From e5bc55695709ec8d1cd9810d309cc78002628ef5 Mon Sep 17 00:00:00 2001 From: TBPig <147127248+TBPig@users.noreply.github.com> Date: Mon, 15 Dec 2025 22:46:47 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=AF=E8=B0=83?= =?UTF-8?q?=E5=BC=8F=E8=83=BD=E9=87=8F=E8=BD=AC=E6=8D=A2=E5=99=A8=E7=9A=84?= =?UTF-8?q?=E6=9D=90=E8=B4=A8=E3=80=81=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../block/AdjustablePowerConverterBlock.java | 19 ++++-- .../AdjustablePowerConverterBlockEntity.java | 8 +++ .../client/AnvilCraftPigsPlusClient.java | 3 +- .../RegisterAdditionalEventListener.java | 1 + .../AdjustablePowerConverterRenderer.java | 32 +++++++++ .../pigsplus/init/AddonBlockEntities.java | 2 + .../adjustable_power_converter.json | 2 +- .../block/adjustable_power_converter.json | 43 +++++++++--- .../adjustable_power_converter_core.json | 23 +++++++ .../adjustable_power_converter_frame.json | 63 ++++++++++++++++++ .../adjustable_power_converter_frame.png | Bin 98 -> 198 bytes 11 files changed, 180 insertions(+), 16 deletions(-) create mode 100644 src/main/java/dev/anvilcraft/pigsplus/client/renderer/blockentity/AdjustablePowerConverterRenderer.java create mode 100644 src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter_core.json create mode 100644 src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter_frame.json diff --git a/src/main/java/dev/anvilcraft/pigsplus/block/AdjustablePowerConverterBlock.java b/src/main/java/dev/anvilcraft/pigsplus/block/AdjustablePowerConverterBlock.java index 77520e8..7b058bf 100644 --- a/src/main/java/dev/anvilcraft/pigsplus/block/AdjustablePowerConverterBlock.java +++ b/src/main/java/dev/anvilcraft/pigsplus/block/AdjustablePowerConverterBlock.java @@ -35,8 +35,8 @@ public class AdjustablePowerConverterBlock extends BetterBaseEntityBlock impleme public AdjustablePowerConverterBlock(Properties properties) { super(properties); this.registerDefaultState(this.stateDefinition.any() - .setValue(POWERED, false) - .setValue(OVERLOAD, true)); + .setValue(POWERED, false) + .setValue(OVERLOAD, true)); } @Override @@ -64,14 +64,23 @@ public InteractionResult use( } return InteractionResult.SUCCESS; } + @Nullable @Override public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { if (level.isClientSide) { - return null; + return createTickerHelper( + type, + AddonBlockEntities.ADJUSTABLE_POWER_CONVERTER.get(), + (level1, blockPos, blockState, blockEntity) -> blockEntity.clientTick() + ); + } else { + return createTickerHelper( + type, + AddonBlockEntities.ADJUSTABLE_POWER_CONVERTER.get(), + (level1, blockPos, blockState, blockEntity) -> blockEntity.tick() + ); } - return createTickerHelper(type, AddonBlockEntities.ADJUSTABLE_POWER_CONVERTER.get(), - (level1, blockPos, blockState, blockEntity) -> blockEntity.tick()); } @Override diff --git a/src/main/java/dev/anvilcraft/pigsplus/block/entity/AdjustablePowerConverterBlockEntity.java b/src/main/java/dev/anvilcraft/pigsplus/block/entity/AdjustablePowerConverterBlockEntity.java index d9f9355..3b1b302 100644 --- a/src/main/java/dev/anvilcraft/pigsplus/block/entity/AdjustablePowerConverterBlockEntity.java +++ b/src/main/java/dev/anvilcraft/pigsplus/block/entity/AdjustablePowerConverterBlockEntity.java @@ -32,6 +32,10 @@ public class AdjustablePowerConverterBlockEntity extends BlockEntity @Setter private int powerTarget = 16; + @Getter + private float rotation = 0; + public static final float ROTATION_PER_POWER = 0.00122f; + public final EnergyStorage feEnergy = new EnergyStorage(128000000); public AdjustablePowerConverterBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState) { @@ -88,11 +92,15 @@ public int getInputPower() { public PowerComponentType getComponentType() { return this.power >= 0 ? PowerComponentType.PRODUCER : PowerComponentType.CONSUMER; } + @Override public int getRange() { return 2; } + public void clientTick() { + rotation += getServerPower() * ROTATION_PER_POWER; + } public void tick() { if (level == null || level.isClientSide()) return; diff --git a/src/main/java/dev/anvilcraft/pigsplus/client/AnvilCraftPigsPlusClient.java b/src/main/java/dev/anvilcraft/pigsplus/client/AnvilCraftPigsPlusClient.java index 6c3c553..725ef26 100644 --- a/src/main/java/dev/anvilcraft/pigsplus/client/AnvilCraftPigsPlusClient.java +++ b/src/main/java/dev/anvilcraft/pigsplus/client/AnvilCraftPigsPlusClient.java @@ -5,10 +5,9 @@ import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; -import org.jetbrains.annotations.NotNull; @Mod(value = AnvilCraftPigsPlus.MOD_ID, dist = Dist.CLIENT) public class AnvilCraftPigsPlusClient { - public AnvilCraftPigsPlusClient(@NotNull IEventBus modBus, @NotNull ModContainer container) { + public AnvilCraftPigsPlusClient(IEventBus modBus, ModContainer container) { } } diff --git a/src/main/java/dev/anvilcraft/pigsplus/client/event/RegisterAdditionalEventListener.java b/src/main/java/dev/anvilcraft/pigsplus/client/event/RegisterAdditionalEventListener.java index d998034..a1abb41 100644 --- a/src/main/java/dev/anvilcraft/pigsplus/client/event/RegisterAdditionalEventListener.java +++ b/src/main/java/dev/anvilcraft/pigsplus/client/event/RegisterAdditionalEventListener.java @@ -15,5 +15,6 @@ public class RegisterAdditionalEventListener { @SubscribeEvent public static void registerModels(ModelEvent.RegisterAdditional event) { event.register(ModelResourceLocation.standalone(AnvilCraftPigsPlus.of("block/enchanted_generator_head"))); + event.register(ModelResourceLocation.standalone(AnvilCraftPigsPlus.of("block/adjustable_power_converter_core"))); } } diff --git a/src/main/java/dev/anvilcraft/pigsplus/client/renderer/blockentity/AdjustablePowerConverterRenderer.java b/src/main/java/dev/anvilcraft/pigsplus/client/renderer/blockentity/AdjustablePowerConverterRenderer.java new file mode 100644 index 0000000..b30bb2b --- /dev/null +++ b/src/main/java/dev/anvilcraft/pigsplus/client/renderer/blockentity/AdjustablePowerConverterRenderer.java @@ -0,0 +1,32 @@ +package dev.anvilcraft.pigsplus.client.renderer.blockentity; + +import dev.anvilcraft.pigsplus.AnvilCraftPigsPlus; +import dev.anvilcraft.pigsplus.block.entity.AdjustablePowerConverterBlockEntity; +import dev.dubhe.anvilcraft.client.renderer.blockentity.PowerProducerRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.resources.model.ModelResourceLocation; + +import static dev.anvilcraft.pigsplus.block.entity.AdjustablePowerConverterBlockEntity.ROTATION_PER_POWER; + +public class AdjustablePowerConverterRenderer extends PowerProducerRenderer { + public static final ModelResourceLocation MODEL = ModelResourceLocation.standalone( + AnvilCraftPigsPlus.of("block/adjustable_power_converter_core") + ); + public AdjustablePowerConverterRenderer(BlockEntityRendererProvider.Context context) { + } + + @Override + protected float elevation() { + return 0.5f; + } + + @Override + protected float rotation(AdjustablePowerConverterBlockEntity blockEntity, float partialTick) { + return blockEntity.getRotation() + blockEntity.getServerPower() * ROTATION_PER_POWER * partialTick; + } + + @Override + protected ModelResourceLocation getModel() { + return MODEL; + } +} diff --git a/src/main/java/dev/anvilcraft/pigsplus/init/AddonBlockEntities.java b/src/main/java/dev/anvilcraft/pigsplus/init/AddonBlockEntities.java index 8307585..7d3c7ab 100644 --- a/src/main/java/dev/anvilcraft/pigsplus/init/AddonBlockEntities.java +++ b/src/main/java/dev/anvilcraft/pigsplus/init/AddonBlockEntities.java @@ -9,6 +9,7 @@ import dev.anvilcraft.pigsplus.block.entity.EnchantedGeneratorBlockEntity; import dev.anvilcraft.pigsplus.block.entity.AdjustablePowerConverterBlockEntity; import dev.anvilcraft.pigsplus.block.entity.SculkExtractorBlockEntity; +import dev.anvilcraft.pigsplus.client.renderer.blockentity.AdjustablePowerConverterRenderer; import dev.anvilcraft.pigsplus.client.renderer.blockentity.EnchantedGeneratorRenderer; import dev.anvilcraft.pigsplus.client.renderer.blockentity.ElectricEnchantingTableRenderer; @@ -55,6 +56,7 @@ public class AddonBlockEntities { public static final BlockEntityEntry ADJUSTABLE_POWER_CONVERTER = REGISTRATE.blockEntity("adjustable_power_converter", AdjustablePowerConverterBlockEntity::new) .validBlock(AddonBlocks.ADJUSTABLE_POWER_CONVERTER) + .renderer(() -> AdjustablePowerConverterRenderer::new) .register(); public static void register() { diff --git a/src/main/resources/assets/anvilcraft_pigsplus/blockstates/adjustable_power_converter.json b/src/main/resources/assets/anvilcraft_pigsplus/blockstates/adjustable_power_converter.json index 59aa4e3..93d10d2 100644 --- a/src/main/resources/assets/anvilcraft_pigsplus/blockstates/adjustable_power_converter.json +++ b/src/main/resources/assets/anvilcraft_pigsplus/blockstates/adjustable_power_converter.json @@ -1,7 +1,7 @@ { "variants": { "": { - "model": "anvilcraft_pigsplus:block/adjustable_power_converter" + "model": "anvilcraft_pigsplus:block/adjustable_power_converter_frame" } } } \ No newline at end of file diff --git a/src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter.json b/src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter.json index 12eaec3..6e869a8 100644 --- a/src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter.json +++ b/src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter.json @@ -1,4 +1,5 @@ { + "format_version": "1.9.0", "credit": "Made with Blockbench", "parent": "minecraft:block/cube", "render_type": "minecraft:cutout", @@ -21,16 +22,42 @@ } }, { - "from": [0.01, 15.99, 0.01], - "to": [15.99, 0.01, 15.99], + "from": [3, 3, 16], + "to": [13, 13, 0], "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, "faces": { - "north": {"uv": [0, 0, 15.98, 16], "texture": "#0"}, - "east": {"uv": [0, 0, 15.98, 16], "texture": "#0"}, - "south": {"uv": [0, 0, 15.98, 16], "texture": "#0"}, - "west": {"uv": [0, 0, 15.98, 16], "texture": "#0"}, - "up": {"uv": [0, 0, 15.98, 15.98], "texture": "#0"}, - "down": {"uv": [0, 0, 15.98, 15.98], "texture": "#0"} + "north": {"uv": [3, 3, 13, 13], "texture": "#0"}, + "east": {"uv": [0, 3, 16, 13], "texture": "#0"}, + "south": {"uv": [3, 3, 13, 13], "texture": "#0"}, + "west": {"uv": [0, 3, 16, 13], "texture": "#0"}, + "up": {"uv": [3, 0, 13, 16], "texture": "#0"}, + "down": {"uv": [3, 0, 13, 16], "texture": "#0"} + } + }, + { + "from": [16, 3, 3], + "to": [0, 13, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "north": {"uv": [0, 3, 16, 13], "texture": "#0"}, + "east": {"uv": [3, 3, 13, 13], "texture": "#0"}, + "south": {"uv": [0, 3, 16, 13], "texture": "#0"}, + "west": {"uv": [3, 3, 13, 13], "texture": "#0"}, + "up": {"uv": [3, 0, 13, 16], "rotation": 90, "texture": "#0"}, + "down": {"uv": [3, 0, 13, 16], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [3, 16, 3], + "to": [13, 0, 13], + "rotation": {"angle": 0, "axis": "z", "origin": [8, 8, 8]}, + "faces": { + "north": {"uv": [0, 3, 16, 13], "rotation": 270, "texture": "#0"}, + "east": {"uv": [3, 0, 13, 16], "rotation": 180, "texture": "#0"}, + "south": {"uv": [0, 3, 16, 13], "rotation": 90, "texture": "#0"}, + "west": {"uv": [3, 0, 13, 16], "texture": "#0"}, + "up": {"uv": [3, 3, 13, 13], "rotation": 90, "texture": "#0"}, + "down": {"uv": [3, 3, 13, 13], "rotation": 90, "texture": "#0"} } }, { diff --git a/src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter_core.json b/src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter_core.json new file mode 100644 index 0000000..fd44f2d --- /dev/null +++ b/src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter_core.json @@ -0,0 +1,23 @@ +{ + "format_version": "1.9.0", + "credit": "Made with Blockbench", + "parent": "minecraft:block/cube", + "textures": { + "1": "anvilcraft_pigsplus:block/adjustable_power_converter_core", + "particle": "anvilcraft_pigsplus:block/adjustable_power_converter_core" + }, + "elements": [ + { + "from": [-4, -4, -4], + "to": [4, 4, 4], + "faces": { + "north": {"uv": [0, 0, 8, 8], "texture": "#1"}, + "east": {"uv": [0, 0, 8, 8], "texture": "#1"}, + "south": {"uv": [0, 0, 8, 8], "texture": "#1"}, + "west": {"uv": [0, 0, 8, 8], "texture": "#1"}, + "up": {"uv": [0, 0, 8, 8], "texture": "#1"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#1"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter_frame.json b/src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter_frame.json new file mode 100644 index 0000000..0bdda00 --- /dev/null +++ b/src/main/resources/assets/anvilcraft_pigsplus/models/block/adjustable_power_converter_frame.json @@ -0,0 +1,63 @@ +{ + "format_version": "1.9.0", + "credit": "Made with Blockbench", + "parent": "minecraft:block/cube", + "render_type": "minecraft:cutout", + "textures": { + "0": "anvilcraft_pigsplus:block/adjustable_power_converter_frame", + "particle": "anvilcraft_pigsplus:block/adjustable_power_converter_frame" + }, + "elements": [ + { + "from": [3, 16, 3], + "to": [13, 0, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "north": {"uv": [0, 3, 16, 13], "rotation": 270, "texture": "#0"}, + "east": {"uv": [3, 0, 13, 16], "rotation": 180, "texture": "#0"}, + "south": {"uv": [0, 3, 16, 13], "rotation": 90, "texture": "#0"}, + "west": {"uv": [3, 0, 13, 16], "texture": "#0"}, + "up": {"uv": [3, 3, 13, 13], "rotation": 90, "texture": "#0"}, + "down": {"uv": [3, 3, 13, 13], "rotation": 90, "texture": "#0"} + } + }, + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#0"} + } + }, + { + "from": [3, 3, 16], + "to": [13, 13, 0], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "north": {"uv": [3, 3, 13, 13], "texture": "#0"}, + "east": {"uv": [0, 3, 16, 13], "texture": "#0"}, + "south": {"uv": [3, 3, 13, 13], "texture": "#0"}, + "west": {"uv": [0, 3, 16, 13], "texture": "#0"}, + "up": {"uv": [3, 0, 13, 16], "texture": "#0"}, + "down": {"uv": [3, 0, 13, 16], "texture": "#0"} + } + }, + { + "from": [16, 3, 3], + "to": [0, 13, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "north": {"uv": [0, 3, 16, 13], "texture": "#0"}, + "east": {"uv": [3, 3, 13, 13], "texture": "#0"}, + "south": {"uv": [0, 3, 16, 13], "texture": "#0"}, + "west": {"uv": [3, 3, 13, 13], "texture": "#0"}, + "up": {"uv": [3, 0, 13, 16], "rotation": 90, "texture": "#0"}, + "down": {"uv": [3, 0, 13, 16], "rotation": 270, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/anvilcraft_pigsplus/textures/block/adjustable_power_converter_frame.png b/src/main/resources/assets/anvilcraft_pigsplus/textures/block/adjustable_power_converter_frame.png index 99dbc81b9e43961a3fa3413474316527174fe4b9..cd2fd3329561029930269a09ac969815cd1824d0 100644 GIT binary patch delta 169 zcmV;a09OBE#sQEde|t$pK~#90?32q0fG`X|qXtiQg^u7Doyh?_IFn;ILhqjHNf3Yi zkV9z$UV89BLn(bBfdto4p5SOV4IK7PhC9A-zK^mGO)rx2u^6C^O`swlaySQR*j6lE>b1pom5BmZzwGt~e900v1!K~w_( X9J?pG>U;qM7S3j3^P6 Date: Tue, 16 Dec 2025 13:17:38 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=AF=E8=B0=83?= =?UTF-8?q?=E5=BC=8F=E8=83=BD=E9=87=8F=E8=BD=AC=E6=8D=A2=E5=99=A8=E7=9A=84?= =?UTF-8?q?=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../block/entity/AdjustablePowerConverterBlockEntity.java | 6 ++---- .../blockentity/AdjustablePowerConverterRenderer.java | 7 +------ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/dev/anvilcraft/pigsplus/block/entity/AdjustablePowerConverterBlockEntity.java b/src/main/java/dev/anvilcraft/pigsplus/block/entity/AdjustablePowerConverterBlockEntity.java index 3b1b302..eeec6fd 100644 --- a/src/main/java/dev/anvilcraft/pigsplus/block/entity/AdjustablePowerConverterBlockEntity.java +++ b/src/main/java/dev/anvilcraft/pigsplus/block/entity/AdjustablePowerConverterBlockEntity.java @@ -32,9 +32,7 @@ public class AdjustablePowerConverterBlockEntity extends BlockEntity @Setter private int powerTarget = 16; - @Getter - private float rotation = 0; - public static final float ROTATION_PER_POWER = 0.00122f; + private int time = 0; public final EnergyStorage feEnergy = new EnergyStorage(128000000); @@ -99,7 +97,7 @@ public int getRange() { } public void clientTick() { - rotation += getServerPower() * ROTATION_PER_POWER; + time += 1; } public void tick() { diff --git a/src/main/java/dev/anvilcraft/pigsplus/client/renderer/blockentity/AdjustablePowerConverterRenderer.java b/src/main/java/dev/anvilcraft/pigsplus/client/renderer/blockentity/AdjustablePowerConverterRenderer.java index b30bb2b..6d8ff21 100644 --- a/src/main/java/dev/anvilcraft/pigsplus/client/renderer/blockentity/AdjustablePowerConverterRenderer.java +++ b/src/main/java/dev/anvilcraft/pigsplus/client/renderer/blockentity/AdjustablePowerConverterRenderer.java @@ -6,12 +6,11 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.resources.model.ModelResourceLocation; -import static dev.anvilcraft.pigsplus.block.entity.AdjustablePowerConverterBlockEntity.ROTATION_PER_POWER; - public class AdjustablePowerConverterRenderer extends PowerProducerRenderer { public static final ModelResourceLocation MODEL = ModelResourceLocation.standalone( AnvilCraftPigsPlus.of("block/adjustable_power_converter_core") ); + public AdjustablePowerConverterRenderer(BlockEntityRendererProvider.Context context) { } @@ -20,10 +19,6 @@ protected float elevation() { return 0.5f; } - @Override - protected float rotation(AdjustablePowerConverterBlockEntity blockEntity, float partialTick) { - return blockEntity.getRotation() + blockEntity.getServerPower() * ROTATION_PER_POWER * partialTick; - } @Override protected ModelResourceLocation getModel() { From daf2b407282c231ee23c692786033f38a81bc84b Mon Sep 17 00:00:00 2001 From: TBPig <147127248+TBPig@users.noreply.github.com> Date: Tue, 16 Dec 2025 20:21:46 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BF=9E=E9=94=81?= =?UTF-8?q?=E9=94=BB=E9=80=A0=E5=8F=B0=E3=80=81=E7=81=B5=E5=AA=92=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E6=9D=90=E8=B4=A8=EF=BC=9B=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=99=84=E9=AD=94=E5=8F=91=E7=94=B5=E6=9C=BA=E7=9A=84=E7=89=A9?= =?UTF-8?q?=E5=93=81=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/block/chain_smithing_table.json | 10 +++---- .../models/block/enchanted_generator.json | 25 +++++++++++------- .../block/chain_smithing_table_front.png | Bin 0 -> 554 bytes .../block/chain_smithing_table_side.png | Bin 0 -> 516 bytes .../block/chain_smithing_table_top.png | Bin 928 -> 237 bytes .../textures/item/spiritual_component.png | Bin 978 -> 1079 bytes 6 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 src/main/resources/assets/anvilcraft_pigsplus/textures/block/chain_smithing_table_front.png create mode 100644 src/main/resources/assets/anvilcraft_pigsplus/textures/block/chain_smithing_table_side.png diff --git a/src/main/resources/assets/anvilcraft_pigsplus/models/block/chain_smithing_table.json b/src/main/resources/assets/anvilcraft_pigsplus/models/block/chain_smithing_table.json index 544effc..2287c25 100644 --- a/src/main/resources/assets/anvilcraft_pigsplus/models/block/chain_smithing_table.json +++ b/src/main/resources/assets/anvilcraft_pigsplus/models/block/chain_smithing_table.json @@ -1,12 +1,12 @@ { - "credit": "Made by XeKr with Blockbench", + "credit": "Made with Blockbench", "parent": "minecraft:block/cube", "textures": { - "down": "anvilcraft:block/royal_smithing_table_bottom", - "particle": "anvilcraft:block/royal_smithing_table_front", - "south": "anvilcraft:block/royal_smithing_table_front", + "down": "anvilcraft_pigsplus:block/chain_smithing_table_bottom", + "particle": "anvilcraft_pigsplus:block/chain_smithing_table_front", + "south": "anvilcraft_pigsplus:block/chain_smithing_table_front", "up": "anvilcraft_pigsplus:block/chain_smithing_table_top", - "west": "anvilcraft:block/royal_smithing_table_side" + "west": "anvilcraft_pigsplus:block/chain_smithing_table_side" }, "elements": [ { diff --git a/src/main/resources/assets/anvilcraft_pigsplus/models/block/enchanted_generator.json b/src/main/resources/assets/anvilcraft_pigsplus/models/block/enchanted_generator.json index 036eacd..b5578a8 100644 --- a/src/main/resources/assets/anvilcraft_pigsplus/models/block/enchanted_generator.json +++ b/src/main/resources/assets/anvilcraft_pigsplus/models/block/enchanted_generator.json @@ -378,32 +378,37 @@ ], "display": { "thirdperson_righthand": { - "rotation": [26, 0, 0], - "scale": [0.4, 0.4, 0.4] + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] }, "thirdperson_lefthand": { - "rotation": [26, 0, 0], - "scale": [0.4, 0.4, 0.4] + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] }, "firstperson_righthand": { - "translation": [0, 0, -0.75], + "rotation": [0, 45, 0], "scale": [0.4, 0.4, 0.4] }, "firstperson_lefthand": { - "translation": [0, 0, -0.75], + "rotation": [0, -135, 0], "scale": [0.4, 0.4, 0.4] }, "ground": { - "translation": [0, -0.25, 0], - "scale": [0.4, 0.4, 0.4] + "translation": [0, 3, 0], + "scale": [0.25, 0.25, 0.25] + }, + "gui": { + "rotation": [30, -135, 0], + "scale": [0.625, 0.625, 0.625] }, "head": { "translation": [0, 12.75, 0], "scale": [0.8, 0.8, 0.8] }, "fixed": { - "translation": [0, 0, 0.5], - "scale": [0.6, 0.6, 0.6] + "scale": [0.5, 0.5, 0.5] } }, "groups": [ diff --git a/src/main/resources/assets/anvilcraft_pigsplus/textures/block/chain_smithing_table_front.png b/src/main/resources/assets/anvilcraft_pigsplus/textures/block/chain_smithing_table_front.png new file mode 100644 index 0000000000000000000000000000000000000000..a4a092a9af51a0390457122ab27c89a58a0abcb6 GIT binary patch literal 554 zcmV+_0@eMAP)KyXH3ZkbfIdSuLP%DD5Xg;$ znS^vESEkZK`chrh`Fm>UtW(gZs!o4(>OVgvR#yKILV9P%h=-@i)5j8v_VgSXjWX}H zyL(F9i$wFxX_z3Ncp%cQs$T^#Tm(r?V3Z3kg;?owew zC>Ir#Q^s=OW51@t+f%x zux~cUw}T!iB?Pb6YsOe(jE*(u1p_}o7dJQ>!oZ<6qVM}*IJ72XlzUar)pA~;pYdr# zlT#@9vhYlsTq$KONi&n^?8naz?s7DoV2&gqfBpXcX6f~-Pm8i5h&7<&IBtGi zKy-Z~va%cZ7TnhJgkYreZ4tHIi@0+MAM`n4fB)@|Eh(kZV#E03jrn> sMz;U}0RR6hOO+%5000I_L_t&o0Fme@E|uiZ(f|Me07*qoM6N<$g1JZleEPx#1am@3R0s$N2z&@+hyVZp32;bRa{vHbSpWcBSph3f{gD6w0hvieK~y-6rIAf; z)Ibo0zwys>+t^t7nM{CDA{Ly16&GN`n#<(^aE=IWfM&!ZNW*xdB*bIK?h*pC=(N+5 zAZ3xatm?1&)vM9zmy;gg?0gBpkF{_#RRA0xyu!)vJIxmr!Bb#>(fbb{dw|XAlIJh> zkh%jvniiF%0H{0}K&iW}UhotcAku|G7cV*g_LGaI92zvBwSsF~p0S*-84;1kDbv{wZ{N-Mddma=hlh7I0n%)jBrnMG zjJj^NY5+%5g{f?yfrE9StYuGi-B48(_vNl3b!Q#8(>d$mI0X1F>>Nqmq4I>lhm}%H zU+*wdEgQ2MYW`4T3}x93*9jbKDnUe8&ev>KH^jeFl(NI!Q0cGGTH~)B`8ydSBt)dy zF5x&t`YR@reU|g}u%5vTFhJl3a$l3l{^M5wD9bxIjN`4qj4=-e`)db2to6gdwANcS zC+9diTU^>g(^`m%zPG=M*kH{cp}zh#eDdk@ccf{NrsW?&E#e#@7cbiY00005p*vV)16d{SOuaf5SXc5PW| zXfCCBzyJUMZb?KzRCwA*X_p_#Nf=_)E#V`hNv29g#?k4900000NkvXXu0mjfcq>hf literal 928 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85kt5fiR=Q#ZzyAf|4b!5hcO-X(i=}MX3yqDfvmM3ZA)%>8U}f zi7AzZCsS>JrnYB>M3hAM`dB6B=jtVb)aX^@765fKFxc2v6eK2Rr1^l#~=$>Fbx5m+O@q>*W`v>l<2HTIw4Z z=^Gj80#)c1SLT%@R_NvxD?<%%Ni9w;$}A|!%+FH*8JL)qUs__TR9c#uVwIMdW}1|e zVyc^zXq=*JXqb|yo0wv3sGDMJoMLWjXknCQn4|=?z9cgZVSipRG#G#Zq7RbMH`Fr# zIT^&Z@-NCv1-b%crJbP-SRO^pMjzx5B!}5SM1Xz;vfv>D3MP2yrse^Iv>X_AI#XtF z1EZwY)5S5w!oPI#-k?JP0uipM$l41YJNe3zzOb*Xtb1huPlxk2 zJvn{!%(2SFi)1(Wee#`qx_k1a#~%uLHeA-{Slw`lt)lYpvzI@E_g_w7Jn;8$yBJT; z^5oD~15Kf$Gy4=jGyU>T^m+cwvMDVh*yDM6ZtI)byOeh9vC!;Qa@A^1tpEDy*WdM< zXO!^ugjeO?oRAiAS}0&|Ltm+xKNE5!Ub zv7g`jpsw_){VPN>AKkIp@Amvz#O({ly^nmF*XCY$`(tTw+S)@J=YBAkZ+gTe~DWM4fNFH>= diff --git a/src/main/resources/assets/anvilcraft_pigsplus/textures/item/spiritual_component.png b/src/main/resources/assets/anvilcraft_pigsplus/textures/item/spiritual_component.png index 321e119bbee6855ab4551b4889de518cdfa5e6d1..8548dca4487f0139cbf3e72c4533c965f127d766 100644 GIT binary patch delta 618 zcmV-w0+s#J2e$~2G7NJG0e=E1Nkl*rQ9`okSyf@#O?>smseBF~$ zx-C1tV?s!UnKuDnez7e>s(%}EOt_T~czK>vO1I@J@uD*YAh(m{!;K>M3n>8P@jw0? z{v?wqa`nAi#NVA<)pe@6PO-8_v9gB{HjWAY!6E#ELkuWULeUwPc4t|OyKMbEM*?Q8 zOiMIqi3R|LxhBD=ier_$7=RXW#{j4IMS-Sea$xQAV4(znHF3n-Sbvr2YcE-tQP?a! zr)il8VPl+h6$q)2+sYz@4M6Um&hM~=5jFw%E?PX@m~=Dx;0O1mGl?RfQ$JXJR^~$O zFGkqJH>@!*pTM}-;G22`fMdDrI#=+~r$BBe%gslh$lU$Hz7AH9i(scztP!Ri{sdkm?rbKvCfK z_GOa!F&=NtvAj9Sq@#H2w*AZVdsG0pGJA*Y_7fbdL^_pc>+1@I)6GrG^rX}xK)sJa z(=xq(AcRe9BS_OSJ!^>u2i86ShAY?^@{4UbJ~}1GN2g>gIzu93(Gj^8cVnTUNRO>g zpY=>nGp$dzrD41D3>%i~0pD7@EjyBRPF=2_HPgBAAK8QmSDkn8dz#-1npdHj%o3FAqU**^HA+G21BC7E6 z)R3vElh)4&I{@38`u28EC)$q~gy4EUuID3ie_8G?`!;YK4nSdDh{t Date: Tue, 16 Dec 2025 22:06:40 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=89=8B=E5=86=8C=E6=B7=BB=E5=8A=A0=20?= =?UTF-8?q?=E5=8F=AF=E8=B0=83=E5=BC=8F=E8=83=BD=E9=87=8F=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E5=99=A8=EF=BC=9B=E6=9C=AB=E5=BD=B1=E9=83=A8=E4=BB=B6=20?= =?UTF-8?q?=E7=9A=84=E6=8F=8F=E8=BF=B0=EF=BC=9B=E6=B7=BB=E5=8A=A0=E6=9C=AB?= =?UTF-8?q?=E5=BD=B1=E9=83=A8=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../anvilcraft_pigsplus/lang/en_ud.json | 1 + .../anvilcraft_pigsplus/lang/en_us.json | 1 + .../models/item/ender_component.json | 6 ++ .../event/EndPortalEventListener.java | 55 ++++++++++++++++++ .../anvilcraft/pigsplus/init/AddonItems.java | 4 ++ .../pigsplus/item/KarakuriComponentItem.java | 9 +-- .../anvilcraft/pigsplus/util/MathUtil.java | 17 ++++++ .../power/adjustable_power_converter.json | 15 +++++ .../entries/power/enchanted_generator.json | 3 +- .../entries/smithing/pigs_materials.json | 8 ++- .../anvilcraft_pigsplus/lang/zh_cn.json | 1 + .../textures/item/ender_component.png | Bin 0 -> 728 bytes 12 files changed, 112 insertions(+), 8 deletions(-) create mode 100644 src/generated/resources/assets/anvilcraft_pigsplus/models/item/ender_component.json create mode 100644 src/main/java/dev/anvilcraft/pigsplus/event/EndPortalEventListener.java create mode 100644 src/main/java/dev/anvilcraft/pigsplus/util/MathUtil.java create mode 100644 src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/power/adjustable_power_converter.json create mode 100644 src/main/resources/assets/anvilcraft_pigsplus/textures/item/ender_component.png diff --git a/src/generated/resources/assets/anvilcraft_pigsplus/lang/en_ud.json b/src/generated/resources/assets/anvilcraft_pigsplus/lang/en_ud.json index be4f9c4..e4e981b 100644 --- a/src/generated/resources/assets/anvilcraft_pigsplus/lang/en_ud.json +++ b/src/generated/resources/assets/anvilcraft_pigsplus/lang/en_ud.json @@ -52,6 +52,7 @@ "config.jade.plugin_anvilcraft_pigsplus.electric_enchanting_table": "ǝןqɐ⟘ buıʇuɐɥɔuƎ ɔıɹʇɔǝןƎ", "config.jade.plugin_anvilcraft_pigsplus.enchanted_generator": "ɹoʇɐɹǝuǝ⅁ pǝʇuɐɥɔuƎ", "item.anvilcraft_pigsplus.chaotic_raw_ore": "ǝɹO ʍɐᴚ ɔıʇoɐɥƆ", + "item.anvilcraft_pigsplus.ender_component": "ʇuǝuodɯoƆ ɹǝpuƎ", "item.anvilcraft_pigsplus.karakuri_component": "ʇuǝuodɯoƆ ıɹnʞɐɹɐʞ", "item.anvilcraft_pigsplus.spiritual_component": "ʇuǝuodɯoƆ ןɐnʇıɹıdS", "itemGroup.anvilcraft_pigsplus.addon_items": "snןԀ sbıԀ :ʇɟɐɹƆןıʌuⱯ", diff --git a/src/generated/resources/assets/anvilcraft_pigsplus/lang/en_us.json b/src/generated/resources/assets/anvilcraft_pigsplus/lang/en_us.json index 4dab7d6..ab298ba 100644 --- a/src/generated/resources/assets/anvilcraft_pigsplus/lang/en_us.json +++ b/src/generated/resources/assets/anvilcraft_pigsplus/lang/en_us.json @@ -52,6 +52,7 @@ "config.jade.plugin_anvilcraft_pigsplus.electric_enchanting_table": "Electric Enchanting Table", "config.jade.plugin_anvilcraft_pigsplus.enchanted_generator": "Enchanted Generator", "item.anvilcraft_pigsplus.chaotic_raw_ore": "Chaotic Raw Ore", + "item.anvilcraft_pigsplus.ender_component": "Ender Component", "item.anvilcraft_pigsplus.karakuri_component": "Karakuri Component", "item.anvilcraft_pigsplus.spiritual_component": "Spiritual Component", "itemGroup.anvilcraft_pigsplus.addon_items": "AnvilCraft: Pigs Plus", diff --git a/src/generated/resources/assets/anvilcraft_pigsplus/models/item/ender_component.json b/src/generated/resources/assets/anvilcraft_pigsplus/models/item/ender_component.json new file mode 100644 index 0000000..a2e77f8 --- /dev/null +++ b/src/generated/resources/assets/anvilcraft_pigsplus/models/item/ender_component.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "anvilcraft_pigsplus:item/ender_component" + } +} \ No newline at end of file diff --git a/src/main/java/dev/anvilcraft/pigsplus/event/EndPortalEventListener.java b/src/main/java/dev/anvilcraft/pigsplus/event/EndPortalEventListener.java new file mode 100644 index 0000000..b16ac79 --- /dev/null +++ b/src/main/java/dev/anvilcraft/pigsplus/event/EndPortalEventListener.java @@ -0,0 +1,55 @@ +package dev.anvilcraft.pigsplus.event; + +import dev.anvilcraft.pigsplus.init.AddonItems; +import dev.anvilcraft.pigsplus.util.MathUtil; +import dev.dubhe.anvilcraft.init.item.ModItems; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent; + +public class EndPortalEventListener { + private static final float CONVERSION_PROBABILITY = 0.2f; + + public static void onItemThrowPortal(final EntityJoinLevelEvent event) { + // 只在服务端执行 + if (event.getLevel().isClientSide()) return; + // 需要是物品实体 + if (!(event.getEntity() instanceof ItemEntity itemEntity)) return; + // 需要是机巧部件 + if (!itemEntity.getItem().is(AddonItems.KARAKURI_COMPONENT)) return; + // 需要位于末地 + if (!itemEntity.level().dimension().equals(Level.END)) return; + // 概率生成末影部件 + int originalCount = itemEntity.getItem().getCount(); + int convertedCount = MathUtil.getCount(CONVERSION_PROBABILITY, originalCount, itemEntity.level()); + int remainingCount = originalCount - convertedCount; + + itemEntity.setRemoved(Entity.RemovalReason.DISCARDED); + + if (convertedCount > 0) { + ItemStack newItem = new ItemStack(AddonItems.ENDER_COMPONENT.asItem(), convertedCount); + ItemEntity newItemEntity = new ItemEntity( + itemEntity.level(), + itemEntity.getX(), + itemEntity.getY(), + itemEntity.getZ(), + newItem + ); + itemEntity.level().addFreshEntity(newItemEntity); + } + + if (remainingCount > 0) { + ItemStack remainingItem = new ItemStack(ModItems.LEVITATION_POWDER.get(), remainingCount); + ItemEntity remainingItemEntity = new ItemEntity( + itemEntity.level(), + itemEntity.getX(), + itemEntity.getY(), + itemEntity.getZ(), + remainingItem + ); + itemEntity.level().addFreshEntity(remainingItemEntity); + } + } +} diff --git a/src/main/java/dev/anvilcraft/pigsplus/init/AddonItems.java b/src/main/java/dev/anvilcraft/pigsplus/init/AddonItems.java index bc5576b..382f5d3 100644 --- a/src/main/java/dev/anvilcraft/pigsplus/init/AddonItems.java +++ b/src/main/java/dev/anvilcraft/pigsplus/init/AddonItems.java @@ -32,6 +32,10 @@ public class AddonItems { .item("spiritual_component", Item::new) .register(); + public static final ItemEntry ENDER_COMPONENT = REGISTRATE + .item("ender_component", Item::new) + .register(); + public static final ItemEntry CHAOTIC_RAW_ORE = REGISTRATE .item("chaotic_raw_ore", Item::new) .recipe((ctx, provider) -> ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ctx.get(), 9) diff --git a/src/main/java/dev/anvilcraft/pigsplus/item/KarakuriComponentItem.java b/src/main/java/dev/anvilcraft/pigsplus/item/KarakuriComponentItem.java index b2bb50d..53c4903 100644 --- a/src/main/java/dev/anvilcraft/pigsplus/item/KarakuriComponentItem.java +++ b/src/main/java/dev/anvilcraft/pigsplus/item/KarakuriComponentItem.java @@ -1,6 +1,7 @@ package dev.anvilcraft.pigsplus.item; import dev.anvilcraft.pigsplus.init.AddonItems; +import dev.anvilcraft.pigsplus.util.MathUtil; import net.minecraft.core.Holder; import net.minecraft.core.component.DataComponents; import net.minecraft.util.Mth; @@ -31,13 +32,13 @@ public void onDestroyed(ItemEntity itemEntity, DamageSource damageSource) { List> enchantments = itemEnchantments.keySet().stream().toList(); float probability = 0.2f * Mth.clamp(enchantments.size(), 0, 5); - int count = 0; - for (int i = 0; i < itemStack.getCount(); i++) { - if (level.random.nextFloat() < probability) count++; - } + + int count = MathUtil.getCount(probability, itemStack.getCount(), level); + // 生成灵媒部件 ItemStack resultItem = AddonItems.SPIRITUAL_COMPONENT.asStack(); resultItem.setCount(count); level.addFreshEntity(new ItemEntity(level, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), resultItem)); } + } \ No newline at end of file diff --git a/src/main/java/dev/anvilcraft/pigsplus/util/MathUtil.java b/src/main/java/dev/anvilcraft/pigsplus/util/MathUtil.java new file mode 100644 index 0000000..144082c --- /dev/null +++ b/src/main/java/dev/anvilcraft/pigsplus/util/MathUtil.java @@ -0,0 +1,17 @@ +package dev.anvilcraft.pigsplus.util; + +import net.minecraft.world.level.Level; + +public class MathUtil { + public static int getCount(float probability, int num, Level level) { + float totalProbability = probability * num; + int baseCount = (int) totalProbability; + float fractionalPart = totalProbability - baseCount; + + int count = baseCount; + if (level.random.nextFloat() < fractionalPart) { + count++; + } + return count; + } +} diff --git a/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/power/adjustable_power_converter.json b/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/power/adjustable_power_converter.json new file mode 100644 index 0000000..8196378 --- /dev/null +++ b/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/power/adjustable_power_converter.json @@ -0,0 +1,15 @@ +{ + "name": "可调式能量转换器", + "category": "anvilcraft:power_system", + "icon": "anvilcraft_pigsplus:adjustable_power_converter", + "sortnum": 22100, + "entry_color": "DD6666", + "pages": [ + "$(li)可以按1kW ⇔ 80FE/t 转换能量(可用config调整) $(li)可自选转换方向,瞬时转换量", + { + "type": "patchouli:crafting", + "recipe": "anvilcraft_pigsplus:adjustable_power_converter", + "text": "常规最大转换量8192kW $(br)电网范围:以自己为中心5x5x5 $(li)拥有128MFE容量" + } + ] +} diff --git a/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/power/enchanted_generator.json b/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/power/enchanted_generator.json index eafbeb1..61406de 100644 --- a/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/power/enchanted_generator.json +++ b/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/power/enchanted_generator.json @@ -2,13 +2,12 @@ "name": "附魔发电机", "category": "anvilcraft:power_system", "icon": "anvilcraft_pigsplus:enchanted_generator", - "sortnum": 22100, + "sortnum": 22101, "entry_color": "DD6666", "pages": [ "本章节将会讲述:如何借助$(item)附魔书$()与$(item)雕纹书架$()发电", { "type": "patchouli:crafting", - "anchor": "enchanted_generator", "recipe": "anvilcraft_pigsplus:enchanted_generator", "text": "常规最大发电量1024kW $(br)工作范围:以自己为中心3x3x3 $(li)可以识别工作范围内的,雕纹书架上的附魔书 $(li)每级附魔提供2kW能量" }, diff --git a/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/smithing/pigs_materials.json b/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/smithing/pigs_materials.json index c237a99..96c430a 100644 --- a/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/smithing/pigs_materials.json +++ b/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/smithing/pigs_materials.json @@ -8,16 +8,20 @@ "在此介绍由$(thing)铁砧工艺:猪+$()提供的材料", { "type": "patchouli:crafting", - "anchor": "karakuri_component", "recipe": "anvilcraft_pigsplus:karakuri_component", "text": "机巧部件具有优秀的红石传导能力与结构强度,被广泛用于智能生产设备中$()" }, { "type": "patchouli:spotlight", - "anchor": "spiritual_component", "item": "anvilcraft_pigsplus:spiritual_component", "link_recipe": true, "text": "携带$(thing)附魔$()的$(item)机巧部件$()被摧毁时,每条附魔提供20%%的概率,生成最多一个$(item)灵媒部件$() $(p)$(#888888)机魂大悦$()" + }, + { + "type": "patchouli:spotlight", + "item": "anvilcraft_pigsplus:ender_component", + "link_recipe": true, + "text": "将$(item)机巧部件$()丢入末地传送门 $(li)20%% → $(item)末影部件$() $(li)80%% → 飘浮粉。" } ] } \ No newline at end of file diff --git a/src/main/resources/assets/anvilcraft_pigsplus/lang/zh_cn.json b/src/main/resources/assets/anvilcraft_pigsplus/lang/zh_cn.json index 8c236be..1277039 100644 --- a/src/main/resources/assets/anvilcraft_pigsplus/lang/zh_cn.json +++ b/src/main/resources/assets/anvilcraft_pigsplus/lang/zh_cn.json @@ -52,6 +52,7 @@ "config.jade.plugin_anvilcraft_pigsplus.electric_enchanting_table": "电力附魔台", "config.jade.plugin_anvilcraft_pigsplus.enchanted_generator": "附魔发电机", "item.anvilcraft_pigsplus.chaotic_raw_ore": "混沌粗矿", + "item.anvilcraft_pigsplus.ender_component": "末影部件", "item.anvilcraft_pigsplus.karakuri_component": "机巧部件", "item.anvilcraft_pigsplus.spiritual_component": "灵媒部件", "itemGroup.anvilcraft_pigsplus.addon_items": "铁砧工艺:猪+", diff --git a/src/main/resources/assets/anvilcraft_pigsplus/textures/item/ender_component.png b/src/main/resources/assets/anvilcraft_pigsplus/textures/item/ender_component.png new file mode 100644 index 0000000000000000000000000000000000000000..23343d22a9e21e3e351a2eb00926c4659e52178c GIT binary patch literal 728 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBufG}g$wN6f;hW5;mh>{3jAFJg2T)o7U{G?R9irfOAY6b=y z`-+0Zwic-?7f?V97Du6s&rHqo20xNy} z^73-Ma$~*xqI7*jOG`_A10#JSBVC{h-Qvo;lEez#ykcdj0WPV<$wiq3C7Jno3Lpa$ zlk!VTY?Vq&GgGY664OkRQc_HHlM;E46*QEJ5g8YkbyvJyj7@#M2ztbj%CI&%NH$Q zk-^K}k?Ghj?O0&3#AsE*114ti9Ws3q zJ3g%M6yXm)nHgPSJ9lHm`gvS65=?4dOVfR)&F1-Oa!Go3>jHMYn|a&}CzfCQeqc-N z`9*S1E_(#uJ!$92S~e-<)_g1FRS$xN?(i0t|L0rz<&I1J)Qxi{|K~Sf(j6oIWnI{0 PQ1bG0^>bP0l+XkK>H7vo literal 0 HcmV?d00001 From b12b014c5fce8d707d5830d20ed94c5dfb128c1c Mon Sep 17 00:00:00 2001 From: TBPig <147127248+TBPig@users.noreply.github.com> Date: Tue, 16 Dec 2025 22:35:49 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=AB=E5=BD=B1?= =?UTF-8?q?=E9=83=A8=E4=BB=B6=E5=90=88=E6=88=90=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recipes/time_warp/ender_component.json | 21 +++++++ .../recipe/time_warp/ender_component.json | 28 ++++++++++ .../pigsplus/data/recipe/RecipeHandler.java | 16 ++++++ .../event/EndPortalEventListener.java | 55 ------------------- .../pigsplus/mixin/package-info.java | 3 + .../entries/smithing/pigs_materials.json | 7 +-- 6 files changed, 71 insertions(+), 59 deletions(-) create mode 100644 src/generated/resources/data/anvilcraft/advancement/recipes/time_warp/ender_component.json create mode 100644 src/generated/resources/data/anvilcraft/recipe/time_warp/ender_component.json delete mode 100644 src/main/java/dev/anvilcraft/pigsplus/event/EndPortalEventListener.java create mode 100644 src/main/java/dev/anvilcraft/pigsplus/mixin/package-info.java diff --git a/src/generated/resources/data/anvilcraft/advancement/recipes/time_warp/ender_component.json b/src/generated/resources/data/anvilcraft/advancement/recipes/time_warp/ender_component.json new file mode 100644 index 0000000..9f8bfff --- /dev/null +++ b/src/generated/resources/data/anvilcraft/advancement/recipes/time_warp/ender_component.json @@ -0,0 +1,21 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "anvilcraft:time_warp/ender_component" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "anvilcraft:time_warp/ender_component" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/anvilcraft/recipe/time_warp/ender_component.json b/src/generated/resources/data/anvilcraft/recipe/time_warp/ender_component.json new file mode 100644 index 0000000..8f7669f --- /dev/null +++ b/src/generated/resources/data/anvilcraft/recipe/time_warp/ender_component.json @@ -0,0 +1,28 @@ +{ + "type": "anvilcraft:time_warp", + "ingredients": [ + { + "items": "anvilcraft_pigsplus:karakuri_component" + }, + { + "items": "minecraft:ender_pearl" + }, + { + "count": 3, + "items": "minecraft:end_stone" + } + ], + "results": [ + { + "count": { + "type": "minecraft:binomial", + "n": 1.0, + "p": 0.2 + }, + "id": "anvilcraft_pigsplus:ender_component" + }, + { + "id": "anvilcraft:levitation_powder" + } + ] +} \ No newline at end of file diff --git a/src/main/java/dev/anvilcraft/pigsplus/data/recipe/RecipeHandler.java b/src/main/java/dev/anvilcraft/pigsplus/data/recipe/RecipeHandler.java index 624781d..35f94e2 100644 --- a/src/main/java/dev/anvilcraft/pigsplus/data/recipe/RecipeHandler.java +++ b/src/main/java/dev/anvilcraft/pigsplus/data/recipe/RecipeHandler.java @@ -2,10 +2,20 @@ import com.tterrag.registrate.providers.RegistrateRecipeProvider; import dev.anvilcraft.pigsplus.init.AddonBlocks; +import dev.anvilcraft.pigsplus.init.AddonItems; +import dev.dubhe.anvilcraft.init.item.ModItemTags; +import dev.dubhe.anvilcraft.init.item.ModItems; import dev.dubhe.anvilcraft.recipe.anvil.wrap.ItemInjectRecipe; +import dev.dubhe.anvilcraft.recipe.anvil.wrap.TimeWarpRecipe; import dev.dubhe.anvilcraft.recipe.mineral.MineralFountainRecipe; +import mezz.jei.api.constants.Tags; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; +import net.neoforged.neoforge.common.crafting.BlockTagIngredient; +import net.neoforged.neoforge.common.data.BlockTagsProvider; public class RecipeHandler { public static void init(RegistrateRecipeProvider provider) { @@ -26,5 +36,11 @@ public static void init(RegistrateRecipeProvider provider) { .resultBlock(AddonBlocks.BUDDING_ECHO_SHARD) .save(provider); + TimeWarpRecipe.builder() + .requires(AddonItems.KARAKURI_COMPONENT) + .requires(Items.ENDER_PEARL) + .requires(Items.END_STONE,3) + .result(AddonItems.ENDER_COMPONENT,0.2f) + .save(provider); } } diff --git a/src/main/java/dev/anvilcraft/pigsplus/event/EndPortalEventListener.java b/src/main/java/dev/anvilcraft/pigsplus/event/EndPortalEventListener.java deleted file mode 100644 index b16ac79..0000000 --- a/src/main/java/dev/anvilcraft/pigsplus/event/EndPortalEventListener.java +++ /dev/null @@ -1,55 +0,0 @@ -package dev.anvilcraft.pigsplus.event; - -import dev.anvilcraft.pigsplus.init.AddonItems; -import dev.anvilcraft.pigsplus.util.MathUtil; -import dev.dubhe.anvilcraft.init.item.ModItems; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.item.ItemEntity; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent; - -public class EndPortalEventListener { - private static final float CONVERSION_PROBABILITY = 0.2f; - - public static void onItemThrowPortal(final EntityJoinLevelEvent event) { - // 只在服务端执行 - if (event.getLevel().isClientSide()) return; - // 需要是物品实体 - if (!(event.getEntity() instanceof ItemEntity itemEntity)) return; - // 需要是机巧部件 - if (!itemEntity.getItem().is(AddonItems.KARAKURI_COMPONENT)) return; - // 需要位于末地 - if (!itemEntity.level().dimension().equals(Level.END)) return; - // 概率生成末影部件 - int originalCount = itemEntity.getItem().getCount(); - int convertedCount = MathUtil.getCount(CONVERSION_PROBABILITY, originalCount, itemEntity.level()); - int remainingCount = originalCount - convertedCount; - - itemEntity.setRemoved(Entity.RemovalReason.DISCARDED); - - if (convertedCount > 0) { - ItemStack newItem = new ItemStack(AddonItems.ENDER_COMPONENT.asItem(), convertedCount); - ItemEntity newItemEntity = new ItemEntity( - itemEntity.level(), - itemEntity.getX(), - itemEntity.getY(), - itemEntity.getZ(), - newItem - ); - itemEntity.level().addFreshEntity(newItemEntity); - } - - if (remainingCount > 0) { - ItemStack remainingItem = new ItemStack(ModItems.LEVITATION_POWDER.get(), remainingCount); - ItemEntity remainingItemEntity = new ItemEntity( - itemEntity.level(), - itemEntity.getX(), - itemEntity.getY(), - itemEntity.getZ(), - remainingItem - ); - itemEntity.level().addFreshEntity(remainingItemEntity); - } - } -} diff --git a/src/main/java/dev/anvilcraft/pigsplus/mixin/package-info.java b/src/main/java/dev/anvilcraft/pigsplus/mixin/package-info.java new file mode 100644 index 0000000..2eff6e0 --- /dev/null +++ b/src/main/java/dev/anvilcraft/pigsplus/mixin/package-info.java @@ -0,0 +1,3 @@ +@net.minecraft.MethodsReturnNonnullByDefault +@javax.annotation.ParametersAreNonnullByDefault +package dev.anvilcraft.pigsplus.mixin; \ No newline at end of file diff --git a/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/smithing/pigs_materials.json b/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/smithing/pigs_materials.json index 96c430a..ac7fd8b 100644 --- a/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/smithing/pigs_materials.json +++ b/src/main/resources/assets/anvilcraft/patchouli_books/guide/en_us/entries/smithing/pigs_materials.json @@ -18,10 +18,9 @@ "text": "携带$(thing)附魔$()的$(item)机巧部件$()被摧毁时,每条附魔提供20%%的概率,生成最多一个$(item)灵媒部件$() $(p)$(#888888)机魂大悦$()" }, { - "type": "patchouli:spotlight", - "item": "anvilcraft_pigsplus:ender_component", - "link_recipe": true, - "text": "将$(item)机巧部件$()丢入末地传送门 $(li)20%% → $(item)末影部件$() $(li)80%% → 飘浮粉。" + "type": "anvilcraft:time_warp", + "recipe": "anvilcraft:time_warp/ender_component", + "text": "只有20%%成功合成率 $(p)蕴涵传送之力" } ] } \ No newline at end of file From 07b0db2b30494297916828b921b1c1e068ac48bc Mon Sep 17 00:00:00 2001 From: TBPig <147127248+TBPig@users.noreply.github.com> Date: Tue, 16 Dec 2025 22:36:01 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=AB=E5=BD=B1?= =?UTF-8?q?=E9=83=A8=E4=BB=B6=E5=90=88=E6=88=90=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../anvilcraft/pigsplus/data/recipe/RecipeHandler.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/dev/anvilcraft/pigsplus/data/recipe/RecipeHandler.java b/src/main/java/dev/anvilcraft/pigsplus/data/recipe/RecipeHandler.java index 35f94e2..da71034 100644 --- a/src/main/java/dev/anvilcraft/pigsplus/data/recipe/RecipeHandler.java +++ b/src/main/java/dev/anvilcraft/pigsplus/data/recipe/RecipeHandler.java @@ -3,19 +3,11 @@ import com.tterrag.registrate.providers.RegistrateRecipeProvider; import dev.anvilcraft.pigsplus.init.AddonBlocks; import dev.anvilcraft.pigsplus.init.AddonItems; -import dev.dubhe.anvilcraft.init.item.ModItemTags; -import dev.dubhe.anvilcraft.init.item.ModItems; import dev.dubhe.anvilcraft.recipe.anvil.wrap.ItemInjectRecipe; import dev.dubhe.anvilcraft.recipe.anvil.wrap.TimeWarpRecipe; import dev.dubhe.anvilcraft.recipe.mineral.MineralFountainRecipe; -import mezz.jei.api.constants.Tags; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.tags.BlockTags; -import net.minecraft.tags.ItemTags; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; -import net.neoforged.neoforge.common.crafting.BlockTagIngredient; -import net.neoforged.neoforge.common.data.BlockTagsProvider; public class RecipeHandler { public static void init(RegistrateRecipeProvider provider) { From e71c2d680a231a04ffbc86c346ae981884542b40 Mon Sep 17 00:00:00 2001 From: TBPig <147127248+TBPig@users.noreply.github.com> Date: Wed, 17 Dec 2025 08:25:55 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=9A=87=E5=AE=B6=E9=94=BB=E9=80=A0=E5=8F=B0=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E6=9D=90=E8=B4=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../block/auto_royal_smithing_table.json | 18 +++++++++--------- .../auto_royal_smithing_table_overload.json | 18 +++++++++--------- .../block/auto_royal_smithing_table_core.png | Bin 273 -> 472 bytes 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/resources/assets/anvilcraft_pigsplus/models/block/auto_royal_smithing_table.json b/src/main/resources/assets/anvilcraft_pigsplus/models/block/auto_royal_smithing_table.json index 96a00eb..4e88408 100644 --- a/src/main/resources/assets/anvilcraft_pigsplus/models/block/auto_royal_smithing_table.json +++ b/src/main/resources/assets/anvilcraft_pigsplus/models/block/auto_royal_smithing_table.json @@ -173,16 +173,16 @@ } }, { - "from": [5, 7, 5], - "to": [11, 13, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 7, 5]}, + "from": [4, 7, 4], + "to": [12, 15, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 11, 8]}, "faces": { - "north": {"uv": [0, 0, 6, 6], "texture": "#3"}, - "east": {"uv": [0, 0, 6, 6], "texture": "#3"}, - "south": {"uv": [0, 0, 6, 6], "texture": "#3"}, - "west": {"uv": [0, 0, 6, 6], "texture": "#3"}, - "up": {"uv": [6, 0, 12, 6], "texture": "#3"}, - "down": {"uv": [6, 6, 12, 12], "texture": "#3"} + "north": {"uv": [0, 0, 8, 8], "texture": "#3"}, + "east": {"uv": [0, 0, 8, 8], "texture": "#3"}, + "south": {"uv": [0, 0, 8, 8], "texture": "#3"}, + "west": {"uv": [0, 0, 8, 8], "texture": "#3"}, + "up": {"uv": [8, 0, 16, 8], "texture": "#3"}, + "down": {"uv": [0, 8, 8, 16], "texture": "#3"} } } ], diff --git a/src/main/resources/assets/anvilcraft_pigsplus/models/block/auto_royal_smithing_table_overload.json b/src/main/resources/assets/anvilcraft_pigsplus/models/block/auto_royal_smithing_table_overload.json index 5484ff2..275914c 100644 --- a/src/main/resources/assets/anvilcraft_pigsplus/models/block/auto_royal_smithing_table_overload.json +++ b/src/main/resources/assets/anvilcraft_pigsplus/models/block/auto_royal_smithing_table_overload.json @@ -173,16 +173,16 @@ } }, { - "from": [5, 7, 5], - "to": [11, 13, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 7, 5]}, + "from": [4, 7, 4], + "to": [12, 15, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 11, 8]}, "faces": { - "north": {"uv": [0, 0, 6, 6], "texture": "#3"}, - "east": {"uv": [0, 0, 6, 6], "texture": "#3"}, - "south": {"uv": [0, 0, 6, 6], "texture": "#3"}, - "west": {"uv": [0, 0, 6, 6], "texture": "#3"}, - "up": {"uv": [6, 0, 12, 6], "texture": "#3"}, - "down": {"uv": [6, 6, 12, 12], "texture": "#3"} + "north": {"uv": [0, 0, 8, 8], "texture": "#3"}, + "east": {"uv": [0, 0, 8, 8], "texture": "#3"}, + "south": {"uv": [0, 0, 8, 8], "texture": "#3"}, + "west": {"uv": [0, 0, 8, 8], "texture": "#3"}, + "up": {"uv": [8, 0, 16, 8], "texture": "#3"}, + "down": {"uv": [0, 8, 8, 16], "texture": "#3"} } } ], diff --git a/src/main/resources/assets/anvilcraft_pigsplus/textures/block/auto_royal_smithing_table_core.png b/src/main/resources/assets/anvilcraft_pigsplus/textures/block/auto_royal_smithing_table_core.png index f133303806f138584980cfff59e96f5406af74ad..94842a76a226a1588481dfdae9dab910ecd97ff1 100644 GIT binary patch delta 446 zcmV;v0YUze0@wqPB!2;OQb$4nuFf3k00004b3#c}2nYxWd%|$H2=6 z8R&e5TeDaku20S=O@RddN&YD+ea`OjMOnH*_=ynuG`*Vt!rYf(n*f-@&;odV)G6G<&abLdm0G_{o oh0dzGJ4ppPt0=RaM?DJQKa!f7T&z;oga7~l07*qoM6N<$f@u23&Hw-a delta 245 zcmVVoa!0LOKd==GZ)Lo0!VKsZ057x*x-X`$jcif)y7zdb?5NWsPYFgthJ z)o+7V!^JNXCJSpz`X#|XIDuYBXPQB7EbVs+nVE4a13`V}{p)ieg08P(>jO1H7DJ#Q vr9o*xyZ`_I|Npa