diff --git a/build.gradle b/build.gradle index e14f77df7..57fcc76e8 100644 --- a/build.gradle +++ b/build.gradle @@ -23,12 +23,12 @@ if(hasProperty('buildnumber')){ } minecraft { - version = "1.12.2-14.23.1.2599" + version = "1.12.2-14.23.4.2739" runDir = "run" - mappings = "snapshot_20180119" + mappings = "snapshot_20180720" + makeObfSourceJar = false replaceIn "ActuallyAdditions.java" replace "@VERSION@", project.version.toString() - makeObfSourceJar = false } repositories { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java index 8213984fc..9a8459b99 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java @@ -147,7 +147,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta)); + return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override @@ -184,8 +184,8 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud @Override - public String getUnlocalizedName(ItemStack stack){ - return this.getUnlocalizedName(); + public String getTranslationKey(ItemStack stack){ + return this.getTranslationKey(); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java index f487c8f41..9d1a0a158 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java @@ -82,7 +82,7 @@ public class BlockBreaker extends BlockContainerBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta)); + return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java index 34781e491..6ff8b82eb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java @@ -98,7 +98,7 @@ public class BlockCoalGenerator extends BlockContainerBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta)); + return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java index 10dbb5b92..b3e7dde88 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java @@ -108,7 +108,7 @@ public class BlockCoffeeMachine extends BlockContainerBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta)); + return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java index a95796053..2629a9c9b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java @@ -163,8 +163,8 @@ public class BlockColoredLamp extends BlockBase{ @Override - public String getUnlocalizedName(ItemStack stack){ - return InitBlocks.blockColoredLamp.getUnlocalizedName()+"_"+ALL_LAMP_TYPES[stack.getItemDamage()].regName; + public String getTranslationKey(ItemStack stack){ + return InitBlocks.blockColoredLamp.getTranslationKey()+"_"+ALL_LAMP_TYPES[stack.getItemDamage()].regName; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java index 5ed2f8f44..c05adbd1f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java @@ -71,6 +71,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay { } @Override + @Deprecated public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn, boolean someBool) { addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS); addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST); 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 55466b799..d54968f01 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java @@ -96,8 +96,8 @@ public class BlockCrystal extends BlockBase{ } @Override - public String getUnlocalizedName(ItemStack stack){ - return stack.getItemDamage() >= ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_CRYSTALS[stack.getItemDamage()].name; + public String getTranslationKey(ItemStack stack){ + return stack.getItemDamage() >= ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_CRYSTALS[stack.getItemDamage()].name; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java index a264917e6..ed718fd3b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java @@ -79,7 +79,7 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta)); + return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override @@ -114,8 +114,7 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo } @Override - @SideOnly(Side.CLIENT) - public BlockRenderLayer getBlockLayer(){ + public BlockRenderLayer getRenderLayer(){ return BlockRenderLayer.TRANSLUCENT; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java index fe5de2c66..837488b7b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java @@ -78,7 +78,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta)); + return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java index 73cf4a252..839eceb01 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java @@ -77,7 +77,7 @@ public class BlockDropper extends BlockContainerBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta)); + return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFakeAir.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFakeAir.java deleted file mode 100644 index ab103d586..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFakeAir.java +++ /dev/null @@ -1,78 +0,0 @@ -package de.ellpeck.actuallyadditions.mod.blocks; - -import javax.annotation.Nullable; - -import de.ellpeck.actuallyadditions.mod.RegistryHandler; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class BlockFakeAir extends Block -{ - public BlockFakeAir(String name){ - super(Material.AIR); - setRegistryName(name); - setUnlocalizedName("stop"); - RegistryHandler.BLOCKS_TO_REGISTER.add(this); - } - - /** - * The type of render function called. MODEL for mixed tesr and static model, MODELBLOCK_ANIMATED for TESR-only, - * LIQUID for vanilla liquids, INVISIBLE to skip all rendering - */ - public EnumBlockRenderType getRenderType(IBlockState state) - { - return EnumBlockRenderType.INVISIBLE; - } - - @Nullable - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) - { - return NULL_AABB; - } - - /** - * Used to determine ambient occlusion and culling when rebuilding chunks for render - */ - public boolean isOpaqueCube(IBlockState state) - { - return false; - } - - public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid) - { - return false; - } - - /** - * Spawns this Block's drops into the World as EntityItems. - */ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - } - - /** - * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) - */ - public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) - { - return true; - } - - public boolean isFullCube(IBlockState state) - { - return false; - } - - public BlockFaceShape getBlockFaceShape(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) - { - return BlockFaceShape.UNDEFINED; - } -} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java index 88b476164..89209bc36 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java @@ -73,7 +73,7 @@ public class BlockFarmer extends BlockContainerBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta)); + return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java index 6035bb770..a36e0f15d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java @@ -84,7 +84,7 @@ public class BlockFluidCollector extends BlockContainerBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta)); + return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java index f762baf5e..547d34b19 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java @@ -101,7 +101,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{ @Override public IBlockState getStateFromMeta(int meta){ boolean isOn = meta >= 4; - EnumFacing facing = EnumFacing.getHorizontal(isOn ? meta-4 : meta); + EnumFacing facing = EnumFacing.byHorizontalIndex(isOn ? meta-4 : meta); return this.getDefaultState().withProperty(BlockHorizontal.FACING, facing).withProperty(IS_ON, isOn); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java index e0b2102ee..9088ede29 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java @@ -63,8 +63,7 @@ public class BlockGreenhouseGlass extends BlockBase { } @Override - @SideOnly(Side.CLIENT) - public BlockRenderLayer getBlockLayer() { + public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java index 44711a4cc..51bbefc70 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java @@ -92,8 +92,8 @@ public class BlockInputter extends BlockContainerBase{ @Override - public String getUnlocalizedName(ItemStack stack){ - return this.getUnlocalizedName(); + public String getTranslationKey(ItemStack stack){ + return this.getTranslationKey(); } @Override @@ -112,7 +112,7 @@ public class BlockInputter extends BlockContainerBase{ this.toPick = this.rand.nextInt(NAME_FLAVOR_AMOUNTS)+1; } - return StringUtil.localize(this.getUnlocalizedName()+".name")+" ("+StringUtil.localize("tile."+ActuallyAdditions.MODID+".block_inputter.add."+this.toPick+".name")+")"; + return StringUtil.localize(this.getTranslationKey()+".name")+" ("+StringUtil.localize("tile."+ActuallyAdditions.MODID+".block_inputter.add."+this.toPick+".name")+")"; } else return super.getItemStackDisplayName(stack); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java index 06744b397..d783416bb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java @@ -57,6 +57,7 @@ public class BlockItemViewerHopping extends BlockItemViewer{ } @Override + @Deprecated public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn, boolean someBool){ addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB); addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB); @@ -98,14 +99,13 @@ public class BlockItemViewerHopping extends BlockItemViewer{ } @Override - @SideOnly(Side.CLIENT) - public BlockRenderLayer getBlockLayer(){ + public BlockRenderLayer getRenderLayer(){ return BlockRenderLayer.CUTOUT_MIPPED; } @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta)); + return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java index 56e255cd4..10b8e84c3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java @@ -63,7 +63,7 @@ public class BlockLampPowerer extends BlockBase{ if(!world.isRemote){ IBlockState state = world.getBlockState(pos); BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state)); - this.updateLampsAtPos(world, coords, world.isBlockIndirectlyGettingPowered(pos) > 0, new ArrayList()); + this.updateLampsAtPos(world, coords, world.getRedstonePowerFromNeighbors(pos) > 0, new ArrayList()); } } @@ -104,7 +104,7 @@ public class BlockLampPowerer extends BlockBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta)); + return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override 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 384bb531a..9bab0b622 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java @@ -136,7 +136,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.getFront(meta)); + return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override @@ -265,7 +265,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{ expl = relay.getCompassDisplayString(); } else{ - expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localizeFormatted("info."+ActuallyAdditions.MODID+".laserRelay.mode.noCompasss", StringUtil.localize(ConfigValues.itemCompassConfigurator.getUnlocalizedName()+".name")); + expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localizeFormatted("info."+ActuallyAdditions.MODID+".laserRelay.mode.noCompasss", StringUtil.localize(ConfigValues.itemCompassConfigurator.getTranslationKey()+".name")); } StringUtil.drawSplitString(minecraft.fontRenderer, expl, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+15, Integer.MAX_VALUE, StringUtil.DECIMAL_COLOR_WHITE, true); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java index 17d376774..0e146075d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java @@ -91,8 +91,8 @@ public class BlockMisc extends BlockBase{ @Override - public String getUnlocalizedName(ItemStack stack){ - return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_MISC_BLOCKS[stack.getItemDamage()].name; + public String getTranslationKey(ItemStack stack){ + return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_MISC_BLOCKS[stack.getItemDamage()].name; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java index 1d3b33810..a31ae296b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java @@ -100,7 +100,7 @@ public class BlockOilGenerator extends BlockContainerBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta)); + return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java index fa124928a..abcf88a36 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java @@ -176,8 +176,8 @@ public class BlockSlabs extends BlockBase{ @Override - public String getUnlocalizedName(ItemStack stack){ - return this.getUnlocalizedName(); + public String getTranslationKey(ItemStack stack){ + return this.getTranslationKey(); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java index aa9676f54..3d0b4bd21 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java @@ -99,7 +99,7 @@ public class BlockSmileyCloud extends BlockContainerBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta)); + return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java index 569981ea0..289d81046 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java @@ -195,8 +195,8 @@ public class BlockTinyTorch extends BlockBase{ if(enumfacing.getAxis().isHorizontal()){ EnumFacing enumfacing1 = enumfacing.getOpposite(); - worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0+0.35D*(double)enumfacing1.getFrontOffsetX(), d1+0.22D, d2+0.35D*(double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D); - worldIn.spawnParticle(EnumParticleTypes.FLAME, d0+0.35D*(double)enumfacing1.getFrontOffsetX(), d1+0.22D, d2+0.35D*(double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D); + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0+0.35D*(double)enumfacing1.getXOffset(), d1+0.22D, d2+0.35D*(double)enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D); + worldIn.spawnParticle(EnumParticleTypes.FLAME, d0+0.35D*(double)enumfacing1.getXOffset(), d1+0.22D, d2+0.35D*(double)enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D); } else{ worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D); @@ -231,8 +231,7 @@ public class BlockTinyTorch extends BlockBase{ } @Override - @SideOnly(Side.CLIENT) - public BlockRenderLayer getBlockLayer(){ + public BlockRenderLayer getRenderLayer(){ return BlockRenderLayer.CUTOUT; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java index ea58ca9a7..6fab55ca4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java @@ -118,7 +118,7 @@ public class BlockTreasureChest extends BlockBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta)); + return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java index 262a7922b..88f2ea0f7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java @@ -34,8 +34,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; public class BlockWildPlant extends BlockBushBase{ @@ -63,7 +61,6 @@ public class BlockWildPlant extends BlockBushBase{ } @Override - @SideOnly(Side.CLIENT) public void getSubBlocks(CreativeTabs tab, NonNullList list){ for(int j = 0; j < ALL_WILD_PLANTS.length; j++){ list.add(new ItemStack(this, 1, j)); @@ -127,8 +124,8 @@ public class BlockWildPlant extends BlockBushBase{ @Override - public String getUnlocalizedName(ItemStack stack){ - return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_WILD_PLANTS[stack.getItemDamage()].name; + public String getTranslationKey(ItemStack stack){ + return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_WILD_PLANTS[stack.getItemDamage()].name; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java index 6c3d93069..f431d7821 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java @@ -74,7 +74,7 @@ public class BlockXPSolidifier extends BlockContainerBase{ @Override public IBlockState getStateFromMeta(int meta){ - return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta)); + return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java index b68667545..d5ada794c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java @@ -172,7 +172,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB TileEntity tile = world.getTileEntity(pos); if(tile instanceof TileEntityBase){ TileEntityBase base = (TileEntityBase)tile; - boolean powered = world.isBlockIndirectlyGettingPowered(pos) > 0; + boolean powered = world.getRedstonePowerFromNeighbors(pos) > 0; boolean wasPowered = base.isRedstonePowered; if(powered && !wasPowered){ if(base.respondsToPulses()){ @@ -262,7 +262,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB } ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state)); - if(!data.hasNoTags()){ + if(!data.isEmpty()){ stack.setTagCompound(new NBTTagCompound()); stack.getTagCompound().setTag("Data", data); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java index 0a8aecd4b..6051dfbe4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java @@ -26,8 +26,8 @@ public class ItemBlockBase extends ItemBlock{ @Override - public String getUnlocalizedName(ItemStack stack){ - return this.getUnlocalizedName(); + public String getTranslationKey(ItemStack stack){ + return this.getTranslationKey(); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java index 1451b6142..0757d276b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java @@ -63,7 +63,7 @@ public class ItemDisplay{ for(int k = 0; k < list.size(); ++k){ if(k == 0){ - list.set(k, this.stack.getRarity().rarityColor+list.get(k)); + list.set(k, this.stack.getRarity().color+list.get(k)); } else{ list.set(k, TextFormatting.GRAY+list.get(k)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FoodCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FoodCrafting.java index ad7c6713e..e8233f14d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FoodCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FoodCrafting.java @@ -20,6 +20,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.Ingredient; import net.minecraftforge.fml.common.registry.GameRegistry; public final class FoodCrafting{ @@ -44,7 +45,7 @@ public final class FoodCrafting{ public static void init(){ - ItemStack knifeStack = new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD); + Ingredient knife = Ingredient.fromItem(InitItems.itemKnife); //Rice Bread GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RICE_DOUGH.ordinal()), @@ -52,7 +53,7 @@ public final class FoodCrafting{ //Bacon RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemFoods, 3, TheFoods.BACON.ordinal()), - knifeStack.copy(), new ItemStack(Items.COOKED_PORKCHOP)); + knife, new ItemStack(Items.COOKED_PORKCHOP)); recipeBacon = RecipeUtil.lastIRecipe(); //Baguette @@ -66,7 +67,7 @@ public final class FoodCrafting{ 'M', new ItemStack(Blocks.BROWN_MUSHROOM), 'C', "cropCarrot", 'F', new ItemStack(Items.COOKED_FISH, 1, Util.WILDCARD), - 'K', knifeStack.copy(), + 'K', knife, 'H', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal())); recipePizza = RecipeUtil.lastIRecipe(); @@ -75,7 +76,7 @@ public final class FoodCrafting{ "KT ", "CB ", " T ", 'T', new ItemStack(InitItems.itemFoods, 1, TheFoods.TOAST.ordinal()), 'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), - 'K', knifeStack.copy(), + 'K', knife, 'B', new ItemStack(Items.COOKED_BEEF)); recipeHamburger = RecipeUtil.lastIRecipe(); @@ -93,13 +94,13 @@ public final class FoodCrafting{ 'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), 'F', new ItemStack(Items.COOKED_BEEF, 1, Util.WILDCARD), 'B', new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), - 'K', knifeStack.copy()); + 'K', knife); recipeSubSandwich = RecipeUtil.lastIRecipe(); //French Fry RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.FRENCH_FRY.ordinal()), new ItemStack(Items.BAKED_POTATO), - knifeStack.copy()); + knife); recipeFrenchFry = RecipeUtil.lastIRecipe(); //French Fries @@ -131,7 +132,7 @@ public final class FoodCrafting{ //Carrot Juice RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CARROT_JUICE.ordinal()), - new ItemStack(Items.GLASS_BOTTLE), "cropCarrot", knifeStack.copy()); + new ItemStack(Items.GLASS_BOTTLE), "cropCarrot", knife); recipeCarrotJuice = RecipeUtil.lastIRecipe(); //Spaghetti @@ -143,7 +144,7 @@ public final class FoodCrafting{ //Noodle RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()), - "cropWheat", knifeStack.copy()); + "cropWheat", knife); recipeNoodle = RecipeUtil.lastIRecipe(); //Chocolate diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeBioMash.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeBioMash.java index c91422512..21f2bc8d8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeBioMash.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeBioMash.java @@ -29,7 +29,7 @@ import net.minecraftforge.registries.IForgeRegistryEntry; public class RecipeBioMash extends IForgeRegistryEntry.Impl implements IRecipe{ public RecipeBioMash(ResourceLocation location){ - RecipeHelper.addRecipe(location.getResourcePath(), this); + RecipeHelper.addRecipe(location.getPath(), this); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java index affef8031..7924a598c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java @@ -26,7 +26,7 @@ public class RecipeKeepDataShaped extends ShapedOreRecipe{ super(group, result, recipe); this.nbtCopyStack = nbtCopyStack; - RecipeHelper.addRecipe(group.getResourcePath(), this); + RecipeHelper.addRecipe(group.getPath(), this); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java index bf20f7f93..dc0265938 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java @@ -26,7 +26,7 @@ public class RecipeKeepDataShapeless extends ShapelessOreRecipe{ super(group, result, recipe); this.nbtCopyStack = nbtCopyStack; - RecipeHelper.addRecipe(group.getResourcePath(), this); + RecipeHelper.addRecipe(group.getPath(), this); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipePotionRingCharging.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipePotionRingCharging.java index 8dfa6f1da..633991466 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipePotionRingCharging.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipePotionRingCharging.java @@ -26,7 +26,7 @@ import net.minecraftforge.registries.IForgeRegistryEntry; public class RecipePotionRingCharging extends IForgeRegistryEntry.Impl implements IRecipe{ public RecipePotionRingCharging(ResourceLocation location){ - RecipeHelper.addRecipe(location.getResourcePath(), this); + RecipeHelper.addRecipe(location.getPath(), this); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java index ddbdb9e9c..b7671ea78 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java @@ -47,7 +47,7 @@ public class CreativeTab extends CreativeTabs{ } @Override - public ItemStack getTabIconItem(){ + public ItemStack createIcon(){ return new ItemStack(InitItems.itemBooklet); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java index ef1e8bbb2..d82ed0069 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java @@ -116,7 +116,7 @@ public class ClientEvents{ event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+Item.REGISTRY.getNameForObject(event.getItemStack().getItem())); //Base Item's Unlocalized Name - String baseName = event.getItemStack().getItem().getUnlocalizedName(); + String baseName = event.getItemStack().getItem().getTranslationKey(); if(baseName != null){ event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".baseUnlocName.desc")+":"); event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+baseName); @@ -129,7 +129,7 @@ public class ClientEvents{ event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+meta+(max > 0 ? "/"+max : "")); //Unlocalized Name - String metaName = event.getItemStack().getItem().getUnlocalizedName(event.getItemStack()); + String metaName = event.getItemStack().getItem().getTranslationKey(event.getItemStack()); if(metaName != null && baseName != null && !metaName.equals(baseName)){ event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".unlocName.desc")+":"); event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+metaName); @@ -137,7 +137,7 @@ public class ClientEvents{ //NBT NBTTagCompound compound = event.getItemStack().getTagCompound(); - if(compound != null && !compound.hasNoTags()){ + if(compound != null && !compound.isEmpty()){ event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".nbt.desc")+":"); if(GuiScreen.isShiftKeyDown()){ int limit = ConfigIntValues.CTRL_INFO_NBT_CHAR_LIMIT.getValue(); @@ -205,7 +205,7 @@ public class ClientEvents{ expl = TextFormatting.GREEN+StringUtil.localize("info."+ActuallyAdditions.MODID+".redstoneMode.validItem"); } else{ - expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localizeFormatted("info."+ActuallyAdditions.MODID+".redstoneMode.invalidItem", StringUtil.localize(ConfigValues.itemRedstoneTorchConfigurator.getUnlocalizedName()+".name")); + expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localizeFormatted("info."+ActuallyAdditions.MODID+".redstoneMode.invalidItem", StringUtil.localize(ConfigValues.itemRedstoneTorchConfigurator.getTranslationKey()+".name")); } font.drawStringWithShadow(expl, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java index 6186fc04e..73d81b368 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java @@ -118,14 +118,14 @@ public class OreGen implements IWorldGenerator{ //Generate Treasure Chests if(ConfigBoolValues.DO_TREASURE_CHEST_GEN.isEnabled()){ if(event.getRand().nextInt(40) == 0){ - BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8); + BlockPos randomPos = event.getChunkPos().getBlock(event.getRand().nextInt(16)+8, 0, event.getRand().nextInt(16)+8); randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos); if(event.getWorld().getBiome(randomPos) instanceof BiomeOcean){ if(randomPos.getY() >= 25 && randomPos.getY() <= 45){ if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){ if(event.getWorld().getBlockState(randomPos.down()).getMaterial().isSolid()){ - event.getWorld().setBlockState(randomPos, InitBlocks.blockTreasureChest.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(event.getRand().nextInt(4))), 2); + event.getWorld().setBlockState(randomPos, InitBlocks.blockTreasureChest.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(event.getRand().nextInt(4))), 2); } } } @@ -140,7 +140,7 @@ public class OreGen implements IWorldGenerator{ if(ConfigBoolValues.DO_RICE_GEN.isEnabled()){ for(int i = 0; i < ConfigIntValues.RICE_AMOUNT.getValue(); i++){ if(event.getRand().nextInt(3) == 0){ - BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8); + BlockPos randomPos = event.getChunkPos().getBlock(event.getRand().nextInt(16)+8, 0, event.getRand().nextInt(16)+8); randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos); if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){ ArrayList blocksAroundBottom = WorldUtil.getMaterialsAround(event.getWorld(), randomPos); @@ -161,7 +161,7 @@ public class OreGen implements IWorldGenerator{ if(doIt){ for(int i = 0; i < amount; i++){ if(event.getRand().nextInt(100) == 0){ - BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8); + BlockPos randomPos = event.getChunkPos().getBlock(event.getRand().nextInt(16)+8, 0, event.getRand().nextInt(16)+8); randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos); if(event.getWorld().getBlockState(randomPos.down()).getMaterial() == blockBelow){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java index daff4ae74..e1d0ddea7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java @@ -78,7 +78,7 @@ public class FluidDisplay extends Gui{ this.oldFluid = fluid; if(fluid != null && fluid.getStill() != null){ - this.resLoc = new ResourceLocation(fluid.getStill().getResourceDomain(), "textures/"+fluid.getStill().getResourcePath()+".png"); + this.resLoc = new ResourceLocation(fluid.getStill().getNamespace(), "textures/"+fluid.getStill().getPath()+".png"); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java index 015399901..a768160cc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java @@ -44,8 +44,8 @@ public class ItemCrystal extends ItemBase{ } @Override - public String getUnlocalizedName(ItemStack stack){ - return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name; + public String getTranslationKey(ItemStack stack){ + return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java index bba9579d0..4f35f3329 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java @@ -37,8 +37,8 @@ public class ItemCrystalShard extends ItemBase implements IColorProvidingItem{ } @Override - public String getUnlocalizedName(ItemStack stack){ - return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name; + public String getTranslationKey(ItemStack stack){ + return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java index 78e2d52b6..d24ae9b12 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java @@ -39,8 +39,8 @@ public class ItemDust extends ItemBase implements IColorProvidingItem{ @Override - public String getUnlocalizedName(ItemStack stack){ - return stack.getItemDamage() >= ALL_DUSTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_DUSTS[stack.getItemDamage()].name; + public String getTranslationKey(ItemStack stack){ + return stack.getItemDamage() >= ALL_DUSTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_DUSTS[stack.getItemDamage()].name; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java index 83c8357ea..1a361391b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java @@ -82,8 +82,8 @@ public class ItemFoods extends ItemFoodBase{ @Override - public String getUnlocalizedName(ItemStack stack){ - return stack.getItemDamage() >= ALL_FOODS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_FOODS[stack.getItemDamage()].name; + public String getTranslationKey(ItemStack stack){ + return stack.getItemDamage() >= ALL_FOODS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_FOODS[stack.getItemDamage()].name; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java index 3ffe85939..f266e5963 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java @@ -48,8 +48,8 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem{ @Override - public String getUnlocalizedName(ItemStack stack){ - return stack.getItemDamage() >= ALL_JAMS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_JAMS[stack.getItemDamage()].name; + public String getTranslationKey(ItemStack stack){ + return stack.getItemDamage() >= ALL_JAMS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_JAMS[stack.getItemDamage()].name; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java index 8945f72dc..d128a6c68 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java @@ -44,8 +44,8 @@ public class ItemMisc extends ItemBase{ } @Override - public String getUnlocalizedName(ItemStack stack){ - return stack.getItemDamage() >= ALL_MISC_ITEMS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_MISC_ITEMS[stack.getItemDamage()].name; + public String getTranslationKey(ItemStack stack){ + return stack.getItemDamage() >= ALL_MISC_ITEMS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_MISC_ITEMS[stack.getItemDamage()].name; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java index 610df3555..601f7e35b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java @@ -91,8 +91,8 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi } @Override - public String getUnlocalizedName(ItemStack stack){ - return stack.getItemDamage() >= ALL_RINGS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+ALL_RINGS[stack.getItemDamage()].name; + public String getTranslationKey(ItemStack stack){ + return stack.getItemDamage() >= ALL_RINGS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+ALL_RINGS[stack.getItemDamage()].name; } @Override @@ -131,14 +131,14 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi @Override public String getItemStackDisplayName(ItemStack stack){ if(Util.isClient()) { - String standardName = StringUtil.localize(this.getUnlocalizedName()+".name"); + String standardName = StringUtil.localize(this.getTranslationKey()+".name"); if(stack.getItemDamage() < ALL_RINGS.length){ String effect = StringUtil.localize(ALL_RINGS[stack.getItemDamage()].name); return standardName+" "+effect; } return standardName; } - String standardName = StringUtil.localizeIllegallyOnTheServerDontUseMePls(this.getUnlocalizedName()+".name"); + String standardName = StringUtil.localizeIllegallyOnTheServerDontUseMePls(this.getTranslationKey()+".name"); if(stack.getItemDamage() < ALL_RINGS.length){ String effect = StringUtil.localizeIllegallyOnTheServerDontUseMePls(ALL_RINGS[stack.getItemDamage()].name); return standardName+" "+effect; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java index dbdd9d121..ca6e3904b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java @@ -90,8 +90,8 @@ public class FilterSettings{ ResourceLocation firstReg = firstItem.getRegistryName(); ResourceLocation secondReg = secondItem.getRegistryName(); if(firstReg != null && secondReg != null){ - String firstDomain = firstReg.getResourceDomain(); - String secondDomain = secondReg.getResourceDomain(); + String firstDomain = firstReg.getNamespace(); + String secondDomain = secondReg.getNamespace(); if(firstDomain != null && secondDomain != null){ if(!firstDomain.equals(secondDomain)){ return false; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 158222009..bca6178de 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -23,6 +23,7 @@ import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; @@ -116,7 +117,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ private static void register(Class tileClass){ try{ //This is hacky and dirty but it works so whatever - String name = ActuallyAdditions.MODID+":"+tileClass.newInstance().name; + ResourceLocation name = new ResourceLocation(ActuallyAdditions.MODID, tileClass.newInstance().name); GameRegistry.registerTileEntity(tileClass, name); } catch(Exception e){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java index 95b6d69dd..983283a2d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java @@ -82,7 +82,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer IBlockState state = this.world.getBlockState(this.pos); int meta = state.getBlock().getMetaFromState(state); - BlockPos center = this.pos.offset(EnumFacing.getHorizontal(meta), radiusAroundCenter + 1); + BlockPos center = this.pos.offset(EnumFacing.byHorizontalIndex(meta), radiusAroundCenter + 1); BlockPos query = center.add(this.checkX, 0, this.checkY); this.checkBehaviors(query); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java index 52c9caed9..55cdc3322 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java @@ -94,7 +94,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase{ if(input.hasTagCompound()){ //TiCon un-break tools - if("tconstruct".equalsIgnoreCase(input.getItem().getRegistryName().getResourceDomain())){ + if("tconstruct".equalsIgnoreCase(input.getItem().getRegistryName().getNamespace())){ NBTTagCompound stats = input.getTagCompound().getCompoundTag("Stats"); stats.removeTag("Broken"); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java index df8d07254..5e6269ad5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java @@ -52,7 +52,7 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase{ ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(this.pos, this.world); NBTTagList list = compound.getTagList("Connections", 10); - if(!list.hasNoTags()){ + if(!list.isEmpty()){ for(int i = 0; i < list.tagCount(); i++){ ConnectionPair pair = new ConnectionPair(); pair.readFromNBT(list.getCompoundTagAt(i)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index 58fe2b0c5..cb998a5cd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -271,7 +271,7 @@ public final class AssetUtil{ double pitch = Math.atan2(combinedVec.y, Math.sqrt(combinedVec.x*combinedVec.x+combinedVec.z*combinedVec.z)); double yaw = Math.atan2(-combinedVec.z, combinedVec.x); - double length = combinedVec.lengthVector(); + double length = combinedVec.length(); GlStateManager.pushMatrix(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java index 4284a3ec1..15fcd2708 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java @@ -36,7 +36,7 @@ public final class ItemUtil{ } public static void registerBlock(Block block, ItemBlockBase itemBlock, String name, boolean addTab){ - block.setUnlocalizedName(ActuallyAdditions.MODID+"."+name); + block.setTranslationKey(ActuallyAdditions.MODID+"."+name); block.setRegistryName(ActuallyAdditions.MODID, name); RegistryHandler.BLOCKS_TO_REGISTER.add(block); @@ -54,7 +54,7 @@ public final class ItemUtil{ } public static void registerItem(Item item, String name, boolean addTab){ - item.setUnlocalizedName(ActuallyAdditions.MODID+"."+name); + item.setTranslationKey(ActuallyAdditions.MODID+"."+name); item.setRegistryName(ActuallyAdditions.MODID, name); RegistryHandler.ITEMS_TO_REGISTER.add(item); @@ -126,7 +126,7 @@ public final class ItemUtil{ ench.removeTag(i); } } - if(ench.hasNoTags() && stack.hasTagCompound()){ + if(ench.isEmpty() && stack.hasTagCompound()){ stack.getTagCompound().removeTag("ench"); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java index 707bc1d72..13d8da2fa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -264,7 +264,7 @@ public final class WorldUtil { float f5 = MathHelper.sin(-f * 0.017453292F); float f6 = f3 * f4; float f7 = f2 * f4; - Vec3d vec31 = vec3.addVector((double) f6 * distance, (double) f5 * distance, (double) f7 * distance); + Vec3d vec31 = vec3.add((double) f6 * distance, (double) f5 * distance, (double) f7 * distance); return world.rayTraceBlocks(vec3, vec31, p1, p2, p3); } @@ -310,7 +310,7 @@ public final class WorldUtil { if (player.capabilities.isCreativeMode) { if (block.removedByPlayer(state, world, pos, player, false)) { - block.onBlockDestroyedByPlayer(world, pos, state); + block.onPlayerDestroy(world, pos, state); } // send update to client @@ -331,7 +331,7 @@ public final class WorldUtil { TileEntity tileEntity = world.getTileEntity(pos); if (block.removedByPlayer(state, world, pos, player, true)) { // boolean is if block can be harvested, checked above - block.onBlockDestroyedByPlayer(world, pos, state); + block.onPlayerDestroy(world, pos, state); block.harvestBlock(world, player, pos, state, tileEntity, stack); block.dropXpOnBlockBreak(world, pos, xp); } @@ -348,7 +348,7 @@ public final class WorldUtil { // following code can be found in PlayerControllerMP.onPlayerDestroyBlock world.playEvent(2001, pos, Block.getStateId(state)); if (block.removedByPlayer(state, world, pos, player, true)) { - block.onBlockDestroyedByPlayer(world, pos, state); + block.onPlayerDestroy(world, pos, state); } // callback to the tool stack.onBlockDestroyed(world, state, pos, player); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/crafting/RecipeHelper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/crafting/RecipeHelper.java index 777eaed0b..b3bffe0b1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/crafting/RecipeHelper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/crafting/RecipeHelper.java @@ -20,7 +20,7 @@ import java.util.List; //This class created by Shadows_of_Fire //MIT License -public final class RecipeHelper{ +public final class RecipeHelper { private static int j = 0; private static final String MODID = ActuallyAdditions.MODID; @@ -30,20 +30,19 @@ public final class RecipeHelper{ /* * This adds the recipe to the list of crafting recipes. Since who cares about names, it adds it as recipesX, where X is the current recipe you are adding. */ - public static void addRecipe(int j, IRecipe rec){ - addRecipe("recipes"+j, rec); + public static void addRecipe(int j, IRecipe rec) { + addRecipe("recipes" + j, rec); } /* * This adds the recipe to the list of crafting recipes. Cares about names. */ - public static void addRecipe(String name, IRecipe rec){ - Item i = rec.getRecipeOutput().getItem(); - if(i instanceof IDisableableItem && ((IDisableableItem) i).isDisabled()) rec = new BlankRecipe(); - if(rec.getRegistryName() == null){ + public static void addRecipe(String name, IRecipe rec) { + Item i = rec.getRecipeOutput().getItem(); + if (i instanceof IDisableableItem && ((IDisableableItem) i).isDisabled()) rec = new BlankRecipe(); + if (rec.getRegistryName() == null) { RECIPE_LIST.add(rec.setRegistryName(new ResourceLocation(MODID, name))); - } - else{ + } else { RECIPE_LIST.add(rec); } RecipeHandler.lastRecipe = rec; @@ -52,77 +51,72 @@ public final class RecipeHelper{ /* * This adds a shaped recipe to the list of crafting recipes, using the forge format. */ - public static void addOldShaped(ItemStack output, Object... input){ + public static void addOldShaped(ItemStack output, Object... input) { ShapedPrimer primer = CraftingHelper.parseShaped(input); - addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, "recipes"+j).toString(), primer.width, - primer.height, primer.input, output)); + addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, "recipes" + j).toString(), primer.width, primer.height, primer.input, output)); } /* * This adds a shaped recipe to the list of crafting recipes, using the forge format, with a custom group. */ - public static void addOldShaped(String group, ItemStack output, Object... input){ + public static void addOldShaped(String group, ItemStack output, Object... input) { ShapedPrimer primer = CraftingHelper.parseShaped(input); - addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height, - primer.input, output)); + addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height, primer.input, output)); } /* * This adds a shaped recipe to the list of crafting recipes, using the forge format, with a custom group. */ - public static void addOldShaped(String name, String group, ItemStack output, Object... input){ + public static void addOldShaped(String name, String group, ItemStack output, Object... input) { ShapedPrimer primer = CraftingHelper.parseShaped(input); - addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height, - primer.input, output).setRegistryName(MODID, name)); + addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height, primer.input, output).setRegistryName(MODID, name)); } /* * This adds a shapeless recipe to the list of crafting recipes, using the forge format. */ - public static void addOldShapeless(ItemStack output, Object... input){ - addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, "recipes"+j).toString(), output, - createInput(input))); + public static void addOldShapeless(ItemStack output, Object... input) { + addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, "recipes" + j).toString(), output, createInput(input))); } /* * This adds a shapeless recipe to the list of crafting recipes, using the forge format, with a custom group. */ - public static void addOldShapeless(String group, ItemStack output, Object... input){ + public static void addOldShapeless(String group, ItemStack output, Object... input) { addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, group).toString(), output, createInput(input))); } - public static void addOldShapeless(String name, String group, ItemStack output, Object... input){ - addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, group).toString(), output, createInput(input)) - .setRegistryName(MODID, name)); + public static void addOldShapeless(String name, String group, ItemStack output, Object... input) { + addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, group).toString(), output, createInput(input)).setRegistryName(MODID, name)); } /* * Adds a shapeless recipe with X output using an array of inputs. Use Strings for OreDictionary support. This array is not ordered. */ - public static void addShapeless(ItemStack output, Object... inputs){ - addRecipe(j++, new ShapelessRecipes(MODID+":"+j, output, createInput(inputs))); + public static void addShapeless(ItemStack output, Object... inputs) { + addRecipe(j++, new ShapelessRecipes(MODID + ":" + j, output, createInput(inputs))); } - public static void addShapeless(Item output, Object... inputs){ + public static void addShapeless(Item output, Object... inputs) { addShapeless(new ItemStack(output), inputs); } - public static void addShapeless(Block output, Object... inputs){ + public static void addShapeless(Block output, Object... inputs) { addShapeless(new ItemStack(output), inputs); } /* * Adds a shapeless recipe with X output using an array of inputs. Use Strings for OreDictionary support. This array is not ordered. This has a custom group. */ - public static void addShapeless(String group, ItemStack output, Object... inputs){ - addRecipe(j++, new ShapelessRecipes(MODID+":"+group, output, createInput(inputs))); + public static void addShapeless(String group, ItemStack output, Object... inputs) { + addRecipe(j++, new ShapelessRecipes(MODID + ":" + group, output, createInput(inputs))); } - public static void addShapeless(String group, Item output, Object... inputs){ + public static void addShapeless(String group, Item output, Object... inputs) { addShapeless(group, new ItemStack(output), inputs); } - public static void addShapeless(String group, Block output, Object... inputs){ + public static void addShapeless(String group, Block output, Object... inputs) { addShapeless(group, new ItemStack(output), inputs); } @@ -130,15 +124,15 @@ public final class RecipeHelper{ * Adds a shapeless recipe with X output on a crafting grid that is W x H, using an array of inputs. Use null for nothing, use Strings for OreDictionary support, this array must have a length of width * height. * This array is ordered, and items must follow from left to right, top to bottom of the crafting grid. */ - public static void addShaped(ItemStack output, int width, int height, Object... input){ + public static void addShaped(ItemStack output, int width, int height, Object... input) { addRecipe(j++, genShaped(output, width, height, input)); } - public static void addShaped(Item output, int width, int height, Object... input){ + public static void addShaped(Item output, int width, int height, Object... input) { addShaped(new ItemStack(output), width, height, input); } - public static void addShaped(Block output, int width, int height, Object... input){ + public static void addShaped(Block output, int width, int height, Object... input) { addShaped(new ItemStack(output), width, height, input); } @@ -146,76 +140,63 @@ public final class RecipeHelper{ * Adds a shapeless recipe with X output on a crafting grid that is W x H, using an array of inputs. Use null for nothing, use Strings for OreDictionary support, this array must have a length of width * height. * This array is ordered, and items must follow from left to right, top to bottom of the crafting grid. This has a custom group. */ - public static void addShaped(String group, ItemStack output, int width, int height, Object... input){ - addRecipe(j++, genShaped(MODID+":"+group, output, width, height, input)); + public static void addShaped(String group, ItemStack output, int width, int height, Object... input) { + addRecipe(j++, genShaped(MODID + ":" + group, output, width, height, input)); } - public static void addShaped(String group, Item output, int width, int height, Object... input){ + public static void addShaped(String group, Item output, int width, int height, Object... input) { addShaped(group, new ItemStack(output), width, height, input); } - public static void addShaped(String group, Block output, int width, int height, Object... input){ + public static void addShaped(String group, Block output, int width, int height, Object... input) { addShaped(group, new ItemStack(output), width, height, input); } - public static ShapedRecipes genShaped(ItemStack output, int l, int w, Object[] input){ - if(input[0] instanceof Object[]){ - input = (Object[])input[0]; - } - if(l*w != input.length){ - throw new UnsupportedOperationException( - "Attempted to add invalid shaped recipe. Complain to the author of "+MODNAME); + public static ShapedRecipes genShaped(ItemStack output, int l, int w, Object[] input) { + if (input[0] instanceof Object[]) { + input = (Object[]) input[0]; } + if (l * w != input.length) { throw new UnsupportedOperationException("Attempted to add invalid shaped recipe. Complain to the author of " + MODNAME); } NonNullList inputL = NonNullList.create(); - for(int i = 0; i < input.length; i++){ + for (int i = 0; i < input.length; i++) { Object k = input[i]; - if(k instanceof String){ - inputL.add(i, new OreIngredient((String)k)); - } - else if(k instanceof ItemStack && !((ItemStack)k).isEmpty()){ - inputL.add(i, Ingredient.fromStacks((ItemStack)k)); - } - else if(k instanceof Item){ - inputL.add(i, Ingredient.fromStacks(new ItemStack((Item)k))); - } - else if(k instanceof Block){ - inputL.add(i, Ingredient.fromStacks(new ItemStack((Block)k))); - } - else{ + if (k instanceof String) { + inputL.add(i, new OreIngredient((String) k)); + } else if (k instanceof ItemStack && !((ItemStack) k).isEmpty()) { + inputL.add(i, Ingredient.fromStacks((ItemStack) k)); + } else if (k instanceof Item) { + inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k))); + } else if (k instanceof Block) { + inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k))); + } else { inputL.add(i, Ingredient.EMPTY); } } - return new ShapedRecipes(MODID+":"+j, l, w, inputL, output); + return new ShapedRecipes(MODID + ":" + j, l, w, inputL, output); } - public static ShapedRecipes genShaped(String group, ItemStack output, int l, int w, Object[] input){ - if(input[0] instanceof List){ - input = ((List)input[0]).toArray(); - } - else if(input[0] instanceof Object[]){ - input = (Object[])input[0]; - } - if(l*w != input.length){ - throw new UnsupportedOperationException( - "Attempted to add invalid shaped recipe. Complain to the author of "+MODNAME); + public static ShapedRecipes genShaped(String group, ItemStack output, int l, int w, Object[] input) { + if (input[0] instanceof List) { + input = ((List) input[0]).toArray(); + } else if (input[0] instanceof Object[]) { + input = (Object[]) input[0]; } + if (l * w != input.length) { throw new UnsupportedOperationException("Attempted to add invalid shaped recipe. Complain to the author of " + MODNAME); } NonNullList inputL = NonNullList.create(); - for(int i = 0; i < input.length; i++){ + for (int i = 0; i < input.length; i++) { Object k = input[i]; - if(k instanceof String){ - inputL.add(i, new OreIngredient((String)k)); - } - else if(k instanceof ItemStack && !((ItemStack)k).isEmpty()){ - inputL.add(i, Ingredient.fromStacks((ItemStack)k)); - } - else if(k instanceof Item){ - inputL.add(i, Ingredient.fromStacks(new ItemStack((Item)k))); - } - else if(k instanceof Block){ - inputL.add(i, Ingredient.fromStacks(new ItemStack((Block)k))); - } - else{ + if (k instanceof String) { + inputL.add(i, new OreIngredient((String) k)); + } else if (k instanceof ItemStack && !((ItemStack) k).isEmpty()) { + inputL.add(i, Ingredient.fromStacks((ItemStack) k)); + } else if (k instanceof Item) { + inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k))); + } else if (k instanceof Block) { + inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k))); + } else if (k instanceof Ingredient) { + inputL.add(i, (Ingredient) k); + } else { inputL.add(i, Ingredient.EMPTY); } } @@ -223,31 +204,27 @@ public final class RecipeHelper{ return new ShapedRecipes(group, l, w, inputL, output); } - public static NonNullList createInput(Object[] input){ - if(input[0] instanceof List){ - input = ((List)input[0]).toArray(); - } - else if(input[0] instanceof Object[]){ - input = (Object[])input[0]; + public static NonNullList createInput(Object[] input) { + if (input[0] instanceof List) { + input = ((List) input[0]).toArray(); + } else if (input[0] instanceof Object[]) { + input = (Object[]) input[0]; } NonNullList inputL = NonNullList.create(); - for(int i = 0; i < input.length; i++){ + for (int i = 0; i < input.length; i++) { Object k = input[i]; - if(k instanceof String){ - inputL.add(i, new OreIngredient((String)k)); - } - else if(k instanceof ItemStack){ - inputL.add(i, Ingredient.fromStacks((ItemStack)k)); - } - else if(k instanceof Item){ - inputL.add(i, Ingredient.fromStacks(new ItemStack((Item)k))); - } - else if(k instanceof Block){ - inputL.add(i, Ingredient.fromStacks(new ItemStack((Block)k))); - } - else{ - throw new UnsupportedOperationException( - "Attempted to add invalid shapeless recipe. Complain to the author of "+MODNAME); + if (k instanceof String) { + inputL.add(i, new OreIngredient((String) k)); + } else if (k instanceof ItemStack) { + inputL.add(i, Ingredient.fromStacks((ItemStack) k)); + } else if (k instanceof Item) { + inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k))); + } else if (k instanceof Block) { + inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k))); + } else if (k instanceof Ingredient) { + inputL.add(i, (Ingredient) k); + } else { + throw new UnsupportedOperationException("Attempted to add invalid shapeless recipe. Complain to the author of " + MODNAME); } } return inputL;