diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java index a2b888f13..4512ed5a2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java @@ -28,10 +28,10 @@ public class BlockRecipeGenerator extends RecipeProvider { //Farmer Recipe.shaped(ActuallyBlocks.FARMER.get()) .pattern("ISI", "SCS", "ISI") - .define('I', ActuallyBlocks.CRYSTAL_ENORI.get()) - .define('C', ActuallyBlocks.IRON_CASING.get()) - .define('S', Tags.Items.SEEDS) - .save(consumer); + .key('I', ActuallyBlocks.ENORI_CRYSTAL.getItem()) + .key('C', ActuallyBlocks.IRON_CASING.get()) + .key('S', Tags.Items.SEEDS) + .build(consumer); //Empowerer Recipe.shaped(ActuallyBlocks.EMPOWERER.get()) @@ -76,7 +76,7 @@ public class BlockRecipeGenerator extends RecipeProvider { .save(consumer); //Vertical Digger - Recipe.shaped(ActuallyBlocks.MINER.get()) + Recipe.shaped(ActuallyBlocks.Vertical_DIGGER.get()) .pattern("IRI", "RCR", "IDI") .define('R', Tags.Items.STORAGE_BLOCKS_REDSTONE) .define('I', ActuallyBlocks.IRON_CASING.get()) @@ -132,15 +132,59 @@ public class BlockRecipeGenerator extends RecipeProvider { // Atomic Reconstructor Recipe.shaped(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()) .pattern("IRI", "RCR", "IRI") - .define('R', Tags.Items.DUSTS_REDSTONE) - .define('I', Tags.Items.INGOTS_IRON) - .define('C', ActuallyBlocks.IRON_CASING.get()) - .save(consumer); + .key('R', Tags.Items.DUSTS_REDSTONE) + .key('I', Tags.Items.INGOTS_IRON) + .key('C', ActuallyBlocks.IRON_CASING.get()) + .build(consumer); + + // Laser Relay + Recipe.shaped(ActuallyBlocks.LASER_RELAY.get(), 4) + .pattern("OBO","RCR","OBO") + .key('B', Tags.Items.STORAGE_BLOCKS_REDSTONE) + .key('O', Tags.Items.OBSIDIAN) + .key('R', ActuallyItems.RESTONIA_CRYSTAL.get()) + .key('C', ActuallyItems.COIL_ADVANCED.get()) + .build(consumer); + + // Advanced Laser Relay + Recipe.shaped(ActuallyBlocks.LASER_RELAY_ADVANCED.get()) + .pattern(" I ", "XRX", " I ") + .key('I', ActuallyItems.ENORI_CRYSTAL.get()) + .key('R', ActuallyBlocks.LASER_RELAY.get()) + .key('X', ActuallyItems.RESTONIA_CRYSTAL.get()) + .build(consumer); + + // Extreme Laser Relay + Recipe.shaped(ActuallyBlocks.LASER_RELAY_EXTREME.get()) + .pattern(" I ", "XRX", " I ") + .key('I', ActuallyItems.DIAMATINE_EMPOWERED_CRYSTAL.get()) + .key('R', ActuallyBlocks.LASER_RELAY_ADVANCED.get()) + .key('X', ActuallyItems.RESTONIA_CRYSTAL.get()) + .build(consumer); + + // Whitelist Item Laser Relay + Recipe.shapeless(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.get()) + .ingredients(ActuallyBlocks.LASER_RELAY_ITEM.get(), ActuallyItems.COIL_ADVANCED.get(), ActuallyItems.BLACK_QUARTZ.get()) + .build(consumer); + + // Item Interface + Recipe.shaped(ActuallyBlocks.ITEM_VIEWER.get()) + .pattern("OBO", "RCR", "OBO") + .key('B', Tags.Items.DUSTS_REDSTONE) + .key('O', ActuallyItems.COIL.get()) + .key('R', ActuallyItems.RESTONIA_CRYSTAL.get()) + .key('C', Tags.Items.CHESTS_WOODEN) + .build(consumer); + + // Hopping Item Interface + Recipe.shapeless(ActuallyBlocks.ITEM_VIEWER_HOPPING.get()).ingredients(ActuallyBlocks.ITEM_VIEWER.get()).build(consumer); + + } @Override - protected void saveAdvancement(DirectoryCache cache, JsonObject cache2, Path advancementJson) { - //Nope... + protected void saveRecipeAdvancement(DirectoryCache cache, JsonObject cache2, Path advancementJson) { + //Nope... maybe later... } public static class Recipe { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index 0c95ff3f4..2f256afb6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -18,7 +18,6 @@ import de.ellpeck.actuallyadditions.mod.data.WorldData; import de.ellpeck.actuallyadditions.mod.entity.InitEntities; import de.ellpeck.actuallyadditions.mod.event.CommonEvents; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; -import de.ellpeck.actuallyadditions.mod.gen.AAWorldGen; import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; @@ -82,7 +81,7 @@ public class ActuallyAdditions { IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); ActuallyBlocks.BLOCKS.register(eventBus); - ActuallyTiles.TILES.register(eventBus); + ActuallyBlocks.TILES.register(eventBus); ActuallyContainers.CONTAINERS.register(eventBus); MinecraftForge.EVENT_BUS.addListener(this::serverStarted); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/AABlockItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/AABlockItem.java new file mode 100644 index 000000000..1c65933a2 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/AABlockItem.java @@ -0,0 +1,10 @@ +package de.ellpeck.actuallyadditions.mod.blocks; + +import net.minecraft.block.Block; +import net.minecraft.item.BlockItem; + +public class AABlockItem extends BlockItem { + public AABlockItem(Block blockIn, Properties builder) { + super(blockIn, builder); + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlock.java new file mode 100644 index 000000000..4a6878158 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlock.java @@ -0,0 +1,64 @@ +package de.ellpeck.actuallyadditions.mod.blocks; + +import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.SlabBlock; +import net.minecraft.block.StairsBlock; +import net.minecraft.item.Item; + +import java.util.function.Supplier; + +/** + * Using a custom class here to declare common rules between all of our blocks. + * This also provides a simple instance of check for our blocks. + * + * @implNote Every block should extend this class in some form or use the {@link IActuallyBlock} + */ +public class ActuallyBlock extends Block implements IActuallyBlock { + public ActuallyBlock(Properties properties) { + super(properties); + } + + @Override + public AABlockItem createBlockItem() { + return new AABlockItem(this, this.getItemProperties()); + } + + @Override + public Item.Properties getItemProperties() { + return new Item.Properties().group(ActuallyAdditions.GROUP); + } + + public static class Stairs extends StairsBlock implements IActuallyBlock { + public Stairs(Supplier state, Properties properties) { + super(state, properties); + } + + @Override + public AABlockItem createBlockItem() { + return new AABlockItem(this, this.getItemProperties()); + } + + @Override + public Item.Properties getItemProperties() { + return new Item.Properties().group(ActuallyAdditions.GROUP); + } + } + + public static class Slabs extends SlabBlock implements IActuallyBlock { + public Slabs(Properties properties) { + super(properties); + } + + @Override + public AABlockItem createBlockItem() { + return new AABlockItem(this, this.getItemProperties()); + } + + @Override + public Item.Properties getItemProperties() { + return new Item.Properties().group(ActuallyAdditions.GROUP); + } + } +} 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 9e9e37443..22753f9bc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java @@ -13,9 +13,13 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals; +import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals; +import de.ellpeck.actuallyadditions.mod.tile.*; +import de.ellpeck.actuallyadditions.registration.AABlockReg; import net.minecraft.block.*; import net.minecraft.block.material.Material; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntityType; import net.minecraftforge.common.ToolType; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; @@ -23,134 +27,247 @@ import net.minecraftforge.registries.ForgeRegistries; public final class ActuallyBlocks { public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID); + public static final DeferredRegister> TILES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, ActuallyAdditions.MODID); - public static final AbstractBlock.Properties miscBlockProperties = AbstractBlock.Properties.of(Material.STONE).harvestLevel(1).harvestTool(ToolType.PICKAXE).strength(1.5f, 10f); - @Deprecated - public static final RegistryObject blockMisc = BLOCKS.register("misc", () -> new Block(miscBlockProperties)); // TODO this isnt a real block? - public static final RegistryObject WOOD_CASING = BLOCKS.register("wood_casing", () -> new Block(miscBlockProperties)); - public static final RegistryObject IRON_CASING = BLOCKS.register("iron_casing", () -> new Block(miscBlockProperties)); - public static final RegistryObject ENDER_CASING = BLOCKS.register("ender_casing", () -> new Block(miscBlockProperties)); - public static final RegistryObject LAVA_CASING = BLOCKS.register("lava_casing", () -> new Block(miscBlockProperties)); - public static final RegistryObject WILD_PLANT = BLOCKS.register("wild", BlockWildPlant::new); - public static final RegistryObject FEEDER = BLOCKS.register("feeder", BlockFeeder::new); - public static final RegistryObject GRINDER = BLOCKS.register("grinder", () -> new BlockGrinder(false)); - public static final RegistryObject GRINDER_DOUBLE = BLOCKS.register("grinder_double", () -> new BlockGrinder(true)); - - public static final RegistryObject CRYSTAL_CLUSTER_REDSTONE = BLOCKS.register("crystal_cluster_redstone", () -> new BlockCrystalCluster(TheCrystals.REDSTONE)); - public static final RegistryObject CRYSTAL_CLUSTER_LAPIS = BLOCKS.register("crystal_cluster_lapis", () -> new BlockCrystalCluster(TheCrystals.LAPIS)); - public static final RegistryObject CRYSTAL_CLUSTER_DIAMOND = BLOCKS.register("crystal_cluster_diamond", () -> new BlockCrystalCluster(TheCrystals.DIAMOND)); - public static final RegistryObject CRYSTAL_CLUSTER_COAL = BLOCKS.register("crystal_cluster_coal", () -> new BlockCrystalCluster(TheCrystals.COAL)); - public static final RegistryObject CRYSTAL_CLUSTER_EMERALD = BLOCKS.register("crystal_cluster_emerald", () -> new BlockCrystalCluster(TheCrystals.EMERALD)); - public static final RegistryObject CRYSTAL_CLUSTER_IRON = BLOCKS.register("crystal_cluster_iron", () -> new BlockCrystalCluster(TheCrystals.IRON)); - public static final RegistryObject BATTERY_BOX = BLOCKS.register("battery_box", BlockBatteryBox::new); - public static final RegistryObject ITEM_VIEWER_HOPPING = BLOCKS.register("item_viewer_hopping", BlockItemViewerHopping::new); - public static final RegistryObject FARMER = BLOCKS.register("farmer", BlockFarmer::new); - public static final RegistryObject BIOREACTOR = BLOCKS.register("bio_reactor", BlockBioReactor::new); - public static final RegistryObject EMPOWERER = BLOCKS.register("empowerer", BlockEmpowerer::new); - public static final RegistryObject TINY_TORCH = BLOCKS.register("tiny_torch", BlockTinyTorch::new); - public static final RegistryObject SHOCK_SUPPRESSOR = BLOCKS.register("shock_suppressor", BlockShockSuppressor::new); - public static final RegistryObject DISPLAY_STAND = BLOCKS.register("display_stand", BlockDisplayStand::new); - public static final RegistryObject PLAYER_INTERFACE = BLOCKS.register("player_interface", BlockPlayerInterface::new); - public static final RegistryObject ITEM_VIEWER = BLOCKS.register("item_viewer", BlockItemViewer::new); - public static final RegistryObject FIREWORK_BOX = BLOCKS.register("firework_box", BlockFireworkBox::new); - public static final RegistryObject MINER = BLOCKS.register("miner", BlockVerticalDigger::new); - public static final RegistryObject ATOMIC_RECONSTRUCTOR = BLOCKS.register("atomic_reconstructor", BlockAtomicReconstructor::new); - public static final RegistryObject LASER_RELAY = BLOCKS.register("laser_relay", () -> new BlockLaserRelay(BlockLaserRelay.Type.ENERGY_BASIC)); - public static final RegistryObject LASER_RELAY_ADVANCED = BLOCKS.register("laser_relay_advanced", () -> new BlockLaserRelay(BlockLaserRelay.Type.ENERGY_ADVANCED)); - public static final RegistryObject LASER_RELAY_EXTREME = BLOCKS.register("laser_relay_extreme", () -> new BlockLaserRelay(BlockLaserRelay.Type.ENERGY_EXTREME)); - public static final RegistryObject LASER_RELAY_FLUIDS = BLOCKS.register("laser_relay_fluids", () -> new BlockLaserRelay(BlockLaserRelay.Type.FLUIDS)); - public static final RegistryObject LASER_RELAY_ITEM = BLOCKS.register("laser_relay_item", () -> new BlockLaserRelay(BlockLaserRelay.Type.ITEM)); - public static final RegistryObject LASER_RELAY_ITEM_WHITELIST = BLOCKS.register("laser_relay_item_whitelist", () -> new BlockLaserRelay(BlockLaserRelay.Type.ITEM_WHITELIST)); - public static final RegistryObject RANGED_COLLECTOR = BLOCKS.register("ranged_collector", BlockRangedCollector::new); - public static final RegistryObject DIRECTIONAL_BREAKER = BLOCKS.register("directional_breaker", BlockDirectionalBreaker::new); - public static final RegistryObject LEAF_GENERATOR = BLOCKS.register("leaf_generator", BlockLeafGenerator::new); - public static final RegistryObject XP_SOLIDIFIER = BLOCKS.register("xp_solidifier", BlockXPSolidifier::new); - public static final RegistryObject ETHETIC_GREEN_BLOCK = BLOCKS.register("ethetic_green_block", BlockGeneric::new); - public static final RegistryObject ETHETIC_WHITE_BLOCK = BLOCKS.register("ethetic_white_block", BlockGeneric::new); - public static final RegistryObject ETHETIC_GREEN_STAIRS = BLOCKS.register("ethetic_green_stairs", () -> new StairsBlock(() -> ETHETIC_GREEN_BLOCK.get().defaultBlockState(), AbstractBlock.Properties.copy(ETHETIC_GREEN_BLOCK.get()))); - public static final RegistryObject ETHETIC_WHITE_STAIRS = BLOCKS.register("ethetic_white_stairs", () -> new StairsBlock(() -> ETHETIC_WHITE_BLOCK.get().defaultBlockState(), AbstractBlock.Properties.copy(ETHETIC_WHITE_BLOCK.get()))); - public static final RegistryObject ETHETIC_GREEN_SLAB = BLOCKS.register("ethetic_green_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(ETHETIC_GREEN_BLOCK.get()))); - public static final RegistryObject ETHETIC_WHITE_SLAB = BLOCKS.register("ethetic_white_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(ETHETIC_WHITE_BLOCK.get()))); - public static final RegistryObject ETHETIC_GREEN_WALL = BLOCKS.register("ethetic_green_wall", () -> new WallBlock(AbstractBlock.Properties.copy(ETHETIC_GREEN_BLOCK.get()))); - public static final RegistryObject ETHETIC_WHITE_WALL = BLOCKS.register("ethetic_white_wall", () -> new WallBlock(AbstractBlock.Properties.copy(ETHETIC_WHITE_BLOCK.get()))); + private static final Item.Properties defaultBlockItemProperties = new Item.Properties().group(ActuallyAdditions.GROUP).maxStackSize(64); - public static final RegistryObject CRYSTAL_ENORI = BLOCKS.register("crystal_enori_block", () -> new BlockCrystal(false)); - public static final RegistryObject CRYSTAL_RESTONIA = BLOCKS.register("crystal_restonia_block", () -> new BlockCrystal(false)); - public static final RegistryObject CRYSTAL_PALIS = BLOCKS.register("crystal_palis_block", () -> new BlockCrystal(false)); - public static final RegistryObject CRYSTAL_DIAMATINE = BLOCKS.register("crystal_diamatine_block", () -> new BlockCrystal(false)); - public static final RegistryObject CRYSTAL_VOID = BLOCKS.register("crystal_void_block", () -> new BlockCrystal(false)); - public static final RegistryObject CRYSTAL_EMERADIC = BLOCKS.register("crystal_emeradic_block", () -> new BlockCrystal(false)); + public static final AbstractBlock.Properties miscBlockProperties = AbstractBlock.Properties.create(Material.ROCK).harvestLevel(1).harvestTool(ToolType.PICKAXE).hardnessAndResistance(1.5f, 10f); - public static final RegistryObject CRYSTAL_EMPOWERED_ENORI = BLOCKS.register("crystal_enori_empowered_block", () -> new BlockCrystal(true)); - public static final RegistryObject CRYSTAL_EMPOWERED_RESTONIA = BLOCKS.register("crystal_restonia_empowered_block", () -> new BlockCrystal(true)); - public static final RegistryObject CRYSTAL_EMPOWERED_PALIS = BLOCKS.register("crystal_palis_empowered_block", () -> new BlockCrystal(true)); - public static final RegistryObject CRYSTAL_EMPOWERED_DIAMATINE = BLOCKS.register("crystal_diamatine_empowered_block", () -> new BlockCrystal(true)); - public static final RegistryObject CRYSTAL_EMPOWERED_VOID = BLOCKS.register("crystal_void_empowered_block", () -> new BlockCrystal(true)); - public static final RegistryObject CRYSTAL_EMPOWERED_EMERADIC = BLOCKS.register("crystal_emeradic_empowered_block", () -> new BlockCrystal(true)); + // Casings + public static final AABlockReg WOOD_CASING = new AABlockReg<>("wood_casing", () -> new ActuallyBlock(miscBlockProperties), ActuallyBlock::createBlockItem); + public static final AABlockReg IRON_CASING = new AABlockReg<>("iron_casing", () -> new ActuallyBlock(miscBlockProperties), ActuallyBlock::createBlockItem); + public static final AABlockReg ENDER_CASING = new AABlockReg<>("ender_casing", () -> new ActuallyBlock(miscBlockProperties), ActuallyBlock::createBlockItem); + public static final AABlockReg LAVA_FACTORY_CASING = new AABlockReg<>("lava_factory_casing", () -> new ActuallyBlock(miscBlockProperties), ActuallyBlock::createBlockItem); - public static final RegistryObject LAMP_WHITE = BLOCKS.register("lamp_white_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_ORANGE = BLOCKS.register("lamp_orange_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_MAGENTA = BLOCKS.register("lamp_magenta_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_LIGHT_BLUE = BLOCKS.register("lamp_light_blue_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_YELLOW = BLOCKS.register("lamp_yellow_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_LIME = BLOCKS.register("lamp_lime_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_PINK = BLOCKS.register("lamp_pink_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_GRAY = BLOCKS.register("lamp_gray_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_LIGHT_GRAY = BLOCKS.register("lamp_light_gray_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_CYAN = BLOCKS.register("lamp_cyan_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_PURPLE = BLOCKS.register("lamp_purple_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_BLUE = BLOCKS.register("lamp_blue_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_BROWN = BLOCKS.register("lamp_brown_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_GREEN = BLOCKS.register("lamp_green_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_RED = BLOCKS.register("lamp_red_block", BlockColoredLamp::new); - public static final RegistryObject LAMP_BLACK = BLOCKS.register("lamp_black_block", BlockColoredLamp::new); + // Machines + public static final AABlockReg FEEDER = new AABlockReg<>("feeder", BlockFeeder::new, (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityFeeder::new); + public static final AABlockReg CRUSHER = new AABlockReg<>("crusher", () -> new BlockCrusher(false), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityCrusher::new); + public static final AABlockReg CRUSHER_DOUBLE = new AABlockReg<>("crusher_double", () -> new BlockCrusher(false), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityCrusherDouble::new); - // public static final RegistryObject blockColoredLamp = BLOCKS.register("colored_lamp", () -> new BlockColoredLamp()); - // public static final RegistryObject blockColoredLampOn = BLOCKS.register("colored_lamp_on", () -> new BlockColoredLamp()); - public static final RegistryObject LAMP_POWERER = BLOCKS.register("lamp_powerer", BlockLampPowerer::new); - // public static final RegistryObject blockTreasureChest = BLOCKS.register("treasure_chest", BlockTreasureChest::new); - public static final RegistryObject ENERGIZER = BLOCKS.register("energizer", () -> new BlockEnergizer(true)); - public static final RegistryObject ENERVATOR = BLOCKS.register("enervator", () -> new BlockEnergizer(false)); - public static final RegistryObject LAVA_FACTORY_CONTROLLER = BLOCKS.register("lava_factory_controller", BlockLavaFactoryController::new); - public static final RegistryObject CANOLA_PRESS = BLOCKS.register("canola_press", BlockCanolaPress::new); - public static final RegistryObject PHANTOMFACE = BLOCKS.register("phantomface", () -> new BlockPhantom(BlockPhantom.Type.FACE)); - public static final RegistryObject PHANTOM_PLACER = BLOCKS.register("phantom_placer", () -> new BlockPhantom(BlockPhantom.Type.PLACER)); - public static final RegistryObject PHANTOM_LIQUIFACE = BLOCKS.register("phantom_liquiface", () -> new BlockPhantom(BlockPhantom.Type.LIQUIFACE)); - public static final RegistryObject PHANTOM_ENERGYFACE = BLOCKS.register("phantom_energyface", () -> new BlockPhantom(BlockPhantom.Type.ENERGYFACE)); - public static final RegistryObject PHANTOM_REDSTONEFACE = BLOCKS.register("phantom_redstoneface", () -> new BlockPhantom(BlockPhantom.Type.REDSTONEFACE)); - public static final RegistryObject PHANTOM_BREAKER = BLOCKS.register("phantom_breaker", () -> new BlockPhantom(BlockPhantom.Type.BREAKER)); - public static final RegistryObject COAL_GENERATOR = BLOCKS.register("coal_generator", BlockCoalGenerator::new); - public static final RegistryObject OIL_GENERATOR = BLOCKS.register("oil_generator", BlockOilGenerator::new); - public static final RegistryObject FERMENTING_BARREL = BLOCKS.register("fermenting_barrel", BlockFermentingBarrel::new); - public static final RegistryObject RICE = BLOCKS.register("rice", () -> new BlockPlant(ActuallyItems.RICE_SEED.get()));// TODO: [port][replace] ensure values match these new BlockPlant(1, 2)); - public static final RegistryObject CANOLA = BLOCKS.register("canola", () -> new BlockPlant(ActuallyItems.CANOLA_SEED.get()));// TODO: [port][replace] ensure values match these new BlockPlant(2, 3)); - public static final RegistryObject FLAX = BLOCKS.register("flax", () -> new BlockPlant(ActuallyItems.FLAX_SEED.get()));// TODO: [port][replace] ensure values match these new BlockPlant(2, 4)); - public static final RegistryObject COFFEE = BLOCKS.register("coffee", () -> new BlockPlant(ActuallyItems.COFFEE_SEED.get()));// TODO: [port][replace] ensure values match these new BlockPlant(2, 2)); - public static final RegistryObject FURNACE_DOUBLE = BLOCKS.register("furnace_double", BlockFurnaceDouble::new); - public static final RegistryObject INPUTTER = BLOCKS.register("inputter", () -> new BlockInputter(false)); - public static final RegistryObject INPUTTER_ADVANCED = BLOCKS.register("inputter_advanced", () -> new BlockInputter(true)); - // public static final RegistryObject blockFurnaceSolar = BLOCKS.register("furnace_solar", BlockFurnaceSolar::new); - public static final RegistryObject HEAT_COLLECTOR = BLOCKS.register("heat_collector", BlockHeatCollector::new); - public static final RegistryObject GREENHOUSE_GLASS = BLOCKS.register("greenhouse_glass", BlockGreenhouseGlass::new); - public static final RegistryObject BREAKER = BLOCKS.register("breaker", () -> new BlockBreaker(false)); - public static final RegistryObject PLACER = BLOCKS.register("placer", () -> new BlockBreaker(true)); - public static final RegistryObject DROPPER = BLOCKS.register("dropper", BlockDropper::new); - public static final RegistryObject FLUID_PLACER = BLOCKS.register("fluid_placer", () -> new BlockFluidCollector(true)); - public static final RegistryObject FLUID_COLLECTOR = BLOCKS.register("fluid_collector", () -> new BlockFluidCollector(false)); - public static final RegistryObject COFFEE_MACHINE = BLOCKS.register("coffee_machine", BlockCoffeeMachine::new); - public static final RegistryObject PHANTOM_BOOSTER = BLOCKS.register("phantom_booster", BlockPhantomBooster::new); - public static final RegistryObject BLACK_QUARTZ_BLOCK = BLOCKS.register("black_quartz_block", BlockGeneric::new); - public static final RegistryObject BLACK_QUARTZ_PILLAR_BLOCK = BLOCKS.register("black_quartz_pillar_block", BlockGeneric::new); - public static final RegistryObject CHISELED_BLACK_QUARTZ_BLOCK = BLOCKS.register("chiseled_black_quartz_block", BlockGeneric::new); - public static final RegistryObject BLACK_QUARTZ_WALL = BLOCKS.register("black_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.copy(blockMisc.get()))); - public static final RegistryObject CHISELED_BLACK_QUARTZ_WALL = BLOCKS.register("chiseled_black_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.copy(blockMisc.get()))); - public static final RegistryObject BLACK_QUARTZ_PILLAR_WALL = BLOCKS.register("black_quartz_pillar_wall", () -> new WallBlock(AbstractBlock.Properties.copy(blockMisc.get()))); - public static final RegistryObject BLACK_QUARTZ_STAIR = BLOCKS.register("black_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().defaultBlockState(), AbstractBlock.Properties.copy(blockMisc.get()))); - public static final RegistryObject CHISELED_BLACK_QUARTZ_STAIR = BLOCKS.register("chiseled_black_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().defaultBlockState(), AbstractBlock.Properties.copy(blockMisc.get()))); - public static final RegistryObject BLACK_QUARTZ_PILLAR_STAIR = BLOCKS.register("black_quartz_pillar_stair", () -> new StairsBlock(() -> blockMisc.get().defaultBlockState(), AbstractBlock.Properties.copy(blockMisc.get()))); - public static final RegistryObject BLACK_QUARTZ_SLAB = BLOCKS.register("black_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(blockMisc.get()))); - public static final RegistryObject CHISELED_BLACK_QUARTZ_SLAB = BLOCKS.register("chiseled_black_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(blockMisc.get()))); - public static final RegistryObject BLACK_QUARTZ_PILLAR_SLAB = BLOCKS.register("black_quartz_pillar_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(blockMisc.get()))); + public static final AABlockReg ENERGIZER = new AABlockReg<>("energizer", () -> new BlockEnergizer(true), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityEnergizer::new); + public static final AABlockReg ENERVATOR = new AABlockReg<>("enervator", () -> new BlockEnergizer(false), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityEnergizer::new); + + public static final AABlockReg LAVA_FACTORY_CONTROLLER + = new AABlockReg<>("lava_factory_controller", BlockLavaFactoryController::new, (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityLavaFactoryController::new); + + public static final AABlockReg LAMP_POWERER = new AABlockReg<>("lamp_powerer", BlockLampPowerer::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + + public static final AABlockReg CANOLA_PRESS = new AABlockReg<>("canola_press", BlockCanolaPress::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityCanolaPress::new); + + public static final AABlockReg FERMENTING_BARREL = new AABlockReg<>("fermenting_barrel", BlockFermentingBarrel::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityFermentingBarrel::new); + + public static final AABlockReg OIL_GENERATOR = new AABlockReg<>("oil_generator", BlockOilGenerator::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityOilGenerator::new); + + public static final AABlockReg COAL_GENERATOR = new AABlockReg<>("coal_generator", BlockCoalGenerator::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityCoalGenerator::new); + + public static final AABlockReg LEAF_GENERATOR = new AABlockReg<>("leaf_generator", BlockLeafGenerator::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties) , TileEntityLeafGenerator::new); + + public static final AABlockReg XP_SOLIDIFIER = new AABlockReg<>("xp_solidifier", BlockXPSolidifier::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityXPSolidifier::new); + + public static final AABlockReg BREAKER = new AABlockReg<>("breaker", () -> new BlockBreaker(false), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityBreaker::new); + public static final AABlockReg PLACER = new AABlockReg<>("placer", () -> new BlockBreaker(true), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPlacer::new); + public static final AABlockReg DROPPER = new AABlockReg<>("dropper", BlockDropper::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityDropper::new); + public static final AABlockReg FLUID_PLACER = new AABlockReg<>("fluid_placer", () -> new BlockFluidCollector(true), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityFluidCollector::new); + public static final AABlockReg FLUID_COLLECTOR = new AABlockReg<>("fluid_collector", () -> new BlockFluidCollector(false), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityFluidPlacer::new); + + public static final AABlockReg FARMER = new AABlockReg<>("farmer", BlockFarmer::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityFarmer::new); + + 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, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityVerticalDigger::new); + + public static final AABlockReg ATOMIC_RECONSTRUCTOR = new AABlockReg<>("atomic_reconstructor", BlockAtomicReconstructor::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityAtomicReconstructor::new); + public static final AABlockReg RANGED_COLLECTOR = new AABlockReg<>("ranged_collector", BlockRangedCollector::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityRangedCollector::new); + public static final AABlockReg LONG_RANGE_BREAKER = new AABlockReg<>("long_range_breaker", BlockLongRangeBreaker::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityLongRangeBreaker::new); + + public static final AABlockReg COFFEE_MACHINE = new AABlockReg<>("coffee_machine", BlockCoffeeMachine::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityCoffeeMachine::new); + public static final AABlockReg POWERED_FURNACE = new AABlockReg<>("powered_furnace", BlockPoweredFurnace::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPoweredFurnace::new); + + + // Crystal Blocks + public static final AABlockReg ENORI_CRYSTAL = new AABlockReg<>("enori_crystal_block", () -> new BlockCrystal(false), BlockCrystal::createBlockItem); + public static final AABlockReg RESTONIA_CRYSTAL = new AABlockReg<>("restonia_crystal_block", () -> new BlockCrystal(false), BlockCrystal::createBlockItem); + public static final AABlockReg PALIS_CRYSTAL = new AABlockReg<>("palis_crystal_block", () -> new BlockCrystal(false), BlockCrystal::createBlockItem); + public static final AABlockReg DIAMATINE_CRYSTAL = new AABlockReg<>("diamatine_crystal_block", () -> new BlockCrystal(false), BlockCrystal::createBlockItem); + public static final AABlockReg VOID_CRYSTAL = new AABlockReg<>("void_crystal_block", () -> new BlockCrystal(false), BlockCrystal::createBlockItem); + public static final AABlockReg EMERADIC_CRYSTAL = new AABlockReg<>("emeradic_crystal_block", () -> new BlockCrystal(false), BlockCrystal::createBlockItem); + // Empowered Crystal Blocks + public static final AABlockReg EMPOWERED_ENORI_CRYSTAL = new AABlockReg<>("empowered_enori_crystal_block", () -> new BlockCrystal(true), BlockCrystal::createBlockItem); + public static final AABlockReg EMPOWERED_RESTONIA_CRYSTAL = new AABlockReg<>("empowered_restonia_crystal_block", () -> new BlockCrystal(true), BlockCrystal::createBlockItem); + public static final AABlockReg EMPOWERED_PALIS_CRYSTAL = new AABlockReg<>("empowered_palis_crystal_block", () -> new BlockCrystal(true), BlockCrystal::createBlockItem); + public static final AABlockReg EMPOWERED_DIAMATINE_CRYSTAL = new AABlockReg<>("empowered_diamatine_crystal_block", () -> new BlockCrystal(true), BlockCrystal::createBlockItem); + public static final AABlockReg EMPOWERED_VOID_CRYSTAL = new AABlockReg<>("empowered_void_crystal_block", () -> new BlockCrystal(true), BlockCrystal::createBlockItem); + public static final AABlockReg EMPOWERED_EMERADIC_CRYSTAL = new AABlockReg<>("empowered_emeradic_crystal_block", () -> new BlockCrystal(true), BlockCrystal::createBlockItem); + // Crystal Clusters + public static final AABlockReg ENORI_CRYSTAL_CLUSTER = new AABlockReg<>("enori_crystal_cluster", () -> new CrystalClusterBlock(Crystals.IRON), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg RESTONIA_CRYSTAL_CLUSTER = new AABlockReg<>("restonia_crystal_cluster", () -> new CrystalClusterBlock(Crystals.REDSTONE), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg PALIS_CRYSTAL_CLUSTER = new AABlockReg<>("palis_crystal_cluster", () -> new CrystalClusterBlock(Crystals.LAPIS), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg DIAMATINE_CRYSTAL_CLUSTER = new AABlockReg<>("diamatine_crystal_cluster", () -> new CrystalClusterBlock(Crystals.DIAMOND), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg VOID_CRYSTAL_CLUSTER = new AABlockReg<>("void_crystal_cluster", () -> new CrystalClusterBlock(Crystals.COAL), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg EMERADIC_CRYSTAL_CLUSTER = new AABlockReg<>("emeradic_crystal_cluster", () -> new CrystalClusterBlock(Crystals.EMERALD), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + + // LAMPS! SO MANY LAMPS + public static final AABlockReg LAMP_WHITE = new AABlockReg<>("lamp_white", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_ORANGE = new AABlockReg<>("lamp_orange", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_MAGENTA = new AABlockReg<>("lamp_magenta", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_LIGHT_BLUE = new AABlockReg<>("lamp_light_blue", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_YELLOW = new AABlockReg<>("lamp_yellow", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_LIME = new AABlockReg<>("lamp_lime", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_PINK = new AABlockReg<>("lamp_pink", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_GRAY = new AABlockReg<>("lamp_gray", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_LIGHT_GRAY = new AABlockReg<>("lamp_light_gray", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_CYAN = new AABlockReg<>("lamp_cyan", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_PURPLE = new AABlockReg<>("lamp_purple", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_BLUE = new AABlockReg<>("lamp_blue", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_BROWN = new AABlockReg<>("lamp_brown", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_GREEN = new AABlockReg<>("lamp_green", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_RED = new AABlockReg<>("lamp_red", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg LAMP_BLACK = new AABlockReg<>("lamp_black", BlockColoredLamp::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); + + // Empowerer / Display Stands + public static final AABlockReg EMPOWERER = new AABlockReg<>("empowerer", BlockEmpowerer::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityEmpowerer::new); + public static final AABlockReg DISPLAY_STAND = new AABlockReg<>("display_stand", BlockDisplayStand::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityDisplayStand::new); + + // Interface Blocks + public static final AABlockReg PLAYER_INTERFACE = new AABlockReg<>("player_interface", BlockPlayerInterface::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPlayerInterface::new); + public static final AABlockReg ITEM_VIEWER = new AABlockReg<>("item_viewer", BlockItemInterface::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityItemInterface::new); + public static final AABlockReg ITEM_VIEWER_HOPPING = new AABlockReg<>("item_viewer_hopping", BlockItemInterfaceHopping::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityItemInterfaceHopping::new); + + // Phantom stuff + public static final AABlockReg PHANTOM_ITEMFACE = new AABlockReg<>("phantom_itemface", () -> new BlockPhantom(BlockPhantom.Type.ITEMFACE), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPhantomItemface::new); + public static final AABlockReg PHANTOM_PLACER = new AABlockReg<>("phantom_placer", () -> new BlockPhantom(BlockPhantom.Type.PLACER), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPhantomPlacer::new); + public static final AABlockReg PHANTOM_LIQUIFACE = new AABlockReg<>("phantom_liquiface", () -> new BlockPhantom(BlockPhantom.Type.LIQUIFACE), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPhantomLiquiface::new); + public static final AABlockReg PHANTOM_ENERGYFACE = new AABlockReg<>("phantom_energyface", () -> new BlockPhantom(BlockPhantom.Type.ENERGYFACE), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPhantomEnergyface::new); + public static final AABlockReg PHANTOM_REDSTONEFACE = new AABlockReg<>("phantom_redstoneface", () -> new BlockPhantom(BlockPhantom.Type.REDSTONEFACE), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPhantomRedstoneface::new); + public static final AABlockReg PHANTOM_BREAKER = new AABlockReg<>("phantom_breaker", () -> new BlockPhantom(BlockPhantom.Type.BREAKER), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPhantomBreaker::new); + public static final AABlockReg PHANTOM_BOOSTER = new AABlockReg<>("phantom_booster", BlockPhantomBooster::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPhantomBooster::new); + + // Misc Tiles + public static final AABlockReg BATTERY_BOX = new AABlockReg<>("battery_box", BlockBatteryBox::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityBatteryBox::new); + + public static final AABlockReg FIREWORK_BOX = new AABlockReg<>("firework_box", BlockFireworkBox::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityFireworkBox::new); + + public static final AABlockReg SHOCK_SUPPRESSOR = new AABlockReg<>("shock_suppressor", BlockShockSuppressor::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityShockSuppressor::new); + public static final AABlockReg HEAT_COLLECTOR = new AABlockReg<>("heat_collector", BlockHeatCollector::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityHeatCollector::new); + + // Freakin-Lasers + public static final AABlockReg LASER_RELAY = new AABlockReg<>("laser_relay", () -> new BlockLaserRelay(BlockLaserRelay.Type.ENERGY_BASIC), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityLaserRelayEnergy::new); + public static final AABlockReg LASER_RELAY_ADVANCED = new AABlockReg<>("laser_relay_advanced", () -> new BlockLaserRelay(BlockLaserRelay.Type.ENERGY_ADVANCED), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityLaserRelayEnergyAdvanced::new); + public static final AABlockReg LASER_RELAY_EXTREME = new AABlockReg<>("laser_relay_extreme", () -> new BlockLaserRelay(BlockLaserRelay.Type.ENERGY_EXTREME), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityLaserRelayEnergyExtreme::new); + public static final AABlockReg LASER_RELAY_FLUIDS = new AABlockReg<>("laser_relay_fluids", () -> new BlockLaserRelay(BlockLaserRelay.Type.FLUIDS), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityLaserRelayFluids::new); + public static final AABlockReg LASER_RELAY_ITEM = new AABlockReg<>("laser_relay_item", () -> new BlockLaserRelay(BlockLaserRelay.Type.ITEM), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityLaserRelayItem::new); + public static final AABlockReg LASER_RELAY_ITEM_ADVANCED = new AABlockReg<>("laser_relay_item_advanced", () -> new BlockLaserRelay(BlockLaserRelay.Type.ITEM_WHITELIST), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityLaserRelayItemAdvanced::new); + + + + // Misc building blocks + public static final AABlockReg ETHETIC_GREEN_BLOCK = new AABlockReg<>("ethetic_green_block", () -> new ActuallyBlock(miscBlockProperties), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg ETHETIC_WHITE_BLOCK = new AABlockReg<>("ethetic_white_block", () -> new ActuallyBlock(miscBlockProperties), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_BLOCK = new AABlockReg<>("black_quartz_block", () -> new ActuallyBlock(miscBlockProperties), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_PILLAR_BLOCK = new AABlockReg<>("black_quartz_pillar_block", () -> new ActuallyBlock(miscBlockProperties), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg CHISELED_BLACK_QUARTZ_BLOCK = new AABlockReg<>("chiseled_black_quartz_block", () -> new ActuallyBlock(miscBlockProperties), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + + public static final AABlockReg ETHETIC_GREEN_STAIRS = new AABlockReg<>("ethetic_green_stairs", () -> new StairsBlock(() -> ETHETIC_GREEN_BLOCK.get().getDefaultState(), AbstractBlock.Properties.from(ETHETIC_GREEN_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg ETHETIC_WHITE_STAIRS = new AABlockReg<>("ethetic_white_stairs", () -> new StairsBlock(() -> ETHETIC_WHITE_BLOCK.get().getDefaultState(), AbstractBlock.Properties.from(ETHETIC_WHITE_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_STAIR = new AABlockReg<>("black_quartz_stair", () -> new StairsBlock(() -> BLACK_QUARTZ_BLOCK.get().getDefaultState(), AbstractBlock.Properties.from(BLACK_QUARTZ_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg CHISELED_BLACK_QUARTZ_STAIR = new AABlockReg<>("chiseled_black_quartz_stair", () -> new StairsBlock(() -> CHISELED_BLACK_QUARTZ_BLOCK.get().getDefaultState(), AbstractBlock.Properties.from(CHISELED_BLACK_QUARTZ_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_PILLAR_STAIR = new AABlockReg<>("black_quartz_pillar_stair", () -> new StairsBlock(() -> BLACK_QUARTZ_PILLAR_BLOCK.get().getDefaultState(), AbstractBlock.Properties.from(BLACK_QUARTZ_PILLAR_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + + public static final AABlockReg ETHETIC_GREEN_WALL = new AABlockReg<>("ethetic_green_wall", () -> new WallBlock(AbstractBlock.Properties.from(ETHETIC_GREEN_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg ETHETIC_WHITE_WALL = new AABlockReg<>("ethetic_white_wall", () -> new WallBlock(AbstractBlock.Properties.from(ETHETIC_WHITE_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_WALL = new AABlockReg<>("black_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.from(BLACK_QUARTZ_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg CHISELED_BLACK_QUARTZ_WALL = new AABlockReg<>("chiseled_black_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.from(CHISELED_BLACK_QUARTZ_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_PILLAR_WALL = new AABlockReg<>("black_quartz_pillar_wall", () -> new WallBlock(AbstractBlock.Properties.from(BLACK_QUARTZ_PILLAR_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + + public static final AABlockReg ETHETIC_GREEN_SLAB = new AABlockReg<>("ethetic_green_slab", () -> new SlabBlock(AbstractBlock.Properties.from(ETHETIC_GREEN_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg ETHETIC_WHITE_SLAB = new AABlockReg<>("ethetic_white_slab", () -> new SlabBlock(AbstractBlock.Properties.from(ETHETIC_WHITE_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_SLAB = new AABlockReg<>("black_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.from(BLACK_QUARTZ_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg CHISELED_BLACK_QUARTZ_SLAB = new AABlockReg<>("chiseled_black_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.from(CHISELED_BLACK_QUARTZ_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_PILLAR_SLAB = new AABlockReg<>("black_quartz_pillar_slab", () -> new SlabBlock(AbstractBlock.Properties.from(BLACK_QUARTZ_PILLAR_BLOCK.get())), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + + + // Other Misc Blocks + public static final AABlockReg TINY_TORCH = new AABlockReg<>("tiny_torch", BlockTinyTorch::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + + //public static final AABlockReg<> WILD_PLANT = new AABlockReg<>("wild", BlockWildPlant::new); //TODO: what is this? + + //TODO: Are plants normal blocks / blockitems? i have no idea... news at 11... + public static final AABlockReg RICE = new AABlockReg<>("rice", () -> new BlockPlant(ActuallyItems.RICE_SEED.get()), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg CANOLA = new AABlockReg<>("canola", () -> new BlockPlant(ActuallyItems.CANOLA_SEED.get()), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg FLAX = new AABlockReg<>("flax", () -> new BlockPlant(ActuallyItems.FLAX_SEED.get()), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg COFFEE = new AABlockReg<>("coffee", () -> new BlockPlant(ActuallyItems.COFFEE_SEED.get()), + (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg GREENHOUSE_GLASS = new AABlockReg<>("greenhouse_glass", BlockGreenhouseGlass::new, + (b) -> new AABlockItem(b, defaultBlockItemProperties)); public static AbstractBlock.Properties defaultPickProps(int harvestLevel, float hardness, float resistance) { return AbstractBlock.Properties.of(Material.STONE).harvestLevel(harvestLevel).harvestTool(ToolType.PICKAXE).strength(hardness, resistance).sound(SoundType.STONE); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrusher.java similarity index 70% rename from src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrusher.java index 983280ed7..dd8af8111 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrusher.java @@ -14,8 +14,8 @@ import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FAC import static net.minecraft.state.properties.BlockStateProperties.LIT; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinderDouble; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusherDouble; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; @@ -37,25 +37,25 @@ import net.minecraft.world.server.ServerWorld; import java.util.Random; -public class BlockGrinder extends BlockContainerBase { +public class BlockCrusher extends BlockContainerBase { private final boolean isDouble; - public BlockGrinder(boolean isDouble) { - super(ActuallyBlocks.defaultPickProps(0).randomTicks()); + public BlockCrusher(boolean isDouble) { + super(ActuallyBlocks.defaultPickProps(0).tickRandomly()); this.isDouble = isDouble; - this.registerDefaultState(this.stateDefinition.any().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(LIT, false)); + this.setDefaultState(this.stateContainer.getBaseState().with(HORIZONTAL_FACING, Direction.NORTH).with(LIT, false)); } @Override - public TileEntity newBlockEntity(IBlockReader worldIn) { + public TileEntity createNewTileEntity(IBlockReader worldIn) { return this.isDouble - ? new TileEntityGrinderDouble() - : new TileEntityGrinder(); + ? new TileEntityCrusherDouble() + : new TileEntityCrusher(); } @Override public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) { - if (state.getValue(BlockStateProperties.LIT)) { + if (state.get(BlockStateProperties.LIT)) { for (int i = 0; i < 5; i++) { double xRand = rand.nextDouble() / 0.75D - 0.5D; double zRand = rand.nextDouble() / 0.75D - 0.5D; @@ -66,34 +66,34 @@ public class BlockGrinder extends BlockContainerBase { } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (this.isDouble) { - return this.openGui(world, player, pos, TileEntityGrinderDouble.class); + return this.openGui(world, player, pos, TileEntityCrusherDouble.class); } - return this.openGui(world, player, pos, TileEntityGrinder.class); + return this.openGui(world, player, pos, TileEntityCrusher.class); } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - return this.defaultBlockState().setValue(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).setValue(LIT, false); + return this.getDefaultState().with(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).with(LIT, false); } @Override - protected void createBlockStateDefinition(StateContainer.Builder builder) { + protected void fillStateContainer(StateContainer.Builder builder) { builder.add(LIT).add(HORIZONTAL_FACING); } @Override public int getLightValue(BlockState state, IBlockReader world, BlockPos pos) { - return state.getValue(LIT) + return state.get(LIT) ? 12 : 0; } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.getValue(HORIZONTAL_FACING)) { + switch (state.get(HORIZONTAL_FACING)) { case EAST: return Shapes.GrinderShapes.SHAPE_E; case SOUTH: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java index 504ef06c1..2b2f67e3b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java @@ -10,9 +10,9 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; +import net.minecraft.item.ItemStack; -public class BlockCrystal extends BlockBase { +public class BlockCrystal extends ActuallyBlock { private final boolean isEmpowered; public BlockCrystal(boolean isEmpowered) { @@ -20,6 +20,16 @@ public class BlockCrystal extends BlockBase { this.isEmpowered = isEmpowered; } + @Override + public AABlockItem createBlockItem() { + return new AABlockItem(this, getItemProperties()) { + @Override + public boolean hasEffect(ItemStack stack) { + return isEmpowered; + } + }; + } + // public static class TheItemBlock extends ItemBlockBase { // // public TheItemBlock(Block block) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java deleted file mode 100644 index aa471a57f..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file ("BlockCrystalCluster.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.blocks; - -import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; -import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals; -import net.minecraft.block.BlockState; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.Material; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; - -import net.minecraft.block.AbstractBlock.Properties; - -public class BlockCrystalCluster extends FullyDirectionalBlock { - - private final TheCrystals crystal; - - public BlockCrystalCluster(TheCrystals crystal) { - super(Properties.of(Material.GLASS).strength(0.25F, 1.0F).sound(SoundType.GLASS).lightLevel(state -> 7)); - this.crystal = crystal; - - // this.setLightOpacity(1); - } - - @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.CRYSTAL_CLUSTER_SHAPE; - } -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterface.java similarity index 78% rename from src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewer.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterface.java index 4e9e8cced..5189a4314 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterface.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewer; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterface; import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; @@ -19,14 +19,14 @@ import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; -public class BlockItemViewer extends BlockContainerBase { - public BlockItemViewer() { +public class BlockItemInterface extends BlockContainerBase { + public BlockItemInterface() { super(ActuallyBlocks.defaultPickProps(0)); } @Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityItemViewer(); + public TileEntity createNewTileEntity(IBlockReader worldIn) { + return new TileEntityItemInterface(); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterfaceHopping.java similarity index 74% rename from src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterfaceHopping.java index 6692c108f..a7d1ea150 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterfaceHopping.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewerHopping; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterfaceHopping; import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; @@ -18,8 +18,8 @@ import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; -public class BlockItemViewerHopping extends BlockItemViewer { - public BlockItemViewerHopping() { +public class BlockItemInterfaceHopping extends BlockItemInterface { + public BlockItemInterfaceHopping() { super(); } @@ -29,7 +29,7 @@ public class BlockItemViewerHopping extends BlockItemViewer { } @Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityItemViewerHopping(); + public TileEntity createNewTileEntity(IBlockReader worldIn) { + return new TileEntityItemInterfaceHopping(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java index cddc55b8e..18c9baecb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java @@ -138,8 +138,8 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements } } - if (relay instanceof TileEntityLaserRelayItemWhitelist) { - return this.openGui(world, player, pos, TileEntityLaserRelayItemWhitelist.class); + if (relay instanceof TileEntityLaserRelayItemAdvanced) { + return this.openGui(world, player, pos, TileEntityLaserRelayItemAdvanced.class); } } return ActionResultType.FAIL; @@ -151,7 +151,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements case ITEM: return new TileEntityLaserRelayItem(); case ITEM_WHITELIST: - return new TileEntityLaserRelayItemWhitelist(); + return new TileEntityLaserRelayItemAdvanced(); case ENERGY_ADVANCED: return new TileEntityLaserRelayEnergyAdvanced(); case ENERGY_EXTREME: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLongRangeBreaker.java similarity index 76% rename from src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLongRangeBreaker.java index 6a70cbd9c..8e0ee123f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLongRangeBreaker.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.tileentity.TileEntity; @@ -24,29 +24,29 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -public class BlockDirectionalBreaker extends FullyDirectionalBlock.Container { +public class BlockLongRangeBreaker extends FullyDirectionalBlock.Container { - public BlockDirectionalBreaker() { + public BlockLongRangeBreaker() { super(ActuallyBlocks.defaultPickProps(0)); } @Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityDirectionalBreaker(); + public TileEntity createNewTileEntity(IBlockReader worldIn) { + return new TileEntityLongRangeBreaker(); } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (this.tryToggleRedstone(world, pos, player)) { return ActionResultType.PASS; } - return this.openGui(world, player, pos, TileEntityDirectionalBreaker.class); + return this.openGui(world, player, pos, TileEntityLongRangeBreaker.class); } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.getValue(FACING)) { + switch (state.get(FACING)) { case UP: return Shapes.DirectionalBlockBreakerShapes.SHAPE_U; case DOWN: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java index 6d9f6a4f8..c57648142 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java @@ -152,7 +152,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { } public enum Type { - FACE, + ITEMFACE, PLACER, BREAKER, LIQUIFACE, diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPoweredFurnace.java similarity index 74% rename from src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPoweredFurnace.java index 86cd6e771..5d0ad1fad 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPoweredFurnace.java @@ -14,7 +14,7 @@ import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FAC import static net.minecraft.state.properties.BlockStateProperties.LIT; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; @@ -35,24 +35,24 @@ import net.minecraft.world.server.ServerWorld; import java.util.Random; -public class BlockFurnaceDouble extends BlockContainerBase { - public BlockFurnaceDouble() { +public class BlockPoweredFurnace extends BlockContainerBase { + public BlockPoweredFurnace() { // TODO: [port] confirm this is correct for light level... Might not be reactive. - super(ActuallyBlocks.defaultPickProps(0).randomTicks().lightLevel(state -> state.getValue(LIT) + super(ActuallyBlocks.defaultPickProps(0).tickRandomly().setLightLevel(state -> state.get(LIT) ? 12 : 0)); - this.registerDefaultState(this.stateDefinition.any().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(LIT, false)); + this.setDefaultState(this.stateContainer.getBaseState().with(HORIZONTAL_FACING, Direction.NORTH).with(LIT, false)); } @Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityFurnaceDouble(); + public TileEntity createNewTileEntity(IBlockReader worldIn) { + return new TileEntityPoweredFurnace(); } @Override public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { - if (state.getValue(LIT)) { + if (state.get(LIT)) { for (int i = 0; i < 5; i++) { worldIn.addParticle(ParticleTypes.SMOKE, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D); } @@ -60,17 +60,17 @@ public class BlockFurnaceDouble extends BlockContainerBase { } @Override - public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { - return this.openGui(worldIn, player, pos, TileEntityFurnaceDouble.class); + public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + return this.openGui(worldIn, player, pos, TileEntityPoweredFurnace.class); } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - return this.defaultBlockState().setValue(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).setValue(LIT, false); + return this.getDefaultState().with(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).with(LIT, false); } @Override - protected void createBlockStateDefinition(StateContainer.Builder builder) { + protected void fillStateContainer(StateContainer.Builder builder) { builder.add(LIT).add(HORIZONTAL_FACING); } @@ -91,7 +91,7 @@ public class BlockFurnaceDouble extends BlockContainerBase { @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.getValue(HORIZONTAL_FACING)) { + switch (state.get(HORIZONTAL_FACING)) { case EAST: return Shapes.FurnaceDoubleShapes.SHAPE_E; case SOUTH: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java index 8073ec183..44e28bacd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.blocks; import com.mojang.blaze3d.matrix.MatrixStack; import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.BlockState; import net.minecraft.client.MainWindow; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/CrystalClusterBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/CrystalClusterBlock.java new file mode 100644 index 000000000..638a9ca42 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/CrystalClusterBlock.java @@ -0,0 +1,69 @@ +/* + * This file ("BlockCrystalCluster.java") is part of the Actually Additions mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015-2017 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.blocks; + +import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; +import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.Material; +import net.minecraft.state.DirectionProperty; +import net.minecraft.state.StateContainer; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.shapes.IBooleanFunction; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.world.IBlockReader; + +import java.util.stream.Stream; + +public class CrystalClusterBlock extends FullyDirectionalBlock { + public static final DirectionProperty FACING = BlockStateProperties.FACING; + + public static final VoxelShape CRYSTAL_SHAPE = Stream.of( + Block.makeCuboidShape(5, 4, 5, 10, 19, 10), Block.makeCuboidShape(4, 0, 4, 11, 5, 11), + Block.makeCuboidShape(3, 0, 3, 5, 4, 5), Block.makeCuboidShape(10, 0, 3, 12, 2, 5), + Block.makeCuboidShape(12, 0, 4, 13, 1, 5), Block.makeCuboidShape(11, 0, 5, 12, 1, 6), + Block.makeCuboidShape(10, 0, 10, 12, 3, 12), Block.makeCuboidShape(3, 0, 10, 5, 1, 12), + Block.makeCuboidShape(9, 0, 3, 10, 3, 4), Block.makeCuboidShape(8, 0, 2, 11, 1, 4), + Block.makeCuboidShape(4, 0, 2, 5, 2, 3), Block.makeCuboidShape(5, 0, 3, 7, 1, 4), + Block.makeCuboidShape(2, 0, 4, 4, 1, 6), Block.makeCuboidShape(3, 0, 5, 4, 3, 6.5), + Block.makeCuboidShape(3, 0, 9, 4, 2, 10), Block.makeCuboidShape(2, 0, 8, 4, 1, 10), + Block.makeCuboidShape(5, 0, 11, 7, 2, 13), Block.makeCuboidShape(7, 0, 11, 11, 1, 13), + Block.makeCuboidShape(10, 0, 9, 13, 1, 11), Block.makeCuboidShape(11, 0, 7, 12, 3, 9) + ).reduce((v1, v2) -> {return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);}).get(); + + public CrystalClusterBlock(Crystals crystal) { + super(Properties.create(Material.GLASS) + .setLightLevel((e) -> 7) + .sound(SoundType.GLASS) + .hardnessAndResistance(0.25f, 1.0f)); + } + + @Override + public BlockState getBaseConstructorState() { + return this.stateContainer.getBaseState().with(FACING, Direction.UP); + } + + @Override + public boolean isTransparent(BlockState state) { + return true; + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return CRYSTAL_SHAPE; + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IActuallyBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IActuallyBlock.java new file mode 100644 index 000000000..fca0054a3 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IActuallyBlock.java @@ -0,0 +1,20 @@ +package de.ellpeck.actuallyadditions.mod.blocks; + +import net.minecraft.item.Item; + +public interface IActuallyBlock { + /** + * Defaults to the default class for mc. Don't run this other than on setup + * + * @return this blocks item pair + */ + AABlockItem createBlockItem(); + + /** + * Defines the Block Item properties for all non-custom block items. + * + * @return block item properties for default block item. + * @see for implementation {@link #createBlockItem()} + */ + Item.Properties getItemProperties(); +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java index f17de6cdf..c981790cd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java @@ -12,10 +12,7 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; import net.minecraft.block.material.Material; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.fluids.BlockFluidClassic; -import net.minecraftforge.fluids.Fluid; public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBase.ICustomRarity { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java index d0f2aea06..4c642378e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java @@ -27,6 +27,10 @@ public abstract class FullyDirectionalBlock extends BlockBase { } + public BlockState getBaseConstructorState() { + return this.stateContainer.getBaseState().with(FACING, Direction.NORTH); + } + @Override protected void createBlockStateDefinition(StateContainer.Builder builder) { builder.add(FACING); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java index 3342a37ec..4ef31bfed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java @@ -19,10 +19,10 @@ import net.minecraft.util.IStringSerializable; @Deprecated public enum TheWildPlants implements IStringSerializable { - CANOLA("canola", Rarity.RARE, ActuallyBlocks.CANOLA), - FLAX("flax", Rarity.RARE, ActuallyBlocks.FLAX), - RICE("rice", Rarity.RARE, ActuallyBlocks.RICE), - COFFEE("coffee", Rarity.RARE, ActuallyBlocks.COFFEE); + CANOLA("canola", Rarity.RARE, ActuallyBlocks.CANOLA.getBlock()), + FLAX("flax", Rarity.RARE, ActuallyBlocks.FLAX.getBlock()), + RICE("rice", Rarity.RARE, ActuallyBlocks.RICE.getBlock()), + COFFEE("coffee", Rarity.RARE, ActuallyBlocks.COFFEE.getBlock()); final String name; final Rarity rarity; 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 558d156a0..2ad63711e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -191,7 +191,7 @@ public final class InitBooklet { new BookletChapter("fluidLaser", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_FLUIDS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeFluidLaser).setWildcard().setNoText()); new BookletChapter("itemRelays", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_ITEM.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeItemLaser).setWildcard().setNoText()).setSpecial(); new BookletChapter("itemInterfaces", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.ITEM_VIEWER.get()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeItemInterface).setNoText()); - new BookletChapter("itemRelaysAdvanced", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_ITEM_WHITELIST.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeLaserRelayItemWhitelist).setWildcard()); + new BookletChapter("itemRelaysAdvanced", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeLaserRelayItemWhitelist).setWildcard()); new BookletChapter("itemInterfacesHopping", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.ITEM_VIEWER_HOPPING.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeItemInterfaceHopping).setWildcard().setNoText()); new BookletChapter("laserUpgradeInvisibility", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_UPGRADE_INVISIBILITY.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLaserUpgradeInvisibility).setNoText()).setImportant(); new BookletChapter("laserUpgradeRange", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_UPGRADE_RANGE.get()), new PageTextOnly(1).addTextReplacement("", TileEntityLaserRelay.MAX_DISTANCE).addTextReplacement("", TileEntityLaserRelay.MAX_DISTANCE_RANGED), new PageCrafting(2, ItemCrafting.recipeLaserUpgradeRange).setNoText()).setImportant(); @@ -199,7 +199,7 @@ public final class InitBooklet { //No RF Using Blocks new BookletChapter("breaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.BREAKER.get()), new PageCrafting(1, BlockCrafting.recipeBreaker).setWildcard(), new PageCrafting(2, BlockCrafting.recipePlacer).setWildcard(), new PageCrafting(3, BlockCrafting.recipeLiquidPlacer).setWildcard(), new PageCrafting(4, BlockCrafting.recipeLiquidCollector).setWildcard()); new BookletChapter("dropper", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.DROPPER.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeDropper).setNoText()); - new BookletChapter("phantomfaces", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_LIQUIFACE.get()), new PageTextOnly(1).addTextReplacement("", TileEntityPhantomface.RANGE), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipePhantomface), new PageCrafting(4, BlockCrafting.recipeLiquiface), new PageCrafting(5, BlockCrafting.recipeEnergyface), new PageCrafting(6, ItemCrafting.recipePhantomConnector).setNoText(), new PageCrafting(7, BlockCrafting.recipePhantomBooster)).setImportant(); + new BookletChapter("phantomfaces", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_LIQUIFACE.get()), new PageTextOnly(1).addTextReplacement("", TileEntityPhantomFace.RANGE), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipePhantomface), new PageCrafting(4, BlockCrafting.recipeLiquiface), new PageCrafting(5, BlockCrafting.recipeEnergyface), new PageCrafting(6, ItemCrafting.recipePhantomConnector).setNoText(), new PageCrafting(7, BlockCrafting.recipePhantomBooster)).setImportant(); new BookletChapter("phantomRedstoneface", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_REDSTONEFACE.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePhantomRedstoneface).setNoText()); new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_BREAKER.get()), new PageTextOnly(1).addTextReplacement("", TileEntityPhantomPlacer.RANGE), new PageCrafting(2, BlockCrafting.recipePhantomPlacer).setNoText(), new PageCrafting(3, BlockCrafting.recipePhantomBreaker).setNoText()); new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.INPUTTER_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial(); @@ -215,11 +215,11 @@ 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.MINER.get()), new PageTextOnly(1).addTextReplacement("", TileEntityMiner.ENERGY_USE_PER_BLOCK).addTextReplacement("", TileEntityMiner.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<>(); - list.add(new PageTextOnly(1).addTextReplacement("", TileEntityGrinder.ENERGY_USE)); + list.add(new PageTextOnly(1).addTextReplacement("", TileEntityCrusher.ENERGY_USE)); list.add(new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText()); list.add(new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText()); if (CrusherCrafting.recipeIronHorseArmor != null) { @@ -233,11 +233,11 @@ public final class InitBooklet { } new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.GRINDER_DOUBLE.get()), list.toArray(new IBookletPage[0])); - new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.FURNACE_DOUBLE.get()), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("", TileEntityFurnaceDouble.ENERGY_USE)); + new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.POWERED_FURNACE.get()), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("", TileEntityPoweredFurnace.ENERGY_USE)); new BookletChapter("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get()), new PageTextOnly(1).addTextReplacement("", TileEntityLavaFactoryController.ENERGY_USE), new PagePicture(2, "page_lava_factory", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLavaFactory).setNoText(), new PageCrafting(4, BlockCrafting.recipeCasing).setNoText()); new BookletChapter("energizer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.ENERGIZER.get()), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator)); // new BookletChapter("repairer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer.get()), new PageCrafting(1, BlockCrafting.recipeRepairer).addTextReplacement("", TileEntityItemRepairer.ENERGY_USE)); - new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.DIRECTIONAL_BREAKER.get()), new PageTextOnly(1).addTextReplacement("", TileEntityDirectionalBreaker.ENERGY_USE).addTextReplacement("", TileEntityDirectionalBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard()); + new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.LONG_RANGE_BREAKER.get()), new PageTextOnly(1).addTextReplacement("", TileEntityLongRangeBreaker.ENERGY_USE).addTextReplacement("", TileEntityLongRangeBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard()); new BookletChapter("playerInterface", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.PLAYER_INTERFACE.get()), new PageTextOnly(1).addTextReplacement("", TileEntityPlayerInterface.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipePlayerInterface).setNoText()).setSpecial(); new BookletChapter("displayStand", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.DISPLAY_STAND.get()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeDisplayStand).setNoText()).setSpecial(); new BookletChapter("shockSuppressor", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.SHOCK_SUPPRESSOR.get()), new PageTextOnly(1).addTextReplacement("", TileEntityShockSuppressor.RANGE).addTextReplacement("", TileEntityShockSuppressor.USE_PER), new PageCrafting(2, BlockCrafting.recipeShockSuppressor)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java index 6d71a524e..a1d17c714 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; @@ -24,13 +24,13 @@ import java.util.Objects; public class ContainerDirectionalBreaker extends Container { - public final TileEntityDirectionalBreaker breaker; + public final TileEntityLongRangeBreaker breaker; public static ContainerDirectionalBreaker fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { return new ContainerDirectionalBreaker(windowId, inv, (TileEntityDirectionalBreaker) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerDirectionalBreaker(int windowId, PlayerInventory inventory, TileEntityDirectionalBreaker tile) { + public ContainerDirectionalBreaker(int windowId, PlayerInventory inventory, TileEntityLongRangeBreaker tile) { super(ActuallyContainers.DIRECTIONAL_BREAKER_CONTAINER.get(), windowId); this.breaker = tile; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java index e61e4a114..19ecb41e7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; @@ -28,20 +28,20 @@ import java.util.Objects; public class ContainerFurnaceDouble extends Container { - public final TileEntityFurnaceDouble furnace; + public final TileEntityPoweredFurnace furnace; public static ContainerFurnaceDouble fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { return new ContainerFurnaceDouble(windowId, inv, (TileEntityFurnaceDouble) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerFurnaceDouble(int windowId, PlayerInventory inventory, TileEntityFurnaceDouble tile) { + public ContainerFurnaceDouble(int windowId, PlayerInventory inventory, TileEntityPoweredFurnace tile) { super(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), windowId); this.furnace = tile; - this.addSlot(new SlotItemHandlerUnconditioned(this.furnace.inv, TileEntityFurnaceDouble.SLOT_INPUT_1, 51, 21)); - this.addSlot(new SlotOutput(this.furnace.inv, TileEntityFurnaceDouble.SLOT_OUTPUT_1, 51, 69)); - this.addSlot(new SlotItemHandlerUnconditioned(this.furnace.inv, TileEntityFurnaceDouble.SLOT_INPUT_2, 109, 21)); - this.addSlot(new SlotOutput(this.furnace.inv, TileEntityFurnaceDouble.SLOT_OUTPUT_2, 108, 69)); + this.addSlot(new SlotItemHandlerUnconditioned(this.furnace.inv, TileEntityPoweredFurnace.SLOT_INPUT_1, 51, 21)); + this.addSlot(new SlotOutput(this.furnace.inv, TileEntityPoweredFurnace.SLOT_OUTPUT_1, 51, 69)); + this.addSlot(new SlotItemHandlerUnconditioned(this.furnace.inv, TileEntityPoweredFurnace.SLOT_INPUT_2, 109, 21)); + this.addSlot(new SlotOutput(this.furnace.inv, TileEntityPoweredFurnace.SLOT_OUTPUT_2, 108, 69)); for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java index 162424d62..bf85d02db 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java @@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; @@ -25,31 +25,31 @@ import net.minecraft.network.PacketBuffer; import java.util.Objects; public class ContainerGrinder extends Container { - public final TileEntityGrinder tileGrinder; + public final TileEntityCrusher tileGrinder; public final boolean isDouble; public static ContainerGrinder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { return new ContainerGrinder(windowId, inv, (TileEntityGrinder) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerGrinder(int windowId, PlayerInventory inventory, TileEntityGrinder tile) { + public ContainerGrinder(int windowId, PlayerInventory inventory, TileEntityCrusher tile) { super(ActuallyContainers.GRINDER_CONTAINER.get(), windowId); this.tileGrinder = tile; this.isDouble = tile.isDouble; - this.addSlot(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityGrinder.SLOT_INPUT_1, this.isDouble + this.addSlot(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityCrusher.SLOT_INPUT_1, this.isDouble ? 51 : 80, 21)); - this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_1_1, this.isDouble + this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityCrusher.SLOT_OUTPUT_1_1, this.isDouble ? 37 : 66, 69)); - this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_1_2, this.isDouble + this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityCrusher.SLOT_OUTPUT_1_2, this.isDouble ? 64 : 92, 69)); if (this.isDouble) { - this.addSlot(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityGrinder.SLOT_INPUT_2, 109, 21)); - this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_2_1, 96, 69)); - this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_2_2, 121, 69)); + this.addSlot(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityCrusher.SLOT_INPUT_2, 109, 21)); + this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityCrusher.SLOT_OUTPUT_2_1, 96, 69)); + this.addSlot(new SlotOutput(this.tileGrinder.inv, TileEntityCrusher.SLOT_OUTPUT_2_2, 121, 69)); } for (int i = 0; i < 3; i++) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java index c63ae12ee..239bed814 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; @@ -25,13 +25,13 @@ import java.util.Objects; public class ContainerLaserRelayItemWhitelist extends Container { - public final TileEntityLaserRelayItemWhitelist tile; + public final TileEntityLaserRelayItemAdvanced tile; public static ContainerLaserRelayItemWhitelist fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { return new ContainerLaserRelayItemWhitelist(windowId, inv, (TileEntityLaserRelayItemWhitelist) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerLaserRelayItemWhitelist(int windowId, PlayerInventory inventory, TileEntityLaserRelayItemWhitelist tile) { + public ContainerLaserRelayItemWhitelist(int windowId, PlayerInventory inventory, TileEntityLaserRelayItemAdvanced tile) { super(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), windowId); this.tile = tile; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java index ae4210a5e..17e20101b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; @@ -24,13 +24,13 @@ import java.util.Objects; public class ContainerMiner extends Container { - public final TileEntityMiner miner; + public final TileEntityVerticalDigger miner; public static ContainerMiner fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { return new ContainerMiner(windowId, inv, (TileEntityMiner) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerMiner(int windowId, PlayerInventory inventory, TileEntityMiner tile) { + public ContainerMiner(int windowId, PlayerInventory inventory, TileEntityVerticalDigger tile) { super(ActuallyContainers.MINER_CONTAINER.get(), windowId); this.miner = tile; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java index af37a9d29..2b9c07f0c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; import com.mojang.blaze3d.matrix.MatrixStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDirectionalBreaker; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.ResourceLocation; @@ -24,7 +24,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; public class GuiDirectionalBreaker extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_directional_breaker"); - private final TileEntityDirectionalBreaker breaker; + private final TileEntityLongRangeBreaker breaker; private EnergyDisplay energy; public GuiDirectionalBreaker(ContainerDirectionalBreaker container, PlayerInventory inventory, ITextComponent title) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java index 3b1149a8c..b2cccfd90 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java @@ -15,7 +15,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.gui.widget.button.Button; @@ -34,7 +34,7 @@ import java.util.Collections; public class GuiFurnaceDouble extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_furnace_double"); - private final TileEntityFurnaceDouble tileFurnace; + private final TileEntityPoweredFurnace tileFurnace; private EnergyDisplay energy; private Button buttonAutoSplit; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java index 2812ae2f4..83c06f08d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java @@ -15,7 +15,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.gui.widget.button.Button; @@ -35,7 +35,7 @@ public class GuiGrinder extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_grinder"); private static final ResourceLocation RES_LOC_DOUBLE = AssetUtil.getGuiLocation("gui_grinder_double"); - private final TileEntityGrinder tileGrinder; + private final TileEntityCrusher tileGrinder; private final boolean isDouble; private EnergyDisplay energy; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java index 82a2eeaf6..f0bd15ec1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist; import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.gui.widget.button.Button; @@ -34,7 +34,7 @@ import java.util.List; public class GuiLaserRelayItemWhitelist extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_laser_relay_item_whitelist"); - private final TileEntityLaserRelayItemWhitelist tile; + private final TileEntityLaserRelayItemAdvanced tile; private FilterSettingsGui leftFilter; private FilterSettingsGui rightFilter; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java index fe9e7066d..e937faa16 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java @@ -14,7 +14,7 @@ import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.gui.widget.button.Button; @@ -29,7 +29,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; public class GuiMiner extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); - private final TileEntityMiner miner; + private final TileEntityVerticalDigger miner; public GuiMiner(ContainerMiner container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheCrystals.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/Crystals.java similarity index 88% rename from src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheCrystals.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/Crystals.java index c22858c96..afeede08a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheCrystals.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/Crystals.java @@ -12,9 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items.metalists; import net.minecraft.util.IStringSerializable; -@Deprecated -public enum TheCrystals implements IStringSerializable { - +public enum Crystals implements IStringSerializable { REDSTONE("red", 0xFF2F21, 158F / 255F, 43F / 255F, 39F / 255F), LAPIS("blue", 0x5171FF, 37F / 255F, 49F / 255F, 147F / 255F), DIAMOND("light_blue", 0x35F1FF, 99F / 255F, 135F / 255F, 210F / 255F), @@ -26,7 +24,7 @@ public enum TheCrystals implements IStringSerializable { public final float[] conversionColorParticles; public final int clusterColor; - TheCrystals(String name, int clusterColor, float... conversionColorParticles) { + Crystals(String name, int clusterColor, float... conversionColorParticles) { this.name = name; this.conversionColorParticles = conversionColorParticles; this.clusterColor = clusterColor; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ActuallyTiles.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ActuallyTiles.java deleted file mode 100644 index 789d35255..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ActuallyTiles.java +++ /dev/null @@ -1,68 +0,0 @@ -package de.ellpeck.actuallyadditions.mod.tile; - -import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; -import net.minecraft.tileentity.TileEntityType; -import net.minecraftforge.fml.RegistryObject; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; - -public class ActuallyTiles { - public static final DeferredRegister> TILES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, ActuallyAdditions.MODID); - - // public static final RegistryObject<,> COMPOST_TILE = TILES.register("compost", () -> TileEntityType.Builder.create(TileEntityCompost::new, InitBlocks.blockCompost.get()).build(null)); - public static final RegistryObject> FEEDER_TILE = TILES.register("feeder", () -> TileEntityType.Builder.of(TileEntityFeeder::new, ActuallyBlocks.FEEDER.get()).build(null)); - // public static final RegistryObject> GIANTCHEST_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityGiantChest::new, ).build(null)); - // public static final RegistryObject> GIANTCHESTMEDIUM_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityGiantChestMedium::new, ).build(null)); - // public static final RegistryObject> GIANTCHESTLARGE_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityGiantChestLarge::new, ).build(null)); - public static final RegistryObject> GRINDER_TILE = TILES.register("grinder", () -> TileEntityType.Builder.of(TileEntityGrinder::new, ActuallyBlocks.GRINDER.get()).build(null)); - public static final RegistryObject> FURNACE_DOUBLE_TILE = TILES.register("furnaceDouble", () -> TileEntityType.Builder.of(TileEntityFurnaceDouble::new, ActuallyBlocks.FURNACE_DOUBLE.get()).build(null)); - public static final RegistryObject> INPUTTER_TILE = TILES.register("inputter", () -> TileEntityType.Builder.of(TileEntityInputter::new, ActuallyBlocks.INPUTTER.get()).build(null)); - // public static final RegistryObject> SOLAR_TILE = TILES.register("solarPanel", () -> TileEntityType.Builder.create(TileEntityFurnaceSolar::new, ActuallyBlocks.blockFurnaceSolar.get()).build(null)); - public static final RegistryObject> HEATCOLLECTOR_TILE = TILES.register("heatCollector", () -> TileEntityType.Builder.of(TileEntityHeatCollector::new, ActuallyBlocks.HEAT_COLLECTOR.get()).build(null)); - public static final RegistryObject> BREAKER_TILE = TILES.register("breaker", () -> TileEntityType.Builder.of(TileEntityBreaker::new, ActuallyBlocks.BREAKER.get()).build(null)); - public static final RegistryObject> DROPPER_TILE = TILES.register("dropper", () -> TileEntityType.Builder.of(TileEntityDropper::new, ActuallyBlocks.DROPPER.get()).build(null)); - public static final RegistryObject> INPUTTERADVANCED_TILE = TILES.register("inputterAdvanced", () -> TileEntityType.Builder.of(TileEntityInputterAdvanced::new, ActuallyBlocks.INPUTTER_ADVANCED.get()).build(null)); - public static final RegistryObject> PLACER_TILE = TILES.register("placer", () -> TileEntityType.Builder.of(TileEntityPlacer::new, ActuallyBlocks.PLACER.get()).build(null)); - public static final RegistryObject> GRINDER_DOUBLE_TILE = TILES.register("grinderDouble", () -> TileEntityType.Builder.of(TileEntityGrinderDouble::new, ActuallyBlocks.GRINDER_DOUBLE.get()).build(null)); - public static final RegistryObject> CANOLAPRESS_TILE = TILES.register("canolaPress", () -> TileEntityType.Builder.of(TileEntityCanolaPress::new, ActuallyBlocks.CANOLA_PRESS.get()).build(null)); - public static final RegistryObject> FERMENTINGBARREL_TILE = TILES.register("fermentingBarrel", () -> TileEntityType.Builder.of(TileEntityFermentingBarrel::new, ActuallyBlocks.FERMENTING_BARREL.get()).build(null)); - public static final RegistryObject> OILGENERATOR_TILE = TILES.register("oilGenerator", () -> TileEntityType.Builder.of(TileEntityOilGenerator::new, ActuallyBlocks.OIL_GENERATOR.get()).build(null)); - public static final RegistryObject> COALGENERATOR_TILE = TILES.register("coalGenerator", () -> TileEntityType.Builder.of(TileEntityCoalGenerator::new, ActuallyBlocks.COAL_GENERATOR.get()).build(null)); - public static final RegistryObject> PHANTOMITEMFACE_TILE = TILES.register("phantomface", () -> TileEntityType.Builder.of(TileEntityPhantomItemface::new, ActuallyBlocks.PHANTOMFACE.get()).build(null)); - public static final RegistryObject> PHANTOMLIQUIFACE_TILE = TILES.register("liquiface", () -> TileEntityType.Builder.of(TileEntityPhantomLiquiface::new, ActuallyBlocks.PHANTOM_LIQUIFACE.get()).build(null)); - public static final RegistryObject> PHANTOMENERGYFACE_TILE = TILES.register("energyface", () -> TileEntityType.Builder.of(TileEntityPhantomEnergyface::new, ActuallyBlocks.PHANTOM_ENERGYFACE.get()).build(null)); - public static final RegistryObject> PLAYERINTERFACE_TILE = TILES.register("playerInterface", () -> TileEntityType.Builder.of(TileEntityPlayerInterface::new, ActuallyBlocks.PLAYER_INTERFACE.get()).build(null)); - public static final RegistryObject> PHANTOMPLACER_TILE = TILES.register("phantomPlacer", () -> TileEntityType.Builder.of(TileEntityPhantomPlacer::new, ActuallyBlocks.PHANTOM_PLACER.get()).build(null)); - public static final RegistryObject> PHANTOMBREAKER_TILE = TILES.register("phantomBreaker", () -> TileEntityType.Builder.of(TileEntityPhantomBreaker::new, ActuallyBlocks.PHANTOM_BREAKER.get()).build(null)); - public static final RegistryObject> FLUIDCOLLECTOR_TILE = TILES.register("fluidCollector", () -> TileEntityType.Builder.of(TileEntityFluidCollector::new, ActuallyBlocks.FLUID_COLLECTOR.get()).build(null)); - public static final RegistryObject> FLUIDPLACER_TILE = TILES.register("fluidPlacer", () -> TileEntityType.Builder.of(TileEntityFluidPlacer::new, ActuallyBlocks.FLUID_PLACER.get()).build(null)); - public static final RegistryObject> LAVAFACTORYCONTROLLER_TILE = TILES.register("lavaFactory", () -> TileEntityType.Builder.of(TileEntityLavaFactoryController::new, ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get()).build(null)); - public static final RegistryObject> COFFEEMACHINE_TILE = TILES.register("coffeeMachine", () -> TileEntityType.Builder.of(TileEntityCoffeeMachine::new, ActuallyBlocks.COFFEE_MACHINE.get()).build(null)); - public static final RegistryObject> PHANTOM_BOOSTER_TILE = TILES.register("phantomBooster", () -> TileEntityType.Builder.of(TileEntityPhantomBooster::new, ActuallyBlocks.PHANTOM_BOOSTER.get()).build(null)); - public static final RegistryObject> ENERGIZER_TILE = TILES.register("energizer", () -> TileEntityType.Builder.of(TileEntityEnergizer::new, ActuallyBlocks.ENERGIZER.get()).build(null)); - public static final RegistryObject> ENERVATOR_TILE = TILES.register("enervator", () -> TileEntityType.Builder.of(TileEntityEnervator::new, ActuallyBlocks.ENERVATOR.get()).build(null)); - public static final RegistryObject> XPSOLIDIFIER_TILE = TILES.register("xpSolidifier", () -> TileEntityType.Builder.of(TileEntityXPSolidifier::new, ActuallyBlocks.XP_SOLIDIFIER.get()).build(null)); - // public static final RegistryObject<.> SMILEYCLOUD_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntitySmileyCloud::new, InitBlocks.blockSmileyCloud.get()).build(null)); - public static final RegistryObject> LEAFGENERATOR_TILE = TILES.register("leafGenerator", () -> TileEntityType.Builder.of(TileEntityLeafGenerator::new, ActuallyBlocks.LEAF_GENERATOR.get()).build(null)); - public static final RegistryObject> DIRECTIONALBREAKER_TILE = TILES.register("directionalBreaker", () -> TileEntityType.Builder.of(TileEntityDirectionalBreaker::new, ActuallyBlocks.DIRECTIONAL_BREAKER.get()).build(null)); - public static final RegistryObject> RANGEDCOLLECTOR_TILE = TILES.register("rangedCollector", () -> TileEntityType.Builder.of(TileEntityRangedCollector::new, ActuallyBlocks.RANGED_COLLECTOR.get()).build(null)); - public static final RegistryObject> ATOMICRECONSTRUCTOR_TILE = TILES.register("reconstructor", () -> TileEntityType.Builder.of(TileEntityAtomicReconstructor::new, ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()).build(null)); - public static final RegistryObject> MINER_TILE = TILES.register("miner", () -> TileEntityType.Builder.of(TileEntityMiner::new, ActuallyBlocks.MINER.get()).build(null)); - public static final RegistryObject> FIREWORKBOX_TILE = TILES.register("fireworkBox", () -> TileEntityType.Builder.of(TileEntityFireworkBox::new, ActuallyBlocks.FIREWORK_BOX.get()).build(null)); - public static final RegistryObject> PHANTOMREDSTONEFACE_TILE = TILES.register("redstoneface", () -> TileEntityType.Builder.of(TileEntityPhantomRedstoneface::new, ActuallyBlocks.PHANTOM_REDSTONEFACE.get()).build(null)); - public static final RegistryObject> LASERRELAYITEM_TILE = TILES.register("laserRelayItem", () -> TileEntityType.Builder.of(TileEntityLaserRelayItem::new, ActuallyBlocks.LASER_RELAY_ITEM.get()).build(null)); - public static final RegistryObject> LASERRELAYENERGY_TILE = TILES.register("laserRelay", () -> TileEntityType.Builder.of(TileEntityLaserRelayEnergy::new, ActuallyBlocks.LASER_RELAY.get()).build(null)); - public static final RegistryObject> LASERRELAYENERGYADVANCED_TILE = TILES.register("laserRelayAdvanced", () -> TileEntityType.Builder.of(TileEntityLaserRelayEnergyAdvanced::new, ActuallyBlocks.LASER_RELAY_ADVANCED.get()).build(null)); - public static final RegistryObject> LASERRELAYENERGYEXTREME_TILE = TILES.register("laserRelayExtreme", () -> TileEntityType.Builder.of(TileEntityLaserRelayEnergyExtreme::new, ActuallyBlocks.LASER_RELAY_EXTREME.get()).build(null)); - public static final RegistryObject> LASERRELAYITEMWHITELIST_TILE = TILES.register("laserRelayItemWhitelist", () -> TileEntityType.Builder.of(TileEntityLaserRelayItemWhitelist::new, ActuallyBlocks.LASER_RELAY_ITEM_WHITELIST.get()).build(null)); - public static final RegistryObject> ITEMVIEWER_TILE = TILES.register("itemViewer", () -> TileEntityType.Builder.of(TileEntityItemViewer::new, ActuallyBlocks.ITEM_VIEWER.get()).build(null)); - public static final RegistryObject> DISPLAYSTAND_TILE = TILES.register("displayStand", () -> TileEntityType.Builder.of(TileEntityDisplayStand::new, ActuallyBlocks.DISPLAY_STAND.get()).build(null)); - public static final RegistryObject> SHOCKSUPPRESSOR_TILE = TILES.register("shockSuppressor", () -> TileEntityType.Builder.of(TileEntityShockSuppressor::new, ActuallyBlocks.SHOCK_SUPPRESSOR.get()).build(null)); - public static final RegistryObject> EMPOWERER_TILE = TILES.register("empowerer", () -> TileEntityType.Builder.of(TileEntityEmpowerer::new, ActuallyBlocks.EMPOWERER.get()).build(null)); - public static final RegistryObject> LASERRELAYFLUIDS_TILE = TILES.register("laserRelayFluids", () -> TileEntityType.Builder.of(TileEntityLaserRelayFluids::new, ActuallyBlocks.LASER_RELAY_FLUIDS.get()).build(null)); - public static final RegistryObject> BIOREACTOR_TILE = TILES.register("bioReactor", () -> TileEntityType.Builder.of(TileEntityBioReactor::new, ActuallyBlocks.BIOREACTOR.get()).build(null)); - public static final RegistryObject> FARMER_TILE = TILES.register("farmer", () -> TileEntityType.Builder.of(TileEntityFarmer::new, ActuallyBlocks.FARMER.get()).build(null)); - public static final RegistryObject> ITEMVIEWERHOPPING_TILE = TILES.register("itemViewerHopping", () -> TileEntityType.Builder.of(TileEntityItemViewerHopping::new, ActuallyBlocks.ITEM_VIEWER.get()).build(null)); - public static final RegistryObject> BATTERYBOX_TILE = TILES.register("batteryBox", () -> TileEntityType.Builder.of(TileEntityBatteryBox::new, ActuallyBlocks.BATTERY_BOX.get()).build(null)); -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusher.java similarity index 84% rename from src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusher.java index b8b64edb5..c1e4abeae 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusher.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe; -import de.ellpeck.actuallyadditions.mod.blocks.BlockFurnaceDouble; +import de.ellpeck.actuallyadditions.mod.blocks.BlockPoweredFurnace; import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder; import de.ellpeck.actuallyadditions.mod.misc.SoundHandler; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; @@ -37,9 +37,7 @@ import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - -public class TileEntityGrinder extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { +public class TileEntityCrusher extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { public static final int SLOT_INPUT_1 = 0; public static final int SLOT_OUTPUT_1_1 = 1; @@ -60,11 +58,11 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto private boolean lastAutoSplit; private boolean lastCrushed; - public TileEntityGrinder(TileEntityType type, int slots) { + public TileEntityCrusher(TileEntityType type, int slots) { super(type, slots); } - public TileEntityGrinder() { + public TileEntityCrusher() { super(ActuallyTiles.GRINDER_TILE.get(), 3); this.isDouble = false; } @@ -94,9 +92,9 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto @Override public void updateEntity() { super.updateEntity(); - if (!this.level.isClientSide) { + if (!this.world.isRemote) { if (this.isDouble && this.isAutoSplit) { - TileEntityFurnaceDouble.autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2); + TileEntityPoweredFurnace.autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2); } boolean crushed = false; @@ -145,8 +143,8 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } } - BlockState currState = this.level.getBlockState(this.worldPosition); - boolean current = currState.getValue(BlockFurnaceDouble.IS_ON); + BlockState currState = this.world.getBlockState(this.pos); + boolean current = currState.get(BlockPoweredFurnace.IS_ON); boolean changeTo = current; if (this.lastCrushed != crushed) { changeTo = crushed; @@ -159,7 +157,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } if (changeTo != current) { - this.level.setBlockAndUpdate(this.worldPosition, currState.setValue(BlockFurnaceDouble.IS_ON, changeTo)); + this.world.setBlockState(this.pos, currState.with(BlockPoweredFurnace.IS_ON, changeTo)); } this.lastCrushed = crushed; @@ -172,7 +170,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } if (shouldPlaySound) { - this.level.playSound(null, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), SoundHandler.crusher, SoundCategory.BLOCKS, 0.025F, 1.0F); + this.world.playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), SoundHandler.crusher, SoundCategory.BLOCKS, 0.025F, 1.0F); } } } @@ -196,13 +194,13 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto ItemStack outputOne = recipe.getOutputOne(); ItemStack outputTwo = recipe.getOutputTwo(); if (StackUtil.isValid(outputOne)) { - if (outputOne.getDamageValue() == Util.WILDCARD) { - outputOne.setDamageValue(0); + if (outputOne.getDamage() == Util.WILDCARD) { + outputOne.setDamage(0); } - if (StackUtil.isValid(outputTwo) && outputTwo.getDamageValue() == Util.WILDCARD) { - outputTwo.setDamageValue(0); + if (StackUtil.isValid(outputTwo) && outputTwo.getDamage() == Util.WILDCARD) { + outputTwo.setDamage(0); } - if ((!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput)) || this.inv.getStackInSlot(theFirstOutput).sameItem(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount()) && (!StackUtil.isValid(outputTwo) || !StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput)) || this.inv.getStackInSlot(theSecondOutput).sameItem(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount())) { + if ((!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput)) || this.inv.getStackInSlot(theFirstOutput).isItemEqual(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount()) && (!StackUtil.isValid(outputTwo) || !StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput)) || this.inv.getStackInSlot(theSecondOutput).isItemEqual(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount())) { return true; } } @@ -223,8 +221,8 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } ItemStack outputOne = recipe.getOutputOne(); if (StackUtil.isValid(outputOne)) { - if (outputOne.getDamageValue() == Util.WILDCARD) { - outputOne.setDamageValue(0); + if (outputOne.getDamage() == Util.WILDCARD) { + outputOne.setDamage(0); } if (!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput))) { this.inv.setStackInSlot(theFirstOutput, outputOne.copy()); @@ -235,10 +233,10 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto ItemStack outputTwo = recipe.getOutputTwo(); if (StackUtil.isValid(outputTwo)) { - if (outputTwo.getDamageValue() == Util.WILDCARD) { - outputTwo.setDamageValue(0); + if (outputTwo.getDamage() == Util.WILDCARD) { + outputTwo.setDamage(0); } - int rand = this.level.random.nextInt(100) + 1; + int rand = this.world.rand.nextInt(100) + 1; if (rand <= recipe.getSecondChance()) { if (!StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput))) { this.inv.setStackInSlot(theSecondOutput, outputTwo.copy()); @@ -267,7 +265,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto public void onButtonPressed(int buttonID, PlayerEntity player) { if (buttonID == 0) { this.isAutoSplit = !this.isAutoSplit; - this.setChanged(); + this.markDirty(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinderDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusherDouble.java similarity index 82% rename from src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinderDouble.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusherDouble.java index b4cba13e3..1f5c9a4c0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinderDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusherDouble.java @@ -10,9 +10,9 @@ package de.ellpeck.actuallyadditions.mod.tile; -public class TileEntityGrinderDouble extends TileEntityGrinder { +public class TileEntityCrusherDouble extends TileEntityCrusher { - public TileEntityGrinderDouble() { + public TileEntityCrusherDouble() { super(ActuallyTiles.GRINDER_DOUBLE_TILE.get(), 6); this.isDouble = true; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java index 2fdcd9d7a..1a4c0489b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java @@ -99,7 +99,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt ? null : this.leftFilter); - if (this.placeToPull instanceof TileEntityItemViewer) { + if (this.placeToPull instanceof TileEntityItemInterface) { break; } } @@ -111,7 +111,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt for (Direction side : this.placeToPut.keySet()) { WorldUtil.doItemInteraction(this.wrapper, this.placeToPut.get(side), Integer.MAX_VALUE, 0, 1, this.slotToPutStart, this.slotToPutEnd, null); - if (this.placeToPut instanceof TileEntityItemViewer) { + if (this.placeToPut instanceof TileEntityItemInterface) { break; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterface.java old mode 100755 new mode 100644 similarity index 85% rename from src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterface.java index 286b6ff70..df99f735b --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterface.java @@ -32,7 +32,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.*; -public class TileEntityItemViewer extends TileEntityBase { +public class TileEntityItemInterface extends TileEntityBase { public final List genericInfos = new ArrayList<>(); public final Map itemHandlerInfos = new HashMap<>(); @@ -43,18 +43,18 @@ public class TileEntityItemViewer extends TileEntityBase { private int lastNetworkChangeAmount = -1; private int slotCount; - public TileEntityItemViewer(TileEntityType type) { + public TileEntityItemInterface(TileEntityType type) { super(type); IItemHandler normalHandler = new IItemHandler() { @Override public int getSlots() { - return TileEntityItemViewer.this.getSlotCount(); + return TileEntityItemInterface.this.getSlotCount(); } @Override public ItemStack getStackInSlot(int slot) { - IItemHandlerInfo handler = TileEntityItemViewer.this.getSwitchedIndexHandler(slot); + IItemHandlerInfo handler = TileEntityItemInterface.this.getSwitchedIndexHandler(slot); if (handler != null && handler.isLoaded()) { return handler.handler.getStackInSlot(handler.switchedIndex); } @@ -63,12 +63,12 @@ public class TileEntityItemViewer extends TileEntityBase { @Override public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { - IItemHandlerInfo info = TileEntityItemViewer.this.getSwitchedIndexHandler(slot); - if (info != null && info.isLoaded() && TileEntityItemViewer.this.isWhitelisted(info, stack, false)) { + IItemHandlerInfo info = TileEntityItemInterface.this.getSwitchedIndexHandler(slot); + if (info != null && info.isLoaded() && TileEntityItemInterface.this.isWhitelisted(info, stack, false)) { ItemStack remain = info.handler.insertItem(info.switchedIndex, stack, simulate); - if (!ItemStack.matches(remain, stack) && !simulate) { - TileEntityItemViewer.this.setChanged(); - TileEntityItemViewer.this.doItemParticle(stack, info.relayInQuestion.getBlockPos(), TileEntityItemViewer.this.connectedRelay.getBlockPos()); + if (!ItemStack.areItemStacksEqual(remain, stack) && !simulate) { + TileEntityItemInterface.this.markDirty(); + TileEntityItemInterface.this.doItemParticle(stack, info.relayInQuestion.getPos(), TileEntityItemInterface.this.connectedRelay.getPos()); } return remain; } @@ -79,12 +79,12 @@ public class TileEntityItemViewer extends TileEntityBase { public ItemStack extractItem(int slot, int amount, boolean simulate) { ItemStack stackIn = this.getStackInSlot(slot); if (StackUtil.isValid(stackIn)) { - IItemHandlerInfo info = TileEntityItemViewer.this.getSwitchedIndexHandler(slot); - if (info != null && info.isLoaded() && TileEntityItemViewer.this.isWhitelisted(info, stackIn, true)) { + IItemHandlerInfo info = TileEntityItemInterface.this.getSwitchedIndexHandler(slot); + if (info != null && info.isLoaded() && TileEntityItemInterface.this.isWhitelisted(info, stackIn, true)) { ItemStack extracted = info.handler.extractItem(info.switchedIndex, amount, simulate); if (StackUtil.isValid(extracted) && !simulate) { - TileEntityItemViewer.this.setChanged(); - TileEntityItemViewer.this.doItemParticle(extracted, TileEntityItemViewer.this.connectedRelay.getBlockPos(), info.relayInQuestion.getBlockPos()); + TileEntityItemInterface.this.markDirty(); + TileEntityItemInterface.this.doItemParticle(extracted, TileEntityItemInterface.this.connectedRelay.getPos(), info.relayInQuestion.getPos()); } return extracted; } @@ -94,7 +94,7 @@ public class TileEntityItemViewer extends TileEntityBase { @Override public int getSlotLimit(int slot) { - IItemHandlerInfo info = TileEntityItemViewer.this.getSwitchedIndexHandler(slot); + IItemHandlerInfo info = TileEntityItemInterface.this.getSwitchedIndexHandler(slot); if (info != null && info.isLoaded()) { return info.handler.getSlotLimit(info.switchedIndex); } else { @@ -117,7 +117,7 @@ public class TileEntityItemViewer extends TileEntityBase { this.itemHandler = new SlotlessableItemHandlerWrapper(this.lazyHandlers, slotlessHandler); } - public TileEntityItemViewer() { + public TileEntityItemInterface() { this(ActuallyTiles.ITEMVIEWER_TILE.get()); } @@ -153,9 +153,9 @@ public class TileEntityItemViewer extends TileEntityBase { } public void doItemParticle(ItemStack stack, BlockPos input, BlockPos output) { - if (!this.level.isClientSide) { + if (!this.world.isRemote) { CompoundNBT compound = new CompoundNBT(); - stack.save(compound); + stack.write(compound); compound.putDouble("InX", input.getX()); compound.putDouble("InY", input.getY()); @@ -166,9 +166,9 @@ public class TileEntityItemViewer extends TileEntityBase { compound.putDouble("OutZ", output.getZ()); int rangeSq = 16 * 16; - for (PlayerEntity player : this.level.players()) { + for (PlayerEntity player : this.world.getPlayers()) { if (player instanceof ServerPlayerEntity) { - if (player.distanceToSqr(input.getX(), input.getY(), input.getZ()) <= rangeSq || player.distanceToSqr(output.getX(), output.getY(), output.getZ()) <= rangeSq) { + if (player.getDistanceSq(input.getX(), input.getY(), input.getZ()) <= rangeSq || player.getDistanceSq(output.getX(), output.getY(), output.getZ()) <= rangeSq) { PacketHandler.sendTo(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), (ServerPlayerEntity) player); } } @@ -249,13 +249,13 @@ public class TileEntityItemViewer extends TileEntityBase { @Override public void saveDataOnChangeOrWorldStart() { TileEntityLaserRelayItem tileFound = null; - if (this.level != null) { //Why is that even possible..? + if (this.world != null) { //Why is that even possible..? for (int i = 0; i <= 5; i++) { Direction side = WorldUtil.getDirectionBySidesInOrder(i); - BlockPos pos = this.getBlockPos().relative(side); + BlockPos pos = this.getPos().offset(side); - if (this.level.hasChunkAt(pos)) { - TileEntity tile = this.level.getBlockEntity(pos); + if (this.world.isBlockLoaded(pos)) { + TileEntity tile = this.world.getTileEntity(pos); if (tile instanceof TileEntityLaserRelayItem) { if (tileFound != null) { @@ -312,7 +312,7 @@ public class TileEntityItemViewer extends TileEntityBase { } public boolean isLoaded() { - return this.relayInQuestion.hasLevel() && this.relayInQuestion.getLevel().hasChunkAt(this.relayInQuestion.getBlockPos()); + return this.relayInQuestion.hasWorld() && this.relayInQuestion.getWorld().isBlockLoaded(this.relayInQuestion.getPos()); } } @@ -326,7 +326,7 @@ public class TileEntityItemViewer extends TileEntityBase { } public boolean isLoaded() { - return this.relayInQuestion.hasLevel() && this.relayInQuestion.getLevel().hasChunkAt(this.relayInQuestion.getBlockPos()); + return this.relayInQuestion.hasWorld() && this.relayInQuestion.getWorld().isBlockLoaded(this.relayInQuestion.getPos()); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewerHopping.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterfaceHopping.java similarity index 83% rename from src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewerHopping.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterfaceHopping.java index 30734db77..bb0278660 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewerHopping.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterfaceHopping.java @@ -28,12 +28,12 @@ import net.minecraftforge.items.IItemHandler; import java.util.List; -public class TileEntityItemViewerHopping extends TileEntityItemViewer { +public class TileEntityItemInterfaceHopping extends TileEntityItemInterface { private SlotlessableItemHandlerWrapper handlerToPullFrom; private SlotlessableItemHandlerWrapper handlerToPushTo; - public TileEntityItemViewerHopping() { + public TileEntityItemInterfaceHopping() { super(ActuallyTiles.ITEMVIEWERHOPPING_TILE.get()); } @@ -42,12 +42,12 @@ public class TileEntityItemViewerHopping extends TileEntityItemViewer { super.updateEntity(); // TODO: [port] validate this is the correct way to get total game time getGameTime - if (!this.level.isClientSide && this.level.getLevelData().getGameTime() % 10 == 0) { + if (!this.world.isRemote && this.world.getWorldInfo().getGameTime() % 10 == 0) { if (this.handlerToPullFrom != null) { WorldUtil.doItemInteraction(this.handlerToPullFrom, this.itemHandler, 4); } else { - if (this.level.getLevelData().getGameTime() % 20 == 0) { - List items = this.level.getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(this.worldPosition.getX(), this.worldPosition.getY() + 0.5, this.worldPosition.getZ(), this.worldPosition.getX() + 1, this.worldPosition.getY() + 2, this.worldPosition.getZ() + 1)); + if (this.world.getWorldInfo().getGameTime() % 20 == 0) { + List items = this.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(this.pos.getX(), this.pos.getY() + 0.5, this.pos.getZ(), this.pos.getX() + 1, this.pos.getY() + 2, this.pos.getZ() + 1)); if (items != null && !items.isEmpty()) { for (ItemEntity item : items) { if (item != null && item.isAlive()) { @@ -96,8 +96,8 @@ public class TileEntityItemViewerHopping extends TileEntityItemViewer { this.handlerToPullFrom = null; this.handlerToPushTo = null; - TileEntity from = this.level.getBlockEntity(this.worldPosition.relative(Direction.UP)); - if (from != null && !(from instanceof TileEntityItemViewer)) { + TileEntity from = this.world.getTileEntity(this.pos.offset(Direction.UP)); + if (from != null && !(from instanceof TileEntityItemInterface)) { LazyOptional normal = from.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN); Object slotless = null; @@ -112,13 +112,13 @@ public class TileEntityItemViewerHopping extends TileEntityItemViewer { this.handlerToPullFrom = new SlotlessableItemHandlerWrapper(normal, slotless); } - BlockState state = this.level.getBlockState(this.worldPosition); - Direction facing = state.getValue(BlockStateProperties.FACING); + BlockState state = this.world.getBlockState(this.pos); + Direction facing = state.get(BlockStateProperties.FACING); - BlockPos toPos = this.worldPosition.relative(facing); - if (this.level.hasChunkAt(toPos)) { - TileEntity to = this.level.getBlockEntity(toPos); - if (to != null && !(to instanceof TileEntityItemViewer)) { + BlockPos toPos = this.pos.offset(facing); + if (this.world.isBlockLoaded(toPos)) { + TileEntity to = this.world.getTileEntity(toPos); + if (to != null && !(to instanceof TileEntityItemInterface)) { LazyOptional normal = to.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); Object slotless = null; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java index c7f8f0d87..0d2980fa4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.api.laser.IConnectionPair; import de.ellpeck.actuallyadditions.api.laser.LaserType; import de.ellpeck.actuallyadditions.api.laser.Network; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewer.GenericItemHandlerInfo; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterface.GenericItemHandlerInfo; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemAdvanced.java similarity index 95% rename from src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemAdvanced.java index efc64f20d..4cf0ebfb8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemAdvanced.java @@ -29,14 +29,12 @@ import net.minecraft.util.text.StringTextComponent; import javax.annotation.Nullable; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - -public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem implements IButtonReactor, INamedContainerProvider { +public class TileEntityLaserRelayItemAdvanced extends TileEntityLaserRelayItem implements IButtonReactor, INamedContainerProvider { public FilterSettings leftFilter = new FilterSettings(12, true, true, false, false, 0, -1000); public FilterSettings rightFilter = new FilterSettings(12, true, true, false, false, 0, -2000); - public TileEntityLaserRelayItemWhitelist() { + public TileEntityLaserRelayItemAdvanced() { super(ActuallyTiles.LASERRELAYITEMWHITELIST_TILE.get()); } @@ -133,7 +131,7 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem public void updateEntity() { super.updateEntity(); - if (!this.level.isClientSide) { + if (!this.world.isRemote) { if ((this.leftFilter.needsUpdateSend() || this.rightFilter.needsUpdateSend()) && this.sendUpdateWithInterval()) { this.leftFilter.updateLasts(); this.rightFilter.updateLasts(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLongRangeBreaker.java similarity index 80% rename from src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLongRangeBreaker.java index 77bb4a3f4..d67bd346e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLongRangeBreaker.java @@ -34,9 +34,7 @@ import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; import java.util.List; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - -public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implements INamedContainerProvider { +public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implements INamedContainerProvider { public static final int RANGE = 8; public static final int ENERGY_USE = 5; @@ -45,7 +43,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem private int lastEnergy; private int currentTime; - public TileEntityDirectionalBreaker() { + public TileEntityLongRangeBreaker() { super(ActuallyTiles.DIRECTIONALBREAKER_TILE.get(), 9); } @@ -70,7 +68,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem @Override public void updateEntity() { super.updateEntity(); - if (!this.level.isClientSide) { + if (!this.world.isRemote) { if (!this.isRedstonePowered && !this.isPulseMode) { if (this.currentTime > 0) { this.currentTime--; @@ -90,24 +88,24 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem private void doWork() { if (this.storage.getEnergyStored() >= ENERGY_USE * RANGE) { - BlockState state = this.level.getBlockState(this.worldPosition); + BlockState state = this.world.getBlockState(this.pos); Direction sideToManipulate = WorldUtil.getDirectionByPistonRotation(state); for (int i = 0; i < RANGE; i++) { - BlockPos coordsBlock = this.worldPosition.relative(sideToManipulate, i + 1); - BlockState breakState = this.level.getBlockState(coordsBlock); + BlockPos coordsBlock = this.pos.offset(sideToManipulate, i + 1); + BlockState breakState = this.world.getBlockState(coordsBlock); Block blockToBreak = breakState.getBlock(); - 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 (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 (chance > 0 && this.level.random.nextFloat() <= chance) { + if (chance > 0 && this.world.rand.nextFloat() <= chance) { if (StackUtil.canAddAll(this.inv, drops, false)) { - this.level.levelEvent(2001, coordsBlock, Block.getId(this.level.getBlockState(coordsBlock))); - this.level.setBlockAndUpdate(coordsBlock, Blocks.AIR.defaultBlockState()); + this.world.playEvent(2001, coordsBlock, Block.getStateId(this.world.getBlockState(coordsBlock))); + this.world.setBlockState(coordsBlock, Blocks.AIR.getDefaultState()); StackUtil.addAll(this.inv, drops, false); this.storage.extractEnergyInternal(ENERGY_USE, false); - this.setChanged(); + this.markDirty(); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java index 3c09681ba..88447f40d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java @@ -10,16 +10,17 @@ package de.ellpeck.actuallyadditions.mod.tile; +import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; -public class TileEntityPhantomEnergyface extends TileEntityPhantomface implements ISharingEnergyProvider { +public class TileEntityPhantomEnergyface extends TileEntityPhantomFace implements ISharingEnergyProvider { public TileEntityPhantomEnergyface() { - super(ActuallyTiles.PHANTOMENERGYFACE_TILE.get()); + super(ActuallyBlocks.PHANTOM_ENERGYFACE.getTileEntityType()); this.type = BlockPhantom.Type.ENERGYFACE; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java index d68ff3f43..3255870b7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.mod.tile; +import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; @@ -18,11 +19,11 @@ import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; -public class TileEntityPhantomItemface extends TileEntityPhantomface { +public class TileEntityPhantomItemface extends TileEntityPhantomFace { public TileEntityPhantomItemface() { - super(ActuallyTiles.PHANTOMITEMFACE_TILE.get()); - this.type = BlockPhantom.Type.FACE; + super(ActuallyBlocks.PHANTOM_ITEMFACE.getTileEntityType()); + this.type = BlockPhantom.Type.ITEMFACE; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java index 6357c4e16..124e309bf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java @@ -10,16 +10,17 @@ package de.ellpeck.actuallyadditions.mod.tile; +import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; -public class TileEntityPhantomLiquiface extends TileEntityPhantomface implements ISharingFluidHandler { +public class TileEntityPhantomLiquiface extends TileEntityPhantomFace implements ISharingFluidHandler { public TileEntityPhantomLiquiface() { - super(ActuallyTiles.PHANTOMLIQUIFACE_TILE.get()); + super(ActuallyBlocks.PHANTOM_LIQUIFACE.getTileEntityType()); this.type = BlockPhantom.Type.LIQUIFACE; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java index f70d154b6..1fe9f0fa6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.api.tile.IPhantomTile; +import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.inventory.ContainerPhantomPlacer; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; @@ -55,7 +56,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } public TileEntityPhantomPlacer() { - super(ActuallyTiles.PHANTOMPLACER_TILE.get(), 9); + super(ActuallyBlocks.PHANTOM_PLACER.getTileEntityType(), 9); this.isBreaker = false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java index 06ef0febb..e48c43bab 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java @@ -17,7 +17,7 @@ import net.minecraftforge.common.capabilities.Capability; import java.util.Arrays; -public class TileEntityPhantomRedstoneface extends TileEntityPhantomface { +public class TileEntityPhantomRedstoneface extends TileEntityPhantomFace { public final int[] providesStrong = new int[Direction.values().length]; public final int[] providesWeak = new int[Direction.values().length]; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java index 45fefcb31..bda8cad03 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java @@ -43,7 +43,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl private Block boundBlockBefore; private int lastStrength; - public TileEntityPhantomface(TileEntityType type) { + public TileEntityPhantomFace(TileEntityType type) { super(type, 0); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPoweredFurnace.java similarity index 92% rename from src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPoweredFurnace.java index 5c275cb9c..154603b0d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPoweredFurnace.java @@ -35,9 +35,7 @@ import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - -public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { +public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { public static final int SLOT_INPUT_1 = 0; public static final int SLOT_OUTPUT_1 = 1; @@ -56,7 +54,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements private boolean lastAutoSplit; private boolean lastSmelted; - public TileEntityFurnaceDouble() { + public TileEntityPoweredFurnace() { super(ActuallyTiles.FURNACE_DOUBLE_TILE.get(), 4); } @@ -113,7 +111,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements @Override public void updateEntity() { super.updateEntity(); - if (!this.level.isClientSide) { + if (!this.world.isRemote) { if (this.isAutoSplit) { autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2); } @@ -151,8 +149,8 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements this.secondSmeltTime = 0; } - BlockState currState = this.level.getBlockState(this.worldPosition); - boolean current = currState.getValue(BlockStateProperties.LIT); + BlockState currState = this.world.getBlockState(this.pos); + boolean current = currState.get(BlockStateProperties.LIT); boolean changeTo = current; if (this.lastSmelted != smelted) { changeTo = smelted; @@ -165,7 +163,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements } if (changeTo != current) { - this.level.setBlockAndUpdate(this.worldPosition, currState.setValue(BlockStateProperties.LIT, changeTo)); + this.world.setBlockState(this.pos, currState.with(BlockStateProperties.LIT, changeTo)); } this.lastSmelted = smelted; @@ -193,7 +191,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) { ItemStack output = FurnaceRecipes.instance().getSmeltingResult(this.inv.getStackInSlot(theInput)); if (StackUtil.isValid(output)) { - if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).sameItem(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) { + if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).isItemEqual(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) { return true; } } @@ -225,7 +223,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements public void onButtonPressed(int buttonID, PlayerEntity player) { if (buttonID == 0) { this.isAutoSplit = !this.isAutoSplit; - this.setChanged(); + this.markDirty(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityVerticalDigger.java similarity index 83% rename from src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityVerticalDigger.java index e1bcfc205..e485960c9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityVerticalDigger.java @@ -42,9 +42,7 @@ import net.minecraftforge.fluids.IFluidBlock; import javax.annotation.Nullable; import java.util.List; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - -public class TileEntityMiner extends TileEntityInventoryBase implements IButtonReactor, IEnergyDisplay, INamedContainerProvider { +public class TileEntityVerticalDigger extends TileEntityInventoryBase implements IButtonReactor, IEnergyDisplay, INamedContainerProvider { public static final int ENERGY_USE_PER_BLOCK = 650; public static final int DEFAULT_RANGE = 2; @@ -59,7 +57,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR private int oldCheckY; private int oldCheckZ; - public TileEntityMiner() { + public TileEntityVerticalDigger() { super(ActuallyTiles.MINER_TILE.get(), 9); } @@ -92,13 +90,13 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR @Override public void updateEntity() { super.updateEntity(); - if (!this.level.isClientSide) { + if (!this.world.isRemote) { if (!this.isRedstonePowered && this.ticksElapsed % 5 == 0) { if (this.checkY != 0) { - int range = TileEntityPhantomface.upgradeRange(DEFAULT_RANGE, this.level, this.worldPosition); + int range = TileEntityPhantomFace.upgradeRange(DEFAULT_RANGE, this.world, this.pos); if (this.checkY < 0) { - this.checkY = this.worldPosition.getY() - 1; + this.checkY = this.pos.getY() - 1; this.checkX = -range; this.checkZ = -range; } @@ -133,23 +131,23 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR ? 3 : 1); if (this.storage.getEnergyStored() >= actualUse) { - BlockPos pos = new BlockPos(this.worldPosition.getX() + this.checkX, this.checkY, this.worldPosition.getZ() + this.checkZ); + BlockPos pos = new BlockPos(this.pos.getX() + this.checkX, this.checkY, this.pos.getZ() + this.checkZ); - BlockState state = this.level.getBlockState(pos); + BlockState state = this.world.getBlockState(pos); Block block = state.getBlock(); - 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); + 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); - if (chance > 0 && this.level.random.nextFloat() <= chance) { + if (chance > 0 && this.world.rand.nextFloat() <= chance) { if (StackUtil.canAddAll(this.inv, drops, false)) { - this.level.levelEvent(2001, pos, Block.getId(this.level.getBlockState(pos))); - this.level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); + this.world.playEvent(2001, pos, Block.getStateId(this.world.getBlockState(pos))); + this.world.setBlockState(pos, Blocks.AIR.getDefaultState()); StackUtil.addAll(this.inv, drops, false); - this.setChanged(); + this.markDirty(); this.storage.extractEnergyInternal(actualUse, false); this.shootParticles(pos.getX(), pos.getY(), pos.getZ()); @@ -198,7 +196,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR } private void shootParticles(int endX, int endY, int endZ) { - AssetUtil.spawnLaserWithTimeServer(this.level, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), endX, endY, endZ, new float[]{65F / 255F, 150F / 255F, 2F / 255F}, 10, 120, 0.1F, 0.8F); + 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); } private boolean isBlacklisted(Block block) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/registration/AABlockReg.java b/src/main/java/de/ellpeck/actuallyadditions/registration/AABlockReg.java new file mode 100644 index 000000000..9525f63bc --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/registration/AABlockReg.java @@ -0,0 +1,102 @@ +package de.ellpeck.actuallyadditions.registration; + +import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; +import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; +import net.minecraft.block.Block; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraftforge.fml.RegistryObject; + +import javax.annotation.Nonnull; +import java.util.Objects; +import java.util.function.Function; +import java.util.function.Supplier; + +public class AABlockReg implements Supplier { +//public class AABlock implements Supplier { + private final String name; + private final RegistryObject block; + private final RegistryObject item; + private RegistryObject> tileEntityType; + + public AABlockReg(String name, Supplier blockSupplier, Function itemSupplier, Supplier tileSupplier) { + this.name = name; + this.block = ActuallyBlocks.BLOCKS.register(name, blockSupplier); + this.item = ActuallyItems.ITEMS.register(name, () -> itemSupplier.apply(block.get())); + this.tileEntityType = ActuallyBlocks.TILES.register(name, () -> TileEntityType.Builder.create(tileSupplier, block.get()).build(null)); + } + public AABlockReg(String name, Supplier blockSupplier, Function itemSupplier) { + this.name = name; + this.block = ActuallyBlocks.BLOCKS.register(name, blockSupplier); + this.item = ActuallyItems.ITEMS.register(name, () -> itemSupplier.apply(block.get())); + } + + /* + public AABlock(BlockBuilder builder) { + this.name = builder.name; + this.block = ActuallyBlocks.BLOCKS.register(name, builder.blockSupplier); + this.item = ActuallyItems.ITEMS.register(name, () -> builder.itemSupplier.apply(block.get())); + if (builder.hasTile) + this.tileEntityType = ActuallyTiles.TILES.register(name, () -> TileEntityType.Builder.create(builder.tileSupplier, block.get()).build(null)); + } + + */ + + public String getName() {return name;} + + @Override + public Block get() { + return block.get(); + } + + public B getBlock() { + return block.get(); + } + + public I getItem() { + return item.get(); + } + + @Nonnull + public TileEntityType getTileEntityType() { return Objects.requireNonNull(tileEntityType.get());} + + + public static class BlockBuilder { + private final String name; + private Supplier blockSupplier; + private Function itemSupplier = (b) -> new BlockItem(b, ActuallyItems.defaultProps()); + private boolean hasTile = false; + private Supplier> tileSupplier; + + private BlockBuilder(String nameIn, Supplier blockSupplierIn) { + this.name = nameIn; + this.blockSupplier = blockSupplierIn; + } + + public static BlockBuilder block(String nameIn, Supplier blockSupplierIn) { + return new BlockBuilder(nameIn, blockSupplierIn); + } + + public BlockBuilder item(Function itemSupplierIn) { + itemSupplier = itemSupplierIn; + + return this; + } + + public BlockBuilder tile(Supplier> tileSupplierIn) { + tileSupplier = tileSupplierIn; + hasTile = true; + + return this; + } +/* + public AABlock build() { + return new AABlock(this); + } + + */ + + } +}