diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index add14c8f1b..f0ccff0fc4 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -2586,6 +2586,8 @@ "enchantment.gtceu.disjunction.desc": "˙sqoɯ pǝʇɐןǝɹ-ɹǝpuƎ oʇ ssǝuʍoןS puɐ ssǝuʞɐǝM sǝıןddⱯ", "enchantment.gtceu.hard_hammer.desc": "˙ɹǝɯɯɐH ɥɔǝ⟘bǝɹ⅁ ɐ ɥʇıʍ pǝuıɯ ǝɹǝʍ ʎǝɥʇ ɟı sɐ sʞɔoןq sʞɐǝɹᗺ", "enchantment.hard_hammer": "buıɹǝɯɯɐH", + "entity.gtceu.boat": "ʇɐoᗺ", + "entity.gtceu.chest_boat": "ʇɐoᗺ ʇsǝɥƆ", "entity.gtceu.dynamite": "ǝʇıɯɐuʎᗡ", "entity.gtceu.industrial_tnt": "⟘N⟘ ןɐıɹʇsnpuI", "entity.gtceu.powderbarrel": "ןǝɹɹɐqɹǝpʍoԀ", @@ -4716,6 +4718,8 @@ "item.gtceu.rotor_casting_mold.tooltip": "sɹoʇoᴚ buıʞɐɯ ɹoɟ pןoWㄥ§", "item.gtceu.rotor_extruder_mold": ")ɹoʇoᴚ( pןoW ɹǝpnɹʇxƎ", "item.gtceu.rotor_extruder_mold.tooltip": "sɹoʇoᴚ buıʞɐɯ ɹoɟ ǝdɐɥS ɹǝpnɹʇxƎㄥ§", + "item.gtceu.rubber_boat": "ʇɐoᗺ ɹǝqqnᴚ", + "item.gtceu.rubber_chest_boat": "ʇsǝɥƆ ɥʇıʍ ʇɐoᗺ ɹǝqqnᴚ", "item.gtceu.rubber_gloves": "sǝʌoן⅁ ɹǝqqnᴚ", "item.gtceu.salt_dust": "ʇןɐS", "item.gtceu.saw_extruder_mold.tooltip": "sʍɐS buıʞɐɯ ɹoɟ ǝdɐɥS ɹǝpnɹʇxƎㄥ§", @@ -4928,7 +4932,9 @@ "item.gtceu.tool.wrench.tooltip": "sǝuıɥɔɐW ǝןʇuɐɯsıp oʇ ʞɔıןɔ ʇɟǝן pןoH8§", "item.gtceu.transistor": "ɹoʇsısuɐɹ⟘", "item.gtceu.transistor.tooltip": "ʇuǝuodɯoƆ ɔıuoɹʇɔǝןƎ ɔısɐᗺㄥ§", + "item.gtceu.treated_wood_boat": "ʇɐoᗺ pooM pǝʇɐǝɹ⟘", "item.gtceu.treated_wood_bolt": "ʞɔıʇS pooM pǝʇɐǝɹ⟘ ʇɹoɥS", + "item.gtceu.treated_wood_chest_boat": "ʇsǝɥƆ ɥʇıʍ ʇɐoᗺ pooM pǝʇɐǝɹ⟘", "item.gtceu.treated_wood_dust": "dןnԀ pooM pǝʇɐǝɹ⟘", "item.gtceu.treated_wood_plate": "ʞuɐןԀ pooM pǝʇɐǝɹ⟘", "item.gtceu.treated_wood_rod": "ʞɔıʇS pooM pǝʇɐǝɹ⟘", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index 7c1eb46ed9..08b1471817 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -2586,6 +2586,8 @@ "enchantment.gtceu.disjunction.desc": "Applies Weakness and Slowness to Ender-related mobs.", "enchantment.gtceu.hard_hammer.desc": "Breaks blocks as if they were mined with a GregTech Hammer.", "enchantment.hard_hammer": "Hammering", + "entity.gtceu.boat": "Boat", + "entity.gtceu.chest_boat": "Chest Boat", "entity.gtceu.dynamite": "Dynamite", "entity.gtceu.industrial_tnt": "Industrial TNT", "entity.gtceu.powderbarrel": "Powderbarrel", @@ -4716,6 +4718,8 @@ "item.gtceu.rotor_casting_mold.tooltip": "§7Mold for making Rotors", "item.gtceu.rotor_extruder_mold": "Extruder Mold (Rotor)", "item.gtceu.rotor_extruder_mold.tooltip": "§7Extruder Shape for making Rotors", + "item.gtceu.rubber_boat": "Rubber Boat", + "item.gtceu.rubber_chest_boat": "Rubber Boat with Chest", "item.gtceu.rubber_gloves": "Rubber Gloves", "item.gtceu.salt_dust": "Salt", "item.gtceu.saw_extruder_mold.tooltip": "§7Extruder Shape for making Saws", @@ -4928,7 +4932,9 @@ "item.gtceu.tool.wrench.tooltip": "§8Hold left click to dismantle Machines", "item.gtceu.transistor": "Transistor", "item.gtceu.transistor.tooltip": "§7Basic Electronic Component", + "item.gtceu.treated_wood_boat": "Treated Wood Boat", "item.gtceu.treated_wood_bolt": "Short Treated Wood Stick", + "item.gtceu.treated_wood_chest_boat": "Treated Wood Boat with Chest", "item.gtceu.treated_wood_dust": "Treated Wood Pulp", "item.gtceu.treated_wood_plate": "Treated Wood Plank", "item.gtceu.treated_wood_rod": "Treated Wood Stick", diff --git a/src/generated/resources/assets/gtceu/models/item/rubber_boat.json b/src/generated/resources/assets/gtceu/models/item/rubber_boat.json new file mode 100644 index 0000000000..1298fccf6d --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/rubber_boat.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/rubber_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/rubber_chest_boat.json b/src/generated/resources/assets/gtceu/models/item/rubber_chest_boat.json new file mode 100644 index 0000000000..69a0964968 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/rubber_chest_boat.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/rubber_chest_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/treated_wood_boat.json b/src/generated/resources/assets/gtceu/models/item/treated_wood_boat.json new file mode 100644 index 0000000000..2ad82d61dc --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/treated_wood_boat.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/treated_wood_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/treated_wood_chest_boat.json b/src/generated/resources/assets/gtceu/models/item/treated_wood_chest_boat.json new file mode 100644 index 0000000000..c24d335945 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/treated_wood_chest_boat.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/treated_wood_chest_boat" + } +} \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java index c1f7f35e7e..336acbcfc7 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java @@ -8,22 +8,27 @@ import com.gregtechceu.gtceu.api.gui.compass.GTRecipeViewCreator; import com.gregtechceu.gtceu.api.gui.compass.MultiblockAction; import com.gregtechceu.gtceu.client.particle.HazardParticle; +import com.gregtechceu.gtceu.client.renderer.entity.GTBoatRenderer; import com.gregtechceu.gtceu.client.renderer.entity.GTExplosiveRenderer; import com.gregtechceu.gtceu.common.CommonProxy; import com.gregtechceu.gtceu.common.data.GTBlockEntities; import com.gregtechceu.gtceu.common.data.GTEntityTypes; import com.gregtechceu.gtceu.common.data.GTParticleTypes; +import com.gregtechceu.gtceu.common.entity.GTBoat; import com.gregtechceu.gtceu.utils.input.KeyBind; import com.lowdragmc.lowdraglib.gui.compass.CompassManager; import com.lowdragmc.lowdraglib.gui.compass.component.RecipeComponent; +import net.minecraft.client.model.BoatModel; +import net.minecraft.client.model.ChestBoatModel; import net.minecraft.client.renderer.blockentity.HangingSignRenderer; import net.minecraft.client.renderer.blockentity.SignRenderer; import net.minecraft.client.renderer.entity.ThrownItemRenderer; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.event.RegisterGuiOverlaysEvent; import net.minecraftforge.client.event.RegisterKeyMappingsEvent; @@ -64,6 +69,15 @@ public void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRenderers eve event.registerBlockEntityRenderer(GTBlockEntities.GT_SIGN.get(), SignRenderer::new); event.registerBlockEntityRenderer(GTBlockEntities.GT_HANGING_SIGN.get(), HangingSignRenderer::new); + + event.registerEntityRenderer(GTEntityTypes.BOAT.get(), c -> new GTBoatRenderer(c, false)); + event.registerEntityRenderer(GTEntityTypes.CHEST_BOAT.get(), c -> new GTBoatRenderer(c, true)); + + for (var type : GTBoat.BoatType.values()) { + ForgeHooksClient.registerLayerDefinition(GTBoatRenderer.getBoatModelName(type), BoatModel::createBodyModel); + ForgeHooksClient.registerLayerDefinition(GTBoatRenderer.getChestBoatModelName(type), + ChestBoatModel::createBodyModel); + } } @SubscribeEvent diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/entity/GTBoatRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/entity/GTBoatRenderer.java new file mode 100644 index 0000000000..f5b3d71d55 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/entity/GTBoatRenderer.java @@ -0,0 +1,60 @@ +package com.gregtechceu.gtceu.client.renderer.entity; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.common.entity.GTBoat; +import com.gregtechceu.gtceu.common.entity.GTChestBoat; + +import net.minecraft.client.model.BoatModel; +import net.minecraft.client.model.ChestBoatModel; +import net.minecraft.client.model.ListModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.entity.BoatRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.vehicle.Boat; + +import com.google.common.collect.ImmutableMap; +import com.mojang.datafixers.util.Pair; + +import java.util.Map; +import java.util.stream.Stream; + +public class GTBoatRenderer extends BoatRenderer { + + private final Map>> boats; + + public GTBoatRenderer(EntityRendererProvider.Context context, boolean chestBoat) { + super(context, chestBoat); + boats = Stream.of(GTBoat.BoatType.values()).collect(ImmutableMap.toImmutableMap(k -> k, + (m) -> Pair.of(new ResourceLocation(GTCEu.MOD_ID, + getTextureLocation(m, chestBoat)), createBoatModel(context, m, chestBoat)))); + } + + @Override + public Pair> getModelWithLocation(Boat boat) { + if (boat instanceof GTChestBoat gtcb) { + return this.boats.get(gtcb.getBoatType()); + } else + return this.boats.get(((GTBoat) boat).getBoatType()); + } + + private static String getTextureLocation(GTBoat.BoatType type, boolean chest) { + return chest ? "textures/entity/boat/" + type.getName() + "_chest_boat.png" : + "textures/entity/boat/" + type.getName() + "_boat.png"; + } + + private BoatModel createBoatModel(EntityRendererProvider.Context context, GTBoat.BoatType type, boolean chest) { + ModelLayerLocation modelLoc = chest ? getChestBoatModelName(type) : getBoatModelName(type); + ModelPart part = context.bakeLayer(modelLoc); + return chest ? new ChestBoatModel(part) : new BoatModel(part); + } + + public static ModelLayerLocation getChestBoatModelName(GTBoat.BoatType type) { + return new ModelLayerLocation(new ResourceLocation(GTCEu.MOD_ID, "chest_boat/" + type.getName()), "main"); + } + + public static ModelLayerLocation getBoatModelName(GTBoat.BoatType type) { + return new ModelLayerLocation(new ResourceLocation(GTCEu.MOD_ID, "boat/" + type.getName()), "main"); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java index efdfa08f54..3d1c611ff9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java @@ -1298,6 +1298,7 @@ public static ItemColor leavesItemColor() { .tag(ItemTags.WOODEN_FENCES) .build() .register(); + public static final BlockEntry TREATED_WOOD_SIGN = REGISTRATE .block("treated_wood_sign", (p) -> new GTStandingSignBlock(p, TREATED_WOOD_TYPE)) .initialProperties(() -> Blocks.SPRUCE_SIGN) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java index 13a09ffdcf..5a7d473cce 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java @@ -1,8 +1,6 @@ package com.gregtechceu.gtceu.common.data; -import com.gregtechceu.gtceu.common.entity.DynamiteEntity; -import com.gregtechceu.gtceu.common.entity.IndustrialTNTEntity; -import com.gregtechceu.gtceu.common.entity.PowderbarrelEntity; +import com.gregtechceu.gtceu.common.entity.*; import net.minecraft.tags.EntityTypeTags; import net.minecraft.world.entity.MobCategory; @@ -32,5 +30,17 @@ public class GTEntityTypes { .properties(builder -> builder.sized(0.98F, 0.98F).fireImmune().clientTrackingRange(10).updateInterval(10)) .register(); + public static final EntityEntry BOAT = REGISTRATE + .entity("boat", GTBoat::new, MobCategory.MISC) + .lang("Boat") + .properties(builder -> builder.sized(1.375f, 0.5625f).clientTrackingRange(10)) + .register(); + + public static final EntityEntry CHEST_BOAT = REGISTRATE + .entity("chest_boat", GTChestBoat::new, MobCategory.MISC) + .lang("Chest Boat") + .properties(builder -> builder.sized(1.375f, 0.5625f).clientTrackingRange(10)) + .register(); + public static void init() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java index 92ed72be06..167fa50dd5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java @@ -31,6 +31,7 @@ import com.gregtechceu.gtceu.api.registry.registrate.CompassSection; import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; import com.gregtechceu.gtceu.common.data.materials.GTFoods; +import com.gregtechceu.gtceu.common.entity.GTBoat; import com.gregtechceu.gtceu.common.item.*; import com.gregtechceu.gtceu.common.item.armor.*; import com.gregtechceu.gtceu.common.item.tool.behavior.LighterBehavior; @@ -2698,6 +2699,27 @@ public Component getItemName(ItemStack stack) { public static ItemEntry BLACKLIGHT = REGISTRATE.item("blacklight", Item::new) .onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry RUBBER_BOAT = REGISTRATE + .item("rubber_boat", p -> new GTBoatItem(false, GTBoat.BoatType.RUBBER, new Item.Properties())) + .lang("Rubber Boat") + .register(); + + public static ItemEntry TREATED_WOOD_BOAT = REGISTRATE + .item("treated_wood_boat", p -> new GTBoatItem(false, GTBoat.BoatType.TREATED_WOOD, new Item.Properties())) + .lang("Treated Wood Boat") + .register(); + + public static ItemEntry RUBBER_CHEST_BOAT = REGISTRATE + .item("rubber_chest_boat", p -> new GTBoatItem(true, GTBoat.BoatType.RUBBER, new Item.Properties())) + .lang("Rubber Boat with Chest") + .register(); + + public static ItemEntry TREATED_WOOD_CHEST_BOAT = REGISTRATE + .item("treated_wood_chest_boat", + p -> new GTBoatItem(true, GTBoat.BoatType.TREATED_WOOD, new Item.Properties())) + .lang("Treated Wood Boat with Chest") + .register(); + public static void init() { generateMaterialItems(); generateTools(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java index 224eaf27af..1119778619 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java @@ -123,6 +123,7 @@ public static void init() { ingot.setIgnored(Iron, Items.IRON_INGOT); ingot.setIgnored(Gold, Items.GOLD_INGOT); ingot.setIgnored(Copper, Items.COPPER_INGOT); + ingot.setIgnored(Brick, Items.BRICK); ingot.setIgnored(Wax, Items.HONEYCOMB); nugget.setIgnored(Gold, Items.GOLD_NUGGET); diff --git a/src/main/java/com/gregtechceu/gtceu/common/entity/GTBoat.java b/src/main/java/com/gregtechceu/gtceu/common/entity/GTBoat.java new file mode 100644 index 0000000000..6986a26b67 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/entity/GTBoat.java @@ -0,0 +1,123 @@ +package com.gregtechceu.gtceu.common.entity; + +import com.gregtechceu.gtceu.common.data.GTBlocks; +import com.gregtechceu.gtceu.common.data.GTEntityTypes; +import com.gregtechceu.gtceu.common.data.GTItems; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; + +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; + +public class GTBoat extends Boat { + + public GTBoat(EntityType entityType, Level level) { + super(entityType, level); + this.blocksBuilding = true; + } + + public GTBoat(Level level, double x, double y, double z) { + super(GTEntityTypes.BOAT.get(), level); + this.setPos(x, y, z); + this.xo = x; + this.yo = y; + this.zo = z; + } + + @Nullable + @Override + public Component getCustomName() { + return super.getCustomName(); + } + + @Override + public Packet getAddEntityPacket() { + return new ClientboundAddEntityPacket(this); + } + + @Override + protected void addAdditionalSaveData(CompoundTag compound) { + compound.putString("Type", getBoatType().getName()); + } + + @Override + protected void readAdditionalSaveData(CompoundTag compound) { + if (compound.contains("Type")) { + entityData.set(DATA_ID_TYPE, BoatType.byName(compound.getString("Type")).ordinal()); + } + } + + @Override + public Item getDropItem() { + return switch (BoatType.byId(this.entityData.get(DATA_ID_TYPE))) { + case RUBBER -> GTItems.RUBBER_BOAT.get(); + case TREATED_WOOD -> GTItems.TREATED_WOOD_BOAT.get(); + }; + } + + public void setBoatType(BoatType type) { + this.entityData.set(DATA_ID_TYPE, type.ordinal()); + } + + public BoatType getBoatType() { + return BoatType.byId(entityData.get(DATA_ID_TYPE)); + } + + @Override + public void setVariant(Type variant) {} + + @Override + public Type getVariant() { + return Type.OAK; + } + + public enum BoatType { + + RUBBER("rubber", GTBlocks.RUBBER_PLANK.get()), + TREATED_WOOD("treated", GTBlocks.TREATED_WOOD_PLANK.get()); + + private final String name; + private final Block planks; + + private static final BoatType[] VALUES = values(); + + private BoatType(String name, Block planks) { + this.name = name; + this.planks = planks; + } + + public String getName() { + return this.name; + } + + public Block getPlanks() { + return this.planks; + } + + public String toString() { + return this.name; + } + + /** + * Get a boat type by its enum ordinal + */ + public static BoatType byId(int id) { + if (id < 0 || id >= VALUES.length) id = 0; + return VALUES[id]; + } + + public static BoatType byName(String name) { + return Arrays.stream(VALUES).filter(type -> type.getName().equals(name)).findFirst().orElse(VALUES[0]); + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/entity/GTChestBoat.java b/src/main/java/com/gregtechceu/gtceu/common/entity/GTChestBoat.java new file mode 100644 index 0000000000..81825a0b61 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/entity/GTChestBoat.java @@ -0,0 +1,71 @@ +package com.gregtechceu.gtceu.common.entity; + +import com.gregtechceu.gtceu.common.data.GTEntityTypes; +import com.gregtechceu.gtceu.common.data.GTItems; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.vehicle.ChestBoat; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; + +public class GTChestBoat extends ChestBoat { + + public GTChestBoat(EntityType entityType, Level level) { + super(entityType, level); + this.blocksBuilding = true; + } + + public GTChestBoat(Level level, double x, double y, double z) { + super(GTEntityTypes.CHEST_BOAT.get(), level); + this.setPos(x, y, z); + this.xo = x; + this.yo = y; + this.zo = z; + } + + @Override + public Packet getAddEntityPacket() { + return new ClientboundAddEntityPacket(this); + } + + @Override + protected void addAdditionalSaveData(CompoundTag compound) { + compound.putString("Type", getBoatType().getName()); + } + + @Override + protected void readAdditionalSaveData(CompoundTag compound) { + if (compound.contains("Type")) { + entityData.set(DATA_ID_TYPE, GTBoat.BoatType.byName(compound.getString("Type")).ordinal()); + } + } + + @Override + public Item getDropItem() { + return switch (GTBoat.BoatType.byId(this.entityData.get(DATA_ID_TYPE))) { + case RUBBER -> GTItems.RUBBER_CHEST_BOAT.get(); + case TREATED_WOOD -> GTItems.TREATED_WOOD_CHEST_BOAT.get(); + }; + } + + public void setBoatType(GTBoat.BoatType type) { + this.entityData.set(DATA_ID_TYPE, type.ordinal()); + } + + public GTBoat.BoatType getBoatType() { + return GTBoat.BoatType.byId(entityData.get(DATA_ID_TYPE)); + } + + @Override + public void setVariant(Type variant) {} + + @Override + public Type getVariant() { + return Type.OAK; + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItem.java b/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItem.java new file mode 100644 index 0000000000..945cc8a009 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItem.java @@ -0,0 +1,91 @@ +package com.gregtechceu.gtceu.common.item; + +import com.gregtechceu.gtceu.common.entity.GTBoat; +import com.gregtechceu.gtceu.common.entity.GTChestBoat; + +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.entity.vehicle.Boat; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.DispenserBlock; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; + +import java.util.List; +import java.util.function.Predicate; + +public class GTBoatItem extends Item { + + private static final Predicate ENTITY_PREDICATE = EntitySelector.NO_SPECTATORS.and(Entity::isPickable); + private final GTBoat.BoatType type; + private final boolean hasChest; + + public GTBoatItem(boolean hasChest, GTBoat.BoatType type, Item.Properties properties) { + super(properties); + this.hasChest = hasChest; + this.type = type; + DispenserBlock.registerBehavior(this, new GTBoatItemDispenseBehaviour(type, hasChest)); + } + + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + ItemStack itemstack = player.getItemInHand(hand); + HitResult hitresult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.ANY); + if (hitresult.getType() == HitResult.Type.MISS) { + return InteractionResultHolder.pass(itemstack); + } else { + Vec3 vec3 = player.getViewVector(1.0F); + double d0 = 5.0; + List list = level.getEntities(player, + player.getBoundingBox().expandTowards(vec3.scale(5.0)).inflate(1.0), ENTITY_PREDICATE); + if (!list.isEmpty()) { + Vec3 vec31 = player.getEyePosition(); + for (Entity e : list) { + AABB aabb = e.getBoundingBox().inflate((double) e.getPickRadius()); + if (aabb.contains(vec31)) { + return InteractionResultHolder.pass(itemstack); + } + } + } + + if (hitresult.getType() == HitResult.Type.BLOCK) { + Boat boat; + if (hasChest) { + boat = new GTChestBoat(level, hitresult.getLocation().x, hitresult.getLocation().y, + hitresult.getLocation().z); + ((GTChestBoat) boat).setBoatType(type); + } else { + boat = new GTBoat(level, hitresult.getLocation().x, hitresult.getLocation().y, + hitresult.getLocation().z); + ((GTBoat) boat).setBoatType(type); + } + + boat.setYRot(player.getYRot()); + if (!level.noCollision(boat, boat.getBoundingBox())) { + return InteractionResultHolder.fail(itemstack); + } else { + if (!level.isClientSide) { + level.addFreshEntity(boat); + level.gameEvent(player, GameEvent.ENTITY_PLACE, hitresult.getLocation()); + if (!player.getAbilities().instabuild) { + itemstack.shrink(1); + } + } + + player.awardStat(Stats.ITEM_USED.get(this)); + return InteractionResultHolder.sidedSuccess(itemstack, level.isClientSide()); + } + } else { + return InteractionResultHolder.pass(itemstack); + } + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItemDispenseBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItemDispenseBehaviour.java new file mode 100644 index 0000000000..edad373466 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItemDispenseBehaviour.java @@ -0,0 +1,72 @@ +package com.gregtechceu.gtceu.common.item; + +import com.gregtechceu.gtceu.common.entity.GTBoat; +import com.gregtechceu.gtceu.common.entity.GTChestBoat; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.BlockSource; +import net.minecraft.core.Direction; +import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.DispenserBlock; + +public class GTBoatItemDispenseBehaviour extends DefaultDispenseItemBehavior { + + private final DefaultDispenseItemBehavior defaultDispenseItemBehavior = new DefaultDispenseItemBehavior(); + private final GTBoat.BoatType type; + private final boolean isChestBoat; + + public GTBoatItemDispenseBehaviour(GTBoat.BoatType type) { + this(type, false); + } + + public GTBoatItemDispenseBehaviour(GTBoat.BoatType type, boolean isChestBoat) { + this.type = type; + this.isChestBoat = isChestBoat; + } + + public ItemStack execute(BlockSource source, ItemStack stack) { + Direction direction = (Direction) source.getBlockState().getValue(DispenserBlock.FACING); + Level level = source.getLevel(); + double d0 = 0.5625 + (double) EntityType.BOAT.getWidth() / 2.0; + double d1 = source.x() + (double) direction.getStepX() * d0; + double d2 = source.y() + (double) ((float) direction.getStepY() * 1.125F); + double d3 = source.z() + (double) direction.getStepZ() * d0; + BlockPos blockpos = source.getPos().relative(direction); + + Boat boat; + if (isChestBoat) { + boat = new GTChestBoat(level, d0, d1, d2); + ((GTChestBoat) boat).setBoatType(type); + } else { + boat = new GTBoat(level, d0, d1, d2); + ((GTBoat) boat).setBoatType(type); + } + + boat.setYRot(direction.toYRot()); + double d4; + if (((Boat) boat).canBoatInFluid(level.getFluidState(blockpos))) { + d4 = 1.0; + } else { + if (!level.getBlockState(blockpos).isAir() || + !((Boat) boat).canBoatInFluid(level.getFluidState(blockpos.below()))) { + return this.defaultDispenseItemBehavior.dispense(source, stack); + } + + d4 = 0.0; + } + + ((Boat) boat).setPos(d1, d2 + d4, d3); + level.addFreshEntity((Entity) boat); + stack.shrink(1); + return stack; + } + + protected void playSound(BlockSource source) { + source.getLevel().levelEvent(1000, source.getPos(), 0); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java index 82e4334adf..ddab441154 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java @@ -80,6 +80,14 @@ public final class WoodTypeEntry { public final Item chestBoat; @Nullable public final String chestBoatRecipeName; + @Nullable + public final Item sign; + @Nullable + public final String signRecipeName; + @Nullable + public final Item hangingSign; + @Nullable + public final String hangingSignRecipeName; public final Material material; public final boolean addLogOreDict; @@ -115,6 +123,8 @@ private WoodTypeEntry(@NotNull String modid, @NotNull String woodName, @NotNull @Nullable Item stairs, @Nullable String stairsRecipeName, boolean addStairsCraftingRecipe, @Nullable Item boat, @Nullable String boatRecipeName, @Nullable Item chestBoat, @Nullable String chestBoatRecipeName, + @Nullable Item sign, @Nullable String signRecipeName, + @Nullable Item hangingSign, @Nullable String hangingSignRecipeName, @Nullable Material material, boolean addLogOreDict, boolean addPlanksOreDict, boolean addDoorsOreDict, boolean addSlabsOreDict, @@ -153,6 +163,10 @@ private WoodTypeEntry(@NotNull String modid, @NotNull String woodName, @NotNull this.boatRecipeName = boatRecipeName; this.chestBoat = chestBoat; this.chestBoatRecipeName = chestBoatRecipeName; + this.sign = sign; + this.signRecipeName = signRecipeName; + this.hangingSign = hangingSign; + this.hangingSignRecipeName = hangingSignRecipeName; this.material = material != null ? material : GTMaterials.Wood; this.addLogOreDict = addLogOreDict; @@ -219,6 +233,10 @@ public static class Builder { private String boatRecipeName; private Item chestBoat = null; private String chestBoatRecipeName; + private Item sign = null; + private String signRecipeName; + private Item hangingSign = null; + private String hangingSignRecipeName; @Nullable private Material material = null; @@ -462,6 +480,32 @@ public Builder chestBoat(@NotNull Item chestBoat, @Nullable String chestBoatReci return this; } + /** + * Add an entry for a sign + * + * @param sign the sign to add + * @param signRecipeName the recipe name for crafting the sign + * @return this + */ + public Builder sign(@NotNull Item sign, @Nullable String signRecipeName) { + this.sign = sign; + this.signRecipeName = signRecipeName; + return this; + } + + /** + * Add an entry for a sign + * + * @param hangingSign the hanging sign to add + * @param hangingSignRecipeName the recipe name for crafting the hanging sign + * @return this + */ + public Builder hangingSign(@NotNull Item hangingSign, @Nullable String hangingSignRecipeName) { + this.hangingSign = hangingSign; + this.hangingSignRecipeName = hangingSignRecipeName; + return this; + } + /** * Specify material for wood entry. If not provided, {@link GTMaterials#Wood} will be used * @@ -573,6 +617,7 @@ public WoodTypeEntry build() { fence, fenceRecipeName, fenceGate, fenceGateRecipeName, stairs, stairsRecipeName, addStairsCraftingRecipe, boat, boatRecipeName, chestBoat, chestBoatRecipeName, + sign, signRecipeName, hangingSign, hangingSignRecipeName, material, addLogOreDict, addPlanksOreDict, addDoorsOreDict, addSlabsOreDict, addFencesOreDict, addFenceGatesOreDict, addStairsOreDict, addPlanksUnificationInfo, diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java index d5421a05ea..6674b5b159 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java @@ -8,6 +8,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.stack.UnificationEntry; import com.gregtechceu.gtceu.api.data.tag.TagUtil; import com.gregtechceu.gtceu.common.data.GTBlocks; +import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; @@ -65,6 +66,8 @@ private static List getDefaultEntries() { .stairs(Items.OAK_STAIRS, "oak_stairs") .boat(Items.OAK_BOAT, "oak_boat") .chestBoat(Items.OAK_CHEST_BOAT, "oak_chest_boat") + .sign(Items.OAK_SIGN, "oak_sign") + .hangingSign(Items.OAK_HANGING_SIGN, "oak_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "spruce") @@ -81,6 +84,8 @@ private static List getDefaultEntries() { .stairs(Items.SPRUCE_STAIRS, "spruce_stairs") .boat(Items.SPRUCE_BOAT, "spruce_boat") .chestBoat(Items.SPRUCE_CHEST_BOAT, "spruce_chest_boat") + .sign(Items.SPRUCE_SIGN, "spruce_sign") + .hangingSign(Items.SPRUCE_HANGING_SIGN, "spruce_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "birch") @@ -97,6 +102,8 @@ private static List getDefaultEntries() { .stairs(Items.BIRCH_STAIRS, "birch_stairs") .boat(Items.BIRCH_BOAT, "birch_boat") .chestBoat(Items.BIRCH_CHEST_BOAT, "birch_chest_boat") + .sign(Items.BIRCH_SIGN, "birch_sign") + .hangingSign(Items.BIRCH_HANGING_SIGN, "birch_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "jungle") @@ -113,6 +120,8 @@ private static List getDefaultEntries() { .stairs(Items.JUNGLE_STAIRS, "jungle_stairs") .boat(Items.JUNGLE_BOAT, "jungle_boat") .chestBoat(Items.JUNGLE_CHEST_BOAT, "jungle_chest_boat") + .sign(Items.JUNGLE_SIGN, "jungle_sign") + .hangingSign(Items.JUNGLE_HANGING_SIGN, "jungle_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "acacia") @@ -129,6 +138,8 @@ private static List getDefaultEntries() { .stairs(Items.ACACIA_STAIRS, "acacia_stairs") .boat(Items.ACACIA_BOAT, "acacia_boat") .chestBoat(Items.ACACIA_CHEST_BOAT, "acacia_chest_boat") + .sign(Items.ACACIA_SIGN, "acacia_sign") + .hangingSign(Items.ACACIA_HANGING_SIGN, "acacia_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "dark_oak") @@ -145,6 +156,8 @@ private static List getDefaultEntries() { .stairs(Items.DARK_OAK_STAIRS, "dark_oak_stairs") .boat(Items.DARK_OAK_BOAT, "dark_oak_boat") .chestBoat(Items.DARK_OAK_CHEST_BOAT, "dark_oak_chest_boat") + .sign(Items.DARK_OAK_SIGN, "dark_oak_sign") + .hangingSign(Items.DARK_OAK_HANGING_SIGN, "dark_oak_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "bamboo") @@ -160,6 +173,8 @@ private static List getDefaultEntries() { .stairs(Items.BAMBOO_STAIRS, "bamboo_stairs") .boat(Items.BAMBOO_RAFT, "bamboo_raft") .chestBoat(Items.BAMBOO_CHEST_RAFT, "bamboo_chest_raft") + .sign(Items.BAMBOO_SIGN, "bamboo_sign") + .hangingSign(Items.BAMBOO_HANGING_SIGN, "bamboo_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "cherry") @@ -176,6 +191,8 @@ private static List getDefaultEntries() { .stairs(Items.CHERRY_STAIRS, "cherry_stairs") .boat(Items.CHERRY_BOAT, "cherry_boat") .chestBoat(Items.CHERRY_CHEST_BOAT, "cherry_chest_boat") + .sign(Items.CHERRY_SIGN, "cherry_sign") + .hangingSign(Items.CHERRY_HANGING_SIGN, "cherry_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "mangrove") @@ -192,6 +209,8 @@ private static List getDefaultEntries() { .stairs(Items.MANGROVE_STAIRS, "mangrove_stairs") .boat(Items.MANGROVE_BOAT, "mangrove_boat") .chestBoat(Items.MANGROVE_CHEST_BOAT, "mangrove_chest_boat") + .sign(Items.MANGROVE_SIGN, "mangrove_sign") + .hangingSign(Items.MANGROVE_HANGING_SIGN, "mangrove_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "crimson") @@ -207,6 +226,8 @@ private static List getDefaultEntries() { .fence(Items.CRIMSON_FENCE, "crimson_fence") .fenceGate(Items.CRIMSON_FENCE_GATE, "crimson_fence_gate") .stairs(Items.CRIMSON_STAIRS, "crimson_stairs") + .sign(Items.CRIMSON_SIGN, "crimson_sign") + .hangingSign(Items.CRIMSON_HANGING_SIGN, "crimson_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "warped") @@ -222,6 +243,8 @@ private static List getDefaultEntries() { .fence(Items.WARPED_FENCE, "warped_fence") .fenceGate(Items.WARPED_FENCE_GATE, "warped_fence_gate") .stairs(Items.WARPED_STAIRS, "warped_stairs") + .sign(Items.WARPED_SIGN, "warped_sign") + .hangingSign(Items.WARPED_HANGING_SIGN, "warped_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(GTCEu.MOD_ID, "rubber") @@ -231,12 +254,15 @@ private static List getDefaultEntries() { .wood(GTBlocks.RUBBER_WOOD.asItem()) .strippedWood(GTBlocks.STRIPPED_RUBBER_WOOD.asItem()) .door(GTBlocks.RUBBER_DOOR.asItem(), null) - .trapdoor(GTBlocks.RUBBER_TRAPDOOR.asItem(), null) + .trapdoor(GTBlocks.RUBBER_TRAPDOOR.asItem(), "rubber_trapdoor") .slab(GTBlocks.RUBBER_SLAB.asItem(), null).addSlabRecipe() .fence(GTBlocks.RUBBER_FENCE.asItem(), null) .fenceGate(GTBlocks.RUBBER_FENCE_GATE.asItem(), null) .stairs(GTBlocks.RUBBER_STAIRS.asItem(), null).addStairsRecipe() - // .boat(GTItems.RUBBER_BOAT.asItem(), null) // TODO someone forgot boat textures. + .boat(GTItems.RUBBER_BOAT.asItem(), null) + .chestBoat(GTItems.RUBBER_CHEST_BOAT.asItem(), null) + .sign(GTBlocks.RUBBER_SIGN.asItem(), null) + .hangingSign(GTBlocks.RUBBER_HANGING_SIGN.asItem(), null) .generateLogToPlankRecipe(false) // rubber log does not have a tag .registerAllTags() .registerAllUnificationInfo() @@ -249,10 +275,12 @@ private static List getDefaultEntries() { .fence(GTBlocks.TREATED_WOOD_FENCE.asItem(), null) .fenceGate(GTBlocks.TREATED_WOOD_FENCE_GATE.asItem(), null) .stairs(GTBlocks.TREATED_WOOD_STAIRS.asItem(), null).addStairsRecipe() - // .boat(GTItems.TREATED_WOOD_BOAT.asItem(), null) // TODO someone forgot boat textures. + .boat(GTItems.TREATED_WOOD_BOAT.asItem(), null) + .chestBoat(GTItems.TREATED_WOOD_CHEST_BOAT.asItem(), null) + .sign(GTBlocks.TREATED_WOOD_SIGN.asItem(), null) + .hangingSign(GTBlocks.TREATED_WOOD_HANGING_SIGN.asItem(), null) .material(TreatedWood) - .generateLogToPlankRecipe(false) - .registerAllUnificationInfo() + .registerUnificationInfo(false, true, true, true, true, true, true, true) .build()); } return DEFAULT_ENTRIES; @@ -458,6 +486,102 @@ public static void registerWoodTypeRecipe(Consumer provider, @No } } + // sign + if (entry.sign != null && entry.slab != null) { + final boolean hasSignRecipe = entry.signRecipeName != null; + String recipeName = hasSignRecipe ? entry.signRecipeName : name + "_sign"; + if (ConfigHolder.INSTANCE.recipes.hardWoodRecipes) { + VanillaRecipeHelper.addShapedRecipe(provider, recipeName + "_iron", new ItemStack(entry.sign), + "LLL", "rPr", "sSd", + 'P', entry.planks, + 'r', new UnificationEntry(screw, Iron), + 'L', entry.slab, + 'S', entry.getStick()); + + // plank -> sign assembling + ASSEMBLER_RECIPES.recipeBuilder(recipeName + "_iron") + .circuitMeta(4) + .inputItems(new ItemStack(entry.slab, 1)) + .inputItems(entry.getStick(), 1) + .inputFluids(Iron.getFluid(GTValues.L / 9)) + .outputItems(entry.sign, 3) + .duration(200).EUt(4).save(provider); + + VanillaRecipeHelper.addShapedRecipe(provider, recipeName + "_steel", new ItemStack(entry.sign, 2), + "LLL", "rPr", "sSd", + 'P', entry.planks, + 'r', new UnificationEntry(screw, Steel), + 'L', entry.slab, + 'S', entry.getStick()); + + // plank -> sign assembling + ASSEMBLER_RECIPES.recipeBuilder(recipeName + "_steel") + .circuitMeta(4) + .inputItems(new ItemStack(entry.slab, 1)) + .inputItems(entry.getStick(), 1) + .inputFluids(Steel.getFluid(GTValues.L / 9)) + .outputItems(entry.sign, 5) + .duration(200).EUt(4).save(provider); + } else { + VanillaRecipeHelper.addShapedRecipe(provider, recipeName, new ItemStack(entry.sign, 3), + "PPP", "PPP", " s ", + 'P', entry.planks, + 's', entry.getStick()); + } + + if (entry.hangingSign != null) { + final boolean hasHangingSignRecipe = entry.hangingSignRecipeName != null; + String recipeNameHanging = hasHangingSignRecipe ? entry.hangingSignRecipeName : name + "_hanging_sign"; + ASSEMBLER_RECIPES.recipeBuilder(recipeNameHanging) + .inputItems(entry.sign) + .inputItems(ring, Iron, 2) + .inputItems(Items.CHAIN, 2) + .circuitMeta(5) + .duration(150) + .EUt(4) + .save(provider); + } + } + + // trapdoor + if (entry.trapdoor != null) { + final boolean hasTrapdoorRecipe = entry.trapdoorRecipeName != null; + String recipeName = hasTrapdoorRecipe ? entry.trapdoorRecipeName : name + "_trapdoor"; + if (ConfigHolder.INSTANCE.recipes.hardWoodRecipes) { + VanillaRecipeHelper.addShapedRecipe(provider, recipeName + "_iron", new ItemStack(entry.trapdoor), + "bPS", "PdP", "SPb", + 'P', entry.planks, + 'b', new UnificationEntry(bolt, Iron), + 'S', entry.getStick()); + + // plank -> trapdoor assembling + ASSEMBLER_RECIPES.recipeBuilder(recipeName + "_iron") + .circuitMeta(3) + .inputItems(new ItemStack(entry.planks, 2)) + .inputFluids(Iron.getFluid(GTValues.L / 9)) + .outputItems(entry.trapdoor) + .duration(200).EUt(4).save(provider); + + VanillaRecipeHelper.addShapedRecipe(provider, recipeName + "_steel", new ItemStack(entry.trapdoor, 2), + "bPS", "PdP", "SPb", + 'P', entry.planks, + 'b', new UnificationEntry(bolt, Steel), + 'S', entry.getStick()); + + // plank -> trapdoor assembling + ASSEMBLER_RECIPES.recipeBuilder(recipeName + "_steel") + .circuitMeta(3) + .inputItems(new ItemStack(entry.planks, 2)) + .inputFluids(Steel.getFluid(GTValues.L / 9)) + .outputItems(entry.trapdoor, 2) + .duration(200).EUt(4).save(provider); + } else { + VanillaRecipeHelper.addShapedRecipe(provider, recipeName, new ItemStack(entry.trapdoor, 2), + "PPP", "PPP", + 'P', entry.planks); + } + } + // stairs if (entry.stairs != null) { final boolean hasStairRecipe = entry.stairsRecipeName != null; @@ -592,29 +716,24 @@ public static void registerWoodTypeRecipe(Consumer provider, @No // chest boat if (entry.chestBoat != null) { final boolean hasChestBoatRecipe = entry.chestBoatRecipeName != null; + String recipeName = hasChestBoatRecipe ? entry.chestBoatRecipeName : name + "_chest_boat"; if (ConfigHolder.INSTANCE.recipes.hardWoodRecipes) { - if (entry.boat != null) { - - VanillaRecipeHelper.addShapedRecipe(provider, - hasChestBoatRecipe ? entry.chestBoatRecipeName : name + "_chest_boat", - new ItemStack(entry.chestBoat), - " B ", "SCS", " w ", - 'B', entry.boat, - 'S', new UnificationEntry(bolt, Wood), - 'C', Tags.Items.CHESTS_WOODEN); - } + VanillaRecipeHelper.addShapedRecipe(provider, recipeName, + new ItemStack(entry.chestBoat), + " B ", "SCS", " w ", + 'B', entry.boat, + 'S', new UnificationEntry(bolt, Wood), + 'C', Tags.Items.CHESTS_WOODEN); } else { - if (!hasChestBoatRecipe) { - VanillaRecipeHelper.addShapelessRecipe(provider, name + "_chest_boat", - new ItemStack(entry.chestBoat), - entry.boat, Tags.Items.CHESTS); - } + VanillaRecipeHelper.addShapelessRecipe(provider, recipeName, + new ItemStack(entry.chestBoat), + entry.boat, Tags.Items.CHESTS_WOODEN); } - // plank -> boat assembling + // boat -> chest boat assembling ASSEMBLER_RECIPES.recipeBuilder(name + "_chest_boat") .inputItems(new ItemStack(entry.boat)) - .inputItems(Tags.Items.CHESTS) + .inputItems(Tags.Items.CHESTS_WOODEN) .outputItems(entry.chestBoat) .circuitMeta(16) .duration(100).EUt(4).save(provider); diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 6131827e9f..e416b85be7 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -20,6 +20,8 @@ public net.minecraft.world.entity.item.ItemEntity f_31986_ # pickupDelay public net.minecraft.server.network.ServerGamePacketListenerImpl f_9737_ # aboveGroundTickCount public net.minecraft.world.entity.Entity m_20115_(IZ)V # setSharedFlag +public net.minecraft.world.entity.vehicle.Boat f_38285_ # DATA_ID_TYPE + # for AE2 to be able to load (idk why but it needs these?) public net.minecraft.world.level.block.Blocks m_50774_(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Z # always public net.minecraft.world.level.block.Blocks m_50805_(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Z # never diff --git a/src/main/resources/assets/gtceu/textures/entity/boat/rubber_boat.png b/src/main/resources/assets/gtceu/textures/entity/boat/rubber_boat.png new file mode 100644 index 0000000000..97e9a65ef9 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/entity/boat/rubber_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/entity/boat/rubber_chest_boat.png b/src/main/resources/assets/gtceu/textures/entity/boat/rubber_chest_boat.png new file mode 100644 index 0000000000..443a3f0f94 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/entity/boat/rubber_chest_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/entity/boat/treated_boat.png b/src/main/resources/assets/gtceu/textures/entity/boat/treated_boat.png new file mode 100644 index 0000000000..b599ef2a56 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/entity/boat/treated_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/entity/boat/treated_chest_boat.png b/src/main/resources/assets/gtceu/textures/entity/boat/treated_chest_boat.png new file mode 100644 index 0000000000..f3a00cba8f Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/entity/boat/treated_chest_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/rubber_boat.png b/src/main/resources/assets/gtceu/textures/item/rubber_boat.png new file mode 100644 index 0000000000..d2998da345 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/rubber_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/rubber_chest_boat.png b/src/main/resources/assets/gtceu/textures/item/rubber_chest_boat.png new file mode 100644 index 0000000000..bfceb351ba Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/rubber_chest_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/treated_wood_boat.png b/src/main/resources/assets/gtceu/textures/item/treated_wood_boat.png new file mode 100644 index 0000000000..94bc2aeef7 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/treated_wood_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/treated_wood_chest_boat.png b/src/main/resources/assets/gtceu/textures/item/treated_wood_chest_boat.png new file mode 100644 index 0000000000..8ca8ead5ee Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/treated_wood_chest_boat.png differ