-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* reorganize some stuff * one ring to rule them all. * One Ring to find them. --------- Co-authored-by: Ghostipedia <46772882+Ghostipedia@users.noreply.github.com>
- Loading branch information
1 parent
24509b7
commit 44d1b32
Showing
32 changed files
with
510 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/generated/resources/assets/cosmiccore/models/item/the_one_ring.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:item/generated", | ||
"textures": { | ||
"layer0": "cosmiccore:item/the_one_ring" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.ghostipedia.cosmiccore; | ||
|
||
import com.ghostipedia.cosmiccore.common.data.CosmicItems; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraftforge.common.util.LazyOptional; | ||
import org.jetbrains.annotations.Nullable; | ||
import top.theillusivec4.curios.api.CuriosApi; | ||
import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler; | ||
import top.theillusivec4.curios.api.type.inventory.ICurioStacksHandler; | ||
import top.theillusivec4.curios.api.type.inventory.IDynamicStackHandler; | ||
|
||
import java.util.Optional; | ||
|
||
public class CosmicUtils { | ||
|
||
public static boolean hasRing(@Nullable Entity entity) { | ||
if (!(entity instanceof LivingEntity living)) { | ||
return false; | ||
} | ||
|
||
LazyOptional<ICuriosItemHandler> cap = CuriosApi.getCuriosInventory(living); | ||
if (cap.isPresent()) { | ||
ICuriosItemHandler curioHandler = cap.resolve().get(); | ||
Optional<ICurioStacksHandler> handler = curioHandler.getStacksHandler("ring"); | ||
if (handler.isPresent()) { | ||
IDynamicStackHandler stackHandler = handler.get().getStacks(); | ||
for (int i = 0; i < stackHandler.getSlots(); i++) { | ||
ItemStack stack = stackHandler.getStackInSlot(i); | ||
if (stack.is(CosmicItems.THE_ONE_RING.get())) { | ||
return true; | ||
} | ||
} | ||
} | ||
} | ||
return false; | ||
|
||
} | ||
|
||
} |
9 changes: 0 additions & 9 deletions
9
src/main/java/com/ghostipedia/cosmiccore/api/item/component/FluidStats.java
This file was deleted.
Oops, something went wrong.
41 changes: 34 additions & 7 deletions
41
src/main/java/com/ghostipedia/cosmiccore/client/ForgeClientEventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,53 @@ | ||
package com.ghostipedia.cosmiccore.client; | ||
|
||
import com.ghostipedia.cosmiccore.CosmicCore; | ||
import com.ghostipedia.cosmiccore.CosmicUtils; | ||
import com.ghostipedia.cosmiccore.client.renderer.StructureBoundingBox; | ||
import com.mojang.blaze3d.shaders.FogShape; | ||
import net.minecraft.client.renderer.FogRenderer; | ||
import net.minecraftforge.api.distmarker.Dist; | ||
import net.minecraftforge.api.distmarker.OnlyIn; | ||
import net.minecraftforge.client.event.RenderLevelStageEvent; | ||
import net.minecraftforge.client.event.ViewportEvent; | ||
import net.minecraftforge.eventbus.api.SubscribeEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
|
||
@Mod.EventBusSubscriber( | ||
modid = CosmicCore.MOD_ID, | ||
bus = Mod.EventBusSubscriber.Bus.FORGE, | ||
value = Dist.CLIENT) | ||
@OnlyIn(Dist.CLIENT) | ||
@SuppressWarnings("unused") | ||
@Mod.EventBusSubscriber(modid = CosmicCore.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) | ||
public class ForgeClientEventHandler { | ||
|
||
@SubscribeEvent | ||
public static void onRenderWorldLast(RenderLevelStageEvent event) { | ||
var stage = event.getStage(); | ||
if (stage == RenderLevelStageEvent.Stage.AFTER_TRIPWIRE_BLOCKS) { | ||
StructureBoundingBox.renderStructureSelect(event.getPoseStack(), event.getCamera()); | ||
} | ||
} | ||
|
||
@SubscribeEvent | ||
public static void onRenderFog(ViewportEvent.RenderFog event) { | ||
if (CosmicUtils.hasRing(event.getCamera().getEntity())) { | ||
event.setFogShape(FogShape.SPHERE); | ||
|
||
// Shrink the fog to be very close | ||
if (event.getMode() == FogRenderer.FogMode.FOG_SKY) { | ||
event.setFarPlaneDistance(16.0F); | ||
event.setNearPlaneDistance(0.0F); | ||
} else { | ||
event.setFarPlaneDistance(10.0F); | ||
event.setNearPlaneDistance(3.0F); | ||
} | ||
event.setCanceled(true); | ||
} | ||
} | ||
|
||
@SubscribeEvent | ||
public static void onComputeFogColor(ViewportEvent.ComputeFogColor event) { | ||
if (CosmicUtils.hasRing(event.getCamera().getEntity())) { | ||
// and make the fog a blue mist. | ||
// #7CBADA | ||
event.setRed(0.671F); | ||
event.setGreen(0.792F); | ||
event.setBlue(0.855F); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.