diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 33473441b..53301130f 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -454,7 +454,7 @@ f657eabc7321de0b05cf92d9ebdd6f5215a685b5 assets/actuallyadditions/models/item/wo 7f8e5e703d9244222706c52d7b24b299e07cb2db assets/actuallyadditions/models/item/worm.json 0b1ab8963077c90a5104b516eab36e56c8a07057 assets/actuallyadditions/models/item/xp_solidifier.json ecf1cc8efe1f425334e8e07a6c747641c714c92c assets/actuallyadditions/sounds.json -9a7897ef54a7b27d06db0cbb412465fd1e71b9fe data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json +cfe30d630abb33959f24b3296a31a6dfe1e8fd49 data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json de3c64d6a363f8e27078d7f7df1a67e4931fd81c data/actuallyadditions/loot_tables/blocks/battery_box.json fb968dc63f2d0a467eff504f3f6ff386080e2433 data/actuallyadditions/loot_tables/blocks/bio_reactor.json a1b62291e361451916e45a97bb499ecb1b6eb595 data/actuallyadditions/loot_tables/blocks/black_quartz_block.json diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json index 51c978c7e..49102f1eb 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json @@ -6,6 +6,34 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + }, + { + "function": "minecraft:copy_nbt", + "source": "block_entity", + "ops": [ + { + "source": "Energy", + "target": "BlockEntityTag.Energy", + "op": "replace" + } + ] + }, + { + "function": "minecraft:copy_nbt", + "source": "block_entity", + "ops": [ + { + "source": "IsPulseMode", + "target": "BlockEntityTag.IsPulseMode", + "op": "replace" + } + ] + } + ], "name": "actuallyadditions:atomic_reconstructor" } ], diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java index e49b352b1..a77d662d1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java @@ -17,6 +17,8 @@ import net.minecraft.item.Item; import net.minecraft.item.Items; import net.minecraft.loot.*; import net.minecraft.loot.conditions.BlockStateProperty; +import net.minecraft.loot.functions.CopyName; +import net.minecraft.loot.functions.CopyNbt; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.RegistryObject; @@ -59,7 +61,15 @@ public class LootTableGenerator extends LootTableProvider { this.dropSelf(ActuallyBlocks.ITEM_INTERFACE.get()); this.dropSelf(ActuallyBlocks.FIREWORK_BOX.get()); this.dropSelf(ActuallyBlocks.VERTICAL_DIGGER.get()); - this.dropSelf(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()); + + //this.dropSelf(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()); + + this.add(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get(), LootTable.lootTable() + .withPool(applyExplosionCondition(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get(), LootPool.lootPool().setRolls(ConstantRange.exactly(1))) + .add(ItemLootEntry.lootTableItem(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()) + .apply(CopyName.copyName(CopyName.Source.BLOCK_ENTITY)).apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY).copy("Energy", "BlockEntityTag.Energy")) + .apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY).copy("IsPulseMode", "BlockEntityTag.IsPulseMode"))))); + this.dropSelf(ActuallyBlocks.ENERGIZER.get()); this.dropSelf(ActuallyBlocks.ENERVATOR.get()); this.dropSelf(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java index 4c7525997..b324a536e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java @@ -65,7 +65,7 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { ItemStack heldItem = player.getItemInHand(hand); if (this.tryToggleRedstone(world, pos, player)) { - return ActionResultType.PASS; + return ActionResultType.CONSUME; } if (!world.isClientSide) { TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getBlockEntity(pos); @@ -159,6 +159,15 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im String base = block.getDescriptionId() + ".info."; pTooltip.add(new TranslationTextComponent(base + "1." + this.toPick1).append(" ").append(new TranslationTextComponent(base + "2." + this.toPick2)).withStyle(s -> s.withColor(TextFormatting.GRAY))); } + + @Override + protected boolean updateCustomBlockEntityTag(BlockPos pPos, World pLevel, @Nullable PlayerEntity pPlayer, ItemStack pStack, BlockState pState) { + boolean ret = super.updateCustomBlockEntityTag(pPos, pLevel, pPlayer, pStack, pState); + + + + return ret; + } } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java index 0a0c5012e..c7c939b55 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java @@ -193,6 +193,7 @@ public abstract class BlockContainerBase extends Block { @Override public void playerWillDestroy(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, PlayerEntity player) { + super.playerWillDestroy(world, pos, state, player); if (!player.isCreative()) { TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) { @@ -256,11 +257,6 @@ public abstract class BlockContainerBase extends Block { // } - @Override - public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid) { - return willHarvest || super.removedByPlayer(state, world, pos, player, false, fluid); - } - // TODO: [port]: eval // @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java index 5e612f97c..53b9c3e5a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java @@ -70,6 +70,6 @@ public class CustomEnergyStorage extends EnergyStorage { public void setEnergyStored(int energy) { this.energy = energy; - this.dirty = false; + this.dirty = true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index 85617431d..50aee0808 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -121,7 +121,8 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple this.currentTime = compound.getInt("CurrentTime"); this.counter = compound.getInt("Counter"); } - this.storage.readFromNBT(compound); + if (compound.contains("Energy")) + this.storage.readFromNBT(compound); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 19102d15e..a8d4c0738 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -147,7 +147,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickableTile this.stopFromDropping = compound.getBoolean("StopDrop"); } - if (this.isRedstoneToggle()) { + if (this.isRedstoneToggle() && compound.contains("IsPulseMode")) { this.isPulseMode = compound.getBoolean("IsPulseMode"); } }