From 682b8ccede6e6e0cdcb2846df9dd46a53ddcd980 Mon Sep 17 00:00:00 2001 From: drcrazy Date: Thu, 7 Mar 2019 11:49:23 +0300 Subject: [PATCH] Do not create already existing block property --- .../java/techreborn/blocks/BlockNuke.java | 1 - .../techreborn/blocks/lighting/BlockLamp.java | 4 +-- .../blocks/storage/BlockEnergyStorage.java | 34 ++----------------- .../blocks/transformers/BlockTransformer.java | 34 ++----------------- .../tiles/transformers/TileTransformer.java | 2 +- 5 files changed, 8 insertions(+), 67 deletions(-) diff --git a/src/main/java/techreborn/blocks/BlockNuke.java b/src/main/java/techreborn/blocks/BlockNuke.java index cf88b23a9..ab54a73b4 100644 --- a/src/main/java/techreborn/blocks/BlockNuke.java +++ b/src/main/java/techreborn/blocks/BlockNuke.java @@ -111,7 +111,6 @@ public class BlockNuke extends BaseBlock { @Override protected void fillStateContainer(StateContainer.Builder builder) { - OVERLAY = BooleanProperty.create("overlay"); builder.add(OVERLAY); } } diff --git a/src/main/java/techreborn/blocks/lighting/BlockLamp.java b/src/main/java/techreborn/blocks/lighting/BlockLamp.java index 0d9b9a8a2..b58607983 100644 --- a/src/main/java/techreborn/blocks/lighting/BlockLamp.java +++ b/src/main/java/techreborn/blocks/lighting/BlockLamp.java @@ -34,6 +34,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.state.BooleanProperty; import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; +import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; @@ -53,7 +54,7 @@ import techreborn.tiles.lighting.TileLamp; public class BlockLamp extends BaseTileBlock { - public static DirectionProperty FACING; + public static DirectionProperty FACING = BlockStateProperties.FACING; public static BooleanProperty ACTIVE; protected final VoxelShape[] shape; @@ -113,7 +114,6 @@ public class BlockLamp extends BaseTileBlock { // Block @Override protected void fillStateContainer(StateContainer.Builder builder) { - FACING = DirectionProperty.create("facing", EnumFacing.Plane.HORIZONTAL); ACTIVE = BooleanProperty.create("active"); builder.add(FACING, ACTIVE); } diff --git a/src/main/java/techreborn/blocks/storage/BlockEnergyStorage.java b/src/main/java/techreborn/blocks/storage/BlockEnergyStorage.java index 89cca4a4e..fcdecc3e0 100644 --- a/src/main/java/techreborn/blocks/storage/BlockEnergyStorage.java +++ b/src/main/java/techreborn/blocks/storage/BlockEnergyStorage.java @@ -24,8 +24,6 @@ package techreborn.blocks.storage; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterators; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -34,6 +32,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; +import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -48,14 +47,11 @@ import reborncore.common.blocks.BlockWrenchEventHandler; import reborncore.common.util.WrenchUtils; import techreborn.TechReborn; -import java.util.Iterator; -import java.util.Random; - /** * Created by Rushmead */ public abstract class BlockEnergyStorage extends BaseTileBlock { - public static DirectionProperty FACING = DirectionProperty.create("facing", Facings.ALL); + public static DirectionProperty FACING = BlockStateProperties.FACING;; public String name; public IMachineGuiHandler gui; @@ -101,7 +97,6 @@ public abstract class BlockEnergyStorage extends BaseTileBlock { // Block @Override protected void fillStateContainer(StateContainer.Builder builder) { - FACING = DirectionProperty.create("facing", Facings.ALL); builder.add(FACING); } @@ -142,29 +137,4 @@ public abstract class BlockEnergyStorage extends BaseTileBlock { } setFacing(facing, worldIn, pos); } - - public enum Facings implements Predicate, Iterable { - ALL; - - public EnumFacing[] facings() { - return new EnumFacing[] { EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST, - EnumFacing.UP, EnumFacing.DOWN }; - } - - public EnumFacing random(Random rand) { - EnumFacing[] aenumfacing = this.facings(); - return aenumfacing[rand.nextInt(aenumfacing.length)]; - } - - @Override - public boolean apply(EnumFacing p_apply_1_) { - return p_apply_1_ != null; - } - - @Override - public Iterator iterator() { - return Iterators.forArray(this.facings()); - } - } - } diff --git a/src/main/java/techreborn/blocks/transformers/BlockTransformer.java b/src/main/java/techreborn/blocks/transformers/BlockTransformer.java index a3acc616e..4799050bc 100644 --- a/src/main/java/techreborn/blocks/transformers/BlockTransformer.java +++ b/src/main/java/techreborn/blocks/transformers/BlockTransformer.java @@ -24,8 +24,6 @@ package techreborn.blocks.transformers; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterators; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -34,6 +32,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; +import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -47,14 +46,12 @@ import reborncore.common.blocks.BlockWrenchEventHandler; import reborncore.common.util.WrenchUtils; import techreborn.TechReborn; -import java.util.Iterator; -import java.util.Random; - /** * Created by Rushmead */ public abstract class BlockTransformer extends BaseTileBlock { - public static DirectionProperty FACING = DirectionProperty.create("facing", Facings.ALL); + + public static DirectionProperty FACING = BlockStateProperties.FACING; public String name; public BlockTransformer(String name) { @@ -90,7 +87,6 @@ public abstract class BlockTransformer extends BaseTileBlock { // Block @Override protected void fillStateContainer(StateContainer.Builder builder) { - FACING = DirectionProperty.create("facing", EnumFacing.Plane.HORIZONTAL); builder.add(FACING); } @@ -113,28 +109,4 @@ public abstract class BlockTransformer extends BaseTileBlock { return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ); } - - public enum Facings implements Predicate, Iterable { - ALL; - - public EnumFacing[] facings() { - return new EnumFacing[] { EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST, - EnumFacing.UP, EnumFacing.DOWN }; - } - - public EnumFacing random(Random rand) { - EnumFacing[] aenumfacing = this.facings(); - return aenumfacing[rand.nextInt(aenumfacing.length)]; - } - - @Override - public boolean apply(EnumFacing p_apply_1_) { - return p_apply_1_ != null; - } - - @Override - public Iterator iterator() { - return Iterators.forArray(this.facings()); - } - } } diff --git a/src/main/java/techreborn/tiles/transformers/TileTransformer.java b/src/main/java/techreborn/tiles/transformers/TileTransformer.java index 373fb2594..c46738dd7 100644 --- a/src/main/java/techreborn/tiles/transformers/TileTransformer.java +++ b/src/main/java/techreborn/tiles/transformers/TileTransformer.java @@ -53,7 +53,7 @@ public class TileTransformer extends TilePowerAcceptor implements IToolDrop, IListInfoProvider { @ConfigRegistry(config = "misc", category = "general", key = "IC2TransformersStyle", comment = "Input from dots side, output from other sides, like in IC2.") - public static boolean IC2TransformersStyle = false; + public static boolean IC2TransformersStyle = true; public String name; public Block wrenchDrop;