From 5c30b51405fc04ccd3fa86cfea4e3c96535c7164 Mon Sep 17 00:00:00 2001 From: EDToaster Date: Sun, 8 Oct 2023 14:36:00 -0700 Subject: [PATCH 01/26] Optimize rendering and clamp node rendering distance --- .../event/ForgeClientEventHandler.java | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java index a825efa8..897bbc63 100644 --- a/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java @@ -102,32 +102,33 @@ private static boolean renderRouteOnStack(RenderLevelStageEvent event, Player pl double baseY = (shape.getName().contains("ascending") ? 0.1 : 0); double baseX = 0; double baseZ = 0; - Runnable mulPose = () -> {}; + var rotation = Axis.ZP.rotationDegrees(0); switch (shape){ case ASCENDING_EAST -> { baseX = 0.2; - mulPose = () -> pose.mulPose(Axis.ZP.rotationDegrees(45)); + rotation = Axis.ZP.rotationDegrees(45); } case ASCENDING_WEST -> { baseX = 0.1; baseY += 0.7; - mulPose = (() -> pose.mulPose(Axis.ZP.rotationDegrees(-45))); + rotation = Axis.ZP.rotationDegrees(-45); } case ASCENDING_NORTH -> { baseZ = 0.1; baseY += 0.7; - mulPose = () -> pose.mulPose(Axis.XP.rotationDegrees(45)); + rotation = Axis.XP.rotationDegrees(45); } case ASCENDING_SOUTH -> { baseZ = 0.2; - mulPose = () -> pose.mulPose(Axis.XP.rotationDegrees(-45)); + rotation = Axis.XP.rotationDegrees(-45); } } pose.translate(block.getX() + baseX - cameraOff.x, block.getY() + baseY - cameraOff.y, block.getZ() + baseZ - cameraOff.z); - AABB a = new AABB(0, 0, 0, 1, 0.2, 1);//.deflate(0.2, 0, 0.2); - mulPose.run(); + pose.mulPose(rotation); + + AABB a = new AABB(0, 0, 0, 1, 0.2, 1); LevelRenderer.renderLineBox(pose, buffer.getBuffer(ModRenderType.LINES), a, 1.0f, 1.0f, 0.3f, 0.5f); pose.popPose(); } @@ -137,7 +138,9 @@ private static boolean renderRouteOnStack(RenderLevelStageEvent event, Player pl if(ShippingConfig.Client.DISABLE_TUG_ROUTE_BEACONS.get()){ return false; } - Vec3 camPos = Minecraft.getInstance().getEntityRenderDispatcher().camera.getPosition(); + + var camera = Minecraft.getInstance().getEntityRenderDispatcher().camera; + var camPos = camera.getPosition(); MultiBufferSource.BufferSource renderTypeBuffer = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); List route = TugRouteItem.getRoute(stack); @@ -163,10 +166,19 @@ private static boolean renderRouteOnStack(RenderLevelStageEvent event, Player pl { matrixStack.pushPose(); - matrixStack.translate(node.getX() - camPos.x - playerDir.x + 0.5, 0, node.getZ() - camPos.z - playerDir.y + 0.5); + + Vec3 nodePos = new Vec3(node.getX() + 0.5 - playerDir.x, camPos.y, node.getZ() + 0.5 - playerDir.y); + Vec3 textRenderPos = computeFixedDistance(nodePos, camPos, 1.0); + + matrixStack.translate(textRenderPos.x - camPos.x, textRenderPos.y - camPos.y, textRenderPos.z - camPos.z); + matrixStack.mulPose(Axis.YP.rotationDegrees(-camera.getYRot())); + matrixStack.mulPose(Axis.XP.rotationDegrees(camera.getXRot())); matrixStack.scale(-0.025F, -0.025F, -0.025F); - matrixStack.mulPose(Minecraft.getInstance().getEntityRenderDispatcher().cameraOrientation()); +// matrixStack.translate(node.getX() - camPos.x - playerDir.x + 0.5, 0, node.getZ() - camPos.z - playerDir.y + 0.5); +// matrixStack.scale(-0.025F, -0.025F, -0.025F); +// +// matrixStack.mulPose(Minecraft.getInstance().getEntityRenderDispatcher().cameraOrientation()); Matrix4f matrix4f = matrixStack.last().pose(); From 2face32139eaa7bca371ff6acdd8a08f3a4fafac Mon Sep 17 00:00:00 2001 From: EDToaster Date: Sun, 8 Oct 2023 15:18:35 -0700 Subject: [PATCH 02/26] Barrel barge v1 --- .../dev/murad/shipping/data/ModRecipeProvider.java | 9 +++++++++ .../entity/custom/vessel/barge/ChestBargeEntity.java | 10 +++++++--- .../murad/shipping/entity/models/ChestBargeModel.java | 3 --- .../murad/shipping/event/ModClientEventHandler.java | 8 +++----- .../java/dev/murad/shipping/setup/ModEntityTypes.java | 7 +++++++ .../dev/murad/shipping/setup/ModEventBusEvents.java | 1 + src/main/java/dev/murad/shipping/setup/ModItems.java | 11 ++++++++++- 7 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/main/java/dev/murad/shipping/data/ModRecipeProvider.java b/src/main/java/dev/murad/shipping/data/ModRecipeProvider.java index 508278e0..87a14244 100644 --- a/src/main/java/dev/murad/shipping/data/ModRecipeProvider.java +++ b/src/main/java/dev/murad/shipping/data/ModRecipeProvider.java @@ -202,6 +202,15 @@ protected void buildRecipes(Consumer consumer) { .unlockedBy("has_item", has(Items.CHEST)) .save(consumer); + ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, ModItems.BARREL_BARGE.get()) + .define('_', Items.BARREL) + .define('#', Items.STICK) + .define('$', Items.IRON_INGOT) + .pattern("#_#") + .pattern("$$$") + .unlockedBy("has_item", has(Items.BARREL)) + .save(consumer); + ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, ModItems.SEATER_BARGE.get()) .define('_', ItemTags.WOODEN_STAIRS) .define('#', ItemTags.SIGNS) diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java index 1e20514f..79e77594 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java @@ -30,8 +30,8 @@ public ChestBargeEntity(EntityType type, Level world super(type, world); } - public ChestBargeEntity(Level worldIn, double x, double y, double z) { - super(ModEntityTypes.CHEST_BARGE.get(), worldIn, x, y, z); + public ChestBargeEntity(EntityType type, Level world, double x, double y, double z) { + super(type, world, x, y, z); } private ItemStackHandler createHandler() { @@ -48,7 +48,11 @@ public void remove(RemovalReason r) { @Override public Item getDropItem() { - return ModItems.CHEST_BARGE.get(); + if (this.getType().equals(ModEntityTypes.BARREL_BARGE.get())) { + return ModItems.BARREL_BARGE.get(); + } else { + return ModItems.CHEST_BARGE.get(); + } } diff --git a/src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java index 7122af2d..81e92aef 100644 --- a/src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java @@ -11,9 +11,6 @@ import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; -// Made with Blockbench 4.1.5 -// Exported for Minecraft version 1.17 with Mojang mappings -// Paste this class into your mod and generate all required imports public class ChestBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "chestbargemodel"), "main"); diff --git a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java index 8ed0ad2c..006af5bf 100644 --- a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java @@ -2,11 +2,7 @@ import dev.murad.shipping.ShippingMod; import dev.murad.shipping.block.fluid.render.FluidHopperTileEntityRenderer; -import dev.murad.shipping.entity.container.AbstractHeadVehicleContainer; -import dev.murad.shipping.entity.custom.train.locomotive.AbstractLocomotiveEntity; -import dev.murad.shipping.entity.custom.vessel.tug.AbstractTugEntity; import dev.murad.shipping.entity.models.*; -import dev.murad.shipping.entity.render.*; import dev.murad.shipping.entity.render.train.FluidTankCarRenderer; import dev.murad.shipping.entity.render.train.TrainCarRenderer; import dev.murad.shipping.entity.render.barge.FishingBargeRenderer; @@ -21,7 +17,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.EntityRenderersEvent; -import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -63,6 +58,9 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender event.registerEntityRenderer(ModEntityTypes.CHEST_BARGE.get(), (ctx) -> new StaticVesselRenderer<>(ctx, ChestBargeModel::new, ChestBargeModel.LAYER_LOCATION, new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/barge.png"))); + event.registerEntityRenderer(ModEntityTypes.BARREL_BARGE.get(), + (ctx) -> new StaticVesselRenderer<>(ctx, ChestBargeModel::new, ChestBargeModel.LAYER_LOCATION, + new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/barge.png"))); event.registerEntityRenderer(ModEntityTypes.CHUNK_LOADER_BARGE.get(), (ctx) -> new StaticVesselRenderer<>(ctx, ChunkLoaderBargeModel::new, ChunkLoaderBargeModel.LAYER_LOCATION, new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/chunk_loader_barge.png"))); diff --git a/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java b/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java index 29495f6b..3cabbab2 100644 --- a/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java +++ b/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java @@ -24,6 +24,13 @@ public class ModEntityTypes { .clientTrackingRange(8) .build(new ResourceLocation(ShippingMod.MOD_ID, "barge").toString())); + public static final RegistryObject> BARREL_BARGE = + Registration.ENTITIES.register("barrel_barge", + () -> EntityType.Builder.of(ChestBargeEntity::new, + MobCategory.MISC).sized(0.6f, 0.9f) + .clientTrackingRange(8) + .build(new ResourceLocation(ShippingMod.MOD_ID, "barrel_barge").toString())); + public static final RegistryObject> CHUNK_LOADER_BARGE = Registration.ENTITIES.register("chunk_loader_barge", () -> EntityType.Builder.of(ChunkLoaderBargeEntity::new, diff --git a/src/main/java/dev/murad/shipping/setup/ModEventBusEvents.java b/src/main/java/dev/murad/shipping/setup/ModEventBusEvents.java index de13bd9f..065c0456 100644 --- a/src/main/java/dev/murad/shipping/setup/ModEventBusEvents.java +++ b/src/main/java/dev/murad/shipping/setup/ModEventBusEvents.java @@ -19,6 +19,7 @@ public static void addEntityAttributes(EntityAttributeCreationEvent event) { event.put(ModEntityTypes.CHUNK_LOADER_BARGE.get(), VesselEntity.setCustomAttributes().build()); event.put(ModEntityTypes.FLUID_TANK_BARGE.get(), VesselEntity.setCustomAttributes().build()); event.put(ModEntityTypes.CHEST_BARGE.get(), VesselEntity.setCustomAttributes().build()); + event.put(ModEntityTypes.BARREL_BARGE.get(), VesselEntity.setCustomAttributes().build()); event.put(ModEntityTypes.SEATER_BARGE.get(), VesselEntity.setCustomAttributes().build()); } } \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/setup/ModItems.java b/src/main/java/dev/murad/shipping/setup/ModItems.java index 9fc25c9d..c6e7b53d 100644 --- a/src/main/java/dev/murad/shipping/setup/ModItems.java +++ b/src/main/java/dev/murad/shipping/setup/ModItems.java @@ -60,7 +60,16 @@ public class ModItems { */ public static final RegistryObject CHEST_BARGE = register("barge", - () -> new VesselItem(new Item.Properties(), ChestBargeEntity::new), ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); + () -> new VesselItem( + new Item.Properties(), + (level, x, y, z) -> new ChestBargeEntity(ModEntityTypes.CHEST_BARGE.get(), level, x, y, z)), + ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); + + public static final RegistryObject BARREL_BARGE = register("barrel_barge", + () -> new VesselItem( + new Item.Properties(), + (level, x, y, z) -> new ChestBargeEntity(ModEntityTypes.BARREL_BARGE.get(), level, x, y, z)), + ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); // public static final RegistryObject CHUNK_LOADER_BARGE = register("chunk_loader_barge", // () -> new VesselItem(new Item.Properties(), ChunkLoaderBargeEntity::new), ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); From e11bd4481b33fbc807853bd097ad10cf1005ea67 Mon Sep 17 00:00:00 2001 From: EDToaster Date: Sun, 8 Oct 2023 15:41:57 -0700 Subject: [PATCH 03/26] Optimize loco route rendering --- .../custom/vessel/barge/ChestBargeEntity.java | 6 +- .../event/ForgeClientEventHandler.java | 91 +++++++++---------- 2 files changed, 46 insertions(+), 51 deletions(-) diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java index 79e77594..c156bd66 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java @@ -24,7 +24,7 @@ import java.util.stream.IntStream; public class ChestBargeEntity extends AbstractBargeEntity implements Container, MenuProvider, WorldlyContainer, TrainInventoryProvider { - protected final ItemStackHandler itemHandler = createHandler(); + protected final ItemStackHandler itemHandler = new ItemStackHandler(27); public ChestBargeEntity(EntityType type, Level world) { super(type, world); @@ -34,10 +34,6 @@ public ChestBargeEntity(EntityType type, Level world super(type, world, x, y, z); } - private ItemStackHandler createHandler() { - return new ItemStackHandler(27); - } - @Override public void remove(RemovalReason r) { if (!this.level().isClientSide) { diff --git a/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java index 897bbc63..e6bb2810 100644 --- a/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java @@ -77,59 +77,58 @@ public ModRenderType(String pName, VertexFormat pFormat, VertexFormat.Mode pMode private static boolean renderRouteOnStack(RenderLevelStageEvent event, Player player, ItemStack stack) { if (stack.getItem().equals(ModItems.LOCO_ROUTE.get())) { - MultiBufferSource.BufferSource buffer = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); - PoseStack pose = event.getPoseStack(); - Vec3 cameraOff = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition(); + var buffer = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); + var pose = event.getPoseStack(); + var cameraOff = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition(); - LocoRoute route = LocoRouteItem.getRoute(stack); - var list = route.stream().map(LocoRouteNode::toBlockPos).collect(Collectors.toList()); - for (BlockPos block : list) { + // Render Beacon Beams + for (var node : LocoRouteItem.getRoute(stack)) { + var block = node.toBlockPos(); pose.pushPose(); - pose.translate(block.getX() - cameraOff.x, 1 - cameraOff.y, block.getZ() - cameraOff.z); - BeaconRenderer.renderBeaconBeam(pose, buffer, BEAM_LOCATION, event.getPartialTick(), - 1F, player.level().getGameTime(), player.level().getMinBuildHeight() + 1, 1024, - DyeColor.YELLOW.getTextureDiffuseColors(), 0.1F, 0.2F); - + { + pose.translate(block.getX() - cameraOff.x, 1 - cameraOff.y, block.getZ() - cameraOff.z); + BeaconRenderer.renderBeaconBeam(pose, buffer, BEAM_LOCATION, event.getPartialTick(), + 1F, player.level().getGameTime(), player.level().getMinBuildHeight() + 1, 1024, + DyeColor.YELLOW.getTextureDiffuseColors(), 0.1F, 0.2F); + } pose.popPose(); - } - - for (BlockPos block : list) { pose.pushPose(); - // handling for removed blocks and blocks out of distance - var shape = RailHelper.getRail(block, player.level()) - .map(pos -> RailHelper.getShape(pos, player.level())) - .orElse(RailShape.EAST_WEST); - double baseY = (shape.getName().contains("ascending") ? 0.1 : 0); - double baseX = 0; - double baseZ = 0; - var rotation = Axis.ZP.rotationDegrees(0); - switch (shape){ - case ASCENDING_EAST -> { - baseX = 0.2; - rotation = Axis.ZP.rotationDegrees(45); - } - case ASCENDING_WEST -> { - baseX = 0.1; - baseY += 0.7; - rotation = Axis.ZP.rotationDegrees(-45); - - } - case ASCENDING_NORTH -> { - baseZ = 0.1; - baseY += 0.7; - rotation = Axis.XP.rotationDegrees(45); - } - case ASCENDING_SOUTH -> { - baseZ = 0.2; - rotation = Axis.XP.rotationDegrees(-45); + { + // handling for removed blocks and blocks out of distance + var shape = RailHelper.getRail(block, player.level()) + .map(pos -> RailHelper.getShape(pos, player.level())) + .orElse(RailShape.EAST_WEST); + double baseY = (shape.isAscending() ? 0.1 : 0); + double baseX = 0; + double baseZ = 0; + var rotation = Axis.ZP.rotationDegrees(0); + switch (shape) { + case ASCENDING_EAST -> { + baseX = 0.2; + rotation = Axis.ZP.rotationDegrees(45); + } + case ASCENDING_WEST -> { + baseX = 0.1; + baseY += 0.7; + rotation = Axis.ZP.rotationDegrees(-45); + } + case ASCENDING_NORTH -> { + baseZ = 0.1; + baseY += 0.7; + rotation = Axis.XP.rotationDegrees(45); + } + case ASCENDING_SOUTH -> { + baseZ = 0.2; + rotation = Axis.XP.rotationDegrees(-45); + } } - } - pose.translate(block.getX() + baseX - cameraOff.x, block.getY() + baseY - cameraOff.y, block.getZ() + baseZ - cameraOff.z); - pose.mulPose(rotation); + pose.translate(block.getX() + baseX - cameraOff.x, block.getY() + baseY - cameraOff.y, block.getZ() + baseZ - cameraOff.z); + pose.mulPose(rotation); - AABB a = new AABB(0, 0, 0, 1, 0.2, 1); - LevelRenderer.renderLineBox(pose, buffer.getBuffer(ModRenderType.LINES), a, 1.0f, 1.0f, 0.3f, 0.5f); + AABB a = new AABB(0, 0, 0, 1, 0.2, 1); + LevelRenderer.renderLineBox(pose, buffer.getBuffer(ModRenderType.LINES), a, 1.0f, 1.0f, 0.3f, 0.5f); + } pose.popPose(); } From 9bbbc839d796db26ec68bee3a3182ad5fa3b96a1 Mon Sep 17 00:00:00 2001 From: EDToaster Date: Sun, 8 Oct 2023 16:54:06 -0700 Subject: [PATCH 04/26] Named train cars drop item with name --- .../custom/train/AbstractTrainCarEntity.java | 42 ++++++++++----- .../locomotive/EnergyLocomotiveEntity.java | 2 +- .../locomotive/SteamLocomotiveEntity.java | 2 +- .../custom/train/wagon/ChestCarEntity.java | 2 +- .../train/wagon/ChunkLoaderCarEntity.java | 2 +- .../train/wagon/FluidTankCarEntity.java | 2 +- .../custom/train/wagon/SeaterCarEntity.java | 2 +- .../entity/custom/vessel/VesselEntity.java | 33 +++++++----- .../event/ForgeClientEventHandler.java | 54 +++++++++++-------- 9 files changed, 84 insertions(+), 57 deletions(-) diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java index 8cd293d5..44efe73d 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java @@ -11,6 +11,7 @@ import dev.murad.shipping.util.RailHelper; import dev.murad.shipping.util.Train; import lombok.Getter; +import lombok.NonNull; import lombok.Setter; import net.minecraft.Util; import net.minecraft.core.BlockPos; @@ -62,7 +63,7 @@ public abstract class AbstractTrainCarEntity extends AbstractMinecart implements @Setter private boolean frozen = false; - private static final Map> EXITS = Util.make(Maps.newEnumMap(RailShape.class), (p_38135_) -> { + private static final Map> EXITS = Util.make(Maps.newEnumMap(RailShape.class), (enumMap) -> { Vec3i west = Direction.WEST.getNormal(); Vec3i east = Direction.EAST.getNormal(); Vec3i north = Direction.NORTH.getNormal(); @@ -71,16 +72,16 @@ public abstract class AbstractTrainCarEntity extends AbstractMinecart implements Vec3i eastUnder = east.below(); Vec3i northUnder = north.below(); Vec3i southUnder = south.below(); - p_38135_.put(RailShape.NORTH_SOUTH, Pair.of(north, south)); - p_38135_.put(RailShape.EAST_WEST, Pair.of(west, east)); - p_38135_.put(RailShape.ASCENDING_EAST, Pair.of(westUnder, east)); - p_38135_.put(RailShape.ASCENDING_WEST, Pair.of(west, eastUnder)); - p_38135_.put(RailShape.ASCENDING_NORTH, Pair.of(north, southUnder)); - p_38135_.put(RailShape.ASCENDING_SOUTH, Pair.of(northUnder, south)); - p_38135_.put(RailShape.SOUTH_EAST, Pair.of(south, east)); - p_38135_.put(RailShape.SOUTH_WEST, Pair.of(south, west)); - p_38135_.put(RailShape.NORTH_WEST, Pair.of(north, west)); - p_38135_.put(RailShape.NORTH_EAST, Pair.of(north, east)); + enumMap.put(RailShape.NORTH_SOUTH, Pair.of(north, south)); + enumMap.put(RailShape.EAST_WEST, Pair.of(west, east)); + enumMap.put(RailShape.ASCENDING_EAST, Pair.of(westUnder, east)); + enumMap.put(RailShape.ASCENDING_WEST, Pair.of(west, eastUnder)); + enumMap.put(RailShape.ASCENDING_NORTH, Pair.of(north, southUnder)); + enumMap.put(RailShape.ASCENDING_SOUTH, Pair.of(northUnder, south)); + enumMap.put(RailShape.SOUTH_EAST, Pair.of(south, east)); + enumMap.put(RailShape.SOUTH_WEST, Pair.of(south, west)); + enumMap.put(RailShape.NORTH_WEST, Pair.of(north, west)); + enumMap.put(RailShape.NORTH_EAST, Pair.of(north, east)); }); private static Pair exits(RailShape pShape) { @@ -91,10 +92,11 @@ public AbstractTrainCarEntity(EntityType entityType, Level level) { super(entityType, level); linkingHandler.train = new Train<>(this); railHelper = new RailHelper(this); + resetAttributes(); } - public AbstractTrainCarEntity(EntityType p_38087_, Level level, double x, double y, double z) { - super(p_38087_, level, x, y, z); + public AbstractTrainCarEntity(EntityType entityType, Level level, double x, double y, double z) { + super(entityType, level, x, y, z); var pos = BlockPos.containing(x, y, z); var state = level().getBlockState(pos); if (state.getBlock() instanceof BaseRailBlock railBlock) { @@ -104,6 +106,11 @@ public AbstractTrainCarEntity(EntityType p_38087_, Level level, double x, dou } linkingHandler.train = new Train<>(this); railHelper = new RailHelper(this); + resetAttributes(); + } + + private void resetAttributes() { + setCustomNameVisible(true); } protected Optional getRailShape() { @@ -454,7 +461,13 @@ public void destroy(@NotNull DamageSource pSource) { int i = (int) Stream.of(linkingHandler.leader, linkingHandler.follower).filter(Optional::isPresent).count(); this.remove(Entity.RemovalReason.KILLED); if (this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { - this.spawnAtLocation(this.getPickResult()); + var stack = this.getPickResult(); + + if (this.hasCustomName()) { + stack.setHoverName(this.getCustomName()); + } + + this.spawnAtLocation(stack); for (int j = 0; j < i; j++) { spawnChain(); } @@ -684,6 +697,7 @@ private static void createLinks(AbstractTrainCarEntity dominant, AbstractTrainCa } @Override + @NonNull public abstract ItemStack getPickResult(); diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/EnergyLocomotiveEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/EnergyLocomotiveEntity.java index 60abb740..69304ecc 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/EnergyLocomotiveEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/EnergyLocomotiveEntity.java @@ -142,7 +142,7 @@ protected boolean tickFuel() { @Override - public ItemStack getPickResult() { + public @NotNull ItemStack getPickResult() { return new ItemStack(ModItems.ENERGY_LOCOMOTIVE.get()); } diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/SteamLocomotiveEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/SteamLocomotiveEntity.java index 5f5b6558..491f1321 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/SteamLocomotiveEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/SteamLocomotiveEntity.java @@ -138,7 +138,7 @@ public SteamLocomotiveEntity(Level level, Double x, Double y, Double z) { @Override - public ItemStack getPickResult() { + public @NotNull ItemStack getPickResult() { return new ItemStack(ModItems.STEAM_LOCOMOTIVE.get()); } diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java index b46088ee..518dc422 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java @@ -49,7 +49,7 @@ private ItemStackHandler createHandler() { } @Override - public ItemStack getPickResult() { + public @NotNull ItemStack getPickResult() { return new ItemStack(ModItems.CHEST_CAR.get()); } diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChunkLoaderCarEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChunkLoaderCarEntity.java index 14f43687..9eba9945 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChunkLoaderCarEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChunkLoaderCarEntity.java @@ -25,7 +25,7 @@ public ChunkLoaderCarEntity(Level level, Double aDouble, Double aDouble1, Double } @Override - public ItemStack getPickResult() { + public @NotNull ItemStack getPickResult() { return new ItemStack(ModItems.SEATER_CAR.get()); } diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/FluidTankCarEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/FluidTankCarEntity.java index a2291b49..6f0d8e18 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/FluidTankCarEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/FluidTankCarEntity.java @@ -56,7 +56,7 @@ public FluidTankCarEntity(Level level, Double aDouble, Double aDouble1, Double a } @Override - public ItemStack getPickResult() { + public @NotNull ItemStack getPickResult() { return new ItemStack(ModItems.FLUID_CAR.get()); } diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/SeaterCarEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/SeaterCarEntity.java index 78d2babf..ba3ce4f5 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/SeaterCarEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/SeaterCarEntity.java @@ -42,7 +42,7 @@ private void initCompat() { } @Override - public ItemStack getPickResult() { + public @NotNull ItemStack getPickResult() { return new ItemStack(ModItems.SEATER_CAR.get()); } diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java index 4b3b56a4..ffb5a921 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java @@ -2,7 +2,6 @@ import dev.murad.shipping.ShippingConfig; import dev.murad.shipping.entity.custom.TrainInventoryProvider; -import dev.murad.shipping.entity.custom.vessel.barge.ChestBargeEntity; import dev.murad.shipping.setup.ModItems; import dev.murad.shipping.util.LinkableEntity; import dev.murad.shipping.util.LinkingHandler; @@ -35,6 +34,7 @@ import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.NameTagItem; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; @@ -63,6 +63,9 @@ import java.util.stream.Stream; public abstract class VesselEntity extends WaterAnimal implements LinkableEntity { + + private final static double NAMETAG_RENDERING_DISTANCE = 15; + @Getter @Setter private boolean frozen = false; @@ -73,8 +76,8 @@ public abstract class VesselEntity extends WaterAnimal implements LinkableEntity protected VesselEntity(EntityType type, Level world) { super(type, world); stuckCounter = 0; - resetSpeedAttributes(); - setSpeedAttributes(ShippingConfig.Server.TUG_BASE_SPEED.get()); + + resetAttributes(ShippingConfig.Server.TUG_BASE_SPEED.get()); } private int stuckCounter; @@ -134,6 +137,7 @@ public static AttributeSupplier.Builder setCustomAttributes() { return Mob.createMobAttributes() .add(Attributes.MAX_HEALTH, 20.0D) .add(Attributes.MOVEMENT_SPEED, 0.0D) + .add(ForgeMod.NAMETAG_DISTANCE.get(), NAMETAG_RENDERING_DISTANCE) .add(ForgeMod.SWIM_SPEED.get(), 0.0D); } @@ -166,22 +170,23 @@ public void onSyncedDataUpdated(@NotNull EntityDataAccessor key) { // reset speed to 1 - private void resetSpeedAttributes() { + private void resetAttributes(double newSpeed) { this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(0); this.getAttribute(ForgeMod.SWIM_SPEED.get()).setBaseValue(0); - } - private void setSpeedAttributes(double speed) { this.getAttribute(Attributes.MOVEMENT_SPEED) .addTransientModifier( - new AttributeModifier("movementspeed_mult", speed, AttributeModifier.Operation.ADDITION)); + new AttributeModifier("movementspeed_mult", newSpeed, AttributeModifier.Operation.ADDITION)); this.getAttribute(ForgeMod.SWIM_SPEED.get()) .addTransientModifier( - new AttributeModifier("swimspeed_mult", speed, AttributeModifier.Operation.ADDITION)); + new AttributeModifier("swimspeed_mult", newSpeed, AttributeModifier.Operation.ADDITION)); + + setCustomNameVisible(true); + this.getAttribute(ForgeMod.NAMETAG_DISTANCE.get()).setBaseValue(NAMETAG_RENDERING_DISTANCE); } @Override - protected void handleAirSupply(int p_209207_1_) { + protected void handleAirSupply(int airSupply) { this.setAirSupply(300); } @@ -517,9 +522,9 @@ public boolean hurt(DamageSource damageSource, float p_70097_2_) { // LivingEntity override, to avoid jumping out of water @Override - public void travel(Vec3 p_213352_1_) { + public void travel(Vec3 relative) { if (this.isEffectiveAi() || this.isControlledByLocalInstance()) { - double d0 = 0.08D; + double d0; AttributeInstance gravity = this.getAttribute(net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY.get()); boolean flag = this.getDeltaMovement().y <= 0.0D; d0 = gravity.getValue(); @@ -548,7 +553,7 @@ public void travel(Vec3 p_213352_1_) { } f6 *= (float) swimSpeed(); - this.moveRelative(f6, p_213352_1_); + this.moveRelative(f6, relative); this.move(MoverType.SELF, this.getDeltaMovement()); Vec3 vector3d6 = this.getDeltaMovement(); if (this.horizontalCollision && this.onClimbable()) { @@ -580,7 +585,7 @@ public void travel(Vec3 p_213352_1_) { } } else if (this.isInLava() && this.isAffectedByFluids() && !this.canStandOnFluid(fluidstate)) { double d7 = this.getY(); - this.moveRelative(0.02F, p_213352_1_); + this.moveRelative(0.02F, relative); this.move(MoverType.SELF, this.getDeltaMovement()); if (this.getFluidHeight(FluidTags.LAVA) <= this.getFluidJumpThreshold()) { this.setDeltaMovement(this.getDeltaMovement().multiply(0.5D, (double) 0.8F, 0.5D)); @@ -644,7 +649,7 @@ public void travel(Vec3 p_213352_1_) { BlockPos blockpos = this.getBlockPosBelowThatAffectsMyMovement(); float f3 = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getFriction(level(), this.getBlockPosBelowThatAffectsMyMovement(), this); float f4 = this.onGround() ? f3 * 0.91F : 0.91F; - Vec3 vector3d5 = this.handleRelativeFrictionAndCalculateMovement(p_213352_1_, f3); + Vec3 vector3d5 = this.handleRelativeFrictionAndCalculateMovement(relative, f3); double d2 = vector3d5.y; if (this.hasEffect(MobEffects.LEVITATION)) { d2 += (0.05D * (double) (this.getEffect(MobEffects.LEVITATION).getAmplifier() + 1) - vector3d5.y) * 0.2D; diff --git a/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java index e6bb2810..e3d9c997 100644 --- a/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java @@ -13,10 +13,7 @@ import dev.murad.shipping.network.client.VehicleTrackerPacketHandler; import dev.murad.shipping.setup.EntityItemMap; import dev.murad.shipping.setup.ModItems; -import dev.murad.shipping.util.LocoRoute; -import dev.murad.shipping.util.LocoRouteNode; -import dev.murad.shipping.util.RailHelper; -import dev.murad.shipping.util.TugRouteNode; +import dev.murad.shipping.util.*; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.renderer.LevelRenderer; @@ -26,6 +23,7 @@ import net.minecraft.client.renderer.blockentity.BeaconRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; @@ -43,7 +41,9 @@ import org.joml.Matrix4f; import org.joml.Vector2d; +import javax.annotation.Nullable; import java.util.List; +import java.util.Optional; import java.util.OptionalDouble; import java.util.stream.Collectors; @@ -141,8 +141,8 @@ private static boolean renderRouteOnStack(RenderLevelStageEvent event, Player pl var camera = Minecraft.getInstance().getEntityRenderDispatcher().camera; var camPos = camera.getPosition(); - MultiBufferSource.BufferSource renderTypeBuffer = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); - List route = TugRouteItem.getRoute(stack); + var renderTypeBuffer = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); + TugRoute route = TugRouteItem.getRoute(stack); for (int i = 0, routeSize = route.size(); i < routeSize; i++) { TugRouteNode node = route.get(i); @@ -152,19 +152,17 @@ private static boolean renderRouteOnStack(RenderLevelStageEvent event, Player pl .normalize(0.5); PoseStack matrixStack = event.getPoseStack(); - + matrixStack.pushPose(); { - matrixStack.pushPose(); matrixStack.translate(node.getX() - camPos.x, 0, node.getZ() - camPos.z); BeaconRenderer.renderBeaconBeam(matrixStack, renderTypeBuffer, BEAM_LOCATION, event.getPartialTick(), 1F, player.level().getGameTime(), player.level().getMinBuildHeight(), 1024, DyeColor.ORANGE.getTextureDiffuseColors(), 0.1F, 0.2F); - matrixStack.popPose(); } - + matrixStack.popPose(); + matrixStack.pushPose(); { - matrixStack.pushPose(); Vec3 nodePos = new Vec3(node.getX() + 0.5 - playerDir.x, camPos.y, node.getZ() + 0.5 - playerDir.y); Vec3 textRenderPos = computeFixedDistance(nodePos, camPos, 1.0); @@ -174,19 +172,12 @@ private static boolean renderRouteOnStack(RenderLevelStageEvent event, Player pl matrixStack.mulPose(Axis.XP.rotationDegrees(camera.getXRot())); matrixStack.scale(-0.025F, -0.025F, -0.025F); -// matrixStack.translate(node.getX() - camPos.x - playerDir.x + 0.5, 0, node.getZ() - camPos.z - playerDir.y + 0.5); -// matrixStack.scale(-0.025F, -0.025F, -0.025F); -// -// matrixStack.mulPose(Minecraft.getInstance().getEntityRenderDispatcher().cameraOrientation()); - - Matrix4f matrix4f = matrixStack.last().pose(); - Font fontRenderer = Minecraft.getInstance().font; String text = node.getDisplayName(i); float width = (-fontRenderer.width(text) / (float) 2); - fontRenderer.drawInBatch(text, width, 0.0F, -1, true, matrix4f, renderTypeBuffer, Font.DisplayMode.NORMAL, 0, 15728880); - matrixStack.popPose(); + fontRenderer.drawInBatch(text, width, 0.0F, -1, true, matrixStack.last().pose(), renderTypeBuffer, Font.DisplayMode.NORMAL, 0, 15728880); } + matrixStack.popPose(); } renderTypeBuffer.endBatch(); } else { @@ -217,6 +208,7 @@ public static void onRenderWorldLast(RenderLevelStageEvent event) { Vec3 camPos = camera.getPosition(); for(EntityPosition position : VehicleTrackerPacketHandler.toRender){ + @Nullable Entity entity = player.level().getEntity(position.id()); Vec3 entityPos = entity != null ? entity.getPosition(event.getPartialTick()) : position.pos(); @@ -248,11 +240,27 @@ public static void onRenderWorldLast(RenderLevelStageEvent event) { matrixStack.mulPose(Axis.XP.rotationDegrees(camera.getXRot())); matrixStack.scale(-0.025F, -0.025F, -0.025F); - Matrix4f matrix4f = matrixStack.last().pose(); + Font fontRenderer = Minecraft.getInstance().font; String text = String.format("%.1fm", position.pos().distanceTo(player.position())); - float width = (-fontRenderer.width(text) / (float) 2); - fontRenderer.drawInBatch(text, width, 0.0F, -1, true, matrix4f, renderTypeBuffer, Font.DisplayMode.NORMAL, 0, 15728880); + + fontRenderer.drawInBatch(text, + (-fontRenderer.width(text) / (float) 2), 0.0F, + -1, true, + matrixStack.last().pose(), renderTypeBuffer, + Font.DisplayMode.NORMAL, + 0, 15728880); + + if (entity != null && entity.hasCustomName()) { + var name = entity.getCustomName(); + matrixStack.translate(0, -20, 0); + fontRenderer.drawInBatch(name, + (-fontRenderer.width(name) / (float) 2), 0.0F, + -1, true, + matrixStack.last().pose(), renderTypeBuffer, + Font.DisplayMode.NORMAL, + 0, 15728880); + } } matrixStack.popPose(); } From 51f2e7e5d03d24237c7483cb06f5dc9eb725772a Mon Sep 17 00:00:00 2001 From: EDToaster Date: Sun, 8 Oct 2023 17:07:26 -0700 Subject: [PATCH 05/26] Vessel now has custom name and drops custom name --- .../entity/custom/vessel/VesselEntity.java | 4 +- .../vessel/barge/AbstractBargeEntity.java | 7 ++- .../custom/vessel/tug/AbstractTugEntity.java | 6 ++- .../dev/murad/shipping/item/VesselItem.java | 51 +++++++------------ 4 files changed, 31 insertions(+), 37 deletions(-) diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java index ffb5a921..01ec4e38 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java @@ -503,7 +503,7 @@ public LazyOptional getCapability(@Nonnull Capability cap, @Nullable D } @Override - public boolean hurt(DamageSource damageSource, float p_70097_2_) { + public boolean hurt(DamageSource damageSource, float amount) { if (this.isInvulnerableTo(damageSource)) { return false; } else if (!this.level().isClientSide && !this.isRemoved() && damageSource.getEntity() instanceof Player) { @@ -516,7 +516,7 @@ public boolean hurt(DamageSource damageSource, float p_70097_2_) { this.remove(RemovalReason.KILLED); return true; } else { - return super.hurt(damageSource, p_70097_2_); + return super.hurt(damageSource, amount); } } diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java index f9fd5edb..82a38029 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java @@ -11,6 +11,7 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.Capability; @@ -103,7 +104,11 @@ public void setTrain(Train train) { @Override public void remove(RemovalReason r){ if (!this.level().isClientSide) { - this.spawnAtLocation(this.getDropItem()); + var stack = new ItemStack(this.getDropItem()); + if (this.hasCustomName()) { + stack.setHoverName(this.getCustomName()); + } + this.spawnAtLocation(stack); } super.remove(r); } diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/tug/AbstractTugEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/tug/AbstractTugEntity.java index 5bf77394..51dd0946 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/tug/AbstractTugEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/tug/AbstractTugEntity.java @@ -515,7 +515,11 @@ public void setTrain(Train train) { @Override public void remove(RemovalReason r) { if (!this.level().isClientSide) { - this.spawnAtLocation(this.getDropItem()); + var stack = new ItemStack(this.getDropItem()); + if (this.hasCustomName()) { + stack.setHoverName(this.getCustomName()); + } + this.spawnAtLocation(stack); Containers.dropContents(this.level(), this, this); this.spawnAtLocation(routeItemHandler.getStackInSlot(0)); } diff --git a/src/main/java/dev/murad/shipping/item/VesselItem.java b/src/main/java/dev/murad/shipping/item/VesselItem.java index 5a7935ec..793d7db8 100644 --- a/src/main/java/dev/murad/shipping/item/VesselItem.java +++ b/src/main/java/dev/murad/shipping/item/VesselItem.java @@ -1,41 +1,32 @@ package dev.murad.shipping.item; -import com.mojang.datafixers.util.Function3; -import com.mojang.datafixers.util.Function4; -import net.minecraft.network.chat.Component; +import net.minecraft.stats.Stats; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.stats.Stats; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; -import javax.annotation.Nullable; import java.util.List; -import java.util.Optional; -import java.util.function.BiFunction; public class VesselItem extends Item { - private final Function4 addEntity; - private Optional tooltipLocation = Optional.empty(); - - public VesselItem(Properties p_i48526_2_, Function4 addEntity, String tooltip) { - super( p_i48526_2_); - this.addEntity = addEntity; - this.tooltipLocation = Optional.of(tooltip); + @FunctionalInterface + public interface AddEntityFunction { + Entity apply(Level level, double x, double y, double z); } - public VesselItem(Properties p_i48526_2_, Function4 addEntity) { - super( p_i48526_2_); + private final AddEntityFunction addEntity; + + public VesselItem(Properties props, AddEntityFunction addEntity) { + super(props); this.addEntity = addEntity; } @@ -46,14 +37,13 @@ public InteractionResultHolder use(Level world, Player player, Intera return InteractionResultHolder.pass(itemstack); } else { Vec3 vector3d = player.getViewVector(1.0F); - double d0 = 5.0D; List list = world.getEntities(player, player.getBoundingBox().expandTowards(vector3d.scale(5.0D)).inflate(1.0D), EntitySelector.NO_SPECTATORS.and(Entity::isPickable)); if (!list.isEmpty()) { Vec3 vector3d1 = player.getEyePosition(1.0F); for(Entity entity : list) { - AABB axisalignedbb = entity.getBoundingBox().inflate((double)entity.getPickRadius()); + AABB axisalignedbb = entity.getBoundingBox().inflate(entity.getPickRadius()); if (axisalignedbb.contains(vector3d1)) { return InteractionResultHolder.pass(itemstack); } @@ -61,7 +51,7 @@ public InteractionResultHolder use(Level world, Player player, Intera } if (raytraceresult.getType() == BlockHitResult.Type.BLOCK) { - Entity entity = getEntity(world, raytraceresult); + Entity entity = getEntity(world, itemstack, raytraceresult); entity.setYRot(player.getYRot()); if (!world.noCollision(entity, entity.getBoundingBox().inflate(-0.1D))) { return InteractionResultHolder.fail(itemstack); @@ -82,16 +72,11 @@ public InteractionResultHolder use(Level world, Player player, Intera } } - protected Entity getEntity(Level world, BlockHitResult raytraceresult) { - return addEntity.apply(world, raytraceresult.getLocation().x, raytraceresult.getLocation().y, raytraceresult.getLocation().z); - } - - @Override - public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { - super.appendHoverText(stack, worldIn, tooltip, flagIn); - tooltipLocation.ifPresent(loc -> - tooltip.add(Component.translatable(loc)) - ); + protected Entity getEntity(Level world, ItemStack stack, BlockHitResult raytraceresult) { + Entity e = addEntity.apply(world, raytraceresult.getLocation().x, raytraceresult.getLocation().y, raytraceresult.getLocation().z); + if (stack.hasCustomHoverName()) { + e.setCustomName(stack.getHoverName()); + } + return e; } - } From 37b344824e755267e34b0a5d8ed51134f50d9aec Mon Sep 17 00:00:00 2001 From: EDToaster Date: Sun, 8 Oct 2023 18:17:00 -0700 Subject: [PATCH 06/26] Item collection barge --- .../vessel/barge/VacuumBargeEntity.java | 117 ++++++++++++++++++ .../entity/models/ChunkLoaderBargeModel.java | 5 +- .../shipping/event/ModClientEventHandler.java | 7 ++ .../murad/shipping/setup/ModEntityTypes.java | 7 ++ .../shipping/setup/ModEventBusEvents.java | 1 + .../dev/murad/shipping/setup/ModItems.java | 3 + 6 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java new file mode 100644 index 00000000..834fb6f2 --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java @@ -0,0 +1,117 @@ +package dev.murad.shipping.entity.custom.vessel.barge; + +import com.mojang.datafixers.util.Pair; +import dev.murad.shipping.ShippingConfig; +import dev.murad.shipping.setup.ModEntityTypes; +import dev.murad.shipping.setup.ModItems; +import dev.murad.shipping.util.InventoryUtils; +import dev.murad.shipping.util.LinkableEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.entity.EntityTypeTest; +import net.minecraft.world.level.storage.loot.BuiltInLootTables; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.AABB; +import net.minecraftforge.common.Tags; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.*; + +public class VacuumBargeEntity extends AbstractBargeEntity { + + private static final int ITEM_CHECK_DELAY = 20; + private static final double PICK_RADIUS = 10; + private static final double PICK_HEIGHT = 4; + + + // There's no point in saving this... probably + private int itemCheckDelay = 0; + + public VacuumBargeEntity(EntityType type, Level world) { + super(type, world); + } + public VacuumBargeEntity(Level worldIn, double x, double y, double z) { + super(ModEntityTypes.VACUUM_BARGE.get(), worldIn, x, y, z); + } + + @Override + // Only called on the server side + protected void doInteract(Player player) { + var size = getConnectedInventories().size(); + + player.displayClientMessage( + switch (size) { + case 0 -> Component.translatable("global.littlelogistics.no_connected_inventory_barge"); + default -> Component.translatable("global.littlelogistics.connected_inventory", size); + }, false); + } + + @Override + public void remove(RemovalReason r) { + super.remove(r); + } + + @Override + public void tick(){ + super.tick(); + + if(this.level().isClientSide) { + return; + } + + if (this.itemCheckDelay > 0) { + this.itemCheckDelay--; + return; + } + + // perform item check + AABB searchBox = new AABB(getX(), getY(), getZ(), getX(), getY(), getZ()) + .inflate(PICK_RADIUS, PICK_HEIGHT / 2.0, PICK_RADIUS); + + var items = this.level() + .getEntitiesOfClass(ItemEntity.class, searchBox, (e) -> e.distanceToSqr(this) < (PICK_RADIUS * PICK_RADIUS)); + + if (!items.isEmpty()) { + var inventoryProviders = getConnectedInventories(); + for (var item : items) { + var leftOver = item.getItem(); + for (var provider : inventoryProviders) { + if (leftOver.isEmpty()) { + break; + } + + var itemHandler = provider.getTrainInventoryHandler(); + if (itemHandler.isPresent()) { + leftOver = InventoryUtils.moveItemStackIntoHandler(itemHandler.get(), leftOver); + } + } + item.setItem(leftOver); + } + } + this.itemCheckDelay = ITEM_CHECK_DELAY; + } + + @Override + public Item getDropItem() { + return ModItems.VACUUM_BARGE.get(); + } +} diff --git a/src/main/java/dev/murad/shipping/entity/models/ChunkLoaderBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/ChunkLoaderBargeModel.java index 6f21dd9b..97d71864 100644 --- a/src/main/java/dev/murad/shipping/entity/models/ChunkLoaderBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/ChunkLoaderBargeModel.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.entity.custom.vessel.barge.ChunkLoaderBargeEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -11,7 +12,7 @@ import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; -public class ChunkLoaderBargeModel extends EntityModel { +public class ChunkLoaderBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "chunkloaderbargemodel"), "main"); private final ModelPart bb_main; @@ -50,7 +51,7 @@ public static LayerDefinition createBodyLayer() { } @Override - public void setupAnim(ChunkLoaderBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } diff --git a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java index 006af5bf..a2ac646e 100644 --- a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java @@ -58,6 +58,8 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender event.registerEntityRenderer(ModEntityTypes.CHEST_BARGE.get(), (ctx) -> new StaticVesselRenderer<>(ctx, ChestBargeModel::new, ChestBargeModel.LAYER_LOCATION, new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/barge.png"))); + + // TODO: textures and models for barrel event.registerEntityRenderer(ModEntityTypes.BARREL_BARGE.get(), (ctx) -> new StaticVesselRenderer<>(ctx, ChestBargeModel::new, ChestBargeModel.LAYER_LOCATION, new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/barge.png"))); @@ -69,6 +71,11 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender (ctx) -> new StaticVesselRenderer<>(ctx, SeaterBargeModel::new, SeaterBargeModel.LAYER_LOCATION, new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/seater_barge.png"))); + // TODO: properly set up the model + event.registerEntityRenderer(ModEntityTypes.VACUUM_BARGE.get(), + (ctx) -> new StaticVesselRenderer<>(ctx, ChunkLoaderBargeModel::new, ChunkLoaderBargeModel.LAYER_LOCATION, + new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/chunk_loader_barge.png"))); + event.registerEntityRenderer(ModEntityTypes.FISHING_BARGE.get(), FishingBargeRenderer::new); event.registerEntityRenderer(ModEntityTypes.FLUID_TANK_BARGE.get(), FluidTankBargeRenderer::new); diff --git a/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java b/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java index 3cabbab2..1e8fb511 100644 --- a/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java +++ b/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java @@ -59,6 +59,13 @@ public class ModEntityTypes { .clientTrackingRange(8) .build(new ResourceLocation(ShippingMod.MOD_ID, "seater_barge").toString())); + public static final RegistryObject> VACUUM_BARGE = + Registration.ENTITIES.register("vacuum_barge", + () -> EntityType.Builder.of(VacuumBargeEntity::new, + MobCategory.MISC).sized(0.6f, 0.9f) + .clientTrackingRange(8) + .build(new ResourceLocation(ShippingMod.MOD_ID, "vacuum_barge").toString())); + public static final RegistryObject> STEAM_TUG = Registration.ENTITIES.register("tug", () -> EntityType.Builder.of(SteamTugEntity::new, diff --git a/src/main/java/dev/murad/shipping/setup/ModEventBusEvents.java b/src/main/java/dev/murad/shipping/setup/ModEventBusEvents.java index 065c0456..32097c0e 100644 --- a/src/main/java/dev/murad/shipping/setup/ModEventBusEvents.java +++ b/src/main/java/dev/murad/shipping/setup/ModEventBusEvents.java @@ -21,5 +21,6 @@ public static void addEntityAttributes(EntityAttributeCreationEvent event) { event.put(ModEntityTypes.CHEST_BARGE.get(), VesselEntity.setCustomAttributes().build()); event.put(ModEntityTypes.BARREL_BARGE.get(), VesselEntity.setCustomAttributes().build()); event.put(ModEntityTypes.SEATER_BARGE.get(), VesselEntity.setCustomAttributes().build()); + event.put(ModEntityTypes.VACUUM_BARGE.get(), VesselEntity.setCustomAttributes().build()); } } \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/setup/ModItems.java b/src/main/java/dev/murad/shipping/setup/ModItems.java index c6e7b53d..8ee69340 100644 --- a/src/main/java/dev/murad/shipping/setup/ModItems.java +++ b/src/main/java/dev/murad/shipping/setup/ModItems.java @@ -83,6 +83,9 @@ public class ModItems { public static final RegistryObject SEATER_BARGE = register("seater_barge", () -> new VesselItem(new Item.Properties(), SeaterBargeEntity::new), ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); + public static final RegistryObject VACUUM_BARGE = register("vacuum_barge", + () -> new VesselItem(new Item.Properties(), VacuumBargeEntity::new), ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); + public static final RegistryObject STEAM_TUG = register("tug", () -> new VesselItem(new Item.Properties(), SteamTugEntity::new), ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); From a5476c841f9157204c5717ded0029810f8e605aa Mon Sep 17 00:00:00 2001 From: EDToaster Date: Sun, 8 Oct 2023 18:59:24 -0700 Subject: [PATCH 07/26] Render train car name tag --- .../vessel/barge/VacuumBargeEntity.java | 25 ------------------- .../render/train/FluidTankCarRenderer.java | 6 ----- .../entity/render/train/TrainCarRenderer.java | 7 +++++- 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java index 834fb6f2..2f366672 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java @@ -1,40 +1,15 @@ package dev.murad.shipping.entity.custom.vessel.barge; -import com.mojang.datafixers.util.Pair; -import dev.murad.shipping.ShippingConfig; import dev.murad.shipping.setup.ModEntityTypes; import dev.murad.shipping.setup.ModItems; import dev.murad.shipping.util.InventoryUtils; -import dev.murad.shipping.util.LinkableEntity; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.entity.EntityTypeTest; -import net.minecraft.world.level.storage.loot.BuiltInLootTables; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.AABB; -import net.minecraftforge.common.Tags; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.util.LazyOptional; -import org.jetbrains.annotations.NotNull; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.*; public class VacuumBargeEntity extends AbstractBargeEntity { diff --git a/src/main/java/dev/murad/shipping/entity/render/train/FluidTankCarRenderer.java b/src/main/java/dev/murad/shipping/entity/render/train/FluidTankCarRenderer.java index abe7c3a1..af8273b7 100644 --- a/src/main/java/dev/murad/shipping/entity/render/train/FluidTankCarRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/train/FluidTankCarRenderer.java @@ -21,12 +21,6 @@ public FluidTankCarRenderer(EntityRendererProvider.Context context, Function renderCarAndGetAttachmentPoints(T car, float yaw, float renderAdditional(car, yaw, partialTicks, pose, buffer, packedLight); pose.popPose(); + if (car.hasCustomName()) { + this.renderNameTag(car, car.getCustomName(), pose, buffer, packedLight); + } + return attach; } From 64ebdc9361902617842202e5bed91f8fa696467d Mon Sep 17 00:00:00 2001 From: EDToaster Date: Mon, 9 Oct 2023 03:54:50 -0700 Subject: [PATCH 08/26] Dyeable barges v1 --- .../java/dev/murad/shipping/ShippingMod.java | 5 + .../vessel/barge/AbstractBargeEntity.java | 40 ++++- .../custom/vessel/barge/ChestBargeEntity.java | 4 - .../entity/models/BaseBargeModel.java | 51 ++++++ .../entity/models/ChestBargeModel.java | 3 +- .../entity/models/CubeInsertBargeModel.java | 46 ++++++ .../entity/models/RingsInsertBargeModel.java | 62 ++++++++ .../entity/models/TrimBargeModel.java | 51 ++++++ .../render/barge/AbstractVesselRenderer.java | 4 +- .../render/barge/MultipartVesselRenderer.java | 147 ++++++++++++++++++ .../shipping/event/ModClientEventHandler.java | 70 ++++++--- .../textures/entity/barge/barrel_insert.png | Bin 0 -> 1126 bytes .../textures/entity/barge/base.png | Bin 0 -> 413 bytes .../textures/entity/barge/chest_insert.png | Bin 0 -> 483 bytes .../entity/barge/chunk_loader_insert.png | Bin 0 -> 524 bytes .../textures/entity/barge/trim.png | Bin 0 -> 560 bytes .../textures/entity/barge/vacuum_insert.png | Bin 0 -> 559 bytes .../textures/entity/barrel_barge.png | Bin 0 -> 1700 bytes 18 files changed, 450 insertions(+), 33 deletions(-) create mode 100644 src/main/java/dev/murad/shipping/entity/models/BaseBargeModel.java create mode 100644 src/main/java/dev/murad/shipping/entity/models/CubeInsertBargeModel.java create mode 100644 src/main/java/dev/murad/shipping/entity/models/RingsInsertBargeModel.java create mode 100644 src/main/java/dev/murad/shipping/entity/models/TrimBargeModel.java create mode 100644 src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/barrel_insert.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/base.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/chest_insert.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/chunk_loader_insert.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/trim.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/vacuum_insert.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barrel_barge.png diff --git a/src/main/java/dev/murad/shipping/ShippingMod.java b/src/main/java/dev/murad/shipping/ShippingMod.java index e12ee103..d4053762 100644 --- a/src/main/java/dev/murad/shipping/ShippingMod.java +++ b/src/main/java/dev/murad/shipping/ShippingMod.java @@ -10,6 +10,7 @@ import dev.murad.shipping.setup.ModMenuTypes; import dev.murad.shipping.setup.Registration; import net.minecraft.client.gui.screens.MenuScreens; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; @@ -52,4 +53,8 @@ private void doClientStuff(final FMLClientSetupEvent event) { event.enqueueWork(ModItemModelProperties::register); } + + public static ResourceLocation entityTexture(String suffix) { + return new ResourceLocation(ShippingMod.MOD_ID, String.format("textures/entity/%s", suffix)); + } } diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java index 82a38029..bfcc1e69 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java @@ -5,26 +5,40 @@ import dev.murad.shipping.entity.custom.vessel.VesselEntity; import dev.murad.shipping.entity.custom.vessel.tug.AbstractTugEntity; import dev.murad.shipping.util.Train; +import lombok.Getter; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.IntTag; +import net.minecraft.nbt.Tag; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.animal.Sheep; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Optional; public abstract class AbstractBargeEntity extends VesselEntity { + + @Getter + @Nullable + private Integer color; + public AbstractBargeEntity(EntityType type, Level world) { super(type, world); this.blocksBuilding = true; linkingHandler.train = new Train<>(this); + this.color = null; } public AbstractBargeEntity(EntityType type, Level worldIn, double x, double y, double z) { @@ -34,6 +48,7 @@ public AbstractBargeEntity(EntityType type, Level this.xo = x; this.yo = y; this.zo = z; + this.color = null; } @Override @@ -41,15 +56,20 @@ protected boolean canAddPassenger(Entity passenger) { return false; } - public abstract Item getDropItem(); - @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { - if (!this.level().isClientSide) { - doInteract(player); + var color = DyeColor.getColor(player.getItemInHand(hand)); + if (color != null) { + this.color = color.getId(); + } else { + if (!this.level().isClientSide) { + doInteract(player); + } } + + // don't interact *and* use current item return InteractionResult.CONSUME; } @@ -60,6 +80,18 @@ public boolean hasWaterOnSides(){ return super.hasWaterOnSides(); } + @Override + public void addAdditionalSaveData(@NotNull CompoundTag tag) { + super.addAdditionalSaveData(tag); + if (color != null) tag.putInt("Color", color); + } + + @Override + public void readAdditionalSaveData(@NotNull CompoundTag tag) { + super.readAdditionalSaveData(tag); + color = tag.contains("Color", Tag.TAG_INT) ? tag.getInt("Color") : null; + } + @Override public void setDominated(VesselEntity entity) { linkingHandler.follower = Optional.of(entity); diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java index c156bd66..8abab9d2 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/ChestBargeEntity.java @@ -51,12 +51,10 @@ public Item getDropItem() { } } - protected void doInteract(Player player) { player.openMenu(this); } - @Override public int getContainerSize() { return this.itemHandler.getSlots(); @@ -95,7 +93,6 @@ public void setItem(int slot, @NotNull ItemStack stack) { @Override public void setChanged() { - } @Override @@ -109,7 +106,6 @@ public boolean stillValid(Player player) { @Override public void clearContent() { - } @Nullable diff --git a/src/main/java/dev/murad/shipping/entity/models/BaseBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/BaseBargeModel.java new file mode 100644 index 00000000..6d42b0de --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/models/BaseBargeModel.java @@ -0,0 +1,51 @@ +package dev.murad.shipping.entity.models; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.vessel.VesselEntity; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; +import dev.murad.shipping.entity.custom.vessel.barge.ChestBargeEntity; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.*; +import net.minecraft.resources.ResourceLocation; + +public class BaseBargeModel extends EntityModel { + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model"), "main"); + private final ModelPart bb_main; + + public BaseBargeModel(ModelPart root) { + this.bb_main = root.getChild("bb_main"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() + // Main + .texOffs(0, 0).addBox(-6.0F, -27.0F, -7.0F, 12.0F, 5.0F, 14.0F) + // Long Side + .texOffs(0, 19).addBox(-8.0F, -27.0F, -7.0F, 2.0F, 2.0F, 14.0F) + .texOffs(0, 19).addBox(6.0F, -27.0F, -7.0F, 2.0F, 2.0F, 14.0F) + // Short Side + .texOffs(19, 21).addBox(-6.0F, -27.0F, -9.0F, 12.0F, 2.0F, 2.0F) + .texOffs(19, 21).addBox(-6.0F, -27.0F, 7.0F, 12.0F, 2.0F, 2.0F), PartPose.offset(0.0F, 23.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 64, 64); + } + + @Override + public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + bb_main.render(poseStack, buffer, packedLight, packedOverlay); + } +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java index 81e92aef..18e6aae7 100644 --- a/src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java @@ -28,7 +28,8 @@ public static LayerDefinition createBodyLayer() { .texOffs(38, 5).addBox(-8.0F, -29.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) .texOffs(28, 43).addBox(-6.0F, -29.0F, -9.0F, 12.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)) .texOffs(26, 25).addBox(6.0F, -29.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(0, 41).addBox(-6.0F, -29.0F, 7.0F, 12.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 23.0F, 0.0F)); + .texOffs(0, 41).addBox(-6.0F, -29.0F, 7.0F, 12.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 23.0F, 0.0F)); PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 19).addBox(-5.0F, -35.0F, -5.0F, 10.0F, 10.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); diff --git a/src/main/java/dev/murad/shipping/entity/models/CubeInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/CubeInsertBargeModel.java new file mode 100644 index 00000000..92e30e27 --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/models/CubeInsertBargeModel.java @@ -0,0 +1,46 @@ +package dev.murad.shipping.entity.models; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.vessel.VesselEntity; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; +import dev.murad.shipping.entity.custom.vessel.barge.ChestBargeEntity; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.*; +import net.minecraft.resources.ResourceLocation; + +public class CubeInsertBargeModel extends EntityModel { + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "cube_insert_barge_model"), "main"); + private final ModelPart bb_main; + + public CubeInsertBargeModel(ModelPart root) { + this.bb_main = root.getChild("bb_main"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition bb_main = meshdefinition.getRoot() + .addOrReplaceChild("bb_main", + CubeListBuilder.create().texOffs(0, 0) + .addBox(-5.0F, -12.0F, -5.0F, 10.0F, 10.0F, 10.0F, + new CubeDeformation(0.0F)), + PartPose.ZERO); + + return LayerDefinition.create(meshdefinition, 64, 64); + } + + @Override + public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + bb_main.render(poseStack, buffer, packedLight, packedOverlay); + } +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/RingsInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/RingsInsertBargeModel.java new file mode 100644 index 00000000..cfe86823 --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/models/RingsInsertBargeModel.java @@ -0,0 +1,62 @@ +package dev.murad.shipping.entity.models; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.vessel.VesselEntity; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.*; +import net.minecraft.resources.ResourceLocation; + +public class RingsInsertBargeModel extends EntityModel { + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "rings_insert_barge_model"), "main"); + private final ModelPart bb_main; + + public RingsInsertBargeModel(ModelPart root) { + this.bb_main = root.getChild("bb_main"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition main = meshdefinition.getRoot() + .addOrReplaceChild("bb_main", + CubeListBuilder.create() + .texOffs(0, 37).addBox(-2.0F, -33.0F, -2.0F, 4.0F, 4.0F, 4.0F), + PartPose.offset(0.0F, 23.0F, 0.0F)); + + main.addOrReplaceChild("ring", CubeListBuilder.create().texOffs(38, 0).addBox(-5.0F, -29.0F, -5.0F, 10.0F, 2.0F, 2.0F) + .texOffs(36, 31).addBox(-5.0F, -29.0F, 3.0F, 10.0F, 2.0F, 2.0F) + .texOffs(10, 41).addBox(3.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F) + .texOffs(38, 4).addBox(-5.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + main.addOrReplaceChild("ring2", CubeListBuilder.create().texOffs(38, 0).addBox(-5.0F, -29.0F, -5.0F, 10.0F, 2.0F, 2.0F) + .texOffs(36, 31).addBox(-5.0F, -29.0F, 3.0F, 10.0F, 2.0F, 2.0F) + .texOffs(10, 41).addBox(3.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F) + .texOffs(38, 4).addBox(-5.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F), + PartPose.offset(0.0F, -3.0F, 0.0F)); + + main.addOrReplaceChild("ring3", CubeListBuilder.create().texOffs(38, 0).addBox(-5.0F, -29.0F, -5.0F, 10.0F, 2.0F, 2.0F) + .texOffs(36, 31).addBox(-5.0F, -29.0F, 3.0F, 10.0F, 2.0F, 2.0F) + .texOffs(10, 41).addBox(3.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F) + .texOffs(38, 4).addBox(-5.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F), + PartPose.offset(0.0F, -7.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 64, 64); + } + + @Override + public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + bb_main.render(poseStack, buffer, packedLight, packedOverlay); + } +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/TrimBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/TrimBargeModel.java new file mode 100644 index 00000000..8cb9bcf3 --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/models/TrimBargeModel.java @@ -0,0 +1,51 @@ +package dev.murad.shipping.entity.models; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.vessel.VesselEntity; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.resources.ResourceLocation; + +public class TrimBargeModel extends EntityModel { + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "trim_barge_model"), "main"); + private final ModelPart bb_main; + + public TrimBargeModel(ModelPart root) { + this.bb_main = root.getChild("bb_main"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() + // Long Side + .texOffs(0, 0).addBox(-8.0F, -29.0F, -7.0F, 2.0F, 2.0F, 14.0F) + .texOffs(0, 0).addBox(6.0F, -29.0F, -7.0F, 2.0F, 2.0F, 14.0F) + // Short Side + .texOffs(19, 2).addBox(-6.0F, -29.0F, -9.0F, 12.0F, 2.0F, 2.0F) + .texOffs(19, 2).addBox(-6.0F, -29.0F, 7.0F, 12.0F, 2.0F, 2.0F), PartPose.offset(0.0F, 23.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 64, 64); + } + + @Override + public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + bb_main.render(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); + } +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java index 0be3158b..d52b8000 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java @@ -52,11 +52,11 @@ public void render(T vesselEntity, float yaw, float partialTick, PoseStack matri } - private void renderModel(T vesselEntity, PoseStack matrixStack, MultiBufferSource buffer, int p_225623_6_) { + protected void renderModel(T vesselEntity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight) { VertexConsumer ivertexbuilder = buffer.getBuffer(getModel(vesselEntity).renderType(this.getTextureLocation(vesselEntity))); int overlay = LivingEntityRenderer.getOverlayCoords(vesselEntity, 0); - getModel(vesselEntity).renderToBuffer(matrixStack, ivertexbuilder, p_225623_6_, overlay, 1.0F, 1.0F, 1.0F, 1.0F); + getModel(vesselEntity).renderToBuffer(matrixStack, ivertexbuilder, packedLight, overlay, 1.0F, 1.0F, 1.0F, 1.0F); } protected double getModelYoffset() { diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java new file mode 100644 index 00000000..8f12c051 --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java @@ -0,0 +1,147 @@ +package dev.murad.shipping.entity.render.barge; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import dev.murad.shipping.entity.custom.vessel.VesselEntity; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; +import lombok.Getter; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.DyeColor; + +public class MultipartVesselRenderer extends AbstractVesselRenderer { + + @Getter + private final EntityModel baseModel, insertModel, trimModel; + + @Getter + private final ResourceLocation baseTextureLocation, insertTextureLocation, trimTextureLocation; + + private MultipartVesselRenderer(EntityRendererProvider.Context context, + ModelSupplier baseModelSupplier, + ModelLayerLocation baseModelLocation, + ResourceLocation baseTexture, + ModelSupplier insertModelSupplier, + ModelLayerLocation insertModelLocation, + ResourceLocation insertTexture, + ModelSupplier trimModelSupplier, + ModelLayerLocation trimModelLocation, + ResourceLocation trimTexture) { + super(context); + this.baseModel = baseModelSupplier.supply(context.bakeLayer(baseModelLocation)); + this.baseTextureLocation = baseTexture; + + this.insertModel = insertModelSupplier.supply(context.bakeLayer(insertModelLocation)); + this.insertTextureLocation = insertTexture; + + this.trimModel = trimModelSupplier.supply(context.bakeLayer(trimModelLocation)); + this.trimTextureLocation = trimTexture; + } + + /** + * Don't directly use this method, use the multipart methods instead + */ + @Override + @Deprecated + EntityModel getModel(T entity) { + return baseModel; + } + + /** + * Don't directly use this method, use the multipart methods instead + */ + @Override + @Deprecated + public ResourceLocation getTextureLocation(T pEntity) { + return baseTextureLocation; + } + + @Override + protected void renderModel(T vesselEntity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight) { + int overlay = LivingEntityRenderer.getOverlayCoords(vesselEntity, 0); + + var colorId = vesselEntity.getColor(); + var color = (colorId == null ? DyeColor.RED : DyeColor.byId(colorId)).getTextureDiffuseColors(); + + baseModel.renderToBuffer(matrixStack, + buffer.getBuffer(baseModel.renderType(baseTextureLocation)), + packedLight, overlay, + 1.0F, 1.0F, 1.0F, 1.0F); + + insertModel.renderToBuffer(matrixStack, + buffer.getBuffer(insertModel.renderType(insertTextureLocation)), + packedLight, overlay, + 1.0F, 1.0F, 1.0F, 1.0F); + + trimModel.renderToBuffer(matrixStack, + buffer.getBuffer(trimModel.renderType(trimTextureLocation)), + packedLight, overlay, + color[0], color[1], color[2], 1.0F); + } + + @FunctionalInterface + public interface ModelSupplier { + EntityModel supply(ModelPart root); + } + + public static class Builder { + private final EntityRendererProvider.Context context; + + private ModelSupplier baseModelSupplier; + private ModelLayerLocation baseModelLocation; + private ResourceLocation baseModelTexture; + + private ModelSupplier insertModelSupplier; + private ModelLayerLocation insertModelLocation; + private ResourceLocation insertModelTexture; + + private ModelSupplier trimModelSupplier; + private ModelLayerLocation trimModelLocation; + private ResourceLocation trimModelTexture; + + + public Builder(EntityRendererProvider.Context context) { + this.context = context; + } + + public Builder baseModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.baseModelSupplier = supplier; + this.baseModelLocation = location; + this.baseModelTexture = texture; + return this; + } + + public Builder insertModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.insertModelSupplier = supplier; + this.insertModelLocation = location; + this.insertModelTexture = texture; + return this; + } + + public Builder trimModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.trimModelSupplier = supplier; + this.trimModelLocation = location; + this.trimModelTexture = texture; + return this; + } + + public MultipartVesselRenderer build() { + return new MultipartVesselRenderer<>(context, + baseModelSupplier, baseModelLocation, baseModelTexture, + insertModelSupplier, insertModelLocation, insertModelTexture, + trimModelSupplier, trimModelLocation, trimModelTexture); + } + + } +} diff --git a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java index a2ac646e..f3d5a98b 100644 --- a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java @@ -3,6 +3,7 @@ import dev.murad.shipping.ShippingMod; import dev.murad.shipping.block.fluid.render.FluidHopperTileEntityRenderer; import dev.murad.shipping.entity.models.*; +import dev.murad.shipping.entity.render.barge.MultipartVesselRenderer; import dev.murad.shipping.entity.render.train.FluidTankCarRenderer; import dev.murad.shipping.entity.render.train.TrainCarRenderer; import dev.murad.shipping.entity.render.barge.FishingBargeRenderer; @@ -29,14 +30,6 @@ @Mod.EventBusSubscriber(modid = ShippingMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class ModClientEventHandler { -// @SubscribeEvent -// public static void onTextureStitchEventPre(TextureStitchEvent.Pre event) { -// if (event.getAtlas().location() != AbstractHeadVehicleContainer.EMPTY_ATLAS_LOC) return; -// event.addSprite(ModItems.LOCO_ROUTE_ICON); -// event.addSprite(ModItems.TUG_ROUTE_ICON); -// event.addSprite(ModItems.EMPTY_ENERGY); -// } - @SubscribeEvent public static void onRenderTypeSetup(FMLClientSetupEvent event) { event.enqueueWork(() -> { @@ -56,29 +49,53 @@ public static void onRenderTypeSetup(FMLClientSetupEvent event) { public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRenderers event) { // Barges event.registerEntityRenderer(ModEntityTypes.CHEST_BARGE.get(), - (ctx) -> new StaticVesselRenderer<>(ctx, ChestBargeModel::new, ChestBargeModel.LAYER_LOCATION, - new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/barge.png"))); + (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) + .baseModel(BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/base.png")) + .insertModel(CubeInsertBargeModel::new, CubeInsertBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/chest_insert.png")) + .trimModel(TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/trim.png")) + .build()); - // TODO: textures and models for barrel event.registerEntityRenderer(ModEntityTypes.BARREL_BARGE.get(), - (ctx) -> new StaticVesselRenderer<>(ctx, ChestBargeModel::new, ChestBargeModel.LAYER_LOCATION, - new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/barge.png"))); + (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) + .baseModel(BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/base.png")) + .insertModel(CubeInsertBargeModel::new, CubeInsertBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/barrel_insert.png")) + .trimModel(TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/trim.png")) + .build()); + event.registerEntityRenderer(ModEntityTypes.CHUNK_LOADER_BARGE.get(), - (ctx) -> new StaticVesselRenderer<>(ctx, ChunkLoaderBargeModel::new, ChunkLoaderBargeModel.LAYER_LOCATION, - new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/chunk_loader_barge.png"))); + (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) + .baseModel(BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/base.png")) + .insertModel(RingsInsertBargeModel::new, RingsInsertBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/chunk_loader_insert.png")) + .trimModel(TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/trim.png")) + .build()); event.registerEntityRenderer(ModEntityTypes.SEATER_BARGE.get(), (ctx) -> new StaticVesselRenderer<>(ctx, SeaterBargeModel::new, SeaterBargeModel.LAYER_LOCATION, new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/seater_barge.png"))); - // TODO: properly set up the model event.registerEntityRenderer(ModEntityTypes.VACUUM_BARGE.get(), - (ctx) -> new StaticVesselRenderer<>(ctx, ChunkLoaderBargeModel::new, ChunkLoaderBargeModel.LAYER_LOCATION, - new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/chunk_loader_barge.png"))); + (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) + .baseModel(BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/base.png")) + .insertModel(RingsInsertBargeModel::new, RingsInsertBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/vacuum_insert.png")) + .trimModel(TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/trim.png")) + .build()); - event.registerEntityRenderer(ModEntityTypes.FISHING_BARGE.get(), FishingBargeRenderer::new); event.registerEntityRenderer(ModEntityTypes.FLUID_TANK_BARGE.get(), FluidTankBargeRenderer::new); + event.registerEntityRenderer(ModEntityTypes.FISHING_BARGE.get(), FishingBargeRenderer::new); + // Tugs event.registerEntityRenderer(ModEntityTypes.ENERGY_TUG.get(), (ctx) -> new StaticVesselRenderer<>(ctx, EnergyTugModel::new, EnergyTugModel.LAYER_LOCATION, @@ -142,15 +159,24 @@ protected float getModelYrot() { public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterLayerDefinitions event) { event.registerLayerDefinition(ChainExtendedModel.LAYER_LOCATION, ChainExtendedModel::createBodyLayer); event.registerLayerDefinition(ChainModel.LAYER_LOCATION, ChainModel::createBodyLayer); + + event.registerLayerDefinition(BaseBargeModel.LAYER_LOCATION, BaseBargeModel::createBodyLayer); + event.registerLayerDefinition(TrimBargeModel.LAYER_LOCATION, TrimBargeModel::createBodyLayer); + event.registerLayerDefinition(CubeInsertBargeModel.LAYER_LOCATION, CubeInsertBargeModel::createBodyLayer); + event.registerLayerDefinition(RingsInsertBargeModel.LAYER_LOCATION, RingsInsertBargeModel::createBodyLayer); + + event.registerLayerDefinition(FluidTankBargeModel.LAYER_LOCATION, FluidTankBargeModel::createBodyLayer); + event.registerLayerDefinition(SeaterBargeModel.LAYER_LOCATION, SeaterBargeModel::createBodyLayer); event.registerLayerDefinition(ChestBargeModel.LAYER_LOCATION, ChestBargeModel::createBodyLayer); event.registerLayerDefinition(ChunkLoaderBargeModel.LAYER_LOCATION, ChunkLoaderBargeModel::createBodyLayer); - event.registerLayerDefinition(EnergyTugModel.LAYER_LOCATION, EnergyTugModel::createBodyLayer); + event.registerLayerDefinition(FishingBargeDeployedModel.LAYER_LOCATION, FishingBargeDeployedModel::createBodyLayer); event.registerLayerDefinition(FishingBargeModel.LAYER_LOCATION, FishingBargeModel::createBodyLayer); event.registerLayerDefinition(FishingBargeTransitionModel.LAYER_LOCATION, FishingBargeTransitionModel::createBodyLayer); - event.registerLayerDefinition(FluidTankBargeModel.LAYER_LOCATION, FluidTankBargeModel::createBodyLayer); - event.registerLayerDefinition(SeaterBargeModel.LAYER_LOCATION, SeaterBargeModel::createBodyLayer); + + event.registerLayerDefinition(EnergyTugModel.LAYER_LOCATION, EnergyTugModel::createBodyLayer); event.registerLayerDefinition(SteamTugModel.LAYER_LOCATION, SteamTugModel::createBodyLayer); + event.registerLayerDefinition(SteamLocomotiveModel.LAYER_LOCATION, SteamLocomotiveModel::createBodyLayer); event.registerLayerDefinition(EnergyLocomotiveModel.LAYER_LOCATION, EnergyLocomotiveModel::createBodyLayer); event.registerLayerDefinition(ChestCarModel.LAYER_LOCATION, ChestCarModel::createBodyLayer); diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/barrel_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/barrel_insert.png new file mode 100644 index 0000000000000000000000000000000000000000..e0f7bc63e04ce41f94d124af55bcb5e341296255 GIT binary patch literal 1126 zcmV-s1eyDZP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TXCDPp*AlfrM2JV83UwcB)Yn<6ieDtQm5Ocx+P;1~#$ z7`{@Xc-#9fH~$P31gXLlD>A_O8jjAMC1=ikWMM;|eer4Sx;8An5vK*ZZ4X6N!>TK| zj)O&TCPMOmY+fheu;ma_MY0(k`F{VojcZ7`%puHW? zqqqA$J?+5ep#o3A_Z*D&eeWRSanw!1wf;;ZCog4g(&(GSP8o&}V9_(Dq!u=)tiRx*Z?44?-Lr_D~k9 z>u=pY8yi3$RIvcO>pjGa@}p}h=yjJyQLGIXnBB;W3a`df%+nGdrV*k=jLDRdFpKfW zhbz3fjHt`p*%3B2fbB56uh%ChCkTAotm8B{pE^b8b~@a_=}{j?{Q#p|A?}_Y;CR%- z@i4^6u!qq>8;-MncNf^$05x;F!`yY>{DA$-=SH@OOXf4foMa4ZW(ET4Bg!ej6y+=GLmu|$9E2Sf!@lz zJgzWjNdJ01HpOf_jZJv}C7Uykx24xK)`NQ=*E&RPj;>1C98z@AO3XvoaXHUB$XL8| z>)M9iPrtluGy<%rpWm-_E2}Dn^VegX9Uq#?-3=U0b_y4ZISzY0wzAB$yqng0_I
    vmNzAA?SpZNXxGro8St zY* z3oJ&_l9p$I%JOvuZu>q*+tjQzH?8;ci{EIL=CGc8cE4`>>tgi#+Y6lC8SoyTq1XAR zEJ-tN>gM&n`mW(3$g8^f=Z4<`_Bhe`p5g@ew@lCXTDC1cK@bE%5ClOG1VIo4K@bE% s5ClOG1VIo4K@bE%5ClOGg#QlkC(I-}>YDpvAOHXW07*qoM6N<$f|rpMRsaA1 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/base.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/base.png new file mode 100644 index 0000000000000000000000000000000000000000..f3b7f18a6971b1d30ad1cee934756656d3cbc13e GIT binary patch literal 413 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!7>k44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O`211o(uw8f$4eSz8BqcmM@1No2Nz)RhGJ1^@s5pTR+E?f0SgQhu%f^5I=gT)wUKpret+#V_TLY(W>U)8SNh?0g zdf9Ms!M29QvOW?yTm2R0q**=4+90_}bp1>|37%77S(CYdERW`|Z11i={BC}>Z2e}F-9G6B7p^7N-tl5> zbX{XDc`svW0#E(w-5sUs7g>VWm~Bw?*;vJtBl*-jOkeTO)&4*E3>%8d-|U)Ey8VUj z_U1HxlU~Euc{62xcu6f`^k_C=$eh5Y!29hl`*AKUtwgoMD!`y(@O1TaS?83{1OSEq BqCfxu literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/chest_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/chest_insert.png new file mode 100644 index 0000000000000000000000000000000000000000..e86220b1b3530e11d9e7f0c786af56864e9733e2 GIT binary patch literal 483 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!7>k44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O`1!1o(uwYOBec8>+V?>DR|AP0i7pkfzm_sJ19ud3m1v>Pp@IOxYzx>XVX{ zjrCO9+S(2sI%H;`R#sNFbm>x{0elmAK<0{+1o;L3#{>-i{?7%0@|*=8k;OpOhe4R} zc>anMpu+?_T^vIq+}}>RIH_5I$Fw%fCaS?ZtjO2@^DW5k@nY7?$I;+7m%jZFE0*_BP zh~Ihn;BpDOVIR+z_>QFyc6##wRnFm>)^mQ&h6PeU?Fk;5#~w?qE=*a#ed|X@LCS)1 z;oT4O7p;49?6>umE1d^hKmO}u$bIEgUA?g6L}~0x*FQE9uZ7aw&-}J_n!QW?!SesL zOQ)pxzWK{}>x%8kBpcsFOWYi1?@BA!3O2yeROiLDHQ8^T^Xv6|FTXJTUE8yi-O}3+ zysv-E8s|{aC@v89fVD-ug7G1cTT^>*+h4}D34AgvViCQ-0AuiU^>bP0l+XkKqYlr= literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/chunk_loader_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/chunk_loader_insert.png new file mode 100644 index 0000000000000000000000000000000000000000..8adfcb62e97bbb4bec159f8f1048a5afb4113b48 GIT binary patch literal 524 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!7>k44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O_~e1o(uwit8IHSlO6(dh;u*>exA`dsy0JCnU|z5;v3!&5kYEp3N#MbNbI+ z0cBkdEp3n?(mrxPN}wdjFZe$yV0fS$D+!e2EbxddW?lsT3E`>t=OoyG$m0{rNQxyj*bhf6gT($ ztp^rv-|#?0Ak(5#z(XoR%7WG6V@ln0j*#WhT!4&hce=@cCsk6|@X` zo;Ug$JBBk44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O`074)6(aoiu4uZf@?hY10Y|3ol)|w0QC2>C>lQzI^${jT>|3%(-^$+SRL9 zuV25uV8Mb57cMMZxNyRR2@@wyEGjCRJ9qBIix=n5pFd;9j44y5ELyba?Af!uy}kAI z^`)hy6%`d*wrtt4W5>*yGpnkq>gwvIPMx}B$&xc?&YU}U?!<``t5>hi&dy%8Y}u(( zry3g@H*MN9d-m+s)>fdq4r=hI0V%_hAiv=MBmxHcS$>K@&71`uk;M!Qe1|}oQB=dL z0Vw#=)5S3)!u{=}+d@qWBCevGpC{ejYUF!aXY-l=|92%EC{#H;=iaQ%aS6t=k21Tj zjM7-8HTR3+)rrd#H~tm!Y;afh5nt5Lx+~G7`jEG-N@HfES}f1qXXQCIGcBf_oNW4Z zso123ud8m>Y&=roda&Yc)x6ygPu^TK_l0Q*=byiJ3J)8F+~&z2-zWajrEecdknLkV z)5l)s2`oty*c3SHk44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O`0p2l#}za&U2R@$j&5a&mF=a0>_s2#fFv2@8seaq{u0dsy0JCnU|z5;v3! z&5kYEp3N#MbNbI+DOEKU9bGvsZFNH<0cBk=1qBW*ZJ>D@Gh2@UDan!`zu^Bk00W~5 z*LI*H&H|6fVg?4jLm< zZ_zfx=T9fup3I2coL+K9*K1BOd&7iO$$26b^Hy`ovFwa=h@N!tVo=)It4ulK-%}?% z<7gA(xD|P+!_#5DLgo>b1B%ZkxvgnxUNZ6gHV1e8Oc%`q_3`-*`_znhr!f8c_>k#B z@Uq60t?4R`LIR!>SdQ!$6iNNcx@ysi*Si=vvR$<`A_CYPGlfHL%(P?N*khRz63n?F z_D=y@--RQ~`3mL5OpYfzH>dY(Sn$?Qmv^4wp{C;d@fja_CVr3R=sx_xAxkUfg?&$= zjQh%!1q=Ths419=&KBEHH(^%SSyw0aZDJ~Je-dn5IuHELJd$PL*Ky~>)L*-bD%-6O z+Em*cXD`_qeY^B+?`i9tsEQ>A`z`-h9IT6O5c8W}9`)j-Ky_v1Dei;WlN2~R_KWG9 aHqX4Cx*{{(_BJq}89ZJ6T-G@yGywp+rP<&B literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barrel_barge.png b/src/main/resources/assets/littlelogistics/textures/entity/barrel_barge.png new file mode 100644 index 0000000000000000000000000000000000000000..2f9211dcd3af8d93c4c658abae52282a30ffa9b4 GIT binary patch literal 1700 zcmdT@`BRez5dDBa73C-ewWZL=A>m34U+xeH1PUP#a{xJkkdTBBjvyEy0m2~=0-}PT zpdeBNFQ|x$2Pz&|s$wlFWvX~nYl}t&nIb3+|3ZK3&c1zbXLfdWXLhR@^ava4Z>#|T zu%SkVu}oaDj1?B9IQwMhyot@9l42nG%RRBqjs^`nIoHOtu67b8AL)Y&huS z6G|j9A|sWywp>fg5@+WMG0q?-)}#_kMVM`hK)sAuEydL-0!x!H`V@Qt58NDw+!Bw} z2tZvTI*${e6`~9HsFFl#q-q&Xmxz{cV7)R>NOmjW1vF%k zKz|q-;e!L=1T+$}(bvz*4e9HJ@b=7&MHC891zZe|v|cN~sF)iyJd7+FrsZQwML21c zS6wPm9^>DTPTHD`%ZdZ@xL`v@5I<m-mk$D!gNIL;bpvn{xwZ(`s2mlO^Cs zI=3ikJJ>9QE7;_PPcz?p^qZfIVDIbUZXnM>I;`@WWDW$&X$lw~G`OdIAZ2U3C=8o& zPVy{eEBtC|YxSY;;-Isy6`&!FmymnK+TCI?K08CnXjqxkd_AxZO9FvGW~SR za~Et--j!>ER6nO|f{<+6jh2l%*aIVoxAR_WKh{_qx}*KQ{h8g3mRYSzrf3MROH_>tA5yh;@&Ef29`w(q!%?&%{ z3qvKt5-j|kf(cc`D#R=m(7!G%4oytygy&{+dro6HD8)Ju=eThAIB2E zST21u=u*74@bSB+k{!lQe@cS!)obI}hs;)EXGYk5E305T-2uCc4X2%SpD=R^_63XW zc6GGNJW=DI7V2m>wAt8y{TQ#_4G@W5P$Wy`;l|?Gaj!+!6~h+CA1+**v^e0%8eLb) zOtl}bl3ZE?t(g0{Yy5avAIuZz8ac0vLD|&mlU$Gil~UVV`}pgA4SLRrs68```s>SX z!ZGUDvy1v!r-5bV@DJW|1B49xCofrYfjZ2ug#HnH)A{pZvFQ^5YB)WtH&j&iFC*Xy A>i_@% literal 0 HcmV?d00001 From 87ce5e62db93e2372360291bc86ca7be08c6e6c8 Mon Sep 17 00:00:00 2001 From: EDToaster Date: Mon, 9 Oct 2023 18:57:27 -0700 Subject: [PATCH 09/26] Delete unused models, add fluid tank rendering --- .../entity/custom/vessel/VesselEntity.java | 24 ++++++- .../vessel/barge/AbstractBargeEntity.java | 36 ++++------ .../vessel/barge/VacuumBargeEntity.java | 13 +++- .../entity/models/ChestBargeModel.java | 48 -------------- .../entity/models/ChunkLoaderBargeModel.java | 62 ------------------ .../{ => train}/ChainExtendedModel.java | 2 +- .../entity/models/{ => train}/ChainModel.java | 2 +- .../models/{ => train}/ChestCarModel.java | 2 +- .../{ => train}/ChunkLoaderCarModel.java | 2 +- .../{ => train}/EnergyLocomotiveModel.java | 2 +- .../models/{ => train}/FluidTankCarModel.java | 2 +- .../models/{ => train}/SeaterCarModel.java | 2 +- .../{ => train}/SteamLocomotiveModel.java | 2 +- .../models/{ => vessel}/BaseBargeModel.java | 18 +++-- .../models/{ => vessel}/EnergyTugModel.java | 2 +- .../FishingBargeDeployedModel.java | 2 +- .../{ => vessel}/FishingBargeModel.java | 2 +- .../FishingBargeTransitionModel.java | 2 +- .../models/{ => vessel}/SteamTugModel.java | 2 +- .../models/{ => vessel}/TrimBargeModel.java | 18 +++-- .../insert}/CubeInsertBargeModel.java | 2 +- .../insert/FluidTankInsertBargeModel.java} | 51 +++++++------- .../insert}/RingsInsertBargeModel.java | 2 +- .../insert/SeaterInsertBargeModel.java} | 37 +++++------ .../render/barge/AbstractVesselRenderer.java | 2 +- .../render/barge/FishingBargeRenderer.java | 6 +- ...eRenderer.java => FluidLevelRenderer.java} | 36 ++++------ .../render/barge/MultipartVesselRenderer.java | 15 ++--- .../entity/render/train/TrainCarRenderer.java | 3 +- .../shipping/event/ModClientEventHandler.java | 45 +++++++++---- .../textures/entity/barge/chest_insert.png | Bin 483 -> 487 bytes .../entity/barge/fluid_tank_insert.png | Bin 0 -> 529 bytes .../textures/entity/barge/seater_insert.png | Bin 0 -> 521 bytes .../textures/entity/barge/vacuum_insert.png | Bin 559 -> 522 bytes 34 files changed, 179 insertions(+), 265 deletions(-) delete mode 100644 src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java delete mode 100644 src/main/java/dev/murad/shipping/entity/models/ChunkLoaderBargeModel.java rename src/main/java/dev/murad/shipping/entity/models/{ => train}/ChainExtendedModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => train}/ChainModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => train}/ChestCarModel.java (97%) rename src/main/java/dev/murad/shipping/entity/models/{ => train}/ChunkLoaderCarModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => train}/EnergyLocomotiveModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => train}/FluidTankCarModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => train}/SeaterCarModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => train}/SteamLocomotiveModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => vessel}/BaseBargeModel.java (77%) rename src/main/java/dev/murad/shipping/entity/models/{ => vessel}/EnergyTugModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => vessel}/FishingBargeDeployedModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => vessel}/FishingBargeModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => vessel}/FishingBargeTransitionModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => vessel}/SteamTugModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{ => vessel}/TrimBargeModel.java (78%) rename src/main/java/dev/murad/shipping/entity/models/{ => vessel/insert}/CubeInsertBargeModel.java (97%) rename src/main/java/dev/murad/shipping/entity/models/{FluidTankBargeModel.java => vessel/insert/FluidTankInsertBargeModel.java} (56%) rename src/main/java/dev/murad/shipping/entity/models/{ => vessel/insert}/RingsInsertBargeModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{SeaterBargeModel.java => vessel/insert/SeaterInsertBargeModel.java} (50%) rename src/main/java/dev/murad/shipping/entity/render/barge/{FluidTankBargeRenderer.java => FluidLevelRenderer.java} (57%) create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/fluid_tank_insert.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/seater_insert.png diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java index 01ec4e38..5884504d 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java @@ -2,6 +2,7 @@ import dev.murad.shipping.ShippingConfig; import dev.murad.shipping.entity.custom.TrainInventoryProvider; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.setup.ModItems; import dev.murad.shipping.util.LinkableEntity; import dev.murad.shipping.util.LinkingHandler; @@ -12,6 +13,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; @@ -63,6 +65,7 @@ import java.util.stream.Stream; public abstract class VesselEntity extends WaterAnimal implements LinkableEntity { + public static final EntityDataAccessor COLOR_DATA = SynchedEntityData.defineId(VesselEntity.class, EntityDataSerializers.INT); private final static double NAMETAG_RENDERING_DISTANCE = 15; @@ -144,19 +147,28 @@ public static AttributeSupplier.Builder setCustomAttributes() { @Override public void readAdditionalSaveData(@NotNull CompoundTag compound) { linkingHandler.readAdditionalSaveData(compound); + if (compound.contains("Color", Tag.TAG_INT)) { + setColor(compound.getInt("Color")); + } super.readAdditionalSaveData(compound); } @Override public void addAdditionalSaveData(@NotNull CompoundTag compound) { linkingHandler.addAdditionalSaveData(compound); + + Integer color = getColor(); + if (color != null) { + compound.putInt("Color", color); + } + super.addAdditionalSaveData(compound); } - @Override protected void defineSynchedData() { super.defineSynchedData(); + this.getEntityData().define(COLOR_DATA, -1); LinkingHandler.defineSynchedData(this, DOMINANT_ID, DOMINATED_ID); } @@ -168,6 +180,16 @@ public void onSyncedDataUpdated(@NotNull EntityDataAccessor key) { } } + @Nullable + public Integer getColor() { + int color = this.getEntityData().get(COLOR_DATA); + return color == -1 ? null : color; + } + + public void setColor(Integer color) { + if (color == null) color = -1; + this.getEntityData().set(COLOR_DATA, color); + } // reset speed to 1 private void resetAttributes(double newSpeed) { diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java index bfcc1e69..e92a82eb 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/AbstractBargeEntity.java @@ -9,11 +9,15 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.IntTag; import net.minecraft.nbt.Tag; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.animal.Sheep; +import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; @@ -30,15 +34,10 @@ public abstract class AbstractBargeEntity extends VesselEntity { - @Getter - @Nullable - private Integer color; - public AbstractBargeEntity(EntityType type, Level world) { super(type, world); this.blocksBuilding = true; linkingHandler.train = new Train<>(this); - this.color = null; } public AbstractBargeEntity(EntityType type, Level worldIn, double x, double y, double z) { @@ -48,7 +47,6 @@ public AbstractBargeEntity(EntityType type, Level this.xo = x; this.yo = y; this.zo = z; - this.color = null; } @Override @@ -60,18 +58,18 @@ protected boolean canAddPassenger(Entity passenger) { @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { - var color = DyeColor.getColor(player.getItemInHand(hand)); - if (color != null) { - this.color = color.getId(); - } else { - if (!this.level().isClientSide) { + if (!this.level().isClientSide) { + var color = DyeColor.getColor(player.getItemInHand(hand)); + + if (color != null) { + this.getEntityData().set(COLOR_DATA, color.getId()); + } else { doInteract(player); } } - // don't interact *and* use current item - return InteractionResult.CONSUME; + return InteractionResult.sidedSuccess(this.level().isClientSide); } abstract protected void doInteract(Player player); @@ -80,18 +78,6 @@ public boolean hasWaterOnSides(){ return super.hasWaterOnSides(); } - @Override - public void addAdditionalSaveData(@NotNull CompoundTag tag) { - super.addAdditionalSaveData(tag); - if (color != null) tag.putInt("Color", color); - } - - @Override - public void readAdditionalSaveData(@NotNull CompoundTag tag) { - super.readAdditionalSaveData(tag); - color = tag.contains("Color", Tag.TAG_INT) ? tag.getInt("Color") : null; - } - @Override public void setDominated(VesselEntity entity) { linkingHandler.follower = Optional.of(entity); diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java index 2f366672..9c77fef3 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java @@ -3,7 +3,9 @@ import dev.murad.shipping.setup.ModEntityTypes; import dev.murad.shipping.setup.ModItems; import dev.murad.shipping.util.InventoryUtils; +import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; @@ -68,7 +70,8 @@ public void tick(){ if (!items.isEmpty()) { var inventoryProviders = getConnectedInventories(); for (var item : items) { - var leftOver = item.getItem(); + var initial = item.getItem(); + var leftOver = initial.copy(); for (var provider : inventoryProviders) { if (leftOver.isEmpty()) { break; @@ -80,6 +83,14 @@ public void tick(){ } } item.setItem(leftOver); + + if (!initial.equals(leftOver)) { + // spawn particles + ((ServerLevel) level()).sendParticles( + ParticleTypes.PORTAL, + item.getX(), item.getY(), item.getZ(), 15, + 0.2, 0.2, 0.2, 0.0); + } } } this.itemCheckDelay = ITEM_CHECK_DELAY; diff --git a/src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java deleted file mode 100644 index 18e6aae7..00000000 --- a/src/main/java/dev/murad/shipping/entity/models/ChestBargeModel.java +++ /dev/null @@ -1,48 +0,0 @@ -package dev.murad.shipping.entity.models; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import dev.murad.shipping.ShippingMod; -import dev.murad.shipping.entity.custom.vessel.barge.ChestBargeEntity; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.*; -import net.minecraft.resources.ResourceLocation; - -public class ChestBargeModel extends EntityModel { - // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "chestbargemodel"), "main"); - private final ModelPart bb_main; - - public ChestBargeModel(ModelPart root) { - this.bb_main = root.getChild("bb_main"); - } - - public static LayerDefinition createBodyLayer() { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); - - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -27.0F, -7.0F, 12.0F, 5.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(38, 5).addBox(-8.0F, -29.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(28, 43).addBox(-6.0F, -29.0F, -9.0F, 12.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(26, 25).addBox(6.0F, -29.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(0, 41).addBox(-6.0F, -29.0F, 7.0F, 12.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), - PartPose.offset(0.0F, 23.0F, 0.0F)); - - PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 19).addBox(-5.0F, -35.0F, -5.0F, 10.0F, 10.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); - - return LayerDefinition.create(meshdefinition, 128, 128); - } - - @Override - public void setupAnim(ChestBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bb_main.render(poseStack, buffer, packedLight, packedOverlay); - } -} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/ChunkLoaderBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/ChunkLoaderBargeModel.java deleted file mode 100644 index 97d71864..00000000 --- a/src/main/java/dev/murad/shipping/entity/models/ChunkLoaderBargeModel.java +++ /dev/null @@ -1,62 +0,0 @@ -package dev.murad.shipping.entity.models; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import dev.murad.shipping.ShippingMod; -import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; -import dev.murad.shipping.entity.custom.vessel.barge.ChunkLoaderBargeEntity; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.*; -import net.minecraft.resources.ResourceLocation; - -public class ChunkLoaderBargeModel extends EntityModel { - // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "chunkloaderbargemodel"), "main"); - private final ModelPart bb_main; - - public ChunkLoaderBargeModel(ModelPart root) { - this.bb_main = root.getChild("bb_main"); - } - - public static LayerDefinition createBodyLayer() { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); - - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -27.0F, -7.0F, 12.0F, 5.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(18, 23).addBox(-8.0F, -29.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(36, 25).addBox(-6.0F, -29.0F, -9.0F, 12.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 19).addBox(6.0F, -29.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(36, 19).addBox(-6.0F, -29.0F, 7.0F, 12.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 37).addBox(-2.0F, -33.0F, -2.0F, 4.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 23.0F, 0.0F)); - - PartDefinition ring = bb_main.addOrReplaceChild("ring", CubeListBuilder.create().texOffs(38, 0).addBox(-5.0F, -29.0F, -5.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(36, 31).addBox(-5.0F, -29.0F, 3.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(10, 41).addBox(3.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)) - .texOffs(38, 4).addBox(-5.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - - PartDefinition ring2 = bb_main.addOrReplaceChild("ring2", CubeListBuilder.create().texOffs(38, 0).addBox(-5.0F, -29.0F, -5.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(36, 31).addBox(-5.0F, -29.0F, 3.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(10, 41).addBox(3.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)) - .texOffs(38, 4).addBox(-5.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -3.0F, 0.0F)); - - PartDefinition ring3 = bb_main.addOrReplaceChild("ring3", CubeListBuilder.create().texOffs(38, 0).addBox(-5.0F, -29.0F, -5.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(36, 31).addBox(-5.0F, -29.0F, 3.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(10, 41).addBox(3.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)) - .texOffs(38, 4).addBox(-5.0F, -29.0F, -3.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -7.0F, 0.0F)); - - return LayerDefinition.create(meshdefinition, 64, 64); - } - - @Override - public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bb_main.render(poseStack, buffer, packedLight, packedOverlay); - } -} diff --git a/src/main/java/dev/murad/shipping/entity/models/ChainExtendedModel.java b/src/main/java/dev/murad/shipping/entity/models/train/ChainExtendedModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/ChainExtendedModel.java rename to src/main/java/dev/murad/shipping/entity/models/train/ChainExtendedModel.java index 8727c5bf..91b3f80c 100644 --- a/src/main/java/dev/murad/shipping/entity/models/ChainExtendedModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/ChainExtendedModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.train; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/ChainModel.java b/src/main/java/dev/murad/shipping/entity/models/train/ChainModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/ChainModel.java rename to src/main/java/dev/murad/shipping/entity/models/train/ChainModel.java index ba9c29d8..138807a9 100644 --- a/src/main/java/dev/murad/shipping/entity/models/ChainModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/ChainModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.train; import com.mojang.blaze3d.vertex.PoseStack; diff --git a/src/main/java/dev/murad/shipping/entity/models/ChestCarModel.java b/src/main/java/dev/murad/shipping/entity/models/train/ChestCarModel.java similarity index 97% rename from src/main/java/dev/murad/shipping/entity/models/ChestCarModel.java rename to src/main/java/dev/murad/shipping/entity/models/train/ChestCarModel.java index 126e29bc..6350b862 100644 --- a/src/main/java/dev/murad/shipping/entity/models/ChestCarModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/ChestCarModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models;// Made with Blockbench 4.1.1 +package dev.murad.shipping.entity.models.train;// Made with Blockbench 4.1.1 // Exported for Minecraft version 1.17 with Mojang mappings // Paste this class into your mod and generate all required imports diff --git a/src/main/java/dev/murad/shipping/entity/models/ChunkLoaderCarModel.java b/src/main/java/dev/murad/shipping/entity/models/train/ChunkLoaderCarModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/ChunkLoaderCarModel.java rename to src/main/java/dev/murad/shipping/entity/models/train/ChunkLoaderCarModel.java index 47c064d1..08a59d41 100644 --- a/src/main/java/dev/murad/shipping/entity/models/ChunkLoaderCarModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/ChunkLoaderCarModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models;// Made with Blockbench 4.1.1 +package dev.murad.shipping.entity.models.train;// Made with Blockbench 4.1.1 // Exported for Minecraft version 1.17 with Mojang mappings // Paste this class into your mod and generate all required imports diff --git a/src/main/java/dev/murad/shipping/entity/models/EnergyLocomotiveModel.java b/src/main/java/dev/murad/shipping/entity/models/train/EnergyLocomotiveModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/EnergyLocomotiveModel.java rename to src/main/java/dev/murad/shipping/entity/models/train/EnergyLocomotiveModel.java index f8d52d34..b074bde5 100644 --- a/src/main/java/dev/murad/shipping/entity/models/EnergyLocomotiveModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/EnergyLocomotiveModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models;// Made with Blockbench 4.1.1 +package dev.murad.shipping.entity.models.train;// Made with Blockbench 4.1.1 // Exported for Minecraft version 1.17 with Mojang mappings // Paste this class into your mod and generate all required imports diff --git a/src/main/java/dev/murad/shipping/entity/models/FluidTankCarModel.java b/src/main/java/dev/murad/shipping/entity/models/train/FluidTankCarModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/FluidTankCarModel.java rename to src/main/java/dev/murad/shipping/entity/models/train/FluidTankCarModel.java index 006a72c0..28adf749 100644 --- a/src/main/java/dev/murad/shipping/entity/models/FluidTankCarModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/FluidTankCarModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models;// Made with Blockbench 4.1.1 +package dev.murad.shipping.entity.models.train;// Made with Blockbench 4.1.1 // Exported for Minecraft version 1.17 with Mojang mappings // Paste this class into your mod and generate all required imports diff --git a/src/main/java/dev/murad/shipping/entity/models/SeaterCarModel.java b/src/main/java/dev/murad/shipping/entity/models/train/SeaterCarModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/SeaterCarModel.java rename to src/main/java/dev/murad/shipping/entity/models/train/SeaterCarModel.java index 4b1e9c25..2da63d03 100644 --- a/src/main/java/dev/murad/shipping/entity/models/SeaterCarModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/SeaterCarModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.train; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/SteamLocomotiveModel.java b/src/main/java/dev/murad/shipping/entity/models/train/SteamLocomotiveModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/SteamLocomotiveModel.java rename to src/main/java/dev/murad/shipping/entity/models/train/SteamLocomotiveModel.java index c0b21ac9..f9b22985 100644 --- a/src/main/java/dev/murad/shipping/entity/models/SteamLocomotiveModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/SteamLocomotiveModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models;// Made with Blockbench 4.1.1 +package dev.murad.shipping.entity.models.train;// Made with Blockbench 4.1.1 // Exported for Minecraft version 1.17 with Mojang mappings // Paste this class into your mod and generate all required imports diff --git a/src/main/java/dev/murad/shipping/entity/models/BaseBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java similarity index 77% rename from src/main/java/dev/murad/shipping/entity/models/BaseBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java index 6d42b0de..d8bcd34d 100644 --- a/src/main/java/dev/murad/shipping/entity/models/BaseBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.vessel; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; @@ -13,28 +13,34 @@ import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; -public class BaseBargeModel extends EntityModel { +public class BaseBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model"), "main"); + public static final ModelLayerLocation LAYER_LOCATION_OPEN = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model_open"), "main"); private final ModelPart bb_main; public BaseBargeModel(ModelPart root) { this.bb_main = root.getChild("bb_main"); } - public static LayerDefinition createBodyLayer() { + public static LayerDefinition createBodyLayer(boolean closedFront) { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() + var listBuilder = CubeListBuilder.create() // Main .texOffs(0, 0).addBox(-6.0F, -27.0F, -7.0F, 12.0F, 5.0F, 14.0F) // Long Side .texOffs(0, 19).addBox(-8.0F, -27.0F, -7.0F, 2.0F, 2.0F, 14.0F) - .texOffs(0, 19).addBox(6.0F, -27.0F, -7.0F, 2.0F, 2.0F, 14.0F) // Short Side .texOffs(19, 21).addBox(-6.0F, -27.0F, -9.0F, 12.0F, 2.0F, 2.0F) - .texOffs(19, 21).addBox(-6.0F, -27.0F, 7.0F, 12.0F, 2.0F, 2.0F), PartPose.offset(0.0F, 23.0F, 0.0F)); + .texOffs(19, 21).addBox(-6.0F, -27.0F, 7.0F, 12.0F, 2.0F, 2.0F); + + if (closedFront) { + listBuilder.texOffs(0, 19).addBox(6.0F, -27.0F, -7.0F, 2.0F, 2.0F, 14.0F); + } + + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", listBuilder, PartPose.offset(0.0F, 23.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 64, 64); } diff --git a/src/main/java/dev/murad/shipping/entity/models/EnergyTugModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/EnergyTugModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/EnergyTugModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/EnergyTugModel.java index 74ef9215..419e58bf 100644 --- a/src/main/java/dev/murad/shipping/entity/models/EnergyTugModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/EnergyTugModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.vessel; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/FishingBargeDeployedModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeDeployedModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/FishingBargeDeployedModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeDeployedModel.java index 14a8c652..b4b8e7e1 100644 --- a/src/main/java/dev/murad/shipping/entity/models/FishingBargeDeployedModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeDeployedModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.vessel; // Made with Blockbench 4.1.1 // Exported for Minecraft version 1.15 - 1.16 with Mojang mappings // Paste this class into your mod and generate all required imports diff --git a/src/main/java/dev/murad/shipping/entity/models/FishingBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/FishingBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeModel.java index c889181f..256debcc 100644 --- a/src/main/java/dev/murad/shipping/entity/models/FishingBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models;// Made with Blockbench 4.1.1 +package dev.murad.shipping.entity.models.vessel;// Made with Blockbench 4.1.1 // Exported for Minecraft version 1.15 - 1.16 with Mojang mappings // Paste this class into your mod and generate all required imports diff --git a/src/main/java/dev/murad/shipping/entity/models/FishingBargeTransitionModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeTransitionModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/FishingBargeTransitionModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeTransitionModel.java index 8632fa87..2b861c53 100644 --- a/src/main/java/dev/murad/shipping/entity/models/FishingBargeTransitionModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeTransitionModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.vessel; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/SteamTugModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/SteamTugModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/SteamTugModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/SteamTugModel.java index eaf044f2..c39938b7 100644 --- a/src/main/java/dev/murad/shipping/entity/models/SteamTugModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/SteamTugModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.vessel; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/TrimBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java similarity index 78% rename from src/main/java/dev/murad/shipping/entity/models/TrimBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java index 8cb9bcf3..d61ac380 100644 --- a/src/main/java/dev/murad/shipping/entity/models/TrimBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.vessel; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; @@ -15,26 +15,32 @@ import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.resources.ResourceLocation; -public class TrimBargeModel extends EntityModel { +public class TrimBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "trim_barge_model"), "main"); + public static final ModelLayerLocation LAYER_LOCATION_OPEN = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "trim_barge_model_open"), "main"); private final ModelPart bb_main; public TrimBargeModel(ModelPart root) { this.bb_main = root.getChild("bb_main"); } - public static LayerDefinition createBodyLayer() { + public static LayerDefinition createBodyLayer(boolean closedFront) { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() + var listBuilder = CubeListBuilder.create() // Long Side .texOffs(0, 0).addBox(-8.0F, -29.0F, -7.0F, 2.0F, 2.0F, 14.0F) - .texOffs(0, 0).addBox(6.0F, -29.0F, -7.0F, 2.0F, 2.0F, 14.0F) // Short Side .texOffs(19, 2).addBox(-6.0F, -29.0F, -9.0F, 12.0F, 2.0F, 2.0F) - .texOffs(19, 2).addBox(-6.0F, -29.0F, 7.0F, 12.0F, 2.0F, 2.0F), PartPose.offset(0.0F, 23.0F, 0.0F)); + .texOffs(19, 2).addBox(-6.0F, -29.0F, 7.0F, 12.0F, 2.0F, 2.0F); + + if (closedFront) { + listBuilder.texOffs(0, 0).addBox(6.0F, -29.0F, -7.0F, 2.0F, 2.0F, 14.0F); + } + + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", listBuilder, PartPose.offset(0.0F, 23.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 64, 64); } diff --git a/src/main/java/dev/murad/shipping/entity/models/CubeInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/CubeInsertBargeModel.java similarity index 97% rename from src/main/java/dev/murad/shipping/entity/models/CubeInsertBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/insert/CubeInsertBargeModel.java index 92e30e27..abd6e8fb 100644 --- a/src/main/java/dev/murad/shipping/entity/models/CubeInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/CubeInsertBargeModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.vessel.insert; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/FluidTankBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FluidTankInsertBargeModel.java similarity index 56% rename from src/main/java/dev/murad/shipping/entity/models/FluidTankBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/insert/FluidTankInsertBargeModel.java index 1b8b94c5..252eef84 100644 --- a/src/main/java/dev/murad/shipping/entity/models/FluidTankBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FluidTankInsertBargeModel.java @@ -1,11 +1,9 @@ -package dev.murad.shipping.entity.models;// Made with Blockbench 4.1.1 -// Exported for Minecraft version 1.15 - 1.16 with Mojang mappings -// Paste this class into your mod and generate all required imports - +package dev.murad.shipping.entity.models.vessel.insert; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.entity.custom.vessel.barge.FluidTankBargeEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -14,12 +12,12 @@ import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; -public class FluidTankBargeModel extends EntityModel { +public class FluidTankInsertBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fluidtankbargemodel"), "main"); + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fluid_tank_insert_barge_model"), "main"); private final ModelPart bb_main; - public FluidTankBargeModel(ModelPart root) { + public FluidTankInsertBargeModel(ModelPart root) { this.bb_main = root.getChild("bb_main"); } @@ -27,32 +25,29 @@ public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -27.0F, -7.0F, 12.0F, 5.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(38, 5).addBox(-8.0F, -29.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(28, 43).addBox(-6.0F, -29.0F, -9.0F, 12.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(26, 25).addBox(6.0F, -29.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(0, 41).addBox(-6.0F, -29.0F, 7.0F, 12.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(16, 49).addBox(-6.0F, -28.0F, -5.0F, 12.0F, 1.0F, 12.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-6.0F, -38.0F, -6.0F, 4.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(2.0F, -38.0F, -6.0F, 4.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(38, 0).addBox(-2.0F, -38.0F, -4.0F, 4.0F, 10.0F, 0.0F, new CubeDeformation(0.0F)) - .texOffs(38, 0).addBox(-2.0F, -38.0F, 5.0F, 4.0F, 10.0F, 0.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(2.0F, -38.0F, 4.0F, 4.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(4.0F, -38.0F, 2.0F, 2.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(38, -4).addBox(5.0F, -38.0F, -2.0F, 0.0F, 10.0F, 4.0F, new CubeDeformation(0.0F)) - .texOffs(38, -4).addBox(-5.0F, -38.0F, -2.0F, 0.0F, 10.0F, 4.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(4.0F, -38.0F, -4.0F, 2.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-6.0F, -38.0F, -4.0F, 2.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-6.0F, -38.0F, 2.0F, 2.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-6.0F, -38.0F, 4.0F, 4.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(16, 49).addBox(-6.0F, -39.0F, -6.0F, 12.0F, 1.0F, 12.0F, new CubeDeformation(0.0F)) - .texOffs(72, 0).addBox(-4.0F, -40.0F, -4.0F, 8.0F, 1.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 23.0F, 0.0F)); + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() + .texOffs(16, 49).addBox(-6.0F, -28.0F, -5.0F, 12.0F, 1.0F, 12.0F) + .texOffs(0, 0).addBox(-6.0F, -38.0F, -6.0F, 4.0F, 10.0F, 2.0F) + .texOffs(0, 0).addBox(2.0F, -38.0F, -6.0F, 4.0F, 10.0F, 2.0F) + .texOffs(38, 0).addBox(-2.0F, -38.0F, -4.0F, 4.0F, 10.0F, 0.0F) + .texOffs(38, 0).addBox(-2.0F, -38.0F, 5.0F, 4.0F, 10.0F, 0.0F) + .texOffs(0, 0).addBox(2.0F, -38.0F, 4.0F, 4.0F, 10.0F, 2.0F) + .texOffs(0, 0).addBox(4.0F, -38.0F, 2.0F, 2.0F, 10.0F, 2.0F) + .texOffs(38, -4).addBox(5.0F, -38.0F, -2.0F, 0.0F, 10.0F, 4.0F) + .texOffs(38, -4).addBox(-5.0F, -38.0F, -2.0F, 0.0F, 10.0F, 4.0F) + .texOffs(0, 0).addBox(4.0F, -38.0F, -4.0F, 2.0F, 10.0F, 2.0F) + .texOffs(0, 0).addBox(-6.0F, -38.0F, -4.0F, 2.0F, 10.0F, 2.0F) + .texOffs(0, 0).addBox(-6.0F, -38.0F, 2.0F, 2.0F, 10.0F, 2.0F) + .texOffs(0, 0).addBox(-6.0F, -38.0F, 4.0F, 4.0F, 10.0F, 2.0F) + .texOffs(16, 49).addBox(-6.0F, -39.0F, -6.0F, 12.0F, 1.0F, 12.0F) + .texOffs(72, 0).addBox(-4.0F, -40.0F, -4.0F, 8.0F, 1.0F, 8.0F), + PartPose.offset(0.0F, 23.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 128, 128); } @Override - public void setupAnim(FluidTankBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } diff --git a/src/main/java/dev/murad/shipping/entity/models/RingsInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/RingsInsertBargeModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/RingsInsertBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/insert/RingsInsertBargeModel.java index cfe86823..cf18162d 100644 --- a/src/main/java/dev/murad/shipping/entity/models/RingsInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/RingsInsertBargeModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.vessel.insert; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/SeaterBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/SeaterInsertBargeModel.java similarity index 50% rename from src/main/java/dev/murad/shipping/entity/models/SeaterBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/insert/SeaterInsertBargeModel.java index b95e3cd6..ba0ab939 100644 --- a/src/main/java/dev/murad/shipping/entity/models/SeaterBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/SeaterInsertBargeModel.java @@ -1,8 +1,9 @@ -package dev.murad.shipping.entity.models; +package dev.murad.shipping.entity.models.vessel.insert; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.entity.custom.vessel.barge.SeaterBargeEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -11,46 +12,38 @@ import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; -public class SeaterBargeModel extends EntityModel { +public class SeaterInsertBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "seaterbargemodel"), "main"); + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "seater_insert_barge_model"), "main"); private final ModelPart bb_main; - private final ModelPart bb_main2; - public SeaterBargeModel(ModelPart root) { + public SeaterInsertBargeModel(ModelPart root) { this.bb_main = root.getChild("bb_main"); - this.bb_main2 = root.getChild("bb_main2"); } public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -27.0F, -7.0F, 12.0F, 5.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(38, 5).addBox(-8.0F, -29.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(28, 43).addBox(-6.0F, -29.0F, -9.0F, 11.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 41).addBox(-6.0F, -29.0F, 7.0F, 11.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 23.0F, 0.0F)); + partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() + .texOffs(0, 19).addBox(-5.0F, -29.0F, -5.0F, 9.0F, 1.0F, 10.0F) + .texOffs(9, 22).addBox(-5.0F, -35.0F, -5.0F, 1.0F, 6.0F, 10.0F) + .texOffs(11, 23).addBox(-4.0F, -31.0F, -5.0F, 8.0F, 2.0F, 1.0F) + .texOffs(11, 24).addBox(-4.0F, -31.0F, 4.0F, 8.0F, 2.0F, 1.0F) + .texOffs(0, 49).addBox(-4.0F, -32.0F, -6.0F, 8.0F, 1.0F, 2.0F) + .texOffs(0, 49).addBox(-4.0F, -32.0F, 4.0F, 8.0F, 1.0F, 2.0F), + PartPose.offset(0.0F, 24.0F, 0.0F)); - PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create(), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); - - PartDefinition bb_main2 = partdefinition.addOrReplaceChild("bb_main2", CubeListBuilder.create().texOffs(0, 19).addBox(-5.0F, -29.0F, -5.0F, 9.0F, 1.0F, 10.0F, new CubeDeformation(0.0F)) - .texOffs(9, 22).addBox(-5.0F, -35.0F, -5.0F, 1.0F, 6.0F, 10.0F, new CubeDeformation(0.0F)) - .texOffs(11, 23).addBox(-4.0F, -31.0F, -5.0F, 8.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(11, 24).addBox(-4.0F, -31.0F, 4.0F, 8.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(0, 49).addBox(-4.0F, -32.0F, -6.0F, 8.0F, 1.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 49).addBox(-4.0F, -32.0F, 4.0F, 8.0F, 1.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); - - return LayerDefinition.create(meshdefinition, 128, 128); + return LayerDefinition.create(meshdefinition, 64, 64); } @Override public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { bb_main.render(poseStack, buffer, packedLight, packedOverlay); - bb_main2.render(poseStack, buffer, packedLight, packedOverlay); } @Override - public void setupAnim(SeaterBargeEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { + public void setupAnim(AbstractBargeEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { } } \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java index d52b8000..ba143d5b 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java @@ -5,7 +5,7 @@ import com.mojang.math.Axis; import dev.murad.shipping.ShippingMod; import dev.murad.shipping.entity.custom.vessel.VesselEntity; -import dev.murad.shipping.entity.models.ChainModel; +import dev.murad.shipping.entity.models.train.ChainModel; import net.minecraft.client.model.EntityModel; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java index 4c8f42f1..fb578ae1 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java @@ -2,9 +2,9 @@ import dev.murad.shipping.ShippingMod; import dev.murad.shipping.entity.custom.vessel.barge.FishingBargeEntity; -import dev.murad.shipping.entity.models.FishingBargeDeployedModel; -import dev.murad.shipping.entity.models.FishingBargeModel; -import dev.murad.shipping.entity.models.FishingBargeTransitionModel; +import dev.murad.shipping.entity.models.vessel.FishingBargeDeployedModel; +import dev.murad.shipping.entity.models.vessel.FishingBargeModel; +import dev.murad.shipping.entity.models.vessel.FishingBargeTransitionModel; import net.minecraft.client.model.EntityModel; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.resources.ResourceLocation; diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/FluidLevelRenderer.java similarity index 57% rename from src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java rename to src/main/java/dev/murad/shipping/entity/render/barge/FluidLevelRenderer.java index d77b85ea..60f045b5 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/FluidLevelRenderer.java @@ -2,46 +2,32 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; -import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.entity.custom.vessel.barge.FluidTankBargeEntity; -import dev.murad.shipping.entity.models.FluidTankBargeModel; import dev.murad.shipping.util.FluidRenderUtil; +import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.model.EntityModel; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.world.level.material.Fluid; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.NotNull; -public class FluidTankBargeRenderer extends AbstractVesselRenderer { - private static final ResourceLocation BARGE_TEXTURE = - new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/fluid_barge.png"); +public class FluidLevelRenderer extends MultipartVesselRenderer { - private final EntityModel model; - - public FluidTankBargeRenderer(EntityRendererProvider.Context context) { - super(context); - model = new FluidTankBargeModel(context.bakeLayer(FluidTankBargeModel.LAYER_LOCATION)); - } - - @Override - EntityModel getModel(FluidTankBargeEntity entity) { - return model; + public FluidLevelRenderer(EntityRendererProvider.Context context, + ModelSupplier baseModelSupplier, ModelLayerLocation baseModelLocation, ResourceLocation baseTexture, + ModelSupplier insertModelSupplier, ModelLayerLocation insertModelLocation, ResourceLocation insertTexture, + ModelSupplier trimModelSupplier, ModelLayerLocation trimModelLocation, ResourceLocation trimTexture) { + super(context, baseModelSupplier, baseModelLocation, baseTexture, insertModelSupplier, insertModelLocation, insertTexture, trimModelSupplier, trimModelLocation, trimTexture); } @Override - public @NotNull ResourceLocation getTextureLocation(@NotNull FluidTankBargeEntity entity) { - return BARGE_TEXTURE; + public void render(@NotNull T entity, float yaw, float partialTick, PoseStack matrixStack, MultiBufferSource buffer, int packedLight) { + super.render(entity, yaw, partialTick, matrixStack, buffer, packedLight); + renderFluid(entity, yaw, partialTick, matrixStack, buffer, 0, packedLight); } - @Override - public void render(@NotNull FluidTankBargeEntity entity, float yaw, float partialTick, PoseStack matrixStack, MultiBufferSource buffer, int p_225623_6_) { - super.render(entity, yaw, partialTick, matrixStack, buffer, p_225623_6_); - renderFluid(entity, yaw, partialTick, matrixStack, buffer, 0, p_225623_6_); - } - - public void renderFluid(FluidTankBargeEntity entity, float yaw, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { FluidStack fluid = entity.getFluidStack(); diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java index 8f12c051..8721c0f3 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java @@ -1,7 +1,6 @@ package dev.murad.shipping.entity.render.barge; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.entity.custom.vessel.VesselEntity; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import lombok.Getter; @@ -13,6 +12,7 @@ import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.DyeColor; +import org.jetbrains.annotations.NotNull; public class MultipartVesselRenderer extends AbstractVesselRenderer { @@ -22,10 +22,10 @@ public class MultipartVesselRenderer extends Abst @Getter private final ResourceLocation baseTextureLocation, insertTextureLocation, trimTextureLocation; - private MultipartVesselRenderer(EntityRendererProvider.Context context, - ModelSupplier baseModelSupplier, - ModelLayerLocation baseModelLocation, - ResourceLocation baseTexture, + protected MultipartVesselRenderer(EntityRendererProvider.Context context, + ModelSupplier baseModelSupplier, + ModelLayerLocation baseModelLocation, + ResourceLocation baseTexture, ModelSupplier insertModelSupplier, ModelLayerLocation insertModelLocation, ResourceLocation insertTexture, @@ -48,7 +48,7 @@ private MultipartVesselRenderer(EntityRendererProvider.Context context, */ @Override @Deprecated - EntityModel getModel(T entity) { + EntityModel getModel(T entity) { return baseModel; } @@ -57,7 +57,7 @@ EntityModel getModel(T entity) { */ @Override @Deprecated - public ResourceLocation getTextureLocation(T pEntity) { + public @NotNull ResourceLocation getTextureLocation(@NotNull T pEntity) { return baseTextureLocation; } @@ -142,6 +142,5 @@ public MultipartVesselRenderer build() { insertModelSupplier, insertModelLocation, insertModelTexture, trimModelSupplier, trimModelLocation, trimModelTexture); } - } } diff --git a/src/main/java/dev/murad/shipping/entity/render/train/TrainCarRenderer.java b/src/main/java/dev/murad/shipping/entity/render/train/TrainCarRenderer.java index afb1e57e..dc0919b8 100644 --- a/src/main/java/dev/murad/shipping/entity/render/train/TrainCarRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/train/TrainCarRenderer.java @@ -6,7 +6,7 @@ import com.mojang.math.Axis; import dev.murad.shipping.ShippingMod; import dev.murad.shipping.entity.custom.train.AbstractTrainCarEntity; -import dev.murad.shipping.entity.models.ChainModel; +import dev.murad.shipping.entity.models.train.ChainModel; import dev.murad.shipping.entity.render.RenderWithAttachmentPoints; import net.minecraft.client.Minecraft; import net.minecraft.client.model.EntityModel; @@ -21,7 +21,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.client.event.RenderNameTagEvent; import java.util.function.Function; diff --git a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java index f3d5a98b..ea3fbd6f 100644 --- a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java @@ -2,12 +2,17 @@ import dev.murad.shipping.ShippingMod; import dev.murad.shipping.block.fluid.render.FluidHopperTileEntityRenderer; -import dev.murad.shipping.entity.models.*; +import dev.murad.shipping.entity.models.train.*; +import dev.murad.shipping.entity.models.vessel.*; +import dev.murad.shipping.entity.models.vessel.insert.CubeInsertBargeModel; +import dev.murad.shipping.entity.models.vessel.insert.FluidTankInsertBargeModel; +import dev.murad.shipping.entity.models.vessel.insert.RingsInsertBargeModel; +import dev.murad.shipping.entity.models.vessel.insert.SeaterInsertBargeModel; +import dev.murad.shipping.entity.render.barge.FluidLevelRenderer; import dev.murad.shipping.entity.render.barge.MultipartVesselRenderer; import dev.murad.shipping.entity.render.train.FluidTankCarRenderer; import dev.murad.shipping.entity.render.train.TrainCarRenderer; import dev.murad.shipping.entity.render.barge.FishingBargeRenderer; -import dev.murad.shipping.entity.render.barge.FluidTankBargeRenderer; import dev.murad.shipping.entity.render.barge.StaticVesselRenderer; import dev.murad.shipping.setup.ModBlocks; import dev.murad.shipping.setup.ModEntityTypes; @@ -79,8 +84,14 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender .build()); event.registerEntityRenderer(ModEntityTypes.SEATER_BARGE.get(), - (ctx) -> new StaticVesselRenderer<>(ctx, SeaterBargeModel::new, SeaterBargeModel.LAYER_LOCATION, - new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/seater_barge.png"))); + (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) + .baseModel(BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION_OPEN, + ShippingMod.entityTexture("barge/base.png")) + .insertModel(SeaterInsertBargeModel::new, SeaterInsertBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/seater_insert.png")) + .trimModel(TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION_OPEN, + ShippingMod.entityTexture("barge/trim.png")) + .build()); event.registerEntityRenderer(ModEntityTypes.VACUUM_BARGE.get(), (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) @@ -92,7 +103,15 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender ShippingMod.entityTexture("barge/trim.png")) .build()); - event.registerEntityRenderer(ModEntityTypes.FLUID_TANK_BARGE.get(), FluidTankBargeRenderer::new); + // TODO: generalize for cars as well + event.registerEntityRenderer(ModEntityTypes.FLUID_TANK_BARGE.get(), + (ctx) -> new FluidLevelRenderer<>(ctx, + BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/base.png"), + FluidTankInsertBargeModel::new, FluidTankInsertBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/fluid_tank_insert.png"), + TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/trim.png"))); event.registerEntityRenderer(ModEntityTypes.FISHING_BARGE.get(), FishingBargeRenderer::new); @@ -128,7 +147,6 @@ protected float getModelYrot() { } }); - event.registerBlockEntityRenderer(ModTileEntitiesTypes.FLUID_HOPPER.get(), FluidHopperTileEntityRenderer::new); event.registerEntityRenderer(ModEntityTypes.STEAM_LOCOMOTIVE.get(), ctx -> new TrainCarRenderer<>(ctx, SteamLocomotiveModel::new, SteamLocomotiveModel.LAYER_LOCATION, @@ -153,6 +171,8 @@ protected float getModelYrot() { SeaterCarModel::new, SeaterCarModel.LAYER_LOCATION, "textures/entity/chest_car.png")); + + event.registerBlockEntityRenderer(ModTileEntitiesTypes.FLUID_HOPPER.get(), FluidHopperTileEntityRenderer::new); } @SubscribeEvent @@ -160,15 +180,16 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterLayerD event.registerLayerDefinition(ChainExtendedModel.LAYER_LOCATION, ChainExtendedModel::createBodyLayer); event.registerLayerDefinition(ChainModel.LAYER_LOCATION, ChainModel::createBodyLayer); - event.registerLayerDefinition(BaseBargeModel.LAYER_LOCATION, BaseBargeModel::createBodyLayer); - event.registerLayerDefinition(TrimBargeModel.LAYER_LOCATION, TrimBargeModel::createBodyLayer); + event.registerLayerDefinition(BaseBargeModel.LAYER_LOCATION, () -> BaseBargeModel.createBodyLayer(true)); + event.registerLayerDefinition(BaseBargeModel.LAYER_LOCATION_OPEN, () -> BaseBargeModel.createBodyLayer(false)); + event.registerLayerDefinition(TrimBargeModel.LAYER_LOCATION, () -> TrimBargeModel.createBodyLayer(true)); + event.registerLayerDefinition(TrimBargeModel.LAYER_LOCATION_OPEN, () -> TrimBargeModel.createBodyLayer(false)); + event.registerLayerDefinition(CubeInsertBargeModel.LAYER_LOCATION, CubeInsertBargeModel::createBodyLayer); event.registerLayerDefinition(RingsInsertBargeModel.LAYER_LOCATION, RingsInsertBargeModel::createBodyLayer); + event.registerLayerDefinition(SeaterInsertBargeModel.LAYER_LOCATION, SeaterInsertBargeModel::createBodyLayer); - event.registerLayerDefinition(FluidTankBargeModel.LAYER_LOCATION, FluidTankBargeModel::createBodyLayer); - event.registerLayerDefinition(SeaterBargeModel.LAYER_LOCATION, SeaterBargeModel::createBodyLayer); - event.registerLayerDefinition(ChestBargeModel.LAYER_LOCATION, ChestBargeModel::createBodyLayer); - event.registerLayerDefinition(ChunkLoaderBargeModel.LAYER_LOCATION, ChunkLoaderBargeModel::createBodyLayer); + event.registerLayerDefinition(FluidTankInsertBargeModel.LAYER_LOCATION, FluidTankInsertBargeModel::createBodyLayer); event.registerLayerDefinition(FishingBargeDeployedModel.LAYER_LOCATION, FishingBargeDeployedModel::createBodyLayer); event.registerLayerDefinition(FishingBargeModel.LAYER_LOCATION, FishingBargeModel::createBodyLayer); diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/chest_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/chest_insert.png index e86220b1b3530e11d9e7f0c786af56864e9733e2..85af119083ddf6d36ef17d06c90a5580358464b9 100644 GIT binary patch delta 319 zcmV-F0l@y_1Lp&fv46q<01m!<<2b%%_NYKITN~{hxU`Qi9d4Q(G>R zEVX7-^|t^V%UnvWBQ_;g2ODtbi%-)Xn-Z&oeT7sj-Mc1eN`I^lr+}rsrF`)@pySRHJD)~5-vI@s+~6GmxLeRk<)vhR3nd`bjF022Wbz(haLGdVtZ%4P0QN!S`81VHdb9LAA>E*Rp7Pa1+4M+Um!Hcc~f3t}7@=z^5< zvXqjb*=GeX<~iq5MiAr3Ko{KU;L~&mF^&xMUx=mPxl0UU9Df;{3YLt|oUou8M+UlJ zNGZnS8mn<+pbOggh;U?}cN4qeZ=$a3#``>$znWBqNGMao4RIjwZ{89)YL&WEa=v(YwYI_ zE{ykg(3kFp<}_rx8@Iskf8zySKzM-{5MJN~gco=L;RRkme0{;T{Q<3D4jcp)Sd9Px N002ovPDHLkV1h<;mAe1{ diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/fluid_tank_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/fluid_tank_insert.png new file mode 100644 index 0000000000000000000000000000000000000000..a5c3b42d22f6e6c6b5fb70cb71deaa7a3827c96b GIT binary patch literal 529 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&F%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl{S4DbnY{r~^}^=I##tgQn)Jhq>|YpkVJl$12FtE;KBbnf2sKvgz&U#x%> zcS(?6Fih^;UhnbCYLe>b)t3Ur=HDvoi#>PtCq}>g?w)zWq@%o8uc>Gvs)$Ij22QFUb zYM;JfdqdfkUZ!u(sk|X;F8MnAmGb%$D4cbt<*-3tu5rPXW0ybJNa?#gzgVGZ$Il|* zz`zJ4H2!lxv*$aR*ArTaW6s9j5I^zs=hNrAXYCFU z{ID>3|L4;?0~CI~o#k8Y_Zld@;_QLlmrK_@(|dEiL9TRq@Ah+7@3e+7@;}Xbcc@?g z;Ht~J%@*!>X|m_PQ_7Dm*4{vcH5@k>p6BJPJ)N+6=e}>IyNwH2A=ZNJ#!HxU`&{N$ YSyj-y=GTl literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/seater_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/seater_insert.png new file mode 100644 index 0000000000000000000000000000000000000000..3c8fd784ba014c79733a21edeaf5c26fc8058363 GIT binary patch literal 521 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!7>k44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O_~e2l#}zYOBec8>+V?>DR|AP0i7pkfzm_sJ19ud3m1v>Pp@IOxYzx>XVX{ zjrCN`4Ag*{fPkmw#$q5PSQ6wH{2vW4sIHxv1eD|~@Q5sCVBk9p!i>lBSEK+P)Ec zkle#6F=Ne~$~f>vjg~cGZ?CX}70DaMd1| zD(+Wu^q;8eG^hVuda7%zEoB@7lQi$J9BIh@$e{r;A>q@#oi#nKol7sUU-_2lq|;hw zR;*!TytGJTX8oeqyOzD-_j)$pU|ZSTRqy09^owG{<&2cPIpema{^JbZou`~*`;d8k zY?klcc*nQu^ZEM?^&Z(C l`ESvBU4l_L;r{o((ofeuZoSm!We*Hu22WQ%mvv4FO#qEr(^LQe literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/vacuum_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/vacuum_insert.png index e4b7cfdde7fd07220b92cf84c37084290d5b9ecf..a14818f73ed144d0ed0213c4695bb47fd997e671 100644 GIT binary patch delta 400 zcmV;B0dM}V1d0TZK><9GLN^r;69uq)kzo zG~3N4yaZ6g(AUIevSz$s~Pd{tQUYyqZ=^9o371Vagg zGiw?#3AhAJBPIbhvDP$yVilY;jeNHRZoQ_FOaZ?8dIIV-(Qc3_;D-+ffKTlPrV>&V zK@pH5C<5|t1iop{p!L4%Iu8)mkz9cnK@$XxP0(UyE&;KLIb5wA3wR4;ShWEp?IF z>nA`3F`)vVA uxXz!HFmV$n{gLEAa7+;t0r_jevitz3SsBl&I?ZMP0000I4v%n*=n1O-s5C}7hYIrp;Ffe*}x;TbJxWApm+uvls)21HJ-t>rJ;{X5N z?{i;@@fK|}eExKj?aBI#$j#{`XLP;h6tg!>NR^x?QZa8emmJH^NQdZ22QLPtoxRGG zBmO;g!ZVIGF^*f2mpVKh<|||#Q8}RaY?9lWrsgFR&u?>Z*Uxm(JWwB>@32qJh<6Ip zua6IzE(9-YT-lng;wU8GIf3QKenFAcudJ&Ut$4kQfg{^hTO%TX%`sEBKIFzsJI0MY zmMI~@oEu{Q6tMMOII^6tP+rXBc(QYIde4RhZ~b(6=NTSqD!w0|@u6qp_h^pp!yg>7 zv|?V^_aw@=uUuKM@V|kYf~n|iu?=+-W_6u)bzSq6R`cTPK!R99A>;y#!? hNrAItznIQx^UUk1D>Bn Date: Mon, 9 Oct 2023 20:02:05 -0700 Subject: [PATCH 10/26] Dyeable fishing barge --- .../entity/models/vessel/BaseBargeModel.java | 24 ++-- .../entity/models/vessel/EmptyModel.java | 44 +++++++ .../vessel/FishingBargeDeployedModel.java | 69 ---------- .../models/vessel/FishingBargeModel.java | 68 ---------- .../vessel/FishingBargeTransitionModel.java | 65 ---------- .../entity/models/vessel/TrimBargeModel.java | 19 +-- .../insert/FishingInsertBargeModel.java | 102 +++++++++++++++ .../render/barge/FishingBargeRenderer.java | 121 +++++++++++++----- .../render/barge/FluidLevelRenderer.java | 47 ------- .../render/barge/FluidTankBargeRenderer.java | 86 +++++++++++++ .../render/barge/MultipartVesselRenderer.java | 81 ++++++------ .../shipping/event/ModClientEventHandler.java | 82 +++++++----- .../textures/entity/barge/fishing_insert.png | Bin 0 -> 1357 bytes 13 files changed, 435 insertions(+), 373 deletions(-) create mode 100644 src/main/java/dev/murad/shipping/entity/models/vessel/EmptyModel.java delete mode 100644 src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeDeployedModel.java delete mode 100644 src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeModel.java delete mode 100644 src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeTransitionModel.java create mode 100644 src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java delete mode 100644 src/main/java/dev/murad/shipping/entity/render/barge/FluidLevelRenderer.java create mode 100644 src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/fishing_insert.png diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java index d8bcd34d..93f1253b 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java @@ -3,9 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; -import dev.murad.shipping.entity.custom.vessel.VesselEntity; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; -import dev.murad.shipping.entity.custom.vessel.barge.ChestBargeEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelPart; @@ -15,31 +13,37 @@ public class BaseBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model"), "main"); - public static final ModelLayerLocation LAYER_LOCATION_OPEN = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model_open"), "main"); + public static final ModelLayerLocation CLOSED_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model_closed"), "main"); + public static final ModelLayerLocation OPEN_FRONT_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model_open_front"), "main"); + public static final ModelLayerLocation OPEN_SIDES_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model_open_sides"), "main"); + private final ModelPart bb_main; public BaseBargeModel(ModelPart root) { this.bb_main = root.getChild("bb_main"); } - public static LayerDefinition createBodyLayer(boolean closedFront) { + public static LayerDefinition createBodyLayer(boolean closedFront, boolean closedSides) { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); var listBuilder = CubeListBuilder.create() // Main .texOffs(0, 0).addBox(-6.0F, -27.0F, -7.0F, 12.0F, 5.0F, 14.0F) - // Long Side - .texOffs(0, 19).addBox(-8.0F, -27.0F, -7.0F, 2.0F, 2.0F, 14.0F) - // Short Side - .texOffs(19, 21).addBox(-6.0F, -27.0F, -9.0F, 12.0F, 2.0F, 2.0F) - .texOffs(19, 21).addBox(-6.0F, -27.0F, 7.0F, 12.0F, 2.0F, 2.0F); + // Back Side + .texOffs(0, 19).addBox(-8.0F, -27.0F, -7.0F, 2.0F, 2.0F, 14.0F); if (closedFront) { + // Front Side listBuilder.texOffs(0, 19).addBox(6.0F, -27.0F, -7.0F, 2.0F, 2.0F, 14.0F); } + if (closedSides) { + // Short Sides + listBuilder.texOffs(19, 21).addBox(-6.0F, -27.0F, -9.0F, 12.0F, 2.0F, 2.0F) + .texOffs(19, 21).addBox(-6.0F, -27.0F, 7.0F, 12.0F, 2.0F, 2.0F); + } + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", listBuilder, PartPose.offset(0.0F, 23.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 64, 64); diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/EmptyModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/EmptyModel.java new file mode 100644 index 00000000..71dbc0fa --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/EmptyModel.java @@ -0,0 +1,44 @@ +package dev.murad.shipping.entity.models.vessel; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.resources.ResourceLocation; + +public class EmptyModel extends EntityModel { + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model_closed"), "main"); + private final ModelPart bb_main; + + public EmptyModel(ModelPart root) { + this.bb_main = root.getChild("bb_main"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create(), PartPose.offset(0.0F, 23.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 64, 64); + } + + @Override + public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + + } +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeDeployedModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeDeployedModel.java deleted file mode 100644 index b4b8e7e1..00000000 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeDeployedModel.java +++ /dev/null @@ -1,69 +0,0 @@ -package dev.murad.shipping.entity.models.vessel; -// Made with Blockbench 4.1.1 -// Exported for Minecraft version 1.15 - 1.16 with Mojang mappings -// Paste this class into your mod and generate all required imports - - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import dev.murad.shipping.ShippingMod; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.*; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; - -public class FishingBargeDeployedModel extends EntityModel { - // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishingbargedeployedmodel"), "main"); - private final ModelPart bb_main; - private final ModelPart bone; - private final ModelPart bone3; - - public FishingBargeDeployedModel(ModelPart root) { - this.bb_main = root.getChild("bb_main"); - this.bone = root.getChild("bone"); - this.bone3 = root.getChild("bone3"); - } - - public static LayerDefinition createBodyLayer() { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); - - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -28.0F, -7.0F, 12.0F, 5.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(18, 23).addBox(-8.0F, -30.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(0, 19).addBox(6.0F, -30.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); - - PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.0F, 0.0F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -9.0F, 0.0F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.0F, -4.0F, 1.5708F, 0.0F, 0.0F)); - - PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -7.0F, -1.0F, -1.5708F, 0.0F, 0.0F)); - - PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(44, 8).mirror().addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); - - PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.0F, -2.0F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -9.0F, -2.0F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.0F, 4.0F, -1.5708F, 0.0F, 0.0F)); - - PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -7.0F, 1.0F, 1.5708F, 0.0F, 0.0F)); - - PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); - - return LayerDefinition.create(meshdefinition, 128, 128); - } - - @Override - public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bb_main.render(poseStack, buffer, packedLight, packedOverlay); - bone.render(poseStack, buffer, packedLight, packedOverlay); - bone3.render(poseStack, buffer, packedLight, packedOverlay); - } -} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeModel.java deleted file mode 100644 index 256debcc..00000000 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeModel.java +++ /dev/null @@ -1,68 +0,0 @@ -package dev.murad.shipping.entity.models.vessel;// Made with Blockbench 4.1.1 -// Exported for Minecraft version 1.15 - 1.16 with Mojang mappings -// Paste this class into your mod and generate all required imports - - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import dev.murad.shipping.ShippingMod; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.*; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; - -public class FishingBargeModel extends EntityModel { - // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishingbargemodel"), "main"); - private final ModelPart bb_main; - private final ModelPart bone; - private final ModelPart bone3; - - public FishingBargeModel(ModelPart root) { - this.bb_main = root.getChild("bb_main"); - this.bone = root.getChild("bone"); - this.bone3 = root.getChild("bone3"); - } - - public static LayerDefinition createBodyLayer() { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); - - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -28.0F, -7.0F, 12.0F, 5.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(18, 23).addBox(-8.0F, -30.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(0, 19).addBox(6.0F, -30.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); - - PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -3.0F, -4.0F)); - - PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -7.0F, 0.0F)); - - PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -2.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(4.5F, 1.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); - - PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -3.0F, 4.0F)); - - PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -7.0F, 0.0F)); - - PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -2.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(4.5F, 1.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); - - return LayerDefinition.create(meshdefinition, 128, 128); - } - - @Override - public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bb_main.render(poseStack, buffer, packedLight, packedOverlay); - bone.render(poseStack, buffer, packedLight, packedOverlay); - bone3.render(poseStack, buffer, packedLight, packedOverlay); - } -} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeTransitionModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeTransitionModel.java deleted file mode 100644 index 2b861c53..00000000 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/FishingBargeTransitionModel.java +++ /dev/null @@ -1,65 +0,0 @@ -package dev.murad.shipping.entity.models.vessel; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import dev.murad.shipping.ShippingMod; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.*; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; - -public class FishingBargeTransitionModel extends EntityModel { - // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishingbargetransitionmodel"), "main"); - private final ModelPart bb_main; - private final ModelPart bone; - private final ModelPart bone3; - - public FishingBargeTransitionModel(ModelPart root) { - this.bb_main = root.getChild("bb_main"); - this.bone = root.getChild("bone"); - this.bone3 = root.getChild("bone3"); - } - - public static LayerDefinition createBodyLayer() { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); - - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -28.0F, -7.0F, 12.0F, 5.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(18, 23).addBox(-8.0F, -30.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(0, 19).addBox(6.0F, -30.0F, -7.0F, 2.0F, 4.0F, 14.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); - - PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.8192F, -0.4264F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -9.8192F, -0.4264F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.0F, -4.0F, 0.6109F, 0.0F, 0.0F)); - - PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -7.0F, 0.0F, -0.6109F, 0.0F, 0.0F)); - - PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(44, 8).mirror().addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); - - PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.8192F, -1.5736F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -9.8192F, -1.5736F, 1.0F, 9.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.0F, 4.0F, -0.6109F, 0.0F, 0.0F)); - - PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -7.0F, 0.0F, 0.6109F, 0.0F, 0.0F)); - - PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); - - return LayerDefinition.create(meshdefinition, 128, 128); - } - - @Override - public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bb_main.render(poseStack, buffer, packedLight, packedOverlay); - bone.render(poseStack, buffer, packedLight, packedOverlay); - bone3.render(poseStack, buffer, packedLight, packedOverlay); - } -} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java index d61ac380..9d5079e1 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java @@ -3,7 +3,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; -import dev.murad.shipping.entity.custom.vessel.VesselEntity; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -17,29 +16,33 @@ public class TrimBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "trim_barge_model"), "main"); - public static final ModelLayerLocation LAYER_LOCATION_OPEN = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "trim_barge_model_open"), "main"); + public static final ModelLayerLocation CLOSED_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "trim_barge_model_closed"), "main"); + public static final ModelLayerLocation OPEN_FRONT_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "trim_barge_model_open_front"), "main"); + public static final ModelLayerLocation OPEN_SIDES_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "trim_barge_model_open_sides"), "main"); private final ModelPart bb_main; public TrimBargeModel(ModelPart root) { this.bb_main = root.getChild("bb_main"); } - public static LayerDefinition createBodyLayer(boolean closedFront) { + public static LayerDefinition createBodyLayer(boolean closedFront, boolean closedSides) { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); var listBuilder = CubeListBuilder.create() // Long Side - .texOffs(0, 0).addBox(-8.0F, -29.0F, -7.0F, 2.0F, 2.0F, 14.0F) - // Short Side - .texOffs(19, 2).addBox(-6.0F, -29.0F, -9.0F, 12.0F, 2.0F, 2.0F) - .texOffs(19, 2).addBox(-6.0F, -29.0F, 7.0F, 12.0F, 2.0F, 2.0F); + .texOffs(0, 0).addBox(-8.0F, -29.0F, -7.0F, 2.0F, 2.0F, 14.0F); if (closedFront) { listBuilder.texOffs(0, 0).addBox(6.0F, -29.0F, -7.0F, 2.0F, 2.0F, 14.0F); } + if (closedSides) { + // Short Side + listBuilder.texOffs(19, 2).addBox(-6.0F, -29.0F, -9.0F, 12.0F, 2.0F, 2.0F) + .texOffs(19, 2).addBox(-6.0F, -29.0F, 7.0F, 12.0F, 2.0F, 2.0F); + } + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", listBuilder, PartPose.offset(0.0F, 23.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 64, 64); diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java new file mode 100644 index 00000000..1e707db0 --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java @@ -0,0 +1,102 @@ +package dev.murad.shipping.entity.models.vessel.insert;// Made with Blockbench 4.1.1 +// Exported for Minecraft version 1.15 - 1.16 with Mojang mappings +// Paste this class into your mod and generate all required imports + + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; +import dev.murad.shipping.entity.custom.vessel.barge.FishingBargeEntity; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.*; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; + +public class FishingInsertBargeModel extends EntityModel { + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation STASHED_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishing_insert_barge_model_stashed"), "main"); + public static final ModelLayerLocation TRANSITION_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishing_insert_barge_model_transition"), "main"); + public static final ModelLayerLocation DEPLOYED_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishing_insert_barge_model_deployed"), "main"); + private final ModelPart bone; + private final ModelPart bone3; + + public FishingInsertBargeModel(ModelPart root) { + this.bone = root.getChild("bone"); + this.bone3 = root.getChild("bone3"); + } + + public static LayerDefinition createBodyLayer(FishingBargeEntity.Status status) { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + if (status == FishingBargeEntity.Status.STASHED) { + PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F), PartPose.offset(0.0F, -3.0F, -4.0F)); + + PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F) + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offset(0.0F, -7.0F, 0.0F)); + + PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -2.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(4.5F, 1.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); + + PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F), PartPose.offset(0.0F, -3.0F, 4.0F)); + + PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F) + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offset(0.0F, -7.0F, 0.0F)); + + PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -2.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(4.5F, 1.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); + + } else if (status == FishingBargeEntity.Status.TRANSITION) { + PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.8192F, -0.4264F, 1.0F, 9.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -9.8192F, -0.4264F, 1.0F, 9.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -3.0F, -4.0F, 0.6109F, 0.0F, 0.0F)); + + PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F) + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -7.0F, 0.0F, -0.6109F, 0.0F, 0.0F)); + + PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(44, 8).mirror().addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F).mirror(false), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); + + PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.8192F, -1.5736F, 1.0F, 9.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -9.8192F, -1.5736F, 1.0F, 9.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -3.0F, 4.0F, -0.6109F, 0.0F, 0.0F)); + + PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F) + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -7.0F, 0.0F, 0.6109F, 0.0F, 0.0F)); + + PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); + + } else { + PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.0F, 0.0F, 1.0F, 9.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -9.0F, 0.0F, 1.0F, 9.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -3.0F, -4.0F, 1.5708F, 0.0F, 0.0F)); + + PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F) + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -7.0F, -1.0F, -1.5708F, 0.0F, 0.0F)); + + PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(44, 8).mirror().addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F).mirror(false), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); + + PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.0F, -2.0F, 1.0F, 9.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -9.0F, -2.0F, 1.0F, 9.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -3.0F, 4.0F, -1.5708F, 0.0F, 0.0F)); + + PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F) + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -7.0F, 1.0F, 1.5708F, 0.0F, 0.0F)); + + PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); + + } + + return LayerDefinition.create(meshdefinition, 128, 128); + } + + @Override + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + bone.render(poseStack, buffer, packedLight, packedOverlay); + bone3.render(poseStack, buffer, packedLight, packedOverlay); + } +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java index fb578ae1..8130fe1f 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java @@ -1,46 +1,109 @@ package dev.murad.shipping.entity.render.barge; -import dev.murad.shipping.ShippingMod; +import com.mojang.blaze3d.vertex.PoseStack; import dev.murad.shipping.entity.custom.vessel.barge.FishingBargeEntity; -import dev.murad.shipping.entity.models.vessel.FishingBargeDeployedModel; -import dev.murad.shipping.entity.models.vessel.FishingBargeModel; -import dev.murad.shipping.entity.models.vessel.FishingBargeTransitionModel; +import lombok.Getter; import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.resources.ResourceLocation; -public class FishingBargeRenderer extends AbstractVesselRenderer { +public class FishingBargeRenderer extends MultipartVesselRenderer { - private static final ResourceLocation BARGE_TEXTURE = - new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/fishing_barge.png"); + @Getter + private final EntityModel transitionInsertModel, deployedInsertModel; - private final EntityModel stashed; - private final EntityModel transition; - private final EntityModel deployed; + @Getter + private final ResourceLocation transitionInsertTextureLocation, deployedInsertTextureLocation; - public FishingBargeRenderer(EntityRendererProvider.Context context) { - super(context); - stashed = new FishingBargeModel(context.bakeLayer(FishingBargeModel.LAYER_LOCATION)); - transition = new FishingBargeTransitionModel(context.bakeLayer(FishingBargeTransitionModel.LAYER_LOCATION)); - deployed = new FishingBargeDeployedModel(context.bakeLayer(FishingBargeDeployedModel.LAYER_LOCATION)); + protected FishingBargeRenderer(EntityRendererProvider.Context context, + ModelPack baseModelPack, + ModelPack stashedInsertModelPack, + ModelPack transitionInsertModelPack, + ModelPack deployedInsertModelPack, + ModelPack trimModelPack) { + super(context, baseModelPack, stashedInsertModelPack, trimModelPack); + + this.transitionInsertModel = transitionInsertModelPack.supplier().supply(context.bakeLayer(transitionInsertModelPack.location())); + this.transitionInsertTextureLocation = transitionInsertModelPack.texture(); + + this.deployedInsertModel = deployedInsertModelPack.supplier().supply(context.bakeLayer(deployedInsertModelPack.location())); + this.deployedInsertTextureLocation = deployedInsertModelPack.texture(); } @Override - EntityModel getModel(FishingBargeEntity entity) { - switch (entity.getStatus()) { - case STASHED: - return stashed; - case DEPLOYED: - return deployed; - case TRANSITION: - return transition; - default: - throw new IllegalStateException("Unexpected value: " + entity.getStatus()); - } + protected void renderInsertModel(T vesselEntity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int overlay) { + var model = switch(vesselEntity.getStatus()) { + case STASHED -> getInsertModel(); + case DEPLOYED -> deployedInsertModel; + case TRANSITION -> transitionInsertModel; + }; + + var texture = switch(vesselEntity.getStatus()) { + case STASHED -> getInsertTextureLocation(); + case DEPLOYED -> deployedInsertTextureLocation; + case TRANSITION -> transitionInsertTextureLocation; + }; + + model.renderToBuffer(matrixStack, + buffer.getBuffer(model.renderType(texture)), + packedLight, overlay, + 1.0F, 1.0F, 1.0F, 1.0F); } - @Override - public ResourceLocation getTextureLocation(FishingBargeEntity p_110775_1_) { - return BARGE_TEXTURE; + public static class Builder { + private final EntityRendererProvider.Context context; + + private ModelPack baseModelPack; + private ModelPack stashedInsertModelPack; + private ModelPack transitionInsertModelPack; + private ModelPack deployedInsertModelPack; + private ModelPack trimModelPack; + + + public Builder(EntityRendererProvider.Context context) { + this.context = context; + } + + public Builder baseModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.baseModelPack = new ModelPack<>(supplier, location, texture); + return this; + } + + public Builder stashedInsertModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.stashedInsertModelPack = new ModelPack<>(supplier, location, texture); + return this; + } + + public Builder transitionInsertModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.transitionInsertModelPack = new ModelPack<>(supplier, location, texture); + return this; + } + + public Builder deployedInsertModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.deployedInsertModelPack = new ModelPack<>(supplier, location, texture); + return this; + } + + public Builder trimModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.trimModelPack = new ModelPack<>(supplier, location, texture); + return this; + } + + public FishingBargeRenderer build() { + return new FishingBargeRenderer<>(context, baseModelPack, stashedInsertModelPack, transitionInsertModelPack, deployedInsertModelPack, trimModelPack); + } } + } diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/FluidLevelRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/FluidLevelRenderer.java deleted file mode 100644 index 60f045b5..00000000 --- a/src/main/java/dev/murad/shipping/entity/render/barge/FluidLevelRenderer.java +++ /dev/null @@ -1,47 +0,0 @@ -package dev.murad.shipping.entity.render.barge; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Axis; -import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; -import dev.murad.shipping.entity.custom.vessel.barge.FluidTankBargeEntity; -import dev.murad.shipping.util.FluidRenderUtil; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.entity.EntityRendererProvider; -import net.minecraft.world.level.material.Fluid; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; -import org.jetbrains.annotations.NotNull; - -public class FluidLevelRenderer extends MultipartVesselRenderer { - - public FluidLevelRenderer(EntityRendererProvider.Context context, - ModelSupplier baseModelSupplier, ModelLayerLocation baseModelLocation, ResourceLocation baseTexture, - ModelSupplier insertModelSupplier, ModelLayerLocation insertModelLocation, ResourceLocation insertTexture, - ModelSupplier trimModelSupplier, ModelLayerLocation trimModelLocation, ResourceLocation trimTexture) { - super(context, baseModelSupplier, baseModelLocation, baseTexture, insertModelSupplier, insertModelLocation, insertTexture, trimModelSupplier, trimModelLocation, trimTexture); - } - - @Override - public void render(@NotNull T entity, float yaw, float partialTick, PoseStack matrixStack, MultiBufferSource buffer, int packedLight) { - super.render(entity, yaw, partialTick, matrixStack, buffer, packedLight); - renderFluid(entity, yaw, partialTick, matrixStack, buffer, 0, packedLight); - } - - public void renderFluid(FluidTankBargeEntity entity, float yaw, float partialTicks, PoseStack matrixStackIn, - MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { - FluidStack fluid = entity.getFluidStack(); - if (fluid == null) return; - - Fluid renderFluid = fluid.getFluid(); - if (renderFluid == null) return; - - matrixStackIn.pushPose(); - matrixStackIn.mulPose(Axis.YP.rotationDegrees(180.0F - yaw)); - matrixStackIn.translate(-0.3, 0.4, -0.25); - matrixStackIn.scale(1f, 1.2f, 1f); - FluidRenderUtil.renderCubeUsingQuads(FluidTankBargeEntity.CAPACITY, fluid, partialTicks, matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); - - matrixStackIn.popPose(); - } -} diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java new file mode 100644 index 00000000..a3088160 --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java @@ -0,0 +1,86 @@ +package dev.murad.shipping.entity.render.barge; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; +import dev.murad.shipping.entity.custom.vessel.barge.FluidTankBargeEntity; +import dev.murad.shipping.util.FluidRenderUtil; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; + +public class FluidTankBargeRenderer extends MultipartVesselRenderer { + + protected FluidTankBargeRenderer( + EntityRendererProvider.Context context, + ModelPack baseModelPack, + ModelPack insertModelPack, + ModelPack trimModelPack) { + super(context, baseModelPack, insertModelPack, trimModelPack); + } + + @Override + public void render(@NotNull T entity, float yaw, float partialTick, PoseStack matrixStack, MultiBufferSource buffer, int packedLight) { + super.render(entity, yaw, partialTick, matrixStack, buffer, packedLight); + renderFluid(entity, yaw, partialTick, matrixStack, buffer, 0, packedLight); + } + + public void renderFluid(FluidTankBargeEntity entity, float yaw, float partialTicks, PoseStack matrixStackIn, + MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { + FluidStack fluid = entity.getFluidStack(); + if (fluid == null) return; + + Fluid renderFluid = fluid.getFluid(); + if (renderFluid == null) return; + + matrixStackIn.pushPose(); + matrixStackIn.mulPose(Axis.YP.rotationDegrees(180.0F - yaw)); + matrixStackIn.translate(-0.3, 0.4, -0.25); + matrixStackIn.scale(1f, 1.2f, 1f); + FluidRenderUtil.renderCubeUsingQuads(FluidTankBargeEntity.CAPACITY, fluid, partialTicks, matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); + + matrixStackIn.popPose(); + } + + public static class Builder { + private final EntityRendererProvider.Context context; + + private ModelPack baseModelPack; + private ModelPack insertModelPack; + private ModelPack trimModelPack; + + + public Builder(EntityRendererProvider.Context context) { + this.context = context; + } + + public Builder baseModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.baseModelPack = new ModelPack<>(supplier, location, texture); + return this; + } + + public Builder insertModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.insertModelPack = new ModelPack<>(supplier, location, texture); + return this; + } + + public Builder trimModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.trimModelPack = new ModelPack<>(supplier, location, texture); + return this; + } + + public FluidTankBargeRenderer build() { + return new FluidTankBargeRenderer<>(context, baseModelPack, insertModelPack, trimModelPack); + } + } +} diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java index 8721c0f3..c9f8bebc 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java @@ -1,16 +1,17 @@ package dev.murad.shipping.entity.render.barge; import com.mojang.blaze3d.vertex.PoseStack; -import dev.murad.shipping.entity.custom.vessel.VesselEntity; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import lombok.Getter; import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.Model; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; import net.minecraft.world.item.DyeColor; import org.jetbrains.annotations.NotNull; @@ -23,24 +24,18 @@ public class MultipartVesselRenderer extends Abst private final ResourceLocation baseTextureLocation, insertTextureLocation, trimTextureLocation; protected MultipartVesselRenderer(EntityRendererProvider.Context context, - ModelSupplier baseModelSupplier, - ModelLayerLocation baseModelLocation, - ResourceLocation baseTexture, - ModelSupplier insertModelSupplier, - ModelLayerLocation insertModelLocation, - ResourceLocation insertTexture, - ModelSupplier trimModelSupplier, - ModelLayerLocation trimModelLocation, - ResourceLocation trimTexture) { + ModelPack baseModelPack, + ModelPack insertModelPack, + ModelPack trimModelPack) { super(context); - this.baseModel = baseModelSupplier.supply(context.bakeLayer(baseModelLocation)); - this.baseTextureLocation = baseTexture; + this.baseModel = baseModelPack.supplier.supply(context.bakeLayer(baseModelPack.location)); + this.baseTextureLocation = baseModelPack.texture; - this.insertModel = insertModelSupplier.supply(context.bakeLayer(insertModelLocation)); - this.insertTextureLocation = insertTexture; + this.insertModel = insertModelPack.supplier.supply(context.bakeLayer(insertModelPack.location)); + this.insertTextureLocation = insertModelPack.texture; - this.trimModel = trimModelSupplier.supply(context.bakeLayer(trimModelLocation)); - this.trimTextureLocation = trimTexture; + this.trimModel = trimModelPack.supplier.supply(context.bakeLayer(trimModelPack.location)); + this.trimTextureLocation = trimModelPack.texture; } /** @@ -64,19 +59,28 @@ EntityModel getModel(T entity) { @Override protected void renderModel(T vesselEntity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight) { int overlay = LivingEntityRenderer.getOverlayCoords(vesselEntity, 0); + renderBaseModel(vesselEntity, matrixStack, buffer, packedLight, overlay); + renderInsertModel(vesselEntity, matrixStack, buffer, packedLight, overlay); + renderTrimModel(vesselEntity, matrixStack, buffer, packedLight, overlay); + } - var colorId = vesselEntity.getColor(); - var color = (colorId == null ? DyeColor.RED : DyeColor.byId(colorId)).getTextureDiffuseColors(); - + protected void renderBaseModel(T vesselEntity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int overlay) { baseModel.renderToBuffer(matrixStack, buffer.getBuffer(baseModel.renderType(baseTextureLocation)), packedLight, overlay, 1.0F, 1.0F, 1.0F, 1.0F); + } + protected void renderInsertModel(T vesselEntity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int overlay) { insertModel.renderToBuffer(matrixStack, buffer.getBuffer(insertModel.renderType(insertTextureLocation)), packedLight, overlay, 1.0F, 1.0F, 1.0F, 1.0F); + } + + protected void renderTrimModel(T vesselEntity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int overlay) { + var colorId = vesselEntity.getColor(); + var color = (colorId == null ? DyeColor.RED : DyeColor.byId(colorId)).getTextureDiffuseColors(); trimModel.renderToBuffer(matrixStack, buffer.getBuffer(trimModel.renderType(trimTextureLocation)), @@ -85,24 +89,22 @@ protected void renderModel(T vesselEntity, PoseStack matrixStack, MultiBufferSou } @FunctionalInterface - public interface ModelSupplier { + public interface ModelSupplier { EntityModel supply(ModelPart root); } + public record ModelPack( + ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + } + public static class Builder { private final EntityRendererProvider.Context context; - private ModelSupplier baseModelSupplier; - private ModelLayerLocation baseModelLocation; - private ResourceLocation baseModelTexture; - - private ModelSupplier insertModelSupplier; - private ModelLayerLocation insertModelLocation; - private ResourceLocation insertModelTexture; - - private ModelSupplier trimModelSupplier; - private ModelLayerLocation trimModelLocation; - private ResourceLocation trimModelTexture; + private ModelPack baseModelPack; + private ModelPack insertModelPack; + private ModelPack trimModelPack; public Builder(EntityRendererProvider.Context context) { @@ -112,35 +114,26 @@ public Builder(EntityRendererProvider.Context context) { public Builder baseModel(ModelSupplier supplier, ModelLayerLocation location, ResourceLocation texture) { - this.baseModelSupplier = supplier; - this.baseModelLocation = location; - this.baseModelTexture = texture; + this.baseModelPack = new ModelPack<>(supplier, location, texture); return this; } public Builder insertModel(ModelSupplier supplier, ModelLayerLocation location, ResourceLocation texture) { - this.insertModelSupplier = supplier; - this.insertModelLocation = location; - this.insertModelTexture = texture; + this.insertModelPack = new ModelPack<>(supplier, location, texture); return this; } public Builder trimModel(ModelSupplier supplier, ModelLayerLocation location, ResourceLocation texture) { - this.trimModelSupplier = supplier; - this.trimModelLocation = location; - this.trimModelTexture = texture; + this.trimModelPack = new ModelPack<>(supplier, location, texture); return this; } public MultipartVesselRenderer build() { - return new MultipartVesselRenderer<>(context, - baseModelSupplier, baseModelLocation, baseModelTexture, - insertModelSupplier, insertModelLocation, insertModelTexture, - trimModelSupplier, trimModelLocation, trimModelTexture); + return new MultipartVesselRenderer<>(context, baseModelPack, insertModelPack, trimModelPack); } } } diff --git a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java index ea3fbd6f..5842977d 100644 --- a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java @@ -2,17 +2,15 @@ import dev.murad.shipping.ShippingMod; import dev.murad.shipping.block.fluid.render.FluidHopperTileEntityRenderer; +import dev.murad.shipping.entity.custom.vessel.barge.FishingBargeEntity; import dev.murad.shipping.entity.models.train.*; import dev.murad.shipping.entity.models.vessel.*; -import dev.murad.shipping.entity.models.vessel.insert.CubeInsertBargeModel; -import dev.murad.shipping.entity.models.vessel.insert.FluidTankInsertBargeModel; -import dev.murad.shipping.entity.models.vessel.insert.RingsInsertBargeModel; -import dev.murad.shipping.entity.models.vessel.insert.SeaterInsertBargeModel; -import dev.murad.shipping.entity.render.barge.FluidLevelRenderer; +import dev.murad.shipping.entity.models.vessel.insert.*; +import dev.murad.shipping.entity.render.barge.FishingBargeRenderer; +import dev.murad.shipping.entity.render.barge.FluidTankBargeRenderer; import dev.murad.shipping.entity.render.barge.MultipartVesselRenderer; import dev.murad.shipping.entity.render.train.FluidTankCarRenderer; import dev.murad.shipping.entity.render.train.TrainCarRenderer; -import dev.murad.shipping.entity.render.barge.FishingBargeRenderer; import dev.murad.shipping.entity.render.barge.StaticVesselRenderer; import dev.murad.shipping.setup.ModBlocks; import dev.murad.shipping.setup.ModEntityTypes; @@ -55,65 +53,79 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender // Barges event.registerEntityRenderer(ModEntityTypes.CHEST_BARGE.get(), (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) - .baseModel(BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION, + .baseModel(BaseBargeModel::new, BaseBargeModel.CLOSED_LOCATION, ShippingMod.entityTexture("barge/base.png")) .insertModel(CubeInsertBargeModel::new, CubeInsertBargeModel.LAYER_LOCATION, ShippingMod.entityTexture("barge/chest_insert.png")) - .trimModel(TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION, + .trimModel(TrimBargeModel::new, TrimBargeModel.CLOSED_LOCATION, ShippingMod.entityTexture("barge/trim.png")) .build()); event.registerEntityRenderer(ModEntityTypes.BARREL_BARGE.get(), (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) - .baseModel(BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION, + .baseModel(BaseBargeModel::new, BaseBargeModel.CLOSED_LOCATION, ShippingMod.entityTexture("barge/base.png")) .insertModel(CubeInsertBargeModel::new, CubeInsertBargeModel.LAYER_LOCATION, ShippingMod.entityTexture("barge/barrel_insert.png")) - .trimModel(TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION, + .trimModel(TrimBargeModel::new, TrimBargeModel.CLOSED_LOCATION, ShippingMod.entityTexture("barge/trim.png")) .build()); event.registerEntityRenderer(ModEntityTypes.CHUNK_LOADER_BARGE.get(), (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) - .baseModel(BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION, + .baseModel(BaseBargeModel::new, BaseBargeModel.CLOSED_LOCATION, ShippingMod.entityTexture("barge/base.png")) .insertModel(RingsInsertBargeModel::new, RingsInsertBargeModel.LAYER_LOCATION, ShippingMod.entityTexture("barge/chunk_loader_insert.png")) - .trimModel(TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION, + .trimModel(TrimBargeModel::new, TrimBargeModel.CLOSED_LOCATION, ShippingMod.entityTexture("barge/trim.png")) .build()); event.registerEntityRenderer(ModEntityTypes.SEATER_BARGE.get(), (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) - .baseModel(BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION_OPEN, + .baseModel(BaseBargeModel::new, BaseBargeModel.OPEN_FRONT_LOCATION, ShippingMod.entityTexture("barge/base.png")) .insertModel(SeaterInsertBargeModel::new, SeaterInsertBargeModel.LAYER_LOCATION, ShippingMod.entityTexture("barge/seater_insert.png")) - .trimModel(TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION_OPEN, + .trimModel(TrimBargeModel::new, TrimBargeModel.OPEN_FRONT_LOCATION, ShippingMod.entityTexture("barge/trim.png")) .build()); event.registerEntityRenderer(ModEntityTypes.VACUUM_BARGE.get(), (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) - .baseModel(BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION, + .baseModel(BaseBargeModel::new, BaseBargeModel.CLOSED_LOCATION, ShippingMod.entityTexture("barge/base.png")) .insertModel(RingsInsertBargeModel::new, RingsInsertBargeModel.LAYER_LOCATION, ShippingMod.entityTexture("barge/vacuum_insert.png")) - .trimModel(TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION, + .trimModel(TrimBargeModel::new, TrimBargeModel.CLOSED_LOCATION, ShippingMod.entityTexture("barge/trim.png")) .build()); - // TODO: generalize for cars as well event.registerEntityRenderer(ModEntityTypes.FLUID_TANK_BARGE.get(), - (ctx) -> new FluidLevelRenderer<>(ctx, - BaseBargeModel::new, BaseBargeModel.LAYER_LOCATION, - ShippingMod.entityTexture("barge/base.png"), - FluidTankInsertBargeModel::new, FluidTankInsertBargeModel.LAYER_LOCATION, - ShippingMod.entityTexture("barge/fluid_tank_insert.png"), - TrimBargeModel::new, TrimBargeModel.LAYER_LOCATION, - ShippingMod.entityTexture("barge/trim.png"))); + (ctx) -> new FluidTankBargeRenderer.Builder<>(ctx) + .baseModel(BaseBargeModel::new, BaseBargeModel.CLOSED_LOCATION, + ShippingMod.entityTexture("barge/base.png")) + .insertModel(FluidTankInsertBargeModel::new, FluidTankInsertBargeModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/fluid_tank_insert.png")) + .trimModel(TrimBargeModel::new, TrimBargeModel.CLOSED_LOCATION, + ShippingMod.entityTexture("barge/trim.png")) + .build()); + + event.registerEntityRenderer(ModEntityTypes.FISHING_BARGE.get(), + (ctx) -> new FishingBargeRenderer.Builder<>(ctx) + .baseModel(BaseBargeModel::new, BaseBargeModel.OPEN_SIDES_LOCATION, + ShippingMod.entityTexture("barge/base.png")) + .stashedInsertModel(FishingInsertBargeModel::new, FishingInsertBargeModel.STASHED_LOCATION, + ShippingMod.entityTexture("barge/fishing_insert.png")) + .transitionInsertModel(FishingInsertBargeModel::new, FishingInsertBargeModel.TRANSITION_LOCATION, + ShippingMod.entityTexture("barge/fishing_insert.png")) + .deployedInsertModel(FishingInsertBargeModel::new, FishingInsertBargeModel.DEPLOYED_LOCATION, + ShippingMod.entityTexture("barge/fishing_insert.png")) + .trimModel(TrimBargeModel::new, TrimBargeModel.OPEN_SIDES_LOCATION, + ShippingMod.entityTexture("barge/trim.png")) + .build()); - event.registerEntityRenderer(ModEntityTypes.FISHING_BARGE.get(), FishingBargeRenderer::new); +// event.registerEntityRenderer(ModEntityTypes.FISHING_BARGE.get(), FishingBargeRenderer::new); // Tugs event.registerEntityRenderer(ModEntityTypes.ENERGY_TUG.get(), @@ -180,20 +192,24 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterLayerD event.registerLayerDefinition(ChainExtendedModel.LAYER_LOCATION, ChainExtendedModel::createBodyLayer); event.registerLayerDefinition(ChainModel.LAYER_LOCATION, ChainModel::createBodyLayer); - event.registerLayerDefinition(BaseBargeModel.LAYER_LOCATION, () -> BaseBargeModel.createBodyLayer(true)); - event.registerLayerDefinition(BaseBargeModel.LAYER_LOCATION_OPEN, () -> BaseBargeModel.createBodyLayer(false)); - event.registerLayerDefinition(TrimBargeModel.LAYER_LOCATION, () -> TrimBargeModel.createBodyLayer(true)); - event.registerLayerDefinition(TrimBargeModel.LAYER_LOCATION_OPEN, () -> TrimBargeModel.createBodyLayer(false)); + event.registerLayerDefinition(EmptyModel.LAYER_LOCATION, EmptyModel::createBodyLayer); + + event.registerLayerDefinition(BaseBargeModel.CLOSED_LOCATION, () -> BaseBargeModel.createBodyLayer(true, true)); + event.registerLayerDefinition(BaseBargeModel.OPEN_FRONT_LOCATION, () -> BaseBargeModel.createBodyLayer(false, true)); + event.registerLayerDefinition(BaseBargeModel.OPEN_SIDES_LOCATION, () -> BaseBargeModel.createBodyLayer(true, false)); + + event.registerLayerDefinition(TrimBargeModel.CLOSED_LOCATION, () -> TrimBargeModel.createBodyLayer(true, true)); + event.registerLayerDefinition(TrimBargeModel.OPEN_FRONT_LOCATION, () -> TrimBargeModel.createBodyLayer(false, true)); + event.registerLayerDefinition(TrimBargeModel.OPEN_SIDES_LOCATION, () -> TrimBargeModel.createBodyLayer(true, false)); event.registerLayerDefinition(CubeInsertBargeModel.LAYER_LOCATION, CubeInsertBargeModel::createBodyLayer); event.registerLayerDefinition(RingsInsertBargeModel.LAYER_LOCATION, RingsInsertBargeModel::createBodyLayer); event.registerLayerDefinition(SeaterInsertBargeModel.LAYER_LOCATION, SeaterInsertBargeModel::createBodyLayer); - event.registerLayerDefinition(FluidTankInsertBargeModel.LAYER_LOCATION, FluidTankInsertBargeModel::createBodyLayer); - event.registerLayerDefinition(FishingBargeDeployedModel.LAYER_LOCATION, FishingBargeDeployedModel::createBodyLayer); - event.registerLayerDefinition(FishingBargeModel.LAYER_LOCATION, FishingBargeModel::createBodyLayer); - event.registerLayerDefinition(FishingBargeTransitionModel.LAYER_LOCATION, FishingBargeTransitionModel::createBodyLayer); + event.registerLayerDefinition(FishingInsertBargeModel.STASHED_LOCATION, () -> FishingInsertBargeModel.createBodyLayer(FishingBargeEntity.Status.STASHED)); + event.registerLayerDefinition(FishingInsertBargeModel.TRANSITION_LOCATION, () -> FishingInsertBargeModel.createBodyLayer(FishingBargeEntity.Status.TRANSITION)); + event.registerLayerDefinition(FishingInsertBargeModel.DEPLOYED_LOCATION, () -> FishingInsertBargeModel.createBodyLayer(FishingBargeEntity.Status.DEPLOYED)); event.registerLayerDefinition(EnergyTugModel.LAYER_LOCATION, EnergyTugModel::createBodyLayer); event.registerLayerDefinition(SteamTugModel.LAYER_LOCATION, SteamTugModel::createBodyLayer); diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/fishing_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/fishing_insert.png new file mode 100644 index 0000000000000000000000000000000000000000..640ca596d5150270c9dba91e803393d25310a7e9 GIT binary patch literal 1357 zcmbtU`!^E`9N+COMUS1NyS#E;Mq#YDA`Q9gGGn)J$(-wPv0XB*M|mYm>O>p1){q`* zrt!;A(yY!6o006)) zqz@uMi+SIAyN-79+@tydfUO2d#EGDc%B9J!v&J|R{_>FSp~#w=abV^nXlc(WU^#o_ zuoIU|^|}hYX|C~f1U|iK&yA5AkjzmvFL&;4`(^HCl|kV4K_Q(S_E|s1(6^xZ;n{>o zKaO!P+Se%VqwEbF)RR2c+O|I0lnRZ`!C0Y0OH;zG5;$8&StF?R5QqN+A_(R6I*fax#i{ zzMZ9z5-cAF*~G=ho+SOG$QMuqrR>O9mF>^y<2n}NuWNkbjb9OwFmX^ot3WP885MK; z2!y-C<8!XafJ&#UsLhSFq1|MS4cdqY!RedXx`rF^%*Wh-ynznDRF`I)%|}MNy!WsE z^hs^4FciacrbUCqLgo^l_chuQLZs3plGt?Rz5JP(am2~ZmHMz&yS>puA1lp@GE2I* zHMG$i{gFmEO2ODuf48TC1o*@S`M_jpS)EK{hl203Lqhr2O*(FGjLu*@D>6*FM$(Hz zcak1}uT*dZD-Jry8L~UK=f2h?gv81LmhHz}POHOIO^2Hp&bL3oX_KB%sYo;z$NG+4h~8B|-p@!)`pK*4?YFM@QY z(am$CdRx=!m~(0~3;yHagKZ2iZfBq!tB6cC^^mH|++To-IRplL@yLtsE3bT5Vpg9I zi)VN#$Mm);rxDSHg-al}rCk}$DI0WF*$Hl6l7Gr+^u-m(sGji23DqZ>Pj#`5i|^qD~MiT~*Oa z8F{sBT%`JYK=x(0WNpjA5SwyL9xdm3_(K4)3Yzz?vK83Zw73HKMs+}u!r2$f z7tTmsy24qO$n}M#38H$F@tsA2Ki5pz^Bf_KuB0521SsgA_RPSC{C({aVbv}!tTU1nd0!)7={UBu*_NSPnny*&0tL9ZQVo(6g;VWyb z`GI`!vR_UfeKsRPUoClEtL1e$x->EiG%bUzMjytO@Q@eM;zzf1b6|zD)Zf;9%A&9m z`cdb!_1b&88LRvUeiZYicjZi?2uJ*P4uX<)J&Fy|pp8G)n+4AiW@+2D3;1zlKKfSP_ AsQ>@~ literal 0 HcmV?d00001 From 9c1b5785ee95e96a3e6e08e804ff408822ce9b29 Mon Sep 17 00:00:00 2001 From: EDToaster Date: Mon, 9 Oct 2023 20:19:09 -0700 Subject: [PATCH 11/26] Cleanup and change fishing barge texture --- .../insert/FishingInsertBargeModel.java | 56 ++++++++++++------ .../render/barge/FishingBargeRenderer.java | 32 +--------- .../render/barge/FluidTankBargeRenderer.java | 31 +--------- .../render/barge/MultipartVesselRenderer.java | 8 +-- .../shipping/event/ModClientEventHandler.java | 10 ++-- .../textures/entity/barge/fishing_insert.png | Bin 1357 -> 514 bytes 6 files changed, 51 insertions(+), 86 deletions(-) diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java index 1e707db0..506ccc89 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java @@ -33,56 +33,76 @@ public static LayerDefinition createBodyLayer(FishingBargeEntity.Status status) MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); + // TODO: most of this is duplicated if (status == FishingBargeEntity.Status.STASHED) { PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F), PartPose.offset(0.0F, -3.0F, -4.0F)); + .texOffs(0, 0).addBox(5.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F), + PartPose.offset(0.0F, -3.0F, -4.0F)); PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offset(0.0F, -7.0F, 0.0F)); + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offset(0.0F, -7.0F, 0.0F)); - PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -2.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(4.5F, 1.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); + PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -2.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offsetAndRotation(4.5F, 1.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F), PartPose.offset(0.0F, -3.0F, 4.0F)); + .texOffs(0, 0).addBox(5.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F), + PartPose.offset(0.0F, -3.0F, 4.0F)); PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offset(0.0F, -7.0F, 0.0F)); + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offset(0.0F, -7.0F, 0.0F)); - PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -2.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(4.5F, 1.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); + PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -2.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offsetAndRotation(4.5F, 1.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); } else if (status == FishingBargeEntity.Status.TRANSITION) { PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.8192F, -0.4264F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -9.8192F, -0.4264F, 1.0F, 9.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -3.0F, -4.0F, 0.6109F, 0.0F, 0.0F)); + .texOffs(0, 0).addBox(5.0F, -9.8192F, -0.4264F, 1.0F, 9.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -3.0F, -4.0F, 0.6109F, 0.0F, 0.0F)); PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -7.0F, 0.0F, -0.6109F, 0.0F, 0.0F)); + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -7.0F, 0.0F, -0.6109F, 0.0F, 0.0F)); - PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(44, 8).mirror().addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F).mirror(false), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); + PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(44, 8).mirror().addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F).mirror(false), + PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.8192F, -1.5736F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -9.8192F, -1.5736F, 1.0F, 9.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -3.0F, 4.0F, -0.6109F, 0.0F, 0.0F)); + .texOffs(0, 0).addBox(5.0F, -9.8192F, -1.5736F, 1.0F, 9.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -3.0F, 4.0F, -0.6109F, 0.0F, 0.0F)); PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -7.0F, 0.0F, 0.6109F, 0.0F, 0.0F)); + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -7.0F, 0.0F, 0.6109F, 0.0F, 0.0F)); - PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); + PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); } else { PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.0F, 0.0F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -9.0F, 0.0F, 1.0F, 9.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -3.0F, -4.0F, 1.5708F, 0.0F, 0.0F)); + .texOffs(0, 0).addBox(5.0F, -9.0F, 0.0F, 1.0F, 9.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -3.0F, -4.0F, 1.5708F, 0.0F, 0.0F)); PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -7.0F, -1.0F, -1.5708F, 0.0F, 0.0F)); + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -7.0F, -1.0F, -1.5708F, 0.0F, 0.0F)); - PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(44, 8).mirror().addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F).mirror(false), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); + PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create() + .texOffs(44, 8).mirror().addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F).mirror(false), + PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.0F, -2.0F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -9.0F, -2.0F, 1.0F, 9.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -3.0F, 4.0F, -1.5708F, 0.0F, 0.0F)); + .texOffs(0, 0).addBox(5.0F, -9.0F, -2.0F, 1.0F, 9.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -3.0F, 4.0F, -1.5708F, 0.0F, 0.0F)); PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -7.0F, 1.0F, 1.5708F, 0.0F, 0.0F)); + .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -7.0F, 1.0F, 1.5708F, 0.0F, 0.0F)); - PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F), PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); + PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); } diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java index 8130fe1f..659b7131 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java @@ -52,32 +52,13 @@ protected void renderInsertModel(T vesselEntity, PoseStack matrixStack, MultiBuf 1.0F, 1.0F, 1.0F, 1.0F); } - public static class Builder { - private final EntityRendererProvider.Context context; - - private ModelPack baseModelPack; - private ModelPack stashedInsertModelPack; + public static class Builder extends MultipartVesselRenderer.Builder { private ModelPack transitionInsertModelPack; private ModelPack deployedInsertModelPack; - private ModelPack trimModelPack; public Builder(EntityRendererProvider.Context context) { - this.context = context; - } - - public Builder baseModel(ModelSupplier supplier, - ModelLayerLocation location, - ResourceLocation texture) { - this.baseModelPack = new ModelPack<>(supplier, location, texture); - return this; - } - - public Builder stashedInsertModel(ModelSupplier supplier, - ModelLayerLocation location, - ResourceLocation texture) { - this.stashedInsertModelPack = new ModelPack<>(supplier, location, texture); - return this; + super(context); } public Builder transitionInsertModel(ModelSupplier supplier, @@ -94,15 +75,8 @@ public Builder deployedInsertModel(ModelSupplier supplier, return this; } - public Builder trimModel(ModelSupplier supplier, - ModelLayerLocation location, - ResourceLocation texture) { - this.trimModelPack = new ModelPack<>(supplier, location, texture); - return this; - } - public FishingBargeRenderer build() { - return new FishingBargeRenderer<>(context, baseModelPack, stashedInsertModelPack, transitionInsertModelPack, deployedInsertModelPack, trimModelPack); + return new FishingBargeRenderer<>(context, baseModelPack, insertModelPack, transitionInsertModelPack, deployedInsertModelPack, trimModelPack); } } diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java index a3088160..bf7083f1 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java @@ -46,37 +46,10 @@ public void renderFluid(FluidTankBargeEntity entity, float yaw, float partialTic matrixStackIn.popPose(); } - public static class Builder { - private final EntityRendererProvider.Context context; - - private ModelPack baseModelPack; - private ModelPack insertModelPack; - private ModelPack trimModelPack; - + public static class Builder extends MultipartVesselRenderer.Builder { public Builder(EntityRendererProvider.Context context) { - this.context = context; - } - - public Builder baseModel(ModelSupplier supplier, - ModelLayerLocation location, - ResourceLocation texture) { - this.baseModelPack = new ModelPack<>(supplier, location, texture); - return this; - } - - public Builder insertModel(ModelSupplier supplier, - ModelLayerLocation location, - ResourceLocation texture) { - this.insertModelPack = new ModelPack<>(supplier, location, texture); - return this; - } - - public Builder trimModel(ModelSupplier supplier, - ModelLayerLocation location, - ResourceLocation texture) { - this.trimModelPack = new ModelPack<>(supplier, location, texture); - return this; + super(context); } public FluidTankBargeRenderer build() { diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java index c9f8bebc..f0b0f75d 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java @@ -100,11 +100,11 @@ public record ModelPack( } public static class Builder { - private final EntityRendererProvider.Context context; + protected final EntityRendererProvider.Context context; - private ModelPack baseModelPack; - private ModelPack insertModelPack; - private ModelPack trimModelPack; + protected ModelPack baseModelPack; + protected ModelPack insertModelPack; + protected ModelPack trimModelPack; public Builder(EntityRendererProvider.Context context) { diff --git a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java index 5842977d..1aebff65 100644 --- a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java @@ -113,20 +113,18 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender event.registerEntityRenderer(ModEntityTypes.FISHING_BARGE.get(), (ctx) -> new FishingBargeRenderer.Builder<>(ctx) - .baseModel(BaseBargeModel::new, BaseBargeModel.OPEN_SIDES_LOCATION, - ShippingMod.entityTexture("barge/base.png")) - .stashedInsertModel(FishingInsertBargeModel::new, FishingInsertBargeModel.STASHED_LOCATION, - ShippingMod.entityTexture("barge/fishing_insert.png")) .transitionInsertModel(FishingInsertBargeModel::new, FishingInsertBargeModel.TRANSITION_LOCATION, ShippingMod.entityTexture("barge/fishing_insert.png")) .deployedInsertModel(FishingInsertBargeModel::new, FishingInsertBargeModel.DEPLOYED_LOCATION, ShippingMod.entityTexture("barge/fishing_insert.png")) + .baseModel(BaseBargeModel::new, BaseBargeModel.OPEN_SIDES_LOCATION, + ShippingMod.entityTexture("barge/base.png")) + .insertModel(FishingInsertBargeModel::new, FishingInsertBargeModel.STASHED_LOCATION, + ShippingMod.entityTexture("barge/fishing_insert.png")) .trimModel(TrimBargeModel::new, TrimBargeModel.OPEN_SIDES_LOCATION, ShippingMod.entityTexture("barge/trim.png")) .build()); -// event.registerEntityRenderer(ModEntityTypes.FISHING_BARGE.get(), FishingBargeRenderer::new); - // Tugs event.registerEntityRenderer(ModEntityTypes.ENERGY_TUG.get(), (ctx) -> new StaticVesselRenderer<>(ctx, EnergyTugModel::new, EnergyTugModel.LAYER_LOCATION, diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/fishing_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/fishing_insert.png index 640ca596d5150270c9dba91e803393d25310a7e9..420d2d72a0501a23abac1b299c03838642cc04a8 100644 GIT binary patch delta 452 zcmX@h)xNS%G}B0G|-o zj*gB14T*yX59Z|LgolSG7|CVZYAs*BeEP)BBS(&y%P~8vaRwR+E}BqY6zkBGAG&E) zB~Yu?o?ts5B~%jR7yKU$)cRPsd_D6@)WsREbb;K<+pb>Q8fNnBXU_I@TNiOQ*hXp3+Rw1#XFW%e{=(Y5N&MWp ze}WF#C;F`^iA{g}dOy>Vb?yoIOf|X;3^I%s*ZCFq78~Wg&EjJ$5i{?t`?6Vn`KE@r z=Nlwaua%j)Gc=zw`cWA*OP{;qcH@t`m-S-K?z9&0x4+Z8^MmY;_u&ir?=s4>{(aDy z!no&z$nPm(r?-5$ajC$n(tU!Q+*T9$ZMC(V*Ias3vWek!8)qEH@y`h*TH@+r}Le3KV;dF-!Cxt=(+E6mhZWH^!zy4(tn|)r6u?E(?@#o*WZ?W zqVn$)i>@SP%dTPqcyD&Z;8vAZ%$4mdVzHWsEp|A333%;J3(uMJH{TU7l6uX=Z8(YCc&uS+^wxuz1! zm5P^68js_bZ+|ozYBrmC^X82tsZ=UyWo1Q@BJ+dFmCBL4U}gI&HBLMRBj5P>$Bv9f zL|`!AR8qIf^6yI;kHN@|jh@rk=s8JJoHT|@{`~pR4wL^XP8!1{XA&PPIbIsWA=f(u z!_2z?-oO9YyvIpnIOI*G?(Y33^BLbgec;{Bj*7PJZGXe~V_Qztne+Sqze*7lfL=%JeS=N#T<|!Ns8EA9+BG#y9V`}>llIOVd&8{Nv83vGLUU(efZE`$WETA|I(Db649^iHla~%oZq(4suV~w9IZns=ew=bihjkP`NGR*^=gy-$HrFL6twL`2r|c zDw$evEr7}Qw*<(r7_>M!>3>SnAD1snl3u)gnd(^PIKN)HBuV<}?c0w1 z{re^4NG(d1mj@>FX%qr27&` zu5TB>N%tkRzTWegII6EL0DTFQ!2u|f&;b}2z$fN^!o-v47Rn_800000NkvXXu0mjf DQhlel From ab1067259df0edcb8d8a54777aa3594ce11a2c7c Mon Sep 17 00:00:00 2001 From: EDToaster Date: Tue, 10 Oct 2023 01:18:37 -0700 Subject: [PATCH 12/26] Cleanup fishing barge and fix pixel clipping --- .../insert/FishingInsertBargeModel.java | 180 +++++++----------- .../textures/entity/barge/energy_tug_trim.png | Bin 0 -> 1926 bytes .../textures/entity/barge/fishing_insert.png | Bin 514 -> 481 bytes .../textures/entity/barge/steam_tug_base.png | Bin 0 -> 2277 bytes .../textures/entity/barge/steam_tug_trim.png | Bin 0 -> 2277 bytes 5 files changed, 73 insertions(+), 107 deletions(-) create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/energy_tug_trim.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/steam_tug_base.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/steam_tug_trim.png diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java index 506ccc89..18b13ff5 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java @@ -1,7 +1,4 @@ -package dev.murad.shipping.entity.models.vessel.insert;// Made with Blockbench 4.1.1 -// Exported for Minecraft version 1.15 - 1.16 with Mojang mappings -// Paste this class into your mod and generate all required imports - +package dev.murad.shipping.entity.models.vessel.insert; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; @@ -14,109 +11,78 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; public class FishingInsertBargeModel extends EntityModel { - // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation STASHED_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishing_insert_barge_model_stashed"), "main"); - public static final ModelLayerLocation TRANSITION_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishing_insert_barge_model_transition"), "main"); - public static final ModelLayerLocation DEPLOYED_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishing_insert_barge_model_deployed"), "main"); - private final ModelPart bone; - private final ModelPart bone3; - - public FishingInsertBargeModel(ModelPart root) { - this.bone = root.getChild("bone"); - this.bone3 = root.getChild("bone3"); - } - - public static LayerDefinition createBodyLayer(FishingBargeEntity.Status status) { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); - - // TODO: most of this is duplicated - if (status == FishingBargeEntity.Status.STASHED) { - PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F), - PartPose.offset(0.0F, -3.0F, -4.0F)); - - PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), - PartPose.offset(0.0F, -7.0F, 0.0F)); - - PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -2.0F, -1.0F, 1.0F, 4.0F, 2.0F), - PartPose.offsetAndRotation(4.5F, 1.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); - - PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -10.0F, -1.0F, 1.0F, 9.0F, 2.0F), - PartPose.offset(0.0F, -3.0F, 4.0F)); - - PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), - PartPose.offset(0.0F, -7.0F, 0.0F)); - - PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -2.0F, -1.0F, 1.0F, 4.0F, 2.0F), - PartPose.offsetAndRotation(4.5F, 1.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); - - } else if (status == FishingBargeEntity.Status.TRANSITION) { - PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.8192F, -0.4264F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -9.8192F, -0.4264F, 1.0F, 9.0F, 2.0F), - PartPose.offsetAndRotation(0.0F, -3.0F, -4.0F, 0.6109F, 0.0F, 0.0F)); - - PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), - PartPose.offsetAndRotation(0.0F, -7.0F, 0.0F, -0.6109F, 0.0F, 0.0F)); - - PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(44, 8).mirror().addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F).mirror(false), - PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); - - PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.8192F, -1.5736F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -9.8192F, -1.5736F, 1.0F, 9.0F, 2.0F), - PartPose.offsetAndRotation(0.0F, -3.0F, 4.0F, -0.6109F, 0.0F, 0.0F)); - - PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), - PartPose.offsetAndRotation(0.0F, -7.0F, 0.0F, 0.6109F, 0.0F, 0.0F)); - - PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F), - PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); - - } else { - PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.0F, 0.0F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -9.0F, 0.0F, 1.0F, 9.0F, 2.0F), - PartPose.offsetAndRotation(0.0F, -3.0F, -4.0F, 1.5708F, 0.0F, 0.0F)); - - PartDefinition bone2 = bone.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), - PartPose.offsetAndRotation(0.0F, -7.0F, -1.0F, -1.5708F, 0.0F, 0.0F)); - - PartDefinition cube_r1 = bone2.addOrReplaceChild("cube_r1", CubeListBuilder.create() - .texOffs(44, 8).mirror().addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F).mirror(false), - PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, 3.1416F, 0.0F)); - - PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(6, 0).addBox(-6.0F, -9.0F, -2.0F, 1.0F, 9.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -9.0F, -2.0F, 1.0F, 9.0F, 2.0F), - PartPose.offsetAndRotation(0.0F, -3.0F, 4.0F, -1.5708F, 0.0F, 0.0F)); - - PartDefinition bone4 = bone3.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(36, 19).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F) - .texOffs(38, 8).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), - PartPose.offsetAndRotation(0.0F, -7.0F, 1.0F, 1.5708F, 0.0F, 0.0F)); - - PartDefinition cube_r2 = bone4.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(38, 8).addBox(-0.5F, -3.0F, -1.0F, 1.0F, 4.0F, 2.0F), - PartPose.offsetAndRotation(4.5F, 2.0F, 0.0F, 0.0F, -3.1416F, 0.0F)); - - } - - return LayerDefinition.create(meshdefinition, 128, 128); - } - - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bone.render(poseStack, buffer, packedLight, packedOverlay); - bone3.render(poseStack, buffer, packedLight, packedOverlay); - } + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation STASHED_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishing_insert_barge_model_stashed"), "main"); + public static final ModelLayerLocation TRANSITION_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishing_insert_barge_model_transition"), "main"); + public static final ModelLayerLocation DEPLOYED_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishing_insert_barge_model_deployed"), "main"); + private final ModelPart armsLeft; + private final ModelPart armsRight; + + public FishingInsertBargeModel(ModelPart root) { + this.armsLeft = root.getChild("arms_left"); + this.armsRight = root.getChild("arms_right"); + } + + public static LayerDefinition createBodyLayer(FishingBargeEntity.Status status) { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + float armAngle = switch (status) { + case STASHED -> 0.0F; + case TRANSITION -> 0.6109F; + case DEPLOYED -> 1.5708F; + }; + + float armY = switch (status) { + case STASHED -> -10.0F; + case TRANSITION -> -9.8192F; + case DEPLOYED -> -9.0F; + }; + + float armZ = switch (status) { + case STASHED -> 0.0F; + case TRANSITION -> 0.5736F; + case DEPLOYED -> 1.0F; + }; + + float netOffsetZ = switch(status) { + case STASHED, TRANSITION -> 0.0F; + case DEPLOYED -> 1.0F; + }; + + partdefinition.addOrReplaceChild("arms_left", CubeListBuilder.create() + .texOffs(0, 0).addBox(-6.0F, armY, -1 + armZ, 1.0F, 9.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, armY, -1 + armZ, 1.0F, 9.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -3.0F, -4.0F, armAngle, 0.0F, 0.0F)) + .addOrReplaceChild("net_left", CubeListBuilder.create() + .texOffs(12, 11).addBox(-5.0F, -1.0F, -4.0F, 10.0F, 4.0F, 7.0F) + .texOffs(6, 0).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F) + .texOffs(6, 0).addBox(4.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -7.0F, -netOffsetZ, -armAngle, 0.0F, 0.0F)); + + partdefinition.addOrReplaceChild("arms_right", CubeListBuilder.create() + .texOffs(0, 0).addBox(-6.0F, armY, -1 - armZ, 1.0F, 9.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, armY, -1 - armZ, 1.0F, 9.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -3.0F, 4.0F, -armAngle, 0.0F, 0.0F)) + .addOrReplaceChild("net_right", CubeListBuilder.create() + .texOffs(12, 0).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 4.0F, 7.0F) + .texOffs(6, 0).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F) + .texOffs(6, 0).addBox(4.0F, -1.0F, -1.0F, 1.0F, 4.0F, 2.0F), + PartPose.offsetAndRotation(0.0F, -7.0F, netOffsetZ, armAngle, 0.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 64, 64); + } + + @Override + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + armsLeft.render(poseStack, buffer, packedLight, packedOverlay); + armsRight.render(poseStack, buffer, packedLight, packedOverlay); + } } \ No newline at end of file diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/energy_tug_trim.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/energy_tug_trim.png new file mode 100644 index 0000000000000000000000000000000000000000..b174f8860e799e6ac3a929824a1f471bdf3c5dea GIT binary patch literal 1926 zcmbtV`8V5%7yX0?(poyY*oH(GRnx{+yHF(%b366`@_5M-E-bK@1A?kJud_8VkZMth5`T}<6v*& ze$Yw(l@#Ov`;q>`03hk?U~>sWC|RZGM$Dj&vi6~YFtNa?d+^rufQaKz`0s}qmszA-r5xbp>&xQv=Pp?oj;;6P zq%6PnD3TR*3183XNN+Z)v5q38bqo3Ybi73 zVcCD=PvC#SH@W4bk!BWyB9UoJYbyu{s;OZP(Q;<8j0q&i(D`TFg#)dh8=LFVqRokC zYVt_oM7Fv~jT$#1@9LN^SIs+IoOY4ibtMW**N8*~4%2ctqw1M#Xak^Yn?jH*1sv15B$ zM8LWnN;tsPE@YGo0;Lo=Wz|wu1A(FNF5*(ea>=!xBWM0hQtMk@fFD11j1z$TCpg;F zcqwLmc+eKk=V8ocv6b-{&O8-Xa=QbN*8;QGY-=96s|+@l%K7<0A%HJ3@ny+pTjF-! zM?`U1Il3Ub|Ao(ac@iT8cO!UQg8gxS{VNSEYb zjaov#@2L{>^!0ChIfpu(8TG|*4RoEpx&QE~SVGj_(D$zKSz4MntFOuuF;qx&w7{*p zp>_fPrWm($tN2!iv0hyWEWs4%;?}YBvgo9}vIo-ktYEGI(aTZsxOZ)Gofe6Q-%vzZ zBn@k8i?alpp{CSn?!^CeQql)l!Jccz48{+}hfm%moie(@ejZC^7D3YW|Cl!Z21!ubcX6d;SZ?ZC)A{jW)skdXSr~ z&a20HQ!NAz6>fE72kFv2JCJEeVxpg?{w%>QFup@Mjf0N4S10G+G(vBO;O;)*t)A(w zh}YEs*ea;4655-9B|GW7lEQIU7ArxfEIQ86A0ytJkO({Flyj&ZmgUo-`6XMUN#KCx z449O8#I@)=B9Iy>ruTzM{!Mq?bV;HL(d70|FN)w(T<4>936WCVZX7mDm2BTj*2wjxmv+RpOyejFUo^~rp^mQ=98 znmGu!I$a@H^<4kW5mpf|l~+hSU6&j7?&yRUzJ99urEFy<<3&C}S`X+fCHJSqbnq1z zof&e|;Xq30tlgen$84b;yQh?VNEx&5y4}$DT!d_R6Z>A#8?oxM*A6VC;1&Oca6@onS4nR*_(DrzND<=PB&V1E9b}1P18YL^@HwHMo-4%UuzOea8=kl64Ypt=u zVoL=D1K2vDqt{(?X)>A3&c)Yb6MG)pGGY`fzD+dwhVTAVm%!~CtP@@vax5n?+wO84 zf3FxT+d)!G(-4x90EveRfFVe43XNyGZq-NvnPz5y>IQiFL3o2t^m$z88VaT)_l)RS zYJbWVyRc}DA^m5EFqtGc=^}#gZ~OR*t*!%Tl*#d3u(BX AFaQ7m literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/fishing_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/fishing_insert.png index 420d2d72a0501a23abac1b299c03838642cc04a8..ed6020606e8b295f450381dc3406f3820d054b35 100644 GIT binary patch delta 399 zcmV;A0dW3;1mOcAiBL{Q4GJ0x0000DNk~Le0000$0000$2m=5B0G+pi?2#cWG&ddt zLnaAPF%hDWcXC}of^Su_nt8#&!IzPVr>CcEY;0FoSH#4`U@{(SJt_bI090G7Dv^LT ze-=qZK~z{r?UL&jf*=rt5k)LD-S>al_I3(VIc@#jZ?O@SNnip%=%6OXen9#dA-(E~ zQv+3qW6CK{IgJg25N_D+_Zgdx^{RN2VA8rGEbF>1%RE1@>DZtOL!L&i+%V{v%AoiH z`fvG)E5f#Q*s3MG_kdQ9`!KckVBa@vf7%mlr?4~9!C5r@Z9sjL!tp?5kg)(pEL0V| zl01;7pVUi`30$vvc<~)|PFA9uC>>cV?K-M#zYOwSK0OOe;sI-v57?rtT4IZ`YKbk% zswK84tCrZJtXlH>DIAiEzvS19vMM9FtD;Op?I^1X;=uKFlvNpePHz=amM<_yE!l({ txB=k?Za}z!8xU^b280{90r95+z!T?V|DrHjOP>G$002ovPDHLkV1h8Ut_}bI delta 432 zcmaFJ+{B{T8Q|y6%O%Cdz`(%k>ERLtq#Hn(gBeJEc`)(kL`7|rg9i`hFY z{s}r{pXj%yBsTr=>-|he*10F-Gu7AVGBC(6T3qK>+*@pv_cn`dw%7&ge&F)GU4OirbAp?q1f5IlI$Zz~BB(^Ue>lJKl#c=)cP-&-(X4 zXA0w<6C%H-gq_~<<;JA~t4j9?a$8O0x7F5eUUTVD$tH%^mB(kVzh1Au^kGR~%%Sxx he!!q09Xv>DIKe+L*eu~&*vUkYc28G7mvv4FO#ngmrzZda diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/steam_tug_base.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/steam_tug_base.png new file mode 100644 index 0000000000000000000000000000000000000000..8c8e5021da28cc62eed80da17c7a290aad56ff5a GIT binary patch literal 2277 zcmd^B`9IYA7k+;R$=1{~(zQgEiHiA3Mb-&nY-zIZRMtT?p%@G`S1MPQxys&UN@z8UWiW%ZEma%-@zvKJEInVQYp4U0QJg@V5oeUReTRCY(X#jv6*3KHY zjii5T=Z@{(Y97?N4G;lmYYD1*lz#%SvlMH6+V#4>pxErTya)2bl>9!_Y;`1u6yWz~ zn35(`gWZF_rL7%Kr{2#(c}hqKU@a%HGq!sfQbTrku32Jm83=dgeEF4(UOy+KCf+E^ z3>`nmGFTqVS~Z@t=$`E|nMy9&ikTgIL*O-@4vJD$HE-xicTaEqmL*!2WIDBNN=m~2 z=rq{i@uohoT(cS*m%p^UtBGeu7aIu&t2_$-*jVQ|;S#OZ9=F7)dy2Cc7Ou|E%?!S0 zvEoA^HZn0TBt$(r677#Sw!!QMb8{o|NUlYxxh}xCv`HTV4$HHd_U%%nq(2Ri)m#+N zeD+3vn*cROBE1B#56}s|FgrXVc4BjbqDx%-71Y8sg+1S2E+)5(0z9ptsV+wdr~_@5 zjl((wB@Ems)zjtX`_$3J zFfWx~CmOCG0H}Dj5#u4!BH5DepW04K;n?SL;a3EBXWxHM6@;OBifIzyntMTr;%9A; zqc^XsflAE@qmIfpdHVXMB#MORuqhTP=4(pyt$xapzgWPZM~gUyR(RqFgBP9JD^L0Q zDztEYbNDvdZ^%cf=2%wm+|VAk(0l!ZQ@x>P;gY4Lrf-^}xcW1lnYL92MIJF@yCF3% z$uA~kBnZh;Reevn6&z&ei&z{qiT_(4?L+x~k~2Z4;V<8-)9>Bqi?O4~_{0Ltp> z;j{BTMprefLcCx$p0CqwCj+-}g*(wIxMhU~~!lD9*+u%>IEHEUzU{`YVEl7hl=r4}T;+ z!r!HxogVZ7U8GfnRW@>3$#x-WyiJ+?X^dXs!aU=B-8{R>UXgghgysCyBNkuOBk!I3 zytEcxGa1=sxF5o#%E-4X;0^N8wS446{U}wJ8x#oyEH?;Jt+~Oo=}c@X?E*6vz|;rpTb^rAWW^)jVudRjs3Q_ zS9Zt?lf=qm1WuI0qn0jSR%`n>O$-H4VZ&aK1S;?_`?WU}kxpY2PQ9d4PPlqeB;?R% znD3;KPb$)J7be`CnQd**Wmuqnvh#M_Cs(aWnJ}~Sq=4qRWB9IEnSQqdyNI<1bxdM| zbjet(OEFM`k?1ERMXz-{DMNjz*F6aVDz0&#j$EFG9x$nHI*xudRY|)5s8?sOR6yD2 z+Q7Ima7nz)@`Jz+ra7Z-7Z^D3E!u;l2o@8`y!dbDAMld~Yh08j<`m<6O4fV^6~P!| zU_wt%=G?5Rdu70#xQH-066eK}SIy&2^@l$s3)37%m+CZ@FVbi*O!quB`{CQdZuk-b z;)HCRmmn2ewRM)8@99<>4lr(q$6DILOu8Gwx0w0KQNI*_gM5LDRYl8`&FIW((&C(V zPIx3(T#|KGIsG_V{G|cDqvRg830FN`Kdi9zRI)76D$oOUA&OBhbYRy`4l%SY;v35q ztfq-aLPxIhgUMmrM-y^CsX0@b#r*!Xd3+vjGvr1d56-r@%AZy^8ZSqg+u?pXRhc!0 zt3B^8$YsaXlf9{X0O+&RVTb{HG9^w1*lAD)b^&d9_Yqy7mYIh$0cEb9;dOv?9A_^8 jBwP^nzp($`0TG;HNt?Dq-1)ryw*c%JXX|Rqz_kAXD~J{N literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/steam_tug_trim.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/steam_tug_trim.png new file mode 100644 index 0000000000000000000000000000000000000000..8c8e5021da28cc62eed80da17c7a290aad56ff5a GIT binary patch literal 2277 zcmd^B`9IYA7k+;R$=1{~(zQgEiHiA3Mb-&nY-zIZRMtT?p%@G`S1MPQxys&UN@z8UWiW%ZEma%-@zvKJEInVQYp4U0QJg@V5oeUReTRCY(X#jv6*3KHY zjii5T=Z@{(Y97?N4G;lmYYD1*lz#%SvlMH6+V#4>pxErTya)2bl>9!_Y;`1u6yWz~ zn35(`gWZF_rL7%Kr{2#(c}hqKU@a%HGq!sfQbTrku32Jm83=dgeEF4(UOy+KCf+E^ z3>`nmGFTqVS~Z@t=$`E|nMy9&ikTgIL*O-@4vJD$HE-xicTaEqmL*!2WIDBNN=m~2 z=rq{i@uohoT(cS*m%p^UtBGeu7aIu&t2_$-*jVQ|;S#OZ9=F7)dy2Cc7Ou|E%?!S0 zvEoA^HZn0TBt$(r677#Sw!!QMb8{o|NUlYxxh}xCv`HTV4$HHd_U%%nq(2Ri)m#+N zeD+3vn*cROBE1B#56}s|FgrXVc4BjbqDx%-71Y8sg+1S2E+)5(0z9ptsV+wdr~_@5 zjl((wB@Ems)zjtX`_$3J zFfWx~CmOCG0H}Dj5#u4!BH5DepW04K;n?SL;a3EBXWxHM6@;OBifIzyntMTr;%9A; zqc^XsflAE@qmIfpdHVXMB#MORuqhTP=4(pyt$xapzgWPZM~gUyR(RqFgBP9JD^L0Q zDztEYbNDvdZ^%cf=2%wm+|VAk(0l!ZQ@x>P;gY4Lrf-^}xcW1lnYL92MIJF@yCF3% z$uA~kBnZh;Reevn6&z&ei&z{qiT_(4?L+x~k~2Z4;V<8-)9>Bqi?O4~_{0Ltp> z;j{BTMprefLcCx$p0CqwCj+-}g*(wIxMhU~~!lD9*+u%>IEHEUzU{`YVEl7hl=r4}T;+ z!r!HxogVZ7U8GfnRW@>3$#x-WyiJ+?X^dXs!aU=B-8{R>UXgghgysCyBNkuOBk!I3 zytEcxGa1=sxF5o#%E-4X;0^N8wS446{U}wJ8x#oyEH?;Jt+~Oo=}c@X?E*6vz|;rpTb^rAWW^)jVudRjs3Q_ zS9Zt?lf=qm1WuI0qn0jSR%`n>O$-H4VZ&aK1S;?_`?WU}kxpY2PQ9d4PPlqeB;?R% znD3;KPb$)J7be`CnQd**Wmuqnvh#M_Cs(aWnJ}~Sq=4qRWB9IEnSQqdyNI<1bxdM| zbjet(OEFM`k?1ERMXz-{DMNjz*F6aVDz0&#j$EFG9x$nHI*xudRY|)5s8?sOR6yD2 z+Q7Ima7nz)@`Jz+ra7Z-7Z^D3E!u;l2o@8`y!dbDAMld~Yh08j<`m<6O4fV^6~P!| zU_wt%=G?5Rdu70#xQH-066eK}SIy&2^@l$s3)37%m+CZ@FVbi*O!quB`{CQdZuk-b z;)HCRmmn2ewRM)8@99<>4lr(q$6DILOu8Gwx0w0KQNI*_gM5LDRYl8`&FIW((&C(V zPIx3(T#|KGIsG_V{G|cDqvRg830FN`Kdi9zRI)76D$oOUA&OBhbYRy`4l%SY;v35q ztfq-aLPxIhgUMmrM-y^CsX0@b#r*!Xd3+vjGvr1d56-r@%AZy^8ZSqg+u?pXRhc!0 zt3B^8$YsaXlf9{X0O+&RVTb{HG9^w1*lAD)b^&d9_Yqy7mYIh$0cEb9;dOv?9A_^8 jBwP^nzp($`0TG;HNt?Dq-1)ryw*c%JXX|Rqz_kAXD~J{N literal 0 HcmV?d00001 From 6ed9612532f9afd008e7c1d850757bc06c20a387 Mon Sep 17 00:00:00 2001 From: EDToaster Date: Tue, 10 Oct 2023 04:09:47 -0700 Subject: [PATCH 13/26] Dyeable tugs --- .../dev/murad/shipping/entity/Colorable.java | 10 +++ .../entity/custom/vessel/VesselEntity.java | 5 +- .../custom/vessel/tug/AbstractTugEntity.java | 13 ++- .../entity/models/vessel/BaseBargeModel.java | 18 +++-- .../entity/models/vessel/EmptyModel.java | 6 +- .../entity/models/vessel/EnergyTugModel.java | 12 +-- .../entity/models/vessel/SteamTugModel.java | 42 +++++----- .../entity/models/vessel/TrimBargeModel.java | 6 +- .../vessel/insert/CubeInsertBargeModel.java | 6 +- .../insert/FishingInsertBargeModel.java | 4 +- .../insert/FluidTankInsertBargeModel.java | 6 +- .../vessel/insert/RingsInsertBargeModel.java | 6 +- .../vessel/insert/SeaterInsertBargeModel.java | 6 +- .../render/barge/MultipartVesselRenderer.java | 27 ++++++- .../shipping/event/ModClientEventHandler.java | 75 +++++++++++------- .../textures/entity/barge/energy_tug_base.png | Bin 0 -> 822 bytes .../textures/entity/barge/energy_tug_trim.png | Bin 1926 -> 642 bytes .../textures/entity/barge/steam_tug_base.png | Bin 2277 -> 666 bytes .../textures/entity/barge/steam_tug_trim.png | Bin 2277 -> 766 bytes 19 files changed, 161 insertions(+), 81 deletions(-) create mode 100644 src/main/java/dev/murad/shipping/entity/Colorable.java create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/barge/energy_tug_base.png diff --git a/src/main/java/dev/murad/shipping/entity/Colorable.java b/src/main/java/dev/murad/shipping/entity/Colorable.java new file mode 100644 index 00000000..2f638467 --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/Colorable.java @@ -0,0 +1,10 @@ +package dev.murad.shipping.entity; + +import javax.annotation.Nullable; + +public interface Colorable { + @Nullable + Integer getColor(); + + void setColor(@Nullable Integer color); +} diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java index 5884504d..2c0e1330 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/VesselEntity.java @@ -1,8 +1,8 @@ package dev.murad.shipping.entity.custom.vessel; import dev.murad.shipping.ShippingConfig; +import dev.murad.shipping.entity.Colorable; import dev.murad.shipping.entity.custom.TrainInventoryProvider; -import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.setup.ModItems; import dev.murad.shipping.util.LinkableEntity; import dev.murad.shipping.util.LinkingHandler; @@ -36,7 +36,6 @@ import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.NameTagItem; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; @@ -64,7 +63,7 @@ import java.util.Optional; import java.util.stream.Stream; -public abstract class VesselEntity extends WaterAnimal implements LinkableEntity { +public abstract class VesselEntity extends WaterAnimal implements LinkableEntity, Colorable { public static final EntityDataAccessor COLOR_DATA = SynchedEntityData.defineId(VesselEntity.class, EntityDataSerializers.INT); private final static double NAMETAG_RENDERING_DISTANCE = 15; diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/tug/AbstractTugEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/tug/AbstractTugEntity.java index 51dd0946..7072a502 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/tug/AbstractTugEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/tug/AbstractTugEntity.java @@ -36,6 +36,7 @@ import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; @@ -304,11 +305,17 @@ protected PathNavigation createNavigation(Level p_175447_1_) { @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { - if (!player.level().isClientSide()) { + if (!this.level().isClientSide) { + var color = DyeColor.getColor(player.getItemInHand(hand)); - NetworkHooks.openScreen((ServerPlayer) player, createContainerProvider(), getDataAccessor()::write); + if (color != null) { + this.getEntityData().set(COLOR_DATA, color.getId()); + } else { + NetworkHooks.openScreen((ServerPlayer) player, createContainerProvider(), getDataAccessor()::write); + } } - return InteractionResult.CONSUME; + + return InteractionResult.sidedSuccess(this.level().isClientSide); } @Override diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java index 93f1253b..e413b352 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -10,8 +11,9 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; -public class BaseBargeModel extends EntityModel { +public class BaseBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation CLOSED_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model_closed"), "main"); public static final ModelLayerLocation OPEN_FRONT_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model_open_front"), "main"); @@ -29,28 +31,28 @@ public static LayerDefinition createBodyLayer(boolean closedFront, boolean close var listBuilder = CubeListBuilder.create() // Main - .texOffs(0, 0).addBox(-6.0F, -27.0F, -7.0F, 12.0F, 5.0F, 14.0F) + .texOffs(0, 0).addBox(-6.0F, -5F, -7.0F, 12.0F, 5.0F, 14.0F) // Back Side - .texOffs(0, 19).addBox(-8.0F, -27.0F, -7.0F, 2.0F, 2.0F, 14.0F); + .texOffs(0, 19).addBox(-8.0F, -5F, -7.0F, 2.0F, 2.0F, 14.0F); if (closedFront) { // Front Side - listBuilder.texOffs(0, 19).addBox(6.0F, -27.0F, -7.0F, 2.0F, 2.0F, 14.0F); + listBuilder.texOffs(0, 19).addBox(6.0F, -5F, -7.0F, 2.0F, 2.0F, 14.0F); } if (closedSides) { // Short Sides - listBuilder.texOffs(19, 21).addBox(-6.0F, -27.0F, -9.0F, 12.0F, 2.0F, 2.0F) - .texOffs(19, 21).addBox(-6.0F, -27.0F, 7.0F, 12.0F, 2.0F, 2.0F); + listBuilder.texOffs(19, 21).addBox(-6.0F, -5F, -9.0F, 12.0F, 2.0F, 2.0F) + .texOffs(19, 21).addBox(-6.0F, -5F, 7.0F, 12.0F, 2.0F, 2.0F); } - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", listBuilder, PartPose.offset(0.0F, 23.0F, 0.0F)); + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", listBuilder, PartPose.ZERO); return LayerDefinition.create(meshdefinition, 64, 64); } @Override - public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/EmptyModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/EmptyModel.java index 71dbc0fa..9729d820 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/EmptyModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/EmptyModel.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -13,8 +14,9 @@ import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; -public class EmptyModel extends EntityModel { +public class EmptyModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_barge_model_closed"), "main"); private final ModelPart bb_main; @@ -33,7 +35,7 @@ public static LayerDefinition createBodyLayer() { } @Override - public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/EnergyTugModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/EnergyTugModel.java index 419e58bf..9b2b4fb1 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/EnergyTugModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/EnergyTugModel.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; import dev.murad.shipping.entity.custom.vessel.tug.AbstractTugEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -10,10 +11,11 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; -public class EnergyTugModel extends EntityModel { +public class EnergyTugModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "energytugmodel"), "main"); + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "energy_tug_model"), "main"); private final ModelPart bb_main; public EnergyTugModel(ModelPart root) { @@ -33,18 +35,18 @@ public static LayerDefinition createBodyLayer() { .texOffs(0, 0).addBox(-3.0F, -20.0F, -14.0F, 6.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)) .texOffs(40, 60).addBox(-4.0F, -21.0F, -15.0F, 8.0F, 1.0F, 8.0F, new CubeDeformation(0.0F)) .texOffs(0, 0).addBox(-7.0F, -9.0F, -19.0F, 14.0F, 6.0F, 24.0F, new CubeDeformation(0.25F)) - .texOffs(52, 42).addBox(-0.5F, -27.0F, -11.0F, 1.0F, 6.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + .texOffs(52, 42).addBox(-0.5F, -27.0F, -11.0F, 1.0F, 6.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 6.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 128, 128); } @Override - public void setupAnim(AbstractTugEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } @Override public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bb_main.render(poseStack, buffer, packedLight, packedOverlay); + bb_main.render(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); } } \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/SteamTugModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/SteamTugModel.java index c39938b7..7818f67e 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/SteamTugModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/SteamTugModel.java @@ -3,6 +3,9 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; +import dev.murad.shipping.entity.custom.vessel.VesselEntity; +import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.entity.custom.vessel.tug.AbstractTugEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -10,10 +13,11 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; -public class SteamTugModel extends EntityModel { +public class SteamTugModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "steamtugmodel"), "main"); + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "steam_tug_model"), "main"); private final ModelPart bb_main; public SteamTugModel(ModelPart root) { @@ -24,31 +28,33 @@ public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-7.0F, -10.0F, -19.0F, 14.0F, 6.0F, 24.0F, new CubeDeformation(0.0F)) - .texOffs(0, 50).addBox(-9.0F, -12.0F, -19.0F, 2.0F, 4.0F, 24.0F, new CubeDeformation(0.0F)) - .texOffs(44, 30).addBox(7.0F, -12.0F, -19.0F, 2.0F, 4.0F, 24.0F, new CubeDeformation(0.0F)) - .texOffs(60, 66).addBox(-7.0F, -12.0F, 5.0F, 14.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(28, 66).addBox(-7.0F, -12.0F, -21.0F, 14.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(53, 0).addBox(-6.0F, -18.0F, -13.0F, 12.0F, 8.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(0, 30).addBox(-8.0F, -20.0F, -15.0F, 16.0F, 2.0F, 18.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-2.0F, -26.0F, -5.0F, 4.0F, 6.0F, 4.0F, new CubeDeformation(0.0F)) - .texOffs(0, 10).addBox(-2.0F, -25.25F, -5.0F, 4.0F, 2.0F, 4.0F, new CubeDeformation(0.5F)) - .texOffs(28, 58).addBox(-9.0F, -11.0F, -21.0F, 18.0F, 2.0F, 6.0F, new CubeDeformation(0.25F)) - .texOffs(0, 0).addBox(-2.0F, -26.0F, -11.0F, 4.0F, 6.0F, 4.0F, new CubeDeformation(0.0F)) - .texOffs(0, 10).addBox(-2.0F, -25.25F, -11.0F, 4.0F, 2.0F, 4.0F, new CubeDeformation(0.5F)) - .texOffs(6, 5).addBox(-1.0F, -14.0F, 7.0F, 2.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(2, 5).addBox(-1.0F, -14.0F, 6.0F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() + .texOffs(0, 0).addBox(-7.0F, 13.0F, -19.0F, 14.0F, 6.0F, 24.0F) + .texOffs(0, 50).addBox(-9.0F, 11.0F, -19.0F, 2.0F, 4.0F, 24.0F) + .texOffs(44, 30).addBox(7.0F, 11.0F, -19.0F, 2.0F, 4.0F, 24.0F) + .texOffs(60, 66).addBox(-7.0F, 11.0F, 5.0F, 14.0F, 4.0F, 2.0F) + .texOffs(28, 66).addBox(-7.0F, 11.0F, -21.0F, 14.0F, 4.0F, 2.0F) + .texOffs(53, 0).addBox(-6.0F, 5.0F, -13.0F, 12.0F, 8.0F, 14.0F) + .texOffs(0, 30).addBox(-8.0F, 3.0F, -15.0F, 16.0F, 2.0F, 18.0F) + .texOffs(0, 0).addBox(-2.0F, -3.0F, -5.0F, 4.0F, 6.0F, 4.0F) + .texOffs(0, 10).addBox(-2.0F, -2.25F, -5.0F, 4.0F, 2.0F, 4.0F, new CubeDeformation(0.5F)) + .texOffs(28, 58).addBox(-9.0F, 12.0F, -21.0F, 18.0F, 2.0F, 6.0F, new CubeDeformation(0.25F)) + .texOffs(0, 0).addBox(-2.0F, -3.0F, -11.0F, 4.0F, 6.0F, 4.0F) + .texOffs(0, 10).addBox(-2.0F, -2.25F, -11.0F, 4.0F, 2.0F, 4.0F, new CubeDeformation(0.5F)) + .texOffs(6, 5).addBox(-1.0F, 10.0F, 7.0F, 2.0F, 3.0F, 1.0F) + .texOffs(2, 5).addBox(-1.0F, 10.0F, 6.0F, 2.0F, 1.0F, 1.0F), + PartPose.offset(0.0F, -16.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 128, 128); } @Override - public void setupAnim(AbstractTugEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } @Override public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bb_main.render(poseStack, buffer, packedLight, packedOverlay); + bb_main.render(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); } } \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java index 9d5079e1..43cf8352 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -13,8 +14,9 @@ import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; -public class TrimBargeModel extends EntityModel { +public class TrimBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation CLOSED_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "trim_barge_model_closed"), "main"); public static final ModelLayerLocation OPEN_FRONT_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "trim_barge_model_open_front"), "main"); @@ -49,7 +51,7 @@ public static LayerDefinition createBodyLayer(boolean closedFront, boolean close } @Override - public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/CubeInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/CubeInsertBargeModel.java index abd6e8fb..2b97ff3d 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/CubeInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/CubeInsertBargeModel.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; import dev.murad.shipping.entity.custom.vessel.VesselEntity; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.entity.custom.vessel.barge.ChestBargeEntity; @@ -12,8 +13,9 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; -public class CubeInsertBargeModel extends EntityModel { +public class CubeInsertBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "cube_insert_barge_model"), "main"); private final ModelPart bb_main; @@ -35,7 +37,7 @@ public static LayerDefinition createBodyLayer() { } @Override - public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java index 18b13ff5..deedf9de 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.entity.custom.vessel.barge.FishingBargeEntity; import net.minecraft.client.model.EntityModel; @@ -11,8 +12,9 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; -public class FishingInsertBargeModel extends EntityModel { +public class FishingInsertBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation STASHED_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishing_insert_barge_model_stashed"), "main"); public static final ModelLayerLocation TRANSITION_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fishing_insert_barge_model_transition"), "main"); diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FluidTankInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FluidTankInsertBargeModel.java index 252eef84..87efb689 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FluidTankInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FluidTankInsertBargeModel.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.entity.custom.vessel.barge.FluidTankBargeEntity; import net.minecraft.client.model.EntityModel; @@ -11,8 +12,9 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; -public class FluidTankInsertBargeModel extends EntityModel { +public class FluidTankInsertBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fluid_tank_insert_barge_model"), "main"); private final ModelPart bb_main; @@ -47,7 +49,7 @@ public static LayerDefinition createBodyLayer() { } @Override - public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/RingsInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/RingsInsertBargeModel.java index cf18162d..01a1382a 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/RingsInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/RingsInsertBargeModel.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; import dev.murad.shipping.entity.custom.vessel.VesselEntity; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import net.minecraft.client.model.EntityModel; @@ -11,8 +12,9 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; -public class RingsInsertBargeModel extends EntityModel { +public class RingsInsertBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "rings_insert_barge_model"), "main"); private final ModelPart bb_main; @@ -51,7 +53,7 @@ public static LayerDefinition createBodyLayer() { } @Override - public void setupAnim(AbstractBargeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/SeaterInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/SeaterInsertBargeModel.java index ba0ab939..96a4b790 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/SeaterInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/insert/SeaterInsertBargeModel.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.entity.custom.vessel.barge.SeaterBargeEntity; import net.minecraft.client.model.EntityModel; @@ -11,8 +12,9 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; -public class SeaterInsertBargeModel extends EntityModel { +public class SeaterInsertBargeModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "seater_insert_barge_model"), "main"); private final ModelPart bb_main; @@ -43,7 +45,7 @@ public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packe } @Override - public void setupAnim(AbstractBargeEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { + public void setupAnim(T pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { } } \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java index f0b0f75d..2d51dad9 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java @@ -1,10 +1,11 @@ package dev.murad.shipping.entity.render.barge; import com.mojang.blaze3d.vertex.PoseStack; -import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.vessel.VesselEntity; +import dev.murad.shipping.entity.models.vessel.EmptyModel; import lombok.Getter; import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.Model; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.MultiBufferSource; @@ -15,7 +16,10 @@ import net.minecraft.world.item.DyeColor; import org.jetbrains.annotations.NotNull; -public class MultipartVesselRenderer extends AbstractVesselRenderer { +public class MultipartVesselRenderer extends AbstractVesselRenderer { + + // TODO: de-uglify + private float rotation = 90f; @Getter private final EntityModel baseModel, insertModel, trimModel; @@ -88,6 +92,15 @@ protected void renderTrimModel(T vesselEntity, PoseStack matrixStack, MultiBuffe color[0], color[1], color[2], 1.0F); } + public MultipartVesselRenderer derotate() { + this.rotation = 0; + return this; + } + + protected float getModelYrot() { + return rotation; + } + @FunctionalInterface public interface ModelSupplier { EntityModel supply(ModelPart root); @@ -99,7 +112,7 @@ public record ModelPack( ResourceLocation texture) { } - public static class Builder { + public static class Builder { protected final EntityRendererProvider.Context context; protected ModelPack baseModelPack; @@ -125,6 +138,12 @@ public Builder insertModel(ModelSupplier supplier, return this; } + public Builder emptyInsert() { + insertModel(EmptyModel::new, EmptyModel.LAYER_LOCATION, ShippingMod.entityTexture("emptytexture.png")); + return this; + } + + public Builder trimModel(ModelSupplier supplier, ModelLayerLocation location, ResourceLocation texture) { diff --git a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java index 1aebff65..bad05f04 100644 --- a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java @@ -126,36 +126,57 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender .build()); // Tugs - event.registerEntityRenderer(ModEntityTypes.ENERGY_TUG.get(), - (ctx) -> new StaticVesselRenderer<>(ctx, EnergyTugModel::new, EnergyTugModel.LAYER_LOCATION, - new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/energy_tug.png")) { - // todo: fix in models itself - @Override - protected double getModelYoffset() { - return 1.55D; - } - - @Override - protected float getModelYrot() { - return 0.0F; - } - }); +// event.registerEntityRenderer(ModEntityTypes.ENERGY_TUG.get(), +// (ctx) -> new StaticVesselRenderer<>(ctx, EnergyTugModel::new, EnergyTugModel.LAYER_LOCATION, +// new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/energy_tug.png")) { +// // todo: fix in models itself +// @Override +// protected double getModelYoffset() { +// return 1.55D; +// } +// +// @Override +// protected float getModelYrot() { +// return 0.0F; +// } +// }); + + +// event.registerEntityRenderer(ModEntityTypes.STEAM_TUG.get(), +// (ctx) -> new StaticVesselRenderer<>(ctx, SteamTugModel::new, SteamTugModel.LAYER_LOCATION, +// new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/tug.png")) { +// // todo: fix in models itself +// @Override +// protected double getModelYoffset() { +// return 1.45D; +// } +// +// @Override +// protected float getModelYrot() { +// return 0; +// } +// }); + event.registerEntityRenderer(ModEntityTypes.ENERGY_TUG.get(), + (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) + .baseModel(EnergyTugModel::new, EnergyTugModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/energy_tug_base.png")) + .emptyInsert() + .trimModel(EnergyTugModel::new, EnergyTugModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/energy_tug_trim.png")) + .build() + // TODO: this is a hack + .derotate()); event.registerEntityRenderer(ModEntityTypes.STEAM_TUG.get(), - (ctx) -> new StaticVesselRenderer<>(ctx, SteamTugModel::new, SteamTugModel.LAYER_LOCATION, - new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/tug.png")) { - // todo: fix in models itself - @Override - protected double getModelYoffset() { - return 1.45D; - } - - @Override - protected float getModelYrot() { - return 0; - } - }); + (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) + .baseModel(SteamTugModel::new, SteamTugModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/steam_tug_base.png")) + .emptyInsert() + .trimModel(SteamTugModel::new, SteamTugModel.LAYER_LOCATION, + ShippingMod.entityTexture("barge/steam_tug_trim.png")) + .build() + .derotate()); event.registerEntityRenderer(ModEntityTypes.STEAM_LOCOMOTIVE.get(), ctx -> new TrainCarRenderer<>(ctx, SteamLocomotiveModel::new, diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/energy_tug_base.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/energy_tug_base.png new file mode 100644 index 0000000000000000000000000000000000000000..a1d75dcd6380c54c5201049d024dda470fe74d38 GIT binary patch literal 822 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&F%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl|-3h)VWHP+H{vbGNJ@OXCR%E@)>ZXG@>BPFG!rInD7U}k1kTU#5PSdv%K z161Dm=|KmO;wuUA3;vG`7+eqBIRTX6Ebxdd1}ZoV!i>lBSEMj7FjafHIEGZjy`9Os zy-9(m?Wy<<4WfG=K{SG-0!eOm1~Ev8y!1zvGZIg--CBqtPl3` zGj_Q#9Q#@E_nxGg?NVb#o!Rq(3>!)nnOGDZ?(-jJ?RGu+Hgcw*gBA1PufK|AFHO3= zdDBumg98~BFE%~-wx(cp%WO$X>`0$XU9npgL@J=ZRM5=QF;{ z@4mfxkx$MV)Ac?_Ei_W+BFEs%@Ishj&5NA^TX_@Y8Mg5{d~uwR$t3XIe2F>3iCqz*4W0ZN2X-?qS$vgo zM>gk#vQ^9trv+Xe;0f_KI@!R+fVq@$lFfv^uw=`7j2_mZj5qq4eoxlm(E3v`>(-Cw zyRFz1_U+rVjge<>1B0W83Dbhiqy2x{T-M1l1k7PmTl!&SCt;zd)AZjNQE^W5$I4ytDc4)ahvdnLYCa z^Z7ETQ%gHn*b2HR9949G$n&5jBxcz&hWp#(52)^_DXx3P?O^TS))_ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/energy_tug_trim.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/energy_tug_trim.png index b174f8860e799e6ac3a929824a1f471bdf3c5dea..618cc30a0aead647c42bdef55ce92ff050bcdb21 100644 GIT binary patch literal 642 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&F%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl}25AX?boiSs^+O=!Xo;~~M(IcSPqu#HaK#H{_$S?Rm5HS4S#up3};4JWn zEM{QfI}E~%$MaXD01bcb>Eakt5%+dRcTtN1kL%Lc|Lcn<7la--?sVi*?)#fFuWpzq zb70ZsOgSD_4F^W9fCeU!1rFkknl)=%j>-MzSi_b$%Z=mCK~(`Kqvu9%jNGC`^%!S9 z&$)V9A~UpRO~W;lM>{tioi}_$^{W!KxZBBf5$AcpkebB!>Mzh_9wgEFX6SkynX9pvzVGre}(Fk z;%ltVi7(+4j}OvaV49>VD$pw$D$IAQ;G^nQCeA3oiCP=WoUXNX>#r0IxOVPhg~RXr zhw@%JSj|t}5}5Lnh41&Yg^$i?9BMT>t=f>RF2nRw>ddd1>5{%yrb0LB<=;GK*{Qfm zXMV%I=od^6!knLXWNn(mv~jxVmIfQQuBK@mPB%BLF55pP?Qu3J94)>v%2c?k%ou0m+?;+FMI|3V)U-(p0w13Wh!41y~nnI8NY%)>&+Y-(6QoE_|2HT!& z=U<%W(;X&2T>C{hkK;=t(DMw4=)uNpW_|Wkx_%b366`@_5M-E-bK@1A?kJud_8VkZMth5`T}<6v*& ze$Yw(l@#Ov`;q>`03hk?U~>sWC|RZGM$Dj&vi6~YFtNa?d+^rufQaKz`0s}qmszA-r5xbp>&xQv=Pp?oj;;6P zq%6PnD3TR*3183XNN+Z)v5q38bqo3Ybi73 zVcCD=PvC#SH@W4bk!BWyB9UoJYbyu{s;OZP(Q;<8j0q&i(D`TFg#)dh8=LFVqRokC zYVt_oM7Fv~jT$#1@9LN^SIs+IoOY4ibtMW**N8*~4%2ctqw1M#Xak^Yn?jH*1sv15B$ zM8LWnN;tsPE@YGo0;Lo=Wz|wu1A(FNF5*(ea>=!xBWM0hQtMk@fFD11j1z$TCpg;F zcqwLmc+eKk=V8ocv6b-{&O8-Xa=QbN*8;QGY-=96s|+@l%K7<0A%HJ3@ny+pTjF-! zM?`U1Il3Ub|Ao(ac@iT8cO!UQg8gxS{VNSEYb zjaov#@2L{>^!0ChIfpu(8TG|*4RoEpx&QE~SVGj_(D$zKSz4MntFOuuF;qx&w7{*p zp>_fPrWm($tN2!iv0hyWEWs4%;?}YBvgo9}vIo-ktYEGI(aTZsxOZ)Gofe6Q-%vzZ zBn@k8i?alpp{CSn?!^CeQql)l!Jccz48{+}hfm%moie(@ejZC^7D3YW|Cl!Z21!ubcX6d;SZ?ZC)A{jW)skdXSr~ z&a20HQ!NAz6>fE72kFv2JCJEeVxpg?{w%>QFup@Mjf0N4S10G+G(vBO;O;)*t)A(w zh}YEs*ea;4655-9B|GW7lEQIU7ArxfEIQ86A0ytJkO({Flyj&ZmgUo-`6XMUN#KCx z449O8#I@)=B9Iy>ruTzM{!Mq?bV;HL(d70|FN)w(T<4>936WCVZX7mDm2BTj*2wjxmv+RpOyejFUo^~rp^mQ=98 znmGu!I$a@H^<4kW5mpf|l~+hSU6&j7?&yRUzJ99urEFy<<3&C}S`X+fCHJSqbnq1z zof&e|;Xq30tlgen$84b;yQh?VNEx&5y4}$DT!d_R6Z>A#8?oxM*A6VC;1&Oca6@onS4nR*_(DrzND<=PB&V1E9b}1P18YL^@HwHMo-4%UuzOea8=kl64Ypt=u zVoL=D1K2vDqt{(?X)>A3&c)Yb6MG)pGGY`fzD+dwhVTAVm%!~CtP@@vax5n?+wO84 zf3FxT+d)!G(-4x90EveRfFVe43XNyGZq-NvnPz5y>IQiFL3o2t^m$z88VaT)_l)RS zYJbWVyRc}DA^m5EFqtGc=^}#gZ~OR*t*!%Tl*#d3u(BX AFaQ7m diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/steam_tug_base.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/steam_tug_base.png index 8c8e5021da28cc62eed80da17c7a290aad56ff5a..34c62f6304ba2cb56bb51c43162c622c8cf8c8b6 100644 GIT binary patch literal 666 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&F%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl|-4e$wZb+WcL*3y!fkdP4&2=MU8jEgJD%bU{J*qonV86O`T8v5+Ym6Pk% z-8y_2sAKnKtwc{q^b#WXvo+qp^%UrAc=r$H{hk!THN<8Oph)rnUa((*l1tK2LRNeio z9t1AwF|bMYcbIVa)o(BMKPL)j=?N^Zxi6GhajdUF?vmAn8dur#+Zqyi1t#PiSax9b zk7~x_(!8f)B)NZCryVn9>ienO<)~h}Hokb)wd)5zNG)Js)o@_s3TR*wL1rFcX8gPO z{z8UWiW%ZEma%-@zvKJEInVQYp4U0QJg@V5oeUReTRCY(X#jv6*3KHY zjii5T=Z@{(Y97?N4G;lmYYD1*lz#%SvlMH6+V#4>pxErTya)2bl>9!_Y;`1u6yWz~ zn35(`gWZF_rL7%Kr{2#(c}hqKU@a%HGq!sfQbTrku32Jm83=dgeEF4(UOy+KCf+E^ z3>`nmGFTqVS~Z@t=$`E|nMy9&ikTgIL*O-@4vJD$HE-xicTaEqmL*!2WIDBNN=m~2 z=rq{i@uohoT(cS*m%p^UtBGeu7aIu&t2_$-*jVQ|;S#OZ9=F7)dy2Cc7Ou|E%?!S0 zvEoA^HZn0TBt$(r677#Sw!!QMb8{o|NUlYxxh}xCv`HTV4$HHd_U%%nq(2Ri)m#+N zeD+3vn*cROBE1B#56}s|FgrXVc4BjbqDx%-71Y8sg+1S2E+)5(0z9ptsV+wdr~_@5 zjl((wB@Ems)zjtX`_$3J zFfWx~CmOCG0H}Dj5#u4!BH5DepW04K;n?SL;a3EBXWxHM6@;OBifIzyntMTr;%9A; zqc^XsflAE@qmIfpdHVXMB#MORuqhTP=4(pyt$xapzgWPZM~gUyR(RqFgBP9JD^L0Q zDztEYbNDvdZ^%cf=2%wm+|VAk(0l!ZQ@x>P;gY4Lrf-^}xcW1lnYL92MIJF@yCF3% z$uA~kBnZh;Reevn6&z&ei&z{qiT_(4?L+x~k~2Z4;V<8-)9>Bqi?O4~_{0Ltp> z;j{BTMprefLcCx$p0CqwCj+-}g*(wIxMhU~~!lD9*+u%>IEHEUzU{`YVEl7hl=r4}T;+ z!r!HxogVZ7U8GfnRW@>3$#x-WyiJ+?X^dXs!aU=B-8{R>UXgghgysCyBNkuOBk!I3 zytEcxGa1=sxF5o#%E-4X;0^N8wS446{U}wJ8x#oyEH?;Jt+~Oo=}c@X?E*6vz|;rpTb^rAWW^)jVudRjs3Q_ zS9Zt?lf=qm1WuI0qn0jSR%`n>O$-H4VZ&aK1S;?_`?WU}kxpY2PQ9d4PPlqeB;?R% znD3;KPb$)J7be`CnQd**Wmuqnvh#M_Cs(aWnJ}~Sq=4qRWB9IEnSQqdyNI<1bxdM| zbjet(OEFM`k?1ERMXz-{DMNjz*F6aVDz0&#j$EFG9x$nHI*xudRY|)5s8?sOR6yD2 z+Q7Ima7nz)@`Jz+ra7Z-7Z^D3E!u;l2o@8`y!dbDAMld~Yh08j<`m<6O4fV^6~P!| zU_wt%=G?5Rdu70#xQH-066eK}SIy&2^@l$s3)37%m+CZ@FVbi*O!quB`{CQdZuk-b z;)HCRmmn2ewRM)8@99<>4lr(q$6DILOu8Gwx0w0KQNI*_gM5LDRYl8`&FIW((&C(V zPIx3(T#|KGIsG_V{G|cDqvRg830FN`Kdi9zRI)76D$oOUA&OBhbYRy`4l%SY;v35q ztfq-aLPxIhgUMmrM-y^CsX0@b#r*!Xd3+vjGvr1d56-r@%AZy^8ZSqg+u?pXRhc!0 zt3B^8$YsaXlf9{X0O+&RVTb{HG9^w1*lAD)b^&d9_Yqy7mYIh$0cEb9;dOv?9A_^8 jBwP^nzp($`0TG;HNt?Dq-1)ryw*c%JXX|Rqz_kAXD~J{N diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/steam_tug_trim.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/steam_tug_trim.png index 8c8e5021da28cc62eed80da17c7a290aad56ff5a..5eaf5ba0ea1e5c2129d08b1299c6484b4de413e4 100644 GIT binary patch delta 753 zcmaDV_>XmhWIZzj1H+dG6Mq6J#^NA%Cx&(BWL^R}Ea{HEjtmSN`?>!lvI6-$0X`wF zGiJHOyh6N)(cJ1<8iF1Nbi<{!2=!noD9yWRXj6!)4#r>aD z`zyEIJW{`OF80xKV_$V`S=5VFtJC|&jnHJ3u z9lemlz`#zi;q86-kNsbb4~&fS^&K|=4f!yw;p(xEtTCUbB|do| zo;dw%^<$aRrWKpcY>%4C5+!?2@WFHW4fk@&cE&0gm-Vs)F;!oG{BCYiwK)IX)c6DI zbj-y6uo)JtZrW6DZg-I1Yf19F_IHznKm3{#d(ikx;;IKTA2J=#F21iJ?Rr#r>*8-8 zF2t6xCy3?5bpgY^F<-nR-~Gmi8z!gp?!SJ2SvVqV+FV^XiL0;QZ`Mz!-uQO;**TjG zy=5;6a(rErWR|wld0#oJfvo-7ux~fno+nSUdJ@oZ)_Z6CgRbv;c(UrQHOw{fxuvJ9 z#-XRX#Q1%s9uW1NBHvMP%Nl}|X>n#3$*+UnS)`Mc+fk|jW10)e(G7B~z cu=&r_lD2`(Sm@deV1i`uboFyt=akR{0N-y!-~a#s literal 2277 zcmd^B`9IYA7k+;R$=1{~(zQgEiHiA3Mb-&nY-zIZRMtT?p%@G`S1MPQxys&UN@z8UWiW%ZEma%-@zvKJEInVQYp4U0QJg@V5oeUReTRCY(X#jv6*3KHY zjii5T=Z@{(Y97?N4G;lmYYD1*lz#%SvlMH6+V#4>pxErTya)2bl>9!_Y;`1u6yWz~ zn35(`gWZF_rL7%Kr{2#(c}hqKU@a%HGq!sfQbTrku32Jm83=dgeEF4(UOy+KCf+E^ z3>`nmGFTqVS~Z@t=$`E|nMy9&ikTgIL*O-@4vJD$HE-xicTaEqmL*!2WIDBNN=m~2 z=rq{i@uohoT(cS*m%p^UtBGeu7aIu&t2_$-*jVQ|;S#OZ9=F7)dy2Cc7Ou|E%?!S0 zvEoA^HZn0TBt$(r677#Sw!!QMb8{o|NUlYxxh}xCv`HTV4$HHd_U%%nq(2Ri)m#+N zeD+3vn*cROBE1B#56}s|FgrXVc4BjbqDx%-71Y8sg+1S2E+)5(0z9ptsV+wdr~_@5 zjl((wB@Ems)zjtX`_$3J zFfWx~CmOCG0H}Dj5#u4!BH5DepW04K;n?SL;a3EBXWxHM6@;OBifIzyntMTr;%9A; zqc^XsflAE@qmIfpdHVXMB#MORuqhTP=4(pyt$xapzgWPZM~gUyR(RqFgBP9JD^L0Q zDztEYbNDvdZ^%cf=2%wm+|VAk(0l!ZQ@x>P;gY4Lrf-^}xcW1lnYL92MIJF@yCF3% z$uA~kBnZh;Reevn6&z&ei&z{qiT_(4?L+x~k~2Z4;V<8-)9>Bqi?O4~_{0Ltp> z;j{BTMprefLcCx$p0CqwCj+-}g*(wIxMhU~~!lD9*+u%>IEHEUzU{`YVEl7hl=r4}T;+ z!r!HxogVZ7U8GfnRW@>3$#x-WyiJ+?X^dXs!aU=B-8{R>UXgghgysCyBNkuOBk!I3 zytEcxGa1=sxF5o#%E-4X;0^N8wS446{U}wJ8x#oyEH?;Jt+~Oo=}c@X?E*6vz|;rpTb^rAWW^)jVudRjs3Q_ zS9Zt?lf=qm1WuI0qn0jSR%`n>O$-H4VZ&aK1S;?_`?WU}kxpY2PQ9d4PPlqeB;?R% znD3;KPb$)J7be`CnQd**Wmuqnvh#M_Cs(aWnJ}~Sq=4qRWB9IEnSQqdyNI<1bxdM| zbjet(OEFM`k?1ERMXz-{DMNjz*F6aVDz0&#j$EFG9x$nHI*xudRY|)5s8?sOR6yD2 z+Q7Ima7nz)@`Jz+ra7Z-7Z^D3E!u;l2o@8`y!dbDAMld~Yh08j<`m<6O4fV^6~P!| zU_wt%=G?5Rdu70#xQH-066eK}SIy&2^@l$s3)37%m+CZ@FVbi*O!quB`{CQdZuk-b z;)HCRmmn2ewRM)8@99<>4lr(q$6DILOu8Gwx0w0KQNI*_gM5LDRYl8`&FIW((&C(V zPIx3(T#|KGIsG_V{G|cDqvRg830FN`Kdi9zRI)76D$oOUA&OBhbYRy`4l%SY;v35q ztfq-aLPxIhgUMmrM-y^CsX0@b#r*!Xd3+vjGvr1d56-r@%AZy^8ZSqg+u?pXRhc!0 zt3B^8$YsaXlf9{X0O+&RVTb{HG9^w1*lAD)b^&d9_Yqy7mYIh$0cEb9;dOv?9A_^8 jBwP^nzp($`0TG;HNt?Dq-1)ryw*c%JXX|Rqz_kAXD~J{N From a75b0f9f04604a04dd7ae3a2f24f76c0bbc19f7c Mon Sep 17 00:00:00 2001 From: EDToaster Date: Tue, 10 Oct 2023 23:24:11 -0700 Subject: [PATCH 14/26] Fix barge base model --- .../shipping/entity/models/vessel/BaseBargeModel.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java index e413b352..ca5793bf 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java @@ -31,19 +31,19 @@ public static LayerDefinition createBodyLayer(boolean closedFront, boolean close var listBuilder = CubeListBuilder.create() // Main - .texOffs(0, 0).addBox(-6.0F, -5F, -7.0F, 12.0F, 5.0F, 14.0F) + .texOffs(0, 0).addBox(-6.0F, -4F, -7.0F, 12.0F, 5.0F, 14.0F) // Back Side - .texOffs(0, 19).addBox(-8.0F, -5F, -7.0F, 2.0F, 2.0F, 14.0F); + .texOffs(0, 19).addBox(-8.0F, -4F, -7.0F, 2.0F, 2.0F, 14.0F); if (closedFront) { // Front Side - listBuilder.texOffs(0, 19).addBox(6.0F, -5F, -7.0F, 2.0F, 2.0F, 14.0F); + listBuilder.texOffs(0, 19).addBox(6.0F, -4F, -7.0F, 2.0F, 2.0F, 14.0F); } if (closedSides) { // Short Sides - listBuilder.texOffs(19, 21).addBox(-6.0F, -5F, -9.0F, 12.0F, 2.0F, 2.0F) - .texOffs(19, 21).addBox(-6.0F, -5F, 7.0F, 12.0F, 2.0F, 2.0F); + listBuilder.texOffs(19, 21).addBox(-6.0F, -4F, -9.0F, 12.0F, 2.0F, 2.0F) + .texOffs(19, 21).addBox(-6.0F, -4F, 7.0F, 12.0F, 2.0F, 2.0F); } PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", listBuilder, PartPose.ZERO); From 6b2980e8247f4452d61206df5d1f588d2b74c3b2 Mon Sep 17 00:00:00 2001 From: EDToaster Date: Wed, 11 Oct 2023 02:23:49 -0700 Subject: [PATCH 15/26] Initial car refactor rendering --- .../custom/train/AbstractTrainCarEntity.java | 80 +++-- .../locomotive/AbstractLocomotiveEntity.java | 4 + .../custom/train/wagon/ChestCarEntity.java | 3 + .../train/wagon/FluidTankCarEntity.java | 3 + .../custom/train/wagon/SeaterCarEntity.java | 1 + .../insert/CubeInsertBargeModel.java | 5 +- .../models/insert/CubeInsertCarModel.java | 45 +++ .../insert/FishingInsertBargeModel.java | 2 +- .../insert/FluidTankInsertBargeModel.java | 2 +- .../insert/RingsInsertBargeModel.java | 2 +- .../insert/SeaterInsertBargeModel.java | 2 +- .../entity/models/train/BaseCarModel.java | 61 ++++ .../entity/models/train/ChestCarModel.java | 23 +- .../entity/models/train/TrimCarModel.java | 57 ++++ .../vessel/{ => base}/BaseBargeModel.java | 2 +- .../vessel/{ => base}/TrimBargeModel.java | 2 +- .../shipping/entity/render/ModelPack.java | 11 + .../shipping/entity/render/ModelSupplier.java | 10 + .../render/barge/AbstractVesselRenderer.java | 2 - .../render/barge/FishingBargeRenderer.java | 6 +- .../render/barge/FluidTankBargeRenderer.java | 1 + .../render/barge/MultipartVesselRenderer.java | 27 +- .../render/barge/StaticVesselRenderer.java | 37 --- .../train/MultipartTrainCarRenderer.java | 283 ++++++++++++++++++ .../entity/render/train/TrainCarRenderer.java | 16 +- .../shipping/event/ModClientEventHandler.java | 47 ++- .../textures/entity/car/base.png | Bin 0 -> 514 bytes .../textures/entity/car/chest_insert.png | Bin 0 -> 549 bytes .../textures/entity/car/trim.png | Bin 0 -> 458 bytes .../textures/entity/emptytexture.png | Bin 0 -> 194 bytes 30 files changed, 604 insertions(+), 130 deletions(-) rename src/main/java/dev/murad/shipping/entity/models/{vessel => }/insert/CubeInsertBargeModel.java (87%) create mode 100644 src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertCarModel.java rename src/main/java/dev/murad/shipping/entity/models/{vessel => }/insert/FishingInsertBargeModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{vessel => }/insert/FluidTankInsertBargeModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{vessel => }/insert/RingsInsertBargeModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/{vessel => }/insert/SeaterInsertBargeModel.java (97%) create mode 100644 src/main/java/dev/murad/shipping/entity/models/train/BaseCarModel.java create mode 100644 src/main/java/dev/murad/shipping/entity/models/train/TrimCarModel.java rename src/main/java/dev/murad/shipping/entity/models/vessel/{ => base}/BaseBargeModel.java (98%) rename src/main/java/dev/murad/shipping/entity/models/vessel/{ => base}/TrimBargeModel.java (98%) create mode 100644 src/main/java/dev/murad/shipping/entity/render/ModelPack.java create mode 100644 src/main/java/dev/murad/shipping/entity/render/ModelSupplier.java delete mode 100644 src/main/java/dev/murad/shipping/entity/render/barge/StaticVesselRenderer.java create mode 100644 src/main/java/dev/murad/shipping/entity/render/train/MultipartTrainCarRenderer.java create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/car/base.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/car/chest_insert.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/car/trim.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/emptytexture.png diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java index 44efe73d..31433ecd 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java @@ -4,7 +4,9 @@ import com.mojang.datafixers.util.Pair; import dev.murad.shipping.ShippingConfig; import dev.murad.shipping.capability.StallingCapability; +import dev.murad.shipping.entity.Colorable; import dev.murad.shipping.entity.custom.train.locomotive.AbstractLocomotiveEntity; +import dev.murad.shipping.entity.custom.vessel.VesselEntity; import dev.murad.shipping.setup.ModItems; import dev.murad.shipping.util.LinkableEntity; import dev.murad.shipping.util.LinkingHandler; @@ -18,18 +20,22 @@ import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.AbstractMinecart; +import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.GameRules; @@ -50,7 +56,9 @@ import java.util.stream.Stream; @SuppressWarnings("OptionalUsedAsFieldOrParameterType") -public abstract class AbstractTrainCarEntity extends AbstractMinecart implements IForgeAbstractMinecart, LinkableEntity { +public abstract class AbstractTrainCarEntity extends AbstractMinecart implements IForgeAbstractMinecart, LinkableEntity, Colorable { + + public static final EntityDataAccessor COLOR_DATA = SynchedEntityData.defineId(AbstractTrainCarEntity.class, EntityDataSerializers.INT); public static final EntityDataAccessor DOMINANT_ID = SynchedEntityData.defineId(AbstractTrainCarEntity.class, EntityDataSerializers.INT); public static final EntityDataAccessor DOMINATED_ID = SynchedEntityData.defineId(AbstractTrainCarEntity.class, EntityDataSerializers.INT); @@ -134,48 +142,57 @@ public boolean canBeCollidedWith() { return getPickResult().getItem(); } + + @Nullable + public Integer getColor() { + int color = this.getEntityData().get(COLOR_DATA); + return color == -1 ? null : color; + } + + public void setColor(Integer color) { + if (color == null) color = -1; + this.getEntityData().set(COLOR_DATA, color); + } + + @Override + public InteractionResult interact(Player player, InteractionHand hand) { + InteractionResult ret = super.interact(player, hand); + if (ret.consumesAction()) return ret; + + var color = DyeColor.getColor(player.getItemInHand(hand)); + + if (color != null) { + if (!level().isClientSide) { + this.getEntityData().set(COLOR_DATA, color.getId()); + } + // don't interact *and* use current item + return InteractionResult.sidedSuccess(this.level().isClientSide); + } + + return InteractionResult.PASS; + } + @Override protected void readAdditionalSaveData(@NotNull CompoundTag compound) { super.readAdditionalSaveData(compound); + + if (compound.contains("Color", Tag.TAG_INT)) { + setColor(compound.getInt("Color")); + } + linkingHandler.readAdditionalSaveData(compound); } @Override protected void addAdditionalSaveData(@NotNull CompoundTag compound) { super.addAdditionalSaveData(compound); - linkingHandler.addAdditionalSaveData(compound); - } - - private Optional tryToLoadFromNBT(CompoundTag compound) { - try { - BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); - pos.set(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z")); - String uuid = compound.getString("UUID"); - AABB searchBox = new AABB( - pos.getX() - 2, - pos.getY() - 2, - pos.getZ() - 2, - pos.getX() + 2, - pos.getY() + 2, - pos.getZ() + 2 - ); - List entities = level().getEntities(this, searchBox, e -> e.getStringUUID().equals(uuid)); - return entities.stream().findFirst().map(e -> (AbstractTrainCarEntity) e); - } catch (Exception e) { - return Optional.empty(); + Integer color = getColor(); + if (color != null) { + compound.putInt("Color", color); } - } - private void writeNBT(Entity entity, CompoundTag globalCompound) { - CompoundTag compound = new CompoundTag(); - compound.putInt("X", (int) Math.floor(entity.getX())); - compound.putInt("Y", (int) Math.floor(entity.getY())); - compound.putInt("Z", (int) Math.floor(entity.getZ())); - - compound.putString("UUID", entity.getUUID().toString()); - - globalCompound.put("dominant", compound); + linkingHandler.addAdditionalSaveData(compound); } @Override @@ -183,6 +200,7 @@ protected void defineSynchedData() { super.defineSynchedData(); getEntityData().define(DOMINANT_ID, -1); getEntityData().define(DOMINATED_ID, -1); + getEntityData().define(COLOR_DATA, -1); } diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/AbstractLocomotiveEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/AbstractLocomotiveEntity.java index 93aeb356..d37994c4 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/AbstractLocomotiveEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/locomotive/AbstractLocomotiveEntity.java @@ -126,6 +126,10 @@ public void remove(RemovalReason r) { @Override public InteractionResult interact(Player pPlayer, InteractionHand pHand) { + + InteractionResult ret = super.interact(pPlayer, pHand); + if (ret.consumesAction()) return ret; + if(!pHand.equals(InteractionHand.MAIN_HAND)){ return InteractionResult.PASS; } diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java index 518dc422..30c88562 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java @@ -55,6 +55,9 @@ private ItemStackHandler createHandler() { @Override public InteractionResult interact(Player player, InteractionHand hand){ + InteractionResult ret = super.interact(player, hand); + if (ret.consumesAction()) return ret; + if(!this.level().isClientSide){ player.openMenu(this); } diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/FluidTankCarEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/FluidTankCarEntity.java index 6f0d8e18..4b516242 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/FluidTankCarEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/FluidTankCarEntity.java @@ -69,6 +69,9 @@ protected void defineSynchedData() { @Override public InteractionResult interact(Player player, InteractionHand hand){ + InteractionResult ret = super.interact(player, hand); + if (ret.consumesAction()) return ret; + if(!this.level().isClientSide){ FluidUtil.interactWithFluidHandler(player, InteractionHand.MAIN_HAND, tank); player.displayClientMessage(FluidDisplayUtil.getFluidDisplay(tank), false); diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/SeaterCarEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/SeaterCarEntity.java index ba3ce4f5..ede2862a 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/SeaterCarEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/SeaterCarEntity.java @@ -49,6 +49,7 @@ private void initCompat() { public InteractionResult interact(Player pPlayer, InteractionHand pHand) { InteractionResult ret = super.interact(pPlayer, pHand); if (ret.consumesAction()) return ret; + if (pPlayer.isSecondaryUseActive()) { return InteractionResult.PASS; } else if (this.isVehicle()) { diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/CubeInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertBargeModel.java similarity index 87% rename from src/main/java/dev/murad/shipping/entity/models/vessel/insert/CubeInsertBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertBargeModel.java index 2b97ff3d..86538226 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/CubeInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertBargeModel.java @@ -1,12 +1,9 @@ -package dev.murad.shipping.entity.models.vessel.insert; +package dev.murad.shipping.entity.models.insert; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; import dev.murad.shipping.entity.Colorable; -import dev.murad.shipping.entity.custom.vessel.VesselEntity; -import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; -import dev.murad.shipping.entity.custom.vessel.barge.ChestBargeEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelPart; diff --git a/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertCarModel.java b/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertCarModel.java new file mode 100644 index 00000000..4fe7beee --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertCarModel.java @@ -0,0 +1,45 @@ +package dev.murad.shipping.entity.models.insert; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.*; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; + +public class CubeInsertCarModel extends EntityModel { + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "cube_insert_car_model"), "main"); + private final ModelPart bb_main; + + public CubeInsertCarModel(ModelPart root) { + this.bb_main = root.getChild("bb_main"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() + .texOffs(0, 0).addBox(-5.0F, -16.0F, -4.0F, 10.0F, 10.0F, 10.0F), + + PartPose.offset(0.0F, 24.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 128, 128); + } + + @Override + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + bb_main.render(poseStack, buffer, packedLight, packedOverlay); + } +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/insert/FishingInsertBargeModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/insert/FishingInsertBargeModel.java index deedf9de..98f28871 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FishingInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/insert/FishingInsertBargeModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models.vessel.insert; +package dev.murad.shipping.entity.models.insert; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FluidTankInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/insert/FluidTankInsertBargeModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/vessel/insert/FluidTankInsertBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/insert/FluidTankInsertBargeModel.java index 87efb689..cd5ce457 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/FluidTankInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/insert/FluidTankInsertBargeModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models.vessel.insert; +package dev.murad.shipping.entity.models.insert; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/RingsInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/insert/RingsInsertBargeModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/vessel/insert/RingsInsertBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/insert/RingsInsertBargeModel.java index 01a1382a..a790a9ba 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/RingsInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/insert/RingsInsertBargeModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models.vessel.insert; +package dev.murad.shipping.entity.models.insert; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/SeaterInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/insert/SeaterInsertBargeModel.java similarity index 97% rename from src/main/java/dev/murad/shipping/entity/models/vessel/insert/SeaterInsertBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/insert/SeaterInsertBargeModel.java index 96a4b790..f7401441 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/insert/SeaterInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/insert/SeaterInsertBargeModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models.vessel.insert; +package dev.murad.shipping.entity.models.insert; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/train/BaseCarModel.java b/src/main/java/dev/murad/shipping/entity/models/train/BaseCarModel.java new file mode 100644 index 00000000..b1a2089d --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/models/train/BaseCarModel.java @@ -0,0 +1,61 @@ +package dev.murad.shipping.entity.models.train; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.train.AbstractTrainCarEntity; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.resources.ResourceLocation; + + +public class BaseCarModel extends EntityModel { + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "base_car_model"), "main"); + private final ModelPart bb_main; + + public BaseCarModel(ModelPart root) { + this.bb_main = root.getChild("bb_main"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() + + // Long sides + .texOffs(0, 0).addBox(-7.0F, -13.0F, -8.0F, 2.0F, 9.0F, 16.0F) + .texOffs(0, 0).addBox(5.0F, -13.0F, -8.0F, 2.0F, 9.0F, 16.0F) + + // Short sides + .texOffs(0, 28).addBox(-5.0F, -13.0F, -8.0F, 10.0F, 9.0F, 2.0F) + .texOffs(0, 28).addBox(-5.0F, -13.0F, 6.0F, 10.0F, 9.0F, 2.0F) + + // Wheels + .texOffs(0, 0).addBox(-6.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(-6.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F), + + PartPose.offset(0.0F, 24.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 128, 128); + } + + @Override + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + bb_main.render(poseStack, buffer, packedLight, packedOverlay); + } +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/train/ChestCarModel.java b/src/main/java/dev/murad/shipping/entity/models/train/ChestCarModel.java index 6350b862..c2a3d899 100644 --- a/src/main/java/dev/murad/shipping/entity/models/train/ChestCarModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/ChestCarModel.java @@ -27,17 +27,18 @@ public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-7.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F, new CubeDeformation(0.0F)) - .texOffs(26, 18).addBox(-5.0F, -16.0F, -4.0F, 10.0F, 10.0F, 10.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F, new CubeDeformation(0.0F)) - .texOffs(0, 28).addBox(-5.0F, -14.0F, -8.0F, 10.0F, 12.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 28).addBox(-5.0F, -14.0F, 6.0F, 10.0F, 12.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(20, 0).addBox(-5.0F, -6.0F, -6.0F, 10.0F, 4.0F, 12.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-6.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-6.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() + .texOffs(0, 0).addBox(-7.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F) + .texOffs(26, 18).addBox(-5.0F, -16.0F, -4.0F, 10.0F, 10.0F, 10.0F) + .texOffs(0, 0).addBox(5.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F) + .texOffs(0, 28).addBox(-5.0F, -14.0F, -8.0F, 10.0F, 12.0F, 2.0F) + .texOffs(0, 28).addBox(-5.0F, -14.0F, 6.0F, 10.0F, 12.0F, 2.0F) + .texOffs(20, 0).addBox(-5.0F, -6.0F, -6.0F, 10.0F, 4.0F, 12.0F) + .texOffs(0, 0).addBox(-6.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(-6.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F), + PartPose.offset(0.0F, 24.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 128, 128); } diff --git a/src/main/java/dev/murad/shipping/entity/models/train/TrimCarModel.java b/src/main/java/dev/murad/shipping/entity/models/train/TrimCarModel.java new file mode 100644 index 00000000..b95e4a87 --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/models/train/TrimCarModel.java @@ -0,0 +1,57 @@ +package dev.murad.shipping.entity.models.train; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.Colorable; +import dev.murad.shipping.entity.custom.train.AbstractTrainCarEntity; +import dev.murad.shipping.entity.custom.train.wagon.SeaterCarEntity; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.*; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.vehicle.Minecart; + + +public class TrimCarModel extends EntityModel { + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "trim_car_model"), "main"); + private final ModelPart bb_main; + + public TrimCarModel(ModelPart root) { + this.bb_main = root.getChild("bb_main"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() + // Long sides trim + .texOffs(0, 18).addBox(-7.0F, -14.0F, -8.0F, 2.0F, 1F, 16.0F) + .texOffs(0, 18).addBox(5.0F, -14.0F, -8.0F, 2.0F, 1F, 16.0F) + + // Short sides trim + .texOffs(36, 18).addBox(-5.0F, -14.0F, -8.0F, 10.0F, 1F, 2.0F) + .texOffs(36, 18).addBox(-5.0F, -14.0F, 6.0F, 10.0F, 1F, 2.0F) + + // Base + .texOffs(0, 0).addBox(-7.0F, -4.0F, -8.0F, 14.0F, 2.0F, 16.0F), + + PartPose.offset(0.0F, 24.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 128, 128); + } + + @Override + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + bb_main.render(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); + } +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/base/BaseBargeModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/base/BaseBargeModel.java index ca5793bf..2c9feb28 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/BaseBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/base/BaseBargeModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models.vessel; +package dev.murad.shipping.entity.models.vessel.base; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/base/TrimBargeModel.java similarity index 98% rename from src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java rename to src/main/java/dev/murad/shipping/entity/models/vessel/base/TrimBargeModel.java index 43cf8352..e6d4dac3 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/TrimBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/base/TrimBargeModel.java @@ -1,4 +1,4 @@ -package dev.murad.shipping.entity.models.vessel; +package dev.murad.shipping.entity.models.vessel.base; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; diff --git a/src/main/java/dev/murad/shipping/entity/render/ModelPack.java b/src/main/java/dev/murad/shipping/entity/render/ModelPack.java new file mode 100644 index 00000000..3307f584 --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/render/ModelPack.java @@ -0,0 +1,11 @@ +package dev.murad.shipping.entity.render; + +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; + +public record ModelPack ( + ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/render/ModelSupplier.java b/src/main/java/dev/murad/shipping/entity/render/ModelSupplier.java new file mode 100644 index 00000000..de6e5932 --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/render/ModelSupplier.java @@ -0,0 +1,10 @@ +package dev.murad.shipping.entity.render; + +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.world.entity.Entity; + +@FunctionalInterface +public interface ModelSupplier { + EntityModel supply(ModelPart root); +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java index ba143d5b..ae7d2b87 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/AbstractVesselRenderer.java @@ -25,13 +25,11 @@ public abstract class AbstractVesselRenderer extends EntityRenderer { - private static final ResourceLocation CHAIN_TEXTURE = new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/chain.png"); private final ChainModel chainModel; - public AbstractVesselRenderer(EntityRendererProvider.Context context) { super(context); chainModel = new ChainModel(context.bakeLayer(ChainModel.LAYER_LOCATION)); diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java index 659b7131..a49f4f0c 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/FishingBargeRenderer.java @@ -2,6 +2,8 @@ import com.mojang.blaze3d.vertex.PoseStack; import dev.murad.shipping.entity.custom.vessel.barge.FishingBargeEntity; +import dev.murad.shipping.entity.render.ModelPack; +import dev.murad.shipping.entity.render.ModelSupplier; import lombok.Getter; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -62,8 +64,8 @@ public Builder(EntityRendererProvider.Context context) { } public Builder transitionInsertModel(ModelSupplier supplier, - ModelLayerLocation location, - ResourceLocation texture) { + ModelLayerLocation location, + ResourceLocation texture) { this.transitionInsertModelPack = new ModelPack<>(supplier, location, texture); return this; } diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java index bf7083f1..7395c840 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/FluidTankBargeRenderer.java @@ -4,6 +4,7 @@ import com.mojang.math.Axis; import dev.murad.shipping.entity.custom.vessel.barge.AbstractBargeEntity; import dev.murad.shipping.entity.custom.vessel.barge.FluidTankBargeEntity; +import dev.murad.shipping.entity.render.ModelPack; import dev.murad.shipping.util.FluidRenderUtil; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.renderer.MultiBufferSource; diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java index 2d51dad9..97c8538f 100644 --- a/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/barge/MultipartVesselRenderer.java @@ -4,15 +4,15 @@ import dev.murad.shipping.ShippingMod; import dev.murad.shipping.entity.custom.vessel.VesselEntity; import dev.murad.shipping.entity.models.vessel.EmptyModel; +import dev.murad.shipping.entity.render.ModelPack; +import dev.murad.shipping.entity.render.ModelSupplier; import lombok.Getter; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; import net.minecraft.world.item.DyeColor; import org.jetbrains.annotations.NotNull; @@ -32,14 +32,14 @@ protected MultipartVesselRenderer(EntityRendererProvider.Context context, ModelPack insertModelPack, ModelPack trimModelPack) { super(context); - this.baseModel = baseModelPack.supplier.supply(context.bakeLayer(baseModelPack.location)); - this.baseTextureLocation = baseModelPack.texture; + this.baseModel = baseModelPack.supplier().supply(context.bakeLayer(baseModelPack.location())); + this.baseTextureLocation = baseModelPack.texture(); - this.insertModel = insertModelPack.supplier.supply(context.bakeLayer(insertModelPack.location)); - this.insertTextureLocation = insertModelPack.texture; + this.insertModel = insertModelPack.supplier().supply(context.bakeLayer(insertModelPack.location())); + this.insertTextureLocation = insertModelPack.texture(); - this.trimModel = trimModelPack.supplier.supply(context.bakeLayer(trimModelPack.location)); - this.trimTextureLocation = trimModelPack.texture; + this.trimModel = trimModelPack.supplier().supply(context.bakeLayer(trimModelPack.location())); + this.trimTextureLocation = trimModelPack.texture(); } /** @@ -101,17 +101,6 @@ protected float getModelYrot() { return rotation; } - @FunctionalInterface - public interface ModelSupplier { - EntityModel supply(ModelPart root); - } - - public record ModelPack( - ModelSupplier supplier, - ModelLayerLocation location, - ResourceLocation texture) { - } - public static class Builder { protected final EntityRendererProvider.Context context; diff --git a/src/main/java/dev/murad/shipping/entity/render/barge/StaticVesselRenderer.java b/src/main/java/dev/murad/shipping/entity/render/barge/StaticVesselRenderer.java deleted file mode 100644 index 188c3851..00000000 --- a/src/main/java/dev/murad/shipping/entity/render/barge/StaticVesselRenderer.java +++ /dev/null @@ -1,37 +0,0 @@ -package dev.murad.shipping.entity.render.barge; - -import dev.murad.shipping.entity.custom.vessel.VesselEntity; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.renderer.entity.EntityRendererProvider; -import net.minecraft.resources.ResourceLocation; - -public class StaticVesselRenderer extends AbstractVesselRenderer { - private final EntityModel model; - private final ResourceLocation textureLocation; - - public StaticVesselRenderer(EntityRendererProvider.Context context, - ModelSupplier supplier, - ModelLayerLocation location, - ResourceLocation texture) { - super(context); - this.model = supplier.supply(context.bakeLayer(location)); - this.textureLocation = texture; - } - - @Override - EntityModel getModel(T entity) { - return model; - } - - @Override - public ResourceLocation getTextureLocation(T pEntity) { - return textureLocation; - } - - @FunctionalInterface - public interface ModelSupplier { - EntityModel supply(ModelPart root); - } -} diff --git a/src/main/java/dev/murad/shipping/entity/render/train/MultipartTrainCarRenderer.java b/src/main/java/dev/murad/shipping/entity/render/train/MultipartTrainCarRenderer.java new file mode 100644 index 00000000..5596adbe --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/render/train/MultipartTrainCarRenderer.java @@ -0,0 +1,283 @@ +package dev.murad.shipping.entity.render.train; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.datafixers.util.Pair; +import com.mojang.math.Axis; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.train.AbstractTrainCarEntity; +import dev.murad.shipping.entity.models.train.ChainModel; +import dev.murad.shipping.entity.models.vessel.EmptyModel; +import dev.murad.shipping.entity.render.ModelPack; +import dev.murad.shipping.entity.render.ModelSupplier; +import dev.murad.shipping.entity.render.RenderWithAttachmentPoints; +import lombok.Getter; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.phys.Vec3; + + +public class MultipartTrainCarRenderer extends EntityRenderer implements RenderWithAttachmentPoints { + + @Getter + private final EntityModel baseModel, insertModel, trimModel; + + @Getter + private final ResourceLocation baseTextureLocation, insertTextureLocation, trimTextureLocation; + + protected MultipartTrainCarRenderer(EntityRendererProvider.Context context, + ModelPack baseModelPack, + ModelPack insertModelPack, + ModelPack trimModelPack) { + super(context); + this.baseModel = baseModelPack.supplier().supply(context.bakeLayer(baseModelPack.location())); + this.baseTextureLocation = baseModelPack.texture(); + + this.insertModel = insertModelPack.supplier().supply(context.bakeLayer(insertModelPack.location())); + this.insertTextureLocation = insertModelPack.texture(); + + this.trimModel = trimModelPack.supplier().supply(context.bakeLayer(trimModelPack.location())); + this.trimTextureLocation = trimModelPack.texture(); + + chainModel = new ChainModel(context.bakeLayer(ChainModel.LAYER_LOCATION)); + } + + private static final ResourceLocation CHAIN_TEXTURE = + new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/chain.png"); + + private final ChainModel chainModel; + + + public void render(T car, float yaw, float pPartialTicks, PoseStack pose, MultiBufferSource buffer, int pPackedLight) { + //getAndRenderChain(car, pose, buffer, pPackedLight); + if (car.getLeader().isPresent()) return; + + pose.pushPose(); + + // render + AbstractTrainCarEntity t = car; + Pair attachmentPoints = renderCarAndGetAttachmentPoints(car, yaw, pPartialTicks, pose, buffer, pPackedLight); + + while (t.getFollower().isPresent()) { + AbstractTrainCarEntity nextT = t.getFollower().get(); + EntityRenderer renderer = Minecraft.getInstance().getEntityRenderDispatcher().getRenderer(nextT); + if (renderer instanceof RenderWithAttachmentPoints) { + @SuppressWarnings("unchecked") + RenderWithAttachmentPoints attachmentRenderer = (RenderWithAttachmentPoints) renderer; + + // translate to next train location + Vec3 nextTPos = nextT.getPosition(pPartialTicks), tPos = t.getPosition(pPartialTicks); + Vec3 offset = nextTPos.subtract(tPos); + pose.translate(offset.x, offset.y, offset.z); + Pair newAttachmentPoints = attachmentRenderer.renderCarAndGetAttachmentPoints(nextT, nextT.getYRot(), pPartialTicks, pose, buffer, pPackedLight); + Vec3 from = newAttachmentPoints.getFirst(); + Vec3 to = attachmentPoints.getSecond(); + + // translate to "from" position + pose.pushPose(); + offset = from.subtract(nextTPos); + pose.translate(offset.x, offset.y, offset.z); + getAndRenderChain(nextT, from, to, pose, buffer, pPackedLight); + pose.popPose(); + + attachmentPoints = newAttachmentPoints; + } + + t = nextT; + } + + pose.popPose(); + } + + private void getAndRenderChain(AbstractTrainCarEntity car, Vec3 from, Vec3 to, PoseStack matrixStack, MultiBufferSource buffer, int p_225623_6_) { + matrixStack.pushPose(); + var vec = from.vectorTo(to); + double dist = vec.length(); + int segments = (int) Math.ceil(dist * 4); + + // TODO: fix pitch + matrixStack.mulPose(Axis.YP.rotation(-(float) Math.atan2(vec.z, vec.x))); + matrixStack.mulPose(Axis.ZP.rotation((float) (Math.asin(vec.y / dist)))); + matrixStack.pushPose(); + VertexConsumer ivertexbuilderChain = buffer.getBuffer(chainModel.renderType(CHAIN_TEXTURE)); + for (int i = 1; i < segments; i++) { + matrixStack.pushPose(); + matrixStack.translate(i / 4.0, 0, 0); + chainModel.renderToBuffer(matrixStack, ivertexbuilderChain, p_225623_6_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); + matrixStack.popPose(); + } + + matrixStack.popPose(); + matrixStack.popPose(); + } + + // First - front anchor point + // Second - back anchor point + // Override this to change anchor points for larger or smaller cars + public Pair getAttachmentPoints(Vec3 chainCentre, Vec3 trackDirection) { + return new Pair<>(chainCentre.add(trackDirection.scale(.2)), chainCentre.add(trackDirection.scale(-.2))); + } + + @Override + public boolean shouldRender(T entity, Frustum pCamera, double pCamX, double pCamY, double pCamZ) { + return true; + } + + public Pair renderCarAndGetAttachmentPoints(T car, float yaw, float partialTicks, PoseStack pose, MultiBufferSource buffer, int packedLight) { + Pair attach = new Pair<>(car.getPosition(partialTicks).add(0, .44, 0), car.getPosition(partialTicks).add(0, .44, 0)); + + pose.pushPose(); + long i = (long)car.getId() * 493286711L; + i = i * i * 4392167121L + i * 98761L; + float f = (((float)(i >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + float f1 = (((float)(i >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + float f2 = (((float)(i >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + pose.translate((double)f, (double)f1, (double)f2); + double d0 = Mth.lerp((double)partialTicks, car.xOld, car.getX()); + double d1 = Mth.lerp((double)partialTicks, car.yOld, car.getY()); + double d2 = Mth.lerp((double)partialTicks, car.zOld, car.getZ()); + double d3 = (double)0.3F; + Vec3 pos = car.getPos(d0, d1, d2); + float pitch = Mth.lerp(partialTicks, car.xRotO, car.getXRot()); + if (pos != null) { + Vec3 forwardDir = car.getPosOffs(d0, d1, d2, (double)0.3F); + Vec3 backDir = car.getPosOffs(d0, d1, d2, (double)-0.3F); + if (forwardDir == null) { + forwardDir = pos; + } + + if (backDir == null) { + backDir = pos; + } + + Vec3 centre = new Vec3(pos.x, (forwardDir.y + backDir.y) / 2.0D, pos.z); + Vec3 offset = centre.subtract(d0, d1, d2); + + pose.translate(offset.x, offset.y, offset.z); + Vec3 trackDirection = forwardDir.subtract(backDir); + if (trackDirection.length() != 0.0D) { + trackDirection = trackDirection.normalize(); + yaw = (float)(Math.atan2(-trackDirection.z, -trackDirection.x) * 180.0D / Math.PI + 90); + pitch = (float)(Math.atan(-trackDirection.y) * 73.0D); + } + + Vec3 chainCentre = centre.add(0, .22, 0); + attach = getAttachmentPoints(chainCentre, trackDirection); + } + + pose.translate(0.0D, 0.375D, 0.0D); + pose.mulPose(Axis.YP.rotationDegrees(180.0F - yaw)); + pose.mulPose(Axis.XN.rotationDegrees(pitch)); + float f5 = (float)car.getHurtTime() - partialTicks; + float f6 = car.getDamage() - partialTicks; + if (f6 < 0.0F) { + f6 = 0.0F; + } + + if (f5 > 0.0F) { + pose.mulPose(Axis.XP.rotationDegrees(Mth.sin(f5) * f5 * f6 / 10.0F * (float)car.getHurtDir())); + } + + pose.translate(0, 1.1, 0); + + pose.scale(-1.0F, -1.0F, 1.0F); + + int overlay = OverlayTexture.NO_OVERLAY; + + renderBaseModel(car, pose, buffer, packedLight, overlay); + renderInsertModel(car, pose, buffer, packedLight, overlay); + renderTrimModel(car, pose, buffer, packedLight, overlay); + + pose.popPose(); + + if (car.hasCustomName()) { + this.renderNameTag(car, car.getCustomName(), pose, buffer, packedLight); + } + + return attach; + } + + protected void renderBaseModel(T entity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int overlay) { + baseModel.renderToBuffer(matrixStack, + buffer.getBuffer(baseModel.renderType(baseTextureLocation)), + packedLight, overlay, + 1.0F, 1.0F, 1.0F, 1.0F); + } + + protected void renderInsertModel(T entity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int overlay) { + insertModel.renderToBuffer(matrixStack, + buffer.getBuffer(insertModel.renderType(insertTextureLocation)), + packedLight, overlay, + 1.0F, 1.0F, 1.0F, 1.0F); + } + + protected void renderTrimModel(T entity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int overlay) { + var colorId = entity.getColor(); + var color = (colorId == null ? DyeColor.RED : DyeColor.byId(colorId)).getTextureDiffuseColors(); + + trimModel.renderToBuffer(matrixStack, + buffer.getBuffer(trimModel.renderType(trimTextureLocation)), + packedLight, overlay, + color[0], color[1], color[2], 1.0F); + } + + // Do not use these directly + @Deprecated + @Override + public ResourceLocation getTextureLocation(T entity) { + return baseTextureLocation; + } + + public static class Builder { + protected final EntityRendererProvider.Context context; + + protected ModelPack baseModelPack; + protected ModelPack insertModelPack; + protected ModelPack trimModelPack; + + + public Builder(EntityRendererProvider.Context context) { + this.context = context; + } + + public Builder baseModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.baseModelPack = new ModelPack<>(supplier, location, texture); + return this; + } + + public Builder insertModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.insertModelPack = new ModelPack<>(supplier, location, texture); + return this; + } + + public Builder emptyInsert() { + insertModel(EmptyModel::new, EmptyModel.LAYER_LOCATION, ShippingMod.entityTexture("emptytexture.png")); + return this; + } + + + public Builder trimModel(ModelSupplier supplier, + ModelLayerLocation location, + ResourceLocation texture) { + this.trimModelPack = new ModelPack<>(supplier, location, texture); + return this; + } + + public MultipartTrainCarRenderer build() { + return new MultipartTrainCarRenderer<>(context, baseModelPack, insertModelPack, trimModelPack); + } + } +} diff --git a/src/main/java/dev/murad/shipping/entity/render/train/TrainCarRenderer.java b/src/main/java/dev/murad/shipping/entity/render/train/TrainCarRenderer.java index dc0919b8..a71b3516 100644 --- a/src/main/java/dev/murad/shipping/entity/render/train/TrainCarRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/train/TrainCarRenderer.java @@ -34,11 +34,19 @@ public class TrainCarRenderer extends EntityRe private final ChainModel chainModel; - public TrainCarRenderer(EntityRendererProvider.Context context, Function> baseModel, ModelLayerLocation layerLocation, String baseTexture) { + public TrainCarRenderer(EntityRendererProvider.Context context, + Function> baseModel, + ModelLayerLocation layerLocation, String baseTexture) { + this(context, baseModel, layerLocation, new ResourceLocation(ShippingMod.MOD_ID, baseTexture)); + } + + public TrainCarRenderer(EntityRendererProvider.Context context, + Function> baseModel, + ModelLayerLocation layerLocation, ResourceLocation baseTexture) { super(context); chainModel = new ChainModel(context.bakeLayer(ChainModel.LAYER_LOCATION)); entityModel = baseModel.apply(context.bakeLayer(layerLocation)); - texture = new ResourceLocation(ShippingMod.MOD_ID, baseTexture); + texture = baseTexture; } public void render(T car, float yaw, float pPartialTicks, PoseStack pose, MultiBufferSource buffer, int pPackedLight) { @@ -191,10 +199,6 @@ protected void renderAdditional(T pEntity, float pEntityYaw, float pPartialTicks } - protected Model getModel(T entity){ - return entityModel; - }; - @Override public ResourceLocation getTextureLocation(T entity) { return texture; diff --git a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java index bad05f04..030d4ab1 100644 --- a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java @@ -3,22 +3,24 @@ import dev.murad.shipping.ShippingMod; import dev.murad.shipping.block.fluid.render.FluidHopperTileEntityRenderer; import dev.murad.shipping.entity.custom.vessel.barge.FishingBargeEntity; +import dev.murad.shipping.entity.models.insert.*; import dev.murad.shipping.entity.models.train.*; import dev.murad.shipping.entity.models.vessel.*; -import dev.murad.shipping.entity.models.vessel.insert.*; +import dev.murad.shipping.entity.models.vessel.base.BaseBargeModel; +import dev.murad.shipping.entity.models.vessel.base.TrimBargeModel; import dev.murad.shipping.entity.render.barge.FishingBargeRenderer; import dev.murad.shipping.entity.render.barge.FluidTankBargeRenderer; import dev.murad.shipping.entity.render.barge.MultipartVesselRenderer; import dev.murad.shipping.entity.render.train.FluidTankCarRenderer; +import dev.murad.shipping.entity.render.train.MultipartTrainCarRenderer; import dev.murad.shipping.entity.render.train.TrainCarRenderer; -import dev.murad.shipping.entity.render.barge.StaticVesselRenderer; import dev.murad.shipping.setup.ModBlocks; import dev.murad.shipping.setup.ModEntityTypes; import dev.murad.shipping.setup.ModItems; import dev.murad.shipping.setup.ModTileEntitiesTypes; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.client.renderer.entity.SheepRenderer; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; @@ -186,33 +188,50 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender EnergyLocomotiveModel::new, EnergyLocomotiveModel.LAYER_LOCATION, "textures/entity/energy_locomotive.png")); - event.registerEntityRenderer(ModEntityTypes.CHEST_CAR.get(), ctx -> new TrainCarRenderer<>(ctx, - ChestCarModel::new, - ChestCarModel.LAYER_LOCATION, - "textures/entity/chest_car.png")); + + event.registerEntityRenderer(ModEntityTypes.CHEST_CAR.get(), ctx -> new MultipartTrainCarRenderer.Builder<>(ctx) + .baseModel(BaseCarModel::new, BaseCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/base.png")) + .trimModel(TrimCarModel::new, TrimCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/trim.png")) + .insertModel(CubeInsertCarModel::new, CubeInsertCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/chest_insert.png")) + .build()); + event.registerEntityRenderer(ModEntityTypes.FLUID_CAR.get(), ctx -> new FluidTankCarRenderer(ctx, FluidTankCarModel::new, FluidTankCarModel.LAYER_LOCATION, "textures/entity/fluid_car.png")); + event.registerEntityRenderer(ModEntityTypes.CHUNK_LOADER_CAR.get(), ctx -> new TrainCarRenderer<>(ctx, ChunkLoaderCarModel::new, ChunkLoaderCarModel.LAYER_LOCATION, "textures/entity/chunk_loader_car.png")); - event.registerEntityRenderer(ModEntityTypes.SEATER_CAR.get(), ctx -> new TrainCarRenderer<>(ctx, - SeaterCarModel::new, - SeaterCarModel.LAYER_LOCATION, - "textures/entity/chest_car.png")); + +// event.registerEntityRenderer(ModEntityTypes.SEATER_CAR.get(), ctx -> new TrainCarRenderer<>(ctx, +// TrimCarModel::new, +// TrimCarModel.LAYER_LOCATION, +// ShippingMod.entityTexture("car/trim.png"))); + + event.registerEntityRenderer(ModEntityTypes.SEATER_CAR.get(), ctx -> new MultipartTrainCarRenderer.Builder<>(ctx) + .baseModel(BaseCarModel::new, BaseCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/base.png")) + .trimModel(TrimCarModel::new, TrimCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/trim.png")) + .emptyInsert() + .build()); event.registerBlockEntityRenderer(ModTileEntitiesTypes.FLUID_HOPPER.get(), FluidHopperTileEntityRenderer::new); } @SubscribeEvent public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterLayerDefinitions event) { + + // COMMON event.registerLayerDefinition(ChainExtendedModel.LAYER_LOCATION, ChainExtendedModel::createBodyLayer); event.registerLayerDefinition(ChainModel.LAYER_LOCATION, ChainModel::createBodyLayer); event.registerLayerDefinition(EmptyModel.LAYER_LOCATION, EmptyModel::createBodyLayer); + event.registerLayerDefinition(CubeInsertBargeModel.LAYER_LOCATION, CubeInsertBargeModel::createBodyLayer); + event.registerLayerDefinition(CubeInsertCarModel.LAYER_LOCATION, CubeInsertCarModel::createBodyLayer); + + // VESSEL event.registerLayerDefinition(BaseBargeModel.CLOSED_LOCATION, () -> BaseBargeModel.createBodyLayer(true, true)); event.registerLayerDefinition(BaseBargeModel.OPEN_FRONT_LOCATION, () -> BaseBargeModel.createBodyLayer(false, true)); event.registerLayerDefinition(BaseBargeModel.OPEN_SIDES_LOCATION, () -> BaseBargeModel.createBodyLayer(true, false)); @@ -221,7 +240,6 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterLayerD event.registerLayerDefinition(TrimBargeModel.OPEN_FRONT_LOCATION, () -> TrimBargeModel.createBodyLayer(false, true)); event.registerLayerDefinition(TrimBargeModel.OPEN_SIDES_LOCATION, () -> TrimBargeModel.createBodyLayer(true, false)); - event.registerLayerDefinition(CubeInsertBargeModel.LAYER_LOCATION, CubeInsertBargeModel::createBodyLayer); event.registerLayerDefinition(RingsInsertBargeModel.LAYER_LOCATION, RingsInsertBargeModel::createBodyLayer); event.registerLayerDefinition(SeaterInsertBargeModel.LAYER_LOCATION, SeaterInsertBargeModel::createBodyLayer); event.registerLayerDefinition(FluidTankInsertBargeModel.LAYER_LOCATION, FluidTankInsertBargeModel::createBodyLayer); @@ -233,6 +251,11 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterLayerD event.registerLayerDefinition(EnergyTugModel.LAYER_LOCATION, EnergyTugModel::createBodyLayer); event.registerLayerDefinition(SteamTugModel.LAYER_LOCATION, SteamTugModel::createBodyLayer); + // CAR + event.registerLayerDefinition(TrimCarModel.LAYER_LOCATION, TrimCarModel::createBodyLayer); + event.registerLayerDefinition(BaseCarModel.LAYER_LOCATION, BaseCarModel::createBodyLayer); + + // LEGACY event.registerLayerDefinition(SteamLocomotiveModel.LAYER_LOCATION, SteamLocomotiveModel::createBodyLayer); event.registerLayerDefinition(EnergyLocomotiveModel.LAYER_LOCATION, EnergyLocomotiveModel::createBodyLayer); event.registerLayerDefinition(ChestCarModel.LAYER_LOCATION, ChestCarModel::createBodyLayer); diff --git a/src/main/resources/assets/littlelogistics/textures/entity/car/base.png b/src/main/resources/assets/littlelogistics/textures/entity/car/base.png new file mode 100644 index 0000000000000000000000000000000000000000..08a5e1f36d682de4f653c453f690712d3439ebea GIT binary patch literal 514 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&F%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl{S5AX?b6%!LvP*AY5v(wVjGB7YuS67b+2{G2vvM@4ovbGNJ@Gvtm0jia_ z-@XD!@sK(7cSwQ9 zEpYq69o7Gzf7LEYn|%L(uZ?resaofb3)tEJYsIoJuF=KpN8+q+& zy6_DB4HkCtei5?s`O_c$U9Zr3YS1o`}ar>rKNVH9_pm2*z^ zO%F@&2iA|b#&X=;9ou2ptp;Rn;JaaWe*K=*(|_)QRo$>EydDtHui*J$*2i0VQ^FVc zT@RGHm$qjcx8mxv)m#3)N)FfC4m7+;Z=uz@)0xNBE~EhE{)i}lkZ1XF?R9tm_X-}N z4e9Y7Kw9m=YBk{VM%xNb!1@J z*w6hZkrl|d3GfMV)mD=?H&ky)(yxzKnwq0GAx*0C&Y@1NbKLfXo#s3Gxg6j|mw3{htd0)-pc9m5Y?d^z>@oj>a0^LCwiA}xJg zNA;M*>`8i-(UT`8ML9hG_2uK-mA-CWnT-9362WrI%p^6JvHlQPrssJAePg$w?e`Zxxkf=}7!6v#NY*mF0jrt&{ao()hxbyJ%n%E> z=C5lMmzFhL@Yri+I+&kf?;`z^W^eyA{SN>jW za{E}(zi%@(eZ6P)_sjnJJ>S2^VM%xNb!1@J z*w6hZkrl}23GfMVoiSs^+O=!Xo;?c`xH41oHAr1akYDis|Nj{rv{rrr@;M7UB8wRq z_zr_GRUAJN(}!6;dT2rF4aq( zdNnTM?eViKo=JG^Hk`lh?7o!fql;%HYdrK{a9QtbQZ-L*L1!D=X7($gCAW@VyU$@_ zGGjgC>z`AcZunj*vzz-*W%ton+u4C0UdI}p{kNy85}Sb4q9e0K@ViY5)KL literal 0 HcmV?d00001 From 17466f01d2fed26d01c659593d1ababa6678e72b Mon Sep 17 00:00:00 2001 From: EDToaster Date: Wed, 11 Oct 2023 22:59:41 -0700 Subject: [PATCH 16/26] Dyeable cars --- .../vessel/barge/FluidTankBargeEntity.java | 2 +- .../models/insert/CubeInsertBargeModel.java | 8 +- .../models/insert/CubeInsertCarModel.java | 16 ++-- .../insert/FluidTankInsertCarModel.java | 67 +++++++++++++++ .../models/train/ChainExtendedModel.java | 18 ++-- .../entity/models/train/ChainModel.java | 8 +- .../entity/models/train/ChestCarModel.java | 55 ------------ .../models/train/ChunkLoaderCarModel.java | 44 +++++----- .../models/train/EnergyLocomotiveModel.java | 59 ++++++------- .../models/train/FluidTankCarModel.java | 80 ------------------ .../entity/models/train/SeaterCarModel.java | 18 ++-- .../models/train/SteamLocomotiveModel.java | 51 +++++------ .../entity/models/vessel/EnergyTugModel.java | 16 ++-- .../render/train/FluidTankCarRenderer.java | 36 ++++++-- ...enderer.java => MultipartCarRenderer.java} | 19 ++--- .../shipping/event/ModClientEventHandler.java | 75 +++++----------- .../textures/entity/car/chest_insert.png | Bin 549 -> 483 bytes .../entity/car/energy_locomotive_base.png | Bin 0 -> 912 bytes .../entity/car/energy_locomotive_trim.png | Bin 0 -> 641 bytes .../textures/entity/car/fluid_tank_insert.png | Bin 0 -> 1730 bytes .../entity/car/steam_locomotive_base.png | Bin 0 -> 1362 bytes .../entity/car/steam_locomotive_trim.png | Bin 0 -> 577 bytes 22 files changed, 244 insertions(+), 328 deletions(-) create mode 100644 src/main/java/dev/murad/shipping/entity/models/insert/FluidTankInsertCarModel.java delete mode 100644 src/main/java/dev/murad/shipping/entity/models/train/ChestCarModel.java delete mode 100644 src/main/java/dev/murad/shipping/entity/models/train/FluidTankCarModel.java rename src/main/java/dev/murad/shipping/entity/render/train/{MultipartTrainCarRenderer.java => MultipartCarRenderer.java} (94%) create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/car/energy_locomotive_base.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/car/energy_locomotive_trim.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/car/fluid_tank_insert.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/car/steam_locomotive_base.png create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/car/steam_locomotive_trim.png diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/FluidTankBargeEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/FluidTankBargeEntity.java index cc7f1873..5676f731 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/FluidTankBargeEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/FluidTankBargeEntity.java @@ -31,7 +31,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class FluidTankBargeEntity extends AbstractBargeEntity{ +public class FluidTankBargeEntity extends AbstractBargeEntity { public static int CAPACITY = FluidType.BUCKET_VOLUME * 10; protected FluidTank tank = new FluidTank(CAPACITY){ @Override diff --git a/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertBargeModel.java b/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertBargeModel.java index 86538226..bc10d56e 100644 --- a/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertBargeModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertBargeModel.java @@ -25,10 +25,10 @@ public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition bb_main = meshdefinition.getRoot() .addOrReplaceChild("bb_main", - CubeListBuilder.create().texOffs(0, 0) - .addBox(-5.0F, -12.0F, -5.0F, 10.0F, 10.0F, 10.0F, - new CubeDeformation(0.0F)), - PartPose.ZERO); + CubeListBuilder.create() + .texOffs(0, 0) + .addBox(-5.0F, -12.0F, -5.0F, 10.0F, 10.0F, 10.0F), + PartPose.ZERO); return LayerDefinition.create(meshdefinition, 64, 64); } diff --git a/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertCarModel.java b/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertCarModel.java index 4fe7beee..aff03f58 100644 --- a/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertCarModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/insert/CubeInsertCarModel.java @@ -23,14 +23,14 @@ public CubeInsertCarModel(ModelPart root) { public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); - - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() - .texOffs(0, 0).addBox(-5.0F, -16.0F, -4.0F, 10.0F, 10.0F, 10.0F), - - PartPose.offset(0.0F, 24.0F, 0.0F)); - - return LayerDefinition.create(meshdefinition, 128, 128); + PartDefinition bb_main = meshdefinition.getRoot() + .addOrReplaceChild("bb_main", + CubeListBuilder.create() + .texOffs(0, 0) + .addBox(-5.0F, 8.0F, -4.0F, 10.0F, 10.0F, 10.0F), + PartPose.ZERO); + + return LayerDefinition.create(meshdefinition, 64, 64); } @Override diff --git a/src/main/java/dev/murad/shipping/entity/models/insert/FluidTankInsertCarModel.java b/src/main/java/dev/murad/shipping/entity/models/insert/FluidTankInsertCarModel.java new file mode 100644 index 00000000..13b4f9ee --- /dev/null +++ b/src/main/java/dev/murad/shipping/entity/models/insert/FluidTankInsertCarModel.java @@ -0,0 +1,67 @@ +package dev.murad.shipping.entity.models.insert;// Made with Blockbench 4.1.1 +// Exported for Minecraft version 1.17 with Mojang mappings +// Paste this class into your mod and generate all required imports + + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.train.AbstractTrainCarEntity; +import dev.murad.shipping.entity.custom.train.wagon.FluidTankCarEntity; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.*; +import net.minecraft.resources.ResourceLocation; + + +public class FluidTankInsertCarModel extends EntityModel { + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fluid_tank_insert_car_model"), "main"); + private final ModelPart bb_main; + + public FluidTankInsertCarModel(ModelPart root) { + this.bb_main = root.getChild("bb_main"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(20, 0).addBox(-6.0F, -28.0F, -5.0F, 12.0F, 1.0F, 12.0F) + .texOffs(32, 40).addBox(-2.0F, -38.0F, -2.0F, 4.0F, 10.0F, 0.0F) + .texOffs(32, 40).addBox(-2.0F, -38.0F, 5.0F, 4.0F, 10.0F, 0.0F) + .texOffs(55, 30).addBox(-4.0F, -38.0F, -1.0F, 0.0F, 10.0F, 5.0F) + .texOffs(55, 30).addBox(4.0F, -38.0F, -1.0F, 0.0F, 10.0F, 5.0F) + .texOffs(20, 0).addBox(2.0F, -38.0F, -3.0F, 3.0F, 10.0F, 2.0F) + .texOffs(20, 0).addBox(-5.0F, -38.0F, -3.0F, 3.0F, 10.0F, 2.0F) + .texOffs(20, 0).addBox(-5.0F, -38.0F, 4.0F, 3.0F, 10.0F, 2.0F) + .texOffs(20, 0).addBox(2.0F, -38.0F, 4.0F, 3.0F, 10.0F, 2.0F) + .texOffs(20, 13).addBox(-5.0F, -39.0F, -3.0F, 10.0F, 1.0F, 2.0F), PartPose.offset(0.0F, 45.0F, 0.0F)); + + PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(24, 32).addBox(-4.0F, 2.0F, -5.0F, 1.0F, 1.0F, 7.0F) + .texOffs(54, 24).addBox(-5.0F, 3.0F, -4.0F, 1.0F, 1.0F, 5.0F) + .texOffs(7, 37).addBox(4.0F, 3.0F, -4.0F, 1.0F, 1.0F, 5.0F) + .texOffs(24, 32).addBox(3.0F, 2.0F, -5.0F, 1.0F, 1.0F, 7.0F) + .texOffs(20, 13).addBox(-5.0F, 3.0F, -6.0F, 10.0F, 1.0F, 2.0F), PartPose.offsetAndRotation(0.0F, -42.0F, 0.0F, 3.1416F, 0.0F, -3.1416F)); + + PartDefinition cube_r2 = bb_main.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(33, 32).addBox(-2.0F, 2.0F, -3.0F, 1.0F, 1.0F, 6.0F) + .texOffs(33, 32).addBox(4.0F, 2.0F, -3.0F, 1.0F, 1.0F, 6.0F), PartPose.offsetAndRotation(0.0F, -42.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); + + PartDefinition cube_r3 = bb_main.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(40, 39).addBox(-3.0F, -4.0F, -39.0F, 6.0F, 5.0F, 0.0F) + .texOffs(40, 39).addBox(-3.0F, -4.0F, -39.0F, 6.0F, 5.0F, 0.0F), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -1.5708F, 0.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 128, 128); + } + + @Override + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + bb_main.render(poseStack, buffer, packedLight, packedOverlay); + } +} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/train/ChainExtendedModel.java b/src/main/java/dev/murad/shipping/entity/models/train/ChainExtendedModel.java index 91b3f80c..89f6859c 100644 --- a/src/main/java/dev/murad/shipping/entity/models/train/ChainExtendedModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/ChainExtendedModel.java @@ -31,15 +31,15 @@ public static LayerDefinition createBodyLayer() { PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create(), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); - PartDefinition bone3 = cube_r1.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(3, 7).addBox(0.0F, -25.0F, -22.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(6, 6).addBox(0.0F, -25.0F, -18.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(6, 4).addBox(-1.0F, -25.0F, -20.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(6, 2).addBox(0.0F, -25.0F, -14.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(6, 0).addBox(-1.0F, -25.0F, -16.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(0, 6).addBox(0.0F, -25.0F, -10.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(3, 5).addBox(-1.0F, -25.0F, -12.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(0, 15).addBox(-1.0F, -26.0F, -22.0F, 2.0F, 1.0F, 14.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-1.0F, -24.0F, -22.0F, 2.0F, 1.0F, 14.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, -12.0F)); + PartDefinition bone3 = cube_r1.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(3, 7).addBox(0.0F, -25.0F, -22.0F, 1.0F, 1.0F, 1.0F) + .texOffs(6, 6).addBox(0.0F, -25.0F, -18.0F, 1.0F, 1.0F, 1.0F) + .texOffs(6, 4).addBox(-1.0F, -25.0F, -20.0F, 1.0F, 1.0F, 1.0F) + .texOffs(6, 2).addBox(0.0F, -25.0F, -14.0F, 1.0F, 1.0F, 1.0F) + .texOffs(6, 0).addBox(-1.0F, -25.0F, -16.0F, 1.0F, 1.0F, 1.0F) + .texOffs(0, 6).addBox(0.0F, -25.0F, -10.0F, 1.0F, 1.0F, 1.0F) + .texOffs(3, 5).addBox(-1.0F, -25.0F, -12.0F, 1.0F, 1.0F, 1.0F) + .texOffs(0, 15).addBox(-1.0F, -26.0F, -22.0F, 2.0F, 1.0F, 14.0F) + .texOffs(0, 0).addBox(-1.0F, -24.0F, -22.0F, 2.0F, 1.0F, 14.0F), PartPose.offset(0.0F, 0.0F, -12.0F)); return LayerDefinition.create(meshdefinition, 64, 64); } diff --git a/src/main/java/dev/murad/shipping/entity/models/train/ChainModel.java b/src/main/java/dev/murad/shipping/entity/models/train/ChainModel.java index 138807a9..5be6ca8d 100644 --- a/src/main/java/dev/murad/shipping/entity/models/train/ChainModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/ChainModel.java @@ -32,10 +32,10 @@ public static LayerDefinition createBodyLayer() { PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create(), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); - PartDefinition bone2 = cube_r1.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(0, 2).addBox(1.0F, -25.0F, -11.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(0.0F, -25.0F, -13.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(3, 8).addBox(0.0F, -26.0F, -13.0F, 2.0F, 1.0F, 4.0F, new CubeDeformation(0.0F)) - .texOffs(4, 4).addBox(0.0F, -24.0F, -13.0F, 2.0F, 1.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, 0.0F, 1.0F)); + PartDefinition bone2 = cube_r1.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(0, 2).addBox(1.0F, -25.0F, -11.0F, 1.0F, 1.0F, 1.0F) + .texOffs(0, 0).addBox(0.0F, -25.0F, -13.0F, 1.0F, 1.0F, 1.0F) + .texOffs(3, 8).addBox(0.0F, -26.0F, -13.0F, 2.0F, 1.0F, 4.0F) + .texOffs(4, 4).addBox(0.0F, -24.0F, -13.0F, 2.0F, 1.0F, 4.0F), PartPose.offset(-1.0F, 0.0F, 1.0F)); return LayerDefinition.create(meshdefinition, 16, 16); } diff --git a/src/main/java/dev/murad/shipping/entity/models/train/ChestCarModel.java b/src/main/java/dev/murad/shipping/entity/models/train/ChestCarModel.java deleted file mode 100644 index c2a3d899..00000000 --- a/src/main/java/dev/murad/shipping/entity/models/train/ChestCarModel.java +++ /dev/null @@ -1,55 +0,0 @@ -package dev.murad.shipping.entity.models.train;// Made with Blockbench 4.1.1 -// Exported for Minecraft version 1.17 with Mojang mappings -// Paste this class into your mod and generate all required imports - - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import dev.murad.shipping.ShippingMod; -import dev.murad.shipping.entity.custom.train.wagon.ChestCarEntity; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.*; -import net.minecraft.resources.ResourceLocation; - -public class ChestCarModel extends EntityModel { - // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "chestcarmodel"), "main"); - private final ModelPart bb_main; - - public ChestCarModel(ModelPart root) { - this.bb_main = root.getChild("bb_main"); - } - - public static LayerDefinition createBodyLayer() { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); - - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create() - .texOffs(0, 0).addBox(-7.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F) - .texOffs(26, 18).addBox(-5.0F, -16.0F, -4.0F, 10.0F, 10.0F, 10.0F) - .texOffs(0, 0).addBox(5.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F) - .texOffs(0, 28).addBox(-5.0F, -14.0F, -8.0F, 10.0F, 12.0F, 2.0F) - .texOffs(0, 28).addBox(-5.0F, -14.0F, 6.0F, 10.0F, 12.0F, 2.0F) - .texOffs(20, 0).addBox(-5.0F, -6.0F, -6.0F, 10.0F, 4.0F, 12.0F) - .texOffs(0, 0).addBox(-6.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F) - .texOffs(0, 0).addBox(-6.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F) - .texOffs(0, 0).addBox(5.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F), - PartPose.offset(0.0F, 24.0F, 0.0F)); - - return LayerDefinition.create(meshdefinition, 128, 128); - } - - @Override - public void setupAnim(ChestCarEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bb_main.render(poseStack, buffer, packedLight, packedOverlay); - } -} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/train/ChunkLoaderCarModel.java b/src/main/java/dev/murad/shipping/entity/models/train/ChunkLoaderCarModel.java index 08a59d41..368dfe8d 100644 --- a/src/main/java/dev/murad/shipping/entity/models/train/ChunkLoaderCarModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/ChunkLoaderCarModel.java @@ -30,32 +30,32 @@ public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(64, 37).addBox(-2.0F, -33.0F, -1.0F, 4.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 43.0F, 0.0F)); + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(64, 37).addBox(-2.0F, -33.0F, -1.0F, 4.0F, 4.0F, 4.0F), PartPose.offset(0.0F, 43.0F, 0.0F)); - PartDefinition ring = bb_main.addOrReplaceChild("ring", CubeListBuilder.create().texOffs(102, 0).addBox(-5.0F, -29.0F, -4.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(100, 31).addBox(-5.0F, -29.0F, 4.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(74, 41).addBox(3.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)) - .texOffs(102, 4).addBox(-5.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition ring = bb_main.addOrReplaceChild("ring", CubeListBuilder.create().texOffs(102, 0).addBox(-5.0F, -29.0F, -4.0F, 10.0F, 2.0F, 2.0F) + .texOffs(100, 31).addBox(-5.0F, -29.0F, 4.0F, 10.0F, 2.0F, 2.0F) + .texOffs(74, 41).addBox(3.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F) + .texOffs(102, 4).addBox(-5.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F), PartPose.offset(0.0F, 0.0F, 0.0F)); - PartDefinition ring2 = bb_main.addOrReplaceChild("ring2", CubeListBuilder.create().texOffs(102, 0).addBox(-5.0F, -29.0F, -4.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(100, 31).addBox(-5.0F, -29.0F, 4.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(74, 41).addBox(3.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)) - .texOffs(102, 4).addBox(-5.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -3.0F, 0.0F)); + PartDefinition ring2 = bb_main.addOrReplaceChild("ring2", CubeListBuilder.create().texOffs(102, 0).addBox(-5.0F, -29.0F, -4.0F, 10.0F, 2.0F, 2.0F) + .texOffs(100, 31).addBox(-5.0F, -29.0F, 4.0F, 10.0F, 2.0F, 2.0F) + .texOffs(74, 41).addBox(3.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F) + .texOffs(102, 4).addBox(-5.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F), PartPose.offset(0.0F, -3.0F, 0.0F)); - PartDefinition ring3 = bb_main.addOrReplaceChild("ring3", CubeListBuilder.create().texOffs(102, 0).addBox(-5.0F, -29.0F, -4.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(100, 31).addBox(-5.0F, -29.0F, 4.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(74, 41).addBox(3.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)) - .texOffs(102, 4).addBox(-5.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -7.0F, 0.0F)); + PartDefinition ring3 = bb_main.addOrReplaceChild("ring3", CubeListBuilder.create().texOffs(102, 0).addBox(-5.0F, -29.0F, -4.0F, 10.0F, 2.0F, 2.0F) + .texOffs(100, 31).addBox(-5.0F, -29.0F, 4.0F, 10.0F, 2.0F, 2.0F) + .texOffs(74, 41).addBox(3.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F) + .texOffs(102, 4).addBox(-5.0F, -29.0F, -2.0F, 2.0F, 2.0F, 6.0F), PartPose.offset(0.0F, -7.0F, 0.0F)); - PartDefinition bb_main2 = partdefinition.addOrReplaceChild("bb_main2", CubeListBuilder.create().texOffs(0, 0).addBox(-7.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F, new CubeDeformation(0.0F)) - .texOffs(0, 28).addBox(-5.0F, -14.0F, -8.0F, 10.0F, 12.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 28).addBox(-5.0F, -14.0F, 6.0F, 10.0F, 12.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(20, 0).addBox(-5.0F, -6.0F, -6.0F, 10.0F, 4.0F, 12.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-6.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-6.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + PartDefinition bb_main2 = partdefinition.addOrReplaceChild("bb_main2", CubeListBuilder.create().texOffs(0, 0).addBox(-7.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F) + .texOffs(0, 0).addBox(5.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F) + .texOffs(0, 28).addBox(-5.0F, -14.0F, -8.0F, 10.0F, 12.0F, 2.0F) + .texOffs(0, 28).addBox(-5.0F, -14.0F, 6.0F, 10.0F, 12.0F, 2.0F) + .texOffs(20, 0).addBox(-5.0F, -6.0F, -6.0F, 10.0F, 4.0F, 12.0F) + .texOffs(0, 0).addBox(-6.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(-6.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F), PartPose.offset(0.0F, 24.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 128, 64); } diff --git a/src/main/java/dev/murad/shipping/entity/models/train/EnergyLocomotiveModel.java b/src/main/java/dev/murad/shipping/entity/models/train/EnergyLocomotiveModel.java index b074bde5..ecc1227b 100644 --- a/src/main/java/dev/murad/shipping/entity/models/train/EnergyLocomotiveModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/EnergyLocomotiveModel.java @@ -6,6 +6,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.train.AbstractTrainCarEntity; import dev.murad.shipping.entity.custom.train.locomotive.AbstractLocomotiveEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -15,9 +16,9 @@ import net.minecraft.resources.ResourceLocation; -public class EnergyLocomotiveModel extends EntityModel { +public class EnergyLocomotiveModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "energylocomotivemodel"), "main"); + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "energy_locomotive_model"), "main"); private final ModelPart bone; private final ModelPart bone2; private final ModelPart bone3; @@ -36,49 +37,49 @@ public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(0, 0).addBox(4.0F, -4.0F, -9.0F, 2.0F, 2.0F, 5.0F, new CubeDeformation(0.0F)) - .texOffs(11, 4).addBox(4.0F, -3.0F, -6.0F, 1.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)) - .texOffs(9, 11).addBox(4.0F, -3.0F, -10.0F, 1.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(0, 0).addBox(4.0F, -4.0F, -9.0F, 2.0F, 2.0F, 5.0F) + .texOffs(11, 4).addBox(4.0F, -3.0F, -6.0F, 1.0F, 3.0F, 3.0F) + .texOffs(9, 11).addBox(4.0F, -3.0F, -10.0F, 1.0F, 3.0F, 3.0F), PartPose.offset(0.0F, 24.0F, 0.0F)); - PartDefinition bone2 = partdefinition.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(0, 0).addBox(4.0F, -4.0F, -9.0F, 2.0F, 2.0F, 5.0F, new CubeDeformation(0.0F)) - .texOffs(11, 4).addBox(4.0F, -3.0F, -6.0F, 1.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)) - .texOffs(9, 11).addBox(4.0F, -3.0F, -10.0F, 1.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 11.0F)); + PartDefinition bone2 = partdefinition.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(0, 0).addBox(4.0F, -4.0F, -9.0F, 2.0F, 2.0F, 5.0F) + .texOffs(11, 4).addBox(4.0F, -3.0F, -6.0F, 1.0F, 3.0F, 3.0F) + .texOffs(9, 11).addBox(4.0F, -3.0F, -10.0F, 1.0F, 3.0F, 3.0F), PartPose.offset(0.0F, 24.0F, 11.0F)); - PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(0, 0).mirror().addBox(-6.0F, -4.0F, -9.0F, 2.0F, 2.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false) - .texOffs(11, 4).mirror().addBox(-5.0F, -3.0F, -6.0F, 1.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false) - .texOffs(9, 11).mirror().addBox(-5.0F, -3.0F, -10.0F, 1.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, 24.0F, 11.0F)); + PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(0, 0).mirror().addBox(-6.0F, -4.0F, -9.0F, 2.0F, 2.0F, 5.0F).mirror(false) + .texOffs(11, 4).mirror().addBox(-5.0F, -3.0F, -6.0F, 1.0F, 3.0F, 3.0F).mirror(false) + .texOffs(9, 11).mirror().addBox(-5.0F, -3.0F, -10.0F, 1.0F, 3.0F, 3.0F).mirror(false), PartPose.offset(0.0F, 24.0F, 11.0F)); - PartDefinition bone4 = partdefinition.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(0, 0).mirror().addBox(-6.0F, -4.0F, -9.0F, 2.0F, 2.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false) - .texOffs(11, 4).mirror().addBox(-5.0F, -3.0F, -6.0F, 1.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false) - .texOffs(9, 11).mirror().addBox(-5.0F, -3.0F, -10.0F, 1.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, 24.0F, 0.0F)); + PartDefinition bone4 = partdefinition.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(0, 0).mirror().addBox(-6.0F, -4.0F, -9.0F, 2.0F, 2.0F, 5.0F).mirror(false) + .texOffs(11, 4).mirror().addBox(-5.0F, -3.0F, -6.0F, 1.0F, 3.0F, 3.0F).mirror(false) + .texOffs(9, 11).mirror().addBox(-5.0F, -3.0F, -10.0F, 1.0F, 3.0F, 3.0F).mirror(false), PartPose.offset(0.0F, 24.0F, 0.0F)); - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -13.0F, -12.0F, 12.0F, 9.0F, 20.0F, new CubeDeformation(0.0F)) - .texOffs(0, 29).addBox(-6.0F, -16.0F, -9.0F, 12.0F, 3.0F, 17.0F, new CubeDeformation(0.0F)) - .texOffs(39, 30).addBox(-4.0F, -4.0F, -11.0F, 8.0F, 3.0F, 19.0F, new CubeDeformation(0.0F)) - .texOffs(0, 14).addBox(-1.0F, -17.0F, -10.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -13.0F, -12.0F, 12.0F, 9.0F, 20.0F) + .texOffs(0, 29).addBox(-6.0F, -16.0F, -9.0F, 12.0F, 3.0F, 17.0F) + .texOffs(39, 30).addBox(-4.0F, -4.0F, -11.0F, 8.0F, 3.0F, 19.0F) + .texOffs(0, 14).addBox(-1.0F, -17.0F, -10.0F, 2.0F, 2.0F, 2.0F) .texOffs(9, 0).addBox(-1.0F, -17.0F, -10.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.25F)) - .texOffs(0, 7).addBox(4.0F, -4.0F, -3.0F, 2.0F, 3.0F, 4.0F, new CubeDeformation(0.0F)) - .texOffs(0, 29).addBox(-1.0F, -5.0F, 8.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 7).addBox(-6.0F, -4.0F, -3.0F, 2.0F, 3.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + .texOffs(0, 7).addBox(4.0F, -4.0F, -3.0F, 2.0F, 3.0F, 4.0F) + .texOffs(0, 29).addBox(-1.0F, -5.0F, 8.0F, 2.0F, 2.0F, 2.0F) + .texOffs(0, 7).addBox(-6.0F, -4.0F, -3.0F, 2.0F, 3.0F, 4.0F), PartPose.offset(0.0F, 24.0F, 0.0F)); - PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 30).addBox(0.0F, 0.0F, -9.5F, 0.0F, 1.0F, 19.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(6.0F, -4.0F, -1.5F, 0.0F, 0.0F, -0.0436F)); + PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 30).addBox(0.0F, 0.0F, -9.5F, 0.0F, 1.0F, 19.0F), PartPose.offsetAndRotation(6.0F, -4.0F, -1.5F, 0.0F, 0.0F, -0.0436F)); - PartDefinition cube_r2 = bb_main.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(44, 0).addBox(-6.0F, 0.0F, 0.0F, 12.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -4.0F, -12.0F, -0.7854F, 0.0F, 0.0F)); + PartDefinition cube_r2 = bb_main.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(44, 0).addBox(-6.0F, 0.0F, 0.0F, 12.0F, 3.0F, 0.0F), PartPose.offsetAndRotation(0.0F, -4.0F, -12.0F, -0.7854F, 0.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 128, 128); } @Override - public void setupAnim(AbstractLocomotiveEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } @Override public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bone.render(poseStack, buffer, packedLight, packedOverlay); - bone2.render(poseStack, buffer, packedLight, packedOverlay); - bone3.render(poseStack, buffer, packedLight, packedOverlay); - bone4.render(poseStack, buffer, packedLight, packedOverlay); - bb_main.render(poseStack, buffer, packedLight, packedOverlay); + bone.render(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); + bone2.render(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); + bone3.render(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); + bone4.render(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); + bb_main.render(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); } } \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/train/FluidTankCarModel.java b/src/main/java/dev/murad/shipping/entity/models/train/FluidTankCarModel.java deleted file mode 100644 index 28adf749..00000000 --- a/src/main/java/dev/murad/shipping/entity/models/train/FluidTankCarModel.java +++ /dev/null @@ -1,80 +0,0 @@ -package dev.murad.shipping.entity.models.train;// Made with Blockbench 4.1.1 -// Exported for Minecraft version 1.17 with Mojang mappings -// Paste this class into your mod and generate all required imports - - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import dev.murad.shipping.ShippingMod; -import dev.murad.shipping.entity.custom.train.wagon.FluidTankCarEntity; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.*; -import net.minecraft.resources.ResourceLocation; - - -public class FluidTankCarModel extends EntityModel { - // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "fluidtankcarmodel"), "main"); - private final ModelPart bone; - private final ModelPart bb_main; - - public FluidTankCarModel(ModelPart root) { - this.bone = root.getChild("bone"); - this.bb_main = root.getChild("bb_main"); - } - - public static LayerDefinition createBodyLayer() { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); - - PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(10, 11).addBox(5.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-7.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-7.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F, new CubeDeformation(0.0F)) - .texOffs(24, 16).addBox(-5.0F, -6.0F, -6.0F, 10.0F, 4.0F, 12.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F, new CubeDeformation(0.0F)) - .texOffs(0, 28).addBox(-5.0F, -14.0F, -8.0F, 10.0F, 12.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 28).addBox(-5.0F, -14.0F, 6.0F, 10.0F, 12.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(10, 11).addBox(-6.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(10, 11).addBox(-6.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(10, 11).addBox(5.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); - - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(20, 0).addBox(-6.0F, -28.0F, -5.0F, 12.0F, 1.0F, 12.0F, new CubeDeformation(0.0F)) - .texOffs(32, 40).addBox(-2.0F, -38.0F, -2.0F, 4.0F, 10.0F, 0.0F, new CubeDeformation(0.0F)) - .texOffs(32, 40).addBox(-2.0F, -38.0F, 5.0F, 4.0F, 10.0F, 0.0F, new CubeDeformation(0.0F)) - .texOffs(55, 30).addBox(-4.0F, -38.0F, -1.0F, 0.0F, 10.0F, 5.0F, new CubeDeformation(0.0F)) - .texOffs(55, 30).addBox(4.0F, -38.0F, -1.0F, 0.0F, 10.0F, 5.0F, new CubeDeformation(0.0F)) - .texOffs(20, 0).addBox(2.0F, -38.0F, -3.0F, 3.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(20, 0).addBox(-5.0F, -38.0F, -3.0F, 3.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(20, 0).addBox(-5.0F, -38.0F, 4.0F, 3.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(20, 0).addBox(2.0F, -38.0F, 4.0F, 3.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(20, 13).addBox(-5.0F, -39.0F, -3.0F, 10.0F, 1.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 45.0F, 0.0F)); - - PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(24, 32).addBox(-4.0F, 2.0F, -5.0F, 1.0F, 1.0F, 7.0F, new CubeDeformation(0.0F)) - .texOffs(54, 24).addBox(-5.0F, 3.0F, -4.0F, 1.0F, 1.0F, 5.0F, new CubeDeformation(0.0F)) - .texOffs(7, 37).addBox(4.0F, 3.0F, -4.0F, 1.0F, 1.0F, 5.0F, new CubeDeformation(0.0F)) - .texOffs(24, 32).addBox(3.0F, 2.0F, -5.0F, 1.0F, 1.0F, 7.0F, new CubeDeformation(0.0F)) - .texOffs(20, 13).addBox(-5.0F, 3.0F, -6.0F, 10.0F, 1.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -42.0F, 0.0F, 3.1416F, 0.0F, -3.1416F)); - - PartDefinition cube_r2 = bb_main.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(33, 32).addBox(-2.0F, 2.0F, -3.0F, 1.0F, 1.0F, 6.0F, new CubeDeformation(0.0F)) - .texOffs(33, 32).addBox(4.0F, 2.0F, -3.0F, 1.0F, 1.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -42.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); - - PartDefinition cube_r3 = bb_main.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(40, 39).addBox(-3.0F, -4.0F, -39.0F, 6.0F, 5.0F, 0.0F, new CubeDeformation(0.0F)) - .texOffs(40, 39).addBox(-3.0F, -4.0F, -39.0F, 6.0F, 5.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -1.5708F, 0.0F, 0.0F)); - - return LayerDefinition.create(meshdefinition, 128, 128); - } - - @Override - public void setupAnim(FluidTankCarEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - - } - - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bone.render(poseStack, buffer, packedLight, packedOverlay); - bb_main.render(poseStack, buffer, packedLight, packedOverlay); - } -} \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/train/SeaterCarModel.java b/src/main/java/dev/murad/shipping/entity/models/train/SeaterCarModel.java index 2da63d03..c2d1ed97 100644 --- a/src/main/java/dev/murad/shipping/entity/models/train/SeaterCarModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/SeaterCarModel.java @@ -25,15 +25,15 @@ public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-7.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F, new CubeDeformation(0.0F)) - .texOffs(0, 28).addBox(-5.0F, -14.0F, -8.0F, 10.0F, 12.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 28).addBox(-5.0F, -14.0F, 6.0F, 10.0F, 12.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(20, 0).addBox(-5.0F, -6.0F, -6.0F, 10.0F, 4.0F, 12.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-6.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-6.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-7.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F) + .texOffs(0, 0).addBox(5.0F, -14.0F, -8.0F, 2.0F, 12.0F, 16.0F) + .texOffs(0, 28).addBox(-5.0F, -14.0F, -8.0F, 10.0F, 12.0F, 2.0F) + .texOffs(0, 28).addBox(-5.0F, -14.0F, 6.0F, 10.0F, 12.0F, 2.0F) + .texOffs(20, 0).addBox(-5.0F, -6.0F, -6.0F, 10.0F, 4.0F, 12.0F) + .texOffs(0, 0).addBox(-6.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(-6.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -2.0F, 4.0F, 1.0F, 2.0F, 2.0F) + .texOffs(0, 0).addBox(5.0F, -2.0F, -6.0F, 1.0F, 2.0F, 2.0F), PartPose.offset(0.0F, 24.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 128, 128); } diff --git a/src/main/java/dev/murad/shipping/entity/models/train/SteamLocomotiveModel.java b/src/main/java/dev/murad/shipping/entity/models/train/SteamLocomotiveModel.java index f9b22985..2f4b24d9 100644 --- a/src/main/java/dev/murad/shipping/entity/models/train/SteamLocomotiveModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/train/SteamLocomotiveModel.java @@ -6,6 +6,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dev.murad.shipping.ShippingMod; +import dev.murad.shipping.entity.custom.train.AbstractTrainCarEntity; import dev.murad.shipping.entity.custom.train.locomotive.AbstractLocomotiveEntity; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -14,9 +15,9 @@ import net.minecraft.client.model.geom.builders.*; import net.minecraft.resources.ResourceLocation; -public class SteamLocomotiveModel extends EntityModel { +public class SteamLocomotiveModel extends EntityModel { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor - public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "steamlocomotivemodel"), "main"); + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ShippingMod.MOD_ID, "steam_locomotive_model"), "main"); private final ModelPart bb_main; public SteamLocomotiveModel(ModelPart root) { @@ -27,42 +28,42 @@ public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 46).addBox(-4.0F, -14.0F, -14.0F, 8.0F, 8.0F, 15.0F, new CubeDeformation(0.0F)) - .texOffs(46, 0).addBox(-6.0F, -16.0F, 1.0F, 12.0F, 10.0F, 7.0F, new CubeDeformation(0.0F)) - .texOffs(32, 23).addBox(-5.0F, -17.0F, 2.0F, 10.0F, 1.0F, 5.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-6.0F, -6.0F, -14.0F, 12.0F, 1.0F, 22.0F, new CubeDeformation(0.0F)) - .texOffs(0, 23).addBox(-3.0F, -5.0F, -12.0F, 6.0F, 3.0F, 20.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-5.0F, -9.0F, -9.0F, 0.0F, 3.0F, 10.0F, new CubeDeformation(0.0F)) + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 46).addBox(-4.0F, -14.0F, -14.0F, 8.0F, 8.0F, 15.0F) + .texOffs(46, 0).addBox(-6.0F, -16.0F, 1.0F, 12.0F, 10.0F, 7.0F) + .texOffs(32, 23).addBox(-5.0F, -17.0F, 2.0F, 10.0F, 1.0F, 5.0F) + .texOffs(0, 0).addBox(-6.0F, -6.0F, -14.0F, 12.0F, 1.0F, 22.0F) + .texOffs(0, 23).addBox(-3.0F, -5.0F, -12.0F, 6.0F, 3.0F, 20.0F) + .texOffs(0, 0).addBox(-5.0F, -9.0F, -9.0F, 0.0F, 3.0F, 10.0F) .texOffs(37, 31).addBox(-4.0F, -14.0F, -14.0F, 8.0F, 8.0F, 15.0F, new CubeDeformation(0.25F)) - .texOffs(0, 19).addBox(-1.0F, -15.0F, -15.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(0, 30).addBox(-1.5F, -18.0F, -12.0F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) - .texOffs(0, 4).addBox(-1.0F, -16.0F, -7.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(0, 19).addBox(-1.0F, -15.0F, -15.0F, 2.0F, 2.0F, 1.0F) + .texOffs(0, 30).addBox(-1.5F, -18.0F, -12.0F, 3.0F, 4.0F, 3.0F) + .texOffs(0, 4).addBox(-1.0F, -16.0F, -7.0F, 2.0F, 2.0F, 2.0F) .texOffs(0, 23).addBox(-1.5F, -18.0F, -12.0F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.25F)) - .texOffs(31, 50).addBox(-4.0F, -4.0F, -11.0F, 1.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) - .texOffs(0, 46).addBox(-4.0F, -4.0F, -2.0F, 1.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) - .texOffs(38, 33).addBox(-4.0F, -4.0F, 3.0F, 1.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(31, 50).addBox(-4.0F, -4.0F, -11.0F, 1.0F, 4.0F, 4.0F) + .texOffs(0, 46).addBox(-4.0F, -4.0F, -2.0F, 1.0F, 4.0F, 4.0F) + .texOffs(38, 33).addBox(-4.0F, -4.0F, 3.0F, 1.0F, 4.0F, 4.0F) .texOffs(14, 16).addBox(-1.0F, -15.0F, -15.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.25F)) - .texOffs(8, 33).addBox(3.0F, -4.0F, 3.0F, 1.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) - .texOffs(32, 29).addBox(3.0F, -4.0F, -2.0F, 1.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) - .texOffs(12, 0).addBox(3.0F, -4.0F, -11.0F, 1.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) - .texOffs(0, 54).addBox(3.0F, -5.0F, -6.0F, 2.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) - .texOffs(7, 7).addBox(-1.0F, -5.0F, 8.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(0, 16).addBox(-3.0F, -7.0F, -15.0F, 6.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(5.0F, -9.0F, -9.0F, 0.0F, 3.0F, 10.0F, new CubeDeformation(0.0F)) - .texOffs(0, 54).mirror().addBox(-5.0F, -5.0F, -6.0F, 2.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, 24.0F, 0.0F)); + .texOffs(8, 33).addBox(3.0F, -4.0F, 3.0F, 1.0F, 4.0F, 4.0F) + .texOffs(32, 29).addBox(3.0F, -4.0F, -2.0F, 1.0F, 4.0F, 4.0F) + .texOffs(12, 0).addBox(3.0F, -4.0F, -11.0F, 1.0F, 4.0F, 4.0F) + .texOffs(0, 54).addBox(3.0F, -5.0F, -6.0F, 2.0F, 4.0F, 3.0F) + .texOffs(7, 7).addBox(-1.0F, -5.0F, 8.0F, 2.0F, 2.0F, 1.0F) + .texOffs(0, 16).addBox(-3.0F, -7.0F, -15.0F, 6.0F, 2.0F, 1.0F) + .texOffs(0, 0).addBox(5.0F, -9.0F, -9.0F, 0.0F, 3.0F, 10.0F) + .texOffs(0, 54).mirror().addBox(-5.0F, -5.0F, -6.0F, 2.0F, 4.0F, 3.0F).mirror(false), PartPose.offset(0.0F, 24.0F, 0.0F)); - PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 4.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -5.0F, -13.0F, -0.7854F, 0.0F, 0.0F)); + PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 4.0F, 0.0F), PartPose.offsetAndRotation(0.0F, -5.0F, -13.0F, -0.7854F, 0.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 128, 128); } @Override - public void setupAnim(AbstractLocomotiveEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { } @Override public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - bb_main.render(poseStack, buffer, packedLight, packedOverlay); + bb_main.render(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); } } \ No newline at end of file diff --git a/src/main/java/dev/murad/shipping/entity/models/vessel/EnergyTugModel.java b/src/main/java/dev/murad/shipping/entity/models/vessel/EnergyTugModel.java index 9b2b4fb1..41d3b146 100644 --- a/src/main/java/dev/murad/shipping/entity/models/vessel/EnergyTugModel.java +++ b/src/main/java/dev/murad/shipping/entity/models/vessel/EnergyTugModel.java @@ -26,16 +26,16 @@ public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 30).addBox(-7.0F, -9.0F, -19.0F, 14.0F, 6.0F, 24.0F, new CubeDeformation(0.0F)) - .texOffs(58, 53).addBox(-9.0F, -11.0F, -19.0F, 2.0F, 5.0F, 18.0F, new CubeDeformation(0.0F)) - .texOffs(52, 17).addBox(-7.0F, -11.0F, -21.0F, 14.0F, 5.0F, 2.0F, new CubeDeformation(0.0F)) - .texOffs(52, 30).addBox(7.0F, -11.0F, -19.0F, 2.0F, 5.0F, 18.0F, new CubeDeformation(0.0F)) + PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 30).addBox(-7.0F, -9.0F, -19.0F, 14.0F, 6.0F, 24.0F) + .texOffs(58, 53).addBox(-9.0F, -11.0F, -19.0F, 2.0F, 5.0F, 18.0F) + .texOffs(52, 17).addBox(-7.0F, -11.0F, -21.0F, 14.0F, 5.0F, 2.0F) + .texOffs(52, 30).addBox(7.0F, -11.0F, -19.0F, 2.0F, 5.0F, 18.0F) .texOffs(0, 60).addBox(-9.0F, -10.0F, -21.0F, 18.0F, 2.0F, 6.0F, new CubeDeformation(0.25F)) - .texOffs(52, 0).addBox(-6.0F, -14.0F, -17.0F, 12.0F, 5.0F, 12.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-3.0F, -20.0F, -14.0F, 6.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)) - .texOffs(40, 60).addBox(-4.0F, -21.0F, -15.0F, 8.0F, 1.0F, 8.0F, new CubeDeformation(0.0F)) + .texOffs(52, 0).addBox(-6.0F, -14.0F, -17.0F, 12.0F, 5.0F, 12.0F) + .texOffs(0, 0).addBox(-3.0F, -20.0F, -14.0F, 6.0F, 6.0F, 6.0F) + .texOffs(40, 60).addBox(-4.0F, -21.0F, -15.0F, 8.0F, 1.0F, 8.0F) .texOffs(0, 0).addBox(-7.0F, -9.0F, -19.0F, 14.0F, 6.0F, 24.0F, new CubeDeformation(0.25F)) - .texOffs(52, 42).addBox(-0.5F, -27.0F, -11.0F, 1.0F, 6.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 6.0F, 0.0F)); + .texOffs(52, 42).addBox(-0.5F, -27.0F, -11.0F, 1.0F, 6.0F, 0.0F), PartPose.offset(0.0F, 6.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 128, 128); } diff --git a/src/main/java/dev/murad/shipping/entity/render/train/FluidTankCarRenderer.java b/src/main/java/dev/murad/shipping/entity/render/train/FluidTankCarRenderer.java index af8273b7..8b74eb53 100644 --- a/src/main/java/dev/murad/shipping/entity/render/train/FluidTankCarRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/train/FluidTankCarRenderer.java @@ -4,24 +4,29 @@ import com.mojang.math.Axis; import dev.murad.shipping.entity.custom.vessel.barge.FluidTankBargeEntity; import dev.murad.shipping.entity.custom.train.wagon.FluidTankCarEntity; +import dev.murad.shipping.entity.render.ModelPack; +import dev.murad.shipping.entity.render.barge.MultipartVesselRenderer; import dev.murad.shipping.util.FluidRenderUtil; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.world.level.material.Fluid; import net.minecraftforge.fluids.FluidStack; -import org.jetbrains.annotations.NotNull; -import java.util.function.Function; +public class FluidTankCarRenderer extends MultipartCarRenderer{ + protected FluidTankCarRenderer(EntityRendererProvider.Context context, + ModelPack baseModelPack, + ModelPack insertModelPack, + ModelPack trimModelPack) { + super(context, baseModelPack, insertModelPack, trimModelPack); + } -public class FluidTankCarRenderer extends TrainCarRenderer{ - public FluidTankCarRenderer(EntityRendererProvider.Context context, Function> baseModel, ModelLayerLocation layerLocation, String baseTexture) { - super(context, baseModel, layerLocation, baseTexture); + @Override + protected void renderInsertModel(T entity, PoseStack matrixStack, MultiBufferSource buffer, float partialTicks, int packedLight, int overlay) { + super.renderInsertModel(entity, matrixStack, buffer, partialTicks, packedLight, overlay); + renderFluid(entity, partialTicks, matrixStack, buffer, packedLight); } - protected void renderAdditional(FluidTankCarEntity entity, float pEntityYaw, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int pPackedLight) { + protected void renderFluid(FluidTankCarEntity entity, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int pPackedLight) { FluidStack fluid = entity.getFluidStack(); if (fluid == null) return; @@ -36,4 +41,17 @@ protected void renderAdditional(FluidTankCarEntity entity, float pEntityYaw, flo matrixStackIn.popPose(); } + + + public static class Builder extends MultipartCarRenderer.Builder { + + public Builder(EntityRendererProvider.Context context) { + super(context); + } + + @Override + public FluidTankCarRenderer build() { + return new FluidTankCarRenderer<>(context, baseModelPack, insertModelPack, trimModelPack); + } + } } diff --git a/src/main/java/dev/murad/shipping/entity/render/train/MultipartTrainCarRenderer.java b/src/main/java/dev/murad/shipping/entity/render/train/MultipartCarRenderer.java similarity index 94% rename from src/main/java/dev/murad/shipping/entity/render/train/MultipartTrainCarRenderer.java rename to src/main/java/dev/murad/shipping/entity/render/train/MultipartCarRenderer.java index 5596adbe..410887af 100644 --- a/src/main/java/dev/murad/shipping/entity/render/train/MultipartTrainCarRenderer.java +++ b/src/main/java/dev/murad/shipping/entity/render/train/MultipartCarRenderer.java @@ -26,7 +26,7 @@ import net.minecraft.world.phys.Vec3; -public class MultipartTrainCarRenderer extends EntityRenderer implements RenderWithAttachmentPoints { +public class MultipartCarRenderer extends EntityRenderer implements RenderWithAttachmentPoints { @Getter private final EntityModel baseModel, insertModel, trimModel; @@ -34,10 +34,10 @@ public class MultipartTrainCarRenderer extends @Getter private final ResourceLocation baseTextureLocation, insertTextureLocation, trimTextureLocation; - protected MultipartTrainCarRenderer(EntityRendererProvider.Context context, - ModelPack baseModelPack, - ModelPack insertModelPack, - ModelPack trimModelPack) { + protected MultipartCarRenderer(EntityRendererProvider.Context context, + ModelPack baseModelPack, + ModelPack insertModelPack, + ModelPack trimModelPack) { super(context); this.baseModel = baseModelPack.supplier().supply(context.bakeLayer(baseModelPack.location())); this.baseTextureLocation = baseModelPack.texture(); @@ -194,7 +194,7 @@ public Pair renderCarAndGetAttachmentPoints(T car, float yaw, float int overlay = OverlayTexture.NO_OVERLAY; renderBaseModel(car, pose, buffer, packedLight, overlay); - renderInsertModel(car, pose, buffer, packedLight, overlay); + renderInsertModel(car, pose, buffer, partialTicks, packedLight, overlay); renderTrimModel(car, pose, buffer, packedLight, overlay); pose.popPose(); @@ -205,7 +205,6 @@ public Pair renderCarAndGetAttachmentPoints(T car, float yaw, float return attach; } - protected void renderBaseModel(T entity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int overlay) { baseModel.renderToBuffer(matrixStack, buffer.getBuffer(baseModel.renderType(baseTextureLocation)), @@ -213,7 +212,7 @@ protected void renderBaseModel(T entity, PoseStack matrixStack, MultiBufferSourc 1.0F, 1.0F, 1.0F, 1.0F); } - protected void renderInsertModel(T entity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int overlay) { + protected void renderInsertModel(T entity, PoseStack matrixStack, MultiBufferSource buffer, float partialTicks, int packedLight, int overlay) { insertModel.renderToBuffer(matrixStack, buffer.getBuffer(insertModel.renderType(insertTextureLocation)), packedLight, overlay, @@ -276,8 +275,8 @@ public Builder trimModel(ModelSupplier supplier, return this; } - public MultipartTrainCarRenderer build() { - return new MultipartTrainCarRenderer<>(context, baseModelPack, insertModelPack, trimModelPack); + public MultipartCarRenderer build() { + return new MultipartCarRenderer<>(context, baseModelPack, insertModelPack, trimModelPack); } } } diff --git a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java index 030d4ab1..fc3aa64c 100644 --- a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java @@ -12,7 +12,7 @@ import dev.murad.shipping.entity.render.barge.FluidTankBargeRenderer; import dev.murad.shipping.entity.render.barge.MultipartVesselRenderer; import dev.murad.shipping.entity.render.train.FluidTankCarRenderer; -import dev.murad.shipping.entity.render.train.MultipartTrainCarRenderer; +import dev.murad.shipping.entity.render.train.MultipartCarRenderer; import dev.murad.shipping.entity.render.train.TrainCarRenderer; import dev.murad.shipping.setup.ModBlocks; import dev.murad.shipping.setup.ModEntityTypes; @@ -20,7 +20,6 @@ import dev.murad.shipping.setup.ModTileEntitiesTypes; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.entity.SheepRenderer; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; @@ -128,37 +127,6 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender .build()); // Tugs -// event.registerEntityRenderer(ModEntityTypes.ENERGY_TUG.get(), -// (ctx) -> new StaticVesselRenderer<>(ctx, EnergyTugModel::new, EnergyTugModel.LAYER_LOCATION, -// new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/energy_tug.png")) { -// // todo: fix in models itself -// @Override -// protected double getModelYoffset() { -// return 1.55D; -// } -// -// @Override -// protected float getModelYrot() { -// return 0.0F; -// } -// }); - - -// event.registerEntityRenderer(ModEntityTypes.STEAM_TUG.get(), -// (ctx) -> new StaticVesselRenderer<>(ctx, SteamTugModel::new, SteamTugModel.LAYER_LOCATION, -// new ResourceLocation(ShippingMod.MOD_ID, "textures/entity/tug.png")) { -// // todo: fix in models itself -// @Override -// protected double getModelYoffset() { -// return 1.45D; -// } -// -// @Override -// protected float getModelYrot() { -// return 0; -// } -// }); - event.registerEntityRenderer(ModEntityTypes.ENERGY_TUG.get(), (ctx) -> new MultipartVesselRenderer.Builder<>(ctx) .baseModel(EnergyTugModel::new, EnergyTugModel.LAYER_LOCATION, @@ -180,37 +148,36 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender .build() .derotate()); - event.registerEntityRenderer(ModEntityTypes.STEAM_LOCOMOTIVE.get(), ctx -> new TrainCarRenderer<>(ctx, - SteamLocomotiveModel::new, - SteamLocomotiveModel.LAYER_LOCATION, - "textures/entity/steam_locomotive.png")); - event.registerEntityRenderer(ModEntityTypes.ENERGY_LOCOMOTIVE.get(), ctx -> new TrainCarRenderer<>(ctx, - EnergyLocomotiveModel::new, - EnergyLocomotiveModel.LAYER_LOCATION, - "textures/entity/energy_locomotive.png")); + event.registerEntityRenderer(ModEntityTypes.STEAM_LOCOMOTIVE.get(), ctx -> new MultipartCarRenderer.Builder<>(ctx) + .baseModel(SteamLocomotiveModel::new, SteamLocomotiveModel.LAYER_LOCATION, ShippingMod.entityTexture("car/steam_locomotive_base.png")) + .trimModel(SteamLocomotiveModel::new, SteamLocomotiveModel.LAYER_LOCATION, ShippingMod.entityTexture("car/steam_locomotive_trim.png")) + .emptyInsert() + .build()); + + event.registerEntityRenderer(ModEntityTypes.ENERGY_LOCOMOTIVE.get(), ctx -> new MultipartCarRenderer.Builder<>(ctx) + .baseModel(EnergyLocomotiveModel::new, EnergyLocomotiveModel.LAYER_LOCATION, ShippingMod.entityTexture("car/energy_locomotive_base.png")) + .trimModel(EnergyLocomotiveModel::new, EnergyLocomotiveModel.LAYER_LOCATION, ShippingMod.entityTexture("car/energy_locomotive_trim.png")) + .emptyInsert() + .build()); - event.registerEntityRenderer(ModEntityTypes.CHEST_CAR.get(), ctx -> new MultipartTrainCarRenderer.Builder<>(ctx) + event.registerEntityRenderer(ModEntityTypes.CHEST_CAR.get(), ctx -> new MultipartCarRenderer.Builder<>(ctx) .baseModel(BaseCarModel::new, BaseCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/base.png")) .trimModel(TrimCarModel::new, TrimCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/trim.png")) .insertModel(CubeInsertCarModel::new, CubeInsertCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/chest_insert.png")) .build()); - event.registerEntityRenderer(ModEntityTypes.FLUID_CAR.get(), ctx -> new FluidTankCarRenderer(ctx, - FluidTankCarModel::new, - FluidTankCarModel.LAYER_LOCATION, - "textures/entity/fluid_car.png")); + event.registerEntityRenderer(ModEntityTypes.FLUID_CAR.get(), ctx -> new MultipartCarRenderer.Builder<>(ctx) + .baseModel(BaseCarModel::new, BaseCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/base.png")) + .trimModel(TrimCarModel::new, TrimCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/trim.png")) + .insertModel(FluidTankInsertCarModel::new, FluidTankInsertCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/fluid_tank_insert.png")) + .build()); event.registerEntityRenderer(ModEntityTypes.CHUNK_LOADER_CAR.get(), ctx -> new TrainCarRenderer<>(ctx, ChunkLoaderCarModel::new, ChunkLoaderCarModel.LAYER_LOCATION, "textures/entity/chunk_loader_car.png")); -// event.registerEntityRenderer(ModEntityTypes.SEATER_CAR.get(), ctx -> new TrainCarRenderer<>(ctx, -// TrimCarModel::new, -// TrimCarModel.LAYER_LOCATION, -// ShippingMod.entityTexture("car/trim.png"))); - - event.registerEntityRenderer(ModEntityTypes.SEATER_CAR.get(), ctx -> new MultipartTrainCarRenderer.Builder<>(ctx) + event.registerEntityRenderer(ModEntityTypes.SEATER_CAR.get(), ctx -> new MultipartCarRenderer.Builder<>(ctx) .baseModel(BaseCarModel::new, BaseCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/base.png")) .trimModel(TrimCarModel::new, TrimCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/trim.png")) .emptyInsert() @@ -254,14 +221,12 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterLayerD // CAR event.registerLayerDefinition(TrimCarModel.LAYER_LOCATION, TrimCarModel::createBodyLayer); event.registerLayerDefinition(BaseCarModel.LAYER_LOCATION, BaseCarModel::createBodyLayer); + event.registerLayerDefinition(FluidTankInsertCarModel.LAYER_LOCATION, FluidTankInsertCarModel::createBodyLayer); // LEGACY event.registerLayerDefinition(SteamLocomotiveModel.LAYER_LOCATION, SteamLocomotiveModel::createBodyLayer); event.registerLayerDefinition(EnergyLocomotiveModel.LAYER_LOCATION, EnergyLocomotiveModel::createBodyLayer); - event.registerLayerDefinition(ChestCarModel.LAYER_LOCATION, ChestCarModel::createBodyLayer); - event.registerLayerDefinition(FluidTankCarModel.LAYER_LOCATION, FluidTankCarModel::createBodyLayer); event.registerLayerDefinition(ChunkLoaderCarModel.LAYER_LOCATION, ChunkLoaderCarModel::createBodyLayer); - event.registerLayerDefinition(SeaterCarModel.LAYER_LOCATION, SeaterCarModel::createBodyLayer); } /** diff --git a/src/main/resources/assets/littlelogistics/textures/entity/car/chest_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/car/chest_insert.png index f26d89e86b231d2207e523d755b87b87fb5a0240..b66f2c7c60ebfbd5f2f20b80fbf15651a74a9b45 100644 GIT binary patch delta 350 zcmV-k0iph-1mgoCiBL{Q4GJ0x0000DNk~Le0000$0000$2m=5B0G+pi?2#dmf5HF& z4#EKyC`y0;009t5L_t(oN9~f)l7k=&MTtlisoQS-|9{;?1BrvpO!uubIX-yGW$sW( z*cu@OK=4Hz#*u+87~+Ue8iE){2D;!jO*3)}VjLOhf|T>Jl#-y?X9Y0kIpP&lkp>)V~UFk*qJXq@zW=G8XJ3^bfC*Y_5eWjFS zP3-*%+SEPCVmwWvq((uTx@K^-#``-j?B@?IjQ4lYm+pq0U7kB~T1ztdWeZjW<0j*#T90V3vjQ{`u07*qoM6N<$g23RKhyVZp delta 416 zcmaFNyp%<;Gr-TCmrII^fq{Y7)59eQNH>5m2Q!fT@?hf6iHZ~I4>K_E9cDb9zaoW! zficL_#WAEJ?(LO}Ma>EVt%(AiN*g_2|K6YN7=Ga5%c-~T{81O5x9iLkY3b`as>dW| zPtvoDo;)!r%HjF1FCXWw^mXgXWb99r2$oxBCaJlM^@qSRO}BjS-|-D^4@)@p>|G01 zaQ@GO_J^6-Kz+CB8|%9bZNIFYhSzhCy(@A>{UF1N~mLC)UtymPWPF>SJ8+Ui|=j~<7Z&sD%a~AAc z{!?n+_xXD>fEu5~|H^zRbL*DqeWsmtI>4|Z7d$xJkouD~iFKamA#rIfkSU(7elF{r G5}E*#%Bipb diff --git a/src/main/resources/assets/littlelogistics/textures/entity/car/energy_locomotive_base.png b/src/main/resources/assets/littlelogistics/textures/entity/car/energy_locomotive_base.png new file mode 100644 index 0000000000000000000000000000000000000000..35e5c91600726d886c84d8ae933b93f8f1d559c5 GIT binary patch literal 912 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&F%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl{y4e$wZm6eq>*3z;tGV=2Ba&&ZbvbJ_}bF;Iv(^FM7HZ~R)7Z338hzJS! z|L57SFQ@*0Su}Iz%oQtEl$V!xbaZHFXvoOO08LtV@7ft4C0-Kb7yKV9V0h;6EDorI zv%n*=n1O-sFbFdq&tH+kz`(T8)5S5QBJS;s-l91MJS~mf>{m>dvhVy}f90K5_9U~J zTbSA3`E23*Cn)!Oa>@bE(&btwq}J_PCoL>xB&!xL{yK5#>8CF}?}jb<8L^jf2gAXt z@1?Z@JDytX^<>=honZ>of_1W|gBfS7I>x`ME0mKVuk;*hQ1yJL72hvye{hn)_R0o_NEQZ`GYwP!GfkKkw)Qy3 zPWLxES+BQ$C~o*@(C}6954XeLgob55|K)JJcK%^`U~%gc`~MHbLhhGnHN3iC@~`m; z|IhZ5_5nt+%U0!Hws=%N<-7><1r?iuduI+Q^o9CgvY8!fTDocd#|(Yv&%1J8{<7G# zWm{hFx2t|00cH>PJ-fL^YiUd91A{-!)dJkF9bUasI~=(Awb<^Zm1f<73$FVX%~$xa zfki@VO@^Bnvm|4rLD=UUF{Orb>1ieMFK3D0Je;$jW`X3{15uxI!j9HlGK`7b$1c#g zRX0;1m+Jtt(g6+US80X822Wq5-3)kgNclikJ9w`e?WQQtP|D_O+;Hhg*%(;Cqr?N8ht@-tC*~1n0 zZ&=(g)2N!2xV%8)sON3I8&@{y?1+fmtJ6I5Z_2CV0o&d-tdlG|_0N0TKh7?(CDG4c n{8h7wWE5Z^54AGB`yT(D)1*DEA@Le8MKgH1`njxgN@xNAKU9hy literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/car/energy_locomotive_trim.png b/src/main/resources/assets/littlelogistics/textures/entity/car/energy_locomotive_trim.png new file mode 100644 index 0000000000000000000000000000000000000000..bde3f82c6b0fe97349713c346b579fb10b56e8f9 GIT binary patch literal 641 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&F%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl|74)6(a-Me@1xpU`Eo;-Q<=+O@!K0JH&Z1d*LJ9g{<%G>$Zp8!&vB|(0{ z|Dk{(*uO#uBv{}PSe}4*^GYuoJe4|q-pNW)LdkN8_pW89uhuQxI=8qnbJn7|DGIkrh5p7&Ua)g! zabtv*L2G5)p-no9I-h% z-4B*!oHy$%Sd#w#(iX80y}^6CnckJul9nt$u;jPN~&ur&pbFz;}O)Q&qmv@f!hWsV9 z_1-SGPEMXKd26{{h1dzfOm$tRZQ(|YE=%T`aKC8d1PbsnU0YomqjbsdmUcqz^NuZ( z{p(l{vliX`x*VwJPjk3}s?ysft`57;2@3)h*~KJ$h+0q^{T?jJ@Vh~1V%a5?0`5zG zS^Ag%-^t&2>HXurwVdMefw~i3&w0Oo&C>0~GBz29j=Eprwqe$@TNL&nHK2h>WB~)K kh65uPu}n7ZC0|%S-+jxqCE}VGFzOjRUHx3vIVCg!09vUI`Tzg` literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/car/fluid_tank_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/car/fluid_tank_insert.png new file mode 100644 index 0000000000000000000000000000000000000000..2a2e6338a6b626f1d0a71cff66454b0b370b6856 GIT binary patch literal 1730 zcmb_d`#TegAD$dr2hC-$veb|y!f#yFzmaW2LJ%3VlnpKF}dQ23&AiKZP2Rw4TZ;VUWGk52vwi+P-cX^yXJ7n z{H>PkiEgCvQPldVV@9!zzzYmZ){I*^dg7rS*!=x9!a+}6hqM{iJu^}Th?`izOWI8* zkx0=bIMTKJyGr8vnivtBXI)pJoG$b`3;VFm0RwgDi(|gNZQn}g=U-2X2Fse7JaEm! zL&OmEyLSUy7rvjSDcbb@{qe+?kis?)cV_}1~yh$ zOt$o>8537nUVMHdiqYRJa8@?RibvW7x?5mu;D?Ep8XNKU%*|U|B z6ZDeKnJpQDvG%a{Br~k2q)2RZ3LjoUY;8Q_ue zjC5MesC1Sr_x4#IP~yEhycv6pI}Mgla>EQ{f3@*?+IHukF5WCUs6p(#|$O8YYP#IO@ifoFqit)(_zpf*;ZtjOmGt(*BT)))~5f{jV@eJekg zhFT*_dIWFbb?)hKf~XCot|)jPFh7YxS5gvwZ3 z4NzCG`i+tR zybdQCz(48-xDCCeX(bAT*gkkBaGD2ih^FdgkQQ8=mR-?HMnn48sj@E6E>%b~*}w)6 z|G61`u6EL1^#?h%p?*4_Qx~&*h6%Zz*TVaE(DoNHJdY^vKe z<+kIpYInRV%WU;+8`<;ltq^k$fm=Q_nydd3Vgb0h+YnF9KJcrOe9N2E@2=W7O~sZc zj&j+zjL^Vf);D4QdY!@Y@8)8g{R;X2P0RHi(AjeO`>M=@{(oJuPHvcLhii%d1Gexw APXGV_ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/entity/car/steam_locomotive_base.png b/src/main/resources/assets/littlelogistics/textures/entity/car/steam_locomotive_base.png new file mode 100644 index 0000000000000000000000000000000000000000..cde76f4eb1f151c6c825a0b1f278f437594ef326 GIT binary patch literal 1362 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&F%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl|d4DbnYRaI3r*3z;tGIFxEjtB_}@bEA+G_q;z$4 zot&I3EG+*2dG_nessCRV0d@Zmf1eMegiC__g8yRxhE271IDpce1s;*b3=DjSL74G) z{)!Z!JDNRR978JN-bUVBv{-@XDC?f1ukL*OZ(rsoc4gJph^4g>ezFse7`ChA#2M=( zgiYcVag7Xfh!k_pUA-ybr*wpHLDgnU`*;&5Nsi2IRD=?U0v6~P_ zm-965dBzK`m!eb0Q5o^{RK$w5Ye zMe4qp?vw9q*F5VPUYLH3K6QP^B|pvj9Jm8xc( z7A#B4gEldImVf-^)&65@jd^ThEi27g8Mht|kaTKTr_2(vN#RXH*JkhYQf+@^7Hm2w zEUmA~oiT5!ti1X9BV~LEX)oqXDPeNBZ^`ti?IYjPf9=8*o(;D??!NkXLHPIJFRZpR zuXW!FJigWZAj=nH3t`D2as?S(ExB#XYN=2-D$vzB<^d_BI$iAr3xOV+XbuwOHoX>hFcU!l`9 zMa}ECvJLkYbbUQmwC6{O;_A<(hbJ6NeCEW;f8+YRgB}T8Te;*mtha5Rct9}5if8LT zsh-0ntCji86<;$?i;|RDwTER!ht+bi0^v<|2`iu8{CLS`!d3@%ySuAmHeTThspPa^ zPdnX{62AAwZ^gSBkGE7E=+okIN+{B*Z;7pKxVv%F;;trv8Oy|P{t4|qd#_KF<3w!q zDh(Z52SEp(Yl;2{Dp1h{@ku|$KdlvzV1Ipn z&59gvQC2mB=rl9i3vVKB2D%>9nKpB6V#b}msj{IWCq8a@=bbIvRAMd2x_A1r@XWQ( z8(q6%_^aO6l*RHL1~Ko7UhcoWNBrHdi5HYy*R>y%a@UrtyYp?+uVqHt+djG+cr4D5 z@RK*kuCc&iW-Ei;45tY)$HY`?o3`%|sOx{M&>$@ME?ukEiqR)F?2GsUDe=;|I^Pd1 zp1<ovSmy^ZnD!lwH4lDynKL1w$?iw6>b?0~CpsBIf0Z!Jm?>H^tNPqL z2gAq9{M8#aszz@N&CK+AAy}uv^lic1*${KSJhzY8@b>5C2KUzAGri{fHMA#k6nqin w+V%g8!IfXxCs>RceH4U=r+(b$VM%xNb!1@J z*w6hZkrl}25AX?befI3xxpU|C?%n(0!v~<)t=n3&ffQ>=kYDhBAYk~tjV~A|z**oC zSVPGvB- z+OT`EUfUej1>B2XFRb0nut+sIpevGL_dl_ONU>VUu5h(m-iy>rbvLnOAN)Ld9Rt(6 z%wq@7-4kNC-k!zu;tPM-H?iP7ruY4AyAG5zD7{K%)VcghCC2=vE$3Rs^Zr#Ljq`p* zH+0uByz9GEb)apXab^lj(aOeW%O(n1Ts_dla@~vB+bBj`@tJ(n?!`x(vYl_+C0Tdg z%#P1HJYV|ew%LWhtN!n;-yg+Syi1))pn-u!!9hCVf5O+m>IZ+DuezUUG(YftYuV|R z?-Sa$#;xv)sm?jt7OghtT&8YwGUJ0~#SCkkx3X;II-~pB{BJzVmzm!ZCQH32xnkL% zdr*fV`mYRwH&cmK)&ZIQ-3%-O@0%8@e$=ywO5!tN+!MUSa#MMi0Xv5S1H@tmMk1IE eCmA&NGF*D{HFW(--W*_5GI+ZBxvX Date: Wed, 11 Oct 2023 23:15:31 -0700 Subject: [PATCH 17/26] Barrel car --- .../custom/train/AbstractTrainCarEntity.java | 1 - .../custom/train/wagon/ChestCarEntity.java | 15 +++++++++------ .../shipping/event/ModClientEventHandler.java | 6 ++++++ .../dev/murad/shipping/setup/ModEntityTypes.java | 8 ++++++++ .../java/dev/murad/shipping/setup/ModItems.java | 11 ++++++++++- .../textures/entity/car/barrel_insert.png | Bin 0 -> 1126 bytes 6 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/assets/littlelogistics/textures/entity/car/barrel_insert.png diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java index 31433ecd..81f435b9 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/AbstractTrainCarEntity.java @@ -142,7 +142,6 @@ public boolean canBeCollidedWith() { return getPickResult().getItem(); } - @Nullable public Integer getColor() { int color = this.getEntityData().get(COLOR_DATA); diff --git a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java index 30c88562..c0cb5b11 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/train/wagon/ChestCarEntity.java @@ -27,13 +27,12 @@ public class ChestCarEntity extends AbstractWagonEntity implements ItemHandlerVanillaContainerWrapper, WorldlyContainer, MenuProvider { protected final ItemStackHandler itemHandler = createHandler(); protected final LazyOptional handler = LazyOptional.of(() -> itemHandler); - public ChestCarEntity(EntityType p_38087_, Level p_38088_) { - super(p_38087_, p_38088_); + public ChestCarEntity(EntityType type, Level level) { + super(type, level); } - public ChestCarEntity(Level level, Double aDouble, Double aDouble1, Double aDouble2) { - super(ModEntityTypes.CHEST_CAR.get(), level, aDouble, aDouble1, aDouble2); - + public ChestCarEntity(EntityType type, Level level, Double x, Double y, Double z) { + super(type, level, x, y, z); } @Override @@ -50,7 +49,11 @@ private ItemStackHandler createHandler() { @Override public @NotNull ItemStack getPickResult() { - return new ItemStack(ModItems.CHEST_CAR.get()); + if (this.getType().equals(ModEntityTypes.BARREL_CAR.get())) { + return new ItemStack(ModItems.BARREL_CAR.get()); + } else { + return new ItemStack(ModItems.CHEST_CAR.get()); + } } @Override diff --git a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java index fc3aa64c..398a13e8 100644 --- a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java @@ -166,6 +166,12 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRender .insertModel(CubeInsertCarModel::new, CubeInsertCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/chest_insert.png")) .build()); + event.registerEntityRenderer(ModEntityTypes.BARREL_CAR.get(), ctx -> new MultipartCarRenderer.Builder<>(ctx) + .baseModel(BaseCarModel::new, BaseCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/base.png")) + .trimModel(TrimCarModel::new, TrimCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/trim.png")) + .insertModel(CubeInsertCarModel::new, CubeInsertCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/barrel_insert.png")) + .build()); + event.registerEntityRenderer(ModEntityTypes.FLUID_CAR.get(), ctx -> new MultipartCarRenderer.Builder<>(ctx) .baseModel(BaseCarModel::new, BaseCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/base.png")) .trimModel(TrimCarModel::new, TrimCarModel.LAYER_LOCATION, ShippingMod.entityTexture("car/trim.png")) diff --git a/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java b/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java index 1e8fb511..57b79e8f 100644 --- a/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java +++ b/src/main/java/dev/murad/shipping/setup/ModEntityTypes.java @@ -88,6 +88,14 @@ public class ModEntityTypes { .setShouldReceiveVelocityUpdates(true) .build(new ResourceLocation(ShippingMod.MOD_ID, "chest_car").toString())); + public static final RegistryObject> BARREL_CAR = + Registration.ENTITIES.register("barrel_car", + () -> EntityType.Builder.of(ChestCarEntity::new, + MobCategory.MISC).sized(0.7f, 0.9f) + .clientTrackingRange(8) + .setShouldReceiveVelocityUpdates(true) + .build(new ResourceLocation(ShippingMod.MOD_ID, "barrel_car").toString())); + public static final RegistryObject> SEATER_CAR = Registration.ENTITIES.register("seater_car", () -> EntityType.Builder.of(SeaterCarEntity::new, diff --git a/src/main/java/dev/murad/shipping/setup/ModItems.java b/src/main/java/dev/murad/shipping/setup/ModItems.java index 8ee69340..a3b075d1 100644 --- a/src/main/java/dev/murad/shipping/setup/ModItems.java +++ b/src/main/java/dev/murad/shipping/setup/ModItems.java @@ -100,7 +100,16 @@ public class ModItems { () -> new TugRouteItem(new Item.Properties().stacksTo(16)), ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); public static final RegistryObject CHEST_CAR = register("chest_car", - () -> new TrainCarItem(ChestCarEntity::new, new Item.Properties().stacksTo(64)), ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); + () -> new TrainCarItem((level, x, y, z) -> + new ChestCarEntity(ModEntityTypes.CHEST_CAR.get(), level, x, y, z), + new Item.Properties().stacksTo(64)), + ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); + + public static final RegistryObject BARREL_CAR = register("barrel_car", + () -> new TrainCarItem((level, x, y, z) -> + new ChestCarEntity(ModEntityTypes.BARREL_CAR.get(), level, x, y, z), + new Item.Properties().stacksTo(64)), + ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); public static final RegistryObject FLUID_CAR = register("fluid_car", () -> new TrainCarItem(FluidTankCarEntity::new, new Item.Properties().stacksTo(64)), ImmutableList.of(CreativeModeTabs.TOOLS_AND_UTILITIES)); diff --git a/src/main/resources/assets/littlelogistics/textures/entity/car/barrel_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/car/barrel_insert.png new file mode 100644 index 0000000000000000000000000000000000000000..e0f7bc63e04ce41f94d124af55bcb5e341296255 GIT binary patch literal 1126 zcmV-s1eyDZP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TXCDPp*AlfrM2JV83UwcB)Yn<6ieDtQm5Ocx+P;1~#$ z7`{@Xc-#9fH~$P31gXLlD>A_O8jjAMC1=ikWMM;|eer4Sx;8An5vK*ZZ4X6N!>TK| zj)O&TCPMOmY+fheu;ma_MY0(k`F{VojcZ7`%puHW? zqqqA$J?+5ep#o3A_Z*D&eeWRSanw!1wf;;ZCog4g(&(GSP8o&}V9_(Dq!u=)tiRx*Z?44?-Lr_D~k9 z>u=pY8yi3$RIvcO>pjGa@}p}h=yjJyQLGIXnBB;W3a`df%+nGdrV*k=jLDRdFpKfW zhbz3fjHt`p*%3B2fbB56uh%ChCkTAotm8B{pE^b8b~@a_=}{j?{Q#p|A?}_Y;CR%- z@i4^6u!qq>8;-MncNf^$05x;F!`yY>{DA$-=SH@OOXf4foMa4ZW(ET4Bg!ej6y+=GLmu|$9E2Sf!@lz zJgzWjNdJ01HpOf_jZJv}C7Uykx24xK)`NQ=*E&RPj;>1C98z@AO3XvoaXHUB$XL8| z>)M9iPrtluGy<%rpWm-_E2}Dn^VegX9Uq#?-3=U0b_y4ZISzY0wzAB$yqng0_I
      vmNzAA?SpZNXxGro8St zY* z3oJ&_l9p$I%JOvuZu>q*+tjQzH?8;ci{EIL=CGc8cE4`>>tgi#+Y6lC8SoyTq1XAR zEJ-tN>gM&n`mW(3$g8^f=Z4<`_Bhe`p5g@ew@lCXTDC1cK@bE%5ClOG1VIo4K@bE% s5ClOG1VIo4K@bE%5ClOGg#QlkC(I-}>YDpvAOHXW07*qoM6N<$f|rpMRsaA1 literal 0 HcmV?d00001 From bb37610ad288fc6b31c00111d732497041742d9d Mon Sep 17 00:00:00 2001 From: EDToaster Date: Wed, 11 Oct 2023 23:29:12 -0700 Subject: [PATCH 18/26] Add item model --- .../data/client/ModItemModelProvider.java | 3 +++ .../shipping/event/ModClientEventHandler.java | 3 ++- .../textures/item/barrel_barge.png | Bin 0 -> 361 bytes .../littlelogistics/textures/item/barrel_car.png | Bin 0 -> 444 bytes .../textures/item/vacuum_barge.png | Bin 0 -> 410 bytes 5 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/assets/littlelogistics/textures/item/barrel_barge.png create mode 100644 src/main/resources/assets/littlelogistics/textures/item/barrel_car.png create mode 100644 src/main/resources/assets/littlelogistics/textures/item/vacuum_barge.png diff --git a/src/main/java/dev/murad/shipping/data/client/ModItemModelProvider.java b/src/main/java/dev/murad/shipping/data/client/ModItemModelProvider.java index 13a048cd..ecf5dec5 100644 --- a/src/main/java/dev/murad/shipping/data/client/ModItemModelProvider.java +++ b/src/main/java/dev/murad/shipping/data/client/ModItemModelProvider.java @@ -28,6 +28,8 @@ protected void registerModels() { withExistingParent("vessel_charger", modLoc("block/vessel_charger")); builder(itemGenerated, "barge"); + builder(itemGenerated, "barrel_barge"); + builder(itemGenerated, "vacuum_barge"); builder(itemGenerated, "chunk_loader_barge"); builder(itemGenerated, "fishing_barge"); builder(itemGenerated, "fluid_barge"); @@ -37,6 +39,7 @@ protected void registerModels() { builder(itemGenerated, "steam_locomotive"); builder(itemGenerated, "energy_locomotive"); builder(itemGenerated, "chest_car"); + builder(itemGenerated, "barrel_car"); builder(itemGenerated, "chunk_loader_car"); builder(itemGenerated, "fluid_car"); builder(itemGenerated, "seater_car"); diff --git a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java index 398a13e8..2db1bec8 100644 --- a/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ModClientEventHandler.java @@ -229,9 +229,10 @@ public static void onRegisterEntityRenderers(EntityRenderersEvent.RegisterLayerD event.registerLayerDefinition(BaseCarModel.LAYER_LOCATION, BaseCarModel::createBodyLayer); event.registerLayerDefinition(FluidTankInsertCarModel.LAYER_LOCATION, FluidTankInsertCarModel::createBodyLayer); - // LEGACY event.registerLayerDefinition(SteamLocomotiveModel.LAYER_LOCATION, SteamLocomotiveModel::createBodyLayer); event.registerLayerDefinition(EnergyLocomotiveModel.LAYER_LOCATION, EnergyLocomotiveModel::createBodyLayer); + + // LEGACY event.registerLayerDefinition(ChunkLoaderCarModel.LAYER_LOCATION, ChunkLoaderCarModel::createBodyLayer); } diff --git a/src/main/resources/assets/littlelogistics/textures/item/barrel_barge.png b/src/main/resources/assets/littlelogistics/textures/item/barrel_barge.png new file mode 100644 index 0000000000000000000000000000000000000000..cd4d5a557ae7130f34567d6a10e88ebfe04f8945 GIT binary patch literal 361 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}-0G|-oskwGja%`L8&1M!l%qekRP+~VN&wh5X(~JW9Sw)U>OI;#u74e!>5700u@A zuI)fYoCO|{#S9F5he4R}c>anMpkR}yi(`mJaO^oxA!bDmhl_k{O@YdWe&6jg=ZK$e z`?Y?>rPcSI9rzkit;g_njuC_B-iZB~%#v5uh-Akk$SN4uPx!;&A0|^L*xHo;p#ISs zMv?7`F3MpJJ{&8Z{S>=4UND+^XQ4@NS%Lhb0G|-oskwHuiX5lp*fzzR%`9}7Q{ud!#BN%i{p@0=83p!pOI;#u74O>_%)r2R z2!t6$HM|;tf(t!e978mMZO<|C9a7+7y`Xrbv*Ao63%l^#qW{`a2^&?G{NJj`v-J7_ zzUs?)=Z+Rm=Q8M;obp_cWigXl>x3Rh_FM}OO?`%GWo<^ix1@Fig?uv*zH=et=s_u~ zclQoN=USd^=H``qG4+`lOH5MpmPPfu8VrxK1y`-LXjMI~`s`Om<$9Hk$1J|jf3$6> vOmV^d{PsuJT{f0ki}Ww_%P##9u4%u_RbuCiL;KzW9n0Y9>gTe~DWM4feVVFa literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/littlelogistics/textures/item/vacuum_barge.png b/src/main/resources/assets/littlelogistics/textures/item/vacuum_barge.png new file mode 100644 index 0000000000000000000000000000000000000000..e1f570a3a611824e865f8f2a1476e7526004ce16 GIT binary patch literal 410 zcmV;L0cHM)P)0x9s+NL5Qb%K zh#ppFgZCQaqqxDO7S10FL5u*F;&sb~Xz$fKPN?XZ!gY!8pY8UP1okCTT1w&QpWIznJO4*QnH-tHmwCIN6@_OKlX+i@7?^K^s&ex{HVLLTcn zJMA`VG|E%4$lzt(4RAY7OC`pW33uHt0B@sF$Q?&g2zgp45NR|}qtO5eaMNnJ;DYnK zgJlzdVLneh7F!9fG+4e4;EC$5+o+@vGAYE`5A>({2J*?3+vZD|a{vGU07*qoM6N<$ Ef{3!N%m4rY literal 0 HcmV?d00001 From c6fb6ec921c36ebb8b16490827a2c4c3d214e5c6 Mon Sep 17 00:00:00 2001 From: EDToaster Date: Wed, 11 Oct 2023 23:31:54 -0700 Subject: [PATCH 19/26] Add lang entries --- src/main/resources/assets/littlelogistics/lang/en_us.json | 3 +++ src/main/resources/assets/littlelogistics/lang/es_es.json | 3 +++ src/main/resources/assets/littlelogistics/lang/fr_fr.json | 3 +++ src/main/resources/assets/littlelogistics/lang/ja_jp.json | 3 +++ src/main/resources/assets/littlelogistics/lang/ko_kr.json | 3 +++ src/main/resources/assets/littlelogistics/lang/nl_nl.json | 3 +++ src/main/resources/assets/littlelogistics/lang/zh_cn.json | 3 +++ 7 files changed, 21 insertions(+) diff --git a/src/main/resources/assets/littlelogistics/lang/en_us.json b/src/main/resources/assets/littlelogistics/lang/en_us.json index 7aa127ae..9f7fe514 100644 --- a/src/main/resources/assets/littlelogistics/lang/en_us.json +++ b/src/main/resources/assets/littlelogistics/lang/en_us.json @@ -1,6 +1,8 @@ { "item.littlelogistics.tug": "Steam Tug", "item.littlelogistics.barge": "Chest Barge", + "item.littlelogistics.barrel_barge": "Barrel Barge", + "item.littlelogistics.vacuum_barge": "Item Collection Barge", "item.littlelogistics.chunk_loader_barge": "Chunk Loader Barge", "item.littlelogistics.seater_barge": "Seater Barge", "item.littlelogistics.fishing_barge": "Auto-Fishing Barge", @@ -11,6 +13,7 @@ "item.littlelogistics.fluid_barge": "Fluid Tank Barge", "item.littlelogistics.fluid_car": "Fluid Tank Train Car", "item.littlelogistics.chest_car": "Chest Train Car", + "item.littlelogistics.barrel_car": "Barrel Train Car", "item.littlelogistics.chunk_loader_car": "Chunk Loader Train Car", "item.littlelogistics.seater_car": "Train Car", "item.littlelogistics.steam_locomotive": "Steam Locomotive", diff --git a/src/main/resources/assets/littlelogistics/lang/es_es.json b/src/main/resources/assets/littlelogistics/lang/es_es.json index 3162eef6..efc36cdf 100644 --- a/src/main/resources/assets/littlelogistics/lang/es_es.json +++ b/src/main/resources/assets/littlelogistics/lang/es_es.json @@ -1,6 +1,8 @@ { "item.littlelogistics.tug": "Remolcador de vapor", "item.littlelogistics.barge": "Barca con cofre", + "item.littlelogistics.barrel_barge": "Barrel Barge", + "item.littlelogistics.vacuum_barge": "Item Collection Barge", "item.littlelogistics.chunk_loader_barge": "Barca con cargador de Chunks", "item.littlelogistics.seater_barge": "Barca con asiento", "item.littlelogistics.fishing_barge": "Barca de auto-pesca", @@ -11,6 +13,7 @@ "item.littlelogistics.fluid_barge": "Barca con tanque de fluidos", "item.littlelogistics.fluid_car": "Vagón con tanque de fluidos", "item.littlelogistics.chest_car": "Vagón con core", + "item.littlelogistics.barrel_car": "Barrel Train Car", "item.littlelogistics.chunk_loader_car": "Vagón con cargador de Chunks", "item.littlelogistics.seater_car": "Vagón con asiento", "item.littlelogistics.steam_locomotive": "Locomotora de vapor", diff --git a/src/main/resources/assets/littlelogistics/lang/fr_fr.json b/src/main/resources/assets/littlelogistics/lang/fr_fr.json index 010c0a4a..107055f1 100644 --- a/src/main/resources/assets/littlelogistics/lang/fr_fr.json +++ b/src/main/resources/assets/littlelogistics/lang/fr_fr.json @@ -1,6 +1,8 @@ { "item.littlelogistics.tug": "Remorqueur à Vapeur", "item.littlelogistics.barge": "Barge de Coffre", + "item.littlelogistics.barrel_barge": "Barrel Barge", + "item.littlelogistics.vacuum_barge": "Item Collection Barge", "item.littlelogistics.chunk_loader_barge": "Barge de Chargement de Tronçon", "item.littlelogistics.seater_barge": "Barge de Chaise", "item.littlelogistics.fishing_barge": "Barge de Pêche", @@ -11,6 +13,7 @@ "item.littlelogistics.fluid_barge": "Remorqueur de Transport de Liquide", "item.littlelogistics.fluid_car": "Fluid Tank Train Car", "item.littlelogistics.chest_car": "Chest Train Car", + "item.littlelogistics.barrel_car": "Barrel Train Car", "item.littlelogistics.chunk_loader_car": "Chunk Loader Train Car", "item.littlelogistics.seater_car": "Train Car", "item.littlelogistics.steam_locomotive": "Steam Locomotive", diff --git a/src/main/resources/assets/littlelogistics/lang/ja_jp.json b/src/main/resources/assets/littlelogistics/lang/ja_jp.json index e4f1027f..1ccff108 100644 --- a/src/main/resources/assets/littlelogistics/lang/ja_jp.json +++ b/src/main/resources/assets/littlelogistics/lang/ja_jp.json @@ -1,6 +1,8 @@ { "item.littlelogistics.tug": "蒸気曳船", "item.littlelogistics.barge": "チェスト付き艀", + "item.littlelogistics.barrel_barge": "Barrel Barge", + "item.littlelogistics.vacuum_barge": "Item Collection Barge", "item.littlelogistics.chunk_loader_barge": "チャンクローダー付き艀", "item.littlelogistics.seater_barge": "座席付き艀", "item.littlelogistics.fishing_barge": "自動釣り機付き艀", @@ -11,6 +13,7 @@ "item.littlelogistics.fluid_barge": "液体タンク付き艀", "item.littlelogistics.fluid_car": "液体タンク付き貨両", "item.littlelogistics.chest_car": "チェスト付き貨車", + "item.littlelogistics.barrel_car": "Barrel Train Car", "item.littlelogistics.chunk_loader_car": "チャンクローダー付き貨車", "item.littlelogistics.seater_car": "貨車", "item.littlelogistics.steam_locomotive": "蒸気機関車", diff --git a/src/main/resources/assets/littlelogistics/lang/ko_kr.json b/src/main/resources/assets/littlelogistics/lang/ko_kr.json index 9de8fd18..44d41e72 100644 --- a/src/main/resources/assets/littlelogistics/lang/ko_kr.json +++ b/src/main/resources/assets/littlelogistics/lang/ko_kr.json @@ -1,6 +1,8 @@ { "item.littlelogistics.tug": "증기 예인선", "item.littlelogistics.barge": "상자 바지선", + "item.littlelogistics.barrel_barge": "Barrel Barge", + "item.littlelogistics.vacuum_barge": "Item Collection Barge", "item.littlelogistics.chunk_loader_barge": "청크 로드 바지선", "item.littlelogistics.seater_barge": "좌석 바지선", "item.littlelogistics.fishing_barge": "자동 낚시 바지선", @@ -11,6 +13,7 @@ "item.littlelogistics.fluid_barge": "유체 탱크 바지선", "item.littlelogistics.fluid_car": "유체 탱크 철도 차량", "item.littlelogistics.chest_car": "상자 철도 차량", + "item.littlelogistics.barrel_car": "Barrel Train Car", "item.littlelogistics.chunk_loader_car": "청크 로더 철도 차량", "item.littlelogistics.seater_car": "철도 차량", "item.littlelogistics.steam_locomotive": "증기 기관차", diff --git a/src/main/resources/assets/littlelogistics/lang/nl_nl.json b/src/main/resources/assets/littlelogistics/lang/nl_nl.json index 8af6ef10..35445948 100644 --- a/src/main/resources/assets/littlelogistics/lang/nl_nl.json +++ b/src/main/resources/assets/littlelogistics/lang/nl_nl.json @@ -1,6 +1,8 @@ { "item.littlelogistics.tug": "Stoom Sleepboot", "item.littlelogistics.barge": "Sleepaak met Kist", + "item.littlelogistics.barrel_barge": "Barrel Barge", + "item.littlelogistics.vacuum_barge": "Item Collection Barge", "item.littlelogistics.chunk_loader_barge": "Sleepaak met Chunk Lader", "item.littlelogistics.seater_barge": "Sleepaak met Zitting", "item.littlelogistics.fishing_barge": "Auto-Vis Sleepaak", @@ -11,6 +13,7 @@ "item.littlelogistics.fluid_barge": "Sleepaak met Vloeistof Tank", "item.littlelogistics.fluid_car": "Wagon met Vloeistof Tank", "item.littlelogistics.chest_car": "Wagon met Kist", + "item.littlelogistics.barrel_car": "Barrel Train Car", "item.littlelogistics.chunk_loader_car": "Wagon met Chunk Lader", "item.littlelogistics.seater_car": "Wagon", "item.littlelogistics.steam_locomotive": "Stoomlocomotief", diff --git a/src/main/resources/assets/littlelogistics/lang/zh_cn.json b/src/main/resources/assets/littlelogistics/lang/zh_cn.json index e17e39d8..b1050b32 100644 --- a/src/main/resources/assets/littlelogistics/lang/zh_cn.json +++ b/src/main/resources/assets/littlelogistics/lang/zh_cn.json @@ -1,6 +1,8 @@ { "item.littlelogistics.tug": "蒸汽拖船", "item.littlelogistics.barge": "运输驳船", + "item.littlelogistics.barrel_barge": "Barrel Barge", + "item.littlelogistics.vacuum_barge": "Item Collection Barge", "item.littlelogistics.chunk_loader_barge": "加载驳船", "item.littlelogistics.seater_barge": "载人驳船", "item.littlelogistics.fishing_barge": "捕鱼驳船", @@ -11,6 +13,7 @@ "item.littlelogistics.fluid_barge": "流体驳船", "item.littlelogistics.fluid_car": "流体车厢", "item.littlelogistics.chest_car": "运输车厢", + "item.littlelogistics.barrel_car": "Barrel Train Car", "item.littlelogistics.chunk_loader_car": "加载车厢", "item.littlelogistics.seater_car": "车厢", "item.littlelogistics.steam_locomotive": "蒸汽车头", From b898b79fad71f58eadb31cdc8faa7831109df06c Mon Sep 17 00:00:00 2001 From: EDToaster Date: Wed, 11 Oct 2023 23:36:03 -0700 Subject: [PATCH 20/26] Vacuum barge item --- .../textures/item/vacuum_barge.png | Bin 410 -> 315 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/assets/littlelogistics/textures/item/vacuum_barge.png b/src/main/resources/assets/littlelogistics/textures/item/vacuum_barge.png index e1f570a3a611824e865f8f2a1476e7526004ce16..a67b50d8b4f725dd782db2043e10eb58d85dc11e 100644 GIT binary patch delta 299 zcmbQmyqjr)WIZzj1A~Sxe=v|@EDmyaVpw-h<|UBBlJ4m1$iT3%pZiZDE0Avx;1lA? zzzCFJV-OJ1h*A{Q(qWXA_3Lvj*`A%v$LGetV63GT;NcO$$|@ot;ACwL)FfAwF&#(= zlmz(&|3?K350qmi85rsrI14-?iy0XB4ude`@%$AjKphpHE{-7@!LfaTe9np-EU^M# zMW_D0zfGaGt|WQF%pILa{}s9Z%ze+QaNXFOQE+Kz;0`O{lZ^HYp1EliPmq+jveb<2 z*yBe(4`}ZdZVBdb?dR$@bY5dQW!8bhccMwVEmu^xZdm$xfz>m6l{;tV&NvkP(W1B| ew&rN>O>w7st`$80OvQkXVDNPHb6Mw<&;$T;bZeIY delta 395 zcmV;60d)Sm0-6Jm8Gi-<001BJ|6u?C0bxl*K~y-6wUa?h0znvtA7vp8l)=>^qQ$^2 zE(Ah|NH;;~;Hmyae?t5Vvj1Xl(NVm_B0?SlZ-o$sWo?KaR-u{>=H~9Ir+RNQ^F8nP z4&My?w=!BvX0()Ccdl##0jd`X0IDYP{_!>BuM2GW!DUs=cYpjQo<&AWNmWg7S^NMX zy!9LKYc}7jU5z~^VSkrOE`nis!3Ats3aXl*3^HI)2C1qE(qc;K>>R^VJfLAIRB{mj zj^c6GL|MRgHVZR=Pjp>p`}rEfn!2gh$xTq`_c_os>P?WhHPT`l00(A|lZOGe<9H1^ zLSQ=%`({2J*?3+vZD|a{vGU07*qoL Date: Wed, 11 Oct 2023 23:38:56 -0700 Subject: [PATCH 21/26] Add entity and ui names --- src/main/resources/assets/littlelogistics/lang/en_us.json | 3 +++ src/main/resources/assets/littlelogistics/lang/es_es.json | 3 +++ src/main/resources/assets/littlelogistics/lang/fr_fr.json | 3 +++ src/main/resources/assets/littlelogistics/lang/ja_jp.json | 3 +++ src/main/resources/assets/littlelogistics/lang/ko_kr.json | 3 +++ src/main/resources/assets/littlelogistics/lang/nl_nl.json | 3 +++ src/main/resources/assets/littlelogistics/lang/zh_cn.json | 3 +++ 7 files changed, 21 insertions(+) diff --git a/src/main/resources/assets/littlelogistics/lang/en_us.json b/src/main/resources/assets/littlelogistics/lang/en_us.json index 9f7fe514..77281963 100644 --- a/src/main/resources/assets/littlelogistics/lang/en_us.json +++ b/src/main/resources/assets/littlelogistics/lang/en_us.json @@ -25,6 +25,8 @@ "entity.littlelogistics.tug": "Steam Tug", "entity.littlelogistics.barge": "Chest Barge", + "entity.littlelogistics.barrel_barge": "Barrel Barge", + "entity.littlelogistics.vacuum_barge": "Item Collection Barge", "entity.littlelogistics.chunk_loader_barge": "Chunk Loader Barge", "entity.littlelogistics.fishing_barge": "Auto-Fishing Barge", "entity.littlelogistics.spring": "Vessel Chain", @@ -33,6 +35,7 @@ "entity.littlelogistics.seater_barge": "Seater Barge", "entity.littlelogistics.fluid_car": "Fluid Tank Train Car", "entity.littlelogistics.chest_car": "Chest Train Car", + "entity.littlelogistics.barrel_car": "Barrel Train Car", "entity.littlelogistics.chunk_loader_car": "Chunk Loader Train Car", "entity.littlelogistics.seater_car": "Train Car", "entity.littlelogistics.steam_locomotive": "Steam Locomotive", diff --git a/src/main/resources/assets/littlelogistics/lang/es_es.json b/src/main/resources/assets/littlelogistics/lang/es_es.json index efc36cdf..8f1652f6 100644 --- a/src/main/resources/assets/littlelogistics/lang/es_es.json +++ b/src/main/resources/assets/littlelogistics/lang/es_es.json @@ -25,6 +25,8 @@ "entity.littlelogistics.tug": "Remolcador de vapor", "entity.littlelogistics.barge": "Barca con cofre", + "entity.littlelogistics.barrel_barge": "Barrel Barge", + "entity.littlelogistics.vacuum_barge": "Item Collection Barge", "entity.littlelogistics.chunk_loader_barge": "Barca con cargador de Chunks", "entity.littlelogistics.fishing_barge": "Barca de auto-pesca", "entity.littlelogistics.spring": "Vinculador", @@ -33,6 +35,7 @@ "entity.littlelogistics.seater_barge": "Barca con asiento", "entity.littlelogistics.fluid_car": "Vagón con tanque de fluidos", "entity.littlelogistics.chest_car": "Vagón con cofre", + "entity.littlelogistics.barrel_car": "Barrel Train Car", "entity.littlelogistics.chunk_loader_car": "Vagón con cargador de Chunks", "entity.littlelogistics.seater_car": "Vagón con asiento", "entity.littlelogistics.steam_locomotive": "Locomotora de vapor", diff --git a/src/main/resources/assets/littlelogistics/lang/fr_fr.json b/src/main/resources/assets/littlelogistics/lang/fr_fr.json index 107055f1..78f90864 100644 --- a/src/main/resources/assets/littlelogistics/lang/fr_fr.json +++ b/src/main/resources/assets/littlelogistics/lang/fr_fr.json @@ -25,6 +25,8 @@ "entity.littlelogistics.tug": "Remorqueur à Vapeur", "entity.littlelogistics.barge": "Barge de Coffre", + "entity.littlelogistics.barrel_barge": "Barrel Barge", + "entity.littlelogistics.vacuum_barge": "Item Collection Barge", "entity.littlelogistics.chunk_loader_barge": "Barge de Chargement de Tronçon", "entity.littlelogistics.fishing_barge": "Barge de Pêche", "entity.littlelogistics.spring": "Chaîne de Bateau", @@ -33,6 +35,7 @@ "entity.littlelogistics.seater_barge": "Barge de Chaise", "entity.littlelogistics.fluid_car": "Fluid Tank Train Car", "entity.littlelogistics.chest_car": "Chest Train Car", + "entity.littlelogistics.barrel_car": "Barrel Train Car", "entity.littlelogistics.chunk_loader_car": "Chunk Loader Train Car", "entity.littlelogistics.seater_car": "Train Car", "entity.littlelogistics.steam_locomotive": "Steam Locomotive", diff --git a/src/main/resources/assets/littlelogistics/lang/ja_jp.json b/src/main/resources/assets/littlelogistics/lang/ja_jp.json index 1ccff108..7e367619 100644 --- a/src/main/resources/assets/littlelogistics/lang/ja_jp.json +++ b/src/main/resources/assets/littlelogistics/lang/ja_jp.json @@ -25,6 +25,8 @@ "entity.littlelogistics.tug": "蒸気曳船", "entity.littlelogistics.barge": "チェスト付き艀", + "entity.littlelogistics.barrel_barge": "Barrel Barge", + "entity.littlelogistics.vacuum_barge": "Item Collection Barge", "entity.littlelogistics.chunk_loader_barge": "チャンクローダー付き艀", "entity.littlelogistics.fishing_barge": "自動釣り機付き艀", "entity.littlelogistics.spring": "車両用鎖", @@ -33,6 +35,7 @@ "entity.littlelogistics.seater_barge": "座席付き艀", "entity.littlelogistics.fluid_car": "液体タンク付き貨両", "entity.littlelogistics.chest_car": "チェスト付き貨車", + "entity.littlelogistics.barrel_car": "Barrel Train Car", "entity.littlelogistics.chunk_loader_car": "チャンクローダー付き貨車", "entity.littlelogistics.seater_car": "貨車", "entity.littlelogistics.steam_locomotive": "蒸気機関車", diff --git a/src/main/resources/assets/littlelogistics/lang/ko_kr.json b/src/main/resources/assets/littlelogistics/lang/ko_kr.json index 44d41e72..4eadc335 100644 --- a/src/main/resources/assets/littlelogistics/lang/ko_kr.json +++ b/src/main/resources/assets/littlelogistics/lang/ko_kr.json @@ -25,6 +25,8 @@ "entity.littlelogistics.tug": "증기 예인선", "entity.littlelogistics.barge": "상자 바지선", + "entity.littlelogistics.barrel_barge": "Barrel Barge", + "entity.littlelogistics.vacuum_barge": "Item Collection Barge", "entity.littlelogistics.chunk_loader_barge": "청크 로더 바지선", "entity.littlelogistics.fishing_barge": "자동 낚시 바지선", "entity.littlelogistics.spring": "선박 사슬", @@ -33,6 +35,7 @@ "entity.littlelogistics.seater_barge": "좌석 바지선", "entity.littlelogistics.fluid_car": "유체 탱크 철도 차량", "entity.littlelogistics.chest_car": "상자 철도 차량", + "entity.littlelogistics.barrel_car": "Barrel Train Car", "entity.littlelogistics.chunk_loader_car": "청크 로더 철도 차량", "entity.littlelogistics.seater_car": "철도 차량", "entity.littlelogistics.steam_locomotive": "증기 기관차", diff --git a/src/main/resources/assets/littlelogistics/lang/nl_nl.json b/src/main/resources/assets/littlelogistics/lang/nl_nl.json index 35445948..d1c2c909 100644 --- a/src/main/resources/assets/littlelogistics/lang/nl_nl.json +++ b/src/main/resources/assets/littlelogistics/lang/nl_nl.json @@ -25,6 +25,8 @@ "entity.littlelogistics.tug": "Stoom Sleepboot", "entity.littlelogistics.barge": "Sleepaak met Kist", + "entity.littlelogistics.barrel_barge": "Barrel Barge", + "entity.littlelogistics.vacuum_barge": "Item Collection Barge", "entity.littlelogistics.chunk_loader_barge": "Sleepaak met Chunk Lader", "entity.littlelogistics.fishing_barge": "Auto-Vis Sleepaak", "entity.littlelogistics.spring": "Sleepkabel", @@ -33,6 +35,7 @@ "entity.littlelogistics.seater_barge": "Sleepaak met Zitting", "entity.littlelogistics.fluid_car": "Wagon met Vloeistof Tank", "entity.littlelogistics.chest_car": "Wagon met Kist", + "entity.littlelogistics.barrel_car": "Barrel Train Car", "entity.littlelogistics.chunk_loader_car": "Wagon met Chunk Lader", "entity.littlelogistics.seater_car": "Wagon", "entity.littlelogistics.steam_locomotive": "Stoomlocomotief", diff --git a/src/main/resources/assets/littlelogistics/lang/zh_cn.json b/src/main/resources/assets/littlelogistics/lang/zh_cn.json index b1050b32..4bee0b72 100644 --- a/src/main/resources/assets/littlelogistics/lang/zh_cn.json +++ b/src/main/resources/assets/littlelogistics/lang/zh_cn.json @@ -25,6 +25,8 @@ "entity.littlelogistics.tug": "蒸汽拖船", "entity.littlelogistics.barge": "运输驳船", + "entity.littlelogistics.barrel_barge": "Barrel Barge", + "entity.littlelogistics.vacuum_barge": "Item Collection Barge", "entity.littlelogistics.chunk_loader_barge": "加载驳船", "entity.littlelogistics.fishing_barge": "捕鱼驳船", "entity.littlelogistics.spring": "船舶锁链", @@ -33,6 +35,7 @@ "entity.littlelogistics.seater_barge": "载人驳船", "entity.littlelogistics.fluid_car": "流体车厢", "entity.littlelogistics.chest_car": "运输车厢", + "entity.littlelogistics.barrel_car": "Barrel Train Car", "entity.littlelogistics.chunk_loader_car": "加载车厢", "entity.littlelogistics.seater_car": "车厢", "entity.littlelogistics.steam_locomotive": "蒸汽车头", From f819059605cb2f9362499776dd279c34e66d262e Mon Sep 17 00:00:00 2001 From: EDToaster Date: Wed, 11 Oct 2023 23:49:27 -0700 Subject: [PATCH 22/26] Add all recipes --- .../murad/shipping/data/ModRecipeProvider.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/dev/murad/shipping/data/ModRecipeProvider.java b/src/main/java/dev/murad/shipping/data/ModRecipeProvider.java index 87a14244..237dd652 100644 --- a/src/main/java/dev/murad/shipping/data/ModRecipeProvider.java +++ b/src/main/java/dev/murad/shipping/data/ModRecipeProvider.java @@ -211,6 +211,15 @@ protected void buildRecipes(Consumer consumer) { .unlockedBy("has_item", has(Items.BARREL)) .save(consumer); + ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, ModItems.VACUUM_BARGE.get()) + .define('_', Items.HOPPER) + .define('#', Items.ENDER_EYE) + .define('$', Items.IRON_INGOT) + .pattern("#_#") + .pattern("$$$") + .unlockedBy("has_item", has(Items.HOPPER)) + .save(consumer); + ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, ModItems.SEATER_BARGE.get()) .define('_', ItemTags.WOODEN_STAIRS) .define('#', ItemTags.SIGNS) @@ -264,6 +273,15 @@ protected void buildRecipes(Consumer consumer) { .unlockedBy("has_item", has(ModItems.SEATER_CAR.get())) .save(consumer); + ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, ModItems.BARREL_CAR.get()) + .define('#', Items.BARREL) + .define('$', ModItems.SEATER_CAR.get()) + .pattern(" ") + .pattern(" # ") + .pattern(" $ ") + .unlockedBy("has_item", has(ModItems.SEATER_CAR.get())) + .save(consumer); + ShapedRecipeBuilder.shaped(RecipeCategory.TRANSPORTATION, ModItems.FLUID_CAR.get()) .define('#', Items.GLASS) .define('$', ModItems.SEATER_CAR.get()) From 8b4c0af2d08b3dd9d0b695d6ad20f3204d6a904b Mon Sep 17 00:00:00 2001 From: EDToaster Date: Fri, 13 Oct 2023 00:35:12 -0700 Subject: [PATCH 23/26] Added texture for vacuum bargfe --- .../custom/vessel/barge/VacuumBargeEntity.java | 10 +++++++++- .../textures/entity/barge/vacuum_insert.png | Bin 522 -> 1510 bytes 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java index 9c77fef3..26d0a577 100644 --- a/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java +++ b/src/main/java/dev/murad/shipping/entity/custom/vessel/barge/VacuumBargeEntity.java @@ -60,6 +60,14 @@ public void tick(){ return; } + var level = ((ServerLevel) level()); + + // Render fire particles + level.sendParticles(ParticleTypes.FLAME, + getX(), getY() + 0.85, getZ(), + 6, + 0.1, 0.1, 0.1, 0.0); + // perform item check AABB searchBox = new AABB(getX(), getY(), getZ(), getX(), getY(), getZ()) .inflate(PICK_RADIUS, PICK_HEIGHT / 2.0, PICK_RADIUS); @@ -86,7 +94,7 @@ public void tick(){ if (!initial.equals(leftOver)) { // spawn particles - ((ServerLevel) level()).sendParticles( + level.sendParticles( ParticleTypes.PORTAL, item.getX(), item.getY(), item.getZ(), 15, 0.2, 0.2, 0.2, 0.0); diff --git a/src/main/resources/assets/littlelogistics/textures/entity/barge/vacuum_insert.png b/src/main/resources/assets/littlelogistics/textures/entity/barge/vacuum_insert.png index a14818f73ed144d0ed0213c4695bb47fd997e671..22f8ae6734b1ba880774c40ea1bbbe160c5a7eeb 100644 GIT binary patch literal 1510 zcmdUu_g9m56o&J?KmXL*<}v*}}nW+xPR_rv}vPRiGyY{Ja#@ z$Z;JB;FlG+3O;C60h1OS3r3#^#l2gP>rF-N@dc9^V0<}fivm?5a9oO+S&!|{#DAy< z$T>992#`xSsWXgAeDh7_`BlT?LK?p@0L4CJsUn(fmBORR)l=s2^j& z<1CxGTF@DTd!7#NEdf1ocmxRn*!WZqb>53UT*uxf|mS*xJ2atIpFVo z6BhpgZi^-@4*)yk=UBBI$}wBYP!gqtlTy{@WA76kvs~{N+8Qx|H!;U{8+LaTbYIbG zeLAkybTz(`@72W8yP+cu*V;AB-3NL$wZ3Vco6XG}8ESGUE8KZ;UD*TP2ieG*p0(pc zS!MSGdv!&9HpxxtiQ!*tEt=}NmbNWd+yU;S18Ykg571!#iizUSG^p#x*d^?{i#aI+AunQECYRqhG4V1> zX4RlL^H_KN_&B@bao?H}7ZZssrIIl)Oo=Btp&b#!E^cP)rqCvsG{`3I*l~DU;8kw* z1|mkhvgGbid88>L=X6aGyg~3iiwwcdIo$)m=*S)JsvWNRa=Ud~^M$Id<|-*<)jr2@ zHDx;$HXG!_Ui&xmE^^NLOiN~OWn^#Kr5pJ)TKv#BO+Cm)W7Fvy_YBiLuTbK#M2~VW zv#j9uB@%?U(v!ws4|W!{SVMT@Hq!Yx)&r=wfT5q5@6BwP?Ek80kXn30&3iXH3-Qip z_i<1qr=3V5*G}l3;C8+pH@D7uo5re+%Jh}(r{tB}i(^vW zVxMIuj{IQ#-}iatsWwy9md^#1~r Cdaoz| delta 453 zcmV;$0XqKX3yK7gKu!QWP)t-s2nq@c3=9Sd2?`4g3lI+6A=~`2@Vb?NI5)f zU}BqU7cm}HYh84=YXub?%lzFCBP|FjD*ylhWp15A0000KbW%=JlYs&ge*jNU=Mew^ z010qNS#tmY4#EHc4#EKyC`y0;00B2iL_t(oN9~pYj)Nc&MX93IYOAgHzw7=#4x~*{ znKawYCcFe^3h}`pNpVXi&bbpnsHzH22I-g43|<7aS->f2aC}u*^K1d8i}MOdYXn0H zgfnXzF$uT?O(P}&HnG+;e_|D!G>v?>1a7^ikxT);`+5TEHPLR6Dd2|>2Y^rQ2Bs2H z6hRS?A}9j#Zv?(+&!F|b>pBk*){$I+7eNyQjZM&EW-bA-i8*8(%MxI^xNrfEP{g-3 zaT^izmrKtkJw`+@jMsrpdW?wRHcc~|^ceZPgz$1`{14Z$EL^BRYqZoYWDghW4=r_( z+T*Q+)J1BKx8<5k&=|q{wh}ag)J5vfy6!T(!IL0$k$Mc{I6P!{gM)f|e3;wr0sCzM vO1RFSlrV7 Date: Fri, 13 Oct 2023 00:35:33 -0700 Subject: [PATCH 24/26] Fix #231 --- .../java/dev/murad/shipping/block/rail/JunctionRail.java | 6 ++++++ src/main/java/dev/murad/shipping/block/rail/SwitchRail.java | 5 +++++ .../java/dev/murad/shipping/block/rail/TeeJunctionRail.java | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/src/main/java/dev/murad/shipping/block/rail/JunctionRail.java b/src/main/java/dev/murad/shipping/block/rail/JunctionRail.java index cadd774a..197273f7 100644 --- a/src/main/java/dev/murad/shipping/block/rail/JunctionRail.java +++ b/src/main/java/dev/murad/shipping/block/rail/JunctionRail.java @@ -121,4 +121,10 @@ public RailShape getVanillaRailShapeFromDirection(BlockState state, BlockPos pos public boolean isAutomaticSwitching() { return false; } + + @Deprecated + @Override + public boolean isValidRailShape(RailShape shape) { + return RAIL_SHAPE.getPossibleValues().contains(shape); + } } diff --git a/src/main/java/dev/murad/shipping/block/rail/SwitchRail.java b/src/main/java/dev/murad/shipping/block/rail/SwitchRail.java index 25e7eabe..6416429d 100644 --- a/src/main/java/dev/murad/shipping/block/rail/SwitchRail.java +++ b/src/main/java/dev/murad/shipping/block/rail/SwitchRail.java @@ -224,4 +224,9 @@ public void neighborChanged(BlockState state, Level world, BlockPos pos, Block p public boolean canConnectRedstone(BlockState state, BlockGetter world, BlockPos pos, @javax.annotation.Nullable Direction side) { return true; } + + @Override + public boolean isValidRailShape(RailShape shape) { + return RAIL_SHAPE.getPossibleValues().contains(shape); + } } diff --git a/src/main/java/dev/murad/shipping/block/rail/TeeJunctionRail.java b/src/main/java/dev/murad/shipping/block/rail/TeeJunctionRail.java index cdeb692b..022525df 100644 --- a/src/main/java/dev/murad/shipping/block/rail/TeeJunctionRail.java +++ b/src/main/java/dev/murad/shipping/block/rail/TeeJunctionRail.java @@ -186,4 +186,10 @@ public void neighborChanged(BlockState state, Level world, BlockPos pos, Block p public boolean canConnectRedstone(BlockState state, BlockGetter world, BlockPos pos, @javax.annotation.Nullable Direction side) { return true; } + + @Deprecated + @Override + public boolean isValidRailShape(RailShape shape) { + return RAIL_SHAPE.getPossibleValues().contains(shape); + } } \ No newline at end of file From 3e3435f11ff1197e1a3eef6bc7117543c8a15bae Mon Sep 17 00:00:00 2001 From: EDToaster Date: Fri, 13 Oct 2023 18:19:12 -0700 Subject: [PATCH 25/26] Add patchouli --- .../guide/en_us/categories/cosmetic.json | 5 +++++ .../guide/en_us/categories/trains.json | 2 +- .../guide/en_us/categories/vessels.json | 2 +- .../en_us/entries/energy_locomotive.json | 2 +- .../guide/en_us/entries/vacuum_barge.json | 19 +++++++++++++++++++ .../guide/en_us/entries/wrench.json | 16 ++++++++++++++++ .../patchouli_books/guide/book.json | 2 +- 7 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/cosmetic.json create mode 100644 src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/vacuum_barge.json create mode 100644 src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/wrench.json diff --git a/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/cosmetic.json b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/cosmetic.json new file mode 100644 index 00000000..5fbd1ae2 --- /dev/null +++ b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/cosmetic.json @@ -0,0 +1,5 @@ +{ + "name": "Coloring Vessels and Cars", + "description": "Locomotives, Cars, Tugs, and Barges can be dyed various colors by right clicking on them with dyes.", + "icon": "minecraft:green_dye" +} \ No newline at end of file diff --git a/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/trains.json b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/trains.json index ae15247c..c76a63f1 100644 --- a/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/trains.json +++ b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/trains.json @@ -1,5 +1,5 @@ { "name": "Trains", - "description": "Train cars are similar to minecarts, but can be linked with $(l:spring)Vehicle Chains$(). Each train should have exactly one locomotive.", + "description": "Train cars are similar to minecarts, but can be linked with $(l:spring)Vehicle Chains$(). Connect a locomotive to pull the train along.", "icon": "littlelogistics:steam_locomotive" } \ No newline at end of file diff --git a/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/vessels.json b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/vessels.json index 73047b70..3aab4a13 100644 --- a/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/vessels.json +++ b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/categories/vessels.json @@ -1,5 +1,5 @@ { "name": "Vessels", - "description": "There are two types of vessels: Barges (that can do all sorts of useful things), and Tugs (that drag the barges). If vessels get stuck, they can be moved slightly using fishing rods (just like other entities). Tugs can also be dragged with leads. Be sure to use $(l:vessel_corner_rail)vessel corner rails$() on sharp corner to prevent vessels from getting stuck.", + "description": "There are two types of vessels: Barges (that can do all sorts of useful things), and Tugs (that drag the barges). If vessels get stuck, they can be dragged with leads or pulled by fishing rods. Be sure to use $(l:vessel_corner_rail)vessel corner rails$() on sharp corner to prevent vessels from getting stuck.", "icon": "littlelogistics:tug" } \ No newline at end of file diff --git a/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/energy_locomotive.json b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/energy_locomotive.json index 17e435a2..db8d13b3 100644 --- a/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/energy_locomotive.json +++ b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/energy_locomotive.json @@ -13,7 +13,7 @@ { "type": "patchouli:crafting", "recipe": "littlelogistics:energy_locomotive", - "text": "The locomotive has an extra slot for a capacitor, this is useful if the locomotive ran out of energy mid-way and needs to be recharged." + "text": "The locomotive has an extra slot for an energy item, this is useful if the locomotive ran out of energy mid-way and needs to be recharged." } ] } \ No newline at end of file diff --git a/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/vacuum_barge.json b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/vacuum_barge.json new file mode 100644 index 00000000..2720e54e --- /dev/null +++ b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/vacuum_barge.json @@ -0,0 +1,19 @@ +{ + "name": "Item Collection Barge Barge", + "icon": "littlelogistics:vacuum_barge", + "category": "littlelogistics:vessels", + "pages": [ + { + "type": "patchouli:entity", + "entity": "littlelogistics:vacuum_barge", + "scale": 0.6, + "offset": 0.5, + "text": "Automatically collects items in a radius" + }, + { + "type": "patchouli:crafting", + "recipe": "littlelogistics:vacuum_barge", + "text": "Connect a Chest Barge behind the Item Collection Barge, as the Item Collection Barge does not provide an inventory of its own." + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/wrench.json b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/wrench.json new file mode 100644 index 00000000..df49e36b --- /dev/null +++ b/src/main/resources/assets/littlelogistics/patchouli_books/guide/en_us/entries/wrench.json @@ -0,0 +1,16 @@ +{ + "name": "Conductor's Wrench", + "icon": "littlelogistics:conductors_wrench", + "category": "littlelogistics:items", + "pages": [ + { + "type": "patchouli:crafting", + "recipe": "littlelogistics:conductors_wrench", + "text": "Held in the hand, the Conductor's wrench will display the locations of currently registered locomotives and tugs." + }, + { + "type": "patchouli:text", + "text": "Right clicking any rails will cycle it through various rail shapes." + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/littlelogistics/patchouli_books/guide/book.json b/src/main/resources/data/littlelogistics/patchouli_books/guide/book.json index 23142983..74703d9d 100644 --- a/src/main/resources/data/littlelogistics/patchouli_books/guide/book.json +++ b/src/main/resources/data/littlelogistics/patchouli_books/guide/book.json @@ -1,7 +1,7 @@ { "name": "Little Logistics Guide", "landing_text": "A short tutorial on Little Logistics! Visit the $(l:https://littlelogistics.murad.dev)online guide$() for video instructions.", - "version": 2, + "version": 3, "creative_tab": "transportation", "show_toasts ": false, "show_progress": false, From d43324cca78968f112af45e4b61edf06ba83acea Mon Sep 17 00:00:00 2001 From: EDToaster Date: Sat, 14 Oct 2023 15:19:35 -0700 Subject: [PATCH 26/26] Fixes #242 --- .../shipping/event/ForgeClientEventHandler.java | 12 ++++++------ .../dev/murad/shipping/event/ForgeEventHandler.java | 1 - .../network/client/VehicleTrackerPacketHandler.java | 5 ++++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java b/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java index e3d9c997..b20dad20 100644 --- a/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ForgeClientEventHandler.java @@ -22,8 +22,6 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BeaconRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.core.BlockPos; -import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; @@ -36,16 +34,13 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RenderLevelStageEvent; +import net.minecraftforge.event.level.LevelEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import org.joml.Matrix4f; import org.joml.Vector2d; import javax.annotation.Nullable; -import java.util.List; -import java.util.Optional; import java.util.OptionalDouble; -import java.util.stream.Collectors; /** * Forge-wide event bus @@ -71,6 +66,11 @@ public ModRenderType(String pName, VertexFormat pFormat, VertexFormat.Mode pMode } } + @SubscribeEvent + public static void onWorldUnload(LevelEvent.Unload event) { + VehicleTrackerPacketHandler.flush(); + } + /** * Returns whether we rendered a route here. Empty route also returns true */ diff --git a/src/main/java/dev/murad/shipping/event/ForgeEventHandler.java b/src/main/java/dev/murad/shipping/event/ForgeEventHandler.java index 05a268a3..fb41b210 100644 --- a/src/main/java/dev/murad/shipping/event/ForgeEventHandler.java +++ b/src/main/java/dev/murad/shipping/event/ForgeEventHandler.java @@ -45,7 +45,6 @@ public static void onWorldTick(TickEvent.LevelTickEvent event) { // Don't do anything client side if (event.level instanceof ServerLevel serverLevel) { TrainChunkManagerManager.get(serverLevel.getServer()).getManagers(event.level.dimension()).forEach(PlayerTrainChunkManager::tick); - } } diff --git a/src/main/java/dev/murad/shipping/network/client/VehicleTrackerPacketHandler.java b/src/main/java/dev/murad/shipping/network/client/VehicleTrackerPacketHandler.java index 3cf04497..b1838e79 100644 --- a/src/main/java/dev/murad/shipping/network/client/VehicleTrackerPacketHandler.java +++ b/src/main/java/dev/murad/shipping/network/client/VehicleTrackerPacketHandler.java @@ -32,7 +32,6 @@ public class VehicleTrackerPacketHandler { private static int id = 0; public static void register() { - // int index, Class messageType, BiConsumer encoder, Function decoder, BiConsumer> messageConsumer INSTANCE.registerMessage(id++, VehicleTrackerClientPacket.class, VehicleTrackerClientPacket::encode, VehicleTrackerClientPacket::new, VehicleTrackerPacketHandler::handleData); } @@ -45,4 +44,8 @@ public static void handleData(VehicleTrackerClientPacket packet, Supplier