From 218df0c85747c10bdecfd08c05a7a27a2cfcb1ca Mon Sep 17 00:00:00 2001 From: Flanks255 <32142731+Flanks255@users.noreply.github.com> Date: Mon, 30 Aug 2021 15:51:41 -0500 Subject: [PATCH] Fixed more classes... --- .../data/BlockRecipeGenerator.java | 2 +- .../mod/blocks/ActuallyBlocks.java | 2 +- .../mod/booklet/InitBooklet.java | 2 +- .../mod/tile/TileEntityLeafGenerator.java | 3 +- .../mod/tile/TileEntityLongRangeBreaker.java | 25 +++++++------- .../mod/tile/TileEntityVerticalDigger.java | 33 ++++++++++--------- .../mod/tile/TileEntityXPSolidifier.java | 3 +- 7 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java index 2db583173..8d7c1f10e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java @@ -76,7 +76,7 @@ public class BlockRecipeGenerator extends RecipeProvider { .save(consumer); //Vertical Digger - Recipe.shaped(ActuallyBlocks.Vertical_DIGGER.get()) + Recipe.shaped(ActuallyBlocks.VERTICAL_DIGGER.get()) .pattern("IRI", "RCR", "IDI") .define('R', Tags.Items.STORAGE_BLOCKS_REDSTONE) .define('I', ActuallyBlocks.IRON_CASING.get()) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java index 20b880ca1..30985a77f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java @@ -91,7 +91,7 @@ public final class ActuallyBlocks { public static final AABlockReg BIOREACTOR = new AABlockReg<>("bio_reactor", BlockBioReactor::new, (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityBioReactor::new); - public static final AABlockReg Vertical_DIGGER = new AABlockReg<>("vertical_digger", BlockVerticalDigger::new, + public static final AABlockReg VERTICAL_DIGGER = new AABlockReg<>("vertical_digger", BlockVerticalDigger::new, (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityVerticalDigger::new); public static final AABlockReg ATOMIC_RECONSTRUCTOR = new AABlockReg<>("atomic_reconstructor", BlockAtomicReconstructor::new, diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index 2ad63711e..3aba797aa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -215,7 +215,7 @@ public final class InitBooklet { new BookletChapter("fireworkBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.FIREWORK_BOX.get()), new PageTextOnly(1).addTextReplacement("", TileEntityFireworkBox.USE_PER_SHOT), new PageCrafting(2, BlockCrafting.recipeFireworkBox)).setSpecial(); new BookletChapter("batteryBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.BATTERY_BOX.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBatteryBox).setNoText()).setSpecial(); new BookletChapter("farmer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.FARMER.get()), new PageTextOnly(1), new PagePicture(2, "page_farmer_crops", 95).addItemsToPage(new ItemStack(Items.WHEAT_SEEDS)).addItemsToPage(new ItemStack(ActuallyItems.CANOLA_SEED.get())), new PagePicture(3, "page_farmer_cactus", 105).addItemsToPage(new ItemStack(Blocks.CACTUS)), new PagePicture(4, "page_farmer_wart", 95).addItemsToPage(new ItemStack(Items.NETHER_WART)), new PagePicture(5, "page_farmer_reeds", 105).addItemsToPage(new ItemStack(Items.REEDS)), new PagePicture(6, "page_farmer_melons", 105).addItemsToPage(new ItemStack(Items.MELON), new ItemStack(Blocks.PUMPKIN), new ItemStack(Blocks.MELON_BLOCK)), new PagePicture(7, "page_farmer_enderlilly", 105), new PagePicture(8, "page_farmer_redorchid", 105), new PageCrafting(4, BlockCrafting.recipeFarmer).setWildcard().setNoText()).setImportant(); - new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.Vertical_DIGGER.get()), new PageTextOnly(1).addTextReplacement("", TileEntityVerticalDigger.ENERGY_USE_PER_BLOCK).addTextReplacement("", TileEntityVerticalDigger.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial(); + new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.VERTICAL_DIGGER.get()), new PageTextOnly(1).addTextReplacement("", TileEntityVerticalDigger.ENERGY_USE_PER_BLOCK).addTextReplacement("", TileEntityVerticalDigger.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial(); new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.COFFEE_MACHINE.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.COFFEE_BEANS.get())).addTextReplacement("", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).addItemsToPage(new ItemStack(ActuallyItems.COFFEE.get())), new PagePicture(3, "page_coffee_machine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setWildcard().setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant(); List list = new ArrayList<>(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java index f9bb892d5..5298efbdf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.mod.tile; +import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.block.Block; @@ -36,7 +37,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE private int oldEnergy; public TileEntityLeafGenerator() { - super(ActuallyTiles.LEAFGENERATOR_TILE.get()); + super(ActuallyBlocks.LEAF_GENERATOR.getTileEntityType()); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLongRangeBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLongRangeBreaker.java index d67bd346e..ca5473437 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLongRangeBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLongRangeBreaker.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.mod.tile; +import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDirectionalBreaker; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; @@ -44,7 +45,7 @@ public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implemen private int currentTime; public TileEntityLongRangeBreaker() { - super(ActuallyTiles.DIRECTIONALBREAKER_TILE.get(), 9); + super(ActuallyBlocks.LONG_RANGE_BREAKER.getTileEntityType(), 9); } @Override @@ -68,7 +69,7 @@ public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implemen @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered && !this.isPulseMode) { if (this.currentTime > 0) { this.currentTime--; @@ -88,24 +89,24 @@ public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implemen private void doWork() { if (this.storage.getEnergyStored() >= ENERGY_USE * RANGE) { - BlockState state = this.world.getBlockState(this.pos); + BlockState state = this.level.getBlockState(this.worldPosition); Direction sideToManipulate = WorldUtil.getDirectionByPistonRotation(state); for (int i = 0; i < RANGE; i++) { - BlockPos coordsBlock = this.pos.offset(sideToManipulate, i + 1); - BlockState breakState = this.world.getBlockState(coordsBlock); + BlockPos coordsBlock = this.worldPosition.relative(sideToManipulate, i + 1); + BlockState breakState = this.level.getBlockState(coordsBlock); Block blockToBreak = breakState.getBlock(); - if (blockToBreak != null && !this.world.isAirBlock(coordsBlock) && this.world.getBlockState(coordsBlock).getBlockHardness(this.world, coordsBlock) > -1.0F) { - List drops = Block.getDrops(breakState, (ServerWorld) this.world, coordsBlock, this.world.getTileEntity(coordsBlock)); - float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.world, coordsBlock); + if (blockToBreak != null && !this.level.isEmptyBlock(coordsBlock) && this.level.getBlockState(coordsBlock).getDestroySpeed(this.level, coordsBlock) > -1.0F) { + List drops = Block.getDrops(breakState, (ServerWorld) this.level, coordsBlock, this.level.getBlockEntity(coordsBlock)); + float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.level, coordsBlock); - if (chance > 0 && this.world.rand.nextFloat() <= chance) { + if (chance > 0 && this.level.random.nextFloat() <= chance) { if (StackUtil.canAddAll(this.inv, drops, false)) { - this.world.playEvent(2001, coordsBlock, Block.getStateId(this.world.getBlockState(coordsBlock))); - this.world.setBlockState(coordsBlock, Blocks.AIR.getDefaultState()); + this.level.levelEvent(2001, coordsBlock, Block.getId(this.level.getBlockState(coordsBlock))); + this.level.setBlockAndUpdate(coordsBlock, Blocks.AIR.defaultBlockState()); StackUtil.addAll(this.inv, drops, false); this.storage.extractEnergyInternal(ENERGY_USE, false); - this.markDirty(); + this.setChanged(); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityVerticalDigger.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityVerticalDigger.java index e485960c9..bb9e066d3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityVerticalDigger.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityVerticalDigger.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.mod.tile; +import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner; import de.ellpeck.actuallyadditions.mod.items.ItemDrill; @@ -58,7 +59,7 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements private int oldCheckZ; public TileEntityVerticalDigger() { - super(ActuallyTiles.MINER_TILE.get(), 9); + super(ActuallyBlocks.VERTICAL_DIGGER.getTileEntityType(), 9); } @Override @@ -90,13 +91,13 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered && this.ticksElapsed % 5 == 0) { if (this.checkY != 0) { - int range = TileEntityPhantomFace.upgradeRange(DEFAULT_RANGE, this.world, this.pos); + int range = TileEntityPhantomface.upgradeRange(DEFAULT_RANGE, this.level, this.worldPosition); if (this.checkY < 0) { - this.checkY = this.pos.getY() - 1; + this.checkY = this.worldPosition.getY() - 1; this.checkX = -range; this.checkZ = -range; } @@ -131,23 +132,23 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements ? 3 : 1); if (this.storage.getEnergyStored() >= actualUse) { - BlockPos pos = new BlockPos(this.pos.getX() + this.checkX, this.checkY, this.pos.getZ() + this.checkZ); + BlockPos pos = new BlockPos(this.worldPosition.getX() + this.checkX, this.checkY, this.worldPosition.getZ() + this.checkZ); - BlockState state = this.world.getBlockState(pos); + BlockState state = this.level.getBlockState(pos); Block block = state.getBlock(); - ItemStack stack = block.getPickBlock(state, new BlockRayTraceResult(new Vector3d(0, 0, 0), Direction.DOWN, pos, false), this.world, pos, FakePlayerFactory.getMinecraft((ServerWorld) this.world)); - if (!block.isAir(this.world.getBlockState(pos), this.world, pos)) { - if (block.getHarvestLevel(this.world.getBlockState(pos)) <= ItemDrill.HARVEST_LEVEL && state.getBlockHardness(this.world, pos) >= 0F && !(block instanceof IFluidBlock) && this.isMinable(block, stack)) { - List drops = Block.getDrops(state, (ServerWorld) this.world, pos, this.world.getTileEntity(pos)); - float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.world, pos); + ItemStack stack = block.getPickBlock(state, new BlockRayTraceResult(new Vector3d(0, 0, 0), Direction.DOWN, pos, false), this.level, pos, FakePlayerFactory.getMinecraft((ServerWorld) this.level)); + if (!block.isAir(this.level.getBlockState(pos), this.level, pos)) { + if (block.getHarvestLevel(this.level.getBlockState(pos)) <= ItemDrill.HARVEST_LEVEL && state.getDestroySpeed(this.level, pos) >= 0F && !(block instanceof IFluidBlock) && this.isMinable(block, stack)) { + List drops = Block.getDrops(state, (ServerWorld) this.level, pos, this.level.getBlockEntity(pos)); + float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.level, pos); - if (chance > 0 && this.world.rand.nextFloat() <= chance) { + if (chance > 0 && this.level.random.nextFloat() <= chance) { if (StackUtil.canAddAll(this.inv, drops, false)) { - this.world.playEvent(2001, pos, Block.getStateId(this.world.getBlockState(pos))); - this.world.setBlockState(pos, Blocks.AIR.getDefaultState()); + this.level.levelEvent(2001, pos, Block.getId(this.level.getBlockState(pos))); + this.level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); StackUtil.addAll(this.inv, drops, false); - this.markDirty(); + this.setChanged(); this.storage.extractEnergyInternal(actualUse, false); this.shootParticles(pos.getX(), pos.getY(), pos.getZ()); @@ -196,7 +197,7 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements } private void shootParticles(int endX, int endY, int endZ) { - AssetUtil.spawnLaserWithTimeServer(this.world, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{65F / 255F, 150F / 255F, 2F / 255F}, 10, 120, 0.1F, 0.8F); + AssetUtil.spawnLaserWithTimeServer(this.level, this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ(), endX, endY, endZ, new float[]{65F / 255F, 150F / 255F, 2F / 255F}, 10, 120, 0.1F, 0.8F); } private boolean isBlacklisted(Block block) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java index cc4cc229b..6db2c283d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience; @@ -50,7 +51,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I private int singlePointAmount; public TileEntityXPSolidifier() { - super(ActuallyTiles.XPSOLIDIFIER_TILE.get(), 2); + super(ActuallyBlocks.XP_SOLIDIFIER.getTileEntityType(), 2); } /*