diff --git a/src/main/java/binnie/botany/Botany.java b/src/main/java/binnie/botany/Botany.java index b064cf51f..ff84ef0c1 100644 --- a/src/main/java/binnie/botany/Botany.java +++ b/src/main/java/binnie/botany/Botany.java @@ -151,8 +151,8 @@ public void onShearFlower(PlayerInteractEvent event) { if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Items.shears) { TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z); - if (tile instanceof TileEntityFlower tef) { - tef.onShear(); + if (tile instanceof TileEntityFlower tileFlower) { + tileFlower.onShear(); event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer); } } @@ -160,10 +160,10 @@ public void onShearFlower(PlayerInteractEvent event) { if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Botany.pollen) { TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z); - if (tile instanceof TileEntityFlower tef) { + if (tile instanceof TileEntityFlower tileFlower) { IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem()); - if (pollen != null && tef.canMateWith(pollen)) { - tef.mateWith(pollen); + if (pollen != null && tileFlower.canMateWith(pollen)) { + tileFlower.mateWith(pollen); if (!event.entityPlayer.capabilities.isCreativeMode) { ItemStack heldItem = event.entityPlayer.getHeldItem(); heldItem.stackSize--; diff --git a/src/main/java/binnie/botany/flower/BlockFlower.java b/src/main/java/binnie/botany/flower/BlockFlower.java index ea1945241..7a2a972ef 100644 --- a/src/main/java/binnie/botany/flower/BlockFlower.java +++ b/src/main/java/binnie/botany/flower/BlockFlower.java @@ -108,14 +108,14 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase e @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { TileEntity tile = world.getTileEntity(x, y, z); - if (!(tile instanceof TileEntityFlower f)) { + if (!(tile instanceof TileEntityFlower tileFlower)) { return super.getIcon(world, x, y, z, side); } - EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER; - IFlowerType flower = f.getType(); - int section = f.getRenderSection(); - boolean flowered = f.isFlowered(); + EnumFlowerStage stage = (tileFlower.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER; + IFlowerType flower = tileFlower.getType(); + int section = tileFlower.getRenderSection(); + boolean flowered = tileFlower.isFlowered(); if (RendererBotany.pass == 0) { return flower.getStem(stage, flowered, section); } @@ -128,11 +128,11 @@ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TileEntityFlower f) { + if (tile instanceof TileEntityFlower tileFlower) { if (RendererBotany.pass == 0) { - return f.getStemColour(); + return tileFlower.getStemColour(); } - return (RendererBotany.pass == 1) ? f.getPrimaryColor() : f.getSecondaryColor(); + return (RendererBotany.pass == 1) ? tileFlower.getPrimaryColor() : tileFlower.getSecondaryColor(); } return 0xffffff; } @@ -151,13 +151,13 @@ public void onNeighborBlockChange(World world, int x, int y, int z, Block block) super.onNeighborBlockChange(world, x, y, z, block); checkAndDropBlock(world, x, y, z); TileEntity tile = world.getTileEntity(x, y, z); - if (!(tile instanceof TileEntityFlower flower)) { + if (!(tile instanceof TileEntityFlower tileFlower)) { return; } - if (flower.getSection() == 0 && flower.getFlower() != null - && flower.getFlower().getAge() > 0 - && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 + if (tileFlower.getSection() == 0 && tileFlower.getFlower() != null + && tileFlower.getFlower().getAge() > 0 + && tileFlower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && world.getBlock(x, y + 1, z) != Botany.flower) { dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); world.setBlockToAir(x, y, z); diff --git a/src/main/java/binnie/botany/gardening/Gardening.java b/src/main/java/binnie/botany/gardening/Gardening.java index 7b11ee8ef..67a5c25d6 100644 --- a/src/main/java/binnie/botany/gardening/Gardening.java +++ b/src/main/java/binnie/botany/gardening/Gardening.java @@ -118,13 +118,13 @@ public static boolean plant(World world, int x, int y, int z, IFlower flower, Ga return false; } - TileEntity tileFlower = world.getTileEntity(x, y, z); - TileEntity below = world.getTileEntity(x, y - 1, z); - if (tileFlower instanceof TileEntityFlower tef) { - if (below instanceof TileEntityFlower tefB) { - tef.setSection(tefB.getSection()); + final TileEntity tile = world.getTileEntity(x, y, z); + final TileEntity below = world.getTileEntity(x, y - 1, z); + if (tile instanceof TileEntityFlower tileFlower) { + if (below instanceof TileEntityFlower lowerFlower) { + tileFlower.setSection(lowerFlower.getSection()); } else { - tef.create(flower, owner); + tileFlower.create(flower, owner); } } diff --git a/src/main/java/binnie/core/craftgui/minecraft/ContainerCraftGUI.java b/src/main/java/binnie/core/craftgui/minecraft/ContainerCraftGUI.java index 3bc9eb98b..d4649b579 100644 --- a/src/main/java/binnie/core/craftgui/minecraft/ContainerCraftGUI.java +++ b/src/main/java/binnie/core/craftgui/minecraft/ContainerCraftGUI.java @@ -145,9 +145,9 @@ public void sendNBTToClient(String key, NBTTagCompound nbt) { @Override public boolean canInteractWith(EntityPlayer player) { - if (player instanceof EntityPlayerMP emp) { - if (!crafters.contains(emp)) { - crafters.add(emp); + if (player instanceof EntityPlayerMP playerMP) { + if (!crafters.contains(playerMP)) { + crafters.add(playerMP); } sentNBT.clear(); } @@ -298,8 +298,8 @@ public void detectAndSendChanges() { if (shouldSend) { for (Object crafter : crafters) { - if (crafter instanceof EntityPlayerMP player) { - BinnieCore.proxy.sendToPlayer(new MessageContainerUpdate(nbt.getValue()), player); + if (crafter instanceof EntityPlayerMP playerMP) { + BinnieCore.proxy.sendToPlayer(new MessageContainerUpdate(nbt.getValue()), playerMP); } } sentThisTime.put(nbt.getKey(), nbt.getValue()); diff --git a/src/main/java/binnie/core/genetics/Gene.java b/src/main/java/binnie/core/genetics/Gene.java index f3d8075c1..eef348c57 100644 --- a/src/main/java/binnie/core/genetics/Gene.java +++ b/src/main/java/binnie/core/genetics/Gene.java @@ -95,11 +95,11 @@ public IAllele getAllele() { @Override public boolean equals(Object obj) { - if (!(obj instanceof Gene g)) { + if (!(obj instanceof Gene gene)) { return false; } - return allele == g.allele && chromosome.ordinal() == g.chromosome.ordinal() && root == g.root; + return allele == gene.allele && chromosome.ordinal() == gene.chromosome.ordinal() && root == gene.root; } public String getAlleleName() { diff --git a/src/main/java/binnie/core/machines/BlockMachine.java b/src/main/java/binnie/core/machines/BlockMachine.java index 3d9413ea9..45e7284c8 100644 --- a/src/main/java/binnie/core/machines/BlockMachine.java +++ b/src/main/java/binnie/core/machines/BlockMachine.java @@ -134,11 +134,11 @@ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { TileEntity tileentity = world.getTileEntity(x, y, z); - if (!(tileentity instanceof TileEntityMachine entity)) { + if (!(tileentity instanceof TileEntityMachine machine)) { return; } - entity.onBlockDestroy(); + machine.onBlockDestroy(); super.breakBlock(world, x, y, z, block, meta); } diff --git a/src/main/java/binnie/core/machines/power/ProcessInfo.java b/src/main/java/binnie/core/machines/power/ProcessInfo.java index 953770e7a..2501ef8d0 100644 --- a/src/main/java/binnie/core/machines/power/ProcessInfo.java +++ b/src/main/java/binnie/core/machines/power/ProcessInfo.java @@ -17,10 +17,10 @@ public ProcessInfo(IProcess process) { processTime = 0; energyPerTick = process.getEnergyPerTick(); - if (process instanceof IProcessTimed time) { - currentProgress = time.getProgress(); - processEnergy = time.getProcessEnergy(); - processTime = time.getProcessLength(); + if (process instanceof IProcessTimed processTimed) { + currentProgress = processTimed.getProgress(); + processEnergy = processTimed.getProcessEnergy(); + processTime = processTimed.getProcessLength(); } else { currentProgress = process.isInProgress() ? 100.0f : 0.0f; } diff --git a/src/main/java/binnie/core/nei/RecipeHandlerBase.java b/src/main/java/binnie/core/nei/RecipeHandlerBase.java index 11493881d..581ca8099 100644 --- a/src/main/java/binnie/core/nei/RecipeHandlerBase.java +++ b/src/main/java/binnie/core/nei/RecipeHandlerBase.java @@ -196,9 +196,9 @@ protected boolean transferFluidTank(GuiRecipe guiRecipe, int recipe, boolean public void drawFluidTanks(int recipe) { CachedRecipe cachedRecipe = this.arecipes.get(recipe); - if (cachedRecipe instanceof CachedBaseRecipe crecipe) { - if (crecipe.getFluidTanks() != null) { - for (PositionedFluidTank fluidTank : crecipe.getFluidTanks()) { + if (cachedRecipe instanceof CachedBaseRecipe baseRecipe) { + if (baseRecipe.getFluidTanks() != null) { + for (PositionedFluidTank fluidTank : baseRecipe.getFluidTanks()) { fluidTank.draw(); } } diff --git a/src/main/java/binnie/extratrees/block/decor/FenceRenderer.java b/src/main/java/binnie/extratrees/block/decor/FenceRenderer.java index 8487dcfc9..1187f691a 100644 --- a/src/main/java/binnie/extratrees/block/decor/FenceRenderer.java +++ b/src/main/java/binnie/extratrees/block/decor/FenceRenderer.java @@ -145,8 +145,8 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b float i = 0.0625f; FenceType fenceType = new FenceType(0); TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TileEntityMetadata tem && block instanceof BlockMultiFence) { - fenceType = WoodManager.getFenceType(tem.getTileMetadata()); + if (tile instanceof TileEntityMetadata tileMeta && block instanceof BlockMultiFence) { + fenceType = WoodManager.getFenceType(tileMeta.getTileMetadata()); } boolean rendered; diff --git a/src/main/java/binnie/extratrees/carpentry/BlockDesign.java b/src/main/java/binnie/extratrees/carpentry/BlockDesign.java index 0066c62ec..b27e51334 100644 --- a/src/main/java/binnie/extratrees/carpentry/BlockDesign.java +++ b/src/main/java/binnie/extratrees/carpentry/BlockDesign.java @@ -55,7 +55,7 @@ public void onClick(PlayerInteractEvent event) { int x = event.x; int y = event.y; int z = event.z; - if (!(world.getBlock(x, y, z) instanceof BlockDesign blockC)) { + if (!(world.getBlock(x, y, z) instanceof BlockDesign blockDesign)) { return; } @@ -65,10 +65,10 @@ public void onClick(PlayerInteractEvent event) { return; } - DesignBlock block = blockC.getCarpentryBlock(world, x, y, z); + DesignBlock carpentryBlock = blockDesign.getCarpentryBlock(world, x, y, z); TileEntityMetadata tile = (TileEntityMetadata) world.getTileEntity(x, y, z); - block.rotate(event.face, item, player, world, x, y, z); - int meta = block.getBlockMetadata(blockC.getDesignSystem()); + carpentryBlock.rotate(event.face, item, player, world, x, y, z); + int meta = carpentryBlock.getBlockMetadata(blockDesign.getDesignSystem()); tile.setTileMetadata(meta, true); } diff --git a/src/main/java/binnie/extratrees/machines/lumbermill/Lumbermill.java b/src/main/java/binnie/extratrees/machines/lumbermill/Lumbermill.java index d8cd29c06..8c0628f8a 100644 --- a/src/main/java/binnie/extratrees/machines/lumbermill/Lumbermill.java +++ b/src/main/java/binnie/extratrees/machines/lumbermill/Lumbermill.java @@ -55,13 +55,13 @@ public static void calculateLumbermillProducts() { private static Collection getRecipeResult(ItemStack output) { List list = new ArrayList<>(); for (IRecipe iRecipe : CraftingManager.getInstance().getRecipeList()) { - if (iRecipe instanceof ShapelessRecipes recipe) { - if (recipe.recipeItems.size() != 1 || !(recipe.recipeItems.get(0) instanceof ItemStack)) { + if (iRecipe instanceof ShapelessRecipes shapeless) { + if (shapeless.recipeItems.size() != 1 || !(shapeless.recipeItems.get(0) instanceof ItemStack)) { continue; } - ItemStack input = recipe.recipeItems.get(0); - if (recipe.getRecipeOutput() != null && recipe.getRecipeOutput().isItemEqual(output)) { + ItemStack input = shapeless.recipeItems.get(0); + if (shapeless.getRecipeOutput() != null && shapeless.getRecipeOutput().isItemEqual(output)) { list.add(input); } } @@ -77,12 +77,12 @@ private static Collection getRecipeResult(ItemStack output) { } } - if (iRecipe instanceof ShapelessOreRecipe shore) { - if (shore.getInput().size() != 1 || !(shore.getInput().get(0) instanceof ItemStack input)) { + if (iRecipe instanceof ShapelessOreRecipe shapelessOre) { + if (shapelessOre.getInput().size() != 1 || !(shapelessOre.getInput().get(0) instanceof ItemStack input)) { continue; } - if (shore.getRecipeOutput() == null || !shore.getRecipeOutput().isItemEqual(output)) { + if (shapelessOre.getRecipeOutput() == null || !shapelessOre.getRecipeOutput().isItemEqual(output)) { continue; } list.add(input); diff --git a/src/main/java/binnie/genetics/gui/AnalystPageProduce.java b/src/main/java/binnie/genetics/gui/AnalystPageProduce.java index b115fd065..fad516ec2 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageProduce.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageProduce.java @@ -114,9 +114,9 @@ public Collection getCrafting(ItemStack stack) { } } - if (iRecipe instanceof ShapelessOreRecipe shore) { + if (iRecipe instanceof ShapelessOreRecipe shapelessOre) { boolean match = true; - for (final Object rec : shore.getInput()) { + for (final Object rec : shapelessOre.getInput()) { if (rec != null && (!(rec instanceof ItemStack i) || !stack.isItemEqual(i))) { match = false; break; @@ -126,7 +126,7 @@ public Collection getCrafting(ItemStack stack) { if (!match) { continue; } - products.add(shore.getRecipeOutput()); + products.add(shapelessOre.getRecipeOutput()); } } return products;