diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java index abc00250c..5e18bfa08 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java @@ -142,7 +142,7 @@ public final class ActuallyAdditionsAPI{ public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance){ CRUSHER_RECIPES.add(new CrusherRecipe(Ingredient.fromStacks(input), outputOne, outputTwo.isEmpty() ? ItemStack.EMPTY : outputTwo, outputTwoChance)); } - + /** * Adds a Recipe to the Crusher Recipe Registry * @@ -208,7 +208,7 @@ public final class ActuallyAdditionsAPI{ public static void addCompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay){ COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay)); } - + /** * Adds a new conversion recipe to the compost. * @@ -247,7 +247,7 @@ public final class ActuallyAdditionsAPI{ public static void addEmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor){ EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor)); } - + public static void addEmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor){ EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor)); } @@ -271,7 +271,7 @@ public final class ActuallyAdditionsAPI{ public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){ addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion); } - + /** * Adds a recipe to the Atomic Reconstructor conversion lenses * StackSizes can only be 1 and greater ones will be ignored @@ -285,7 +285,7 @@ public final class ActuallyAdditionsAPI{ public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse, LensConversion type){ RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type)); } - + public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse){ addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IFarmer.java index d21deaedb..fa7eab4a5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IFarmer.java @@ -28,8 +28,8 @@ public interface IFarmer extends IEnergyTile{ boolean canAddToSeeds(List stacks); boolean canAddToOutput(List stacks); - + void addToSeeds(List stacks); - + void addToOutput(List stacks); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java index 57ae83457..e44b4a792 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java @@ -44,7 +44,7 @@ public interface IMethodHandler{ boolean invokeReconstructor(IAtomicReconstructor tile); boolean addCrusherRecipes(List inputs, List outputOnes, int outputOneAmounts, List outputTwos, int outputTwoAmounts, int outputTwoChance); - + @Deprecated //Use Ingredient input on AA API class boolean addCrusherRecipes(List inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/laser/Network.java b/src/main/java/de/ellpeck/actuallyadditions/api/laser/Network.java index 8fe639cbc..0771bd272 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/laser/Network.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/laser/Network.java @@ -14,7 +14,7 @@ import io.netty.util.internal.ConcurrentSet; public class Network{ - public final ConcurrentSet connections = new ConcurrentSet(); + public final ConcurrentSet connections = new ConcurrentSet<>(); public int changeAmount; @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/misc/IDisableableItem.java b/src/main/java/de/ellpeck/actuallyadditions/api/misc/IDisableableItem.java index 36f8ffbc2..0dbbe0909 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/misc/IDisableableItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/misc/IDisableableItem.java @@ -1,12 +1,12 @@ package de.ellpeck.actuallyadditions.api.misc; public interface IDisableableItem { - - /** - * Represents an item that can be disabled in the configuration of the mod. - * If this returns true, assume the item is not registered with the game, but may still be instantiated. - * @return If the item has not been registered with the Forge Registry. - */ - public boolean isDisabled(); + + /** + * Represents an item that can be disabled in the configuration of the mod. + * If this returns true, assume the item is not registered with the game, but may still be instantiated. + * @return If the item has not been registered with the Forge Registry. + */ + public boolean isDisabled(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java index 6ea8227a7..4899a3ba6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java @@ -25,19 +25,19 @@ public class CoffeeIngredient { public CoffeeIngredient(ItemStack input, PotionEffect[] effects, int maxAmplifier) { this(Ingredient.fromStacks(input), maxAmplifier, effects); } - + public CoffeeIngredient(Ingredient input, int maxAmplifier, PotionEffect... effects) { this.input = input; this.effects = effects; this.maxAmplifier = maxAmplifier; } - + public boolean matches(ItemStack stack) { - return input.apply(stack); + return this.input.apply(stack); } - + public Ingredient getInput() { - return input; + return this.input; } public PotionEffect[] getEffects() { @@ -51,8 +51,8 @@ public class CoffeeIngredient { public String getExtraText() { return ""; } - + public int getMaxAmplifier() { - return maxAmplifier; + return this.maxAmplifier; } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CompostRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CompostRecipe.java index 447f53cb6..607f01b0c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CompostRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CompostRecipe.java @@ -26,32 +26,32 @@ public class CompostRecipe{ public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) { this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState()); } - + public CompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay){ this.input = input; this.output = output; this.inputDisplay = inputDisplay; this.outputDisplay = outputDisplay; } - + public boolean matches(ItemStack stack) { - return input.apply(stack); + return this.input.apply(stack); } - + public Ingredient getInput() { - return input; + return this.input; } - + public ItemStack getOutput() { - return output; + return this.output; } - + public IBlockState getInputDisplay() { - return inputDisplay; + return this.inputDisplay; } - + public IBlockState getOutputDisplay() { - return outputDisplay; + return this.outputDisplay; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java index 2b2c248f5..6aaa90529 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java @@ -33,23 +33,23 @@ public class CrusherRecipe { } public boolean matches(ItemStack stack) { - return input.apply(stack); + return this.input.apply(stack); } public ItemStack getOutputOne() { - return outputOne; + return this.outputOne; } public ItemStack getOutputTwo() { - return outputTwo; + return this.outputTwo; } public int getSecondChance() { - return outputChance; + return this.outputChance; } public Ingredient getInput() { - return input; + return this.input; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/EmpowererRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/EmpowererRecipe.java index 9777c1b60..753c336fc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/EmpowererRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/EmpowererRecipe.java @@ -48,22 +48,22 @@ public class EmpowererRecipe { } public boolean matches(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) { - if (!input.apply(base)) return false; + if (!this.input.apply(base)) return false; List matches = new ArrayList<>(); ItemStack[] stacks = { stand1, stand2, stand3, stand4 }; boolean[] unused = { true, true, true, true }; for (ItemStack s : stacks) { - if (unused[0] && modifier1.apply(s)) { - matches.add(modifier1); + if (unused[0] && this.modifier1.apply(s)) { + matches.add(this.modifier1); unused[0] = false; - } else if (unused[1] && modifier2.apply(s)) { - matches.add(modifier2); + } else if (unused[1] && this.modifier2.apply(s)) { + matches.add(this.modifier2); unused[1] = false; - } else if (unused[2] && modifier3.apply(s)) { - matches.add(modifier3); + } else if (unused[2] && this.modifier3.apply(s)) { + matches.add(this.modifier3); unused[2] = false; - } else if (unused[3] && modifier4.apply(s)) { - matches.add(modifier4); + } else if (unused[3] && this.modifier4.apply(s)) { + matches.add(this.modifier4); unused[3] = false; } } @@ -72,38 +72,38 @@ public class EmpowererRecipe { } public Ingredient getInput() { - return input; + return this.input; } public ItemStack getOutput() { - return output; + return this.output; } public Ingredient getStandOne() { - return modifier1; + return this.modifier1; } public Ingredient getStandTwo() { - return modifier2; + return this.modifier2; } public Ingredient getStandThree() { - return modifier3; + return this.modifier3; } public Ingredient getStandFour() { - return modifier4; + return this.modifier4; } public int getTime() { - return time; + return this.time; } public int getEnergyPerStand() { - return energyPerStand; + return this.energyPerStand; } public float[] getParticleColors() { - return particleColor; + return this.particleColor; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java index bcbcf936a..c8f9b7ee4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java @@ -41,19 +41,19 @@ public class LensConversionRecipe { } public Ingredient getInput() { - return input; + return this.input; } public ItemStack getOutput() { - return output; + return this.output; } public int getEnergyUsed() { - return energy; + return this.energy; } public Lens getType() { - return type; + return this.type; } public void transformHook(ItemStack stack, IBlockState state, BlockPos pos, IAtomicReconstructor tile) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java index c249b2f76..b62665423 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java @@ -6,6 +6,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper; import net.minecraft.block.Block; +import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -21,7 +22,7 @@ import java.util.Map; public class ClientRegistryHandler{ - public static final Map MODEL_LOCATIONS_FOR_REGISTERING = new HashMap(); + public static final Map MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<>(); /** * (Excerpted from Tinkers' Construct with permission, thanks guys!) @@ -30,7 +31,7 @@ public class ClientRegistryHandler{ Block block = fluid.getBlock(); Item item = Item.getItemFromBlock(block); FluidStateMapper mapper = new FluidStateMapper(fluid); - ModelLoader.registerItemVariants(item); + ModelBakery.registerItemVariants(item); ModelLoader.setCustomMeshDefinition(item, mapper); ModelLoader.setCustomStateMapper(block, mapper); } @@ -52,7 +53,7 @@ public class ClientRegistryHandler{ registerCustomFluidBlockRenderer(InitFluids.fluidCrystalOil); registerCustomFluidBlockRenderer(InitFluids.fluidEmpoweredOil); } - + @SubscribeEvent public void onModelBake(ModelBakeEvent e) { ModelResourceLocation mrl = new ModelResourceLocation(new ResourceLocation(ActuallyAdditions.MODID, "block_compost"), "normal"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/InitAchievements.java b/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/InitAchievements.java index 2c287d7be..7e111c016 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/InitAchievements.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/InitAchievements.java @@ -44,4 +44,4 @@ public final class InitAchievements{ } } -*/ \ No newline at end of file + */ \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java b/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java index d7fd676c1..8e1f7c58d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java @@ -143,4 +143,4 @@ public enum TheAchievements{ } } } -*/ \ No newline at end of file + */ \ No newline at end of file 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 9a8459b99..2f3986fbe 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java @@ -209,7 +209,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud tooltip.add(StringUtil.localize(base+"1."+this.toPick1)+" "+StringUtil.localize(base+"2."+this.toPick2)); } } - + @Override public boolean hasComparatorInputOverride(IBlockState state){ return true; @@ -217,11 +217,11 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud @Override public int getComparatorInputOverride(IBlockState blockState, World world, BlockPos pos){ - TileEntity t = world.getTileEntity(pos); - int i = 0; - if (t instanceof TileEntityAtomicReconstructor) { - i = ((TileEntityAtomicReconstructor) t).getEnergy(); - } + TileEntity t = world.getTileEntity(pos); + int i = 0; + if (t instanceof TileEntityAtomicReconstructor) { + i = ((TileEntityAtomicReconstructor) t).getEnergy(); + } return MathHelper.clamp(i / 20000, 0, 15); } } \ No newline at end of file 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 b3e7dde88..f88112b2d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java @@ -88,7 +88,7 @@ public class BlockCoffeeMachine extends BlockContainerBase{ @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ - int rotation = MathHelper.floor((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; + int rotation = MathHelper.floor(player.rotationYaw*4.0F/360.0F+0.5D) & 3; if(rotation == 0){ world.setBlockState(pos, this.getStateFromMeta(0), 2); 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 2629a9c9b..6e8a92a7d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java @@ -157,8 +157,8 @@ public class BlockColoredLamp extends BlockBase{ if(stack.getItemDamage() >= ALL_LAMP_TYPES.length){ return StringUtil.BUGGED_ITEM_NAME; } - if(Util.isClient()) return super.getItemStackDisplayName(stack)+(((BlockColoredLamp)this.block).isOn ? " ("+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".onSuffix.desc")+")" : ""); - else return super.getItemStackDisplayName(stack); + if(Util.isClient()) return super.getItemStackDisplayName(stack)+(((BlockColoredLamp)this.block).isOn ? " ("+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".onSuffix.desc")+")" : ""); + else return super.getItemStackDisplayName(stack); } 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 c05adbd1f..2094afb8e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java @@ -139,7 +139,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay { } } tile.markDirty(); - world.notifyBlockUpdate(pos, getDefaultState(), getDefaultState(), 3); + world.notifyBlockUpdate(pos, this.getDefaultState(), this.getDefaultState(), 3); } } else { return true; 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 ed718fd3b..ab43b8d16 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java @@ -34,7 +34,6 @@ import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; 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; @@ -105,12 +104,7 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo @Override @SideOnly(Side.CLIENT) public IBlockColor getBlockColor(){ - return new IBlockColor(){ - @Override - public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex){ - return BlockCrystalCluster.this.crystal.clusterColor; - } - }; + return (state, world, pos, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor; } @Override @@ -121,12 +115,7 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo @Override @SideOnly(Side.CLIENT) public IItemColor getItemColor(){ - return new IItemColor(){ - @Override - public int colorMultiplier(ItemStack stack, int tintIndex){ - return BlockCrystalCluster.this.crystal.clusterColor; - } - }; + return (stack, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java index 6dfceee45..e15879654 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java @@ -63,12 +63,12 @@ public class BlockGiantChest extends BlockContainerBase{ @Override public TileEntity createNewTileEntity(World world, int par2){ switch(this.type){ - case 1: - return new TileEntityGiantChestMedium(); - case 2: - return new TileEntityGiantChestLarge(); - default: - return new TileEntityGiantChest(); + case 1: + return new TileEntityGiantChestMedium(); + case 2: + return new TileEntityGiantChestLarge(); + default: + return new TileEntityGiantChest(); } } 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 51bbefc70..514510738 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java @@ -104,17 +104,17 @@ public class BlockInputter extends BlockContainerBase{ @Override public String getItemStackDisplayName(ItemStack stack){ - if(Util.isClient()) { - long sysTime = System.currentTimeMillis(); + if(Util.isClient()) { + long sysTime = System.currentTimeMillis(); - if(this.lastSysTime+5000 < sysTime){ - this.lastSysTime = sysTime; - this.toPick = this.rand.nextInt(NAME_FLAVOR_AMOUNTS)+1; + if(this.lastSysTime+5000 < sysTime){ + this.lastSysTime = sysTime; + this.toPick = this.rand.nextInt(NAME_FLAVOR_AMOUNTS)+1; + } + + return StringUtil.localize(this.getTranslationKey()+".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); + 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 d783416bb..e651e73a2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java @@ -10,7 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import com.google.common.base.Predicate; import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewerHopping; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockStateContainer; @@ -34,12 +33,7 @@ import java.util.List; //Most of this is just copied from BlockHopper, no credit taken. Or clue what it is. public class BlockItemViewerHopping extends BlockItemViewer{ - public static final PropertyDirection FACING = PropertyDirection.create("facing", new Predicate(){ - @Override - public boolean apply(EnumFacing facing){ - return facing != EnumFacing.UP; - } - }); + public static final PropertyDirection FACING = PropertyDirection.create("facing", facing -> facing != EnumFacing.UP); private static final AxisAlignedBB BASE_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D); private static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D); 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 9bab0b622..5bdba1eef 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java @@ -99,18 +99,18 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{ @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ switch(this.getMetaFromState(state)){ - case 1: - return AABB_UP; - case 2: - return AABB_NORTH; - case 3: - return AABB_SOUTH; - case 4: - return AABB_WEST; - case 5: - return AABB_EAST; - default: - return AABB_DOWN; + case 1: + return AABB_UP; + case 2: + return AABB_NORTH; + case 3: + return AABB_SOUTH; + case 4: + return AABB_WEST; + case 5: + return AABB_EAST; + default: + return AABB_DOWN; } } @@ -230,18 +230,18 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{ @Override public TileEntity createNewTileEntity(World world, int i){ switch(this.type){ - case ITEM: - return new TileEntityLaserRelayItem(); - case ITEM_WHITELIST: - return new TileEntityLaserRelayItemWhitelist(); - case ENERGY_ADVANCED: - return new TileEntityLaserRelayEnergyAdvanced(); - case ENERGY_EXTREME: - return new TileEntityLaserRelayEnergyExtreme(); - case FLUIDS: - return new TileEntityLaserRelayFluids(); - default: - return new TileEntityLaserRelayEnergy(); + case ITEM: + return new TileEntityLaserRelayItem(); + case ITEM_WHITELIST: + return new TileEntityLaserRelayItemWhitelist(); + case ENERGY_ADVANCED: + return new TileEntityLaserRelayEnergyAdvanced(); + case ENERGY_EXTREME: + return new TileEntityLaserRelayEnergyExtreme(); + case FLUIDS: + return new TileEntityLaserRelayFluids(); + default: + return new TileEntityLaserRelayEnergy(); } } @@ -281,7 +281,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{ ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world); } - + @Override public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { return BlockFaceShape.UNDEFINED; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java index 7a8752ecf..201b611f7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java @@ -76,7 +76,7 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{ TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos()); if(tile instanceof TileEntityMiner){ TileEntityMiner miner = (TileEntityMiner)tile; - String info = miner.checkY == 0 ? "Done Mining!" : (miner.checkY == -1 ? "Calculating positions..." : "Mining at "+(miner.getPos().getX()+miner.checkX)+", "+miner.checkY+", "+(miner.getPos().getZ()+miner.checkZ)+"."); + String info = miner.checkY == 0 ? "Done Mining!" : miner.checkY == -1 ? "Calculating positions..." : "Mining at "+(miner.getPos().getX()+miner.checkX)+", "+miner.checkY+", "+(miner.getPos().getZ()+miner.checkZ)+"."; minecraft.fontRenderer.drawStringWithShadow(info, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-20, StringUtil.DECIMAL_COLOR_WHITE); } } 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 0e146075d..947fd870d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java @@ -98,7 +98,7 @@ public class BlockMisc extends BlockBase{ @Override public int getItemBurnTime(ItemStack stack) { if(stack.getMetadata() == TheMiscBlocks.CHARCOAL_BLOCK.ordinal()) return 16000; - return super.getItemBurnTime(stack); + return super.getItemBurnTime(stack); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java index 240dc9176..b15045676 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java @@ -86,18 +86,18 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{ @Override public TileEntity createNewTileEntity(World world, int par2){ switch(this.type){ - case PLACER: - return new TileEntityPhantomPlacer(); - case BREAKER: - return new TileEntityPhantomBreaker(); - case LIQUIFACE: - return new TileEntityPhantomLiquiface(); - case ENERGYFACE: - return new TileEntityPhantomEnergyface(); - case REDSTONEFACE: - return new TileEntityPhantomRedstoneface(); - default: - return new TileEntityPhantomItemface(); + case PLACER: + return new TileEntityPhantomPlacer(); + case BREAKER: + return new TileEntityPhantomBreaker(); + case LIQUIFACE: + return new TileEntityPhantomLiquiface(); + case ENERGYFACE: + return new TileEntityPhantomEnergyface(); + case REDSTONEFACE: + return new TileEntityPhantomRedstoneface(); + default: + return new TileEntityPhantomItemface(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java index b0cc0d64f..d599c551c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java @@ -54,8 +54,8 @@ public class BlockShockSuppressor extends BlockContainerBase{ if(!suppressor.isRedstonePowered){ BlockPos supPos = suppressor.getPos(); - List entitiesToRemove = new ArrayList(); - List posesToRemove = new ArrayList(); + List entitiesToRemove = new ArrayList<>(); + List posesToRemove = new ArrayList<>(); for(BlockPos pos : affectedBlocks){ if(pos.distanceSq(supPos) <= rangeSq){ 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 abcf88a36..100d1dc41 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java @@ -37,7 +37,7 @@ public class BlockSlabs extends BlockBase{ public static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D); private static final AxisAlignedBB AABB_TOP_HALF = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D); - + private final IBlockState fullBlockState; public BlockSlabs(String name, Block fullBlock){ @@ -118,7 +118,7 @@ public class BlockSlabs extends BlockBase{ if(state.getBlock() == this.block){ BlockSlabs theBlock = (BlockSlabs)this.block; - if((facing == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM) || (facing == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP)){ + if(facing == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP){ IBlockState newState = theBlock.fullBlockState; AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos); @@ -145,7 +145,7 @@ public class BlockSlabs extends BlockBase{ IBlockState state = worldIn.getBlockState(pos); if(state.getBlock() == this.block){ - if((side == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM) || (side == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP)){ + if(side == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP){ return true; } } @@ -162,7 +162,7 @@ public class BlockSlabs extends BlockBase{ AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos); if(bound != Block.NULL_AABB && world.checkNoEntityCollision(bound.offset(pos)) && world.setBlockState(pos, newState, 11)){ - SoundType soundtype = theBlock.fullBlockState.getBlock().getSoundType(theBlock.fullBlockState, world, pos, player); + SoundType soundtype = theBlock.fullBlockState.getBlock().getSoundType(theBlock.fullBlockState, world, pos, player); world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume()+1.0F)/2.0F, soundtype.getPitch()*0.8F); player.setHeldItem(hand, StackUtil.shrink(stack, 1)); 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 289d81046..c7a35301c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java @@ -55,16 +55,16 @@ public class BlockTinyTorch extends BlockBase{ @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ switch(state.getValue(BlockTorch.FACING)){ - case EAST: - return TORCH_EAST_AABB; - case WEST: - return TORCH_WEST_AABB; - case SOUTH: - return TORCH_SOUTH_AABB; - case NORTH: - return TORCH_NORTH_AABB; - default: - return STANDING_AABB; + case EAST: + return TORCH_EAST_AABB; + case WEST: + return TORCH_WEST_AABB; + case SOUTH: + return TORCH_SOUTH_AABB; + case NORTH: + return TORCH_NORTH_AABB; + default: + return STANDING_AABB; } } @@ -83,12 +83,12 @@ public class BlockTinyTorch extends BlockBase{ public boolean isFullCube(IBlockState state){ return false; } - + @Override public boolean isNormalCube(IBlockState state){ return false; } - + @Override public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing facing) { return BlockFaceShape.UNDEFINED; @@ -189,14 +189,14 @@ public class BlockTinyTorch extends BlockBase{ public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand){ if(rand.nextBoolean()){ EnumFacing enumfacing = stateIn.getValue(BlockTorch.FACING); - double d0 = (double)pos.getX()+0.5D; - double d1 = (double)pos.getY()+0.4D; - double d2 = (double)pos.getZ()+0.5D; + double d0 = pos.getX()+0.5D; + double d1 = pos.getY()+0.4D; + double d2 = pos.getZ()+0.5D; if(enumfacing.getAxis().isHorizontal()){ EnumFacing enumfacing1 = enumfacing.getOpposite(); - 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); + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0+0.35D*enumfacing1.getXOffset(), d1+0.22D, d2+0.35D*enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D); + worldIn.spawnParticle(EnumParticleTypes.FLAME, d0+0.35D*enumfacing1.getXOffset(), d1+0.22D, d2+0.35D*enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D); } else{ worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D); @@ -210,21 +210,21 @@ public class BlockTinyTorch extends BlockBase{ IBlockState iblockstate = this.getDefaultState(); switch(meta){ - case 1: - iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.EAST); - break; - case 2: - iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.WEST); - break; - case 3: - iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.SOUTH); - break; - case 4: - iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.NORTH); - break; - case 5: - default: - iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.UP); + case 1: + iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.EAST); + break; + case 2: + iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.WEST); + break; + case 3: + iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.SOUTH); + break; + case 4: + iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.NORTH); + break; + case 5: + default: + iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.UP); } return iblockstate; @@ -240,22 +240,22 @@ public class BlockTinyTorch extends BlockBase{ int i = 0; switch(state.getValue(BlockTorch.FACING)){ - case EAST: - i = i | 1; - break; - case WEST: - i = i | 2; - break; - case SOUTH: - i = i | 3; - break; - case NORTH: - i = i | 4; - break; - case DOWN: - case UP: - default: - i = i | 5; + case EAST: + i = i | 1; + break; + case WEST: + i = i | 2; + break; + case SOUTH: + i = i | 3; + break; + case NORTH: + i = i | 4; + break; + case DOWN: + case UP: + default: + i = i | 5; } return i; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java index c0c1bf623..7b40fc035 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java @@ -117,7 +117,7 @@ public class BlockWallAA extends BlockBase{ public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){ IBlockState state = worldIn.getBlockState(pos); Block block = state.getBlock(); - return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || ((state.getMaterial().isOpaque() && state.isFullCube()) && state.getMaterial() != Material.GOURD)); + return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || state.getMaterial().isOpaque() && state.isFullCube() && state.getMaterial() != Material.GOURD); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java index 8c6bf83fd..daed03d51 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java @@ -45,6 +45,7 @@ public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHa return true; } + @Override public void registerRendering(){ ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory"); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java index 7c5274d0d..be5d71e36 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java @@ -45,6 +45,7 @@ public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRar return true; } + @Override public void registerRendering(){ ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory"); } 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 d5ada794c..40057005b 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 @@ -74,6 +74,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB return true; } + @Override public void registerRendering(){ ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory"); } @@ -246,7 +247,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK); //Remove unnecessarily saved default values to avoid unstackability - List keysToRemove = new ArrayList(); + List keysToRemove = new ArrayList<>(); for(String key : data.getKeySet()){ NBTBase tag = data.getTag(key); //Remove only ints because they are the most common ones diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java index 0162c99d0..1b21fbea6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java @@ -69,6 +69,7 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit return false; } + @Override public void registerRendering(){ ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory"); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java index d7a8f0001..501dc48da 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java @@ -52,6 +52,7 @@ public class BlockStair extends BlockStairs implements ItemBlockBase.ICustomRari return true; } + @Override public void registerRendering(){ ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory"); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java index 1bd899323..808b7af20 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java @@ -40,10 +40,10 @@ public enum TheWildPlants implements IStringSerializable { } public EnumRarity getRarity() { - return rarity; + return this.rarity; } public Block getNormalVersion() { - return normal; + return this.normal; } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/CompostModel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/CompostModel.java index 665029226..196650f9d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/CompostModel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/CompostModel.java @@ -27,7 +27,7 @@ public class CompostModel implements IBakedModel { public CompostModel(IBlockState flowerState, float height) { this.display = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(flowerState); - + TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, -.218F, 0), null, new Vector3f(0.75F, height / 1.81F, 0.75F), null)); ImmutableList.Builder builder; @@ -35,8 +35,8 @@ public class CompostModel implements IBakedModel { for (EnumFacing face : EnumFacing.values()) { builder = ImmutableList.builder(); - if (!display.isBuiltInRenderer()) { - for (BakedQuad quad : display.getQuads(flowerState, face, 0)) { + if (!this.display.isBuiltInRenderer()) { + for (BakedQuad quad : this.display.getQuads(flowerState, face, 0)) { Transformer transformer = new Transformer(transform, quad.getFormat()); quad.pipe(transformer); builder.add(transformer.build()); @@ -46,29 +46,29 @@ public class CompostModel implements IBakedModel { faces.put(face, builder.build()); } - if (!display.isBuiltInRenderer()) { + if (!this.display.isBuiltInRenderer()) { builder = ImmutableList.builder(); - for (BakedQuad quad : display.getQuads(flowerState, null, 0)) { + for (BakedQuad quad : this.display.getQuads(flowerState, null, 0)) { Transformer transformer = new Transformer(transform, quad.getFormat()); quad.pipe(transformer); builder.add(transformer.build()); } builder.addAll(compostBase.getQuads(null, null, 0)); this.general = builder.build(); - } else general = ImmutableList.of(); + } else this.general = ImmutableList.of(); this.faces = Maps.immutableEnumMap(faces); } @Override public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - if (side == null) return general; - return faces.get(side); + if (side == null) return this.general; + return this.faces.get(side); } @Override public boolean isAmbientOcclusion() { - return compostBase.isAmbientOcclusion() && display.isAmbientOcclusion(); + return compostBase.isAmbientOcclusion() && this.display.isAmbientOcclusion(); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java index a4f2a644f..5078aa142 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java @@ -37,7 +37,7 @@ public class RenderBatteryBox extends TileEntitySpecialRenderer= 0 && ActuallyAdditionsAPI.EMPOWERER_RECIPES.size() > index){ EmpowererRecipe recipe = ActuallyAdditionsAPI.EMPOWERER_RECIPES.get(index); if(recipe != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java index c600c2d23..4025fbc06 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java @@ -43,7 +43,7 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer= 3) { Vector4f vec = new Vector4f(data); vec.setW(1.0f); - transformation.transform(vec); + this.transformation.transform(vec); data = new float[4]; vec.get(data); } else if (usage == VertexFormatElement.EnumUsage.NORMAL && data.length >= 3) { Vector3f vec = new Vector3f(data); - normalTransformation.transform(vec); + this.normalTransformation.transform(vec); vec.normalize(); data = new float[4]; vec.get(data); @@ -49,6 +49,6 @@ public class Transformer extends VertexTransformer { } public UnpackedBakedQuad build() { - return ((UnpackedBakedQuad.Builder) parent).build(); + return ((UnpackedBakedQuad.Builder) this.parent).build(); } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index ee3b348dc..9cce8f763 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.booklet; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.Comparator; import java.util.List; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; @@ -127,12 +126,12 @@ public final class InitBooklet{ for(IBookletPage page : chapter.getAllPages()){ pageCount++; - List items = new ArrayList(); + List items = new ArrayList<>(); page.getItemStacksForPage(items); - List fluids = new ArrayList(); + List fluids = new ArrayList<>(); page.getFluidStacksForPage(fluids); - if((items != null && !items.isEmpty()) || (fluids != null && !fluids.isEmpty())){ + if(items != null && !items.isEmpty() || fluids != null && !fluids.isEmpty()){ if(!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.contains(page)){ ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.add(page); infoCount++; @@ -143,29 +142,20 @@ public final class InitBooklet{ } } - Collections.sort(ActuallyAdditionsAPI.BOOKLET_ENTRIES, new Comparator(){ - @Override - public int compare(IBookletEntry entry1, IBookletEntry entry2){ - Integer prio1 = entry1.getSortingPriority(); - Integer prio2 = entry2.getSortingPriority(); - return prio2.compareTo(prio1); - } + Collections.sort(ActuallyAdditionsAPI.BOOKLET_ENTRIES, (entry1, entry2) -> { + Integer prio1 = entry1.getSortingPriority(); + Integer prio2 = entry2.getSortingPriority(); + return prio2.compareTo(prio1); }); - Collections.sort(ActuallyAdditionsAPI.ALL_CHAPTERS, new Comparator(){ - @Override - public int compare(IBookletChapter chapter1, IBookletChapter chapter2){ - Integer prio1 = chapter1.getSortingPriority(); - Integer prio2 = chapter2.getSortingPriority(); - return prio2.compareTo(prio1); - } + Collections.sort(ActuallyAdditionsAPI.ALL_CHAPTERS, (chapter1, chapter2) -> { + Integer prio1 = chapter1.getSortingPriority(); + Integer prio2 = chapter2.getSortingPriority(); + return prio2.compareTo(prio1); }); - Collections.sort(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, new Comparator(){ - @Override - public int compare(IBookletPage page1, IBookletPage page2){ - Integer prio1 = page1.getSortingPriority(); - Integer prio2 = page2.getSortingPriority(); - return prio2.compareTo(prio1); - } + Collections.sort(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, (page1, page2) -> { + Integer prio1 = page1.getSortingPriority(); + Integer prio2 = page2.getSortingPriority(); + return prio2.compareTo(prio1); }); ActuallyAdditions.LOGGER.info("Registered a total of "+chapCount+" booklet chapters, where "+infoCount+" out of "+pageCount+" booklet pages contain information about items or fluids!"); @@ -176,7 +166,7 @@ public final class InitBooklet{ chaptersIntroduction[0] = new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, ItemCrafting.recipeBook).setNoText()); chaptersIntroduction[1] = new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM"), new PageLinkButton(2, "https://www.youtube.com/playlist?list=PLJeFZ64pT89MrTRZYzD_rtHFajPVlt6cF")).setImportant(); new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3)); - ArrayList crystalPages = new ArrayList(); + ArrayList crystalPages = new ArrayList<>(); crystalPages.addAll(Arrays.asList(new PageTextOnly(1).addTextReplacement("", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "page_atomic_reconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setWildcard())); for(int i = 0; i < LensRecipeHandler.MAIN_PAGE_RECIPES.size(); i++){ crystalPages.add(new PageReconstructor(7+i, LensRecipeHandler.MAIN_PAGE_RECIPES.get(i)).setNoText()); @@ -186,7 +176,7 @@ public final class InitBooklet{ chaptersIntroduction[2] = new BookletChapter("engineerHouse", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.EMERALD), new PageTextOnly(1), new PagePicture(2, "page_engineer_house", 145)); chaptersIntroduction[6] = new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial(); chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageTextOnly(1).addTextReplacement("", TileEntityCoalGenerator.PRODUCE), new PageCrafting(2, BlockCrafting.recipeCoalGen).setWildcard().setNoText()); - ArrayList empowererPages = new ArrayList(); + ArrayList empowererPages = new ArrayList<>(); empowererPages.addAll(Arrays.asList(new PageTextOnly(1), new PagePicture(2, "page_empowerer", 137), new PageCrafting(3, BlockCrafting.recipeEmpowerer), new PageCrafting(4, BlockCrafting.recipeDisplayStand))); for(int i = 0; i < EmpowererHandler.MAIN_PAGE_RECIPES.size(); i++){ empowererPages.add(new PageEmpowerer(7+i, EmpowererHandler.MAIN_PAGE_RECIPES.get(i)).setNoText()); @@ -206,7 +196,7 @@ public final class InitBooklet{ chaptersIntroduction[3] = new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).addItemsToPage(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("", AAWorldGen.QUARTZ_MIN).addTextReplacement("", AAWorldGen.QUARTZ_MAX), new PageTextOnly(2).addItemsToPage(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText()); new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setWildcard()).setSpecial(); new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_COAL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText()); - ArrayList lampPages = new ArrayList(); + ArrayList lampPages = new ArrayList<>(); lampPages.add(new PageTextOnly(lampPages.size()+1)); lampPages.add(new PageTextOnly(lampPages.size()+1)); lampPages.add(new PageCrafting(lampPages.size()+1, BlockCrafting.recipePowerer).setWildcard().setNoText()); @@ -265,7 +255,7 @@ public final class InitBooklet{ new BookletChapter("farmer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFarmer), new PageTextOnly(1), new PagePicture(2, "page_farmer_crops", 95).addItemsToPage(new ItemStack(Items.WHEAT_SEEDS)).addItemsToPage(new ItemStack(InitItems.itemCanolaSeed)), new PagePicture(3, "page_farmer_cactus", 105).addItemsToPage(new ItemStack(Blocks.CACTUS)), new PagePicture(4, "page_farmer_wart", 95).addItemsToPage(new ItemStack(Items.NETHER_WART)), new PagePicture(5, "page_farmer_reeds", 105).addItemsToPage(new ItemStack(Items.REEDS)), new PagePicture(6, "page_farmer_melons", 105).addItemsToPage(new ItemStack(Items.MELON), new ItemStack(Blocks.PUMPKIN), new ItemStack(Blocks.MELON_BLOCK)), new PagePicture(7, "page_farmer_enderlilly", 105), new PagePicture(8, "page_farmer_redorchid", 105), new PageCrafting(4, BlockCrafting.recipeFarmer).setWildcard().setNoText()).setImportant(); new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockMiner), new PageTextOnly(1).addTextReplacement("", TileEntityMiner.ENERGY_USE_PER_BLOCK).addTextReplacement("", TileEntityMiner.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial(); new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemCoffeeBean)).addTextReplacement("", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).addItemsToPage(new ItemStack(InitItems.itemCoffee)), new PagePicture(3, "page_coffee_machine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setWildcard().setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant(); - + List list = new ArrayList<>(); list.add(new PageTextOnly(1).addTextReplacement("", TileEntityGrinder.ENERGY_USE)); list.add(new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText()); @@ -273,7 +263,7 @@ public final class InitBooklet{ if(CrusherCrafting.recipeIronHorseArmor != null) list.add(new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText()); if(CrusherCrafting.recipeGoldHorseArmor != null) list.add(new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText()); if(CrusherCrafting.recipeDiamondHorseArmor != null) list.add(new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText()); - + new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), list.toArray(new IBookletPage[0])); new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("", TileEntityFurnaceDouble.ENERGY_USE)); new BookletChapter("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("", TileEntityLavaFactoryController.ENERGY_USE), new PagePicture(2, "page_lava_factory", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLavaFactory).setNoText(), new PageCrafting(4, BlockCrafting.recipeCasing).setNoText()); @@ -298,7 +288,7 @@ public final class InitBooklet{ new BookletChapter("foods", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipeBacon).setNoText(), new PageFurnace(2, new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal())).setNoText(), new PageCrafting(3, FoodCrafting.recipeHamburger).setNoText(), new PageCrafting(4, FoodCrafting.recipeBigCookie).setNoText(), new PageCrafting(5, FoodCrafting.recipeSubSandwich).setNoText(), new PageCrafting(6, FoodCrafting.recipeFrenchFry).setNoText(), new PageCrafting(7, FoodCrafting.recipeFrenchFries).setNoText(), new PageCrafting(8, FoodCrafting.recipeFishNChips).setNoText(), new PageCrafting(9, FoodCrafting.recipeCheese).setNoText(), new PageCrafting(10, FoodCrafting.recipePumpkinStew).setNoText(), new PageCrafting(11, FoodCrafting.recipeCarrotJuice).setNoText(), new PageCrafting(12, FoodCrafting.recipeSpaghetti).setNoText(), new PageCrafting(13, FoodCrafting.recipeNoodle).setNoText(), new PageCrafting(14, FoodCrafting.recipeChocolate).setNoText(), new PageCrafting(15, FoodCrafting.recipeChocolateCake).setNoText(), new PageCrafting(16, FoodCrafting.recipeToast).setNoText(), new PageFurnace(17, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal())).setNoText(), new PageCrafting(18, FoodCrafting.recipeChocolateToast).setNoText(), new PageCrafting(1, FoodCrafting.recipePizza).setNoText()); new BookletChapter("leafBlower", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemLeafBlowerAdvanced), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower).setNoText(), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced).setNoText()).setImportant(); new BookletChapter("playerProbe", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemPlayerProbe), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipePlayerProbe).setNoText()).setSpecial(); - ArrayList aiotPages = new ArrayList(); + ArrayList aiotPages = new ArrayList<>(); aiotPages.add(new PageTextOnly(aiotPages.size()+1)); for(IRecipe recipe : ToolCrafting.RECIPES_PAXELS){ aiotPages.add(new PageCrafting(aiotPages.size()+1, recipe).setWildcard().setNoText()); @@ -307,7 +297,7 @@ public final class InitBooklet{ new BookletChapter("jams", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemJams), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemJams, 1, Util.WILDCARD)), new PagePicture(2, "page_jam_house", 150), new PageTextOnly(3)); - ArrayList potionRingPages = new ArrayList(); + ArrayList potionRingPages = new ArrayList<>(); potionRingPages.add(new PageTextOnly(potionRingPages.size()+1)); for(IRecipe recipe : ItemCrafting.RECIPES_POTION_RINGS){ potionRingPages.add(new PageCrafting(potionRingPages.size()+1, recipe).setNoText()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java index 861913caa..8c6a06fbe 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java @@ -91,7 +91,7 @@ public class BookmarkButton extends GuiButton{ public void drawHover(int mouseX, int mouseY){ if(this.isMouseOver()){ - List list = new ArrayList(); + List list = new ArrayList<>(); if(this.assignedPage != null){ IBookletChapter chapter = this.assignedPage.getChapter(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCoffee.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCoffee.java index 0daf360b0..fd811ddf1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCoffee.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCoffee.java @@ -30,7 +30,7 @@ public class BookletChapterCoffee extends BookletChapter{ } private static IBookletPage[] getPages(IBookletPage... pages){ - List allPages = new ArrayList(); + List allPages = new ArrayList<>(); allPages.addAll(Arrays.asList(pages)); for(CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCrusher.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCrusher.java index 1e9abcc05..da71a6c7a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCrusher.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCrusher.java @@ -28,7 +28,7 @@ public class BookletChapterCrusher extends BookletChapter{ } private static IBookletPage[] getPages(IBookletPage... pages){ - List allPages = new ArrayList(); + List allPages = new ArrayList<>(); allPages.addAll(Arrays.asList(pages)); for(CrusherRecipe recipe : CrusherCrafting.MISC_RECIPES){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java index 7633cffa8..e9685e97d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java @@ -33,7 +33,7 @@ public class BookletEntry implements IBookletEntry{ private final String identifier; private final int priority; - private final List chapters = new ArrayList(); + private final List chapters = new ArrayList<>(); private TextFormatting color; public BookletEntry(String identifier){ @@ -52,7 +52,7 @@ public class BookletEntry implements IBookletEntry{ private static boolean fitsFilter(IBookletPage page, String searchBarText){ Minecraft mc = Minecraft.getMinecraft(); - List items = new ArrayList(); + List items = new ArrayList<>(); page.getItemStacksForPage(items); if(!items.isEmpty()){ for(ItemStack stack : items){ @@ -67,7 +67,7 @@ public class BookletEntry implements IBookletEntry{ } } - List fluids = new ArrayList(); + List fluids = new ArrayList<>(); page.getFluidStacksForPage(fluids); if(!fluids.isEmpty()){ for(FluidStack stack : fluids){ @@ -116,7 +116,7 @@ public class BookletEntry implements IBookletEntry{ if(searchBarText != null && !searchBarText.isEmpty()){ String search = searchBarText.toLowerCase(Locale.ROOT); - List fittingChapters = new ArrayList(); + List fittingChapters = new ArrayList<>(); for(IBookletChapter chapter : this.getAllChapters()){ if(chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(search)){ fittingChapters.add(chapter); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java index 1d8c4c7ec..52f61d568 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java @@ -81,7 +81,7 @@ public abstract class GuiBooklet extends GuiBookletBase{ } } else{ - return (float)conf/100F; + return conf/100F; } } @@ -330,7 +330,7 @@ public abstract class GuiBooklet extends GuiBookletBase{ @Override protected void keyTyped(char typedChar, int key) throws IOException{ - if(key == Keyboard.KEY_ESCAPE || (key == this.mc.gameSettings.keyBindInventory.getKeyCode() && (!this.hasSearchBar() || !this.searchField.isFocused()))){ + if(key == Keyboard.KEY_ESCAPE || key == this.mc.gameSettings.keyBindInventory.getKeyCode() && (!this.hasSearchBar() || !this.searchField.isFocused())){ this.mc.displayGuiScreen(this.previousScreen); } else if(this.hasSearchBar() & this.searchField.isFocused()){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java index 02dda6b23..7c68e21a4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java @@ -87,7 +87,7 @@ public class GuiEntry extends GuiBooklet{ } } - int idOffset = this.entryPage*(BUTTONS_PER_PAGE*2); + int idOffset = this.entryPage*BUTTONS_PER_PAGE*2; for(int x = 0; x < 2; x++){ for(int y = 0; y < BUTTONS_PER_PAGE; y++){ int id = y+x*BUTTONS_PER_PAGE; @@ -105,7 +105,7 @@ public class GuiEntry extends GuiBooklet{ @Override protected void actionPerformed(GuiButton button) throws IOException{ if(button instanceof EntryButton){ - int actualId = button.id+this.entryPage*(BUTTONS_PER_PAGE*2); + int actualId = button.id+this.entryPage*BUTTONS_PER_PAGE*2; if(this.chapters.size() > actualId){ IBookletChapter chapter = this.chapters.get(actualId); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java index cfae67f7c..2b0be116b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java @@ -103,7 +103,7 @@ public class GuiMainPage extends GuiBooklet{ } private static List getDisplayedEntries(){ - List displayed = new ArrayList(); + List displayed = new ArrayList<>(); for(IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES){ if(entry.visibleOnFrontPage()){ @@ -196,13 +196,13 @@ public class GuiMainPage extends GuiBooklet{ } } - List configText = new ArrayList(); + List configText = new ArrayList<>(); configText.add(TextFormatting.GOLD+StringUtil.localize("booklet."+ActuallyAdditions.MODID+".configButton.name")); configText.addAll(this.fontRenderer.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet."+ActuallyAdditions.MODID+".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200)); this.configButton = new TexturedButton(RES_LOC_GADGETS, -388, this.guiLeft+16, this.guiTop+this.ySize-30, 188, 14, 16, 16, configText); this.buttonList.add(this.configButton); - List achievementText = new ArrayList(); + List achievementText = new ArrayList<>(); achievementText.add(TextFormatting.GOLD+StringUtil.localize("booklet."+ActuallyAdditions.MODID+".achievementButton.name")); achievementText.addAll(this.fontRenderer.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet."+ActuallyAdditions.MODID+".achievementButton.desc", ActuallyAdditions.NAME), 200)); //this.achievementButton = new TexturedButton(RES_LOC_GADGETS, -389, this.guiLeft+36, this.guiTop+this.ySize-30, 204, 14, 16, 16, achievementText); @@ -242,7 +242,7 @@ public class GuiMainPage extends GuiBooklet{ } } } - /*else if(button == this.achievementButton){ + /*else if(button == this.achievementButton){ GuiScreen achievements = new GuiAAAchievements(this, this.mc.player.getStatFileWriter()); this.mc.displayGuiScreen(achievements); }*/ @@ -293,7 +293,7 @@ public class GuiMainPage extends GuiBooklet{ int quoteSize = this.quote.size(); for(int i = 0; i < quoteSize; i++){ - this.renderScaledAsciiString(TextFormatting.ITALIC+this.quote.get(i), this.guiLeft+25, this.guiTop+90+(i*8), 0, false, this.getMediumFontSize()); + this.renderScaledAsciiString(TextFormatting.ITALIC+this.quote.get(i), this.guiLeft+25, this.guiTop+90+i*8, 0, false, this.getMediumFontSize()); } this.renderScaledAsciiString("- "+this.quoteGuy, this.guiLeft+60, this.guiTop+93+quoteSize*8, 0, false, this.getLargeFontSize()); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java index d756cef66..da71fc87e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java @@ -37,7 +37,7 @@ import java.util.List; public class GuiPage extends GuiBooklet{ public final IBookletPage[] pages = new IBookletPage[2]; - private final List itemDisplays = new ArrayList(); + private final List itemDisplays = new ArrayList<>(); private int pageTimer; private GuiButton buttonViewOnline; @@ -132,7 +132,7 @@ public class GuiPage extends GuiBooklet{ } private List getWebLinks(){ - List links = new ArrayList(); + List links = new ArrayList<>(); for(IBookletPage page : this.pages){ if(page != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/GuiAAAchievements.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/GuiAAAchievements.java index 716c7b491..85ccae067 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/GuiAAAchievements.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/GuiAAAchievements.java @@ -62,4 +62,4 @@ public class GuiAAAchievements extends GuiAchievements{ } } } -*/ \ No newline at end of file + */ \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java index 12a486fd7..771fb57d0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java @@ -28,11 +28,11 @@ import java.util.*; public class BookletPage implements IBookletPage{ - protected final HashMap textReplacements = new HashMap(); + protected final HashMap textReplacements = new HashMap<>(); protected final int localizationKey; private final int priority; - private final List itemsForPage = new ArrayList(); - private final List fluidsForPage = new ArrayList(); + private final List itemsForPage = new ArrayList<>(); + private final List fluidsForPage = new ArrayList<>(); protected IBookletChapter chapter; protected boolean hasNoText; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java index 5cb602152..e11f3b7c3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java @@ -52,8 +52,8 @@ public class PageCoffeeMachine extends BookletPage{ gui.renderSplitScaledAsciiString("Hover over this to see the effect!", startX+5, startY+51, 0, false, gui.getSmallFontSize(), 35); PageTextOnly.renderTextToPage(gui, this, startX+6, startY+90); - - if(counter++ % 50 == 0) gui.addOrModifyItemRenderer(stacks[rotate++ % stacks.length], startX+5+82, startY+10+1, 1F, true); + + if(this.counter++ % 50 == 0) gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX+5+82, startY+10+1, 1F, true); } @Override @@ -61,7 +61,7 @@ public class PageCoffeeMachine extends BookletPage{ public void initGui(GuiBookletBase gui, int startX, int startY){ super.initGui(gui, startX, startY); - gui.addOrModifyItemRenderer(stacks[0], startX+5+82, startY+10+1, 1F, true); + gui.addOrModifyItemRenderer(this.stacks[0], startX+5+82, startY+10+1, 1F, true); gui.addOrModifyItemRenderer(this.outcome, startX+5+36, startY+10+42, 1F, false); gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), startX+5+37, startY+10+1, 1F, true); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java index 2e2be1f2a..fe7778586 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java @@ -129,7 +129,7 @@ public class PageCrafting extends BookletPage{ Ingredient[] ings = new Ingredient[9]; int width = 3; int height = 3; - + if(recipe instanceof BlankRecipe){ this.recipeTypeLocKey = "tooltip."+ActuallyAdditions.MODID+".disabled"; gui.addOrModifyItemRenderer(recipe.getRecipeOutput(), startX+100, startY+25, 1F, false); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java index de17fb76f..b32fc2092 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java @@ -33,7 +33,7 @@ public class PageCrusherRecipe extends BookletPage{ public PageCrusherRecipe(int localizationKey, CrusherRecipe recipe){ super(localizationKey); this.recipe = recipe; - stacks = recipe.getInput().getMatchingStacks(); + this.stacks = recipe.getInput().getMatchingStacks(); } @Override @@ -47,8 +47,8 @@ public class PageCrusherRecipe extends BookletPage{ gui.renderScaledAsciiString("("+StringUtil.localize("booklet."+ActuallyAdditions.MODID+".crusherRecipe")+")", startX+36, startY+85, 0, false, gui.getMediumFontSize()); PageTextOnly.renderTextToPage(gui, this, startX+6, startY+100); - - if(counter++ % 50 == 0) gui.addOrModifyItemRenderer(stacks[rotate++ % stacks.length], startX+38+18, startY+6+1, 1F, true); + + if(this.counter++ % 50 == 0) gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX+38+18, startY+6+1, 1F, true); } @Override @@ -57,7 +57,7 @@ public class PageCrusherRecipe extends BookletPage{ super.initGui(gui, startX, startY); if(this.recipe != null){ - gui.addOrModifyItemRenderer(stacks[rotate++ % stacks.length], startX+38+18, startY+6+1, 1F, true); + gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX+38+18, startY+6+1, 1F, true); gui.addOrModifyItemRenderer(this.recipe.getOutputOne(), startX+38+4, startY+6+53, 1F, false); if(StackUtil.isValid(this.recipe.getOutputTwo())){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java index 58a8e63b0..8a1dbfdd0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java @@ -56,7 +56,7 @@ public class PageEmpowerer extends BookletPage{ gui.renderScaledAsciiString("("+StringUtil.localize("booklet."+ActuallyAdditions.MODID+".empowererRecipe")+")", startX+6, startY+85, 0, false, gui.getMediumFontSize()); PageTextOnly.renderTextToPage(gui, this, startX+6, startY+100); - if(recipe != null) updateInputs(gui, startX, startY); + if(this.recipe != null) this.updateInputs(gui, startX, startY); } @Override @@ -65,25 +65,25 @@ public class PageEmpowerer extends BookletPage{ super.initGui(gui, startX, startY); if(this.recipe != null){ - gui.addOrModifyItemRenderer(stand1[0], startX+5+26, startY+10+1, 1F, true); - gui.addOrModifyItemRenderer(stand2[0], startX+5+1, startY+10+26, 1F, true); - gui.addOrModifyItemRenderer(stand3[0], startX+5+51, startY+10+26, 1F, true); - gui.addOrModifyItemRenderer(stand4[0], startX+5+26, startY+10+51, 1F, true); + gui.addOrModifyItemRenderer(this.stand1[0], startX+5+26, startY+10+1, 1F, true); + gui.addOrModifyItemRenderer(this.stand2[0], startX+5+1, startY+10+26, 1F, true); + gui.addOrModifyItemRenderer(this.stand3[0], startX+5+51, startY+10+26, 1F, true); + gui.addOrModifyItemRenderer(this.stand4[0], startX+5+26, startY+10+51, 1F, true); - gui.addOrModifyItemRenderer(inputs[0], startX+5+26, startY+10+26, 1F, true); + gui.addOrModifyItemRenderer(this.inputs[0], startX+5+26, startY+10+26, 1F, true); gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX+5+96, startY+10+26, 1F, false); } } - - private void updateInputs(GuiBookletBase gui, int startX, int startY) { - if(counter++ % 50 == 0) { - rotate++; - gui.addOrModifyItemRenderer(stand1[rotate % stand1.length], startX+5+26, startY+10+1, 1F, true); - gui.addOrModifyItemRenderer(stand2[rotate % stand2.length], startX+5+1, startY+10+26, 1F, true); - gui.addOrModifyItemRenderer(stand3[rotate % stand3.length], startX+5+51, startY+10+26, 1F, true); - gui.addOrModifyItemRenderer(stand4[rotate % stand4.length], startX+5+26, startY+10+51, 1F, true); - gui.addOrModifyItemRenderer(inputs[rotate % inputs.length], startX+5+26, startY+10+26, 1F, true); + private void updateInputs(GuiBookletBase gui, int startX, int startY) { + if(this.counter++ % 50 == 0) { + this.rotate++; + gui.addOrModifyItemRenderer(this.stand1[this.rotate % this.stand1.length], startX+5+26, startY+10+1, 1F, true); + gui.addOrModifyItemRenderer(this.stand2[this.rotate % this.stand2.length], startX+5+1, startY+10+26, 1F, true); + gui.addOrModifyItemRenderer(this.stand3[this.rotate % this.stand3.length], startX+5+51, startY+10+26, 1F, true); + gui.addOrModifyItemRenderer(this.stand4[this.rotate % this.stand4.length], startX+5+26, startY+10+51, 1F, true); + + gui.addOrModifyItemRenderer(this.inputs[this.rotate % this.inputs.length], startX+5+26, startY+10+26, 1F, true); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java index da35f3aeb..64fb54a7e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java @@ -50,7 +50,7 @@ public class PageReconstructor extends BookletPage{ PageTextOnly.renderTextToPage(gui, this, startX+6, startY+88); if(this.recipe != null){ - if(counter++ % 50 == 0) gui.addOrModifyItemRenderer(stacks[rotate++ % stacks.length], startX+30+1, startY+10+13, 1F, true); + if(this.counter++ % 50 == 0) gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX+30+1, startY+10+13, 1F, true); } } @@ -60,7 +60,7 @@ public class PageReconstructor extends BookletPage{ super.initGui(gui, startX, startY); if(this.recipe != null){ - gui.addOrModifyItemRenderer(stacks[0], startX+30+1, startY+10+13, 1F, true); + gui.addOrModifyItemRenderer(this.stacks[0], startX+30+1, startY+10+13, 1F, true); gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX+30+47, startY+10+13, 1F, false); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiConfiguration.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiConfiguration.java index 81a10ab0a..40a832024 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiConfiguration.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiConfiguration.java @@ -27,7 +27,7 @@ public class GuiConfiguration extends GuiConfig{ } private static List getConfigElements(){ - List list = new ArrayList(); + List list = new ArrayList<>(); for(int i = 0; i < ConfigCategories.values().length; i++){ ConfigCategories cat = ConfigCategories.values()[i]; ConfigurationHandler.config.setCategoryComment(cat.name, cat.comment); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java index c00ed2271..cfb96c68d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java @@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.config.values; import de.ellpeck.actuallyadditions.mod.config.ConfigCategories; public enum ConfigIntValues{ - + RICE_AMOUNT("Rice: Amount", ConfigCategories.WORLD_GEN, 15, 1, 100, "The Amount of Rice generating"), CANOLA_AMOUNT("Canola: Amount", ConfigCategories.WORLD_GEN, 10, 1, 50, "The Amount of Canola generating"), FLAX_AMOUNT("Flax: Amount", ConfigCategories.WORLD_GEN, 8, 1, 50, "The Amount of Flax generating"), @@ -30,9 +30,9 @@ public enum ConfigIntValues{ FONT_SIZE_LARGE("Booklet Large Font Size", ConfigCategories.OTHER, 0, 0, 500, "The size of the booklet's large font in percent. Set to 0 to use defaults from the lang file."), ELEVEN("What is 11", ConfigCategories.OTHER, 11, 0, 12, "11?"), - FUR_CHANCE("Fur Drop Chance", ConfigCategories.OTHER, 5000, 1, Integer.MAX_VALUE, "The 1/n drop chance, per tick, for a fur ball to be dropped."), - RECONSTRUCTOR_POWER("Atomic Reconstructor Power", ConfigCategories.MACHINE_VALUES, 300000, 300000, Integer.MAX_VALUE, "The amount of power the atomic reconstructor can store."), - FARMER_AREA("Farmer Area", ConfigCategories.MACHINE_VALUES, 9, 1, Integer.MAX_VALUE, "The size of the farmer's farming area. Default is 9x9, must be an odd number."); + FUR_CHANCE("Fur Drop Chance", ConfigCategories.OTHER, 5000, 1, Integer.MAX_VALUE, "The 1/n drop chance, per tick, for a fur ball to be dropped."), + RECONSTRUCTOR_POWER("Atomic Reconstructor Power", ConfigCategories.MACHINE_VALUES, 300000, 300000, Integer.MAX_VALUE, "The amount of power the atomic reconstructor can store."), + FARMER_AREA("Farmer Area", ConfigCategories.MACHINE_VALUES, 9, 1, Integer.MAX_VALUE, "The size of the farmer's farming area. Default is 9x9, must be an odd number."); public final String name; public final String category; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java index 4c9207755..68bd55edb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java @@ -100,28 +100,28 @@ public final class BlockCrafting{ public static IRecipe recipeFarmer; public static IRecipe recipeBatteryBox; - private static class FireworkIngredient extends Ingredient { + private static class FireworkIngredient extends Ingredient { - ItemStack firework = new ItemStack(Items.FIREWORKS); - ItemStack[] fireworks = new ItemStack[] {firework}; + ItemStack firework = new ItemStack(Items.FIREWORKS); + ItemStack[] fireworks = new ItemStack[] {this.firework}; - @Override - public ItemStack[] getMatchingStacks() { - return fireworks; - } + @Override + public ItemStack[] getMatchingStacks() { + return this.fireworks; + } + + @Override + public boolean apply(ItemStack stack) { + return stack.getItem() == Items.FIREWORKS; + } + } - @Override - public boolean apply(ItemStack stack) { - return stack.getItem() == Items.FIREWORKS; - } - } - public static void init(){ Block[] removeNBTBlocks = new Block[] { InitBlocks.blockOilGenerator, InitBlocks.blockFluidPlacer, InitBlocks.blockFluidCollector, InitBlocks.blockCanolaPress, InitBlocks.blockFermentingBarrel }; for(Block b : removeNBTBlocks) - RecipeHandler.addShapelessOreDictRecipe(new ItemStack(b), new ItemStack(b)); + RecipeHandler.addShapelessOreDictRecipe(new ItemStack(b), new ItemStack(b)); //Battery Box RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitBlocks.blockBatteryBox), @@ -160,7 +160,7 @@ public final class BlockCrafting{ 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_CHAR.ordinal()), 'W', "stickWood"); recipesTinyTorch[1] = RecipeUtil.lastIRecipe(); - + //Firework Box RecipeHandler.addOreDictRecipe(new ItemStack(InitBlocks.blockFireworkBox), "GFG", "SAS", "CCC", @@ -371,8 +371,8 @@ public final class BlockCrafting{ RecipeHandler.addOreDictRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal()), "WSW", "SRS", "WSW", 'W', ConfigBoolValues.SUPER_DUPER_HARD_MODE.isEnabled() ? new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()) : new ItemStack(Items.ENDER_PEARL), - 'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()), - 'S', ConfigBoolValues.SUPER_DUPER_HARD_MODE.isEnabled() ? new ItemStack(Blocks.DIAMOND_BLOCK) : new ItemStack(InitItems.itemCrystalEmpowered, 1, TheCrystals.DIAMOND.ordinal())); + 'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()), + 'S', ConfigBoolValues.SUPER_DUPER_HARD_MODE.isEnabled() ? new ItemStack(Blocks.DIAMOND_BLOCK) : new ItemStack(InitItems.itemCrystalEmpowered, 1, TheCrystals.DIAMOND.ordinal())); recipeEnderCase = RecipeUtil.lastIRecipe(); //Phantom Booster diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java index 71b039d9c..1af70b8a5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java @@ -76,22 +76,22 @@ public final class CrusherCrafting { MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); if(!CrusherRecipeRegistry.hasException("oreRedstone")) - ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreRedstone"), new ItemStack(Items.REDSTONE, 10), StackUtil.getEmpty(), 0); + ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreRedstone"), new ItemStack(Items.REDSTONE, 10), StackUtil.getEmpty(), 0); if(!CrusherRecipeRegistry.hasException("oreLapis")) - ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreLapis"), new ItemStack(Items.DYE, 12, 4), StackUtil.getEmpty(), 0); + ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreLapis"), new ItemStack(Items.DYE, 12, 4), StackUtil.getEmpty(), 0); if(!CrusherRecipeRegistry.hasException("coal")) - ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("coal"), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()), StackUtil.getEmpty(), 0); + ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("coal"), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()), StackUtil.getEmpty(), 0); if(!CrusherRecipeRegistry.hasException("oreCoal")) - ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreCoal"), new ItemStack(Items.COAL, 3), StackUtil.getEmpty(), 0); + ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreCoal"), new ItemStack(Items.COAL, 3), StackUtil.getEmpty(), 0); if(!CrusherRecipeRegistry.hasException("blockCoal")) - ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("blockCoal"), new ItemStack(Items.COAL, 9), StackUtil.getEmpty(), 0); + ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("blockCoal"), new ItemStack(Items.COAL, 9), StackUtil.getEmpty(), 0); if(!CrusherRecipeRegistry.hasException("oreQuartz")) - ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreQuartz"), new ItemStack(Items.QUARTZ, 3), StackUtil.getEmpty(), 0); + ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreQuartz"), new ItemStack(Items.QUARTZ, 3), StackUtil.getEmpty(), 0); if(!CrusherRecipeRegistry.hasException("cobblestone")) - ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("cobblestone"), new ItemStack(Blocks.SAND), StackUtil.getEmpty(), 0); + ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("cobblestone"), new ItemStack(Blocks.SAND), StackUtil.getEmpty(), 0); ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT), new ItemStack(Items.FLINT), 50); if(!CrusherRecipeRegistry.hasException("stone")) - ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("stone", false), OreDictionary.getOres("cobblestone", false), 1, NonNullList.withSize(1, StackUtil.getEmpty()), 0, 0); + ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("stone", false), OreDictionary.getOres("cobblestone", false), 1, NonNullList.withSize(1, StackUtil.getEmpty()), 0, 0); ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.SUGAR, 2), StackUtil.getEmpty(), 0); MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); @@ -100,9 +100,9 @@ public final class CrusherCrafting { MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); if(!CrusherRecipeRegistry.hasException("oreNickel")) - ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreNickel", false), OreDictionary.getOres("dustNickel", false), 2, OreDictionary.getOres("dustPlatinum", false), 1, 15); + ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreNickel", false), OreDictionary.getOres("dustNickel", false), 2, OreDictionary.getOres("dustPlatinum", false), 1, 15); if(!CrusherRecipeRegistry.hasException("oreIron")) - ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreIron", false), OreDictionary.getOres("dustIron", false), 2, OreDictionary.getOres("dustGold", false), 1, 20); + ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreIron", false), OreDictionary.getOres("dustIron", false), 2, OreDictionary.getOres("dustGold", false), 1, 20); ItemStack temp = getStack("dustIron"); if (!temp.isEmpty()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java index 4dec9a359..f29051564 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java @@ -37,8 +37,8 @@ import java.util.ArrayList; public final class ItemCrafting{ - public static final ArrayList RECIPES_POTION_RINGS = new ArrayList(); - public static final ArrayList RECIPES_DRILL_COLORING = new ArrayList(); + public static final ArrayList RECIPES_POTION_RINGS = new ArrayList<>(); + public static final ArrayList RECIPES_DRILL_COLORING = new ArrayList<>(); public static IRecipe recipePhantomConnector; public static IRecipe recipeCoil; public static IRecipe recipeCoilAdvanced; @@ -469,7 +469,7 @@ public final class ItemCrafting{ RecipeHandler.addOreDictRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), " R ", "RIR", " R ", 'I', ConfigBoolValues.SUPER_DUPER_HARD_MODE.isEnabled() ? new ItemStack(InitItems.itemMisc, 1, TheMiscItems.ENDER_STAR.ordinal()) : new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), - 'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal())); + 'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal())); recipeCoil = RecipeUtil.lastIRecipe(); //Cup diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiscCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiscCrafting.java index 75dbda7fe..d2808d041 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiscCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiscCrafting.java @@ -98,7 +98,7 @@ public final class MiscCrafting{ new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new ItemStack(Items.PRISMARINE_SHARD)); ItemCrafting.recipeEnderStar = RecipeUtil.lastIRecipe(); - + //Spawner Shard -> ingot GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.SPAWNER_SHARD.ordinal()), new ItemStack(Items.IRON_INGOT, 2), 5F); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ToolCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ToolCrafting.java index 4ba455eac..2a2c035fc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ToolCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ToolCrafting.java @@ -25,7 +25,7 @@ import java.util.ArrayList; public final class ToolCrafting{ - public static final ArrayList RECIPES_PAXELS = new ArrayList(); + public static final ArrayList RECIPES_PAXELS = new ArrayList<>(); public static void init(){ 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 b7671ea78..a2fe2f02c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java @@ -350,7 +350,7 @@ public class CreativeTab extends CreativeTabs{ } public void add(Item item){ - if(item != null && (!(item instanceof IDisableableItem) || (item instanceof IDisableableItem && !((IDisableableItem) item).isDisabled()))){ + if(item != null && (!(item instanceof IDisableableItem) || item instanceof IDisableableItem && !((IDisableableItem) item).isDisabled())){ item.getSubItems(INSTANCE, this.list); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java index b124ed2f9..776ad5b43 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java @@ -57,7 +57,7 @@ public final class PlayerData{ public int batWingsFlyTime; public IBookletPage[] bookmarks = new IBookletPage[12]; - public List completedTrials = new ArrayList(); + public List completedTrials = new ArrayList<>(); @SideOnly(Side.CLIENT) public GuiBooklet lastOpenBooklet; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java index 4d7ee0dbb..a9544df07 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java @@ -27,8 +27,8 @@ public class WorldData extends WorldSavedData { public static final String DATA_TAG = ActuallyAdditions.MODID + "data"; private static WorldData data; - public final ConcurrentSet laserRelayNetworks = new ConcurrentSet(); - public final ConcurrentHashMap playerSaveData = new ConcurrentHashMap(); + public final ConcurrentSet laserRelayNetworks = new ConcurrentSet<>(); + public final ConcurrentHashMap playerSaveData = new ConcurrentHashMap<>(); public WorldData(String name) { super(name); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java index 6e3207d4f..46f63abae 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java @@ -87,9 +87,9 @@ public class EntityWorm extends Entity{ if(!isFarmland || state.getValue(BlockFarmland.MOISTURE) < 7){ if(isMiddlePose || this.world.rand.nextFloat() >= 0.45F){ - if(!isFarmland) DefaultFarmerBehavior.useHoeAt(world, pos); - state = this.world.getBlockState(pos); - isFarmland = state.getBlock() instanceof BlockFarmland; + if(!isFarmland) DefaultFarmerBehavior.useHoeAt(this.world, pos); + state = this.world.getBlockState(pos); + isFarmland = state.getBlock() instanceof BlockFarmland; if(isFarmland) this.world.setBlockState(pos, state.withProperty(BlockFarmland.MOISTURE, 7), 2); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/InitEntities.java b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/InitEntities.java index 7967ace06..6cc065a6e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/InitEntities.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/InitEntities.java @@ -29,5 +29,5 @@ public final class InitEntities{ public static void initClient(){ RenderingRegistry.registerEntityRenderingHandler(EntityWorm.class, RenderWorm::new); } - + } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java index 50199edf3..c510f1940 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java @@ -28,7 +28,7 @@ public class RenderWorm extends Render{ private static ItemStack stack = ItemStack.EMPTY; public static void fixItemStack(){ - stack = new ItemStack(InitItems.itemWorm); + stack = new ItemStack(InitItems.itemWorm); } protected RenderWorm(RenderManager renderManager){ @@ -43,10 +43,10 @@ public class RenderWorm extends Render{ @Override public void doRender(EntityWorm entity, double x, double y, double z, float entityYaw, float partialTicks){ GlStateManager.pushMatrix(); - bindEntityTexture(entity); + this.bindEntityTexture(entity); GlStateManager.translate(x, y+0.7F, z); double boop = Minecraft.getSystemTime()/70D; - GlStateManager.rotate(-(float)((boop%360)), 0, 1, 0); + GlStateManager.rotate(-(float)(boop%360), 0, 1, 0); GlStateManager.translate(0, 0, 0.4); stack.setStackDisplayName(entity.getName()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java index 6375eafeb..348970124 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java @@ -68,7 +68,7 @@ public class WorldGenLushCaves{ } private void genTreesAndTallGrass(World world, BlockPos center, int radius, int amount, Random rand, StructureBoundingBox box){ - List possiblePoses = new ArrayList(); + List possiblePoses = new ArrayList<>(); for(double x = -radius; x < radius; x++){ for(double y = -radius; y < radius; y++){ for(double z = -radius; z < radius; z++){ @@ -152,7 +152,7 @@ public class WorldGenLushCaves{ for(double x = -radius; x < radius; x++){ for(double y = -radius; y < radius; y++){ for(double z = -radius; z < radius; z++){ - if(Math.sqrt((x*x)+(y*y)+(z*z)) < radius){ + if(Math.sqrt(x*x+y*y+z*z) < radius){ BlockPos pos = center.add(x, y, z); //Note: order matters, checkIndestructable will generate chunks if order is reversed if(boundingBox.isVecInside(pos) && !this.checkIndestructable(world, pos)){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentCustomCropField.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentCustomCropField.java index fc7543117..accb53a1b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentCustomCropField.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentCustomCropField.java @@ -102,14 +102,14 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous private IBlockState getRandomCropType(Random rand){ int randomMeta = MathHelper.getInt(rand, 1, 7); switch(rand.nextInt(4)){ - case 0: - return InitBlocks.blockFlax.getDefaultState().withProperty(BlockCrops.AGE, randomMeta); - case 1: - return InitBlocks.blockCoffee.getDefaultState().withProperty(BlockCrops.AGE, randomMeta); - case 2: - return InitBlocks.blockRice.getDefaultState().withProperty(BlockCrops.AGE, randomMeta); - default: - return InitBlocks.blockCanola.getDefaultState().withProperty(BlockCrops.AGE, randomMeta); + case 0: + return InitBlocks.blockFlax.getDefaultState().withProperty(BlockCrops.AGE, randomMeta); + case 1: + return InitBlocks.blockCoffee.getDefaultState().withProperty(BlockCrops.AGE, randomMeta); + case 2: + return InitBlocks.blockRice.getDefaultState().withProperty(BlockCrops.AGE, randomMeta); + default: + return InitBlocks.blockCanola.getDefaultState().withProperty(BlockCrops.AGE, randomMeta); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentJamHouse.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentJamHouse.java index 116dd95a3..a06c88b63 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentJamHouse.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentJamHouse.java @@ -101,7 +101,7 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{ } @SuppressWarnings("deprecation") - public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){ + public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){ //Base this.fillWithBlocks(world, sbb, 1, 0, 8, 9, 0, 10, Blocks.GRASS); this.fillWithBlocks(world, sbb, 0, 0, 0, 1, 0, 7, Blocks.COBBLESTONE); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java index bb640e1c3..0c9e9f106 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java @@ -209,7 +209,7 @@ public class ContainerBag extends Container implements IButtonReactor { @Override public boolean canInteractWith(EntityPlayer player) { - return !sack.isEmpty() && player.getHeldItemMainhand() == sack; + return !this.sack.isEmpty() && player.getHeldItemMainhand() == this.sack; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java index e467d2846..a362af326 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java @@ -100,10 +100,10 @@ public class ContainerDropper extends Container{ public boolean canInteractWith(EntityPlayer player){ return this.dropper.canPlayerUse(player); } - + @Override public void onContainerClosed(EntityPlayer playerIn) { - super.onContainerClosed(playerIn); - if (!player.isSpectator()) dropper.getWorld().notifyNeighborsOfStateChange(dropper.getPos(), InitBlocks.blockDropper, false); + super.onContainerClosed(playerIn); + if (!this.player.isSpectator()) this.dropper.getWorld().notifyNeighborsOfStateChange(this.dropper.getPos(), InitBlocks.blockDropper, false); } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java index b61bb3529..066786a94 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java @@ -55,7 +55,7 @@ public class ContainerEnergizer extends Container { for (int k = 0; k < 4; ++k) { final EntityEquipmentSlot slot = VALID_EQUIPMENT_SLOTS[k]; - this.addSlotToContainer(new Slot(player.inventory, 36 + (3 - k), 102, 19 + k * 18) { + this.addSlotToContainer(new Slot(player.inventory, 36 + 3 - k, 102, 19 + k * 18) { @Override public int getSlotStackLimit() { return 1; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java index 41ec62a31..f2046e8f8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java @@ -49,7 +49,7 @@ public class ContainerEnervator extends Container{ for(int k = 0; k < 4; ++k){ final EntityEquipmentSlot slot = ContainerEnergizer.VALID_EQUIPMENT_SLOTS[k]; - this.addSlotToContainer(new Slot(player.inventory, 36+(3-k), 102, 19+k*18){ + this.addSlotToContainer(new Slot(player.inventory, 36+3-k, 102, 19+k*18){ @Override public int getSlotStackLimit(){ return 1; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java index b502f7e75..e6f2d0fb6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java @@ -35,7 +35,7 @@ public class ContainerFilter extends Container{ for(int i = 0; i < 4; i++){ for(int j = 0; j < 6; j++){ - this.addSlotToContainer(new SlotFilter(this.filterInventory, j+(i*6), 35+j*18, 10+i*18)); + this.addSlotToContainer(new SlotFilter(this.filterInventory, j+i*6, 35+j*18, 10+i*18)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java index 12d1cd483..31e901478 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java @@ -31,7 +31,7 @@ public class ContainerGiantChest extends Container{ for(int i = 0; i < 9; i++){ for(int j = 0; j < 13; j++){ - this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileChest.inv, (9*13*page)+j+(i*13), 5+j*18, 5+i*18)); + this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileChest.inv, 9*13*page+j+i*13, 5+j*18, 5+i*18)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java index df625cc1f..88b4cfe86 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java @@ -65,7 +65,7 @@ public class ContainerGrinder extends Container{ ItemStack currentStack = newStack.copy(); //Slots in Inventory to shift from - if(slot == TileEntityGrinder.SLOT_OUTPUT_1_1 || slot == TileEntityGrinder.SLOT_OUTPUT_1_2 || (this.isDouble && (slot == TileEntityGrinder.SLOT_OUTPUT_2_1 || slot == TileEntityGrinder.SLOT_OUTPUT_2_2))){ + if(slot == TileEntityGrinder.SLOT_OUTPUT_1_1 || slot == TileEntityGrinder.SLOT_OUTPUT_1_2 || this.isDouble && (slot == TileEntityGrinder.SLOT_OUTPUT_2_1 || slot == TileEntityGrinder.SLOT_OUTPUT_2_2)){ if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){ return StackUtil.getEmpty(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java index e3b55b2ca..4b95dec0d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java @@ -66,78 +66,78 @@ public class GuiHandler implements IGuiHandler{ tile = (TileEntityBase)world.getTileEntity(new BlockPos(x, y, z)); } switch(GuiTypes.values()[id]){ - case FEEDER: - return new ContainerFeeder(player.inventory, tile); - case GIANT_CHEST: - return new ContainerGiantChest(player.inventory, tile, 0); - case GIANT_CHEST_PAGE_2: - return new ContainerGiantChest(player.inventory, tile, 1); - case GIANT_CHEST_PAGE_3: - return new ContainerGiantChest(player.inventory, tile, 2); - case CRAFTER: - return CompatUtil.getCrafterContainerElement(player, world, x, y, z); - case GRINDER: - return new ContainerGrinder(player.inventory, tile, false); - case GRINDER_DOUBLE: - return new ContainerGrinder(player.inventory, tile, true); - case FURNACE_DOUBLE: - return new ContainerFurnaceDouble(player.inventory, tile); - case INPUTTER: - return new ContainerInputter(player.inventory, tile, false); - case INPUTTER_ADVANCED: - return new ContainerInputter(player.inventory, tile, true); - case REPAIRER: - return new ContainerRepairer(player.inventory, tile); - case BREAKER: - return new ContainerBreaker(player.inventory, tile); - case DROPPER: - return new ContainerDropper(player, tile); - case CANOLA_PRESS: - return new ContainerCanolaPress(player.inventory, tile); - case FERMENTING_BARREL: - return new ContainerFermentingBarrel(player.inventory, tile); - case COAL_GENERATOR: - return new ContainerCoalGenerator(player.inventory, tile); - case OIL_GENERATOR: - return new ContainerOilGenerator(player.inventory, tile); - case PHANTOM_PLACER: - return new ContainerPhantomPlacer(player.inventory, tile); - case FLUID_COLLECTOR: - return new ContainerFluidCollector(player.inventory, tile); - case COFFEE_MACHINE: - return new ContainerCoffeeMachine(player.inventory, tile); - case DRILL: - return new ContainerDrill(player.inventory); - case FILTER: - return new ContainerFilter(player.inventory); - case ENERGIZER: - return new ContainerEnergizer(player, tile); - case ENERVATOR: - return new ContainerEnervator(player, tile); - case XP_SOLIDIFIER: - return new ContainerXPSolidifier(player.inventory, tile); - case CLOUD: - return new ContainerSmileyCloud(); - case DIRECTIONAL_BREAKER: - return new ContainerDirectionalBreaker(player.inventory, tile); - case RANGED_COLLECTOR: - return new ContainerRangedCollector(player.inventory, tile); - case MINER: - return new ContainerMiner(player.inventory, tile); - case LASER_RELAY_ITEM_WHITELIST: - return new ContainerLaserRelayItemWhitelist(player.inventory, tile); - case BAG: - return new ContainerBag(player.getHeldItemMainhand(), player.inventory, false); - case VOID_BAG: - return new ContainerBag(player.getHeldItemMainhand(), player.inventory, true); - case BIO_REACTOR: - return new ContainerBioReactor(player.inventory, tile); - case FARMER: - return new ContainerFarmer(player.inventory, tile); - case FIREWORK_BOX: - return new ContainerFireworkBox(); - default: - return null; + case FEEDER: + return new ContainerFeeder(player.inventory, tile); + case GIANT_CHEST: + return new ContainerGiantChest(player.inventory, tile, 0); + case GIANT_CHEST_PAGE_2: + return new ContainerGiantChest(player.inventory, tile, 1); + case GIANT_CHEST_PAGE_3: + return new ContainerGiantChest(player.inventory, tile, 2); + case CRAFTER: + return CompatUtil.getCrafterContainerElement(player, world, x, y, z); + case GRINDER: + return new ContainerGrinder(player.inventory, tile, false); + case GRINDER_DOUBLE: + return new ContainerGrinder(player.inventory, tile, true); + case FURNACE_DOUBLE: + return new ContainerFurnaceDouble(player.inventory, tile); + case INPUTTER: + return new ContainerInputter(player.inventory, tile, false); + case INPUTTER_ADVANCED: + return new ContainerInputter(player.inventory, tile, true); + case REPAIRER: + return new ContainerRepairer(player.inventory, tile); + case BREAKER: + return new ContainerBreaker(player.inventory, tile); + case DROPPER: + return new ContainerDropper(player, tile); + case CANOLA_PRESS: + return new ContainerCanolaPress(player.inventory, tile); + case FERMENTING_BARREL: + return new ContainerFermentingBarrel(player.inventory, tile); + case COAL_GENERATOR: + return new ContainerCoalGenerator(player.inventory, tile); + case OIL_GENERATOR: + return new ContainerOilGenerator(player.inventory, tile); + case PHANTOM_PLACER: + return new ContainerPhantomPlacer(player.inventory, tile); + case FLUID_COLLECTOR: + return new ContainerFluidCollector(player.inventory, tile); + case COFFEE_MACHINE: + return new ContainerCoffeeMachine(player.inventory, tile); + case DRILL: + return new ContainerDrill(player.inventory); + case FILTER: + return new ContainerFilter(player.inventory); + case ENERGIZER: + return new ContainerEnergizer(player, tile); + case ENERVATOR: + return new ContainerEnervator(player, tile); + case XP_SOLIDIFIER: + return new ContainerXPSolidifier(player.inventory, tile); + case CLOUD: + return new ContainerSmileyCloud(); + case DIRECTIONAL_BREAKER: + return new ContainerDirectionalBreaker(player.inventory, tile); + case RANGED_COLLECTOR: + return new ContainerRangedCollector(player.inventory, tile); + case MINER: + return new ContainerMiner(player.inventory, tile); + case LASER_RELAY_ITEM_WHITELIST: + return new ContainerLaserRelayItemWhitelist(player.inventory, tile); + case BAG: + return new ContainerBag(player.getHeldItemMainhand(), player.inventory, false); + case VOID_BAG: + return new ContainerBag(player.getHeldItemMainhand(), player.inventory, true); + case BIO_REACTOR: + return new ContainerBioReactor(player.inventory, tile); + case FARMER: + return new ContainerFarmer(player.inventory, tile); + case FIREWORK_BOX: + return new ContainerFireworkBox(); + default: + return null; } } @@ -148,93 +148,93 @@ public class GuiHandler implements IGuiHandler{ tile = (TileEntityBase)world.getTileEntity(new BlockPos(x, y, z)); } switch(GuiTypes.values()[id]){ - case FEEDER: - return new GuiFeeder(player.inventory, tile); - case GIANT_CHEST: - return new GuiGiantChest(player.inventory, tile, 0); - case GIANT_CHEST_PAGE_2: - return new GuiGiantChest(player.inventory, tile, 1); - case GIANT_CHEST_PAGE_3: - return new GuiGiantChest(player.inventory, tile, 2); - case CRAFTER: - return CompatUtil.getCrafterGuiElement(player, world, x, y, z); - case GRINDER: - return new GuiGrinder(player.inventory, tile); - case GRINDER_DOUBLE: - return new GuiGrinder.GuiGrinderDouble(player.inventory, tile); - case FURNACE_DOUBLE: - return new GuiFurnaceDouble(player.inventory, tile); - case INPUTTER: - return new GuiInputter(player.inventory, tile, false); - case INPUTTER_ADVANCED: - return new GuiInputter(player.inventory, tile, true); - case REPAIRER: - return new GuiRepairer(player.inventory, tile); - case BREAKER: - return new GuiBreaker(player.inventory, tile); - case DROPPER: - return new GuiDropper(player, tile); - case CANOLA_PRESS: - return new GuiCanolaPress(player.inventory, tile); - case FERMENTING_BARREL: - return new GuiFermentingBarrel(player.inventory, tile); - case COAL_GENERATOR: - return new GuiCoalGenerator(player.inventory, tile); - case OIL_GENERATOR: - return new GuiOilGenerator(player.inventory, tile); - case PHANTOM_PLACER: - return new GuiPhantomPlacer(player.inventory, tile); - case FLUID_COLLECTOR: - return new GuiFluidCollector(player.inventory, tile); - case COFFEE_MACHINE: - return new GuiCoffeeMachine(player.inventory, tile); - case DRILL: - return new GuiDrill(player.inventory); - case FILTER: - return new GuiFilter(player.inventory); - case ENERGIZER: - return new GuiEnergizer(player, tile); - case ENERVATOR: - return new GuiEnervator(player, tile); - case XP_SOLIDIFIER: - return new GuiXPSolidifier(player.inventory, tile); - case CLOUD: - return new GuiSmileyCloud(tile, x, y, z, world); - case BOOK: - if(ItemBooklet.forcedPage != null){ - GuiBooklet gui = BookletUtils.createBookletGuiFromPage(null, ItemBooklet.forcedPage); - ItemBooklet.forcedPage = null; - return gui; + case FEEDER: + return new GuiFeeder(player.inventory, tile); + case GIANT_CHEST: + return new GuiGiantChest(player.inventory, tile, 0); + case GIANT_CHEST_PAGE_2: + return new GuiGiantChest(player.inventory, tile, 1); + case GIANT_CHEST_PAGE_3: + return new GuiGiantChest(player.inventory, tile, 2); + case CRAFTER: + return CompatUtil.getCrafterGuiElement(player, world, x, y, z); + case GRINDER: + return new GuiGrinder(player.inventory, tile); + case GRINDER_DOUBLE: + return new GuiGrinder.GuiGrinderDouble(player.inventory, tile); + case FURNACE_DOUBLE: + return new GuiFurnaceDouble(player.inventory, tile); + case INPUTTER: + return new GuiInputter(player.inventory, tile, false); + case INPUTTER_ADVANCED: + return new GuiInputter(player.inventory, tile, true); + case REPAIRER: + return new GuiRepairer(player.inventory, tile); + case BREAKER: + return new GuiBreaker(player.inventory, tile); + case DROPPER: + return new GuiDropper(player, tile); + case CANOLA_PRESS: + return new GuiCanolaPress(player.inventory, tile); + case FERMENTING_BARREL: + return new GuiFermentingBarrel(player.inventory, tile); + case COAL_GENERATOR: + return new GuiCoalGenerator(player.inventory, tile); + case OIL_GENERATOR: + return new GuiOilGenerator(player.inventory, tile); + case PHANTOM_PLACER: + return new GuiPhantomPlacer(player.inventory, tile); + case FLUID_COLLECTOR: + return new GuiFluidCollector(player.inventory, tile); + case COFFEE_MACHINE: + return new GuiCoffeeMachine(player.inventory, tile); + case DRILL: + return new GuiDrill(player.inventory); + case FILTER: + return new GuiFilter(player.inventory); + case ENERGIZER: + return new GuiEnergizer(player, tile); + case ENERVATOR: + return new GuiEnervator(player, tile); + case XP_SOLIDIFIER: + return new GuiXPSolidifier(player.inventory, tile); + case CLOUD: + return new GuiSmileyCloud(tile, x, y, z, world); + case BOOK: + if(ItemBooklet.forcedPage != null){ + GuiBooklet gui = BookletUtils.createBookletGuiFromPage(null, ItemBooklet.forcedPage); + ItemBooklet.forcedPage = null; + return gui; + } + else{ + PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); + if(data.lastOpenBooklet != null){ + return data.lastOpenBooklet; } else{ - PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); - if(data.lastOpenBooklet != null){ - return data.lastOpenBooklet; - } - else{ - return new GuiMainPage(null); - } + return new GuiMainPage(null); } - case DIRECTIONAL_BREAKER: - return new GuiDirectionalBreaker(player.inventory, tile); - case RANGED_COLLECTOR: - return new GuiRangedCollector(player.inventory, tile); - case MINER: - return new GuiMiner(player.inventory, tile); - case LASER_RELAY_ITEM_WHITELIST: - return new GuiLaserRelayItemWhitelist(player.inventory, tile); - case BAG: - return new GuiBag(player.getHeldItemMainhand(), player.inventory, false); - case VOID_BAG: - return new GuiBag(player.getHeldItemMainhand(), player.inventory, true); - case BIO_REACTOR: - return new GuiBioReactor(player.inventory, tile); - case FARMER: - return new GuiFarmer(player.inventory, tile); - case FIREWORK_BOX: - return new GuiFireworkBox(tile); - default: - return null; + } + case DIRECTIONAL_BREAKER: + return new GuiDirectionalBreaker(player.inventory, tile); + case RANGED_COLLECTOR: + return new GuiRangedCollector(player.inventory, tile); + case MINER: + return new GuiMiner(player.inventory, tile); + case LASER_RELAY_ITEM_WHITELIST: + return new GuiLaserRelayItemWhitelist(player.inventory, tile); + case BAG: + return new GuiBag(player.getHeldItemMainhand(), player.inventory, false); + case VOID_BAG: + return new GuiBag(player.getHeldItemMainhand(), player.inventory, true); + case BIO_REACTOR: + return new GuiBioReactor(player.inventory, tile); + case FARMER: + return new GuiFarmer(player.inventory, tile); + case FIREWORK_BOX: + return new GuiFireworkBox(tile); + default: + return null; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java index 6bd3858a4..991f10fe4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java @@ -82,7 +82,7 @@ public class EnergyDisplay extends Gui{ if(this.isMouseOver(mouseX, mouseY)){ Minecraft mc = Minecraft.getMinecraft(); - List text = new ArrayList(); + List text = new ArrayList<>(); text.add(this.getOverlayText()); GuiUtils.drawHoveringText(text, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java index e9a9245ca..123e0df3d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java @@ -63,14 +63,14 @@ public class FilterSettingsGui extends Gui{ this.metaButton.displayString = (this.theSettings.respectMeta ? TextFormatting.DARK_GREEN : TextFormatting.RED)+"ME"; this.nbtButton.displayString = (this.theSettings.respectNBT ? TextFormatting.DARK_GREEN : TextFormatting.RED)+"NB"; this.modButton.displayString = (this.theSettings.respectMod ? TextFormatting.DARK_GREEN : TextFormatting.RED)+"MO"; - this.oredictButton.displayString = (this.theSettings.respectOredict == 0 ? TextFormatting.RED : (this.theSettings.respectOredict == 1 ? TextFormatting.GREEN : TextFormatting.DARK_GREEN))+"OR"; + this.oredictButton.displayString = (this.theSettings.respectOredict == 0 ? TextFormatting.RED : this.theSettings.respectOredict == 1 ? TextFormatting.GREEN : TextFormatting.DARK_GREEN)+"OR"; } public void drawHover(int mouseX, int mouseY){ Minecraft mc = Minecraft.getMinecraft(); if(this.whitelistButton.isMouseOver()){ - List list = new ArrayList(); + List list = new ArrayList<>(); list.add(TextFormatting.BOLD+(this.theSettings.isWhitelist ? StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.whitelist") : StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.blacklist"))); list.addAll(mc.fontRenderer.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ActuallyAdditions.MODID+".gui.whitelistInfo"), 200)); GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); @@ -82,7 +82,7 @@ public class FilterSettingsGui extends Gui{ GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD+(this.theSettings.respectNBT ? StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.respectNBT") : StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.ignoreNBT"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); } else if(this.modButton.isMouseOver()){ - List list = new ArrayList(); + List list = new ArrayList<>(); list.add(TextFormatting.BOLD+(this.theSettings.respectMod ? StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.respectMod") : StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.ignoreMod"))); list.addAll(mc.fontRenderer.listFormattedStringToWidth(StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.respectModInfo"), 200)); @@ -90,8 +90,8 @@ public class FilterSettingsGui extends Gui{ GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); } else if(this.oredictButton.isMouseOver()){ - List list = new ArrayList(); - list.add(TextFormatting.BOLD+(this.theSettings.respectOredict == 0 ? StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.ignoreOredict") : (this.theSettings.respectOredict == 1 ? StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.respectOredictSoft") : StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.respectOredictHard")))); + List list = new ArrayList<>(); + list.add(TextFormatting.BOLD+(this.theSettings.respectOredict == 0 ? StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.ignoreOredict") : this.theSettings.respectOredict == 1 ? StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.respectOredictSoft") : StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.respectOredictHard"))); String type = null; if(this.theSettings.respectOredict == 1){ 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 e1d0ddea7..55a8b7b42 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 @@ -90,7 +90,7 @@ public class FluidDisplay extends Gui{ GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); int i = this.fluidReference.getFluidAmount()*83/this.fluidReference.getCapacity(); - GuiInputter.drawModalRectWithCustomSizedTexture(barX+1, barY+84-i, 36, 172, 16, i, 16, 512); + Gui.drawModalRectWithCustomSizedTexture(barX+1, barY+84-i, 36, 172, 16, i, 16, 512); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.popMatrix(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java index 6c1f931c3..fe4157d49 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java @@ -103,7 +103,7 @@ public class GuiBag extends GuiWtfMojang{ this.filter.drawHover(mouseX, mouseY); if(this.buttonAutoInsert.isMouseOver()){ - List text = new ArrayList(); + List text = new ArrayList<>(); text.add(TextFormatting.BOLD+"Auto-Insert "+(this.container.autoInsert ? "On" : "Off")); text.addAll(this.mc.fontRenderer.listFormattedStringToWidth("Turn this on to make items that get picked up automatically go into the bag.", 200)); text.addAll(this.mc.fontRenderer.listFormattedStringToWidth(TextFormatting.GRAY+""+TextFormatting.ITALIC+"Note that this WON'T work when you are holding the bag in your hand.", 200)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java index 56bc84061..e2d19cef5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java @@ -41,7 +41,7 @@ public class GuiFeeder extends GuiWtfMojang{ public void drawScreen(int x, int y, float f){ super.drawScreen(x, y, f); if(x >= this.guiLeft+69 && y >= this.guiTop+30 && x <= this.guiLeft+69+10 && y <= this.guiTop+30+10){ - String[] array = new String[]{(this.tileFeeder.currentAnimalAmount+" "+StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.animals")), ((this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD) ? StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.enoughToBreed") : (this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD ? StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.tooMany") : StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.notEnough")))}; + String[] array = new String[]{this.tileFeeder.currentAnimalAmount+" "+StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.animals"), this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD ? StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.enoughToBreed") : this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD ? StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.tooMany") : StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.notEnough")}; this.drawHoveringText(Arrays.asList(array), x, y); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java index 37129d6e5..b8f9f3c38 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java @@ -51,7 +51,7 @@ public class GuiGiantChest extends GuiWtfMojang{ this.buttonList.add(new GuiButton(this.page-1, this.guiLeft+13, this.guiTop+172, 20, 20, "<")); } - if((this.page == 0 && this.chest instanceof TileEntityGiantChestMedium) || (this.page <= 1 && this.chest instanceof TileEntityGiantChestLarge)){ + if(this.page == 0 && this.chest instanceof TileEntityGiantChestMedium || this.page <= 1 && this.chest instanceof TileEntityGiantChestLarge){ this.buttonList.add(new GuiButton(this.page+1, this.guiLeft+209, this.guiTop+172, 20, 20, ">")); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java index 81435d10d..ff80f1028 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java @@ -79,7 +79,7 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang{ super.drawScreen(x, y, f); if(this.buttonSmartWhitelistLeft.isMouseOver() || this.buttonSmartWhitelistRight.isMouseOver()){ - List list = new ArrayList(); + List list = new ArrayList<>(); list.add(TextFormatting.BOLD+StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.smart")); list.addAll(this.fontRenderer.listFormattedStringToWidth(StringUtil.localize("info."+ActuallyAdditions.MODID+".gui.smartInfo"), 200)); this.drawHoveringText(list, x, y); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java index f39b422b7..00c744d68 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java @@ -76,7 +76,7 @@ public class GuiOilGenerator extends GuiWtfMojang{ this.drawCenteredString(this.fontRenderer, "for "+ this.generator.maxBurnTime + " t", this.guiLeft + 87, this.guiTop + 75, 0xFFFFFF); GlStateManager.pushMatrix(); GlStateManager.scale(0.75, 0.75, 1); - float xS = (this.guiLeft + 87) * 1.365F - fontRenderer.getStringWidth("(per 50 mB)") / 2F; + float xS = (this.guiLeft + 87) * 1.365F - this.fontRenderer.getStringWidth("(per 50 mB)") / 2F; StringUtil.renderScaledAsciiString(this.fontRenderer, "(per 50 mB)", xS, (this.guiTop + 85) * 1.345F, 0xFFFFFF, true, 0.75F); GlStateManager.popMatrix(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java index b2c1dab14..2bfa699b6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java @@ -67,7 +67,7 @@ public class GuiPhantomPlacer extends GuiWtfMojang{ if(!this.placer.isBreaker && this.buttonList.get(0).isMouseOver()){ String loc = "info."+ActuallyAdditions.MODID+".placer.sides"; - List textList = new ArrayList(); + List textList = new ArrayList<>(); textList.add(TextFormatting.GOLD+StringUtil.localize(loc+".1")); textList.addAll(this.fontRenderer.listFormattedStringToWidth(StringUtil.localize(loc+".2"), 200)); this.drawHoveringText(textList, mouseX, mouseY); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java index 89d0f4b13..070d666fb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java @@ -24,7 +24,7 @@ import java.util.List; @SideOnly(Side.CLIENT) public class TexturedButton extends GuiButton{ - public final List textList = new ArrayList(); + public final List textList = new ArrayList<>(); private final ResourceLocation resLoc; public int texturePosX; public int texturePosY; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java index 5b6b66112..6246f4f64 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java @@ -28,7 +28,7 @@ public class SlotItemHandlerUnconditioned extends SlotItemHandler { @Override public boolean isItemValid(ItemStack stack) { - if (stack.isEmpty() || !inv.canAccept(getSlotIndex(), stack, false)) return false; + if (stack.isEmpty() || !this.inv.canAccept(this.getSlotIndex(), stack, false)) return false; ItemStack currentStack = this.inv.getStackInSlot(this.getSlotIndex()); this.inv.setStackInSlot(this.getSlotIndex(), ItemStack.EMPTY); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java index 64eb73507..3581d84b7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java @@ -78,16 +78,16 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem{ @Override public boolean canHarvestBlock(IBlockState state, ItemStack stack){ - return this.hasExtraWhitelist(state.getBlock()) || state.getMaterial().isToolNotRequired() || (state.getBlock() == Blocks.SNOW_LAYER || state.getBlock() == Blocks.SNOW || (state.getBlock() == Blocks.OBSIDIAN ? this.toolMaterial.getHarvestLevel() >= 3 : (state.getBlock() != Blocks.DIAMOND_BLOCK && state.getBlock() != Blocks.DIAMOND_ORE ? (state.getBlock() != Blocks.EMERALD_ORE && state.getBlock() != Blocks.EMERALD_BLOCK ? (state.getBlock() != Blocks.GOLD_BLOCK && state.getBlock() != Blocks.GOLD_ORE ? (state.getBlock() != Blocks.IRON_BLOCK && state.getBlock() != Blocks.IRON_ORE ? (state.getBlock() != Blocks.LAPIS_BLOCK && state.getBlock() != Blocks.LAPIS_ORE ? (state.getBlock() != Blocks.REDSTONE_ORE && state.getBlock() != Blocks.LIT_REDSTONE_ORE ? (state.getMaterial() == Material.ROCK || (state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2))); + return this.hasExtraWhitelist(state.getBlock()) || state.getMaterial().isToolNotRequired() || state.getBlock() == Blocks.SNOW_LAYER || state.getBlock() == Blocks.SNOW || (state.getBlock() == Blocks.OBSIDIAN ? this.toolMaterial.getHarvestLevel() >= 3 : state.getBlock() != Blocks.DIAMOND_BLOCK && state.getBlock() != Blocks.DIAMOND_ORE ? state.getBlock() != Blocks.EMERALD_ORE && state.getBlock() != Blocks.EMERALD_BLOCK ? state.getBlock() != Blocks.GOLD_BLOCK && state.getBlock() != Blocks.GOLD_ORE ? state.getBlock() != Blocks.IRON_BLOCK && state.getBlock() != Blocks.IRON_ORE ? state.getBlock() != Blocks.LAPIS_BLOCK && state.getBlock() != Blocks.LAPIS_ORE ? state.getBlock() != Blocks.REDSTONE_ORE && state.getBlock() != Blocks.LIT_REDSTONE_ORE ? state.getMaterial() == Material.ROCK || state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL : this.toolMaterial.getHarvestLevel() >= 2 : this.toolMaterial.getHarvestLevel() >= 1 : this.toolMaterial.getHarvestLevel() >= 1 : this.toolMaterial.getHarvestLevel() >= 2 : this.toolMaterial.getHarvestLevel() >= 2 : this.toolMaterial.getHarvestLevel() >= 2); } private boolean hasExtraWhitelist(Block block){ String name = block.getRegistryName().toString(); - for(String list : ConfigStringListValues.PAXEL_EXTRA_MINING_WHITELIST.getValue()){ - if(list.equals(name)){ - return true; - } + for(String list : ConfigStringListValues.PAXEL_EXTRA_MINING_WHITELIST.getValue()){ + if(list.equals(name)){ + return true; } + } return false; } @@ -110,16 +110,11 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem{ @SideOnly(Side.CLIENT) @Override public IItemColor getItemColor(){ - return new IItemColor(){ - @Override - public int colorMultiplier(ItemStack stack, int pass){ - return pass > 0 ? ItemAllToolAA.this.color : 0xFFFFFF; - } - }; + return (stack, pass) -> pass > 0 ? ItemAllToolAA.this.color : 0xFFFFFF; + } + + @Override + public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { + return super.canApplyAtEnchantingTable(stack, enchantment) || enchantment.type.canEnchantItem(Items.DIAMOND_SWORD); } - - @Override - public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { - return super.canApplyAtEnchantingTable(stack, enchantment) || enchantment.type.canEnchantItem(Items.DIAMOND_SWORD); - } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java index 32fb4046e..77a5eb855 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java @@ -75,7 +75,7 @@ public class ItemBattery extends ItemEnergy{ public ActionResult onItemRightClick(World worldIn, EntityPlayer player, EnumHand hand){ if(!worldIn.isRemote && player.isSneaking()){ ItemUtil.changeEnabled(player, hand); - return new ActionResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); + return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } return super.onItemRightClick(worldIn, player, hand); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java index 3325b5eb8..ba09142c2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java @@ -80,7 +80,7 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{ //TheAchievements.OPEN_BOOKLET.get(player); //TheAchievements.OPEN_BOOKLET_MILESTONE.get(player); } - return new ActionResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); + return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java index 40ccf4c68..7744ac0e8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java @@ -44,7 +44,7 @@ public class ItemChestToCrateUpgrade extends ItemBase{ ItemStack heldStack = player.getHeldItem(hand); if(player.isSneaking()){ TileEntity tileHit = world.getTileEntity(pos); - if(tileHit != null && start.isInstance(tileHit)){ + if(tileHit != null && this.start.isInstance(tileHit)){ if(!world.isRemote){ //Copy Slots @@ -60,7 +60,7 @@ public class ItemChestToCrateUpgrade extends ItemBase{ ItemStack[] stacks = new ItemStack[chest.getSlots()]; for(int i = 0; i < stacks.length; i++){ ItemStack aStack = chest.getStackInSlot(i); - stacks[i] = aStack.copy(); + stacks[i] = aStack.copy(); } //Set New Block diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java index d131efdf6..34f1d39a0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java @@ -140,7 +140,7 @@ public class ItemCoffee extends ItemFoodBase{ @Override public boolean effect(ItemStack stack){ PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack); - ArrayList effectsNew = new ArrayList(); + ArrayList effectsNew = new ArrayList<>(); if(effects != null && effects.length > 0){ for(PotionEffect effect : effects){ if(effect.getAmplifier() > 0){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java index 20d12a26d..25fd13b3c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java @@ -34,7 +34,7 @@ public class ItemCrafterOnAStick extends ItemBase{ if(!world.isRemote){ player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.CRAFTER.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); } - return new ActionResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); + return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } 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 4f35f3329..12b6582d0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java @@ -67,16 +67,13 @@ public class ItemCrystalShard extends ItemBase implements IColorProvidingItem{ @Override @SideOnly(Side.CLIENT) public IItemColor getItemColor(){ - return new IItemColor(){ - @Override - public int colorMultiplier(ItemStack stack, int tintIndex){ - int damage = stack.getItemDamage(); - if(damage >= 0 && damage < BlockCrystal.ALL_CRYSTALS.length){ - return BlockCrystal.ALL_CRYSTALS[damage].clusterColor; - } - else{ - return 0; - } + return (stack, tintIndex) -> { + int damage = stack.getItemDamage(); + if(damage >= 0 && damage < BlockCrystal.ALL_CRYSTALS.length){ + return BlockCrystal.ALL_CRYSTALS[damage].clusterColor; + } + else{ + return 0; } }; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java index 2febcc811..6f1708235 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java @@ -167,7 +167,7 @@ public class ItemDrill extends ItemEnergy{ if(!world.isRemote && player.isSneaking() && hand == EnumHand.MAIN_HAND){ player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); } - return new ActionResult(EnumActionResult.PASS, player.getHeldItem(hand)); + return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand)); } @Override @@ -205,7 +205,7 @@ public class ItemDrill extends ItemEnergy{ @Override public float getDestroySpeed(ItemStack stack, IBlockState state){ - return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) ? (this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.getEfficiencyFromUpgrade(stack) : 1.0F) : 0.1F; + return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) ? this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.getEfficiencyFromUpgrade(stack) : 1.0F : 0.1F; } @Override @@ -226,7 +226,7 @@ public class ItemDrill extends ItemEnergy{ //Block hit RayTraceResult ray = WorldUtil.getNearestBlockWithDefaultReachDistance(player.world, player); if(ray != null){ - + //Breaks the Blocks if(!player.isSneaking() && this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)){ @@ -251,12 +251,12 @@ public class ItemDrill extends ItemEnergy{ @Override public boolean canHarvestBlock(IBlockState state, ItemStack stack){ Block block = state.getBlock(); - return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || state.getMaterial().isToolNotRequired() || (block == Blocks.SNOW_LAYER || block == Blocks.SNOW || (block == Blocks.OBSIDIAN ? HARVEST_LEVEL >= 3 : (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE ? (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK ? (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE ? (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE ? (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE ? (block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE ? (state.getMaterial() == Material.ROCK || (state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL)) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 1) : HARVEST_LEVEL >= 1) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 2)))); + return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || state.getMaterial().isToolNotRequired() || block == Blocks.SNOW_LAYER || block == Blocks.SNOW || (block == Blocks.OBSIDIAN ? HARVEST_LEVEL >= 3 : block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE ? block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK ? block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE ? block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE ? block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE ? block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE ? state.getMaterial() == Material.ROCK || state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL : HARVEST_LEVEL >= 2 : HARVEST_LEVEL >= 1 : HARVEST_LEVEL >= 1 : HARVEST_LEVEL >= 2 : HARVEST_LEVEL >= 2 : HARVEST_LEVEL >= 2)); } @Override public Set getToolClasses(ItemStack stack){ - HashSet hashSet = new HashSet(); + HashSet hashSet = new HashSet<>(); hashSet.add("pickaxe"); hashSet.add("shovel"); return hashSet; @@ -418,13 +418,13 @@ public class ItemDrill extends ItemEnergy{ else{ return false; } - - if(radius == 2 && side.getAxis() != Axis.Y) { - aPos = aPos.up(); - IBlockState theState = world.getBlockState(aPos); - if(theState.getBlockHardness(world, aPos) <= mainHardness+5.0F){ - this.tryHarvestBlock(world, aPos, true, stack, player, use); - } + + if(radius == 2 && side.getAxis() != Axis.Y) { + aPos = aPos.up(); + IBlockState theState = world.getBlockState(aPos); + if(theState.getBlockHardness(world, aPos) <= mainHardness+5.0F){ + this.tryHarvestBlock(world, aPos, true, stack, player, use); + } } //Break Blocks around @@ -468,7 +468,7 @@ public class ItemDrill extends ItemEnergy{ Block block = state.getBlock(); float hardness = state.getBlockHardness(world, pos); boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(state, stack)) && (!isExtra || this.getDestroySpeed(stack, world.getBlockState(pos)) > 1.0F); - if(hardness >= 0.0F && (!isExtra || (canHarvest && !block.hasTileEntity(world.getBlockState(pos))))){ + if(hardness >= 0.0F && (!isExtra || canHarvest && !block.hasTileEntity(world.getBlockState(pos)))){ if(!player.capabilities.isCreativeMode){ this.extractEnergyInternal(stack, use, false); } @@ -494,9 +494,9 @@ public class ItemDrill extends ItemEnergy{ } return false; } - + @Override public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) { - return !(newStack.isItemEqual(oldStack)); + return !newStack.isItemEqual(oldStack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java index e78a2969c..6ee2a48ac 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java @@ -43,9 +43,9 @@ public class ItemDrillUpgrade extends ItemBase{ ItemStack stack = player.getHeldItem(hand); if(!world.isRemote && this.type == UpgradeType.PLACER){ this.setSlotToPlaceFrom(stack, player.inventory.currentItem); - return new ActionResult(EnumActionResult.SUCCESS, stack); + return new ActionResult<>(EnumActionResult.SUCCESS, stack); } - return new ActionResult(EnumActionResult.FAIL, stack); + return new ActionResult<>(EnumActionResult.FAIL, stack); } public void setSlotToPlaceFrom(ItemStack stack, int slot){ 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 d24ae9b12..f8774cf63 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java @@ -69,17 +69,12 @@ public class ItemDust extends ItemBase implements IColorProvidingItem{ @SideOnly(Side.CLIENT) @Override public IItemColor getItemColor(){ - return new IItemColor(){ - @Override - public int colorMultiplier(ItemStack stack, int pass){ - return stack.getItemDamage() >= ALL_DUSTS.length ? 0xFFFFFF : ALL_DUSTS[stack.getItemDamage()].color; - } - }; + return (stack, pass) -> stack.getItemDamage() >= ALL_DUSTS.length ? 0xFFFFFF : ALL_DUSTS[stack.getItemDamage()].color; } - + @Override public int getItemBurnTime(ItemStack stack) { - if(stack.getMetadata() == 6) return 1200; - return super.getItemBurnTime(stack); + if(stack.getMetadata() == 6) return 1200; + return super.getItemBurnTime(stack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java index db31cae00..efc320d3d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java @@ -32,7 +32,7 @@ import java.util.Set; public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles{ - private final Set cachedGlowingEntities = new ConcurrentSet(); + private final Set cachedGlowingEntities = new ConcurrentSet<>(); private final boolean displayMobs; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java index 59fe4f94a..f8a2477c3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java @@ -44,7 +44,7 @@ public class ItemFilter extends ItemBase{ if(!world.isRemote && hand == EnumHand.MAIN_HAND){ player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FILTER.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); } - return new ActionResult(EnumActionResult.PASS, player.getHeldItem(hand)); + return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand)); } @Override 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 1a361391b..f5b22d968 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java @@ -62,7 +62,7 @@ public class ItemFoods extends ItemFoodBase{ @Override public EnumAction getItemUseAction(ItemStack stack){ - return stack.getItemDamage() >= ALL_FOODS.length ? EnumAction.EAT : (ALL_FOODS[stack.getItemDamage()].getsDrunken ? EnumAction.DRINK : EnumAction.EAT); + return stack.getItemDamage() >= ALL_FOODS.length ? EnumAction.EAT : ALL_FOODS[stack.getItemDamage()].getsDrunken ? EnumAction.DRINK : EnumAction.EAT; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java index 9e845eae6..f01bcb1d1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java @@ -45,7 +45,7 @@ public class ItemGrowthRing extends ItemEnergy{ int energyUse = 300; if(StackUtil.isValid(equipped) && equipped == stack && this.getEnergyStored(stack) >= energyUse){ - List blocks = new ArrayList(); + List blocks = new ArrayList<>(); //Adding all possible Blocks if(player.world.getTotalWorldTime()%30 == 0){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java index 3751d52d8..6aad84a32 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java @@ -34,7 +34,7 @@ import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class ItemHairyBall extends ItemBase{ - + private final UUID KittyVanCatUUID = UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44"); public ItemHairyBall(String name){ @@ -47,12 +47,12 @@ public class ItemHairyBall extends ItemBase{ public void livingUpdateEvent(LivingEvent.LivingUpdateEvent event){ //Ocelots dropping Hair Balls if(ConfigBoolValues.DO_CAT_DROPS.isEnabled() && event.getEntityLiving() != null && event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote){ - if((event.getEntityLiving() instanceof EntityOcelot && ((EntityOcelot)event.getEntityLiving()).isTamed()) || (event.getEntityLiving() instanceof EntityPlayer && event.getEntityLiving().getUniqueID().equals(KittyVanCatUUID))){ - if(event.getEntityLiving().world.rand.nextInt(ConfigIntValues.FUR_CHANCE.getValue()) == 0){ - EntityItem item = new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX+0.5, event.getEntityLiving().posY+0.5, event.getEntityLiving().posZ+0.5, new ItemStack(InitItems.itemHairyBall)); - event.getEntityLiving().world.spawnEntity(item); - } - } + if(event.getEntityLiving() instanceof EntityOcelot && ((EntityOcelot)event.getEntityLiving()).isTamed() || event.getEntityLiving() instanceof EntityPlayer && event.getEntityLiving().getUniqueID().equals(this.KittyVanCatUUID)){ + if(event.getEntityLiving().world.rand.nextInt(ConfigIntValues.FUR_CHANCE.getValue()) == 0){ + EntityItem item = new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX+0.5, event.getEntityLiving().posY+0.5, event.getEntityLiving().posZ+0.5, new ItemStack(InitItems.itemHairyBall)); + event.getEntityLiving().world.spawnEntity(item); + } + } } } @@ -70,7 +70,7 @@ public class ItemHairyBall extends ItemBase{ world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, world.rand.nextFloat()*0.1F+0.9F); } - return new ActionResult(EnumActionResult.SUCCESS, stack); + return new ActionResult<>(EnumActionResult.SUCCESS, stack); } public ItemStack getRandomReturnItem(Random rand){ 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 f266e5963..e4826e794 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java @@ -109,11 +109,6 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem{ @Override @SideOnly(Side.CLIENT) public IItemColor getItemColor(){ - return new IItemColor(){ - @Override - public int colorMultiplier(ItemStack stack, int pass){ - return pass > 0 ? (stack.getItemDamage() >= ALL_JAMS.length ? 0xFFFFFF : ALL_JAMS[stack.getItemDamage()].color) : 0xFFFFFF; - } - }; + return (stack, pass) -> pass > 0 ? stack.getItemDamage() >= ALL_JAMS.length ? 0xFFFFFF : ALL_JAMS[stack.getItemDamage()].color : 0xFFFFFF; } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java index 9a7396e5f..f99610e58 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java @@ -48,7 +48,7 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem{ @Override public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand){ player.setActiveHand(hand); - return new ActionResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); + return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } @@ -96,18 +96,18 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem{ * @param z The Z Position of the Player */ public boolean breakStuff(World world, int x, int y, int z){ - ArrayList breakPositions = new ArrayList(); + ArrayList breakPositions = new ArrayList<>(); int rangeSides = 5; int rangeUp = 1; for(int reachX = -rangeSides; reachX < rangeSides+1; reachX++){ for(int reachZ = -rangeSides; reachZ < rangeSides+1; reachZ++){ - for(int reachY = (this.isAdvanced ? -rangeSides : -rangeUp); reachY < (this.isAdvanced ? rangeSides : rangeUp)+1; reachY++){ + for(int reachY = this.isAdvanced ? -rangeSides : -rangeUp; reachY < (this.isAdvanced ? rangeSides : rangeUp)+1; reachY++){ //The current Block to break BlockPos pos = new BlockPos(x+reachX, y+reachY, z+reachZ); Block block = world.getBlockState(pos).getBlock(); - if(block != null && ((block instanceof BlockBush || block instanceof IShearable) && (this.isAdvanced || !block.isLeaves(world.getBlockState(pos), world, pos)))){ + if(block != null && (block instanceof BlockBush || block instanceof IShearable) && (this.isAdvanced || !block.isLeaves(world.getBlockState(pos), world, pos))){ breakPositions.add(pos); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java index fc17aa357..ec15f6cf5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java @@ -47,7 +47,7 @@ public class ItemMagnetRing extends ItemEnergy{ List items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(entity.posX-range, entity.posY-range, entity.posZ-range, entity.posX+range, entity.posY+range, entity.posZ+range)); if(!items.isEmpty()){ for(EntityItem item : items){ - if(item.getEntityData().getBoolean("PreventRemoteMovement")) continue; + if(item.getEntityData().getBoolean("PreventRemoteMovement")) continue; if(!item.isDead && !item.cannotPickup()){ int energyForItem = 50*item.getItem().getCount(); @@ -73,7 +73,7 @@ public class ItemMagnetRing extends ItemEnergy{ public ActionResult onItemRightClick(World worldIn, EntityPlayer player, EnumHand hand){ if(!worldIn.isRemote && player.isSneaking()){ ItemUtil.changeEnabled(player, hand); - return new ActionResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); + return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } return super.onItemRightClick(worldIn, player, hand); } 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 d128a6c68..0efd6ffcc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java @@ -103,15 +103,15 @@ public class ItemMisc extends ItemBase{ public boolean hasEffect(ItemStack stack){ return stack.getItemDamage() == TheMiscItems.EMPOWERED_CANOLA_SEED.ordinal(); } - + @Override public int getItemBurnTime(ItemStack stack) { - int k = stack.getMetadata(); - + int k = stack.getMetadata(); + if(k == TheMiscItems.TINY_CHAR.ordinal()) return 200; if(k == TheMiscItems.TINY_COAL.ordinal()) return 200; if(k == TheMiscItems.BIOCOAL.ordinal()) return 800; - - return super.getItemBurnTime(stack); + + return super.getItemBurnTime(stack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java index c8c180077..1524f79c8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java @@ -51,7 +51,7 @@ public class ItemPickaxeAA extends ItemToolAA{ if(block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE){ if(block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE){ Material material = blockIn.getMaterial(); - return material == Material.ROCK || (material == Material.IRON || material == Material.ANVIL); + return material == Material.ROCK || material == Material.IRON || material == Material.ANVIL; } else{ return this.toolMaterial.getHarvestLevel() >= 2; 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 601f7e35b..898515560 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java @@ -113,7 +113,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi ItemStack equippedStack = thePlayer.getHeldItemMainhand(); ItemStack offhandStack = thePlayer.getHeldItemOffhand(); - if(this.effectEntity(thePlayer, stack, (StackUtil.isValid(equippedStack) && stack == equippedStack) || (StackUtil.isValid(offhandStack) && stack == offhandStack))){ + if(this.effectEntity(thePlayer, stack, StackUtil.isValid(equippedStack) && stack == equippedStack || StackUtil.isValid(offhandStack) && stack == offhandStack)){ if(world.getTotalWorldTime()%10 == 0){ setStoredBlaze(stack, storedBlaze-1); } @@ -130,20 +130,20 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi @Override public String getItemStackDisplayName(ItemStack stack){ - if(Util.isClient()) { - String standardName = StringUtil.localize(this.getTranslationKey()+".name"); + if(Util.isClient()) { + 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.getTranslationKey()+".name"); if(stack.getItemDamage() < ALL_RINGS.length){ - String effect = StringUtil.localize(ALL_RINGS[stack.getItemDamage()].name); + String effect = StringUtil.localizeIllegallyOnTheServerDontUseMePls(ALL_RINGS[stack.getItemDamage()].name); return standardName+" "+effect; } return standardName; - } - 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; - } - return standardName; } @Override @@ -175,12 +175,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi @Override @SideOnly(Side.CLIENT) public IItemColor getItemColor(){ - return new IItemColor(){ - @Override - public int colorMultiplier(ItemStack stack, int tintIndex){ - return stack.getItemDamage() >= ALL_RINGS.length ? 0xFFFFFF : ALL_RINGS[stack.getItemDamage()].color; - } - }; + return (stack, tintIndex) -> stack.getItemDamage() >= ALL_RINGS.length ? 0xFFFFFF : ALL_RINGS[stack.getItemDamage()].color; } @Override @@ -232,7 +227,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi ThePotionRings effect = ThePotionRings.values()[stack.getItemDamage()]; Potion potion = Potion.getPotionById(effect.effectID); PotionEffect activeEffect = thePlayer.getActivePotionEffect(potion); - if(!effect.needsWaitBeforeActivating || (activeEffect == null || activeEffect.getDuration() <= 1)){ + if(!effect.needsWaitBeforeActivating || activeEffect == null || activeEffect.getDuration() <= 1){ if(!((ItemPotionRing)stack.getItem()).isAdvanced){ if(canUseBasic){ thePlayer.addPotionEffect(new PotionEffect(potion, effect.activeTime, effect.normalAmplifier, true, false)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java index 69471a17b..9d750457f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java @@ -33,7 +33,7 @@ public class ItemResonantRice extends ItemBase{ stack.shrink(1); world.createExplosion(null, player.posX, player.posY, player.posZ, 0.5F, true); } - return new ActionResult(EnumActionResult.SUCCESS, stack); + return new ActionResult<>(EnumActionResult.SUCCESS, stack); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java index 53bcdb77e..18f1af8f2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java @@ -92,28 +92,28 @@ public class ItemWaterBowl extends ItemBase{ } if(trace == null){ - return new ActionResult(EnumActionResult.PASS, stack); + return new ActionResult<>(EnumActionResult.PASS, stack); } else if(trace.typeOfHit != RayTraceResult.Type.BLOCK){ - return new ActionResult(EnumActionResult.PASS, stack); + return new ActionResult<>(EnumActionResult.PASS, stack); } else{ BlockPos pos = trace.getBlockPos(); if(!world.isBlockModifiable(player, pos)){ - return new ActionResult(EnumActionResult.FAIL, stack); + return new ActionResult<>(EnumActionResult.FAIL, stack); } else{ BlockPos pos1 = world.getBlockState(pos).getBlock().isReplaceable(world, pos) && trace.sideHit == EnumFacing.UP ? pos : pos.offset(trace.sideHit); if(!player.canPlayerEdit(pos1, trace.sideHit, stack)){ - return new ActionResult(EnumActionResult.FAIL, stack); + return new ActionResult<>(EnumActionResult.FAIL, stack); } else if(this.tryPlaceContainedLiquid(player, world, pos1, false)){ - return !player.capabilities.isCreativeMode ? new ActionResult(EnumActionResult.SUCCESS, new ItemStack(Items.BOWL)) : new ActionResult(EnumActionResult.SUCCESS, stack); + return !player.capabilities.isCreativeMode ? new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(Items.BOWL)) : new ActionResult<>(EnumActionResult.SUCCESS, stack); } else{ - return new ActionResult(EnumActionResult.FAIL, stack); + return new ActionResult<>(EnumActionResult.FAIL, stack); } } } @@ -134,12 +134,12 @@ public class ItemWaterBowl extends ItemBase{ } boolean change = false; - if((lastX != 0 && lastX != (int)entity.posX) || (lastY != 0 && lastY != (int)entity.posY)){ + if(lastX != 0 && lastX != (int)entity.posX || lastY != 0 && lastY != (int)entity.posY){ if(!entity.isSneaking()){ if(entity instanceof EntityPlayer){ EntityPlayer player = (EntityPlayer)entity; if(this.tryPlaceContainedLiquid(player, world, player.getPosition(), true)){ - checkReplace(player, stack, new ItemStack(Items.BOWL), itemSlot); + this.checkReplace(player, stack, new ItemStack(Items.BOWL), itemSlot); } } } @@ -159,7 +159,7 @@ public class ItemWaterBowl extends ItemBase{ } } } - + private void checkReplace(EntityPlayer player, ItemStack old, ItemStack stack, int slot) { if(player.inventory.getStackInSlot(slot) == old) player.inventory.setInventorySlotContents(slot, stack); else if(player.inventory.offHandInventory.get(slot) == old) player.inventory.offHandInventory.set(slot, stack); @@ -184,7 +184,7 @@ public class ItemWaterBowl extends ItemBase{ world.playSound(player, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F+(world.rand.nextFloat()-world.rand.nextFloat())*0.8F); for(int k = 0; k < 8; k++){ - world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)pos.getX()+Math.random(), (double)pos.getY()+Math.random(), (double)pos.getZ()+Math.random(), 0.0D, 0.0D, 0.0D); + world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, pos.getX()+Math.random(), pos.getY()+Math.random(), pos.getZ()+Math.random(), 0.0D, 0.0D, 0.0D); } } else{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java index 27db8db8b..4b2d0f9b2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java @@ -72,7 +72,7 @@ public class ItemWingsOfTheBats extends ItemBase{ PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); if(data != null){ double diff = MAX_FLY_TIME-data.batWingsFlyTime; - return 1-(diff/MAX_FLY_TIME); + return 1-diff/MAX_FLY_TIME; } } return super.getDurabilityForDisplay(stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java index 0d317b0c4..113facb3d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java @@ -27,7 +27,7 @@ public class ItemArmorAA extends ItemArmor implements IDisableableItem{ private final String name; private final EnumRarity rarity; private final boolean disabled; - + public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem){ this(name, material, type, repairItem, EnumRarity.RARE); } @@ -38,7 +38,7 @@ public class ItemArmorAA extends ItemArmor implements IDisableableItem{ this.name = name; this.rarity = rarity; this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(name) +". It will not be registered."); - if(!disabled) this.register(); + if(!this.disabled) this.register(); } private void register(){ @@ -68,9 +68,9 @@ public class ItemArmorAA extends ItemArmor implements IDisableableItem{ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ return StackUtil.isValid(this.repairItem) && ItemUtil.areItemsEqual(this.repairItem, stack, false); } - + @Override public boolean isDisabled() { - return disabled; + return this.disabled; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java index 95db8da65..f492e3400 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java @@ -222,8 +222,8 @@ public abstract class ItemEnergy extends ItemBase{ return this.getCapability(capability, facing) != null; } - - @Nullable + + @Nullable @Override public T getCapability(Capability capability, EnumFacing facing){ if(capability == CapabilityEnergy.ENERGY){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java index 9daf8b51a..2b3ac46d7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java @@ -34,8 +34,8 @@ public class ItemHoeAA extends ItemHoe implements IDisableableItem { this.name = unlocalizedName; this.rarity = rarity; - this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(name) +". It will not be registered."); - if(!disabled) this.register(); + this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(this.name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(this.name) +". It will not be registered."); + if(!this.disabled) this.register(); } private void register(){ @@ -67,8 +67,8 @@ public class ItemHoeAA extends ItemHoe implements IDisableableItem { return ItemUtil.areItemsEqual(this.repairItem, stack, false); } - @Override - public boolean isDisabled() { - return disabled; - } + @Override + public boolean isDisabled() { + return this.disabled; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java index d1961465f..74e925a2f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java @@ -34,8 +34,8 @@ public class ItemSwordAA extends ItemSword implements IDisableableItem { this.name = unlocalizedName; this.rarity = rarity; - this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(name) +". It will not be registered."); - if(!disabled) this.register(); + this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(this.name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(this.name) +". It will not be registered."); + if(!this.disabled) this.register(); } private void register(){ @@ -71,8 +71,8 @@ public class ItemSwordAA extends ItemSword implements IDisableableItem { return this.rarity; } - @Override - public boolean isDisabled() { - return disabled; - } + @Override + public boolean isDisabled() { + return this.disabled; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java index 295392bd6..d50eafc4a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java @@ -44,7 +44,7 @@ public class ItemToolAA extends ItemTool implements IDisableableItem{ this.name = unlocalizedName; this.rarity = rarity; this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(unlocalizedName), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(unlocalizedName) +". It will not be registered."); - if(!disabled) this.register(); + if(!this.disabled) this.register(); } private void register(){ @@ -87,8 +87,8 @@ public class ItemToolAA extends ItemTool implements IDisableableItem{ return false; } - @Override - public boolean isDisabled() { - return disabled; - } + @Override + public boolean isDisabled() { + return this.disabled; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java index 608a5d27e..aaed68a4a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java @@ -62,10 +62,10 @@ public class LensColor extends Lens{ int meta = block.getMetaFromState(state); ItemStack returnStack = this.tryConvert(new ItemStack(block, 1, meta), hitState, hitBlock, tile); if(returnStack != null && returnStack.getItem() instanceof ItemBlock){ - Block toPlace = Block.getBlockFromItem(returnStack.getItem()); - IBlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), hitBlock, EnumFacing.UP, 0, 0, 0, returnStack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND); + Block toPlace = Block.getBlockFromItem(returnStack.getItem()); + IBlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), hitBlock, EnumFacing.UP, 0, 0, 0, returnStack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND); tile.getWorldObject().setBlockState(hitBlock, state2Place, 2); - tile.extractEnergy(ENERGY_USE); + tile.extractEnergy(ENERGY_USE); } } @@ -90,9 +90,9 @@ public class LensColor extends Lens{ private ItemStack tryConvert(ItemStack stack, IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ if(StackUtil.isValid(stack)){ Item item = stack.getItem(); - for(Map.Entry changer : ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_COLOR_CHANGERS.entrySet()){ - if(item == changer.getKey()){ - return changer.getValue().modifyItem(stack, hitState, hitBlock, tile); + for(Map.Entry changer : ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_COLOR_CHANGERS.entrySet()){ + if(item == changer.getKey()){ + return changer.getValue().modifyItem(stack, hitState, hitBlock, tile); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java index 441d5589b..634e9d6a4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java @@ -165,7 +165,7 @@ public class LensMining extends Lens{ if(tile.getEnergy() >= adaptedUse){ Block block = Block.getBlockFromItem(stack.getItem()); if(block != Blocks.AIR){ - IBlockState state = block.getStateForPlacement(tile.getWorldObject(), hitPos, EnumFacing.UP, 0, 0, 0, stack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND); + IBlockState state = block.getStateForPlacement(tile.getWorldObject(), hitPos, EnumFacing.UP, 0, 0, 0, stack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND); tile.getWorldObject().setBlockState(hitPos, state, 2); tile.getWorldObject().playEvent(2001, hitPos, Block.getStateId(state)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensRecipeHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensRecipeHandler.java index 356a905a2..1df55b711 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensRecipeHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensRecipeHandler.java @@ -39,7 +39,7 @@ import net.minecraftforge.oredict.OreDictionary; public final class LensRecipeHandler { - public static final ArrayList MAIN_PAGE_RECIPES = new ArrayList(); + public static final ArrayList MAIN_PAGE_RECIPES = new ArrayList<>(); public static LensConversionRecipe recipeColorLens; public static LensConversionRecipe recipeSoulSand; public static LensConversionRecipe recipeGreenWall; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java index fc76c91a7..3584e8290 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java @@ -47,18 +47,18 @@ import net.minecraft.item.ItemStack; @JEIPlugin public class JEIActuallyAdditionsPlugin implements IModPlugin{ - + @Override - public void registerCategories(IRecipeCategoryRegistration registry) { - IJeiHelpers helpers = registry.getJeiHelpers(); - registry.addRecipeCategories( + public void registerCategories(IRecipeCategoryRegistration registry) { + IJeiHelpers helpers = registry.getJeiHelpers(); + registry.addRecipeCategories( new CoffeeMachineRecipeCategory(helpers.getGuiHelper()), new CompostRecipeCategory(helpers.getGuiHelper()), new CrusherRecipeCategory(helpers.getGuiHelper()), new ReconstructorRecipeCategory(helpers.getGuiHelper()), new EmpowererRecipeCategory(helpers.getGuiHelper()), new BookletRecipeCategory(helpers.getGuiHelper())); - } + } @Override public void register(IModRegistry registry){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeCategory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeCategory.java index b9bca2748..c1872e489 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeCategory.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeCategory.java @@ -58,7 +58,7 @@ public class BookletRecipeCategory implements IRecipeCategory list = new ArrayList(); + List list = new ArrayList<>(); wrapper.thePage.getItemStacksForPage(list); recipeLayout.getItemStacks().set(0, list); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java index 282341077..b60f62a43 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java @@ -35,12 +35,12 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton { @Override public void getIngredients(IIngredients ingredients) { - List itemList = new ArrayList(); + List itemList = new ArrayList<>(); this.thePage.getItemStacksForPage(itemList); ingredients.setInputs(VanillaTypes.ITEM, itemList); ingredients.setOutputs(VanillaTypes.ITEM, itemList); - List fluidList = new ArrayList(); + List fluidList = new ArrayList<>(); this.thePage.getFluidStacksForPage(fluidList); ingredients.setInputs(VanillaTypes.FLUID, fluidList); ingredients.setOutputs(VanillaTypes.FLUID, fluidList); @@ -50,7 +50,7 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton { public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { List header = minecraft.fontRenderer.listFormattedStringToWidth(StringUtil.localize("container.nei." + ActuallyAdditions.MODID + ".booklet.header").replaceAll("", TextFormatting.BLUE + "").replaceAll("", TextFormatting.BLACK + ""), 150); for (int i = 0; i < header.size(); i++) { - minecraft.fontRenderer.drawString((String) header.get(i), 0, 17 + i * (minecraft.fontRenderer.FONT_HEIGHT + 1), 0, false); + minecraft.fontRenderer.drawString(header.get(i), 0, 17 + i * (minecraft.fontRenderer.FONT_HEIGHT + 1), 0, false); } int maxLines = 4; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java index b54000406..f8c0004f6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java @@ -47,7 +47,7 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton { @Override public void getIngredients(IIngredients ingredients) { List list = new ArrayList<>(); - for (ItemStack s : ingredient.getInput().getMatchingStacks()) + for (ItemStack s : this.ingredient.getInput().getMatchingStacks()) list.add(s); list.add(this.cup); list.add(this.coffeeBeans); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/compost/CompostRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/compost/CompostRecipeWrapper.java index 71da6840c..599fd7618 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/compost/CompostRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/compost/CompostRecipeWrapper.java @@ -33,8 +33,8 @@ public class CompostRecipeWrapper extends RecipeWrapperWithButton { @Override public void getIngredients(IIngredients ingredients) { - ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(recipe.getInput().getMatchingStacks())); - ingredients.setOutput(VanillaTypes.ITEM, recipe.getOutput()); + ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(this.recipe.getInput().getMatchingStacks())); + ingredients.setOutput(VanillaTypes.ITEM, this.recipe.getOutput()); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java index fe32f16c8..d85ce1893 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java @@ -36,7 +36,7 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton { @Override public void getIngredients(IIngredients ingredients) { - ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(theRecipe.getInput().getMatchingStacks())); + ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(this.theRecipe.getInput().getMatchingStacks())); List list = new ArrayList<>(); list.add(this.theRecipe.getOutputOne()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeWrapper.java index a1902ebe6..b592805b9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeWrapper.java @@ -33,15 +33,15 @@ public class EmpowererRecipeWrapper extends RecipeWrapperWithButton { @Override public void getIngredients(IIngredients ingredients) { List inputs = new ArrayList<>(); - for (ItemStack s : theRecipe.getInput().getMatchingStacks()) + for (ItemStack s : this.theRecipe.getInput().getMatchingStacks()) inputs.add(s); - for (ItemStack s : theRecipe.getStandOne().getMatchingStacks()) + for (ItemStack s : this.theRecipe.getStandOne().getMatchingStacks()) inputs.add(s); - for (ItemStack s : theRecipe.getStandTwo().getMatchingStacks()) + for (ItemStack s : this.theRecipe.getStandTwo().getMatchingStacks()) inputs.add(s); - for (ItemStack s : theRecipe.getStandThree().getMatchingStacks()) + for (ItemStack s : this.theRecipe.getStandThree().getMatchingStacks()) inputs.add(s); - for (ItemStack s : theRecipe.getStandFour().getMatchingStacks()) + for (ItemStack s : this.theRecipe.getStandFour().getMatchingStacks()) inputs.add(s); ingredients.setInputs(VanillaTypes.ITEM, inputs); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java index 794e2dc89..7b990a6a3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java @@ -99,7 +99,7 @@ public class ConnectionPair implements IConnectionPair{ if(obj instanceof ConnectionPair){ ConnectionPair pair = (ConnectionPair)obj; for(int i = 0; i < this.positions.length; i++){ - if(this.positions[i] == pair.positions[i] || (this.positions[i] != null && this.positions[i].equals(pair.positions[i]))){ + if(this.positions[i] == pair.positions[i] || this.positions[i] != null && this.positions[i].equals(pair.positions[i])){ return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java index 67197477d..d4952991f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java @@ -69,7 +69,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH */ @Override public ConcurrentSet getConnectionsFor(BlockPos relay, World world){ - ConcurrentSet allPairs = new ConcurrentSet(); + ConcurrentSet allPairs = new ConcurrentSet<>(); for(Network aNetwork : WorldData.get(world).laserRelayNetworks){ for(IConnectionPair pair : aNetwork.connections){ if(pair.contains(relay)){ @@ -107,14 +107,14 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH */ @Override public Network getNetworkFor(BlockPos relay, World world){ - if(world != null) - for(Network aNetwork : WorldData.get(world).laserRelayNetworks){ - for(IConnectionPair pair : aNetwork.connections){ - if(pair.contains(relay)){ - return aNetwork; + if(world != null) + for(Network aNetwork : WorldData.get(world).laserRelayNetworks){ + for(IConnectionPair pair : aNetwork.connections){ + if(pair.contains(relay)){ + return aNetwork; + } } } - } return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java index 2a244c78a..09343122d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java @@ -96,7 +96,7 @@ public class MethodHandler implements IMethodHandler{ stack.setTagCompound(new NBTTagCompound()); for(int i = 0; i < effects.length; i++){ if(effects[i].getPotion() == effect.getPotion()){ - effects[i] = new PotionEffect(effects[i].getPotion(), effects[i].getDuration()+(addDur ? effect.getDuration() : 0), effects[i].getAmplifier()+(addAmp ? (effect.getAmplifier() > 0 ? effect.getAmplifier() : 1) : 0)); + effects[i] = new PotionEffect(effects[i].getPotion(), effects[i].getDuration()+(addDur ? effect.getDuration() : 0), effects[i].getAmplifier()+(addAmp ? effect.getAmplifier() > 0 ? effect.getAmplifier() : 1 : 0)); } this.addEffectToStack(stack, effects[i]); } @@ -124,7 +124,7 @@ public class MethodHandler implements IMethodHandler{ @Override public PotionEffect[] getEffectsFromStack(ItemStack stack){ - ArrayList effects = new ArrayList(); + ArrayList effects = new ArrayList<>(); NBTTagCompound tag = stack.getTagCompound(); if(tag != null){ int counter = tag.getInteger("Counter"); @@ -171,29 +171,29 @@ public class MethodHandler implements IMethodHandler{ IBlockState state = tile.getWorldObject().getBlockState(pos); if(state.getBlock() instanceof BlockLaserRelay) continue; LensConversionRecipe recipe = LensRecipeHandler.findMatchingRecipe(new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state)), tile.getLens()); - if(recipe != null && tile.getEnergy() >= recipe.getEnergyUsed()){ - ItemStack output = recipe.getOutput(); - if(StackUtil.isValid(output)){ - tile.getWorldObject().playEvent(2001, pos, Block.getStateId(state)); - recipe.transformHook(ItemStack.EMPTY, state, pos, tile); - if(output.getItem() instanceof ItemBlock){ - Block toPlace = Block.getBlockFromItem(output.getItem()); - IBlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND); - tile.getWorldObject().setBlockState(pos, state2Place, 2); - } - else{ - EntityItem item = new EntityItem(tile.getWorldObject(), pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy()); - tile.getWorldObject().spawnEntity(item); - tile.getWorldObject().setBlockToAir(pos); - } - - tile.extractEnergy(recipe.getEnergyUsed()); - break; + if(recipe != null && tile.getEnergy() >= recipe.getEnergyUsed()){ + ItemStack output = recipe.getOutput(); + if(StackUtil.isValid(output)){ + tile.getWorldObject().playEvent(2001, pos, Block.getStateId(state)); + recipe.transformHook(ItemStack.EMPTY, state, pos, tile); + if(output.getItem() instanceof ItemBlock){ + Block toPlace = Block.getBlockFromItem(output.getItem()); + IBlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND); + tile.getWorldObject().setBlockState(pos, state2Place, 2); } + else{ + EntityItem item = new EntityItem(tile.getWorldObject(), pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy()); + tile.getWorldObject().spawnEntity(item); + tile.getWorldObject().setBlockToAir(pos); + } + + tile.extractEnergy(recipe.getEnergyUsed()); + break; } } } } + } } //Converting the Items @@ -202,32 +202,32 @@ public class MethodHandler implements IMethodHandler{ ItemStack stack = item.getItem(); if(!item.isDead && StackUtil.isValid(stack)){ LensConversionRecipe recipe = LensRecipeHandler.findMatchingRecipe(stack, tile.getLens()); - if(recipe != null){ - int itemsPossible = Math.min(tile.getEnergy()/recipe.getEnergyUsed(), stack.getCount()); + if(recipe != null){ + int itemsPossible = Math.min(tile.getEnergy()/recipe.getEnergyUsed(), stack.getCount()); - if(itemsPossible > 0){ - recipe.transformHook(item.getItem(), null, item.getPosition(), tile); - item.setDead(); + if(itemsPossible > 0){ + recipe.transformHook(item.getItem(), null, item.getPosition(), tile); + item.setDead(); - if(stack.getCount()-itemsPossible > 0){ - ItemStack stackCopy = stack.copy(); - stackCopy.shrink(itemsPossible); + if(stack.getCount()-itemsPossible > 0){ + ItemStack stackCopy = stack.copy(); + stackCopy.shrink(itemsPossible); - EntityItem inputLeft = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, stackCopy); - tile.getWorldObject().spawnEntity(inputLeft); - } - - ItemStack outputCopy = recipe.getOutput().copy(); - outputCopy.setCount(itemsPossible); - - EntityItem newItem = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, outputCopy); - tile.getWorldObject().spawnEntity(newItem); - - tile.extractEnergy(recipe.getEnergyUsed()*itemsPossible); - break; + EntityItem inputLeft = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, stackCopy); + tile.getWorldObject().spawnEntity(inputLeft); } + + ItemStack outputCopy = recipe.getOutput().copy(); + outputCopy.setCount(itemsPossible); + + EntityItem newItem = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, outputCopy); + tile.getWorldObject().spawnEntity(newItem); + + tile.extractEnergy(recipe.getEnergyUsed()*itemsPossible); + break; } } + } } return !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock); } @@ -289,30 +289,30 @@ public class MethodHandler implements IMethodHandler{ } return hasWorkedOnce; } - + @Override public boolean addCrusherRecipes(List inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance){ boolean hasWorkedOnce = false; for(ItemStack input : inputs){ if(StackUtil.isValid(input) && CrusherRecipeRegistry.getRecipeFromInput(input) == null){ - if(StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())){ - ItemStack outputOneCopy = outputOne.copy(); - outputOneCopy.setCount(outputOneAmount); + if(StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())){ + ItemStack outputOneCopy = outputOne.copy(); + outputOneCopy.setCount(outputOneAmount); - if(!StackUtil.isValid(outputTwo)){ - ActuallyAdditionsAPI.addCrusherRecipe(input, outputOneCopy, StackUtil.getEmpty(), 0); - hasWorkedOnce = true; - } - else if(StackUtil.isValid(outputTwo) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputTwo, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())){ - ItemStack outputTwoCopy = outputTwo.copy(); - outputTwoCopy.setCount(outputTwoAmount); + if(!StackUtil.isValid(outputTwo)){ + ActuallyAdditionsAPI.addCrusherRecipe(input, outputOneCopy, StackUtil.getEmpty(), 0); + hasWorkedOnce = true; + } + else if(StackUtil.isValid(outputTwo) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputTwo, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())){ + ItemStack outputTwoCopy = outputTwo.copy(); + outputTwoCopy.setCount(outputTwoAmount); - ActuallyAdditionsAPI.addCrusherRecipe(input, outputOneCopy, outputTwoCopy, outputTwoChance); - hasWorkedOnce = true; - } - } + ActuallyAdditionsAPI.addCrusherRecipe(input, outputOneCopy, outputTwoCopy, outputTwoChance); + hasWorkedOnce = true; } } + } + } return hasWorkedOnce; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java index 356b24fbb..edad90037 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java @@ -87,9 +87,9 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { Block block = state.getBlock(); if (block instanceof BlockCrops) { - if (((BlockCrops) block).isMaxAge(state)) { return doFarmerStuff(state, world, pos, farmer); } - } else if ((BlockCrops.AGE).equals(block.getBlockState().getProperty("age"))) { - if (state.getValue(BlockCrops.AGE) >= 7 && !(block instanceof BlockStem)) return doFarmerStuff(state, world, pos, farmer); + if (((BlockCrops) block).isMaxAge(state)) { return this.doFarmerStuff(state, world, pos, farmer); } + } else if (BlockCrops.AGE.equals(block.getBlockState().getProperty("age"))) { + if (state.getValue(BlockCrops.AGE) >= 7 && !(block instanceof BlockStem)) return this.doFarmerStuff(state, world, pos, farmer); } } return FarmerResult.FAIL; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java index bf2200b08..3c72ef7a9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java @@ -34,7 +34,7 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior { Item seedItem = seed.getItem(); boolean isPumpkin = seedItem == Items.PUMPKIN_SEEDS; if (isPumpkin || seedItem == Items.MELON_SEEDS) { - if ((pos.getX() % 2 == 0) == (pos.getZ() % 2 == 0)) { + if (pos.getX() % 2 == 0 == (pos.getZ() % 2 == 0)) { IBlockState toPlant = (isPumpkin ? Blocks.PUMPKIN_STEM : Blocks.MELON_STEM).getDefaultState(); if (DefaultFarmerBehavior.defaultPlant(world, pos, toPlant, farmer, use)) return FarmerResult.SUCCESS; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/ExUPlantFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/ExUPlantFarmerBehavior.java index a49a0fcd6..a2e30635f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/ExUPlantFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/ExUPlantFarmerBehavior.java @@ -72,7 +72,7 @@ public abstract class ExUPlantFarmerBehavior implements IFarmerBehavior{ if(reg != null && this.getPlantName().equals(reg.toString())){ if(block.getMetaFromState(state) >= this.getMaxStage()){ - NonNullList drops = NonNullList.create(); + NonNullList drops = NonNullList.create(); block.getDrops(drops, world, pos, state, 0); if(StackUtil.isEmpty(drops)) return FarmerResult.FAIL; for(ItemStack stack : drops){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/cloud/SmileyCloudEasterEggs.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/cloud/SmileyCloudEasterEggs.java index c04984d6c..3e376a68c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/cloud/SmileyCloudEasterEggs.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/cloud/SmileyCloudEasterEggs.java @@ -26,7 +26,7 @@ import java.util.List; public final class SmileyCloudEasterEggs{ - public static final List CLOUD_STUFF = new ArrayList(); + public static final List CLOUD_STUFF = new ArrayList<>(); static{ //Glenthor diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java index 380f60c4b..5828dc19c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java @@ -62,7 +62,7 @@ public class RenderSpecial{ //Peck edit: What do you mean by "nice" you jackass? >_> double boop = Minecraft.getSystemTime()/1000D; GlStateManager.translate(0D, Math.sin(boop%(2*Math.PI))*0.25, 0D); - GlStateManager.rotate((float)(((boop*40D)%360)), 0, 1, 0); + GlStateManager.rotate((float)(boop*40D%360), 0, 1, 0); GlStateManager.disableLighting(); GlStateManager.pushMatrix(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java index d9f5ecdb5..35caf2542 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java @@ -26,7 +26,7 @@ import java.util.Properties; public class SpecialRenderInit{ - public static final HashMap SPECIAL_LIST = new HashMap(); + public static final HashMap SPECIAL_LIST = new HashMap<>(); public SpecialRenderInit(){ new ThreadSpecialFetcher(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java index 651966802..0fc993cd7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java @@ -61,12 +61,9 @@ public class PacketClientToServer implements IMessage{ @Override public IMessage onMessage(final PacketClientToServer message, final MessageContext ctx){ - FMLCommonHandler.instance().getMinecraftServerInstance().addScheduledTask(new Runnable(){ - @Override - public void run(){ - if(message.data != null && message.handler != null){ - message.handler.handleData(message.data, ctx); - } + FMLCommonHandler.instance().getMinecraftServerInstance().addScheduledTask(() -> { + if(message.data != null && message.handler != null){ + message.handler.handleData(message.data, ctx); } }); return null; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java index a634cb77b..d65398100 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java @@ -41,7 +41,7 @@ import java.util.List; public final class PacketHandler{ - public static final List DATA_HANDLERS = new ArrayList(); + public static final List DATA_HANDLERS = new ArrayList<>(); public static final IDataHandler LASER_HANDLER = new IDataHandler(){ @Override @SideOnly(Side.CLIENT) @@ -81,56 +81,44 @@ public final class PacketHandler{ mc.effectRenderer.addEffect(fx); } }; - public static final IDataHandler GUI_BUTTON_TO_TILE_HANDLER = new IDataHandler(){ - @Override - public void handleData(NBTTagCompound compound, MessageContext context){ - World world = DimensionManager.getWorld(compound.getInteger("WorldID")); - TileEntity tile = world.getTileEntity(new BlockPos(compound.getInteger("X"), compound.getInteger("Y"), compound.getInteger("Z"))); + public static final IDataHandler GUI_BUTTON_TO_TILE_HANDLER = (compound, context) -> { + World world = DimensionManager.getWorld(compound.getInteger("WorldID")); + TileEntity tile = world.getTileEntity(new BlockPos(compound.getInteger("X"), compound.getInteger("Y"), compound.getInteger("Z"))); - if(tile instanceof IButtonReactor){ - IButtonReactor reactor = (IButtonReactor)tile; - Entity entity = world.getEntityByID(compound.getInteger("PlayerID")); - if(entity instanceof EntityPlayer){ - reactor.onButtonPressed(compound.getInteger("ButtonID"), (EntityPlayer)entity); - } - } - } - }; - public static final IDataHandler GUI_BUTTON_TO_CONTAINER_HANDLER = new IDataHandler(){ - @Override - public void handleData(NBTTagCompound compound, MessageContext context){ - World world = DimensionManager.getWorld(compound.getInteger("WorldID")); + if(tile instanceof IButtonReactor){ + IButtonReactor reactor = (IButtonReactor)tile; Entity entity = world.getEntityByID(compound.getInteger("PlayerID")); if(entity instanceof EntityPlayer){ - Container container = ((EntityPlayer)entity).openContainer; - if(container instanceof IButtonReactor){ - ((IButtonReactor)container).onButtonPressed(compound.getInteger("ButtonID"), (EntityPlayer)entity); - } + reactor.onButtonPressed(compound.getInteger("ButtonID"), (EntityPlayer)entity); } } }; - public static final IDataHandler GUI_NUMBER_TO_TILE_HANDLER = new IDataHandler(){ - @Override - public void handleData(NBTTagCompound compound, MessageContext context){ - World world = DimensionManager.getWorld(compound.getInteger("WorldID")); - TileEntity tile = world.getTileEntity(new BlockPos(compound.getInteger("X"), compound.getInteger("Y"), compound.getInteger("Z"))); - - if(tile instanceof INumberReactor){ - INumberReactor reactor = (INumberReactor)tile; - reactor.onNumberReceived(compound.getDouble("Number"), compound.getInteger("NumberID"), (EntityPlayer)world.getEntityByID(compound.getInteger("PlayerID"))); + public static final IDataHandler GUI_BUTTON_TO_CONTAINER_HANDLER = (compound, context) -> { + World world = DimensionManager.getWorld(compound.getInteger("WorldID")); + Entity entity = world.getEntityByID(compound.getInteger("PlayerID")); + if(entity instanceof EntityPlayer){ + Container container = ((EntityPlayer)entity).openContainer; + if(container instanceof IButtonReactor){ + ((IButtonReactor)container).onButtonPressed(compound.getInteger("ButtonID"), (EntityPlayer)entity); } } }; - public static final IDataHandler GUI_STRING_TO_TILE_HANDLER = new IDataHandler(){ - @Override - public void handleData(NBTTagCompound compound, MessageContext context){ - World world = DimensionManager.getWorld(compound.getInteger("WorldID")); - TileEntity tile = world.getTileEntity(new BlockPos(compound.getInteger("X"), compound.getInteger("Y"), compound.getInteger("Z"))); + public static final IDataHandler GUI_NUMBER_TO_TILE_HANDLER = (compound, context) -> { + World world = DimensionManager.getWorld(compound.getInteger("WorldID")); + TileEntity tile = world.getTileEntity(new BlockPos(compound.getInteger("X"), compound.getInteger("Y"), compound.getInteger("Z"))); - if(tile instanceof IStringReactor){ - IStringReactor reactor = (IStringReactor)tile; - reactor.onTextReceived(compound.getString("Text"), compound.getInteger("TextID"), (EntityPlayer)world.getEntityByID(compound.getInteger("PlayerID"))); - } + if(tile instanceof INumberReactor){ + INumberReactor reactor = (INumberReactor)tile; + reactor.onNumberReceived(compound.getDouble("Number"), compound.getInteger("NumberID"), (EntityPlayer)world.getEntityByID(compound.getInteger("PlayerID"))); + } + }; + public static final IDataHandler GUI_STRING_TO_TILE_HANDLER = (compound, context) -> { + World world = DimensionManager.getWorld(compound.getInteger("WorldID")); + TileEntity tile = world.getTileEntity(new BlockPos(compound.getInteger("X"), compound.getInteger("Y"), compound.getInteger("Z"))); + + if(tile instanceof IStringReactor){ + IStringReactor reactor = (IStringReactor)tile; + reactor.onTextReceived(compound.getString("Text"), compound.getInteger("TextID"), (EntityPlayer)world.getEntityByID(compound.getInteger("PlayerID"))); } }; public static final IDataHandler SYNC_PLAYER_DATA = new IDataHandler(){ @@ -152,38 +140,35 @@ public final class PacketHandler{ } } }; - public static final IDataHandler PLAYER_DATA_TO_SERVER = new IDataHandler(){ - @Override - public void handleData(NBTTagCompound compound, MessageContext context){ - World world = DimensionManager.getWorld(compound.getInteger("World")); - EntityPlayer player = world.getPlayerEntityByUUID(compound.getUniqueId("UUID")); - if(player != null){ - PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); + public static final IDataHandler PLAYER_DATA_TO_SERVER = (compound, context) -> { + World world = DimensionManager.getWorld(compound.getInteger("World")); + EntityPlayer player = world.getPlayerEntityByUUID(compound.getUniqueId("UUID")); + if(player != null){ + PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); - int type = compound.getInteger("Type"); - if(type == 0){ - data.loadBookmarks(compound.getTagList("Bookmarks", 8)); - } - else if(type == 1){ - data.didBookTutorial = compound.getBoolean("DidBookTutorial"); - } - else if(type == 2){ - data.loadTrials(compound.getTagList("Trials", 8)); + int type = compound.getInteger("Type"); + if(type == 0){ + data.loadBookmarks(compound.getTagList("Bookmarks", 8)); + } + else if(type == 1){ + data.didBookTutorial = compound.getBoolean("DidBookTutorial"); + } + else if(type == 2){ + data.loadTrials(compound.getTagList("Trials", 8)); - if(compound.getBoolean("Achievement")){ - //TheAchievements.COMPLETE_TRIALS.get(player); - } - } - WorldData.get(world).markDirty(); - - if(compound.getBoolean("Log")){ - ActuallyAdditions.LOGGER.info("Receiving changed Player Data for player "+player.getName()+"."); + if(compound.getBoolean("Achievement")){ + //TheAchievements.COMPLETE_TRIALS.get(player); } } - else{ - ActuallyAdditions.LOGGER.error("Tried to receive Player Data for UUID "+compound.getUniqueId("UUID")+", but he doesn't seem to be present!"); + WorldData.get(world).markDirty(); + + if(compound.getBoolean("Log")){ + ActuallyAdditions.LOGGER.info("Receiving changed Player Data for player "+player.getName()+"."); } } + else{ + ActuallyAdditions.LOGGER.error("Tried to receive Player Data for UUID "+compound.getUniqueId("UUID")+", but he doesn't seem to be present!"); + } }; public static SimpleNetworkWrapper theNetwork; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java index 21a4a2e44..9b1dfe9e4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java @@ -64,12 +64,9 @@ public class PacketServerToClient implements IMessage{ @Override @SideOnly(Side.CLIENT) public IMessage onMessage(final PacketServerToClient message, final MessageContext ctx){ - Minecraft.getMinecraft().addScheduledTask(new Runnable(){ - @Override - public void run(){ - if(message.data != null && message.handler != null){ - message.handler.handleData(message.data, ctx); - } + Minecraft.getMinecraft().addScheduledTask(() -> { + if(message.data != null && message.handler != null){ + message.handler.handleData(message.data, ctx); } }); return null; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java index d3f4a0bd6..e209446b0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java @@ -72,7 +72,7 @@ public class ParticleLaserItem extends Particle{ GlStateManager.scale(0.3F, 0.3F, 0.3F); double boop = Minecraft.getSystemTime()/600D; - GlStateManager.rotate((float)((boop*40D)%360), 0, 1, 0); + GlStateManager.rotate((float)(boop*40D%360), 0, 1, 0); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_CONSTANT_COLOR, GlStateManager.SourceFactor.ONE.factor, GlStateManager.DestFactor.ZERO.factor); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java index 8e4d21620..99314c012 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java @@ -64,8 +64,8 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; public class ClientProxy implements IProxy{ - private static final List COLOR_PRODIVIDING_ITEMS_FOR_REGISTERING = new ArrayList(); - private static final List COLOR_PRODIVIDING_BLOCKS_FOR_REGISTERING = new ArrayList(); + private static final List COLOR_PRODIVIDING_ITEMS_FOR_REGISTERING = new ArrayList<>(); + private static final List COLOR_PRODIVIDING_BLOCKS_FOR_REGISTERING = new ArrayList<>(); @Override public void preInit(FMLPreInitializationEvent event){ @@ -81,7 +81,7 @@ public class ClientProxy implements IProxy{ ActuallyAdditions.LOGGER.info("Initializing ClientProxy..."); RenderWorm.fixItemStack(); - + new ClientEvents(); //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderCompost()); @@ -113,7 +113,7 @@ public class ClientProxy implements IProxy{ Minecraft.getMinecraft().getItemColors().registerItemColorHandler(((IColorProvidingItem)block).getItemColor(), block); } } - + IBlockColor color = (state, world, pos, tint) -> { if (world != null && pos != null) { TileEntity tileentity = world.getTileEntity(pos); @@ -153,12 +153,12 @@ public class ClientProxy implements IProxy{ public EntityPlayer getCurrentPlayer(){ return Minecraft.getMinecraft().player; } - + @Override public void sendBreakPacket(BlockPos pos) { NetHandlerPlayClient netHandlerPlayClient = Minecraft.getMinecraft().getConnection(); assert netHandlerPlayClient != null; netHandlerPlayClient.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, pos, Minecraft - .getMinecraft().objectMouseOver.sideHit)); + .getMinecraft().objectMouseOver.sideHit)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/IProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/IProxy.java index 4c7ff7ed0..e01d65aac 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/IProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/IProxy.java @@ -35,7 +35,7 @@ public interface IProxy{ void addColoredBlock(Block block); EntityPlayer getCurrentPlayer(); - + default void sendBreakPacket(BlockPos pos) {}; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/ColorLensRotator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/ColorLensRotator.java index e62a4609b..11392da16 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/ColorLensRotator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/ColorLensRotator.java @@ -45,7 +45,7 @@ public class ColorLensRotator implements IColorLensChanger { if (idx == -1) return ItemStack.EMPTY; - ItemStack s = rotations.get((idx + 1) % rotations.size()).copy(); + ItemStack s = this.rotations.get((idx + 1) % this.rotations.size()).copy(); s.setCount(stack.getCount()); return s; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java index 186fd03ba..77866a5f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java @@ -29,7 +29,7 @@ public final class CrusherRecipeRegistry{ public static final ArrayList SEARCH_CASES = new ArrayList<>(); public static void registerFinally(){ - ArrayList oresNoResult = new ArrayList(); + ArrayList oresNoResult = new ArrayList<>(); int recipeStartedAt = ActuallyAdditionsAPI.CRUSHER_RECIPES.size(); for(String ore : OreDictionary.getOreNames()){ @@ -52,7 +52,7 @@ public final class CrusherRecipeRegistry{ } } - ArrayList addedRecipes = new ArrayList(); + ArrayList addedRecipes = new ArrayList<>(); for(int i = recipeStartedAt; i < ActuallyAdditionsAPI.CRUSHER_RECIPES.size(); i++){ CrusherRecipe recipe = ActuallyAdditionsAPI.CRUSHER_RECIPES.get(i); addedRecipes.add(recipe.getInput().getMatchingStacks()+" -> "+recipe.getOutputOne()); @@ -61,7 +61,7 @@ public final class CrusherRecipeRegistry{ ActuallyAdditions.LOGGER.debug("Couldn't add "+oresNoResult.size()+" Crusher Recipes automatically, either because the inputs were missing outputs, or because they exist already: "+oresNoResult); removeDuplicateRecipes(); } - + public static void removeDuplicateRecipes() { ArrayList usable = new ArrayList<>(); ArrayList removed = new ArrayList<>(); @@ -71,15 +71,15 @@ public final class CrusherRecipeRegistry{ else for(CrusherRecipe re : usable) { if(re.getInput().apply(r.getInput().getMatchingStacks()[0])) canUse = false; } - + if(canUse) usable.add(r); else removed.add(r); } - + ActuallyAdditionsAPI.CRUSHER_RECIPES.clear(); ActuallyAdditionsAPI.CRUSHER_RECIPES.addAll(usable); ActuallyAdditions.LOGGER.debug(String.format("Removed %s crusher recipes that had dupliate inputs, %s remain.", removed.size(), usable.size())); - } + } public static boolean hasBlacklistedOutput(ItemStack output, String[] config){ if(StackUtil.isValid(output)){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java index 5f233146e..b8d8c667f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java @@ -31,7 +31,7 @@ import net.minecraftforge.oredict.OreIngredient; public final class EmpowererHandler { - public static final ArrayList MAIN_PAGE_RECIPES = new ArrayList(); + public static final ArrayList MAIN_PAGE_RECIPES = new ArrayList<>(); public static EmpowererRecipe recipeEmpoweredCanolaSeed; public static void init() { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java index cf71abbbb..066839441 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java @@ -18,18 +18,18 @@ import net.minecraft.util.math.BlockPos; public class EnchBookConversion extends LensConversionRecipe { - public EnchBookConversion() { - super(Ingredient.fromItem(Items.ENCHANTED_BOOK), ItemStack.EMPTY, 155000, ActuallyAdditionsAPI.lensDefaultConversion); - } - - @Override - public void transformHook(ItemStack stack, IBlockState state, BlockPos pos, IAtomicReconstructor tile) { - for(Map.Entry e : EnchantmentHelper.getEnchantments(stack).entrySet()) { - ItemStack book = new ItemStack(Items.ENCHANTED_BOOK); - Map ench = ImmutableMap.of(e.getKey(), e.getValue()); - EnchantmentHelper.setEnchantments(ench, book); - Block.spawnAsEntity(tile.getWorldObject(), pos, book); - } - } + public EnchBookConversion() { + super(Ingredient.fromItem(Items.ENCHANTED_BOOK), ItemStack.EMPTY, 155000, ActuallyAdditionsAPI.lensDefaultConversion); + } + + @Override + public void transformHook(ItemStack stack, IBlockState state, BlockPos pos, IAtomicReconstructor tile) { + for(Map.Entry e : EnchantmentHelper.getEnchantments(stack).entrySet()) { + ItemStack book = new ItemStack(Items.ENCHANTED_BOOK); + Map ench = ImmutableMap.of(e.getKey(), e.getValue()); + EnchantmentHelper.setEnchantments(ench, book); + Block.spawnAsEntity(tile.getWorldObject(), pos, book); + } + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java index 54f722487..cc7445626 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java @@ -38,9 +38,9 @@ public class CustomEnergyStorage extends EnergyStorage{ this.maxReceive = before; return toReturn; } - + public void addEnergyRaw(int energy){ - this.energy = Math.min(this.energy + energy, this.capacity); + this.energy = Math.min(this.energy + energy, this.capacity); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index 7eb6e947f..a55a04711 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -43,7 +43,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple super(1, "reconstructor"); int power = ConfigIntValues.RECONSTRUCTOR_POWER.getValue(); int recieve = MathHelper.ceil(power * 0.016666F); - storage = new CustomEnergyStorage(power, recieve, 0); + this.storage = new CustomEnergyStorage(power, recieve, 0); } public static void shootLaser(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, Lens currentLens) { @@ -93,7 +93,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { this.oldEnergy = this.storage.getEnergyStored(); - this.world.updateComparatorOutputLevel(pos, InitBlocks.blockAtomicReconstructor); + this.world.updateComparatorOutputLevel(this.pos, InitBlocks.blockAtomicReconstructor); } } @@ -101,7 +101,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple @Override public Lens getLens() { - Item item = inv.getStackInSlot(0).getItem(); + Item item = this.inv.getStackInSlot(0).getItem(); if (item instanceof ILensItem) return ((ILensItem) item).getLens(); return this.counter >= 500 ? ActuallyAdditionsAPI.lensDisruption : ActuallyAdditionsAPI.lensDefaultConversion; } 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 bb9c4dcbf..8b5880a53 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -157,10 +157,10 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ public final void handleUpdateTag(NBTTagCompound compound){ this.readSyncableNBT(compound, NBTType.SYNC); } - + public final void sendUpdate(){ - if(world != null && !world.isRemote) VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this); - /* + if(this.world != null && !this.world.isRemote) VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this); + /* if(this.world != null && !this.world.isRemote){ NBTTagCompound compound = new NBTTagCompound(); this.writeSyncableNBT(compound, NBTType.SYNC); @@ -182,7 +182,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ compound.setInteger("TicksElapsed", this.ticksElapsed); compound.setBoolean("StopDrop", this.stopFromDropping); } - else if(type == NBTType.SYNC && stopFromDropping) compound.setBoolean("StopDrop", this.stopFromDropping); + else if(type == NBTType.SYNC && this.stopFromDropping) compound.setBoolean("StopDrop", this.stopFromDropping); if(this.isRedstoneToggle() && (type != NBTType.SAVE_BLOCK || this.isPulseMode)){ compound.setBoolean("IsPulseMode", this.isPulseMode); @@ -226,7 +226,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ public int getComparatorStrength(){ return 0; } - + private boolean shareEnergy = this instanceof ISharingEnergyProvider; private boolean shareFluid = this instanceof ISharingFluidHandler; @@ -234,7 +234,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ this.ticksElapsed++; if(!this.world.isRemote){ - if(shareEnergy){ + if(this.shareEnergy){ ISharingEnergyProvider provider = (ISharingEnergyProvider)this; if(provider.doesShareEnergy()){ int total = provider.getEnergyToSplitShare(); @@ -256,7 +256,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ } } - if(shareFluid){ + if(this.shareFluid){ ISharingFluidHandler handler = (ISharingFluidHandler)this; if(handler.doesShareFluid()){ int total = handler.getMaxFluidAmountToSplitShare(); @@ -326,7 +326,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ } @SuppressWarnings("unchecked") - @Override + @Override public T getCapability(Capability capability, EnumFacing facing){ if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){ IItemHandler handler = this.getItemHandler(facing); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java index ee025aeb9..3494456cb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java @@ -55,7 +55,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh ItemStack stack = this.inv.getStackInSlot(0); if(StackUtil.isValid(stack) && ItemUtil.isEnabled(stack)){ if(storage.getEnergyStored() > 0){ - List tiles = new ArrayList(); + List tiles = new ArrayList<>(); this.energyPushOffLoop(this, tiles); if(!tiles.isEmpty()){ @@ -105,7 +105,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh public int getComparatorStrength(){ IEnergyStorage storage = this.getEnergyStorage(null); if(storage != null){ - float calc = ((float)storage.getEnergyStored()/(float)storage.getMaxEnergyStored())*15F; + float calc = (float)storage.getEnergyStored()/(float)storage.getMaxEnergyStored()*15F; return (int)calc; } else{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java index 6337603c4..73491a29b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java @@ -72,7 +72,7 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements ISh Item item = stack.getItem(); if (isValidItem(stack) && (types == null || !types.contains(item))) { if (types == null) { - types = new ArrayList(); + types = new ArrayList<>(); } types.add(item); @@ -163,7 +163,7 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements ISh @Override public int getComparatorStrength() { - float calc = ((float) this.storage.getEnergyStored() / (float) this.storage.getMaxEnergyStored()) * 15F; + float calc = (float) this.storage.getEnergyStored() / (float) this.storage.getMaxEnergyStored() * 15F; return (int) calc; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java index 39ea3d00a..a9fd40a22 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java @@ -77,27 +77,27 @@ public class TileEntityBreaker extends TileEntityInventoryBase { } private void doWork() { - EnumFacing side = WorldUtil.getDirectionByPistonRotation(world.getBlockState(pos)); - BlockPos breakCoords = pos.offset(side); - IBlockState stateToBreak = world.getBlockState(breakCoords); + EnumFacing side = WorldUtil.getDirectionByPistonRotation(this.world.getBlockState(this.pos)); + BlockPos breakCoords = this.pos.offset(side); + IBlockState stateToBreak = this.world.getBlockState(breakCoords); Block blockToBreak = stateToBreak.getBlock(); if (!this.isPlacer && blockToBreak != Blocks.AIR && !(blockToBreak instanceof BlockLiquid) && !(blockToBreak instanceof IFluidBlock) && stateToBreak.getBlockHardness(this.world, breakCoords) >= 0.0F) { NonNullList drops = NonNullList.create(); - blockToBreak.getDrops(drops, world, breakCoords, stateToBreak, 0); - float chance = WorldUtil.fireFakeHarvestEventsForDropChance(drops, world, breakCoords); + blockToBreak.getDrops(drops, this.world, breakCoords, stateToBreak, 0); + float chance = WorldUtil.fireFakeHarvestEventsForDropChance(drops, this.world, breakCoords); - if (chance > 0 && world.rand.nextFloat() <= chance) { - if (StackUtil.canAddAll(inv, drops, false)) { - world.destroyBlock(breakCoords, false); - StackUtil.addAll(inv, drops, false); + if (chance > 0 && this.world.rand.nextFloat() <= chance) { + if (StackUtil.canAddAll(this.inv, drops, false)) { + this.world.destroyBlock(breakCoords, false); + StackUtil.addAll(this.inv, drops, false); this.markDirty(); } } } else if (this.isPlacer) { - int slot = StackUtil.findFirstFilled(inv); + int slot = StackUtil.findFirstFilled(this.inv); if (slot == -1) return; - this.inv.setStackInSlot(slot, WorldUtil.useItemAtSide(side, world, pos, inv.getStackInSlot(slot))); + this.inv.setStackInSlot(slot, WorldUtil.useItemAtSide(side, this.world, this.pos, this.inv.getStackInSlot(slot))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java index 12adb463e..ec9a1839f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java @@ -86,7 +86,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IS public void updateEntity() { super.updateEntity(); if (!this.world.isRemote) { - if (isCanola(inv.getStackInSlot(0)) && PRODUCE <= this.tank.getCapacity() - this.tank.getFluidAmount()) { + if (isCanola(this.inv.getStackInSlot(0)) && PRODUCE <= this.tank.getCapacity() - this.tank.getFluidAmount()) { if (this.storage.getEnergyStored() >= ENERGY_USE) { this.currentProcessTime++; this.storage.extractEnergyInternal(ENERGY_USE, false); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java index b900fdbb5..0f95e3517 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java @@ -24,131 +24,131 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityCoalGenerator extends TileEntityInventoryBase implements ISharingEnergyProvider { - public static final int PRODUCE = 30; - public final CustomEnergyStorage storage = new CustomEnergyStorage(60000, 0, 80); - public int maxBurnTime; - public int currentBurnTime; - private int lastEnergy; - private int lastBurnTime; - private int lastCurrentBurnTime; - private int lastCompare; - private ItemStack curStack = ItemStack.EMPTY; - private int curBurn = -1; + public static final int PRODUCE = 30; + public final CustomEnergyStorage storage = new CustomEnergyStorage(60000, 0, 80); + public int maxBurnTime; + public int currentBurnTime; + private int lastEnergy; + private int lastBurnTime; + private int lastCurrentBurnTime; + private int lastCompare; + private ItemStack curStack = ItemStack.EMPTY; + private int curBurn = -1; - public TileEntityCoalGenerator() { - super(1, "coalGenerator"); - } + public TileEntityCoalGenerator() { + super(1, "coalGenerator"); + } - @SideOnly(Side.CLIENT) - public int getEnergyScaled(int i) { - return this.storage.getEnergyStored() * i / this.storage.getMaxEnergyStored(); - } + @SideOnly(Side.CLIENT) + public int getEnergyScaled(int i) { + return this.storage.getEnergyStored() * i / this.storage.getMaxEnergyStored(); + } - @SideOnly(Side.CLIENT) - public int getBurningScaled(int i) { - return this.currentBurnTime * i / this.maxBurnTime; - } + @SideOnly(Side.CLIENT) + public int getBurningScaled(int i) { + return this.currentBurnTime * i / this.maxBurnTime; + } - @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { - if (type != NBTType.SAVE_BLOCK) { - compound.setInteger("BurnTime", this.currentBurnTime); - compound.setInteger("MaxBurnTime", this.maxBurnTime); - } - this.storage.writeToNBT(compound); - super.writeSyncableNBT(compound, type); - } + @Override + public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + if (type != NBTType.SAVE_BLOCK) { + compound.setInteger("BurnTime", this.currentBurnTime); + compound.setInteger("MaxBurnTime", this.maxBurnTime); + } + this.storage.writeToNBT(compound); + super.writeSyncableNBT(compound, type); + } - @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { - if (type != NBTType.SAVE_BLOCK) { - this.currentBurnTime = compound.getInteger("BurnTime"); - this.maxBurnTime = compound.getInteger("MaxBurnTime"); - } - this.storage.readFromNBT(compound); - super.readSyncableNBT(compound, type); - } + @Override + public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + if (type != NBTType.SAVE_BLOCK) { + this.currentBurnTime = compound.getInteger("BurnTime"); + this.maxBurnTime = compound.getInteger("MaxBurnTime"); + } + this.storage.readFromNBT(compound); + super.readSyncableNBT(compound, type); + } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.world.isRemote) { - boolean flag = this.currentBurnTime > 0; + @Override + public void updateEntity() { + super.updateEntity(); + if (!this.world.isRemote) { + boolean flag = this.currentBurnTime > 0; - if (this.currentBurnTime > 0) { - this.currentBurnTime--; - this.storage.addEnergyRaw(PRODUCE); - } + if (this.currentBurnTime > 0) { + this.currentBurnTime--; + this.storage.addEnergyRaw(PRODUCE); + } - ItemStack stack = inv.getStackInSlot(0); - if (!stack.isEmpty() && stack != curStack) { - curStack = stack; - curBurn = TileEntityFurnace.getItemBurnTime(stack); - } else if (stack.isEmpty()) { - curStack = ItemStack.EMPTY; - curBurn = -1; - } + ItemStack stack = this.inv.getStackInSlot(0); + if (!stack.isEmpty() && stack != this.curStack) { + this.curStack = stack; + this.curBurn = TileEntityFurnace.getItemBurnTime(stack); + } else if (stack.isEmpty()) { + this.curStack = ItemStack.EMPTY; + this.curBurn = -1; + } - if (!this.isRedstonePowered && this.currentBurnTime <= 0 && curBurn > 0 && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored()) { - this.maxBurnTime = curBurn; - this.currentBurnTime = curBurn; - inv.setStackInSlot(0, StackUtil.shrinkForContainer(stack, 1)); - } + if (!this.isRedstonePowered && this.currentBurnTime <= 0 && this.curBurn > 0 && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored()) { + this.maxBurnTime = this.curBurn; + this.currentBurnTime = this.curBurn; + this.inv.setStackInSlot(0, StackUtil.shrinkForContainer(stack, 1)); + } - if (flag != this.currentBurnTime > 0 || this.lastCompare != this.getComparatorStrength()) { - this.lastCompare = this.getComparatorStrength(); - this.markDirty(); - } + if (flag != this.currentBurnTime > 0 || this.lastCompare != this.getComparatorStrength()) { + this.lastCompare = this.getComparatorStrength(); + this.markDirty(); + } - if ((this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime) && this.sendUpdateWithInterval()) { - this.lastEnergy = this.storage.getEnergyStored(); - this.lastCurrentBurnTime = this.currentBurnTime; - this.lastBurnTime = this.currentBurnTime; - } - } - } + if ((this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime) && this.sendUpdateWithInterval()) { + this.lastEnergy = this.storage.getEnergyStored(); + this.lastCurrentBurnTime = this.currentBurnTime; + this.lastBurnTime = this.currentBurnTime; + } + } + } - @Override - public int getComparatorStrength() { - float calc = ((float) this.storage.getEnergyStored() / (float) this.storage.getMaxEnergyStored()) * 15F; - return (int) calc; - } + @Override + public int getComparatorStrength() { + float calc = (float) this.storage.getEnergyStored() / (float) this.storage.getMaxEnergyStored() * 15F; + return (int) calc; + } - @Override - public IAcceptor getAcceptor() { - return (slot, stack, automation) -> TileEntityFurnace.getItemBurnTime(stack) > 0; - } + @Override + public IAcceptor getAcceptor() { + return (slot, stack, automation) -> TileEntityFurnace.getItemBurnTime(stack) > 0; + } - @Override - public IRemover getRemover() { - return (slot, automation) -> { - if (!automation) return true; - return TileEntityFurnace.getItemBurnTime(this.inv.getStackInSlot(0)) <= 0; - }; - } + @Override + public IRemover getRemover() { + return (slot, automation) -> { + if (!automation) return true; + return TileEntityFurnace.getItemBurnTime(this.inv.getStackInSlot(0)) <= 0; + }; + } - @Override - public int getEnergyToSplitShare() { - return this.storage.getEnergyStored(); - } + @Override + public int getEnergyToSplitShare() { + return this.storage.getEnergyStored(); + } - @Override - public boolean doesShareEnergy() { - return true; - } + @Override + public boolean doesShareEnergy() { + return true; + } - @Override - public EnumFacing[] getEnergyShareSides() { - return EnumFacing.values(); - } + @Override + public EnumFacing[] getEnergyShareSides() { + return EnumFacing.values(); + } - @Override - public boolean canShareTo(TileEntity tile) { - return true; - } + @Override + public boolean canShareTo(TileEntity tile) { + return true; + } - @Override - public IEnergyStorage getEnergyStorage(EnumFacing facing) { - return this.storage; - } + @Override + public IEnergyStorage getEnergyStorage(EnumFacing facing) { + return this.storage; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java index 1d51e010f..758adebed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java @@ -128,12 +128,12 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements @Override public IAcceptor getAcceptor() { - return (slot, stack, automation) -> !automation || (slot >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (slot == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (slot == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()); + return (slot, stack, automation) -> !automation || slot >= 3 && ItemCoffee.getIngredientFromStack(stack) != null || slot == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean || slot == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal(); } @Override public IRemover getRemover() { - return (slot, automation) -> !automation || slot == SLOT_OUTPUT || (slot >= 3 && slot < this.inv.getSlots() && ItemCoffee.getIngredientFromStack(inv.getStackInSlot(slot)) == null); + return (slot, automation) -> !automation || slot == SLOT_OUTPUT || slot >= 3 && slot < this.inv.getSlots() && ItemCoffee.getIngredientFromStack(this.inv.getStackInSlot(slot)) == null; } public void storeCoffee() { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java index f87b5d002..802bcd961 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java @@ -68,13 +68,13 @@ public class TileEntityCompost extends TileEntityInventoryBase { super.updateEntity(); if (!this.world.isRemote) { boolean theFlag = this.conversionTime > 0; - ItemStack input = inv.getStackInSlot(0); + ItemStack input = this.inv.getStackInSlot(0); if (StackUtil.isValid(input)) { - if (recipe == null || !recipe.matches(input)) recipe = getRecipeForInput(input); - if (recipe != null) { + if (this.recipe == null || !this.recipe.matches(input)) this.recipe = getRecipeForInput(input); + if (this.recipe != null) { this.conversionTime++; if (this.conversionTime >= COMPOST_TIME_TICKS) { - ItemStack output = recipe.getOutput().copy(); + ItemStack output = this.recipe.getOutput().copy(); output.setCount(input.getCount()); this.inv.setStackInSlot(0, output); this.conversionTime = 0; @@ -98,12 +98,12 @@ public class TileEntityCompost extends TileEntityInventoryBase { @Override public IRemover getRemover() { - return (slot, automation) -> getRecipeForInput(inv.getStackInSlot(slot)) == null; + return (slot, automation) -> getRecipeForInput(this.inv.getStackInSlot(slot)) == null; } public IBlockState getCurrentDisplay() { - ItemStack input = inv.getStackInSlot(0); - CompostRecipe displayRecipe = recipe; + ItemStack input = this.inv.getStackInSlot(0); + CompostRecipe displayRecipe = this.recipe; if (displayRecipe == null || !displayRecipe.matches(input)) displayRecipe = getRecipeForInput(input); if (displayRecipe == null) for (CompostRecipe r : ActuallyAdditionsAPI.COMPOST_RECIPES) { @@ -116,7 +116,7 @@ public class TileEntityCompost extends TileEntityInventoryBase { } public float getHeight() { - ItemStack input = inv.getStackInSlot(0); + ItemStack input = this.inv.getStackInSlot(0); if (input.isEmpty()) return 0; return (float) input.getCount() / input.getMaxStackSize(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java index bc9b5a8db..b5a547a34 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java @@ -80,11 +80,11 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase { for (int i = 0; i < RANGE; i++) { BlockPos coordsBlock = this.pos.offset(sideToManipulate, i + 1); - IBlockState breakState = world.getBlockState(coordsBlock); + IBlockState breakState = this.world.getBlockState(coordsBlock); Block blockToBreak = breakState.getBlock(); if (blockToBreak != null && !this.world.isAirBlock(coordsBlock) && this.world.getBlockState(coordsBlock).getBlockHardness(this.world, coordsBlock) > -1.0F) { NonNullList drops = NonNullList.create(); - blockToBreak.getDrops(drops, world, coordsBlock, breakState, 0); + blockToBreak.getDrops(drops, this.world, coordsBlock, breakState, 0); float chance = WorldUtil.fireFakeHarvestEventsForDropChance(drops, this.world, coordsBlock); if (chance > 0 && this.world.rand.nextFloat() <= chance) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java index 336a76395..bf31ae601 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java @@ -101,7 +101,7 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I public IEnergyStorage getEnergyStorage(EnumFacing facing){ return this.storage; } - + public ItemStack getStack() { return this.inv.getStackInSlot(0); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java index 12a3ccb21..eb26f6380 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java @@ -66,7 +66,7 @@ public class TileEntityDropper extends TileEntityInventoryBase{ ItemStack drop = theoreticalRemove.copy(); drop.setCount(1); WorldUtil.dropItemAtSide(WorldUtil.getDirectionByPistonRotation(state), this.world, this.pos, drop); - this.removeFromInventory(true); + this.removeFromInventory(true); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java index 83daf8c16..2c9d1144f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java @@ -40,7 +40,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { @Deprecated //Use findMatchingRecipe public static List getRecipesForInput(ItemStack input) { - List recipesThatWork = new ArrayList(); + List recipesThatWork = new ArrayList<>(); if (StackUtil.isValid(input)) { for (EmpowererRecipe recipe : ActuallyAdditionsAPI.EMPOWERER_RECIPES) { if (recipe.getInput().apply(input)) { @@ -171,7 +171,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { @Override public IRemover getRemover() { - return (slot, automation) -> !automation || !isPossibleInput(inv.getStackInSlot(0)); + return (slot, automation) -> !automation || !isPossibleInput(this.inv.getStackInSlot(0)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java index 31e8e1f76..af2afe57e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java @@ -75,12 +75,12 @@ public class TileEntityEnergizer extends TileEntityInventoryBase { @Override public IAcceptor getAcceptor() { - return (slot, stack, automation) -> !automation || (slot == 0 && (stack.hasCapability(CapabilityEnergy.ENERGY, null))); + return (slot, stack, automation) -> !automation || slot == 0 && stack.hasCapability(CapabilityEnergy.ENERGY, null); } @Override public IRemover getRemover() { - return (slot, automation) -> !EnchantmentHelper.hasBindingCurse(inv.getStackInSlot(slot)) && !automation || (slot == 1); + return (slot, automation) -> !EnchantmentHelper.hasBindingCurse(this.inv.getStackInSlot(slot)) && !automation || slot == 1; } public int getEnergyScaled(int i) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java index 4f3eb061f..dee07658c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java @@ -76,7 +76,7 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements ISha @Override public IAcceptor getAcceptor() { - return (slot, stack, automation) -> !automation || (slot == 0 && (stack.hasCapability(CapabilityEnergy.ENERGY, null))); + return (slot, stack, automation) -> !automation || slot == 0 && stack.hasCapability(CapabilityEnergy.ENERGY, null); } @Override 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 0e8232656..d41c5b6cf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java @@ -129,8 +129,8 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer if (harvestResult == FarmerResult.STOP_PROCESSING) return; for (int i = 0; i < 6; i++) { //Process seed slots only ItemStack stack = this.inv.getStackInSlot(i); - IBlockState state = world.getBlockState(query); - if (StackUtil.isValid(stack) && state.getBlock().isReplaceable(world, query)) { + IBlockState state = this.world.getBlockState(query); + if (StackUtil.isValid(stack) && state.getBlock().isReplaceable(this.world, query)) { FarmerResult plantResult = behavior.tryPlantSeed(stack, this.world, query, this); if (plantResult == FarmerResult.SUCCESS) { this.inv.getStackInSlot(i).shrink(1); @@ -200,21 +200,21 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer @Override public boolean canAddToSeeds(List stacks) { - return StackUtil.canAddAll(inv, stacks, 0, 6, false); + return StackUtil.canAddAll(this.inv, stacks, 0, 6, false); } @Override public boolean canAddToOutput(List stacks) { - return StackUtil.canAddAll(inv, stacks, 6, 12, false); + return StackUtil.canAddAll(this.inv, stacks, 6, 12, false); } @Override public void addToSeeds(List stacks) { - StackUtil.addAll(inv, stacks, 0, 6, false); + StackUtil.addAll(this.inv, stacks, 0, 6, false); } @Override public void addToOutput(List stacks) { - StackUtil.addAll(inv, stacks, 6, 12, false); + StackUtil.addAll(this.inv, stacks, 6, 12, false); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java index 47e80ccb7..b43499b00 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java @@ -62,20 +62,20 @@ public class TileEntityFeeder extends TileEntityInventoryBase { @Override public void updateEntity() { super.updateEntity(); - currentTimer = MathHelper.clamp(++currentTimer, 0, 100); - if (world.isRemote) return; + this.currentTimer = MathHelper.clamp(++this.currentTimer, 0, 100); + if (this.world.isRemote) return; int range = 5; ItemStack stack = this.inv.getStackInSlot(0); if (!stack.isEmpty() && this.currentTimer >= TIME) { List animals = this.world.getEntitiesWithinAABB(EntityAnimal.class, new AxisAlignedBB(this.pos.getX() - range, this.pos.getY() - range, this.pos.getZ() - range, this.pos.getX() + range, this.pos.getY() + range, this.pos.getZ() + range)); this.currentAnimalAmount = animals.size(); - if (currentAnimalAmount >= 2 && currentAnimalAmount < THRESHOLD) { + if (this.currentAnimalAmount >= 2 && this.currentAnimalAmount < THRESHOLD) { Optional opt = animals.stream().filter((e) -> canBeFed(stack, e)).findAny(); if (opt.isPresent()) { feedAnimal(opt.get()); stack.shrink(1); this.currentTimer = 0; - markDirty(); + this.markDirty(); } } } @@ -96,14 +96,14 @@ public class TileEntityFeeder extends TileEntityInventoryBase { double d = animal.world.rand.nextGaussian() * 0.02D; double d1 = animal.world.rand.nextGaussian() * 0.02D; double d2 = animal.world.rand.nextGaussian() * 0.02D; - animal.world.spawnParticle(EnumParticleTypes.HEART, (animal.posX + (double) (animal.world.rand.nextFloat() * animal.width * 2.0F)) - animal.width, animal.posY + 0.5D + (double) (animal.world.rand.nextFloat() * animal.height), (animal.posZ + (double) (animal.world.rand.nextFloat() * animal.width * 2.0F)) - animal.width, d, d1, d2); + animal.world.spawnParticle(EnumParticleTypes.HEART, animal.posX + animal.world.rand.nextFloat() * animal.width * 2.0F - animal.width, animal.posY + 0.5D + animal.world.rand.nextFloat() * animal.height, animal.posZ + animal.world.rand.nextFloat() * animal.width * 2.0F - animal.width, d, d1, d2); } } private static boolean canBeFed(ItemStack stack, EntityAnimal animal) { if (animal instanceof EntityHorse && ((EntityHorse) animal).isTame()) { Item item = stack.getItem(); - return (animal.getGrowingAge() == 0 && !animal.isInLove()) && (item == Items.GOLDEN_APPLE || item == Items.GOLDEN_CARROT); + return animal.getGrowingAge() == 0 && !animal.isInLove() && (item == Items.GOLDEN_APPLE || item == Items.GOLDEN_CARROT); } return animal.getGrowingAge() == 0 && !animal.isInLove() && animal.isBreedingItem(stack); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java index 8e9c22033..9bcd9ea19 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java @@ -113,7 +113,7 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari @Override public int getComparatorStrength(){ - float calc = ((float)this.oilTank.getFluidAmount()/(float)this.oilTank.getCapacity())*15F; + float calc = (float)this.oilTank.getFluidAmount()/(float)this.oilTank.getCapacity()*15F; return (int)calc; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java index 748f3c4ce..cde1c0b27 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java @@ -96,42 +96,42 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp @Override public void onNumberReceived(double number, int id, EntityPlayer player){ switch(id){ - case 0: - this.intValuePlay = (int)number; - break; - case 1: - this.chargeAmount = (int)number; - break; - case 2: - this.flightTime = (int)number; - break; - case 3: - this.trailOrFlickerChance = (float)number; - break; - case 4: - this.flickerChance = (float)number; - break; - case 5: - this.colorAmount = (int)number; - break; - case 6: - this.typeChance0 = (float)number; - break; - case 7: - this.typeChance1 = (float)number; - break; - case 8: - this.typeChance2 = (float)number; - break; - case 9: - this.typeChance3 = (float)number; - break; - case 10: - this.typeChance4 = (float)number; - break; - case 11: - this.areaOfEffect = (int)number; - break; + case 0: + this.intValuePlay = (int)number; + break; + case 1: + this.chargeAmount = (int)number; + break; + case 2: + this.flightTime = (int)number; + break; + case 3: + this.trailOrFlickerChance = (float)number; + break; + case 4: + this.flickerChance = (float)number; + break; + case 5: + this.colorAmount = (int)number; + break; + case 6: + this.typeChance0 = (float)number; + break; + case 7: + this.typeChance1 = (float)number; + break; + case 8: + this.typeChance2 = (float)number; + break; + case 9: + this.typeChance3 = (float)number; + break; + case 10: + this.typeChance4 = (float)number; + break; + case 11: + this.areaOfEffect = (int)number; + break; } this.sendUpdate(); @@ -205,7 +205,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp } private int getRandomType(){ - List possible = new ArrayList(); + List possible = new ArrayList<>(); possible.add(new WeightedFireworkType(0, this.typeChance0)); possible.add(new WeightedFireworkType(1, this.typeChance1)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java index 2e141dafc..47befd07c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java @@ -108,7 +108,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing if(this.world instanceof WorldServer){ for(int l = 0; l < 8; ++l){ - ((WorldServer)this.world).spawnParticle(EnumParticleTypes.SMOKE_LARGE, false, (double)offsetPos.getX()+Math.random(), (double)offsetPos.getY()+Math.random(), (double)offsetPos.getZ()+Math.random(), 1, 0.0D, 0.0D, 0.0D, 0); + ((WorldServer)this.world).spawnParticle(EnumParticleTypes.SMOKE_LARGE, false, offsetPos.getX()+Math.random(), offsetPos.getY()+Math.random(), offsetPos.getZ()+Math.random(), 1, 0.0D, 0.0D, 0.0D, 0); } } } @@ -123,7 +123,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing @Override public int getComparatorStrength(){ - float calc = ((float)this.tank.getFluidAmount()/(float)this.tank.getCapacity())*15F; + float calc = (float)this.tank.getFluidAmount()/(float)this.tank.getCapacity()*15F; return (int)calc; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java index 4a270b7dc..083c9065d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java @@ -59,7 +59,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements toSplit = first; } else if (ItemUtil.canBeStacked(first, second)) { if (first.getCount() < first.getMaxStackSize() || second.getCount() < second.getMaxStackSize()) { - if (!((first.getCount() <= second.getCount() + 1 && first.getCount() >= second.getCount() - 1) || (second.getCount() <= first.getCount() + 1 && second.getCount() >= first.getCount() - 1))) { + if (!(first.getCount() <= second.getCount() + 1 && first.getCount() >= second.getCount() - 1 || second.getCount() <= first.getCount() + 1 && second.getCount() >= first.getCount() - 1)) { toSplit = first; toSplit.grow(second.getCount()); } @@ -158,19 +158,19 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements @Override public IAcceptor getAcceptor() { - return (slot, stack, automation) -> !automation || ((slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && StackUtil.isValid(FurnaceRecipes.instance().getSmeltingResult(stack))); + return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && StackUtil.isValid(FurnaceRecipes.instance().getSmeltingResult(stack)); } @Override public IRemover getRemover() { - return (slot, automation) -> !automation || (slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2); + return (slot, automation) -> !automation || slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2; } public boolean canSmeltOn(int theInput, int theOutput) { if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) { ItemStack output = FurnaceRecipes.instance().getSmeltingResult(this.inv.getStackInSlot(theInput)); if (StackUtil.isValid(output)) { - if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || (this.inv.getStackInSlot(theOutput).isItemEqual(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount())) { return true; } + if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).isItemEqual(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) { return true; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGiantChest.java index 44cdc0aab..7699eaadf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGiantChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGiantChest.java @@ -86,7 +86,7 @@ public class TileEntityGiantChest extends TileEntityInventoryBase implements IBu if(player != null){ builder.withLuck(player.getLuck()); } - AwfulUtil.fillInventory(table, this.inv, world.rand, builder.build()); + AwfulUtil.fillInventory(table, this.inv, this.world.rand, builder.build()); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java index 8a6a0b2e1..b04b106c8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java @@ -108,7 +108,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } this.storage.extractEnergyInternal(ENERGY_USE, false); } - crushed = storage.getEnergyStored() >= ENERGY_USE; + crushed = this.storage.getEnergyStored() >= ENERGY_USE; } else { this.firstCrushTime = 0; } @@ -126,7 +126,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } this.storage.extractEnergyInternal(ENERGY_USE, false); } - crushed = storage.getEnergyStored() >= ENERGY_USE; + crushed = this.storage.getEnergyStored() >= ENERGY_USE; } else { this.secondCrushTime = 0; } @@ -156,17 +156,17 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto @Override public IAcceptor getAcceptor() { - return (slot, stack, automation) -> !automation || ((slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null); + return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null; } @Override public IRemover getRemover() { - return (slot, automation) -> !automation || (slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2); + return (slot, automation) -> !automation || slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2; } public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput) { if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) { - CrusherRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(inv.getStackInSlot(theInput)); + CrusherRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput)); if (recipe == null) return false; ItemStack outputOne = recipe.getOutputOne(); ItemStack outputTwo = recipe.getOutputTwo(); @@ -177,7 +177,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto if (StackUtil.isValid(outputTwo) && outputTwo.getItemDamage() == Util.WILDCARD) { outputTwo.setItemDamage(0); } - if ((!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput)) || (this.inv.getStackInSlot(theFirstOutput).isItemEqual(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount())) && (!StackUtil.isValid(outputTwo) || (!StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput)) || (this.inv.getStackInSlot(theSecondOutput).isItemEqual(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount())))) { return true; } + if ((!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput)) || this.inv.getStackInSlot(theFirstOutput).isItemEqual(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount()) && (!StackUtil.isValid(outputTwo) || !StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput)) || this.inv.getStackInSlot(theSecondOutput).isItemEqual(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount())) { return true; } } } return false; @@ -188,7 +188,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput) { - CrusherRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(inv.getStackInSlot(theInput)); + CrusherRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput)); if (recipe == null) return; ItemStack outputOne = recipe.getOutputOne(); if (StackUtil.isValid(outputOne)) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java index 905fcc7f5..9a82be61d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java @@ -59,13 +59,13 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE public void updateEntity(){ super.updateEntity(); if(!this.world.isRemote){ - ArrayList blocksAround = new ArrayList(); + ArrayList blocksAround = new ArrayList<>(); if(ENERGY_PRODUCE <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){ for(int i = 1; i <= 5; i++){ BlockPos coords = this.pos.offset(WorldUtil.getDirectionBySidesInOrder(i)); IBlockState state = this.world.getBlockState(coords); Block block = state.getBlock(); - if(block != null && (this.world.getBlockState(coords).getMaterial() == Material.LAVA && block.getMetaFromState(state) == 0) || this.world.getBlockState(coords).getBlock() instanceof BlockMagma){ + if(block != null && this.world.getBlockState(coords).getMaterial() == Material.LAVA && block.getMetaFromState(state) == 0 || this.world.getBlockState(coords).getBlock() instanceof BlockMagma){ blocksAround.add(i); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java index aaabdbbb2..795adc1b3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java @@ -39,11 +39,11 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt public int sideToPut = -1; public int slotToPutStart; public int slotToPutEnd; - public Map placeToPut = new ConcurrentHashMap(); + public Map placeToPut = new ConcurrentHashMap<>(); public int sideToPull = -1; public int slotToPullStart; public int slotToPullEnd; - public Map placeToPull = new ConcurrentHashMap(); + public Map placeToPull = new ConcurrentHashMap<>(); public boolean isAdvanced; public FilterSettings leftFilter = new FilterSettings(12, true, true, false, false, 0, -1000); public FilterSettings rightFilter = new FilterSettings(12, true, true, false, false, 0, -2000); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java index 9148f874e..730b3defc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java @@ -28,7 +28,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { public TileEntityInventoryBase(int slots, String name) { super(name); - inv = new TileStackHandler(slots); + this.inv = new TileStackHandler(slots); } public static void saveSlots(IItemHandler slots, NBTTagCompound compound) { @@ -59,7 +59,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { @Override public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { super.writeSyncableNBT(compound, type); - if (type == NBTType.SAVE_TILE || (type == NBTType.SYNC && this.shouldSyncSlots())) { + if (type == NBTType.SAVE_TILE || type == NBTType.SYNC && this.shouldSyncSlots()) { saveSlots(this.inv, compound); } } @@ -102,7 +102,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { @Override public void readSyncableNBT(NBTTagCompound compound, NBTType type) { super.readSyncableNBT(compound, type); - if (type == NBTType.SAVE_TILE || (type == NBTType.SYNC && this.shouldSyncSlots())) { + if (type == NBTType.SAVE_TILE || type == NBTType.SYNC && this.shouldSyncSlots()) { loadSlots(this.inv, compound); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java index 8133aae0b..5ce6689a4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java @@ -34,9 +34,9 @@ import java.util.*; public class TileEntityItemViewer extends TileEntityBase{ - public final List genericInfos = new ArrayList(); - public final Map itemHandlerInfos = new HashMap(); - public final List slotlessInfos = new ArrayList(); + public final List genericInfos = new ArrayList<>(); + public final Map itemHandlerInfos = new HashMap<>(); + public final List slotlessInfos = new ArrayList<>(); protected final SlotlessableItemHandlerWrapper itemHandler; public TileEntityLaserRelayItem connectedRelay; private int lastNetworkChangeAmount = -1; @@ -134,7 +134,7 @@ public class TileEntityItemViewer extends TileEntityBase{ } @SuppressWarnings("unchecked") - @Override + @Override public T getCapability(Capability capability, EnumFacing facing){ if(ActuallyAdditions.commonCapsLoaded){ if(capability == SlotlessItemHandlerConfig.CAPABILITY){ @@ -316,7 +316,7 @@ public class TileEntityItemViewer extends TileEntityBase{ public static class GenericItemHandlerInfo implements Comparable{ - public final List handlers = new ArrayList(); + public final List handlers = new ArrayList<>(); public final TileEntityLaserRelayItem relayInQuestion; public GenericItemHandlerInfo(TileEntityLaserRelayItem relayInQuestion){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java index b75600f59..205052564 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java @@ -37,7 +37,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay{ public static final int CAP = 1000; - public final ConcurrentHashMap receiversAround = new ConcurrentHashMap(); + public final ConcurrentHashMap receiversAround = new ConcurrentHashMap<>(); private final IEnergyStorage[] energyStorages = new IEnergyStorage[6]; private Mode mode = Mode.BOTH; @@ -108,7 +108,7 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay{ @Override public void saveDataOnChangeOrWorldStart(){ - Map old = new HashMap(this.receiversAround); + Map old = new HashMap<>(this.receiversAround); boolean change = false; this.receiversAround.clear(); @@ -161,15 +161,15 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay{ EnumFacing opp = facing.getOpposite(); if(tile != null){ - if(tile.hasCapability(CapabilityEnergy.ENERGY, opp)){ - IEnergyStorage cap = tile.getCapability(CapabilityEnergy.ENERGY, opp); - if(cap != null && cap.receiveEnergy(maxTransfer, true) > 0){ - totalReceiverAmount++; - workedOnce = true; + if(tile.hasCapability(CapabilityEnergy.ENERGY, opp)){ + IEnergyStorage cap = tile.getCapability(CapabilityEnergy.ENERGY, opp); + if(cap != null && cap.receiveEnergy(maxTransfer, true) > 0){ + totalReceiverAmount++; + workedOnce = true; + } } } } - } } if(workedOnce){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java index 879c4cb3f..651630c9a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java @@ -38,7 +38,7 @@ import java.util.concurrent.ConcurrentHashMap; public class TileEntityLaserRelayFluids extends TileEntityLaserRelay{ - public final ConcurrentHashMap handlersAround = new ConcurrentHashMap(); + public final ConcurrentHashMap handlersAround = new ConcurrentHashMap<>(); private final IFluidHandler[] fluidHandlers = new IFluidHandler[6]; private Mode mode = Mode.BOTH; @@ -91,7 +91,7 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay{ @Override public void saveDataOnChangeOrWorldStart(){ - Map old = new HashMap(this.handlersAround); + Map old = new HashMap<>(this.handlersAround); boolean change = false; this.handlersAround.clear(); @@ -139,9 +139,9 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay{ private int transferFluidToReceiverInNeed(EnumFacing from, Network network, FluidStack stack, boolean doFill){ int transmitted = 0; //Keeps track of all the Laser Relays and Energy Acceptors that have been checked already to make nothing run multiple times - Set alreadyChecked = new HashSet(); + Set alreadyChecked = new HashSet<>(); - Set relaysThatWork = new HashSet(); + Set relaysThatWork = new HashSet<>(); int totalReceiverAmount = 0; for(IConnectionPair pair : network.connections){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java index 4ab9ebada..4f3985402 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java @@ -36,7 +36,7 @@ import java.util.concurrent.ConcurrentHashMap; public class TileEntityLaserRelayItem extends TileEntityLaserRelay{ - public final Map handlersAround = new ConcurrentHashMap(); + public final Map handlersAround = new ConcurrentHashMap<>(); public int priority; public TileEntityLaserRelayItem(String name){ @@ -62,7 +62,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay{ @Override public void saveDataOnChangeOrWorldStart(){ - Map old = new HashMap(this.handlersAround); + Map old = new HashMap<>(this.handlersAround); boolean change = false; this.handlersAround.clear(); @@ -107,7 +107,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay{ public void getItemHandlersInNetwork(Network network, List storeList){ //Keeps track of all the Laser Relays and Item Handlers that have been checked already to make nothing run multiple times - Set alreadyChecked = new HashSet(); + Set alreadyChecked = new HashSet<>(); for(IConnectionPair pair : network.connections){ for(BlockPos relay : pair.getPositions()){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java index 15a8b22b6..6a8f90619 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java @@ -56,7 +56,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE this.nextUseCounter = 0; if(ENERGY_PRODUCED <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){ - List breakPositions = new ArrayList(); + List breakPositions = new ArrayList<>(); for(int reachX = -RANGE; reachX < RANGE+1; reachX++){ for(int reachZ = -RANGE; reachZ < RANGE+1; reachZ++){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java index d9039c8a0..1ebd155e7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java @@ -126,19 +126,19 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR IBlockState state = this.world.getBlockState(pos); Block block = state.getBlock(); - ItemStack stack = block.getPickBlock(state, new RayTraceResult(Type.BLOCK, new Vec3d(0, 0, 0), EnumFacing.DOWN, pos), world, pos, FakePlayerFactory.getMinecraft((WorldServer) world)); + ItemStack stack = block.getPickBlock(state, new RayTraceResult(Type.BLOCK, new Vec3d(0, 0, 0), EnumFacing.DOWN, pos), this.world, pos, FakePlayerFactory.getMinecraft((WorldServer) this.world)); if (!block.isAir(this.world.getBlockState(pos), this.world, pos)) { if (block.getHarvestLevel(this.world.getBlockState(pos)) <= ItemDrill.HARVEST_LEVEL && state.getBlockHardness(this.world, pos) >= 0F && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock) && this.isMinable(block, stack)) { NonNullList drops = NonNullList.create(); - block.getDrops(drops, world, pos, state, 0); + block.getDrops(drops, this.world, pos, state, 0); float chance = WorldUtil.fireFakeHarvestEventsForDropChance(drops, this.world, pos); if (chance > 0 && this.world.rand.nextFloat() <= chance) { - if (StackUtil.canAddAll(inv, drops, false)) { + if (StackUtil.canAddAll(this.inv, drops, false)) { this.world.playEvent(2001, pos, Block.getStateId(this.world.getBlockState(pos))); this.world.setBlockToAir(pos); - StackUtil.addAll(inv, drops, false); + StackUtil.addAll(this.inv, drops, false); this.markDirty(); this.storage.extractEnergyInternal(actualUse, false); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java index bcc9583cf..e360fdc32 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java @@ -29,7 +29,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn int[] i = ConfigIntListValues.OIL_POWER.getValue(); - public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 0, Math.max(Math.max(i[0], i[1]), Math.max(i[2], i[3])) + 20); + public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 0, Math.max(Math.max(this.i[0], this.i[1]), Math.max(this.i[2], this.i[3])) + 20); public final FluidTank tank = new FluidTank(2*Util.BUCKET){ @Override public boolean canDrain(){ @@ -154,7 +154,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn @Override public int getComparatorStrength(){ - float calc = ((float)this.storage.getEnergyStored()/(float)this.storage.getMaxEnergyStored())*15F; + float calc = (float)this.storage.getEnergyStored()/(float)this.storage.getMaxEnergyStored()*15F; return (int)calc; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java index 9141737bf..2a6acd8c9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java @@ -118,7 +118,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements @Override public boolean hasBoundPosition() { if (this.boundPosition != null) { - if (this.world.getTileEntity(this.boundPosition) instanceof IPhantomTile || (this.getPos().getX() == this.boundPosition.getX() && this.getPos().getY() == this.boundPosition.getY() && this.getPos().getZ() == this.boundPosition.getZ() && this.world.provider.getDimension() == this.world.provider.getDimension())) { + if (this.world.getTileEntity(this.boundPosition) instanceof IPhantomTile || this.getPos().getX() == this.boundPosition.getX() && this.getPos().getY() == this.boundPosition.getY() && this.getPos().getZ() == this.boundPosition.getZ() && this.world.provider.getDimension() == this.world.provider.getDimension()) { this.boundPosition = null; return false; } @@ -133,7 +133,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements Block blockToBreak = this.world.getBlockState(this.boundPosition).getBlock(); if (blockToBreak != null && this.world.getBlockState(this.boundPosition).getBlockHardness(this.world, this.boundPosition) > -1.0F) { NonNullList drops = NonNullList.create(); - blockToBreak.getDrops(drops, world, pos, this.world.getBlockState(this.boundPosition), 0); + blockToBreak.getDrops(drops, this.world, this.pos, this.world.getBlockState(this.boundPosition), 0); if (StackUtil.canAddAll(this.inv, drops, false)) { this.world.playEvent(2001, this.boundPosition, Block.getStateId(this.world.getBlockState(this.boundPosition))); @@ -145,21 +145,21 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } else { int theSlot = StackUtil.findFirstFilled(this.inv); if (theSlot == -1) return; - inv.setStackInSlot(theSlot, WorldUtil.useItemAtSide(WorldUtil.getDirectionBySidesInOrder(this.side), this.world, this.boundPosition, inv.getStackInSlot(theSlot))); + this.inv.setStackInSlot(theSlot, WorldUtil.useItemAtSide(WorldUtil.getDirectionBySidesInOrder(this.side), this.world, this.boundPosition, this.inv.getStackInSlot(theSlot))); } } } public void renderParticles() { if (this.world.rand.nextInt(2) == 0) { - double d1 = (double) ((float) this.boundPosition.getY() + this.world.rand.nextFloat()); + double d1 = this.boundPosition.getY() + this.world.rand.nextFloat(); int i1 = this.world.rand.nextInt(2) * 2 - 1; int j1 = this.world.rand.nextInt(2) * 2 - 1; - double d4 = ((double) this.world.rand.nextFloat() - 0.5D) * 0.125D; - double d2 = (double) this.boundPosition.getZ() + 0.5D + 0.25D * (double) j1; - double d5 = (double) (this.world.rand.nextFloat() * 1.0F * (float) j1); - double d0 = (double) this.boundPosition.getX() + 0.5D + 0.25D * (double) i1; - double d3 = (double) (this.world.rand.nextFloat() * 1.0F * (float) i1); + double d4 = (this.world.rand.nextFloat() - 0.5D) * 0.125D; + double d2 = this.boundPosition.getZ() + 0.5D + 0.25D * j1; + double d5 = this.world.rand.nextFloat() * 1.0F * j1; + double d0 = this.boundPosition.getX() + 0.5D + 0.25D * i1; + double d3 = this.world.rand.nextFloat() * 1.0F * i1; this.world.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java index 518f25cb9..968113f89 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java @@ -111,7 +111,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl } protected boolean doesNeedUpdateSend(){ - return this.boundPosition != this.boundPosBefore || (this.boundPosition != null && this.world.getBlockState(this.boundPosition).getBlock() != this.boundBlockBefore) || this.rangeBefore != this.range; + return this.boundPosition != this.boundPosBefore || this.boundPosition != null && this.world.getBlockState(this.boundPosition).getBlock() != this.boundBlockBefore || this.rangeBefore != this.range; } protected void onUpdateSent(){ @@ -130,7 +130,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl @Override public boolean hasBoundPosition(){ if(this.boundPosition != null){ - if(this.world.getTileEntity(this.boundPosition) instanceof IPhantomTile || (this.getPos().getX() == this.boundPosition.getX() && this.getPos().getY() == this.boundPosition.getY() && this.getPos().getZ() == this.boundPosition.getZ())){ + if(this.world.getTileEntity(this.boundPosition) instanceof IPhantomTile || this.getPos().getX() == this.boundPosition.getX() && this.getPos().getY() == this.boundPosition.getY() && this.getPos().getZ() == this.boundPosition.getZ()){ this.boundPosition = null; return false; } @@ -142,14 +142,14 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl @SideOnly(Side.CLIENT) public void renderParticles(){ if(this.world.rand.nextInt(2) == 0){ - double d1 = (double)((float)this.boundPosition.getY()+this.world.rand.nextFloat()); + double d1 = this.boundPosition.getY()+this.world.rand.nextFloat(); int i1 = this.world.rand.nextInt(2)*2-1; int j1 = this.world.rand.nextInt(2)*2-1; - double d4 = ((double)this.world.rand.nextFloat()-0.5D)*0.125D; - double d2 = (double)this.boundPosition.getZ()+0.5D+0.25D*(double)j1; - double d5 = (double)(this.world.rand.nextFloat()*1.0F*(float)j1); - double d0 = (double)this.boundPosition.getX()+0.5D+0.25D*(double)i1; - double d3 = (double)(this.world.rand.nextFloat()*1.0F*(float)i1); + double d4 = (this.world.rand.nextFloat()-0.5D)*0.125D; + double d2 = this.boundPosition.getZ()+0.5D+0.25D*j1; + double d5 = this.world.rand.nextFloat()*1.0F*j1; + double d0 = this.boundPosition.getX()+0.5D+0.25D*i1; + double d3 = this.world.rand.nextFloat()*1.0F*i1; this.world.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java index a1440e60a..a510eaf4f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java @@ -60,10 +60,10 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement if (!item.isDead && !item.cannotPickup() && StackUtil.isValid(item.getItem())) { ItemStack toAdd = item.getItem().copy(); if (this.filter.check(toAdd)) { - ArrayList checkList = new ArrayList(); + ArrayList checkList = new ArrayList<>(); checkList.add(toAdd); - if (StackUtil.canAddAll(inv, checkList, false)) { - StackUtil.addAll(inv, checkList, false); + if (StackUtil.canAddAll(this.inv, checkList, false)) { + StackUtil.addAll(this.inv, checkList, false); ((WorldServer) this.world).spawnParticle(EnumParticleTypes.CLOUD, false, item.posX, item.posY + 0.45F, item.posZ, 5, 0, 0, 0, 0.03D); item.setDead(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java index 6c5f5aec2..9a714736a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java @@ -19,7 +19,7 @@ import java.util.List; public class TileEntityShockSuppressor extends TileEntityBase implements IEnergyDisplay{ - public static final List SUPPRESSORS = new ArrayList(); + public static final List SUPPRESSORS = new ArrayList<>(); public static final int USE_PER = 300; public static final int RANGE = 5; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java index 8d95866dc..193c62fe9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java @@ -82,7 +82,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } public static int getPlayerXP(EntityPlayer player) { - return (int) (getExperienceForLevel(player.experienceLevel) + (player.experience * player.xpBarCap())); + return (int) (getExperienceForLevel(player.experienceLevel) + player.experience * player.xpBarCap()); } public static void addPlayerXP(EntityPlayer player, int amount) { @@ -120,7 +120,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I this.markDirty(); } else if (stack.getCount() < 64) { int needed = 64 - stack.getCount(); - int toAdd = Math.min(needed, amount); + int toAdd = Math.min(needed, this.amount); stack.grow(toAdd); this.amount -= toAdd; this.markDirty(); @@ -148,7 +148,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I ItemStack stack = this.inv.getStackInSlot(1); if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemSolidifiedExperience) { - int remainingSpace = MathHelper.clamp(Integer.MAX_VALUE - amount, 0, stack.getCount()); + int remainingSpace = MathHelper.clamp(Integer.MAX_VALUE - this.amount, 0, stack.getCount()); if (stack.getCount() >= remainingSpace && remainingSpace != 0) { this.amount += remainingSpace; stack.shrink(remainingSpace); @@ -169,7 +169,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I @Override public void markDirty() { - if (amount < 0) amount = Integer.MAX_VALUE; //don't u go negative on me weird number + if (this.amount < 0) this.amount = Integer.MAX_VALUE; //don't u go negative on me weird number super.markDirty(); } 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 cb998a5cd..90d72a20b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -91,7 +91,7 @@ public final class AssetUtil{ GlStateManager.popMatrix(); } } - + @SideOnly(Side.CLIENT) public static void renderStateInWorld(IBlockState state, IBlockAccess world, BlockPos pos, float brightness){ Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); @@ -99,9 +99,9 @@ public final class AssetUtil{ GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); int i = Minecraft.getMinecraft().getBlockColors().colorMultiplier(state, world, pos, 0); - float r = (float) (i >> 16 & 255) / 255F; - float g = (float) (i >> 8 & 255) / 255F; - float b = (float) (i & 255) / 255F; + float r = (i >> 16 & 255) / 255F; + float g = (i >> 8 & 255) / 255F; + float b = (i & 255) / 255F; Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(state, model, brightness, r, g, b); } @@ -156,14 +156,14 @@ public final class AssetUtil{ //Copied from Gui.class and changed @SideOnly(Side.CLIENT) public static void drawHorizontalGradientRect(int left, int top, int right, int bottom, int startColor, int endColor, float zLevel){ - float f = (float)(startColor >> 24 & 255)/255.0F; - float f1 = (float)(startColor >> 16 & 255)/255.0F; - float f2 = (float)(startColor >> 8 & 255)/255.0F; - float f3 = (float)(startColor & 255)/255.0F; - float f4 = (float)(endColor >> 24 & 255)/255.0F; - float f5 = (float)(endColor >> 16 & 255)/255.0F; - float f6 = (float)(endColor >> 8 & 255)/255.0F; - float f7 = (float)(endColor & 255)/255.0F; + float f = (startColor >> 24 & 255)/255.0F; + float f1 = (startColor >> 16 & 255)/255.0F; + float f2 = (startColor >> 8 & 255)/255.0F; + float f3 = (startColor & 255)/255.0F; + float f4 = (endColor >> 24 & 255)/255.0F; + float f5 = (endColor >> 16 & 255)/255.0F; + float f6 = (endColor >> 8 & 255)/255.0F; + float f7 = (endColor & 255)/255.0F; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); @@ -172,10 +172,10 @@ public final class AssetUtil{ Tessellator tessellator = Tessellator.getInstance(); BufferBuilder renderer = tessellator.getBuffer(); renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - renderer.pos((double)left, (double)top, (double)zLevel).color(f1, f2, f3, f).endVertex(); - renderer.pos((double)left, (double)bottom, (double)zLevel).color(f1, f2, f3, f).endVertex(); - renderer.pos((double)right, (double)bottom, (double)zLevel).color(f5, f6, f7, f4).endVertex(); - renderer.pos((double)right, (double)top, (double)zLevel).color(f5, f6, f7, f4).endVertex(); + renderer.pos(left, top, zLevel).color(f1, f2, f3, f).endVertex(); + renderer.pos(left, bottom, zLevel).color(f1, f2, f3, f).endVertex(); + renderer.pos(right, bottom, zLevel).color(f5, f6, f7, f4).endVertex(); + renderer.pos(right, top, zLevel).color(f5, f6, f7, f4).endVertex(); tessellator.draw(); GlStateManager.shadeModel(7424); GlStateManager.disableBlend(); @@ -205,10 +205,10 @@ public final class AssetUtil{ int j = fontrenderer.getStringWidth(tag)/2; GlStateManager.disableTexture2D(); renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - renderer.pos((double)(-j-1), (double)(-1+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - renderer.pos((double)(-j-1), (double)(8+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - renderer.pos((double)(j+1), (double)(8+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - renderer.pos((double)(j+1), (double)(-1+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + renderer.pos(-j-1, -1+i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + renderer.pos(-j-1, 8+i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + renderer.pos(j+1, 8+i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + renderer.pos(j+1, -1+i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); fontrenderer.drawString(tag, -fontrenderer.getStringWidth(tag)/2, i, 553648127); @@ -267,7 +267,7 @@ public final class AssetUtil{ Vec3d vec2 = new Vec3d(secondX, secondY, secondZ); Vec3d combinedVec = vec2.subtract(vec1); - double rot = rotationTime > 0 ? (360D*((world.getTotalWorldTime()%rotationTime)/rotationTime)) : 0; + double rot = rotationTime > 0 ? 360D*(world.getTotalWorldTime()%rotationTime/rotationTime) : 0; double pitch = Math.atan2(combinedVec.y, Math.sqrt(combinedVec.x*combinedVec.x+combinedVec.z*combinedVec.z)); double yaw = Math.atan2(-combinedVec.z, combinedVec.x); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AwfulUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AwfulUtil.java index 772b6183f..f4b1ad7fe 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AwfulUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AwfulUtil.java @@ -96,15 +96,15 @@ public final class AwfulUtil{ Collections.shuffle(list, rand); return list; } - + public static void callTheFuckinPolice(Object... stuff) { - int i = 0; - String error = "Actually Additions: Something is very wrong. This method was provided with "; - for(Object k : stuff) { - error += ("\n" + i++ + ": " + (k == null ? "null" : (k.getClass().getSimpleName() + " <- CLASS | INSTANCE -> " + k.toString() + ", "))); - } - error += "\n" + "The current side is: " + FMLCommonHandler.instance().getEffectiveSide(); - error += "\n" + "Report this to https://github.com/Ellpeck/ActuallyAdditions/issues"; - throw new IllegalStateException(error); + int i = 0; + String error = "Actually Additions: Something is very wrong. This method was provided with "; + for(Object k : stuff) { + error += "\n" + i++ + ": " + (k == null ? "null" : k.getClass().getSimpleName() + " <- CLASS | INSTANCE -> " + k.toString() + ", "); + } + error += "\n" + "The current side is: " + FMLCommonHandler.instance().getEffectiveSide(); + error += "\n" + "Report this to https://github.com/Ellpeck/ActuallyAdditions/issues"; + throw new IllegalStateException(error); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemStackHandlerAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemStackHandlerAA.java index 39ecb2899..4d747a86f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemStackHandlerAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemStackHandlerAA.java @@ -54,38 +54,38 @@ public class ItemStackHandlerAA extends ItemStackHandler { @Override public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { - return insertItem(slot, stack, simulate, true); + return this.insertItem(slot, stack, simulate, true); } public ItemStack insertItem(int slot, ItemStack stack, boolean simulate, boolean fromAutomation) { - if (!canAccept(slot, stack, fromAutomation)) return stack; + if (!this.canAccept(slot, stack, fromAutomation)) return stack; return super.insertItem(slot, stack, simulate); } @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { - return extractItem(slot, amount, simulate, true); + return this.extractItem(slot, amount, simulate, true); } public ItemStack extractItem(int slot, int amount, boolean simulate, boolean byAutomation) { - if (!canRemove(slot, byAutomation)) return ItemStack.EMPTY; + if (!this.canRemove(slot, byAutomation)) return ItemStack.EMPTY; return super.extractItem(slot, amount, simulate); } public final boolean canAccept(int slot, ItemStack stack, boolean automation) { - return getAcceptor().canAccept(slot, stack, automation); + return this.getAcceptor().canAccept(slot, stack, automation); } public final boolean canRemove(int slot, boolean automation) { - return getRemover().canRemove(slot, automation); + return this.getRemover().canRemove(slot, automation); } public IAcceptor getAcceptor() { - return acceptor; + return this.acceptor; } public IRemover getRemover() { - return remover; + return this.remover; } public static interface IAcceptor { 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 15fcd2708..a9bc93c7a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java @@ -79,7 +79,7 @@ public final class ItemUtil{ public static int getPlaceAt(List list, ItemStack stack, boolean checkWildcard){ if(list != null && list.size() > 0){ for(int i = 0; i < list.size(); i++){ - if((!StackUtil.isValid(stack) && !StackUtil.isValid(list.get(i))) || areItemsEqual(stack, list.get(i), checkWildcard)){ + if(!StackUtil.isValid(stack) && !StackUtil.isValid(list.get(i)) || areItemsEqual(stack, list.get(i), checkWildcard)){ return i; } } @@ -88,7 +88,7 @@ public final class ItemUtil{ } public static boolean areItemsEqual(ItemStack stack1, ItemStack stack2, boolean checkWildcard){ - return StackUtil.isValid(stack1) && StackUtil.isValid(stack2) && (stack1.isItemEqual(stack2) || (checkWildcard && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == Util.WILDCARD || stack2.getItemDamage() == Util.WILDCARD))); + return StackUtil.isValid(stack1) && StackUtil.isValid(stack2) && (stack1.isItemEqual(stack2) || checkWildcard && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == Util.WILDCARD || stack2.getItemDamage() == Util.WILDCARD)); } /** diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java index ae31f974e..503da14ce 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java @@ -47,15 +47,15 @@ public final class StringUtil{ @SuppressWarnings("deprecation")//TODO: delete this shit and move ItemPotionRing's getItemStackDisplayName into getUnlocalizedName public static String localizeIllegallyOnTheServerDontUseMePls(String langKey) { - return net.minecraft.util.text.translation.I18n.translateToLocal(langKey); + return net.minecraft.util.text.translation.I18n.translateToLocal(langKey); } - + @SideOnly(Side.CLIENT) public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow){ List list = renderer.listFormattedStringToWidth(strg, width); for(int i = 0; i < list.size(); i++){ - String s1 = (String)list.get(i); - renderer.drawString(s1, x, y+(i*renderer.FONT_HEIGHT), color, shadow); + String s1 = list.get(i); + renderer.drawString(s1, x, y+i*renderer.FONT_HEIGHT, color, shadow); } } @@ -76,10 +76,10 @@ public final class StringUtil{ public static void renderSplitScaledAsciiString(FontRenderer font, String text, int x, int y, int color, boolean shadow, float scale, int length){ List lines = font.listFormattedStringToWidth(text, (int)(length/scale)); for(int i = 0; i < lines.size(); i++){ - renderScaledAsciiString(font, lines.get(i), x, y+(i*(int)(font.FONT_HEIGHT*scale+3)), color, shadow, scale); + renderScaledAsciiString(font, lines.get(i), x, y+i*(int)(font.FONT_HEIGHT*scale+3), color, shadow, scale); } } - + //TODO: Remove static LanguageMap cancerino; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/Util.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/Util.java index f4fad78bb..9ae7be035 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/Util.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/Util.java @@ -41,9 +41,9 @@ public final class Util{ public static boolean isDevVersion(){ return ActuallyAdditions.VERSION.equals("@VERSION@"); } - + public static boolean isClient(){ - return FMLCommonHandler.instance().getEffectiveSide().isClient(); + return FMLCommonHandler.instance().getEffectiveSide().isClient(); } private static String[] splitVersion(){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java index 70ce93e69..2bc923da9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java @@ -9,20 +9,20 @@ import net.minecraft.world.WorldServer; public final class VanillaPacketDispatcher { - //Don't call from the client. - public static void dispatchTEToNearbyPlayers(TileEntity tile) { - WorldServer world = (WorldServer) tile.getWorld(); - PlayerChunkMapEntry entry = world.getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4); + //Don't call from the client. + public static void dispatchTEToNearbyPlayers(TileEntity tile) { + WorldServer world = (WorldServer) tile.getWorld(); + PlayerChunkMapEntry entry = world.getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4); - if (entry == null) return; + if (entry == null) return; - for (EntityPlayerMP player : entry.getWatchingPlayers()) - ((EntityPlayerMP) player).connection.sendPacket(tile.getUpdatePacket()); + for (EntityPlayerMP player : entry.getWatchingPlayers()) + player.connection.sendPacket(tile.getUpdatePacket()); - } + } - public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) { - TileEntity tile = world.getTileEntity(pos); - if (tile != null) dispatchTEToNearbyPlayers(tile); - } + public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) { + TileEntity tile = world.getTileEntity(pos); + if (tile != null) dispatchTEToNearbyPlayers(tile); + } } 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 1479662ab..55a82758f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -121,16 +121,16 @@ public final class WorldUtil { public static void doEnergyInteraction(TileEntity tileFrom, TileEntity tileTo, EnumFacing sideTo, int maxTransfer) { if (maxTransfer > 0) { EnumFacing opp = sideTo == null ? null : sideTo.getOpposite(); - IEnergyStorage handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo); - IEnergyStorage handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp); - if (handlerFrom != null && handlerTo != null) { - int drain = handlerFrom.extractEnergy(maxTransfer, true); - if (drain > 0) { - int filled = handlerTo.receiveEnergy(drain, false); - handlerFrom.extractEnergy(filled, false); - return; - } + IEnergyStorage handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo); + IEnergyStorage handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp); + if (handlerFrom != null && handlerTo != null) { + int drain = handlerFrom.extractEnergy(maxTransfer, true); + if (drain > 0) { + int filled = handlerTo.receiveEnergy(drain, false); + handlerFrom.extractEnergy(filled, false); + return; } + } } } @@ -236,7 +236,7 @@ public final class WorldUtil { } public static ArrayList getMaterialsAround(World world, BlockPos pos) { - ArrayList blocks = new ArrayList(); + ArrayList blocks = new ArrayList<>(); blocks.add(world.getBlockState(pos.offset(EnumFacing.NORTH)).getMaterial()); blocks.add(world.getBlockState(pos.offset(EnumFacing.EAST)).getMaterial()); blocks.add(world.getBlockState(pos.offset(EnumFacing.SOUTH)).getMaterial()); @@ -252,7 +252,7 @@ public final class WorldUtil { float f = player.rotationPitch; float f1 = player.rotationYaw; double d0 = player.posX; - double d1 = player.posY + (double) player.getEyeHeight(); + double d1 = player.posY + player.getEyeHeight(); double d2 = player.posZ; Vec3d vec3 = new Vec3d(d0, d1, d2); float f2 = MathHelper.cos(-f1 * 0.017453292F - (float) Math.PI); @@ -261,7 +261,7 @@ public final class WorldUtil { float f5 = MathHelper.sin(-f * 0.017453292F); float f6 = f3 * f4; float f7 = f2 * f4; - Vec3d vec31 = vec3.add((double) f6 * distance, (double) f5 * distance, (double) f7 * distance); + Vec3d vec31 = vec3.add(f6 * distance, f5 * distance, f7 * distance); return world.rayTraceBlocks(vec3, vec31, p1, p2, p3); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatFastBench.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatFastBench.java index be9bbc129..f1f0db33f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatFastBench.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatFastBench.java @@ -12,18 +12,18 @@ import shadows.fastbench.gui.GuiFastBench; public class CompatFastBench { - public static Container getFastBenchContainer(EntityPlayer p, World world) { - return new ContainerFastBench(p, world, BlockPos.ORIGIN) { - @Override - public boolean canInteractWith(EntityPlayer playerIn) { - return true; - } - }; - } + public static Container getFastBenchContainer(EntityPlayer p, World world) { + return new ContainerFastBench(p, world, BlockPos.ORIGIN) { + @Override + public boolean canInteractWith(EntityPlayer playerIn) { + return true; + } + }; + } - @SideOnly(Side.CLIENT) - public static Gui getFastBenchGui(EntityPlayer p, World world) { - return new GuiFastBench(p.inventory, world, BlockPos.ORIGIN); - } + @SideOnly(Side.CLIENT) + public static Gui getFastBenchGui(EntityPlayer p, World world) { + return new GuiFastBench(p.inventory, world, BlockPos.ORIGIN); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatUtil.java index d4a59e137..fa72ad19a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatUtil.java @@ -34,6 +34,7 @@ public final class CompatUtil { public static Object getCrafterContainerElement(EntityPlayer player, World world, int x, int y, int z) { if (fb) return CompatFastBench.getFastBenchContainer(player, world); return new ContainerWorkbench(player.inventory, world, new BlockPos(x, y, z)) { + @Override public boolean canInteractWith(EntityPlayer playerIn) { return true; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/IMCHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/IMCHandler.java index 052c4a15f..77e4c2cb3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/IMCHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/IMCHandler.java @@ -20,14 +20,14 @@ import org.apache.commons.lang3.ArrayUtils; public final class IMCHandler{ private static final Class[] NO_CARRYING = new Class[]{ - BlockGiantChest.class, - BlockWildPlant.class, - BlockPlant.class, - BlockPhantom.class, - BlockTinyTorch.class, - BlockItemViewer.class, - BlockItemViewerHopping.class, - BlockLaserRelay.class + BlockGiantChest.class, + BlockWildPlant.class, + BlockPlant.class, + BlockPhantom.class, + BlockTinyTorch.class, + BlockItemViewer.class, + BlockItemViewerHopping.class, + BlockLaserRelay.class }; public static void doBlockIMC(Block block){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/crafting/BlankRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/crafting/BlankRecipe.java index 415d802d4..1190f1dd7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/crafting/BlankRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/crafting/BlankRecipe.java @@ -9,24 +9,24 @@ import net.minecraftforge.registries.IForgeRegistryEntry; public class BlankRecipe extends IForgeRegistryEntry.Impl implements IRecipe{ - @Override - public boolean matches(InventoryCrafting inv, World worldIn) { - return false; - } + @Override + public boolean matches(InventoryCrafting inv, World worldIn) { + return false; + } - @Override - public ItemStack getCraftingResult(InventoryCrafting inv) { - return ItemStack.EMPTY; - } + @Override + public ItemStack getCraftingResult(InventoryCrafting inv) { + return ItemStack.EMPTY; + } - @Override - public boolean canFit(int width, int height) { - return false; - } + @Override + public boolean canFit(int width, int height) { + return false; + } - @Override - public ItemStack getRecipeOutput() { - return ItemStack.EMPTY; - } + @Override + public ItemStack getRecipeOutput() { + return ItemStack.EMPTY; + } } 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 b3bffe0b1..6e9187df9 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 @@ -18,7 +18,7 @@ import net.minecraftforge.oredict.OreIngredient; import java.util.List; -//This class created by Shadows_of_Fire +//This class created by Shadows_of_Fire //MIT License public final class RecipeHelper { @@ -65,8 +65,8 @@ public final class RecipeHelper { } /* - * This adds a shaped recipe to the list of crafting recipes, using the forge format, with a custom group. - */ + * 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) { ShapedPrimer primer = CraftingHelper.parseShaped(input); addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height, primer.input, output).setRegistryName(MODID, name));