Compare commits

..

No commits in common. "ffb11ca5f38e76b2883fbadec6be03e7aff9e22d" and "773d723ce08fdb38a15e51ef33331945f94ff78c" have entirely different histories.

9 changed files with 39 additions and 101 deletions

View file

@ -454,7 +454,7 @@ f657eabc7321de0b05cf92d9ebdd6f5215a685b5 assets/actuallyadditions/models/item/wo
7f8e5e703d9244222706c52d7b24b299e07cb2db assets/actuallyadditions/models/item/worm.json 7f8e5e703d9244222706c52d7b24b299e07cb2db assets/actuallyadditions/models/item/worm.json
0b1ab8963077c90a5104b516eab36e56c8a07057 assets/actuallyadditions/models/item/xp_solidifier.json 0b1ab8963077c90a5104b516eab36e56c8a07057 assets/actuallyadditions/models/item/xp_solidifier.json
ecf1cc8efe1f425334e8e07a6c747641c714c92c assets/actuallyadditions/sounds.json ecf1cc8efe1f425334e8e07a6c747641c714c92c assets/actuallyadditions/sounds.json
214cf5b268cb34e55c2232cc7c694e81f388dc1f data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json 9a7897ef54a7b27d06db0cbb412465fd1e71b9fe data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json
de3c64d6a363f8e27078d7f7df1a67e4931fd81c data/actuallyadditions/loot_tables/blocks/battery_box.json de3c64d6a363f8e27078d7f7df1a67e4931fd81c data/actuallyadditions/loot_tables/blocks/battery_box.json
fb968dc63f2d0a467eff504f3f6ff386080e2433 data/actuallyadditions/loot_tables/blocks/bio_reactor.json fb968dc63f2d0a467eff504f3f6ff386080e2433 data/actuallyadditions/loot_tables/blocks/bio_reactor.json
a1b62291e361451916e45a97bb499ecb1b6eb595 data/actuallyadditions/loot_tables/blocks/black_quartz_block.json a1b62291e361451916e45a97bb499ecb1b6eb595 data/actuallyadditions/loot_tables/blocks/black_quartz_block.json

View file

@ -13,34 +13,6 @@
{ {
"condition": "minecraft:survives_explosion" "condition": "minecraft:survives_explosion"
} }
],
"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"
}
]
}
] ]
} }
] ]

View file

@ -17,8 +17,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.loot.*; import net.minecraft.loot.*;
import net.minecraft.loot.conditions.BlockStateProperty; 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.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.RegistryObject;
@ -61,12 +59,7 @@ public class LootTableGenerator extends LootTableProvider {
this.dropSelf(ActuallyBlocks.ITEM_INTERFACE.get()); this.dropSelf(ActuallyBlocks.ITEM_INTERFACE.get());
this.dropSelf(ActuallyBlocks.FIREWORK_BOX.get()); this.dropSelf(ActuallyBlocks.FIREWORK_BOX.get());
this.dropSelf(ActuallyBlocks.VERTICAL_DIGGER.get()); this.dropSelf(ActuallyBlocks.VERTICAL_DIGGER.get());
this.dropSelf(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get());
dropNBT(ActuallyBlocks.ATOMIC_RECONSTRUCTOR, a ->
a.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.ENERGIZER.get());
this.dropSelf(ActuallyBlocks.ENERVATOR.get()); this.dropSelf(ActuallyBlocks.ENERVATOR.get());
this.dropSelf(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get()); this.dropSelf(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get());
@ -199,15 +192,6 @@ public class LootTableGenerator extends LootTableProvider {
} }
private void dropNBT(Supplier<Block> blockSupplier, Consumer<LootPool.Builder> lootFunctionProvider) {
LootPool.Builder lootpool = LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add(ItemLootEntry.lootTableItem(blockSupplier.get()));
lootpool.apply(CopyName.copyName(CopyName.Source.BLOCK_ENTITY));
lootFunctionProvider.accept(lootpool);
add(blockSupplier.get(), LootTable.lootTable().withPool(applyExplosionCondition(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get(), lootpool)));
}
/* // This isn't quite right :cry: fortune doesn't change it /* // This isn't quite right :cry: fortune doesn't change it
private void registerCrystal(RegistryObject<Block> crystalCluster, RegistryObject<Item> crystalShard) { private void registerCrystal(RegistryObject<Block> crystalCluster, RegistryObject<Item> crystalShard) {
this.registerLootTable(crystalCluster.get(), (crystal) -> this.registerLootTable(crystalCluster.get(), (crystal) ->

View file

@ -33,7 +33,7 @@ public final class ActuallyBlocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID); public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID);
public static final DeferredRegister<TileEntityType<?>> TILES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, ActuallyAdditions.MODID); public static final DeferredRegister<TileEntityType<?>> TILES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, ActuallyAdditions.MODID);
public static final Item.Properties defaultBlockItemProperties = new Item.Properties().tab(ActuallyAdditions.GROUP).stacksTo(64); private static final Item.Properties defaultBlockItemProperties = new Item.Properties().tab(ActuallyAdditions.GROUP).stacksTo(64);
public static final AbstractBlock.Properties miscBlockProperties = AbstractBlock.Properties.of(Material.STONE).harvestLevel(1).harvestTool(ToolType.PICKAXE).strength(1.5f, 10f); public static final AbstractBlock.Properties miscBlockProperties = AbstractBlock.Properties.of(Material.STONE).harvestLevel(1).harvestTool(ToolType.PICKAXE).strength(1.5f, 10f);
@ -99,7 +99,7 @@ public final class ActuallyBlocks {
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityVerticalDigger::new); (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityVerticalDigger::new);
public static final AABlockReg<BlockAtomicReconstructor, AABlockItem, TileEntityAtomicReconstructor> ATOMIC_RECONSTRUCTOR = new AABlockReg<>("atomic_reconstructor", BlockAtomicReconstructor::new, public static final AABlockReg<BlockAtomicReconstructor, AABlockItem, TileEntityAtomicReconstructor> ATOMIC_RECONSTRUCTOR = new AABlockReg<>("atomic_reconstructor", BlockAtomicReconstructor::new,
BlockAtomicReconstructor.TheItemBlock::new, TileEntityAtomicReconstructor::new); (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityAtomicReconstructor::new);
public static final AABlockReg<BlockRangedCollector, AABlockItem, TileEntityRangedCollector> RANGED_COLLECTOR = new AABlockReg<>("ranged_collector", BlockRangedCollector::new, public static final AABlockReg<BlockRangedCollector, AABlockItem, TileEntityRangedCollector> RANGED_COLLECTOR = new AABlockReg<>("ranged_collector", BlockRangedCollector::new,
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityRangedCollector::new); (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityRangedCollector::new);
public static final AABlockReg<BlockLongRangeBreaker, AABlockItem, TileEntityLongRangeBreaker> LONG_RANGE_BREAKER = new AABlockReg<>("long_range_breaker", BlockLongRangeBreaker::new, public static final AABlockReg<BlockLongRangeBreaker, AABlockItem, TileEntityLongRangeBreaker> LONG_RANGE_BREAKER = new AABlockReg<>("long_range_breaker", BlockLongRangeBreaker::new,

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.api.lens.ILensItem; import de.ellpeck.actuallyadditions.api.lens.ILensItem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig; import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
@ -20,11 +19,9 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.Lang; import de.ellpeck.actuallyadditions.mod.util.Lang;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.MainWindow; import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -46,10 +43,7 @@ import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List;
import java.util.Random;
public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container implements IHudDisplay { public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container implements IHudDisplay {
public static final DirectionProperty FACING = BlockStateProperties.FACING; public static final DirectionProperty FACING = BlockStateProperties.FACING;
@ -65,7 +59,7 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
ItemStack heldItem = player.getItemInHand(hand); ItemStack heldItem = player.getItemInHand(hand);
if (this.tryToggleRedstone(world, pos, player)) { if (this.tryToggleRedstone(world, pos, player)) {
return ActionResultType.CONSUME; return ActionResultType.PASS;
} }
if (!world.isClientSide) { if (!world.isClientSide) {
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getBlockEntity(pos); TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getBlockEntity(pos);
@ -128,47 +122,32 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
} }
} }
public static class TheItemBlock extends AABlockItem { // public static class TheItemBlock extends ItemBlockBase {
//
private long lastSysTime; // private long lastSysTime;
private int toPick1; // private int toPick1;
private int toPick2; // private int toPick2;
private final Block block; //
// public TheItemBlock(Block block) {
public TheItemBlock(Block blockIn) { // super(block, new Item.Properties().group(ActuallyAdditions.GROUP).setNoRepair());
super(blockIn, ActuallyBlocks.defaultBlockItemProperties); // }
block = blockIn; //
} // @Override
// public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
@OnlyIn(Dist.CLIENT) // long sysTime = System.currentTimeMillis();
@Override //
public void appendHoverText(@Nonnull ItemStack pStack, @Nullable World pLevel, @Nonnull List<ITextComponent> pTooltip, @Nonnull ITooltipFlag pFlag) { // if (this.lastSysTime + 3000 < sysTime) {
super.appendHoverText(pStack, pLevel, pTooltip, pFlag); // this.lastSysTime = sysTime;
// if (Minecraft.getInstance().world != null) {
long sysTime = System.currentTimeMillis(); // this.toPick1 = Minecraft.getInstance().world.rand.nextInt(NAME_FLAVOR_AMOUNTS_1) + 1;
// this.toPick2 = Minecraft.getInstance().world.rand.nextInt(NAME_FLAVOR_AMOUNTS_2) + 1;
if (this.lastSysTime + 3000 < sysTime) { // }
this.lastSysTime = sysTime; // }
if (Minecraft.getInstance().level != null) { //
Random random = Minecraft.getInstance().level.random; // String base = "tile." + ActuallyAdditions.MODID + "." + ((BlockAtomicReconstructor) this.block).getBaseName() + ".info.";
this.toPick1 = random.nextInt(NAME_FLAVOR_AMOUNTS_1) + 1; // tooltip.add(StringUtil.localize(base + "1." + this.toPick1) + " " + StringUtil.localize(base + "2." + this.toPick2));
this.toPick2 = random.nextInt(NAME_FLAVOR_AMOUNTS_2) + 1; // }
} // }
}
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 @Override
public boolean hasAnalogOutputSignal(BlockState state) { public boolean hasAnalogOutputSignal(BlockState state) {

View file

@ -193,7 +193,6 @@ public abstract class BlockContainerBase extends Block {
@Override @Override
public void playerWillDestroy(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, PlayerEntity player) { public void playerWillDestroy(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, PlayerEntity player) {
super.playerWillDestroy(world, pos, state, player);
if (!player.isCreative()) { if (!player.isCreative()) {
TileEntity tile = world.getBlockEntity(pos); TileEntity tile = world.getBlockEntity(pos);
if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) { if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) {
@ -257,6 +256,11 @@ 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 // TODO: [port]: eval
// @Override // @Override

View file

@ -70,6 +70,6 @@ public class CustomEnergyStorage extends EnergyStorage {
public void setEnergyStored(int energy) { public void setEnergyStored(int energy) {
this.energy = energy; this.energy = energy;
this.dirty = true; this.dirty = false;
} }
} }

View file

@ -121,8 +121,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
this.currentTime = compound.getInt("CurrentTime"); this.currentTime = compound.getInt("CurrentTime");
this.counter = compound.getInt("Counter"); this.counter = compound.getInt("Counter");
} }
if (compound.contains("Energy")) this.storage.readFromNBT(compound);
this.storage.readFromNBT(compound);
} }
@Override @Override

View file

@ -147,7 +147,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickableTile
this.stopFromDropping = compound.getBoolean("StopDrop"); this.stopFromDropping = compound.getBoolean("StopDrop");
} }
if (this.isRedstoneToggle() && compound.contains("IsPulseMode")) { if (this.isRedstoneToggle()) {
this.isPulseMode = compound.getBoolean("IsPulseMode"); this.isPulseMode = compound.getBoolean("IsPulseMode");
} }
} }