1696 - find + replace pass

This commit is contained in:
modmuss50 2019-01-13 16:51:50 +00:00
parent 368e2d48df
commit b6312b124a
94 changed files with 418 additions and 419 deletions

View file

@ -26,7 +26,7 @@ package techreborn.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.state.DirectionProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
@ -55,13 +55,13 @@ import javax.annotation.Nullable;
import java.util.List;
public class BlockAlarm extends BaseTileBlock {
public static PropertyDirection FACING;
public static DirectionProperty FACING;
public static PropertyBool ACTIVE;
private AxisAlignedBB[] bbs;
public BlockAlarm() {
super(Material.ROCK);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, false));
this.setDefaultState(this.blockState.getBaseState().with(FACING, EnumFacing.NORTH).with(ACTIVE, false));
this.bbs = GenBoundingBoxes(0.19, 0.81);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/lighting"));
BlockWrenchEventHandler.wrenableBlocks.add(this);
@ -88,18 +88,18 @@ public class BlockAlarm extends BaseTileBlock {
}
public static void setFacing(EnumFacing facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public static void setActive(boolean active, World world, BlockPos pos) {
EnumFacing facing = world.getBlockState(pos).getValue(FACING);
IBlockState state = world.getBlockState(pos).withProperty(ACTIVE, active).withProperty(FACING, facing);
IBlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing);
world.setBlockState(pos, state, 3);
}
@Override
protected BlockStateContainer createBlockState() {
FACING = PropertyDirection.create("facing");
FACING = DirectionProperty.create("facing");
ACTIVE = PropertyBool.create("active");
return new BlockStateContainer(this, FACING, ACTIVE);
}
@ -141,7 +141,7 @@ public class BlockAlarm extends BaseTileBlock {
public IBlockState getStateFromMeta(int meta) {
Boolean active = (meta & 8) == 8;
EnumFacing facing = EnumFacing.byIndex(meta & 7);
return this.getDefaultState().withProperty(FACING, facing).withProperty(ACTIVE, active);
return this.getDefaultState().with(FACING, facing).with(ACTIVE, active);
}
@Nullable
@ -153,7 +153,7 @@ public class BlockAlarm extends BaseTileBlock {
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
return this.getDefaultState().withProperty(FACING, facing);
return this.getDefaultState().with(FACING, facing);
}
@Override

View file

@ -39,8 +39,8 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import techreborn.TechReborn;
import techreborn.tiles.TileEntityFlare;
import java.util.List;
@ -58,7 +58,7 @@ public class BlockFlare extends BlockContainer {
super(Material.REDSTONE_LIGHT);
setCreativeTab(TechReborn.TAB);
setTranslationKey("techreborn.flare");
this.setDefaultState(this.blockState.getBaseState().withProperty(COLOR, EnumDyeColor.WHITE));
this.setDefaultState(this.blockState.getBaseState().with(COLOR, EnumDyeColor.WHITE));
}
@Override
@ -74,7 +74,7 @@ public class BlockFlare extends BlockContainer {
return (state.getValue(COLOR)).getMetadata();
}
@SideOnly(Side.CLIENT)
@OnlyIn(Dist.CLIENT)
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
for (EnumDyeColor enumdyecolor : EnumDyeColor.values()) {
list.add(new ItemStack(itemIn, 1, enumdyecolor.getMetadata()));
@ -83,7 +83,7 @@ public class BlockFlare extends BlockContainer {
@Override
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(COLOR, EnumDyeColor.byMetadata(meta));
return this.getDefaultState().with(COLOR, EnumDyeColor.byMetadata(meta));
}
@Override
@ -102,7 +102,7 @@ public class BlockFlare extends BlockContainer {
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Dist.CLIENT)
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}

View file

@ -54,7 +54,7 @@ public class BlockNuke extends BaseBlock {
public BlockNuke() {
super(Material.TNT);
this.setDefaultState(this.blockState.getBaseState().withProperty(OVERLAY, false));
this.setDefaultState(this.blockState.getBaseState().with(OVERLAY, false));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
@ -123,7 +123,7 @@ public class BlockNuke extends BaseBlock {
@Override
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(OVERLAY, (meta & 1) > 0);
return this.getDefaultState().with(OVERLAY, (meta & 1) > 0);
}
@Override

View file

@ -29,8 +29,8 @@ import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
@ -57,7 +57,7 @@ public class BlockReinforcedGlass extends BlockGlass {
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Dist.CLIENT)
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}

View file

@ -36,8 +36,8 @@ import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
@ -49,8 +49,8 @@ public class BlockRubberLeaves extends BlockLeaves {
public BlockRubberLeaves() {
super();
this.setDefaultState(this.getDefaultState().withProperty(CHECK_DECAY, true)
.withProperty(DECAYABLE, true));
this.setDefaultState(this.getDefaultState().with(CHECK_DECAY, true)
.with(DECAYABLE, true));
Blocks.FIRE.setFireInfo(this, 30, 60);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, CHECK_DECAY, DECAYABLE));
}
@ -90,8 +90,8 @@ public class BlockRubberLeaves extends BlockLeaves {
@Override
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(DECAYABLE, (meta & 1) == 0)
.withProperty(CHECK_DECAY, (meta & 2) > 0);
return this.getDefaultState().with(DECAYABLE, (meta & 1) == 0)
.with(CHECK_DECAY, (meta & 2) > 0);
}
@Override
@ -106,17 +106,17 @@ public class BlockRubberLeaves extends BlockLeaves {
return meta;
}
@SideOnly(Side.CLIENT)
@OnlyIn(Dist.CLIENT)
public int getBlockColor() {
return 16777215;
}
@SideOnly(Side.CLIENT)
@OnlyIn(Dist.CLIENT)
public int getRenderColor(IBlockState state) {
return 16777215;
}
@SideOnly(Side.CLIENT)
@OnlyIn(Dist.CLIENT)
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) {
return 16777215;
}

View file

@ -28,7 +28,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.state.DirectionProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
@ -63,14 +63,14 @@ import java.util.Random;
*/
public class BlockRubberLog extends Block {
public static PropertyDirection SAP_SIDE = PropertyDirection.create("sapside", EnumFacing.Plane.HORIZONTAL);
public static DirectionProperty SAP_SIDE = DirectionProperty.create("sapside", EnumFacing.Plane.HORIZONTAL);
public static PropertyBool HAS_SAP = PropertyBool.create("hassap");
public BlockRubberLog() {
super(Material.WOOD);
this.setHardness(2.0F);
this.setDefaultState(
this.getDefaultState().withProperty(SAP_SIDE, EnumFacing.NORTH).withProperty(HAS_SAP, false));
this.getDefaultState().with(SAP_SIDE, EnumFacing.NORTH).with(HAS_SAP, false));
this.setTickRandomly(true);
this.setSoundType(SoundType.WOOD);
Blocks.FIRE.setFireInfo(this, 5, 5);
@ -91,7 +91,7 @@ public class BlockRubberLog extends Block {
tempMeta -= 3;
}
EnumFacing facing = EnumFacing.byHorizontalIndex(tempMeta);
return this.getDefaultState().withProperty(SAP_SIDE, facing).withProperty(HAS_SAP, hasSap);
return this.getDefaultState().with(SAP_SIDE, facing).with(HAS_SAP, hasSap);
}
@Override
@ -155,7 +155,7 @@ public class BlockRubberLog extends Block {
EnumFacing facing = EnumFacing.byHorizontalIndex(rand.nextInt(4));
if (worldIn.getBlockState(pos.down()).getBlock() == this
&& worldIn.getBlockState(pos.up()).getBlock() == this) {
worldIn.setBlockState(pos, state.withProperty(HAS_SAP, true).withProperty(SAP_SIDE, facing));
worldIn.setBlockState(pos, state.with(HAS_SAP, true).with(SAP_SIDE, facing));
}
}
}
@ -176,7 +176,7 @@ public class BlockRubberLog extends Block {
if ((capEnergy != null && capEnergy.getEnergyStored() > 20) || stack.getItem() instanceof ItemTreeTap) {
if (state.getValue(HAS_SAP) && state.getValue(SAP_SIDE) == side) {
worldIn.setBlockState(pos,
state.withProperty(HAS_SAP, false).withProperty(SAP_SIDE, EnumFacing.byHorizontalIndex(0)));
state.with(HAS_SAP, false).with(SAP_SIDE, EnumFacing.byHorizontalIndex(0)));
worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.SAP_EXTRACT, SoundCategory.BLOCKS,
0.6F, 1F);
if (!worldIn.isRemote) {

View file

@ -55,14 +55,14 @@ public abstract class BlockRubberPlankSlab extends BlockSlab {
this.name = name;
IBlockState iblockstate = this.blockState.getBaseState();
if (!this.isDouble()) {
iblockstate = iblockstate.withProperty(HALF, EnumBlockHalf.BOTTOM);
iblockstate = iblockstate.with(HALF, EnumBlockHalf.BOTTOM);
halfslab = this;
}
setHarvestLevel("axe", 0);
setHardness(2.0F);
setResistance(15);
setSoundType(SoundType.WOOD);
this.setDefaultState(iblockstate.withProperty(VARIANT, BlockRubberPlankSlab.Variant.DEFAULT));
this.setDefaultState(iblockstate.with(VARIANT, BlockRubberPlankSlab.Variant.DEFAULT));
useNeighborBrightness = true;
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
@ -84,10 +84,10 @@ public abstract class BlockRubberPlankSlab extends BlockSlab {
@Override
public IBlockState getStateFromMeta(int meta) {
IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockRubberPlankSlab.Variant.DEFAULT);
IBlockState iblockstate = this.getDefaultState().with(VARIANT, BlockRubberPlankSlab.Variant.DEFAULT);
if (!this.isDouble()) {
iblockstate = iblockstate.withProperty(HALF, (meta & 8) == 0 ? EnumBlockHalf.BOTTOM : EnumBlockHalf.TOP);
iblockstate = iblockstate.with(HALF, (meta & 8) == 0 ? EnumBlockHalf.BOTTOM : EnumBlockHalf.TOP);
}
return iblockstate;

View file

@ -42,7 +42,7 @@ import java.util.Random;
public class BlockRubberSapling extends BlockSapling {
public BlockRubberSapling() {
this.setDefaultState(this.getDefaultState().withProperty(STAGE, 0));
this.setDefaultState(this.getDefaultState().with(STAGE, 0));
setSoundType(SoundType.PLANT);
}

View file

@ -64,7 +64,7 @@ public class BlockStorage extends BaseBlock {
// if (meta > types.length) {
// meta = 0;
// }
// return getBlockState().getBaseState().withProperty(TYPE, typesList.get(meta));
// return getBlockState().getBaseState().with(TYPE, typesList.get(meta));
// }
//
// @Override

View file

@ -85,7 +85,7 @@ public class BlockCable extends BlockContainer {
this.type = type;
setHardness(1F);
setResistance(8F);
setDefaultState(getDefaultState().withProperty(EAST, false).withProperty(WEST, false).withProperty(NORTH, false).withProperty(SOUTH, false).withProperty(UP, false).withProperty(DOWN, false));
setDefaultState(getDefaultState().with(EAST, false).with(WEST, false).with(NORTH, false).with(SOUTH, false).with(UP, false).with(DOWN, false));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
@ -226,7 +226,7 @@ public class BlockCable extends BlockContainer {
for (EnumFacing facing : EnumFacing.values()) {
TileEntity tileEntity = getTileEntitySafely(worldIn, pos.offset(facing));
if (tileEntity != null) {
actualState = actualState.withProperty(getProperty(facing), tileEntity.hasCapability(CapabilityEnergy.ENERGY, facing.getOpposite()));
actualState = actualState.with(getProperty(facing), tileEntity.hasCapability(CapabilityEnergy.ENERGY, facing.getOpposite()));
}
}
return actualState;

View file

@ -37,8 +37,8 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -78,7 +78,7 @@ public class BlockFusionCoil extends Block {
return false;
}
@SideOnly(Side.CLIENT)
@OnlyIn(Dist.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, ITooltipFlag advanced) {
super.addInformation(stack, player, tooltip, advanced);

View file

@ -26,7 +26,7 @@ package techreborn.blocks.lighting;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.state.DirectionProperty;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
@ -52,7 +52,7 @@ import techreborn.tiles.lighting.TileLamp;
public class BlockLamp extends BaseTileBlock {
public static PropertyDirection FACING;
public static DirectionProperty FACING;
public static PropertyBool ACTIVE;
private AxisAlignedBB[] bbs;
@ -61,7 +61,7 @@ public class BlockLamp extends BaseTileBlock {
public BlockLamp(int brightness, int cost, double depth, double width) {
super(Material.REDSTONE_LIGHT);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, false));
this.setDefaultState(this.blockState.getBaseState().with(FACING, EnumFacing.NORTH).with(ACTIVE, false));
this.bbs = GenBoundingBoxes(depth, width);
this.cost = cost;
this.brightness = brightness;
@ -93,12 +93,12 @@ public class BlockLamp extends BaseTileBlock {
}
public static void setFacing(EnumFacing facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public static void setActive(Boolean active, World world, BlockPos pos) {
EnumFacing facing = (EnumFacing)world.getBlockState(pos).getValue(FACING);
IBlockState state = world.getBlockState(pos).withProperty(ACTIVE, active).withProperty(FACING, facing);
IBlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing);
world.setBlockState(pos, state, 3);
}
@ -115,7 +115,7 @@ public class BlockLamp extends BaseTileBlock {
// Block
@Override
protected BlockStateContainer createBlockState() {
FACING = PropertyDirection.create("facing");
FACING = DirectionProperty.create("facing");
ACTIVE = PropertyBool.create("active");
return new BlockStateContainer(this, FACING, ACTIVE);
}
@ -123,7 +123,7 @@ public class BlockLamp extends BaseTileBlock {
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
return this.getDefaultState().withProperty(FACING, facing);
return this.getDefaultState().with(FACING, facing);
}
@Override
@ -196,6 +196,6 @@ public class BlockLamp extends BaseTileBlock {
public IBlockState getStateFromMeta(int meta) {
Boolean active = (meta&8)==8;
EnumFacing facing = EnumFacing.byIndex(meta&7);
return this.getDefaultState().withProperty(FACING, facing).withProperty(ACTIVE, active);
return this.getDefaultState().with(FACING, facing).with(ACTIVE, active);
}
}

View file

@ -28,12 +28,12 @@ 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.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.state.DirectionProperty;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@ -53,14 +53,14 @@ import java.util.Random;
* Created by Rushmead
*/
public abstract class BlockEnergyStorage extends BaseTileBlock {
public static PropertyDirection FACING = PropertyDirection.create("facing", Facings.ALL);
public static DirectionProperty FACING = DirectionProperty.create("facing", Facings.ALL);
public String name;
public int guiID;
public BlockEnergyStorage(String name, int guiID) {
super(Material.IRON);
setHardness(2f);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
this.setDefaultState(this.blockState.getBaseState().with(FACING, EnumFacing.NORTH));
this.name = name;
this.guiID = guiID;
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/energy"));
@ -68,7 +68,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
}
public void setFacing(EnumFacing facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public EnumFacing getSideFromint(int i) {
@ -143,7 +143,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
} else {
facing = side.getOpposite();
}
world.setBlockState(pos, state.withProperty(BlockEnergyStorage.FACING, facing));
world.setBlockState(pos, state.with(BlockEnergyStorage.FACING, facing));
return true;
}
@ -177,7 +177,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
@Override
protected BlockStateContainer createBlockState() {
FACING = PropertyDirection.create("facing", Facings.ALL);
FACING = DirectionProperty.create("facing", Facings.ALL);
return new BlockStateContainer(this, FACING);
}
@ -203,7 +203,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing facing = getSideFromint(meta);
return this.getDefaultState().withProperty(FACING, facing);
return this.getDefaultState().with(FACING, facing);
}
public enum Facings implements Predicate<EnumFacing>, Iterable<EnumFacing> {

View file

@ -32,8 +32,8 @@ import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -52,7 +52,7 @@ public class BlockIronFurnace extends BlockMachineBase {
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/tier0_machines"));
}
@SideOnly(Side.CLIENT)
@OnlyIn(Dist.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(final World worldIn, final BlockPos pos, final IBlockState state, final Random rand) {
if (this.isActive(state)) {

View file

@ -44,8 +44,8 @@ import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import reborncore.api.IToolDrop;
import reborncore.api.ToolManager;
import reborncore.api.tile.IMachineGuiHandler;
@ -132,7 +132,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
} else if (type.equals("you")) {
newType = "all";
}
worldIn.setBlockState(pos, state.withProperty(TYPE, newType));
worldIn.setBlockState(pos, state.with(TYPE, newType));
}
}
}
@ -156,7 +156,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
if (meta > types.length) {
meta = 0;
}
return getBlockState().getBaseState().withProperty(TYPE, typeNamesList.get(meta));
return getBlockState().getBaseState().with(TYPE, typeNamesList.get(meta));
}
@Override
@ -181,7 +181,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Dist.CLIENT)
public void getSubBlocks(CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
for (int meta = 0; meta < types.length; meta++) {
list.add(new ItemStack(this, 1, meta));

View file

@ -28,7 +28,7 @@ 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.properties.PropertyDirection;
import net.minecraft.state.DirectionProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
@ -53,20 +53,20 @@ import java.util.Random;
* Created by Rushmead
*/
public abstract class BlockTransformer extends BaseTileBlock {
public static PropertyDirection FACING = PropertyDirection.create("facing", Facings.ALL);
public static DirectionProperty FACING = DirectionProperty.create("facing", Facings.ALL);
public String name;
public BlockTransformer(String name) {
super(Material.IRON);
setHardness(2f);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
this.setDefaultState(this.blockState.getBaseState().with(FACING, EnumFacing.NORTH));
this.name = name;
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/energy"));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
public void setFacing(EnumFacing facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public EnumFacing getFacing(IBlockState state) {
@ -125,14 +125,14 @@ public abstract class BlockTransformer extends BaseTileBlock {
enumfacing = EnumFacing.WEST;
}
worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
worldIn.setBlockState(pos, state.with(FACING, enumfacing), 2);
}
}
// Block
@Override
protected BlockStateContainer createBlockState() {
FACING = PropertyDirection.create("facing", Facings.ALL);
FACING = DirectionProperty.create("facing", Facings.ALL);
return new BlockStateContainer(this, FACING);
}
@ -186,7 +186,7 @@ public abstract class BlockTransformer extends BaseTileBlock {
} else {
facing = side.getOpposite();
}
world.setBlockState(pos, state.withProperty(BlockTransformer.FACING, facing));
world.setBlockState(pos, state.with(BlockTransformer.FACING, facing));
return true;
}
@ -202,7 +202,7 @@ public abstract class BlockTransformer extends BaseTileBlock {
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing facing = getSideFromint(meta);
return this.getDefaultState().withProperty(FACING, facing);
return this.getDefaultState().with(FACING, facing);
}
public enum Facings implements Predicate<EnumFacing>, Iterable<EnumFacing> {