diff --git a/src/main/java/forestry/api/core/EnumCamouflageType.java b/src/main/java/forestry/api/core/EnumCamouflageType.java new file mode 100644 index 000000000..e6bc98583 --- /dev/null +++ b/src/main/java/forestry/api/core/EnumCamouflageType.java @@ -0,0 +1,12 @@ +/******************************************************************************* + * Copyright 2011-2014 SirSengir + * + * This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details. + ******************************************************************************/ +package forestry.api.core; + +public enum EnumCamouflageType { + DEFAULT, GLASS, DOOR; + + public static final EnumCamouflageType[] VALUES = values(); +} diff --git a/src/main/java/forestry/api/core/ICamouflageHandler.java b/src/main/java/forestry/api/core/ICamouflageHandler.java new file mode 100644 index 000000000..e2eeb0050 --- /dev/null +++ b/src/main/java/forestry/api/core/ICamouflageHandler.java @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright 2011-2014 SirSengir + * + * This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details. + ******************************************************************************/ +package forestry.api.core; + +import forestry.core.tiles.ILocatable; +import net.minecraft.item.ItemStack; + +public interface ICamouflageHandler extends ILocatable { + + ItemStack getCamouflageBlock(EnumCamouflageType type); + + void setCamouflageBlock(EnumCamouflageType type, ItemStack camouflageBlock); + +} diff --git a/src/main/java/forestry/api/core/ICamouflagedBlock.java b/src/main/java/forestry/api/core/ICamouflagedBlock.java new file mode 100644 index 000000000..ac5b0e1d1 --- /dev/null +++ b/src/main/java/forestry/api/core/ICamouflagedBlock.java @@ -0,0 +1,14 @@ +/******************************************************************************* + * Copyright 2011-2014 SirSengir + * + * This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details. + ******************************************************************************/ +package forestry.api.core; + +import forestry.core.tiles.ILocatable; + +public interface ICamouflagedBlock extends ILocatable { + + EnumCamouflageType getCamouflageType(); + +} diff --git a/src/main/java/forestry/api/greenhouse/DefaultGreenhouseListener.java b/src/main/java/forestry/api/greenhouse/DefaultGreenhouseListener.java index db33ce3ac..598d7b8a0 100644 --- a/src/main/java/forestry/api/greenhouse/DefaultGreenhouseListener.java +++ b/src/main/java/forestry/api/greenhouse/DefaultGreenhouseListener.java @@ -10,7 +10,7 @@ import forestry.api.multiblock.IGreenhouseController; public class DefaultGreenhouseListener implements IGreenhouseListener { @Override - public boolean canWork(G greenhouse) { + public boolean canWork(G greenhouse, boolean canWork) { return true; } diff --git a/src/main/java/forestry/api/greenhouse/GreenhouseManager.java b/src/main/java/forestry/api/greenhouse/GreenhouseManager.java new file mode 100644 index 000000000..f9d1b408d --- /dev/null +++ b/src/main/java/forestry/api/greenhouse/GreenhouseManager.java @@ -0,0 +1,7 @@ +package forestry.api.greenhouse; + +public class GreenhouseManager { + + public static IGreenhouseItemAccess greenhouseItemAccess; + +} diff --git a/src/main/java/forestry/api/greenhouse/IGreenhouseHousing.java b/src/main/java/forestry/api/greenhouse/IGreenhouseHousing.java index ab6eee873..13cfefb52 100644 --- a/src/main/java/forestry/api/greenhouse/IGreenhouseHousing.java +++ b/src/main/java/forestry/api/greenhouse/IGreenhouseHousing.java @@ -5,8 +5,6 @@ ******************************************************************************/ package forestry.api.greenhouse; -import forestry.api.core.EnumHumidity; -import forestry.api.core.EnumTemperature; import forestry.api.core.IErrorLogicSource; import forestry.core.tiles.IClimatised; import net.minecraft.util.BlockPos; diff --git a/src/main/java/forestry/api/greenhouse/IGreenhouseItemAccess.java b/src/main/java/forestry/api/greenhouse/IGreenhouseItemAccess.java new file mode 100644 index 000000000..4ffc5f805 --- /dev/null +++ b/src/main/java/forestry/api/greenhouse/IGreenhouseItemAccess.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright 2011-2014 SirSengir + * + * This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details. + ******************************************************************************/ +package forestry.api.greenhouse; + +import javax.annotation.Nonnull; + +import forestry.api.core.EnumCamouflageType; +import net.minecraft.item.ItemStack; + +public interface IGreenhouseItemAccess { + + void registerGreenhouseGlass(@Nonnull ItemStack glass); + + boolean isGreenhouseGlass(@Nonnull ItemStack glass); + + void addToCamouflageBlockBlackList(@Nonnull EnumCamouflageType type, @Nonnull ItemStack camouflageBlock); + + boolean isOnCamouflageBlockBlackList(@Nonnull EnumCamouflageType type, @Nonnull ItemStack camouflageBlock); + +} diff --git a/src/main/java/forestry/api/greenhouse/IGreenhouseListener.java b/src/main/java/forestry/api/greenhouse/IGreenhouseListener.java index 7a094e966..d443357f1 100644 --- a/src/main/java/forestry/api/greenhouse/IGreenhouseListener.java +++ b/src/main/java/forestry/api/greenhouse/IGreenhouseListener.java @@ -10,11 +10,12 @@ import forestry.api.multiblock.IGreenhouseController; public interface IGreenhouseListener { /** - * Called before the greenhouse work + * Called before the greenhouse work. * - * @param greenhouse The greenhouse multiblock - * @return Can the greenhouse work + * @param greenhouse The greenhouse multiblock. + * @param canWork The actual {@link Boolean} value. + * @return True if the greenhouse can work. */ - boolean canWork(G greenhouse); + boolean canWork(G greenhouse, boolean canWork); } diff --git a/src/main/java/forestry/api/multiblock/IGreenhouseComponent.java b/src/main/java/forestry/api/multiblock/IGreenhouseComponent.java index 9d7d6a7aa..39ee7a22b 100644 --- a/src/main/java/forestry/api/multiblock/IGreenhouseComponent.java +++ b/src/main/java/forestry/api/multiblock/IGreenhouseComponent.java @@ -16,6 +16,9 @@ public interface IGreenhouseComponent exte interface Listener extends IGreenhouseComponent { IGreenhouseListener getGreenhouseListener(); } + + interface Door extends IGreenhouseComponent { + } interface Climatiser extends IGreenhouseComponent { void changeClimate(int tickCount, G greenhouse); diff --git a/src/main/java/forestry/apiculture/blocks/BlockCandle.java b/src/main/java/forestry/apiculture/blocks/BlockCandle.java index 2bac9986e..aa3250fe8 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockCandle.java +++ b/src/main/java/forestry/apiculture/blocks/BlockCandle.java @@ -282,7 +282,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister { @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - TileCandle tileCandle = (TileCandle) (world.getTileEntity(pos)); + TileCandle tileCandle = (TileCandle) world.getTileEntity(pos); int colour = getColourValueFromItemStack(stack); boolean isLit = isLit(stack); tileCandle.setColour(colour); diff --git a/src/main/java/forestry/apiculture/entities/EntityFXBee.java b/src/main/java/forestry/apiculture/entities/EntityFXBee.java index df915b04f..beccd1104 100644 --- a/src/main/java/forestry/apiculture/entities/EntityFXBee.java +++ b/src/main/java/forestry/apiculture/entities/EntityFXBee.java @@ -42,9 +42,9 @@ public class EntityFXBee extends EntityFX { this.prevPosY = this.posY; this.prevPosZ = this.posZ; this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= (1 + 0.2D * rand.nextFloat()); + this.motionX *= 1 + 0.2D * rand.nextFloat(); this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2; - this.motionZ *= (1 + 0.2D * rand.nextFloat()); + this.motionZ *= 1 + 0.2D * rand.nextFloat(); if (this.particleAge++ >= this.particleMaxAge) { this.setDead(); @@ -66,17 +66,17 @@ public class EntityFXBee extends EntityFX { } float f10 = 0.1F * particleScale; - float f11 = (float) ((prevPosX + (posX - prevPosX) * f) - interpPosX); - float f12 = (float) ((prevPosY + (posY - prevPosY) * f) - interpPosY); - float f13 = (float) ((prevPosZ + (posZ - prevPosZ) * f) - interpPosZ); + float f11 = (float) (prevPosX + (posX - prevPosX) * f - interpPosX); + float f12 = (float) (prevPosY + (posY - prevPosY) * f - interpPosY); + float f13 = (float) (prevPosZ + (posZ - prevPosZ) * f - interpPosZ); int i = this.getBrightnessForRender(f); int j = i >> 16 & 65535; int k = i & 65535; wR.pos(f11 - f1 * f10 - f4 * f10, f12 - f2 * f10, f13 - f3 * f10 - f5 * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); - wR.pos((f11 - f1 * f10) + f4 * f10, f12 + f2 * f10, (f13 - f3 * f10) + f5 * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); + wR.pos(f11 - f1 * f10 + f4 * f10, f12 + f2 * f10, f13 - f3 * f10 + f5 * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); wR.pos(f11 + f1 * f10 + f4 * f10, f12 + f2 * f10, f13 + f3 * f10 + f5 * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); - wR.pos((f11 + f1 * f10) - f4 * f10, f12 - f2 * f10, (f13 + f3 * f10) - f5 * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); + wR.pos(f11 + f1 * f10 - f4 * f10, f12 - f2 * f10, f13 + f3 * f10 - f5 * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); } @Override diff --git a/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java b/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java index 8f8c62a85..fa68ec949 100644 --- a/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java +++ b/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java @@ -141,7 +141,7 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain @Override public int getHealthScaled(int i) { - return (breedingProgressPercent * i) / 100; + return breedingProgressPercent * i / 100; } @Override diff --git a/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java b/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java index ae61c1da9..1d3eab25e 100755 --- a/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java +++ b/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java @@ -97,7 +97,7 @@ public class BeekeepingMode implements IBeekeepingMode { float productionModifier = beeModifier.getProductionModifier(queen.getGenome(), 1f); if (productionModifier > 16) { - if (housing.getWorld().rand.nextFloat() * 100 < 0.01 * ((productionModifier * productionModifier) - 100)) { + if (housing.getWorld().rand.nextFloat() * 100 < 0.01 * (productionModifier * productionModifier - 100)) { return true; } } @@ -111,7 +111,7 @@ public class BeekeepingMode implements IBeekeepingMode { float mutationModifier = beeModifier.getMutationModifier(queen.getGenome(), queen.getMate(), 1.0f); if (mutationModifier > 10) { - if (housing.getWorld().rand.nextFloat() * 100 < 0.4 * ((mutationModifier * mutationModifier) - 100)) { + if (housing.getWorld().rand.nextFloat() * 100 < 0.4 * (mutationModifier * mutationModifier - 100)) { return true; } } diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFertile.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFertile.java index b3b0431e9..f4590b5a9 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFertile.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFertile.java @@ -41,8 +41,8 @@ public class AlleleEffectFertile extends AlleleEffectThrottled { int blockX = getRandomOffset(world.rand, housingCoordinates.getX(), area.getX()); int blockZ = getRandomOffset(world.rand, housingCoordinates.getZ(), area.getZ()); - int blockMaxY = housingCoordinates.getY() + (area.getY() / 2) + 1; - int blockMinY = housingCoordinates.getY() - (area.getY() / 2) - 1; + int blockMaxY = housingCoordinates.getY() + area.getY() / 2 + 1; + int blockMinY = housingCoordinates.getY() - area.getY() / 2 - 1; for (int attempt = 0; attempt < MAX_BLOCK_FIND_TRIES; ++attempt) { if (tryTickColumn(world, blockX, blockZ, blockMaxY, blockMinY)) { @@ -56,7 +56,7 @@ public class AlleleEffectFertile extends AlleleEffectThrottled { } private static int getRandomOffset(Random random, int centrePos, int offset) { - return centrePos + random.nextInt(offset) - (offset / 2); + return centrePos + random.nextInt(offset) - offset / 2; } private static boolean tryTickColumn(World world, int x, int z, int maxY, int minY) { diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFungification.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFungification.java index e1239f97c..8471697c4 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFungification.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFungification.java @@ -87,11 +87,11 @@ public class AlleleEffectFungification extends AlleleEffectThrottled { } private static int getRandomOffset(Random random, int centrePos, int offset) { - return centrePos + random.nextInt(offset) - (offset / 2); + return centrePos + random.nextInt(offset) - offset / 2; } private static boolean isSuitableForMycelium(World world, Block block, BlockPos pos) { - return block == Blocks.grass || (block == Blocks.dirt && world.canBlockSeeSky(pos)); + return block == Blocks.grass || block == Blocks.dirt && world.canBlockSeeSky(pos); } private static boolean isSuitableForGrowth(Block block) { diff --git a/src/main/java/forestry/apiculture/inventory/InventoryApiary.java b/src/main/java/forestry/apiculture/inventory/InventoryApiary.java index 52c3eedb2..f1e42d313 100644 --- a/src/main/java/forestry/apiculture/inventory/InventoryApiary.java +++ b/src/main/java/forestry/apiculture/inventory/InventoryApiary.java @@ -36,7 +36,7 @@ public class InventoryApiary extends InventoryBeeHousing implements IApiaryInven @Override public boolean canSlotAccept(int slotIndex, ItemStack itemStack) { if (SlotUtil.isSlotInRange(slotIndex, SLOT_FRAMES_1, SLOT_FRAMES_COUNT)) { - return (itemStack.getItem() instanceof IHiveFrame) && (getStackInSlot(slotIndex) == null); + return itemStack.getItem() instanceof IHiveFrame && getStackInSlot(slotIndex) == null; } return super.canSlotAccept(slotIndex, itemStack); diff --git a/src/main/java/forestry/apiculture/items/ItemHiveFrame.java b/src/main/java/forestry/apiculture/items/ItemHiveFrame.java index 8898afa57..eef5b1581 100755 --- a/src/main/java/forestry/apiculture/items/ItemHiveFrame.java +++ b/src/main/java/forestry/apiculture/items/ItemHiveFrame.java @@ -57,7 +57,7 @@ public class ItemHiveFrame extends ItemForestry implements IHiveFrame { @Override public float getProductionModifier(IBeeGenome genome, float currentModifier) { - return (currentModifier < 10f) ? 2f : 1f; + return currentModifier < 10f ? 2f : 1f; } @Override diff --git a/src/main/java/forestry/apiculture/multiblock/AlvearyController.java b/src/main/java/forestry/apiculture/multiblock/AlvearyController.java index 86201f9e0..7a6ff22c9 100644 --- a/src/main/java/forestry/apiculture/multiblock/AlvearyController.java +++ b/src/main/java/forestry/apiculture/multiblock/AlvearyController.java @@ -279,10 +279,10 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple fxY += upSpread; // display fx on all 4 sides - Proxies.render.addEntityHoneyDustFX(worldObj, (fxX - distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter)); - Proxies.render.addEntityHoneyDustFX(worldObj, (fxX + distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter)); - Proxies.render.addEntityHoneyDustFX(worldObj, (fxX + leftRightSpreadFromCenter), fxY, (fxZ - distanceFromCenter)); - Proxies.render.addEntityHoneyDustFX(worldObj, (fxX + leftRightSpreadFromCenter), fxY, (fxZ + distanceFromCenter)); + Proxies.render.addEntityHoneyDustFX(worldObj, fxX - distanceFromCenter, fxY, fxZ + leftRightSpreadFromCenter); + Proxies.render.addEntityHoneyDustFX(worldObj, fxX + distanceFromCenter, fxY, fxZ + leftRightSpreadFromCenter); + Proxies.render.addEntityHoneyDustFX(worldObj, fxX + leftRightSpreadFromCenter, fxY, fxZ - distanceFromCenter); + Proxies.render.addEntityHoneyDustFX(worldObj, fxX + leftRightSpreadFromCenter, fxY, fxZ + distanceFromCenter); } } } @@ -428,7 +428,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple /* GUI */ @Override public int getHealthScaled(int i) { - return (breedingProgressPercent * i) / 100; + return breedingProgressPercent * i / 100; } @Override diff --git a/src/main/java/forestry/apiculture/render/ModelBee.java b/src/main/java/forestry/apiculture/render/ModelBee.java index 44c5a7784..e523d1908 100755 --- a/src/main/java/forestry/apiculture/render/ModelBee.java +++ b/src/main/java/forestry/apiculture/render/ModelBee.java @@ -133,7 +133,7 @@ public class ModelBee extends ModelBase { GL11.glPushMatrix(); float scale = 0.75f; GL11.glScalef(scale, scale, scale); - GL11.glTranslatef(0.0F, (12.0f / scale) * f5, 0.0F); + GL11.glTranslatef(0.0F, 12.0f / scale * f5, 0.0F); snout.render(f5); torsoWing.render(f5); diff --git a/src/main/java/forestry/apiculture/render/TextureHabitatLocator.java b/src/main/java/forestry/apiculture/render/TextureHabitatLocator.java index c831e09fa..134adfa8d 100644 --- a/src/main/java/forestry/apiculture/render/TextureHabitatLocator.java +++ b/src/main/java/forestry/apiculture/render/TextureHabitatLocator.java @@ -74,11 +74,11 @@ public class TextureHabitatLocator extends TextureAtlasSprite { double angleChange = targetAngle - currentAngle; while (angleChange < -Math.PI) { - angleChange += (Math.PI * 2D); + angleChange += Math.PI * 2D; } while (angleChange >= Math.PI) { - angleChange -= (Math.PI * 2D); + angleChange -= Math.PI * 2D; } if (angleChange < -1.0D) { diff --git a/src/main/java/forestry/apiculture/tiles/TileBeeHousingBase.java b/src/main/java/forestry/apiculture/tiles/TileBeeHousingBase.java index 58e202d52..af4393a15 100644 --- a/src/main/java/forestry/apiculture/tiles/TileBeeHousingBase.java +++ b/src/main/java/forestry/apiculture/tiles/TileBeeHousingBase.java @@ -108,13 +108,13 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing double fxZ = zCoord + 0.5F; float distanceFromCenter = 0.6F; float leftRightSpreadFromCenter = distanceFromCenter * (world.rand.nextFloat() - 0.5F); - float upSpread = (world.rand.nextFloat() * 6F) / 16F; + float upSpread = world.rand.nextFloat() * 6F / 16F; fxY += upSpread; - Proxies.render.addEntityHoneyDustFX(world, (fxX - distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter)); - Proxies.render.addEntityHoneyDustFX(world, (fxX + distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter)); - Proxies.render.addEntityHoneyDustFX(world, (fxX + leftRightSpreadFromCenter), fxY, (fxZ - distanceFromCenter)); - Proxies.render.addEntityHoneyDustFX(world, (fxX + leftRightSpreadFromCenter), fxY, (fxZ + distanceFromCenter)); + Proxies.render.addEntityHoneyDustFX(world, fxX - distanceFromCenter, fxY, fxZ + leftRightSpreadFromCenter); + Proxies.render.addEntityHoneyDustFX(world, fxX + distanceFromCenter, fxY, fxZ + leftRightSpreadFromCenter); + Proxies.render.addEntityHoneyDustFX(world, fxX + leftRightSpreadFromCenter, fxY, fxZ - distanceFromCenter); + Proxies.render.addEntityHoneyDustFX(world, fxX + leftRightSpreadFromCenter, fxY, fxZ + distanceFromCenter); } @Override @@ -126,7 +126,7 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing @Override public int getHealthScaled(int i) { - return (breedingProgressPercent * i) / 100; + return breedingProgressPercent * i / 100; } @Override diff --git a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java index 0e89a8f2b..04c908408 100755 --- a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java +++ b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java @@ -85,7 +85,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { private void createBuildingBlocks(Random random) { if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) { - boolean fireproof = (random.nextInt(4) == 0); + boolean fireproof = random.nextInt(4) == 0; EnumWoodType roofWood = EnumWoodType.getRandom(random); EnumWoodType logWood = EnumWoodType.getRandom(random); diff --git a/src/main/java/forestry/apiculture/worldgen/HiveGen.java b/src/main/java/forestry/apiculture/worldgen/HiveGen.java index 9b7f25b98..a4c359042 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveGen.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveGen.java @@ -24,7 +24,7 @@ public abstract class HiveGen implements IHiveGen { public boolean canReplace(World world, BlockPos pos) { Block block = BlockUtil.getBlock(world, pos); Material material = block.getMaterial(); - return (material.isReplaceable() && !material.isLiquid()) || + return material.isReplaceable() && !material.isLiquid() || material == Material.air || material == Material.plants; } diff --git a/src/main/java/forestry/arboriculture/LeafDecayHelper.java b/src/main/java/forestry/arboriculture/LeafDecayHelper.java index 61c4af902..6c5da7355 100644 --- a/src/main/java/forestry/arboriculture/LeafDecayHelper.java +++ b/src/main/java/forestry/arboriculture/LeafDecayHelper.java @@ -74,8 +74,8 @@ public abstract class LeafDecayHelper { leafDecayValues[(xOffset + arrayOffset) * xArrayMult + (yOffset + arrayOffset + 1) * yArrayMult + zOffset + arrayOffset] = sustainedValue; } - if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult + (yOffset + arrayOffset) * yArrayMult + (zOffset + arrayOffset - 1)] == IS_LEAVES) { - leafDecayValues[(xOffset + arrayOffset) * xArrayMult + (yOffset + arrayOffset) * yArrayMult + (zOffset + arrayOffset - 1)] = sustainedValue; + if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult + (yOffset + arrayOffset) * yArrayMult + zOffset + arrayOffset - 1] == IS_LEAVES) { + leafDecayValues[(xOffset + arrayOffset) * xArrayMult + (yOffset + arrayOffset) * yArrayMult + zOffset + arrayOffset - 1] = sustainedValue; } if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult + (yOffset + arrayOffset) * yArrayMult + zOffset + arrayOffset + 1] == IS_LEAVES) { @@ -88,7 +88,7 @@ public abstract class LeafDecayHelper { } } - int sustainValue = leafDecayValues[(arrayOffset * xArrayMult) + (arrayOffset * yArrayMult) + arrayOffset]; + int sustainValue = leafDecayValues[arrayOffset * xArrayMult + arrayOffset * yArrayMult + arrayOffset]; if (sustainValue >= 0) { world.setBlockState(pos, state.getBlock().getStateFromMeta(leafMeta & -9), 4); // stop trying to decay diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbLog.java b/src/main/java/forestry/arboriculture/blocks/BlockArbLog.java index 21bc71e67..c9c6f793e 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbLog.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbLog.java @@ -105,7 +105,7 @@ public abstract class BlockArbLog extends BlockLog implements IWoodTyped, IState @Nonnull @Override public EnumWoodType getWoodType(int meta) { - int variantMeta = (meta & VARIANTS_META_MASK) + (blockNumber * VARIANTS_PER_BLOCK); + int variantMeta = (meta & VARIANTS_META_MASK) + blockNumber * VARIANTS_PER_BLOCK; return EnumWoodType.byMetadata(variantMeta); } @@ -128,6 +128,7 @@ public abstract class BlockArbLog extends BlockLog implements IWoodTyped, IState } } + @SuppressWarnings("incomplete-switch") @Override public int getMetaFromState(IBlockState state) { int i = damageDropped(state); @@ -160,7 +161,7 @@ public abstract class BlockArbLog extends BlockLog implements IWoodTyped, IState @Override public int damageDropped(IBlockState state) { - return state.getValue(getVariant()).getMetadata() - (blockNumber * VARIANTS_PER_BLOCK); + return state.getValue(getVariant()).getMetadata() - blockNumber * VARIANTS_PER_BLOCK; } @Override diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbPlanks.java b/src/main/java/forestry/arboriculture/blocks/BlockArbPlanks.java index d8de67a2c..8221eb18e 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbPlanks.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbPlanks.java @@ -104,7 +104,7 @@ public abstract class BlockArbPlanks extends Block implements IWoodTyped, IState @Nonnull @Override public EnumWoodType getWoodType(int meta) { - int variantMeta = (meta & VARIANTS_META_MASK) + (blockNumber * VARIANTS_PER_BLOCK); + int variantMeta = (meta & VARIANTS_META_MASK) + blockNumber * VARIANTS_PER_BLOCK; return EnumWoodType.byMetadata(variantMeta); } @@ -126,7 +126,7 @@ public abstract class BlockArbPlanks extends Block implements IWoodTyped, IState @Override public int damageDropped(IBlockState state) { - return state.getValue(getVariant()).getMetadata() - (blockNumber * VARIANTS_PER_BLOCK); + return state.getValue(getVariant()).getMetadata() - blockNumber * VARIANTS_PER_BLOCK; } @Override diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbSlab.java b/src/main/java/forestry/arboriculture/blocks/BlockArbSlab.java index 7a7ec721d..40e791c70 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbSlab.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbSlab.java @@ -127,14 +127,14 @@ public abstract class BlockArbSlab extends BlockSlab implements IWoodTyped, IIte @Nonnull @Override public EnumWoodType getWoodType(int meta) { - int variantMeta = (meta & VARIANTS_META_MASK) + (blockNumber * VARIANTS_PER_BLOCK); + int variantMeta = (meta & VARIANTS_META_MASK) + blockNumber * VARIANTS_PER_BLOCK; return EnumWoodType.byMetadata(variantMeta); } @Override public int getMetaFromState(IBlockState state) { EnumWoodType woodType = state.getValue(getVariant()); - int meta = woodType.getMetadata() - (blockNumber * VARIANTS_PER_BLOCK); + int meta = woodType.getMetadata() - blockNumber * VARIANTS_PER_BLOCK; if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) { meta |= 8; @@ -145,7 +145,7 @@ public abstract class BlockArbSlab extends BlockSlab implements IWoodTyped, IIte @Override public int damageDropped(IBlockState state) { - return state.getValue(getVariant()).getMetadata() - (blockNumber * VARIANTS_PER_BLOCK); + return state.getValue(getVariant()).getMetadata() - blockNumber * VARIANTS_PER_BLOCK; } @Override diff --git a/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java index 4d3f90c35..b117b4698 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java @@ -168,7 +168,7 @@ public abstract class BlockDecorativeLeaves extends Block implements IShearable, @Nonnull public TreeDefinition getTreeType(int meta) { - int variantMeta = (meta & VARIANTS_META_MASK) + (blockNumber * VARIANTS_PER_BLOCK); + int variantMeta = (meta & VARIANTS_META_MASK) + blockNumber * VARIANTS_PER_BLOCK; return TreeDefinition.byMetadata(variantMeta); } @@ -179,7 +179,7 @@ public abstract class BlockDecorativeLeaves extends Block implements IShearable, @Override public int damageDropped(IBlockState state) { - return state.getValue(getVariant()).getMetadata() - (blockNumber * VARIANTS_PER_BLOCK); + return state.getValue(getVariant()).getMetadata() - blockNumber * VARIANTS_PER_BLOCK; } @Override diff --git a/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java index a1bf4c4c7..db673456f 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java @@ -315,7 +315,7 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP ItemStack heldItem = player.getHeldItem(); TileEntity tile = world.getTileEntity(pos); IButterfly caterpillar = tile instanceof TileLeaves ? ((TileLeaves) tile).getCaterpillar() : null; - if (heldItem != null && (heldItem.getItem() instanceof IToolScoop) && caterpillar != null) { + if (heldItem != null && heldItem.getItem() instanceof IToolScoop && caterpillar != null) { ItemStack butterfly = ButterflyManager.butterflyRoot.getMemberStack(caterpillar, EnumFlutterType.CATERPILLAR.ordinal()); ItemStackUtil.dropItemStackAsEntity(butterfly, world, pos); ((TileLeaves) tile).setCaterpillar(null); diff --git a/src/main/java/forestry/arboriculture/commands/ForestSpawner.java b/src/main/java/forestry/arboriculture/commands/ForestSpawner.java index 7b3ffe0cd..ab27c0c9d 100644 --- a/src/main/java/forestry/arboriculture/commands/ForestSpawner.java +++ b/src/main/java/forestry/arboriculture/commands/ForestSpawner.java @@ -25,9 +25,9 @@ public class ForestSpawner implements ITreeSpawner { public boolean spawn(ICommandSender sender, String treeName, EntityPlayer player) throws SpeciesNotFoundException, TemplateNotFoundException { Vec3 look = player.getLookVec(); - int x = (int) Math.round(player.posX + (16 * look.xCoord)); + int x = (int) Math.round(player.posX + 16 * look.xCoord); int y = (int) Math.round(player.posY); - int z = (int) Math.round(player.posZ + (16 * look.zCoord)); + int z = (int) Math.round(player.posZ + 16 * look.zCoord); for (int i = 0; i < 16; i++) { int spawnX = x + player.worldObj.rand.nextInt(32) - 16; diff --git a/src/main/java/forestry/arboriculture/commands/TreeSpawner.java b/src/main/java/forestry/arboriculture/commands/TreeSpawner.java index 2d27c5061..e89e3e9f5 100644 --- a/src/main/java/forestry/arboriculture/commands/TreeSpawner.java +++ b/src/main/java/forestry/arboriculture/commands/TreeSpawner.java @@ -25,9 +25,9 @@ public class TreeSpawner implements ITreeSpawner { public boolean spawn(ICommandSender sender, String treeName, EntityPlayer player) throws SpeciesNotFoundException, TemplateNotFoundException { Vec3 look = player.getLookVec(); - int x = (int) Math.round(player.posX + (3 * look.xCoord)); + int x = (int) Math.round(player.posX + 3 * look.xCoord); int y = (int) Math.round(player.posY); - int z = (int) Math.round(player.posZ + (3 * look.zCoord)); + int z = (int) Math.round(player.posZ + 3 * look.zCoord); BlockPos pos = new BlockPos(x, y, z); WorldGenerator gen = TreeGenHelper.getWorldGen(treeName, player, pos); diff --git a/src/main/java/forestry/arboriculture/tiles/TileLeaves.java b/src/main/java/forestry/arboriculture/tiles/TileLeaves.java index 071d3cffc..3788036d6 100644 --- a/src/main/java/forestry/arboriculture/tiles/TileLeaves.java +++ b/src/main/java/forestry/arboriculture/tiles/TileLeaves.java @@ -168,7 +168,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru isFruitLeaf = fruitProvider.markAsFruitLeaf(genome, worldObj, getPos()); if (isFruitLeaf) { // Hardcoded because vanilla oak trees don't show fruits. - if ((species == TreeDefinition.Oak.getGenome().getPrimary()) && (fruitProvider == AlleleFruit.fruitApple.getProvider())) { + if (species == TreeDefinition.Oak.getGenome().getPrimary() && fruitProvider == AlleleFruit.fruitApple.getProvider()) { textureIndexFruits = -1; } else { textureIndexFruits = fruitProvider.getSpriteIndex(genome, worldObj, getPos(), getRipeningTime(), true); diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java index e483832d4..0f56a7cf5 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java @@ -184,7 +184,7 @@ public abstract class WorldGenArboriculture extends WorldGenBase { for (int x = 0; x < girth; x++) { for (int z = 0; z < girth; z++) { - if ((x > 0 && x < girth) && (z > 0 && z < girth)) { + if (x > 0 && x < girth && z > 0 && z < girth) { continue; } @@ -309,7 +309,7 @@ public abstract class WorldGenArboriculture extends WorldGenBase { @Override protected boolean addBlock(World world, BlockPos pos, ITreeBlockType type, EnumReplaceMode replace) { if (replace == EnumReplaceMode.ALL - || (replace == EnumReplaceMode.SOFT && BlockUtil.isReplaceableBlock(world, startPos.add(pos))) + || replace == EnumReplaceMode.SOFT && BlockUtil.isReplaceableBlock(world, startPos.add(pos)) || world.isAirBlock(startPos.add(pos))) { type.setBlock(world, tree, startPos.add(pos)); return true; diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenEbony.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenEbony.java index c7620f3cf..3d0e26935 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenEbony.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenEbony.java @@ -57,8 +57,8 @@ public class WorldGenEbony extends WorldGenTree { h = height / 2 + world.rand.nextInt(height / 2); } - int x_off = -(girth) + world.rand.nextInt(2 * girth); - int y_off = -(girth) + world.rand.nextInt(2 * girth); + int x_off = -girth + world.rand.nextInt(2 * girth); + int y_off = -girth + world.rand.nextInt(2 * girth); Vector center = new Vector(x_off, h, y_off); int radius = 1 + world.rand.nextInt(girth); diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenPadauk.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenPadauk.java index 61a463f3f..7843ed926 100644 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenPadauk.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenPadauk.java @@ -47,11 +47,11 @@ public class WorldGenPadauk extends WorldGenTree { if (world.rand.nextBoolean()) { int[] offset = {-1, 1}; - int offsetValue = (offset[new Random().nextInt(offset.length)]); + int offsetValue = offset[new Random().nextInt(offset.length)]; int maxBranchLength = 3; int branchLength = new Random().nextInt(maxBranchLength + 1); EnumFacing[] direction = {EnumFacing.NORTH, EnumFacing.EAST}; - EnumFacing directionValue = (direction[new Random().nextInt(direction.length)]); + EnumFacing directionValue = direction[new Random().nextInt(direction.length)]; int branchSpawn = leafSpawn; for (int j = 1; j < branchLength + 1; j++) { diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenSequoia.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenSequoia.java index 88f75e90a..ce6e5e190 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenSequoia.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenSequoia.java @@ -33,7 +33,7 @@ public class WorldGenSequoia extends WorldGenTree { generateTreeTrunk(world, height, girth); generateSupportStems(world, height, girth, 0.4f, 0.4f); - int topHeight = (height / 3) + world.rand.nextInt(height / 6); + int topHeight = height / 3 + world.rand.nextInt(height / 6); List branchCoords = new ArrayList<>(); for (int yBranch = topHeight; yBranch < height; yBranch++) { diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenTeak.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenTeak.java index 42bc6d281..38b959759 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenTeak.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenTeak.java @@ -27,7 +27,7 @@ public class WorldGenTeak extends WorldGenTree { public void generate(World world) { generateTreeTrunk(world, height, girth); - float leafMultiplier = (height / 6.0f); + float leafMultiplier = height / 6.0f; if (leafMultiplier > 2) { leafMultiplier = 2; } diff --git a/src/main/java/forestry/core/TickHandlerCoreServer.java b/src/main/java/forestry/core/TickHandlerCoreServer.java index a3171feec..88fb78d6e 100755 --- a/src/main/java/forestry/core/TickHandlerCoreServer.java +++ b/src/main/java/forestry/core/TickHandlerCoreServer.java @@ -68,7 +68,7 @@ public class TickHandlerCoreServer { Random random = new Random(worldSeed); long xSeed = random.nextLong() >> 2 + 1L; long zSeed = random.nextLong() >> 2 + 1L; - random.setSeed((xSeed * coords.xCoord + zSeed * coords.zCoord) ^ worldSeed); + random.setSeed(xSeed * coords.xCoord + zSeed * coords.zCoord ^ worldSeed); worldGenerator.retroGen(random, coords.xCoord, coords.zCoord, world); } diff --git a/src/main/java/forestry/core/access/AccessHandler.java b/src/main/java/forestry/core/access/AccessHandler.java index 85ca9ccf9..4877d3f67 100644 --- a/src/main/java/forestry/core/access/AccessHandler.java +++ b/src/main/java/forestry/core/access/AccessHandler.java @@ -73,6 +73,11 @@ public final class AccessHandler implements IAccessHandler { public final boolean allowsViewing(EntityPlayer player) { return allowsAlteration(player) || getAccess() == EnumAccess.VIEWABLE; } + + @Override + public boolean allowsInteracting(EntityPlayer player) { + return allowsAlteration(player); + } @Override public final boolean allowsPipeConnections() { diff --git a/src/main/java/forestry/core/access/FakeAccessHandler.java b/src/main/java/forestry/core/access/FakeAccessHandler.java index 511cf3c0f..db747aedf 100644 --- a/src/main/java/forestry/core/access/FakeAccessHandler.java +++ b/src/main/java/forestry/core/access/FakeAccessHandler.java @@ -58,7 +58,12 @@ public class FakeAccessHandler implements IAccessHandler { public boolean allowsViewing(EntityPlayer player) { return true; } - + + @Override + public boolean allowsInteracting(EntityPlayer player) { + return true; + } + @Override public boolean allowsPipeConnections() { return true; diff --git a/src/main/java/forestry/core/access/IAccessHandler.java b/src/main/java/forestry/core/access/IAccessHandler.java index 83ff223a2..3e4966433 100644 --- a/src/main/java/forestry/core/access/IAccessHandler.java +++ b/src/main/java/forestry/core/access/IAccessHandler.java @@ -27,6 +27,8 @@ public interface IAccessHandler extends IOwnable, IStreamable, INbtWritable, INb boolean allowsAlteration(EntityPlayer player); boolean allowsViewing(EntityPlayer player); + + boolean allowsInteracting(EntityPlayer player); boolean allowsPipeConnections(); diff --git a/src/main/java/forestry/core/blocks/BlockSoil.java b/src/main/java/forestry/core/blocks/BlockSoil.java index 4f2a4f64f..7db875825 100644 --- a/src/main/java/forestry/core/blocks/BlockSoil.java +++ b/src/main/java/forestry/core/blocks/BlockSoil.java @@ -109,7 +109,7 @@ public class BlockSoil extends Block implements IItemTyped, IItemModelRegister { @Override public int getDamageValue(World world, BlockPos pos) { - return (getMetaFromState(world.getBlockState(pos)) & 0x03); + return getMetaFromState(world.getBlockState(pos)) & 0x03; } @Override @@ -173,7 +173,7 @@ public class BlockSoil extends Block implements IItemTyped, IItemModelRegister { grade++; // Repackage in format TTGG - meta = (grade << 2 | type); + meta = grade << 2 | type; if (grade >= degradeDelimiter) { world.setBlockState(pos, Blocks.sand.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH); @@ -217,7 +217,7 @@ public class BlockSoil extends Block implements IItemTyped, IItemModelRegister { // Increment (de)gradation maturity++; - meta = (maturity << 2 | type); + meta = maturity << 2 | type; world.setBlockState(pos, BlockUtil.getBlock(world, pos).getStateFromMeta(meta), Constants.FLAG_BLOCK_SYNCH); world.markBlockForUpdate(pos); } diff --git a/src/main/java/forestry/core/commands/CommandPlugins.java b/src/main/java/forestry/core/commands/CommandPlugins.java index 8ec108d05..d0c1c6398 100644 --- a/src/main/java/forestry/core/commands/CommandPlugins.java +++ b/src/main/java/forestry/core/commands/CommandPlugins.java @@ -92,7 +92,7 @@ public class CommandPlugins extends SubCommand { continue; } - if ((info.pluginID().equalsIgnoreCase(pluginUid) || info.name().equalsIgnoreCase(pluginUid))) { + if (info.pluginID().equalsIgnoreCase(pluginUid) || info.name().equalsIgnoreCase(pluginUid)) { found = plugin; break; } diff --git a/src/main/java/forestry/core/entities/EntityFXHoneydust.java b/src/main/java/forestry/core/entities/EntityFXHoneydust.java index 1590cc6cf..59891a70e 100644 --- a/src/main/java/forestry/core/entities/EntityFXHoneydust.java +++ b/src/main/java/forestry/core/entities/EntityFXHoneydust.java @@ -17,8 +17,8 @@ public class EntityFXHoneydust extends EntityReddustFX { public EntityFXHoneydust(World world, double x, double y, double z, float f1, float f2, float f3) { super(world, x, y, z, 1.0F, f1, f2, f3); - particleRed = 0.9F + (world.rand.nextFloat() * 0.1F); - particleGreen = 0.75F + (world.rand.nextFloat() * 0.2F); - particleBlue = 0F + (world.rand.nextFloat() * 0.2F); + particleRed = 0.9F + world.rand.nextFloat() * 0.1F; + particleGreen = 0.75F + world.rand.nextFloat() * 0.2F; + particleBlue = 0F + world.rand.nextFloat() * 0.2F; } } diff --git a/src/main/java/forestry/core/entities/EntityFXIgnition.java b/src/main/java/forestry/core/entities/EntityFXIgnition.java index 789063b83..2cd4fadfd 100644 --- a/src/main/java/forestry/core/entities/EntityFXIgnition.java +++ b/src/main/java/forestry/core/entities/EntityFXIgnition.java @@ -30,7 +30,7 @@ public class EntityFXIgnition extends EntityFX { this.motionZ *= 0.8; this.motionY = this.rand.nextFloat() * 0.4F + 0.05F; this.particleRed = this.particleGreen = this.particleBlue = 1.0F; - this.particleScale *= (this.rand.nextFloat() / 2) + 0.3F; + this.particleScale *= this.rand.nextFloat() / 2 + 0.3F; this.ignitionParticleScale = this.particleScale; this.particleMaxAge = (int) (16.0 / (Math.random() * 0.8 + 0.2)); this.noClip = false; @@ -75,7 +75,7 @@ public class EntityFXIgnition extends EntityFX { float f = (float) this.particleAge / (float) this.particleMaxAge; - if (this.rand.nextFloat() > (f * 2)) { + if (this.rand.nextFloat() > f * 2) { this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ); } diff --git a/src/main/java/forestry/core/entities/EntityFXSnow.java b/src/main/java/forestry/core/entities/EntityFXSnow.java index 8838603ef..85c68f05a 100644 --- a/src/main/java/forestry/core/entities/EntityFXSnow.java +++ b/src/main/java/forestry/core/entities/EntityFXSnow.java @@ -40,9 +40,9 @@ public class EntityFXSnow extends EntityFX { @Override public void renderParticle(WorldRenderer worldRenderer, Entity entity, float timeStep, float rotationX, float rotationXZ, float rotationZ, float rotationYZ, float rotationXY) { - double x = (this.prevPosX + (this.posX - this.prevPosX) * timeStep - interpPosX); - double y = (this.prevPosY + (this.posY - this.prevPosY) * timeStep - interpPosY); - double z = (this.prevPosZ + (this.posZ - this.prevPosZ) * timeStep - interpPosZ); + double x = this.prevPosX + (this.posX - this.prevPosX) * timeStep - interpPosX; + double y = this.prevPosY + (this.posY - this.prevPosY) * timeStep - interpPosY; + double z = this.prevPosZ + (this.posZ - this.prevPosZ) * timeStep - interpPosZ; float minU = this.particleTextureIndexX / 16.0F; float maxU = minU + 0.0624375F; @@ -66,9 +66,9 @@ public class EntityFXSnow extends EntityFX { int i = this.getBrightnessForRender(timeStep); int j = i >> 16 & 65535; int k = i & 65535; - worldRenderer.pos((x - rotationX * scale - rotationYZ * scale), (y - rotationXZ * scale), (z - rotationZ * scale - rotationXY * scale)).tex(maxU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); - worldRenderer.pos((x - rotationX * scale + rotationYZ * scale), (y + rotationXZ * scale), (z - rotationZ * scale + rotationXY * scale)).tex(maxU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); - worldRenderer.pos((x + rotationX * scale + rotationYZ * scale), (y + rotationXZ * scale), (z + rotationZ * scale + rotationXY * scale)).tex(minU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); - worldRenderer.pos((x + rotationX * scale - rotationYZ * scale), (y - rotationXZ * scale), (z + rotationZ * scale - rotationXY * scale)).tex(minU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRenderer.pos(x - rotationX * scale - rotationYZ * scale, y - rotationXZ * scale, z - rotationZ * scale - rotationXY * scale).tex(maxU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRenderer.pos(x - rotationX * scale + rotationYZ * scale, y + rotationXZ * scale, z - rotationZ * scale + rotationXY * scale).tex(maxU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRenderer.pos(x + rotationX * scale + rotationYZ * scale, y + rotationXZ * scale, z + rotationZ * scale + rotationXY * scale).tex(minU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRenderer.pos(x + rotationX * scale - rotationYZ * scale, y - rotationXZ * scale, z + rotationZ * scale - rotationXY * scale).tex(minU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); } } diff --git a/src/main/java/forestry/core/fluids/FluidHelper.java b/src/main/java/forestry/core/fluids/FluidHelper.java index 11bad3a89..4948584c9 100644 --- a/src/main/java/forestry/core/fluids/FluidHelper.java +++ b/src/main/java/forestry/core/fluids/FluidHelper.java @@ -156,9 +156,9 @@ public final class FluidHelper { if (fluidInContainer == null) { return FillStatus.INVALID_INPUT; } - boolean moveToOutput = (fluidInContainer.amount >= containerCapacity); + boolean moveToOutput = fluidInContainer.amount >= containerCapacity; if (moveToOutput) { - if ((output != null) && (output.stackSize >= output.getMaxStackSize() || !InventoryUtil.isItemEqual(filled, output))) { + if (output != null && (output.stackSize >= output.getMaxStackSize() || !InventoryUtil.isItemEqual(filled, output))) { return FillStatus.NO_SPACE; } } else { diff --git a/src/main/java/forestry/core/fluids/tanks/StandardTank.java b/src/main/java/forestry/core/fluids/tanks/StandardTank.java index 69eb70319..8831dda6c 100644 --- a/src/main/java/forestry/core/fluids/tanks/StandardTank.java +++ b/src/main/java/forestry/core/fluids/tanks/StandardTank.java @@ -124,6 +124,7 @@ public class StandardTank extends FluidTank implements IStreamable { return fluid != null; } + @SuppressWarnings("incomplete-switch") public boolean canBeFilledExternally() { switch (tankMode) { case DEFAULT: @@ -133,6 +134,7 @@ public class StandardTank extends FluidTank implements IStreamable { return false; } + @SuppressWarnings("incomplete-switch") public boolean canBeDrainedExternally() { switch (tankMode) { case DEFAULT: @@ -156,7 +158,7 @@ public class StandardTank extends FluidTank implements IStreamable { public boolean canDrain(int amount) { FluidStack drained = drain(amount, false); - return (drained != null) && (drained.amount == amount); + return drained != null && drained.amount == amount; } public boolean canDrain(FluidStack toDrain) { diff --git a/src/main/java/forestry/core/genetics/alleles/AlleleSpecies.java b/src/main/java/forestry/core/genetics/alleles/AlleleSpecies.java index 956a9b4bd..7ceeb7869 100644 --- a/src/main/java/forestry/core/genetics/alleles/AlleleSpecies.java +++ b/src/main/java/forestry/core/genetics/alleles/AlleleSpecies.java @@ -105,7 +105,7 @@ public abstract class AlleleSpecies extends Allele implements IAlleleSpeciesBuil @Override public ItemStack[] getResearchBounty(World world, GameProfile researcher, IIndividual individual, int bountyLevel) { ItemStack research = null; - if (world.rand.nextFloat() < ((float) 10 / bountyLevel)) { + if (world.rand.nextFloat() < (float) 10 / bountyLevel) { Collection combinations = getRoot().getCombinations(this); if (combinations.size() > 0) { IMutation[] candidates = combinations.toArray(new IMutation[combinations.size()]); diff --git a/src/main/java/forestry/core/gui/ContainerEntity.java b/src/main/java/forestry/core/gui/ContainerEntity.java index 5b35582d5..389c09583 100644 --- a/src/main/java/forestry/core/gui/ContainerEntity.java +++ b/src/main/java/forestry/core/gui/ContainerEntity.java @@ -67,7 +67,7 @@ public class ContainerEntity extends ContainerFor IErrorLogicSource errorLogicSource = (IErrorLogicSource) entity; ImmutableSet errorStates = errorLogicSource.getErrorLogic().getErrorStates(); - if ((previousErrorStates == null) || !errorStates.equals(previousErrorStates)) { + if (previousErrorStates == null || !errorStates.equals(previousErrorStates)) { PacketErrorUpdateEntity packet = new PacketErrorUpdateEntity(entity, errorLogicSource); sendPacketToCrafters(packet); } diff --git a/src/main/java/forestry/core/gui/ContainerEscritoire.java b/src/main/java/forestry/core/gui/ContainerEscritoire.java index 6d8921021..4e2414aa8 100755 --- a/src/main/java/forestry/core/gui/ContainerEscritoire.java +++ b/src/main/java/forestry/core/gui/ContainerEscritoire.java @@ -42,7 +42,7 @@ public class ContainerEscritoire extends ContainerTile implement for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { - addSlotToContainer(new SlotOutput(this.tile, InventoryEscritoire.SLOT_RESULTS_1 + (i * 2) + j, 177 + j * 18, 85 + i * 18)); + addSlotToContainer(new SlotOutput(this.tile, InventoryEscritoire.SLOT_RESULTS_1 + i * 2 + j, 177 + j * 18, 85 + i * 18)); } } } diff --git a/src/main/java/forestry/core/gui/ContainerForestry.java b/src/main/java/forestry/core/gui/ContainerForestry.java index 76a5a79a3..d9918ea6d 100644 --- a/src/main/java/forestry/core/gui/ContainerForestry.java +++ b/src/main/java/forestry/core/gui/ContainerForestry.java @@ -71,7 +71,7 @@ public abstract class ContainerForestry extends Container { } } - Slot slot = (slotIndex < 0) ? null : getSlot(slotIndex); + Slot slot = slotIndex < 0 ? null : getSlot(slotIndex); if (slot instanceof SlotForestry) { SlotForestry slotForestry = (SlotForestry) slot; if (slotForestry.isPhantom()) { diff --git a/src/main/java/forestry/core/gui/ContainerTile.java b/src/main/java/forestry/core/gui/ContainerTile.java index d5c699309..32c9d2eb0 100644 --- a/src/main/java/forestry/core/gui/ContainerTile.java +++ b/src/main/java/forestry/core/gui/ContainerTile.java @@ -77,7 +77,7 @@ public abstract class ContainerTile extends ContainerFores IErrorLogicSource errorLogicSource = (IErrorLogicSource) tile; ImmutableSet errorStates = errorLogicSource.getErrorLogic().getErrorStates(); - if ((previousErrorStates == null) || !errorStates.equals(previousErrorStates)) { + if (previousErrorStates == null || !errorStates.equals(previousErrorStates)) { PacketErrorUpdate packet = new PacketErrorUpdate(tile, errorLogicSource); sendPacketToCrafters(packet); } diff --git a/src/main/java/forestry/core/gui/GuiAlyzer.java b/src/main/java/forestry/core/gui/GuiAlyzer.java index ab26799e1..d3aac42c0 100755 --- a/src/main/java/forestry/core/gui/GuiAlyzer.java +++ b/src/main/java/forestry/core/gui/GuiAlyzer.java @@ -112,8 +112,8 @@ public abstract class GuiAlyzer extends GuiForestry textLayout.drawLine(text0, textLayout.column0); int columnwidth = textLayout.column2 - textLayout.column1 - 2; - GuiUtil.drawItemStack(this, iconStacks.get(primary.getUID()), guiLeft + textLayout.column1 + (columnwidth - 20), guiTop + 10); - GuiUtil.drawItemStack(this, iconStacks.get(secondary.getUID()), guiLeft + textLayout.column2 + (columnwidth - 20), guiTop + 10); + GuiUtil.drawItemStack(this, iconStacks.get(primary.getUID()), guiLeft + textLayout.column1 + columnwidth - 20, guiTop + 10); + GuiUtil.drawItemStack(this, iconStacks.get(secondary.getUID()), guiLeft + textLayout.column2 + columnwidth - 20, guiTop + 10); String primaryName = customPrimaryName == null ? primary.getName() : customPrimaryName; String secondaryName = customSecondaryName == null ? secondary.getName() : customSecondaryName; @@ -225,7 +225,7 @@ public abstract class GuiAlyzer extends GuiForestry textLayout.drawSplitLine(tokens[0], 12, 200, 0x666666); if (tokens.length > 1) { String signature = "- " + tokens[1]; - fontRendererObj.drawStringWithShadow(signature, (guiLeft + 210) - fontRendererObj.getStringWidth(signature), guiTop + 145 - 14, 0x99cc32); + fontRendererObj.drawStringWithShadow(signature, guiLeft + 210 - fontRendererObj.getStringWidth(signature), guiTop + 145 - 14, 0x99cc32); } } diff --git a/src/main/java/forestry/core/gui/GuiIdRegistry.java b/src/main/java/forestry/core/gui/GuiIdRegistry.java index 3fe08aaa7..26e693390 100644 --- a/src/main/java/forestry/core/gui/GuiIdRegistry.java +++ b/src/main/java/forestry/core/gui/GuiIdRegistry.java @@ -44,6 +44,7 @@ import forestry.factory.tiles.TileStill; import forestry.factory.tiles.TileWorktable; import forestry.farming.tiles.TileFarm; import forestry.food.items.ItemInfuser; +import forestry.greenhouse.tiles.TileGreenhouse; import forestry.lepidopterology.items.ItemFlutterlyzer; import forestry.mail.items.ItemCatalogue; import forestry.mail.items.ItemLetter; @@ -82,6 +83,8 @@ public class GuiIdRegistry { TileStill.class, TileFarm.class, + + TileGreenhouse.class, TileEngineBiogas.class, TileEnginePeat.class, diff --git a/src/main/java/forestry/core/gui/TextLayoutHelper.java b/src/main/java/forestry/core/gui/TextLayoutHelper.java index 56eceb944..18dcab11d 100644 --- a/src/main/java/forestry/core/gui/TextLayoutHelper.java +++ b/src/main/java/forestry/core/gui/TextLayoutHelper.java @@ -60,7 +60,7 @@ public class TextLayoutHelper { } public void newLineCompressed() { - line += (LINE_HEIGHT - 2); + line += LINE_HEIGHT - 2; } public void newLine(int lineHeight) { diff --git a/src/main/java/forestry/core/gui/ledgers/LedgerManager.java b/src/main/java/forestry/core/gui/ledgers/LedgerManager.java index 9b96f2c14..bd8a78db0 100644 --- a/src/main/java/forestry/core/gui/ledgers/LedgerManager.java +++ b/src/main/java/forestry/core/gui/ledgers/LedgerManager.java @@ -74,8 +74,8 @@ public class LedgerManager { private Ledger getAtPosition(int mX, int mY) { if (ledgers.size() > 0) { - final int xShift = ((gui.width - gui.getSizeX()) / 2) + gui.getSizeX(); - int yShift = ((gui.height - gui.getSizeY()) / 2) + 8; + final int xShift = (gui.width - gui.getSizeX()) / 2 + gui.getSizeX(); + int yShift = (gui.height - gui.getSizeY()) / 2 + 8; for (Ledger ledger : ledgers) { if (!ledger.isVisible()) { @@ -92,8 +92,8 @@ public class LedgerManager { } } - final int xShiftError = ((gui.width - gui.getSizeX()) / 2); - int yShiftError = ((gui.height - gui.getSizeY()) / 2) + 8; + final int xShiftError = (gui.width - gui.getSizeX()) / 2; + int yShiftError = (gui.height - gui.getSizeY()) / 2 + 8; for (ErrorLedger errorLedger : errorLedgers) { if (!errorLedger.isVisible()) { diff --git a/src/main/java/forestry/core/gui/widgets/TankWidget.java b/src/main/java/forestry/core/gui/widgets/TankWidget.java index 840889bc0..8c1cb67ea 100755 --- a/src/main/java/forestry/core/gui/widgets/TankWidget.java +++ b/src/main/java/forestry/core/gui/widgets/TankWidget.java @@ -32,6 +32,7 @@ import forestry.core.gui.IContainerLiquidTanks; import forestry.core.gui.tooltips.ToolTip; import forestry.core.proxy.Proxies; import forestry.farming.gui.ContainerFarm; +import forestry.greenhouse.gui.ContainerGreenhouse; /** * Slot for liquid tanks @@ -61,6 +62,8 @@ public class TankWidget extends Widget { return ((IContainerLiquidTanks) container).getTank(slot); } else if (container instanceof ContainerFarm) { return ((ContainerFarm) container).getTank(slot); + }else if (container instanceof ContainerGreenhouse) { + return ((ContainerGreenhouse) container).getTank(slot); } return null; } @@ -95,7 +98,7 @@ public class TankWidget extends Widget { int fluidColor = fluid.getColor(contents); - int scaledAmount = (contents.amount * height) / tank.getCapacity(); + int scaledAmount = contents.amount * height / tank.getCapacity(); if (contents.amount > 0 && scaledAmount < 1) { scaledAmount = 1; } @@ -107,18 +110,18 @@ public class TankWidget extends Widget { setGLColorFromInt(fluidColor); final int xTileCount = width / 16; - final int xRemainder = width - (xTileCount * 16); + final int xRemainder = width - xTileCount * 16; final int yTileCount = scaledAmount / 16; - final int yRemainder = scaledAmount - (yTileCount * 16); + final int yRemainder = scaledAmount - yTileCount * 16; final int yStart = startY + height; for (int xTile = 0; xTile <= xTileCount; xTile++) { for (int yTile = 0; yTile <= yTileCount; yTile++) { - int width = (xTile == xTileCount) ? xRemainder : 16; - int height = (yTile == yTileCount) ? yRemainder : 16; - int x = startX + (xTile * 16); - int y = yStart - ((yTile + 1) * 16); + int width = xTile == xTileCount ? xRemainder : 16; + int height = yTile == yTileCount ? yRemainder : 16; + int x = startX + xTile * 16; + int y = yStart - (yTile + 1) * 16; if (width > 0 && height > 0) { int maskTop = 16 - height; int maskRight = 16 - width; @@ -159,8 +162,8 @@ public class TankWidget extends Widget { double uMax = textureSprite.getMaxU(); double vMin = textureSprite.getMinV(); double vMax = textureSprite.getMaxV(); - uMax = uMax - (maskRight / 16.0 * (uMax - uMin)); - vMax = vMax - (maskTop / 16.0 * (vMax - vMin)); + uMax = uMax - maskRight / 16.0 * (uMax - uMin); + vMax = vMax - maskTop / 16.0 * (vMax - vMin); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); diff --git a/src/main/java/forestry/core/models/ModelBlockOverlay.java b/src/main/java/forestry/core/models/ModelBlockOverlay.java index c9e33b000..0ff8c5bcf 100644 --- a/src/main/java/forestry/core/models/ModelBlockOverlay.java +++ b/src/main/java/forestry/core/models/ModelBlockOverlay.java @@ -63,8 +63,9 @@ public abstract class ModelBlockOverlay implements IFlexibleBak @Override public boolean isAmbientOcclusion() { - if(latestItemModel == null && latestBlockModel == null) + if(latestItemModel == null && latestBlockModel == null) { return false; + } return latestBlockModel != null ? latestBlockModel.isAmbientOcclusion() : latestItemModel.isAmbientOcclusion(); } @@ -75,29 +76,33 @@ public abstract class ModelBlockOverlay implements IFlexibleBak @Override public boolean isBuiltInRenderer() { - if(latestItemModel == null && latestBlockModel == null) + if(latestItemModel == null && latestBlockModel == null) { return false; + } return latestBlockModel != null ? latestBlockModel.isBuiltInRenderer() : latestItemModel.isBuiltInRenderer(); } @Override public TextureAtlasSprite getParticleTexture() { - if(latestBlockModel != null) + if(latestBlockModel != null) { return latestBlockModel.getParticleTexture(); + } return null; } @Override public ItemCameraTransforms getItemCameraTransforms() { - if(latestItemModel == null) + if(latestItemModel == null) { return null; + } return latestItemModel.getItemCameraTransforms(); } @Override public VertexFormat getFormat() { - if(latestItemModel == null && latestBlockModel == null) + if(latestItemModel == null && latestBlockModel == null) { return DefaultVertexFormats.BLOCK; + } return latestBlockModel != null ? latestBlockModel.getFormat() : latestItemModel.getFormat(); } diff --git a/src/main/java/forestry/core/models/baker/ModelBaker.java b/src/main/java/forestry/core/models/baker/ModelBaker.java index dfdc125ac..92cf7b077 100644 --- a/src/main/java/forestry/core/models/baker/ModelBaker.java +++ b/src/main/java/forestry/core/models/baker/ModelBaker.java @@ -65,8 +65,9 @@ public class ModelBaker implements IModelBaker { @Override public void setRenderBoundsFromBlock(@Nonnull Block block) { - if (block == null) + if (block == null) { return; + } renderMinX = block.getBlockBoundsMinX(); renderMinY = block.getBlockBoundsMinY(); @@ -280,8 +281,9 @@ public class ModelBaker implements IModelBaker { public IModelBakerModel bakeModel(boolean flip) { ModelRotation mr = ModelRotation.X0_Y0; - if (flip) + if (flip) { mr = ModelRotation.X0_Y180; + } for (ModelBakerFace face : faces) { final EnumFacing myFace = face.face; @@ -293,10 +295,11 @@ public class ModelBaker implements IModelBaker { BakedQuad bf = faceBakery.makeBakedQuad(face.to, face.from, bpf, face.spite, myFace, mr, null, true, true); bf = new IColoredBakedQuad.ColoredBakedQuad(bf.getVertexData(), face.colorIndex, bf.getFace()); - if (face.isEdge) + if (face.isEdge) { this.currentModel.getFaceQuads(myFace).add(bf); - else + } else { this.currentModel.getGeneralQuads().add(bf); + } } //Add baked models to the current model. diff --git a/src/main/java/forestry/core/models/baker/ModelBakerModel.java b/src/main/java/forestry/core/models/baker/ModelBakerModel.java index 103b4fae2..a04fefcb9 100644 --- a/src/main/java/forestry/core/models/baker/ModelBakerModel.java +++ b/src/main/java/forestry/core/models/baker/ModelBakerModel.java @@ -43,8 +43,9 @@ public class ModelBakerModel implements IModelBakerModel { public ModelBakerModel() { general = new ArrayList(); - for (EnumFacing f : EnumFacing.VALUES) + for (EnumFacing f : EnumFacing.VALUES) { faces[f.ordinal()] = new ArrayList(); + } formate = DefaultVertexFormats.BLOCK; isGui3d = true; isAmbientOcclusion = false; diff --git a/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java b/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java index 49f7b1f54..563e4e5bc 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java +++ b/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java @@ -109,7 +109,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI if (!connectedParts.add(part)) { Log.warning("[%s] Controller %s is double-adding part %d @ %s. This is unusual. " + "If you encounter odd behavior, please tear down the machine and rebuild it.", - (worldObj.isRemote ? "CLIENT" : "SERVER"), hashCode(), part.hashCode(), coord); + worldObj.isRemote ? "CLIENT" : "SERVER", hashCode(), part.hashCode(), coord); } MultiblockLogic logic = (MultiblockLogic) part.getMultiblockLogic(); @@ -580,7 +580,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI } protected final boolean isCoordInMultiblock(int x, int y, int z) { - return (x >= minimumCoord.getX() && x <= maximumCoord.getX()) && (y >= minimumCoord.getY() && y <= maximumCoord.getY()) && (z >= minimumCoord.getZ() && z <= maximumCoord.getZ()); + return x >= minimumCoord.getX() && x <= maximumCoord.getX() && y >= minimumCoord.getY() && y <= maximumCoord.getY() && z >= minimumCoord.getZ() && z <= maximumCoord.getZ(); } @Override diff --git a/src/main/java/forestry/core/multiblock/MultiblockLogic.java b/src/main/java/forestry/core/multiblock/MultiblockLogic.java index deda9a24d..c2688c606 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockLogic.java +++ b/src/main/java/forestry/core/multiblock/MultiblockLogic.java @@ -130,7 +130,7 @@ public abstract class MultiblockLogic i @Override public final boolean isConnected() { - return (controller != null); + return controller != null; } public final void becomeMultiblockSaveDelegate() { diff --git a/src/main/java/forestry/core/network/packets/PacketPipetteClick.java b/src/main/java/forestry/core/network/packets/PacketPipetteClick.java index 0337d39d1..b143409b1 100644 --- a/src/main/java/forestry/core/network/packets/PacketPipetteClick.java +++ b/src/main/java/forestry/core/network/packets/PacketPipetteClick.java @@ -31,7 +31,7 @@ public class PacketPipetteClick extends PacketSlotClick implements IForestryPack @Override public void onPacketData(DataInputStreamForestry data, EntityPlayerMP player) throws IOException { - if ((player.openContainer instanceof IContainerLiquidTanks)) { + if (player.openContainer instanceof IContainerLiquidTanks) { ((IContainerLiquidTanks) player.openContainer).handlePipetteClick(getSlot(), player); } } diff --git a/src/main/java/forestry/core/proxy/ProxyNetwork.java b/src/main/java/forestry/core/proxy/ProxyNetwork.java index 9403e5af3..5704863ef 100755 --- a/src/main/java/forestry/core/proxy/ProxyNetwork.java +++ b/src/main/java/forestry/core/proxy/ProxyNetwork.java @@ -48,7 +48,7 @@ public class ProxyNetwork { } public void sendToPlayer(IForestryPacketClient packet, EntityPlayer entityplayer) { - if (!(entityplayer instanceof EntityPlayerMP) || (entityplayer instanceof FakePlayer)) { + if (!(entityplayer instanceof EntityPlayerMP) || entityplayer instanceof FakePlayer) { return; } diff --git a/src/main/java/forestry/core/recipes/RecipeUtil.java b/src/main/java/forestry/core/recipes/RecipeUtil.java index 0611c5fbb..49d0d30b7 100644 --- a/src/main/java/forestry/core/recipes/RecipeUtil.java +++ b/src/main/java/forestry/core/recipes/RecipeUtil.java @@ -290,7 +290,7 @@ public abstract class RecipeUtil { if (widthIt >= 0 && heightIt >= 0 && widthIt < width && heightIt < height) { if (mirror) { - recipeIngredient = recipeIngredients[(width - widthIt - 1) + heightIt * width]; + recipeIngredient = recipeIngredients[width - widthIt - 1 + heightIt * width]; } else { recipeIngredient = recipeIngredients[widthIt + heightIt * width]; } diff --git a/src/main/java/forestry/core/recipes/ShapedRecipeCustom.java b/src/main/java/forestry/core/recipes/ShapedRecipeCustom.java index bff07190e..5d3324c16 100644 --- a/src/main/java/forestry/core/recipes/ShapedRecipeCustom.java +++ b/src/main/java/forestry/core/recipes/ShapedRecipeCustom.java @@ -54,7 +54,7 @@ public class ShapedRecipeCustom extends ShapedOreRecipe implements IDescriptiveR } if (recipe[idx] instanceof String[]) { - String[] parts = ((String[]) recipe[idx++]); + String[] parts = (String[]) recipe[idx++]; for (String s : parts) { width = s.length(); diff --git a/src/main/java/forestry/core/render/ParticleHelper.java b/src/main/java/forestry/core/render/ParticleHelper.java index 3cb867244..1c8afba39 100644 --- a/src/main/java/forestry/core/render/ParticleHelper.java +++ b/src/main/java/forestry/core/render/ParticleHelper.java @@ -49,9 +49,9 @@ public class ParticleHelper { } float b = 0.1F; - double px = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (b * 2.0F)) + b + block.getBlockBoundsMinX(); - double py = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (b * 2.0F)) + b + block.getBlockBoundsMinY(); - double pz = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (b * 2.0F)) + b + block.getBlockBoundsMinZ(); + double px = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - b * 2.0F) + b + block.getBlockBoundsMinX(); + double py = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - b * 2.0F) + b + block.getBlockBoundsMinY(); + double pz = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - b * 2.0F) + b + block.getBlockBoundsMinZ(); if (sideHit == EnumFacing.DOWN) { py = y + block.getBlockBoundsMinY() - b; diff --git a/src/main/java/forestry/core/tiles/AdjacentTileCache.java b/src/main/java/forestry/core/tiles/AdjacentTileCache.java index 0f081e062..f69f4379d 100644 --- a/src/main/java/forestry/core/tiles/AdjacentTileCache.java +++ b/src/main/java/forestry/core/tiles/AdjacentTileCache.java @@ -140,7 +140,7 @@ public final class AdjacentTileCache { public boolean hasTriggered(World world, int ticks) { long currentTime = world.getTotalWorldTime(); - if (currentTime >= (ticks + startTime) || startTime > currentTime) { + if (currentTime >= ticks + startTime || startTime > currentTime) { startTime = currentTime; return true; } diff --git a/src/main/java/forestry/core/tiles/ICamouflagedBlock.java b/src/main/java/forestry/core/tiles/ICamouflagedBlock.java deleted file mode 100644 index 848c18b8c..000000000 --- a/src/main/java/forestry/core/tiles/ICamouflagedBlock.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ -package forestry.core.tiles; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; - -public interface ICamouflagedBlock { - - ItemStack getCamouflageBlock(); - - boolean setCamouflageBlock(ItemStack camouflageBlock); - - BlockPos getCoordinates(); - - CamouflageType getType(); - - public enum CamouflageType{ - DEFAULT, GLASS - } - -} diff --git a/src/main/java/forestry/core/tiles/TileAnalyzer.java b/src/main/java/forestry/core/tiles/TileAnalyzer.java index 5b936b7ce..2e14e5b40 100644 --- a/src/main/java/forestry/core/tiles/TileAnalyzer.java +++ b/src/main/java/forestry/core/tiles/TileAnalyzer.java @@ -173,7 +173,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui ItemStack specimen = getStackInSlot(InventoryAnalyzer.SLOT_ANALYZE); - boolean hasSpecimen = (specimen != null); + boolean hasSpecimen = specimen != null; boolean hasResource = true; boolean hasSpace = true; diff --git a/src/main/java/forestry/core/tiles/TileForestry.java b/src/main/java/forestry/core/tiles/TileForestry.java index 3bf3b7f03..3d608b201 100644 --- a/src/main/java/forestry/core/tiles/TileForestry.java +++ b/src/main/java/forestry/core/tiles/TileForestry.java @@ -88,7 +88,7 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE } public void rotateAfterPlacement(EntityPlayer player, EnumFacing side) { - int l = MathHelper.floor_double(((player.rotationYaw * 4F) / 360F) + 0.5D) & 3; + int l = MathHelper.floor_double(player.rotationYaw * 4F / 360F + 0.5D) & 3; if (l == 0) { setOrientation(EnumFacing.NORTH); } diff --git a/src/main/java/forestry/core/tiles/TilePowered.java b/src/main/java/forestry/core/tiles/TilePowered.java index 0ea10a33e..95b8b9810 100644 --- a/src/main/java/forestry/core/tiles/TilePowered.java +++ b/src/main/java/forestry/core/tiles/TilePowered.java @@ -144,7 +144,7 @@ public abstract class TilePowered extends TileBase implements IRenderableTile, I return 0; } - return (workCounter * i) / ticksPerWorkCycle; + return workCounter * i / ticksPerWorkCycle; } @Override diff --git a/src/main/java/forestry/core/utils/BlockUtil.java b/src/main/java/forestry/core/utils/BlockUtil.java index 6dccdb418..880f9be52 100644 --- a/src/main/java/forestry/core/utils/BlockUtil.java +++ b/src/main/java/forestry/core/utils/BlockUtil.java @@ -145,8 +145,8 @@ public abstract class BlockUtil { * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. */ public static MovingObjectPosition collisionRayTrace(@Nonnull BlockPos pos, @Nonnull Vec3 startVec, @Nonnull Vec3 endVec, double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { - startVec = startVec.addVector((-pos.getX()), (-pos.getY()), (-pos.getZ())); - endVec = endVec.addVector((-pos.getX()), (-pos.getY()), (-pos.getZ())); + startVec = startVec.addVector(-pos.getX(), -pos.getY(), -pos.getZ()); + endVec = endVec.addVector(-pos.getX(), -pos.getY(), -pos.getZ()); Vec3 vec32 = startVec.getIntermediateWithXValue(endVec, minX); Vec3 vec33 = startVec.getIntermediateWithXValue(endVec, maxX); Vec3 vec34 = startVec.getIntermediateWithYValue(endVec, minY); @@ -241,21 +241,21 @@ public abstract class BlockUtil { * Checks if a vector is within the Y and Z bounds of the block. */ private static boolean isVecInsideYZBounds(Vec3 vec, double minY, double minZ, double maxY, double maxZ) { - return vec != null && (vec.yCoord >= minY && vec.yCoord <= maxY && vec.zCoord >= minZ && vec.zCoord <= maxZ); + return vec != null && vec.yCoord >= minY && vec.yCoord <= maxY && vec.zCoord >= minZ && vec.zCoord <= maxZ; } /** * Checks if a vector is within the X and Z bounds of the block. */ private static boolean isVecInsideXZBounds(Vec3 vec, double minX, double minZ, double maxX, double maxZ) { - return vec != null && (vec.xCoord >= minX && vec.xCoord <= maxX && vec.zCoord >= minZ && vec.zCoord <= maxZ); + return vec != null && vec.xCoord >= minX && vec.xCoord <= maxX && vec.zCoord >= minZ && vec.zCoord <= maxZ; } /** * Checks if a vector is within the X and Y bounds of the block. */ private static boolean isVecInsideXYBounds(Vec3 vec, double minX, double minY, double maxX, double maxY) { - return vec != null && (vec.xCoord >= minX && vec.xCoord <= maxX && vec.yCoord >= minY && vec.yCoord <= maxY); + return vec != null && vec.xCoord >= minX && vec.xCoord <= maxX && vec.yCoord >= minY && vec.yCoord <= maxY; } /* CHUNKS */ diff --git a/src/main/java/forestry/core/utils/ColourUtil.java b/src/main/java/forestry/core/utils/ColourUtil.java index 2e12231a5..ffb34e504 100644 --- a/src/main/java/forestry/core/utils/ColourUtil.java +++ b/src/main/java/forestry/core/utils/ColourUtil.java @@ -15,30 +15,30 @@ public class ColourUtil { public static int rgbToBgr(int rgb) { int r = rgb >> 16 & 0xFF; int b = rgb & 0xFF; - return rgb & 0xFF00FF00 | r | (b << 16); + return rgb & 0xFF00FF00 | r | b << 16; } public static int addRGBComponents(int colour, int r, int g, int b) { r = ((colour & 0xff0000) >> 16) + r; g = ((colour & 0xff00) >> 8) + g; - b = ((colour & 0xff)) + b; + b = (colour & 0xff) + b; r = r <= 255 ? r : 255; g = g <= 255 ? g : 255; b = b <= 255 ? b : 255; - return ((r & 0x0ff) << 16) | ((g & 0x0ff) << 8) | (b & 0x0ff); + return (r & 0x0ff) << 16 | (g & 0x0ff) << 8 | b & 0x0ff; } public static int multiplyRGBComponents(int colour, float factor) { int r = (int) (((colour & 0xff0000) >> 16) * factor); int g = (int) (((colour & 0xff00) >> 8) * factor); - int b = (int) (((colour & 0xff)) * factor); + int b = (int) ((colour & 0xff) * factor); r = r <= 255 ? r : 255; g = g <= 255 ? g : 255; b = b <= 255 ? b : 255; - return ((r & 0x0ff) << 16) | ((g & 0x0ff) << 8) | (b & 0x0ff); + return (r & 0x0ff) << 16 | (g & 0x0ff) << 8 | b & 0x0ff; } } diff --git a/src/main/java/forestry/core/utils/InventoryUtil.java b/src/main/java/forestry/core/utils/InventoryUtil.java index 032265961..5e63e265d 100644 --- a/src/main/java/forestry/core/utils/InventoryUtil.java +++ b/src/main/java/forestry/core/utils/InventoryUtil.java @@ -405,7 +405,7 @@ public abstract class InventoryUtil { if (stackMax == 0) { return false; } - return ((float) amount / (float) stackMax) >= percent; + return (float) amount / (float) stackMax >= percent; } public static boolean isEmpty(IInventory inventory, int slotStart, int slotCount) { @@ -465,7 +465,7 @@ public abstract class InventoryUtil { public static boolean tryAddStack(IInventory inventory, ItemStack stack, int startSlot, int slots, boolean all, boolean doAdd) { int added = addStack(inventory, stack, startSlot, slots, false); - boolean success = all ? (added == stack.stackSize) : (added > 0); + boolean success = all ? added == stack.stackSize : added > 0; if (success && doAdd) { addStack(inventory, stack, startSlot, slots, true); diff --git a/src/main/java/forestry/core/utils/ItemStackUtil.java b/src/main/java/forestry/core/utils/ItemStackUtil.java index 0a02745da..a04f266b0 100644 --- a/src/main/java/forestry/core/utils/ItemStackUtil.java +++ b/src/main/java/forestry/core/utils/ItemStackUtil.java @@ -160,7 +160,7 @@ public abstract class ItemStackUtil { return; } - if (giver.stackSize <= (receptor.getMaxStackSize() - receptor.stackSize)) { + if (giver.stackSize <= receptor.getMaxStackSize() - receptor.stackSize) { receptor.stackSize += giver.stackSize; giver.stackSize = 0; return; @@ -199,7 +199,7 @@ public abstract class ItemStackUtil { boolean matched = false; for (ItemStack cached : condensed) { - if ((cached.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(cached, stack))) { + if (cached.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(cached, stack)) { cached.stackSize += stack.stackSize; matched = true; } @@ -392,9 +392,9 @@ public abstract class ItemStackUtil { } float f1 = 0.7F; - double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; - double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; - double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; + double d = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5D; + double d1 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5D; + double d2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5D; EntityItem entityitem = new EntityItem(world, x + d, y + d1, z + d2, items); entityitem.setPickupDelay(delayForPickup); diff --git a/src/main/java/forestry/core/utils/SlotUtil.java b/src/main/java/forestry/core/utils/SlotUtil.java index cdc9ea3f4..9c1239374 100644 --- a/src/main/java/forestry/core/utils/SlotUtil.java +++ b/src/main/java/forestry/core/utils/SlotUtil.java @@ -23,7 +23,7 @@ import forestry.core.gui.slots.SlotForestry; public abstract class SlotUtil { public static boolean isSlotInRange(int slotIndex, int start, int count) { - return (slotIndex >= start) && (slotIndex < start + count); + return slotIndex >= start && slotIndex < start + count; } public static ItemStack slotClickPhantom(SlotForestry slot, int mouseButton, int modifier, EntityPlayer player) { @@ -70,7 +70,7 @@ public abstract class SlotUtil { return null; } - boolean fromCraftingSlot = (slot instanceof SlotCrafting); + boolean fromCraftingSlot = slot instanceof SlotCrafting; int numSlots = inventorySlots.size(); ItemStack stackInSlot = slot.getStack(); diff --git a/src/main/java/forestry/core/utils/vect/Vect.java b/src/main/java/forestry/core/utils/vect/Vect.java index df75f3aef..5c4ef7943 100644 --- a/src/main/java/forestry/core/utils/vect/Vect.java +++ b/src/main/java/forestry/core/utils/vect/Vect.java @@ -136,6 +136,6 @@ public class Vect extends IVect { return false; } Vect other = (Vect) obj; - return (getX() == other.getX()) && (getY() == other.getY()) && (getZ() == other.getZ()); + return getX() == other.getX() && getY() == other.getY() && getZ() == other.getZ(); } } diff --git a/src/main/java/forestry/core/worldgen/WorldGenBase.java b/src/main/java/forestry/core/worldgen/WorldGenBase.java index c581b474b..311e36bc9 100755 --- a/src/main/java/forestry/core/worldgen/WorldGenBase.java +++ b/src/main/java/forestry/core/worldgen/WorldGenBase.java @@ -89,7 +89,7 @@ public abstract class WorldGenBase extends WorldGenerator { for (int z = (int) start.z; z < (int) start.z + area.z; z++) { Vector position = new Vector(x, y, z); Vector treeCenter = new Vector(center.x, y, center.z); - if (Vector.distance(position, treeCenter) <= (radius) + 0.01) { + if (Vector.distance(position, treeCenter) <= radius + 0.01) { EnumFacing direction = Vector.direction(position, treeCenter); block.setDirection(direction); addBlock(world, new BlockPos(x, y, z), block, replace); @@ -116,7 +116,7 @@ public abstract class WorldGenBase extends WorldGenerator { } double distance = Vector.distance(new Vector(x, y, z), new Vector(center.x, y, center.z)); - if ((radius - width - 0.01 < distance && distance <= (radius) + 0.01)) { + if (radius - width - 0.01 < distance && distance <= radius + 0.01) { addBlock(world, new BlockPos(x, y, z), block, replace); } } @@ -130,7 +130,7 @@ public abstract class WorldGenBase extends WorldGenerator { for (int x = (int) start.x; x < (int) start.x + area.x; x++) { for (int y = (int) start.y; y < (int) start.y + area.y; y++) { for (int z = (int) start.z; z < (int) start.z + area.z; z++) { - if (Vector.distance(new Vector(x, y, z), new Vector(center.x, center.y, center.z)) <= (radius) + 0.01) { + if (Vector.distance(new Vector(x, y, z), new Vector(center.x, center.y, center.z)) <= radius + 0.01) { addBlock(world, new BlockPos(x, y, z), block, replace); } } diff --git a/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java b/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java index 247908df4..8f2ea755a 100755 --- a/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java +++ b/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java @@ -39,20 +39,20 @@ public class WorldGenMinableMeta extends WorldGenerator { boolean hasGenerated = false; float randomBase = random.nextFloat() * 3.141593F; - double d = (pos.getX() + 8) + (MathHelper.sin(randomBase) * numberOfBlocks) / 8F; - double d1 = (pos.getX() + 8) - (MathHelper.sin(randomBase) * numberOfBlocks) / 8F; - double d2 = (pos.getZ() + 8) + (MathHelper.cos(randomBase) * numberOfBlocks) / 8F; - double d3 = (pos.getZ() + 8) - (MathHelper.cos(randomBase) * numberOfBlocks) / 8F; - double d4 = (pos.getY() + random.nextInt(3)) - 2; - double d5 = (pos.getY() + random.nextInt(3)) - 2; + double d = pos.getX() + 8 + MathHelper.sin(randomBase) * numberOfBlocks / 8F; + double d1 = pos.getX() + 8 - MathHelper.sin(randomBase) * numberOfBlocks / 8F; + double d2 = pos.getZ() + 8 + MathHelper.cos(randomBase) * numberOfBlocks / 8F; + double d3 = pos.getZ() + 8 - MathHelper.cos(randomBase) * numberOfBlocks / 8F; + double d4 = pos.getY() + random.nextInt(3) - 2; + double d5 = pos.getY() + random.nextInt(3) - 2; for (int l = 0; l <= numberOfBlocks; l++) { - double d6 = d + ((d1 - d) * l) / numberOfBlocks; - double d7 = d4 + ((d5 - d4) * l) / numberOfBlocks; - double d8 = d2 + ((d3 - d2) * l) / numberOfBlocks; - double d9 = (random.nextDouble() * numberOfBlocks) / 16D; - double d10 = (MathHelper.sin((l * 3.141593F) / numberOfBlocks) + 1.0F) * d9 + 1.0D; - double d11 = (MathHelper.sin((l * 3.141593F) / numberOfBlocks) + 1.0F) * d9 + 1.0D; + double d6 = d + (d1 - d) * l / numberOfBlocks; + double d7 = d4 + (d5 - d4) * l / numberOfBlocks; + double d8 = d2 + (d3 - d2) * l / numberOfBlocks; + double d9 = random.nextDouble() * numberOfBlocks / 16D; + double d10 = (MathHelper.sin(l * 3.141593F / numberOfBlocks) + 1.0F) * d9 + 1.0D; + double d11 = (MathHelper.sin(l * 3.141593F / numberOfBlocks) + 1.0F) * d9 + 1.0D; int xStart = MathHelper.floor_double(d6 - d10 / 2D); int yStart = MathHelper.floor_double(d7 - d11 / 2D); int zStart = MathHelper.floor_double(d8 - d10 / 2D); @@ -61,19 +61,19 @@ public class WorldGenMinableMeta extends WorldGenerator { int zEnd = MathHelper.floor_double(d8 + d10 / 2D); for (int targetX = xStart; targetX <= xEnd; targetX++) { - double d12 = ((targetX + 0.5D) - d6) / (d10 / 2D); + double d12 = (targetX + 0.5D - d6) / (d10 / 2D); if (d12 * d12 >= 1.0D) { continue; } for (int targetY = yStart; targetY <= yEnd; targetY++) { - double d13 = ((targetY + 0.5D) - d7) / (d11 / 2D); + double d13 = (targetY + 0.5D - d7) / (d11 / 2D); if (d12 * d12 + d13 * d13 >= 1.0D) { continue; } for (int targetZ = zStart; targetZ <= zEnd; targetZ++) { - double d14 = ((targetZ + 0.5D) - d8) / (d10 / 2D); + double d14 = (targetZ + 0.5D - d8) / (d10 / 2D); BlockPos target = new BlockPos(targetX, targetY, targetZ); if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlockState(target).getBlock() == Blocks.stone) { world.setBlockState(target, mineableBlock.getStateFromMeta(mineableBlockMeta), Constants.FLAG_BLOCK_SYNCH); diff --git a/src/main/java/forestry/energy/blocks/BlockEngine.java b/src/main/java/forestry/energy/blocks/BlockEngine.java index 49d262465..24df5291f 100644 --- a/src/main/java/forestry/energy/blocks/BlockEngine.java +++ b/src/main/java/forestry/energy/blocks/BlockEngine.java @@ -96,7 +96,7 @@ public class BlockEngine extends BlockBase { AxisAlignedBB boundingBox = boundingBoxBase.offset(pos.getX(), pos.getY(), pos.getZ()); MovingObjectPosition intersection = boundingBox.calculateIntercept(start, end); if (intersection != null) { - if (nearestIntersection == null || (intersection.hitVec.distanceTo(start) < nearestIntersection.hitVec.distanceTo(start))) { + if (nearestIntersection == null || intersection.hitVec.distanceTo(start) < nearestIntersection.hitVec.distanceTo(start)) { nearestIntersection = intersection; } } diff --git a/src/main/java/forestry/energy/gui/GuiEngine.java b/src/main/java/forestry/energy/gui/GuiEngine.java index 5e6e3d335..b02d01768 100755 --- a/src/main/java/forestry/energy/gui/GuiEngine.java +++ b/src/main/java/forestry/energy/gui/GuiEngine.java @@ -59,7 +59,7 @@ public abstract class GuiEngine exten drawText(inventory.getEnergyManager().getEnergyStored(inventory.getOrientation()) + " RF", x + 22, y + 56); drawSubheader(StringUtil.localize("gui.heat") + ':', x + 22, y + 68); - drawText((((double) inventory.getHeat() / (double) 10) + 20.0) + " C", x + 22, y + 80); + drawText((double) inventory.getHeat() / (double) 10 + 20.0 + " C", x + 22, y + 80); } @Override diff --git a/src/main/java/forestry/energy/tiles/TileEngineBiogas.java b/src/main/java/forestry/energy/tiles/TileEngineBiogas.java index b7d22ef2d..d8241ea97 100644 --- a/src/main/java/forestry/energy/tiles/TileEngineBiogas.java +++ b/src/main/java/forestry/energy/tiles/TileEngineBiogas.java @@ -225,11 +225,11 @@ public class TileEngineBiogas extends TileEngine implements ISidedInventory, ILi return 0; } - return (burnTank.getFluidAmount() * i) / burnTank.getCapacity(); + return burnTank.getFluidAmount() * i / burnTank.getCapacity(); } public int getOperatingTemperatureScaled(int i) { - return (int) Math.round((heat * i) / (maxHeat * 0.2)); + return (int) Math.round(heat * i / (maxHeat * 0.2)); } @Override diff --git a/src/main/java/forestry/energy/tiles/TileEngineClockwork.java b/src/main/java/forestry/energy/tiles/TileEngineClockwork.java index 4190fd4c8..618c33556 100644 --- a/src/main/java/forestry/energy/tiles/TileEngineClockwork.java +++ b/src/main/java/forestry/energy/tiles/TileEngineClockwork.java @@ -62,7 +62,7 @@ public class TileEngineClockwork extends TileEngine { } player.addExhaustion(WIND_EXHAUSTION); - if (tension > ENGINE_CLOCKWORK_WIND_MAX + (0.1 * WIND_TENSION_BASE)) { + if (tension > ENGINE_CLOCKWORK_WIND_MAX + 0.1 * WIND_TENSION_BASE) { player.attackEntityFrom(damageSourceEngineClockwork, 6); } tension = tension > ENGINE_CLOCKWORK_WIND_MAX + WIND_TENSION_BASE ? ENGINE_CLOCKWORK_WIND_MAX + WIND_TENSION_BASE : tension; @@ -145,7 +145,7 @@ public class TileEngineClockwork extends TileEngine { return 0; } - float fromClockwork = (tension / ENGINE_CLOCKWORK_WIND_MAX) * Constants.ENGINE_PISTON_SPEED_MAX; + float fromClockwork = tension / ENGINE_CLOCKWORK_WIND_MAX * Constants.ENGINE_PISTON_SPEED_MAX; fromClockwork = Math.round(fromClockwork * 100f) / 100f; diff --git a/src/main/java/forestry/energy/tiles/TileEnginePeat.java b/src/main/java/forestry/energy/tiles/TileEnginePeat.java index ee65f8b65..6718a8c4b 100644 --- a/src/main/java/forestry/energy/tiles/TileEnginePeat.java +++ b/src/main/java/forestry/energy/tiles/TileEnginePeat.java @@ -164,7 +164,7 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory { if (isBurning()) { heatToAdd++; - if (((double) energyManager.getTotalEnergyStored() / (double) energyManager.getMaxEnergyStored()) > 0.5) { + if ((double) energyManager.getTotalEnergyStored() / (double) energyManager.getMaxEnergyStored() > 0.5) { heatToAdd++; } } @@ -251,7 +251,7 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory { return 0; } - return (burnTime * i) / totalBurnTime; + return burnTime * i / totalBurnTime; } @Override @@ -262,7 +262,7 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory { } IInventoryAdapter inventory = getInternalInventory(); - return ((float) inventory.getStackInSlot(fuelSlot).stackSize / (float) inventory.getStackInSlot(fuelSlot).getMaxStackSize()) > percentage; + return (float) inventory.getStackInSlot(fuelSlot).stackSize / (float) inventory.getStackInSlot(fuelSlot).getMaxStackSize() > percentage; } // / LOADING AND SAVING diff --git a/src/main/java/forestry/factory/PluginFactory.java b/src/main/java/forestry/factory/PluginFactory.java index b1b823ff3..2b08f61cf 100644 --- a/src/main/java/forestry/factory/PluginFactory.java +++ b/src/main/java/forestry/factory/PluginFactory.java @@ -277,7 +277,7 @@ public class PluginFactory extends BlankForestryPlugin { RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.cactus), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cactus"), Fluids.BIOMASS); RecipeUtil.addFermenterRecipes(new ItemStack(Items.wheat), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS); - RecipeUtil.addFermenterRecipes(new ItemStack(Items.potato), (2 * ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat")), Fluids.BIOMASS); + RecipeUtil.addFermenterRecipes(new ItemStack(Items.potato), 2 * ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS); RecipeUtil.addFermenterRecipes(new ItemStack(Items.reeds), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cane"), Fluids.BIOMASS); RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.brown_mushroom), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS); RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.red_mushroom), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS); diff --git a/src/main/java/forestry/factory/gui/GuiWorktable.java b/src/main/java/forestry/factory/gui/GuiWorktable.java index fb75d16f9..2f8c1f2f3 100755 --- a/src/main/java/forestry/factory/gui/GuiWorktable.java +++ b/src/main/java/forestry/factory/gui/GuiWorktable.java @@ -37,9 +37,9 @@ public class GuiWorktable extends GuiForestryTitled { return true; } - if (SlotUtil.isSlotInRange(slotIndex, SLOT_STASH_1, (SLOT_STASH_COUNT + SLOT_RESERVOIR_COUNT))) { + if (SlotUtil.isSlotInRange(slotIndex, SLOT_STASH_1, SLOT_STASH_COUNT + SLOT_RESERVOIR_COUNT)) { return !FuelManager.moistenerResource.containsKey(itemstack); } diff --git a/src/main/java/forestry/factory/recipes/jei/carpenter/CarpenterRecipeCategory.java b/src/main/java/forestry/factory/recipes/jei/carpenter/CarpenterRecipeCategory.java index 33aa75211..9e16dc450 100644 --- a/src/main/java/forestry/factory/recipes/jei/carpenter/CarpenterRecipeCategory.java +++ b/src/main/java/forestry/factory/recipes/jei/carpenter/CarpenterRecipeCategory.java @@ -69,7 +69,7 @@ public class CarpenterRecipeCategory extends ForestryRecipeCategory { for (int y = 0; y < 3; ++y) { for (int x = 0; x < 3; ++x) { - int index = craftInputSlot + x + (y * 3); + int index = craftInputSlot + x + y * 3; guiItemStacks.init(index, true, x * 18, 3 + y * 18); } } diff --git a/src/main/java/forestry/factory/recipes/jei/fabricator/FabricatorRecipeCategory.java b/src/main/java/forestry/factory/recipes/jei/fabricator/FabricatorRecipeCategory.java index ad24af7e2..c599ae559 100644 --- a/src/main/java/forestry/factory/recipes/jei/fabricator/FabricatorRecipeCategory.java +++ b/src/main/java/forestry/factory/recipes/jei/fabricator/FabricatorRecipeCategory.java @@ -63,7 +63,7 @@ public class FabricatorRecipeCategory extends ForestryRecipeCategory { for (int y = 0; y < 3; ++y) { for (int x = 0; x < 3; ++x) { - int index = craftInputSlot + x + (y * 3); + int index = craftInputSlot + x + y * 3; guiItemStacks.init(index, true, 46 + x * 18, y * 18); } } diff --git a/src/main/java/forestry/factory/tiles/TileBottler.java b/src/main/java/forestry/factory/tiles/TileBottler.java index 7ca70f612..bd05dda27 100644 --- a/src/main/java/forestry/factory/tiles/TileBottler.java +++ b/src/main/java/forestry/factory/tiles/TileBottler.java @@ -114,7 +114,7 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid currentRecipe = BottlerRecipe.getRecipe(resource, emptyCan); if (currentRecipe != null) { float viscosityMultiplier = resource.getFluid().getViscosity(resource) / 1000.0f; - viscosityMultiplier = ((viscosityMultiplier - 1f) / 20f) + 1f; // scale down the effect + viscosityMultiplier = (viscosityMultiplier - 1f) / 20f + 1f; // scale down the effect int fillAmount = Math.min(currentRecipe.input.amount, resource.amount); float fillTime = fillAmount / (float) Constants.BUCKET_VOLUME; @@ -133,7 +133,7 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid return false; } - return ((float) inventory.getStackInSlot(InventoryBottler.SLOT_INPUT_EMPTY_CAN).stackSize / (float) inventory.getStackInSlot(InventoryBottler.SLOT_INPUT_EMPTY_CAN).getMaxStackSize()) > percentage; + return (float) inventory.getStackInSlot(InventoryBottler.SLOT_INPUT_EMPTY_CAN).stackSize / (float) inventory.getStackInSlot(InventoryBottler.SLOT_INPUT_EMPTY_CAN).getMaxStackSize() > percentage; } @Override diff --git a/src/main/java/forestry/factory/tiles/TileCarpenter.java b/src/main/java/forestry/factory/tiles/TileCarpenter.java index 06befe4e3..498ca1b48 100644 --- a/src/main/java/forestry/factory/tiles/TileCarpenter.java +++ b/src/main/java/forestry/factory/tiles/TileCarpenter.java @@ -197,7 +197,7 @@ public class TileCarpenter extends TilePowered implements ISidedInventory, ILiqu checkRecipe(); } - boolean hasRecipe = (currentRecipe != null); + boolean hasRecipe = currentRecipe != null; boolean hasLiquidResources = true; boolean hasItemResources = true; boolean canAdd = true; diff --git a/src/main/java/forestry/factory/tiles/TileCentrifuge.java b/src/main/java/forestry/factory/tiles/TileCentrifuge.java index 9c443ae76..a541141f0 100644 --- a/src/main/java/forestry/factory/tiles/TileCentrifuge.java +++ b/src/main/java/forestry/factory/tiles/TileCentrifuge.java @@ -180,7 +180,7 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn return false; } - return ((float) inventory.getStackInSlot(InventoryCentrifuge.SLOT_RESOURCE).stackSize / (float) inventory.getStackInSlot(InventoryCentrifuge.SLOT_RESOURCE).getMaxStackSize()) > percentage; + return (float) inventory.getStackInSlot(InventoryCentrifuge.SLOT_RESOURCE).stackSize / (float) inventory.getStackInSlot(InventoryCentrifuge.SLOT_RESOURCE).getMaxStackSize() > percentage; } @Override diff --git a/src/main/java/forestry/factory/tiles/TileFabricator.java b/src/main/java/forestry/factory/tiles/TileFabricator.java index a32d8ecc2..4b7b8794c 100644 --- a/src/main/java/forestry/factory/tiles/TileFabricator.java +++ b/src/main/java/forestry/factory/tiles/TileFabricator.java @@ -115,7 +115,7 @@ public class TileFabricator extends TilePowered implements ISlotPickupWatcher, I if (!moltenTank.isEmpty()) { // Remove smelt if we have gone below melting point - if (heat < (getMeltingPoint() - 100)) { + if (heat < getMeltingPoint() - 100) { moltenTank.drain(5, true); } } @@ -260,7 +260,7 @@ public class TileFabricator extends TilePowered implements ISlotPickupWatcher, I } public int getHeatScaled(int i) { - return (heat * i) / MAX_HEAT; + return heat * i / MAX_HEAT; } private int getMeltingPoint() { @@ -282,7 +282,7 @@ public class TileFabricator extends TilePowered implements ISlotPickupWatcher, I if (meltingPoint <= 0) { return 0; } else { - return (meltingPoint * i) / MAX_HEAT; + return meltingPoint * i / MAX_HEAT; } } diff --git a/src/main/java/forestry/factory/tiles/TileFermenter.java b/src/main/java/forestry/factory/tiles/TileFermenter.java index a9e494591..3a351b06c 100644 --- a/src/main/java/forestry/factory/tiles/TileFermenter.java +++ b/src/main/java/forestry/factory/tiles/TileFermenter.java @@ -158,7 +158,7 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu currentRecipe = FermenterRecipeManager.findMatchingRecipe(resource, fluid); - fermentationTotalTime = fermentationTime = (currentRecipe == null) ? 0 : currentRecipe.getFermentationValue(); + fermentationTotalTime = fermentationTime = currentRecipe == null ? 0 : currentRecipe.getFermentationValue(); if (currentRecipe != null) { currentResourceModifier = determineResourceMod(resource); @@ -203,7 +203,7 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu return false; } - return ((float) fermentationStack.stackSize / (float) fermentationStack.getMaxStackSize()) > percentage; + return (float) fermentationStack.stackSize / (float) fermentationStack.getMaxStackSize() > percentage; } @Override @@ -213,7 +213,7 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu return false; } - return ((float) fuelStack.stackSize / (float) fuelStack.getMaxStackSize()) > percentage; + return (float) fuelStack.stackSize / (float) fuelStack.getMaxStackSize() > percentage; } @Override @@ -221,7 +221,7 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu checkRecipe(); checkFuel(); - boolean hasRecipe = (currentRecipe != null); + boolean hasRecipe = currentRecipe != null; boolean hasFuel = fuelBurnTime > 0; boolean hasResource = fermentationTime > 0 || getStackInSlot(InventoryFermenter.SLOT_RESOURCE) != null; boolean hasFluidResource = resourceTank.canDrain(fuelCurrentFerment); @@ -248,7 +248,7 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu return 0; } - return (fuelBurnTime * i) / fuelTotalTime; + return fuelBurnTime * i / fuelTotalTime; } public int getFermentationProgressScaled(int i) { @@ -256,7 +256,7 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu return 0; } - return (fermentationTime * i) / fermentationTotalTime; + return fermentationTime * i / fermentationTotalTime; } @Override diff --git a/src/main/java/forestry/factory/tiles/TileMillRainmaker.java b/src/main/java/forestry/factory/tiles/TileMillRainmaker.java index 221c29f58..fbb2e636b 100644 --- a/src/main/java/forestry/factory/tiles/TileMillRainmaker.java +++ b/src/main/java/forestry/factory/tiles/TileMillRainmaker.java @@ -87,15 +87,15 @@ public class TileMillRainmaker extends TileMill { (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F); float f = getPos().getX() + 0.5F; - float f1 = getPos().getY() + 0.0F + (worldObj.rand.nextFloat() * 6F) / 16F; + float f1 = getPos().getY() + 0.0F + worldObj.rand.nextFloat() * 6F / 16F; float f2 = getPos().getZ() + 0.5F; float f3 = 0.52F; float f4 = worldObj.rand.nextFloat() * 0.6F - 0.3F; - Proxies.render.addEntityExplodeFX(worldObj, (f - f3), f1, (f2 + f4)); - Proxies.render.addEntityExplodeFX(worldObj, (f + f3), f1, (f2 + f4)); - Proxies.render.addEntityExplodeFX(worldObj, (f + f4), f1, (f2 - f3)); - Proxies.render.addEntityExplodeFX(worldObj, (f + f4), f1, (f2 + f3)); + Proxies.render.addEntityExplodeFX(worldObj, f - f3, f1, f2 + f4); + Proxies.render.addEntityExplodeFX(worldObj, f + f3, f1, f2 + f4); + Proxies.render.addEntityExplodeFX(worldObj, f + f4, f1, f2 - f3); + Proxies.render.addEntityExplodeFX(worldObj, f + f4, f1, f2 + f3); } if (!worldObj.isRemote) { diff --git a/src/main/java/forestry/factory/tiles/TileMoistener.java b/src/main/java/forestry/factory/tiles/TileMoistener.java index eece3a865..c2c5941b0 100644 --- a/src/main/java/forestry/factory/tiles/TileMoistener.java +++ b/src/main/java/forestry/factory/tiles/TileMoistener.java @@ -428,7 +428,7 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT } } - return ((float) avail / (float) max) > percentage; + return (float) avail / (float) max > percentage; } public boolean hasResourcesMin(float percentage) { @@ -437,7 +437,7 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT return false; } - return ((float) inventory.getStackInSlot(InventoryMoistener.SLOT_RESOURCE).stackSize / (float) inventory.getStackInSlot(InventoryMoistener.SLOT_RESOURCE).getMaxStackSize()) > percentage; + return (float) inventory.getStackInSlot(InventoryMoistener.SLOT_RESOURCE).stackSize / (float) inventory.getStackInSlot(InventoryMoistener.SLOT_RESOURCE).getMaxStackSize() > percentage; } public boolean isProducing() { @@ -449,7 +449,7 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT return 0; } - return (productionTime * i) / timePerItem; + return productionTime * i / timePerItem; } @@ -458,12 +458,12 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT return 0; } - return (burnTime * i) / totalTime; + return burnTime * i / totalTime; } public int getResourceScaled(int i) { - return (resourceTank.getFluidAmount() * i) / Constants.PROCESSOR_TANK_CAPACITY; + return resourceTank.getFluidAmount() * i / Constants.PROCESSOR_TANK_CAPACITY; } /* IRenderableTile */ diff --git a/src/main/java/forestry/factory/tiles/TileRaintank.java b/src/main/java/forestry/factory/tiles/TileRaintank.java index fb353d85e..4f3edc22e 100644 --- a/src/main/java/forestry/factory/tiles/TileRaintank.java +++ b/src/main/java/forestry/factory/tiles/TileRaintank.java @@ -152,7 +152,7 @@ public class TileRaintank extends TileBase implements ISidedInventory, ILiquidTa } public int getFillProgressScaled(int i) { - return (fillingTime * i) / Constants.RAINTANK_FILLING_TIME; + return fillingTime * i / Constants.RAINTANK_FILLING_TIME; } /* SMP GUI */ diff --git a/src/main/java/forestry/factory/tiles/TileSqueezer.java b/src/main/java/forestry/factory/tiles/TileSqueezer.java index 76d57d81a..ad387a284 100644 --- a/src/main/java/forestry/factory/tiles/TileSqueezer.java +++ b/src/main/java/forestry/factory/tiles/TileSqueezer.java @@ -137,7 +137,7 @@ public class TileSqueezer extends TilePowered implements ISocketable, ISidedInve FluidStack resultFluid = currentRecipe.getFluidOutput(); productTank.fill(resultFluid, true); - if (currentRecipe.getRemnants() != null && (worldObj.rand.nextFloat() < currentRecipe.getRemnantsChance())) { + if (currentRecipe.getRemnants() != null && worldObj.rand.nextFloat() < currentRecipe.getRemnantsChance()) { ItemStack remnant = currentRecipe.getRemnants().copy(); inventory.addRemnant(remnant, true); } @@ -180,7 +180,7 @@ public class TileSqueezer extends TilePowered implements ISocketable, ISidedInve boolean canAdd = true; if (hasResources) { - hasRecipe = (currentRecipe != null); + hasRecipe = currentRecipe != null; if (hasRecipe) { FluidStack resultFluid = currentRecipe.getFluidOutput(); canFill = productTank.canFill(resultFluid); diff --git a/src/main/java/forestry/factory/tiles/TileStill.java b/src/main/java/forestry/factory/tiles/TileStill.java index 98a3257b9..eb4bf0666 100644 --- a/src/main/java/forestry/factory/tiles/TileStill.java +++ b/src/main/java/forestry/factory/tiles/TileStill.java @@ -140,7 +140,7 @@ public class TileStill extends TilePowered implements ISidedInventory, ILiquidTa public boolean hasWork() { checkRecipe(); - boolean hasRecipe = (currentRecipe != null); + boolean hasRecipe = currentRecipe != null; boolean hasTankSpace = true; boolean hasLiquidResource = true; diff --git a/src/main/java/forestry/farming/blocks/BlockMushroom.java b/src/main/java/forestry/farming/blocks/BlockMushroom.java index 5bd1e7028..29d2b1bb5 100644 --- a/src/main/java/forestry/farming/blocks/BlockMushroom.java +++ b/src/main/java/forestry/farming/blocks/BlockMushroom.java @@ -127,7 +127,7 @@ public class BlockMushroom extends BlockBush implements IItemTyped, IItemModelRe if (maturity != 3) { maturity = 3; int matX = maturity << 2; - int meta = (matX | type.ordinal()); + int meta = matX | type.ordinal(); world.setBlockState(new BlockPos(i, j, k), world.getBlockState(new BlockPos(i, j, k)).getBlock().getStateFromMeta(meta), Constants.FLAG_BLOCK_SYNCH); } else if (lightvalue <= 7) { generateTree(world, new BlockPos(i, j, k), world.getBlockState(new BlockPos(i, j, k)), random); diff --git a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java index 8db4c1813..200df8c6c 100644 --- a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java +++ b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java @@ -228,7 +228,7 @@ public class FarmLogicOrchard extends FarmLogic { Block candidate = VectUtil.getBlock(world, position); for (Block block : traversalBlocks) { - if (block == (candidate)) { + if (block == candidate) { return true; } } diff --git a/src/main/java/forestry/farming/logic/FarmableStacked.java b/src/main/java/forestry/farming/logic/FarmableStacked.java index 93f005362..ee0630aef 100755 --- a/src/main/java/forestry/farming/logic/FarmableStacked.java +++ b/src/main/java/forestry/farming/logic/FarmableStacked.java @@ -42,10 +42,10 @@ public class FarmableStacked implements IFarmable { @Override public ICrop getCropAt(World world, BlockPos pos) { - if (BlockUtil.getBlock(world, new BlockPos(pos.getX(), pos.getY() + (matureHeight - 1), pos.getZ())) != block) { + if (BlockUtil.getBlock(world, new BlockPos(pos.getX(), pos.getY() + matureHeight - 1, pos.getZ())) != block) { return null; } - return new CropBlock(world, block, matureMeta, new Vect(pos.getX(), pos.getY() + (matureHeight - 1), pos.getZ())); + return new CropBlock(world, block, matureMeta, new Vect(pos.getX(), pos.getY() + matureHeight - 1, pos.getZ())); } @Override diff --git a/src/main/java/forestry/farming/multiblock/FarmController.java b/src/main/java/forestry/farming/multiblock/FarmController.java index 0c2bd8947..44024a7b1 100644 --- a/src/main/java/forestry/farming/multiblock/FarmController.java +++ b/src/main/java/forestry/farming/multiblock/FarmController.java @@ -430,7 +430,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen @Override public int[] getArea() { if (area == null) { - area = new int[]{7 + (allowedExtent * 2), 13, 7 + (allowedExtent * 2)}; + area = new int[]{7 + allowedExtent * 2, 13, 7 + allowedExtent * 2}; } return area; } diff --git a/src/main/java/forestry/farming/multiblock/FarmFertilizerManager.java b/src/main/java/forestry/farming/multiblock/FarmFertilizerManager.java index a35ea124c..df819e8cd 100644 --- a/src/main/java/forestry/farming/multiblock/FarmFertilizerManager.java +++ b/src/main/java/forestry/farming/multiblock/FarmFertilizerManager.java @@ -77,7 +77,7 @@ public class FarmFertilizerManager implements INbtWritable, INbtReadable, IStrea return 0; } - return (storedFertilizer * scale) / (fertilizerValue + BUFFER_FERTILIZER); + return storedFertilizer * scale / (fertilizerValue + BUFFER_FERTILIZER); } @Override diff --git a/src/main/java/forestry/farming/multiblock/FarmHydrationManager.java b/src/main/java/forestry/farming/multiblock/FarmHydrationManager.java index 8f7d0e35b..8b8278d15 100644 --- a/src/main/java/forestry/farming/multiblock/FarmHydrationManager.java +++ b/src/main/java/forestry/farming/multiblock/FarmHydrationManager.java @@ -84,7 +84,7 @@ public class FarmHydrationManager implements IFarmLedgerDelegate, INbtWritable, @Override public double getDrought() { - return Math.round(((double) ticksSinceRainfall / 24000) * 10) / 10.; + return Math.round((double) ticksSinceRainfall / 24000 * 10) / 10.; } @Override diff --git a/src/main/java/forestry/farming/tiles/TileFarmGearbox.java b/src/main/java/forestry/farming/tiles/TileFarmGearbox.java index 3b3c22dfb..9f178c3ac 100644 --- a/src/main/java/forestry/farming/tiles/TileFarmGearbox.java +++ b/src/main/java/forestry/farming/tiles/TileFarmGearbox.java @@ -70,7 +70,7 @@ public class TileFarmGearbox extends TileFarm implements IEnergyReceiver, IEnerg workCounter++; } - if (workCounter >= WORK_CYCLES && (tickCount % 5 == 0)) { + if (workCounter >= WORK_CYCLES && tickCount % 5 == 0) { IFarmController farmController = getMultiblockLogic().getController(); if (farmController.doWork()) { workCounter = 0; diff --git a/src/main/java/forestry/farming/triggers/TriggerLowLiquid.java b/src/main/java/forestry/farming/triggers/TriggerLowLiquid.java index c726a1f23..aedd853f6 100755 --- a/src/main/java/forestry/farming/triggers/TriggerLowLiquid.java +++ b/src/main/java/forestry/farming/triggers/TriggerLowLiquid.java @@ -53,6 +53,6 @@ public class TriggerLowLiquid extends Trigger { if (tank.getCapacity() == 0) { return false; } - return ((float) tank.getFluidAmount() / tank.getCapacity()) <= threshold; + return (float) tank.getFluidAmount() / tank.getCapacity() <= threshold; } } diff --git a/src/main/java/forestry/food/inventory/ItemInventoryInfuser.java b/src/main/java/forestry/food/inventory/ItemInventoryInfuser.java index b3a05dd9a..24c4a0ff2 100644 --- a/src/main/java/forestry/food/inventory/ItemInventoryInfuser.java +++ b/src/main/java/forestry/food/inventory/ItemInventoryInfuser.java @@ -76,8 +76,8 @@ public class ItemInventoryInfuser extends ItemInventory { break; } - if ((ghost.getItemDamage() >= 0 && ingredient.isItemEqual(ghost)) - || (ghost.getItemDamage() < 0 && ghost.getItem() == ingredient.getItem())) { + if (ghost.getItemDamage() >= 0 && ingredient.isItemEqual(ghost) + || ghost.getItemDamage() < 0 && ghost.getItem() == ingredient.getItem()) { ItemStack removed = decrStackSize(i, 1); ghost.stackSize -= removed.stackSize; } diff --git a/src/main/java/forestry/greenhouse/GreenhouseItemAccess.java b/src/main/java/forestry/greenhouse/GreenhouseItemAccess.java new file mode 100644 index 000000000..e94afd825 --- /dev/null +++ b/src/main/java/forestry/greenhouse/GreenhouseItemAccess.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.greenhouse; + +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Nonnull; + +import com.google.common.collect.Lists; + +import forestry.api.core.EnumCamouflageType; +import forestry.api.greenhouse.IGreenhouseItemAccess; +import forestry.core.utils.Log; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +public class GreenhouseItemAccess implements IGreenhouseItemAccess { + + private final List greenhouseGlass = Lists.newArrayList(); + private final Map> camouflageBlockBlacklist = new EnumMap(EnumCamouflageType.class); + + public GreenhouseItemAccess() { + for(EnumCamouflageType type : EnumCamouflageType.VALUES){ + camouflageBlockBlacklist.put(type, new ArrayList()); + } + } + + @Override + public void registerGreenhouseGlass(@Nonnull ItemStack glass) { + if(glass == null || glass.getItem() == null){ + Log.error("Fail to register greenhouse glass, because it is null"); + return; + } + Block block = Block.getBlockFromItem(glass.getItem()); + if(block == null || block.isOpaqueCube()){ + Log.error("Fail to register greenhouse glass: " + block + "."); + return; + } + for(ItemStack greenhouseGlass : greenhouseGlass){ + if(greenhouseGlass.getItem() == glass.getItem() && greenhouseGlass.getItemDamage() == glass.getItemDamage() && ItemStack.areItemStackTagsEqual(glass, greenhouseGlass)){ + Log.error("Fail to register greenhouse glass, because it is already registered: " + glass + "."); + return; + } + } + greenhouseGlass.add(glass); + } + + @Override + public boolean isGreenhouseGlass(@Nonnull ItemStack glass) { + if(glass == null || glass.getItem() == null || Block.getBlockFromItem(glass.getItem()) == null) { + return false; + } + for(ItemStack greenhouseGlass : greenhouseGlass){ + if(greenhouseGlass.getItem() == glass.getItem() && greenhouseGlass.getItemDamage() == glass.getItemDamage() && ItemStack.areItemStackTagsEqual(glass, greenhouseGlass)){ + return true; + } + } + return false; + } + + @Override + public void addToCamouflageBlockBlackList(@Nonnull EnumCamouflageType type, @Nonnull ItemStack camouflageBlock) { + if(camouflageBlock == null || camouflageBlock.getItem() == null){ + Log.error("Fail to add camouflage block item to the black list, because it is null"); + return; + } + Block block = Block.getBlockFromItem(camouflageBlock.getItem()); + if(block == null){ + Log.error("Fail to add camouflage block item to the black list: because it has no block."); + return; + } + for(ItemStack camouflageBlacklisted : camouflageBlockBlacklist.get(type)){ + if(camouflageBlacklisted.getItem() == camouflageBlock.getItem() && camouflageBlacklisted.getItemDamage() == camouflageBlock.getItemDamage() && ItemStack.areItemStackTagsEqual(camouflageBlock, camouflageBlacklisted)){ + Log.error("Fail to add camouflage block item to the black list, because it is already registered: " + camouflageBlock + "."); + return; + } + } + camouflageBlockBlacklist.get(type).add(camouflageBlock); + } + + @Override + public boolean isOnCamouflageBlockBlackList(@Nonnull EnumCamouflageType type, @Nonnull ItemStack camouflageBlock) { + if(camouflageBlock == null || camouflageBlock.getItem() == null || Block.getBlockFromItem(camouflageBlock.getItem()) == null) { + return false; + } + for(ItemStack camouflageBlacklisted : camouflageBlockBlacklist.get(type)){ + if(camouflageBlacklisted.getItem() == camouflageBlock.getItem() && camouflageBlacklisted.getItemDamage() == camouflageBlock.getItemDamage() && ItemStack.areItemStackTagsEqual(camouflageBlock, camouflageBlacklisted)){ + return true; + } + } + return false; + } + +} diff --git a/src/main/java/forestry/greenhouse/PluginGreenhouse.java b/src/main/java/forestry/greenhouse/PluginGreenhouse.java index a508f987d..532dcd952 100644 --- a/src/main/java/forestry/greenhouse/PluginGreenhouse.java +++ b/src/main/java/forestry/greenhouse/PluginGreenhouse.java @@ -1,15 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ package forestry.greenhouse; -import java.util.List; -import javax.annotation.Nonnull; - -import com.google.common.collect.Lists; - +import forestry.api.core.EnumCamouflageType; +import forestry.api.greenhouse.GreenhouseManager; +import forestry.api.greenhouse.IGreenhouseItemAccess; import forestry.core.config.Constants; +import forestry.greenhouse.blocks.BlockGreenhouse; import forestry.greenhouse.blocks.BlockGreenhouseType; import forestry.greenhouse.blocks.BlockRegistryGreenhouse; import forestry.greenhouse.proxy.ProxyGreenhouse; import forestry.greenhouse.tiles.TileGreenhouseControl; +import forestry.greenhouse.tiles.TileGreenhouseDoor; import forestry.greenhouse.tiles.TileGreenhouseDryer; import forestry.greenhouse.tiles.TileGreenhouseFan; import forestry.greenhouse.tiles.TileGreenhouseGearbox; @@ -37,7 +47,11 @@ public class PluginGreenhouse extends BlankForestryPlugin { public static ProxyGreenhouse proxy; public static BlockRegistryGreenhouse blocks; - private static final List greenhouseGlass = Lists.newArrayList(); + + @Override + public void setupAPI() { + GreenhouseManager.greenhouseItemAccess = new GreenhouseItemAccess(); + } @Override public void registerItemsAndBlocks() { @@ -48,59 +62,54 @@ public class PluginGreenhouse extends BlankForestryPlugin { public void doInit() { super.doInit(); - GameRegistry.registerTileEntity(TileGreenhouseFan.class, "forestry.greenhouse.fan"); - GameRegistry.registerTileEntity(TileGreenhouseHeater.class, "forestry.greenhouse.heater"); - GameRegistry.registerTileEntity(TileGreenhouseDryer.class, "forestry.greenhouse.dryer"); - GameRegistry.registerTileEntity(TileGreenhouseSprinkler.class, "forestry.greenhouse.sprinkler"); - GameRegistry.registerTileEntity(TileGreenhouseValve.class, "forestry.greenhouse.valve"); - GameRegistry.registerTileEntity(TileGreenhouseGearbox.class, "forestry.greenhouse.gearbox"); - GameRegistry.registerTileEntity(TileGreenhouseControl.class, "forestry.greenhouse.controller"); - GameRegistry.registerTileEntity(TileGreenhousePlain.class, "forestry.greenhouse.plain"); + GameRegistry.registerTileEntity(TileGreenhouseFan.class, "forestry.GreenhouseFan"); + GameRegistry.registerTileEntity(TileGreenhouseHeater.class, "forestry.GreenhouseHeater"); + GameRegistry.registerTileEntity(TileGreenhouseDryer.class, "forestry.GreenhouseDryer"); + GameRegistry.registerTileEntity(TileGreenhouseSprinkler.class, "forestry.GreenhouseSprinkler"); + GameRegistry.registerTileEntity(TileGreenhouseValve.class, "forestry.GreenhouseValve"); + GameRegistry.registerTileEntity(TileGreenhouseGearbox.class, "forestry.GreenhouseGearbox"); + GameRegistry.registerTileEntity(TileGreenhouseControl.class, "forestry.GreenhouseController"); + GameRegistry.registerTileEntity(TileGreenhousePlain.class, "forestry.GreenhousePlain"); + GameRegistry.registerTileEntity(TileGreenhouseDoor.class, "forestry.GreenhouseDoor"); } @Override public void preInit(){ MinecraftForge.EVENT_BUS.register(this); - addGreenhouseGlass(new ItemStack(Blocks.glass, 1, 0)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 0)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 1)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 2)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 3)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 4)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 5)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 6)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 7)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 8)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 9)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 10)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 11)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 12)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 13)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 14)); - addGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 15)); + IGreenhouseItemAccess greenhouseAccess = GreenhouseManager.greenhouseItemAccess; + + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.glass, 1, 0)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 0)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 1)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 2)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 3)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 4)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 5)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 6)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 7)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 8)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 9)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 10)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 11)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 12)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 13)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 14)); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 15)); + + for(BlockGreenhouseType type : BlockGreenhouseType.VALUES){ + if(type == BlockGreenhouseType.GLASS){ + greenhouseAccess.addToCamouflageBlockBlackList(EnumCamouflageType.GLASS, blocks.getGreenhouseBlock(type)); + }else if(type == BlockGreenhouseType.DOOR){ + greenhouseAccess.addToCamouflageBlockBlackList(EnumCamouflageType.DOOR, blocks.getGreenhouseBlock(type)); + }else{ + greenhouseAccess.addToCamouflageBlockBlackList(EnumCamouflageType.DEFAULT, blocks.getGreenhouseBlock(type)); + } + } proxy.initializeModels(); } - public static void addGreenhouseGlass(@Nonnull ItemStack stack){ - for(ItemStack glass : greenhouseGlass){ - if(ItemStack.areItemStackTagsEqual(stack, glass)){ - return; - } - } - greenhouseGlass.add(stack); - } - - public static boolean isGreenhouseGlass(@Nonnull ItemStack stack){ - for(ItemStack glass : greenhouseGlass){ - if(ItemStack.areItemStackTagsEqual(stack, glass)){ - return true; - } - } - return false; - } - @SubscribeEvent @SideOnly(Side.CLIENT) public void handleTextureRemap(TextureStitchEvent.Pre event) { diff --git a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java index 221969638..4269c6dac 100644 --- a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java +++ b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java @@ -24,7 +24,6 @@ import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -48,6 +47,7 @@ import forestry.core.blocks.BlockStructure; import forestry.core.blocks.propertys.UnlistedBlockAccess; import forestry.core.blocks.propertys.UnlistedBlockPos; import forestry.greenhouse.tiles.TileGreenhouseControl; +import forestry.greenhouse.tiles.TileGreenhouseDoor; import forestry.greenhouse.tiles.TileGreenhouseDryer; import forestry.greenhouse.tiles.TileGreenhouseFan; import forestry.greenhouse.tiles.TileGreenhouseGearbox; @@ -72,13 +72,18 @@ public abstract class BlockGreenhouse extends BlockStructure { public static Map create() { Map blockMap = new EnumMap<>(BlockGreenhouseType.class); for (final BlockGreenhouseType type : BlockGreenhouseType.VALUES) { - BlockGreenhouse block = new BlockGreenhouse() { - @Nonnull - @Override - public BlockGreenhouseType getGreenhouseType() { - return type; - } - }; + BlockGreenhouse block; + if(type == BlockGreenhouseType.DOOR){ + block = new BlockGreenhouseDoor(); + }else{ + block = new BlockGreenhouse() { + @Nonnull + @Override + public BlockGreenhouseType getGreenhouseType() { + return type; + } + }; + } blockMap.put(type, block); } return blockMap; @@ -142,6 +147,8 @@ public abstract class BlockGreenhouse extends BlockStructure { return new TileGreenhouseHeater(); case CONTROL: return new TileGreenhouseControl(); + case DOOR: + return new TileGreenhouseDoor(); default: return new TileGreenhousePlain(); } @@ -164,7 +171,7 @@ public abstract class BlockGreenhouse extends BlockStructure { @Override public boolean isFullCube() { - return getGreenhouseType() != BlockGreenhouseType.GLASS && getGreenhouseType() == BlockGreenhouseType.SPRINKLER; + return getGreenhouseType() != BlockGreenhouseType.GLASS && getGreenhouseType() != BlockGreenhouseType.SPRINKLER; } @Override @@ -172,7 +179,8 @@ public abstract class BlockGreenhouse extends BlockStructure { return getGreenhouseType() != BlockGreenhouseType.GLASS; } - @SideOnly(Side.CLIENT) + @Override + @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) { IBlockState iblockstate = worldIn.getBlockState(pos); @@ -189,6 +197,8 @@ public abstract class BlockGreenhouse extends BlockStructure { { return false; } + }else if(getGreenhouseType() == BlockGreenhouseType.DOOR){ + return super.shouldSideBeRendered(worldIn, pos, side); } return block == this ? false : super.shouldSideBeRendered(worldIn, pos, side); diff --git a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseDoor.java b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseDoor.java new file mode 100644 index 000000000..023031829 --- /dev/null +++ b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseDoor.java @@ -0,0 +1,398 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.greenhouse.blocks; + +import java.util.Random; + +import forestry.api.core.IModelManager; +import forestry.api.core.IStateMapperRegister; +import forestry.core.proxy.Proxies; +import forestry.greenhouse.tiles.TileGreenhouseDoor; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.statemap.StateMap; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.StatCollector; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapperRegister { + + //The door propertys + private static final PropertyDirection FACING = BlockDoor.FACING; + private static final PropertyBool OPEN = BlockDoor.OPEN; + private static final PropertyEnum HINGE = BlockDoor.HINGE; + private static final PropertyBool POWERED = BlockDoor.POWERED; + private static final PropertyEnum HALF = BlockDoor.HALF; + + public BlockGreenhouseDoor() { + super(); + setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(OPEN, Boolean.valueOf(false)).withProperty(HINGE, BlockDoor.EnumHingePosition.LEFT).withProperty(POWERED, Boolean.valueOf(false)).withProperty(HALF, BlockDoor.EnumDoorHalf.LOWER)); + } + + @Override + public String getLocalizedName(){ + return StatCollector.translateToLocal((this.getUnlocalizedName() + ".name").replaceAll("tile", "item")); + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean isPassable(IBlockAccess worldIn, BlockPos pos){ + return isOpen(combineMetadata(worldIn, pos)); + } + + @Override + public boolean isFullCube(){ + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos){ + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getSelectedBoundingBox(worldIn, pos); + } + + @Override + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state){ + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getCollisionBoundingBox(worldIn, pos, state); + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos){ + this.setBoundBasedOnMeta(combineMetadata(worldIn, pos)); + } + + private void setBoundBasedOnMeta(int combinedMeta){ + float f = 0.1875F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); + EnumFacing enumfacing = getFacing(combinedMeta); + boolean flag = isOpen(combinedMeta); + boolean flag1 = isHingeLeft(combinedMeta); + + if (flag){ + if (enumfacing == EnumFacing.EAST){ + if (!flag1){ + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + }else{ + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + } + }else if (enumfacing == EnumFacing.SOUTH){ + if (!flag1){ + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + }else{ + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + } + }else if (enumfacing == EnumFacing.WEST){ + if (!flag1){ + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + }else{ + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + } + }else if (enumfacing == EnumFacing.NORTH){ + if (!flag1){ + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + }else{ + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + }else if (enumfacing == EnumFacing.EAST){ + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + }else if (enumfacing == EnumFacing.SOUTH){ + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + }else if (enumfacing == EnumFacing.WEST){ + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + }else if (enumfacing == EnumFacing.NORTH){ + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + } + } + + @Override + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ){ + TileEntity tile = world.getTileEntity(pos); + if(!(tile instanceof TileGreenhouseDoor)){ + return false; + } + TileGreenhouseDoor door = (TileGreenhouseDoor) tile; + if(!door.getAccessHandler().allowsInteracting(player)){ + return false; + }else{ + BlockPos blockpos = state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down(); + IBlockState iblockstate = pos.equals(blockpos) ? state : world.getBlockState(blockpos); + + if (iblockstate.getBlock() != this) + { + return false; + }else{ + state = iblockstate.cycleProperty(OPEN); + world.setBlockState(blockpos, state, 2); + world.markBlockRangeForRenderUpdate(blockpos, pos); + world.playAuxSFXAtEntity(player, state.getValue(OPEN).booleanValue() ? 1003 : 1006, pos, 0); + return true; + } + } + } + + public void toggleDoor(World worldIn, BlockPos pos, boolean open){ + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == this){ + BlockPos blockpos = iblockstate.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down(); + IBlockState iblockstate1 = pos == blockpos ? iblockstate : worldIn.getBlockState(blockpos); + + if (iblockstate1.getBlock() == this && iblockstate1.getValue(OPEN).booleanValue() != open){ + worldIn.setBlockState(blockpos, iblockstate1.withProperty(OPEN, Boolean.valueOf(open)), 2); + worldIn.markBlockRangeForRenderUpdate(blockpos, pos); + worldIn.playAuxSFXAtEntity((EntityPlayer)null, open ? 1003 : 1006, pos, 0); + } + } + } + + @Override + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock){ + if (state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER){ + BlockPos blockpos = pos.down(); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock() != this){ + worldIn.setBlockToAir(pos); + }else if (neighborBlock != this){ + this.onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock); + } + }else{ + boolean flag1 = false; + BlockPos blockpos1 = pos.up(); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + + if (iblockstate1.getBlock() != this){ + worldIn.setBlockToAir(pos); + flag1 = true; + } + + if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down())){ + worldIn.setBlockToAir(pos); + flag1 = true; + + if (iblockstate1.getBlock() == this){ + worldIn.setBlockToAir(blockpos1); + } + } + + if (flag1){ + if (!worldIn.isRemote){ + this.dropBlockAsItem(worldIn, pos, state, 0); + } + }else{ + boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(blockpos1); + + if ((flag || neighborBlock.canProvidePower()) && neighborBlock != this && flag != iblockstate1.getValue(POWERED).booleanValue()){ + worldIn.setBlockState(blockpos1, iblockstate1.withProperty(POWERED, Boolean.valueOf(flag)), 2); + + if (flag != state.getValue(OPEN).booleanValue()){ + worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(flag)), 2); + worldIn.markBlockRangeForRenderUpdate(pos, pos); + worldIn.playAuxSFXAtEntity((EntityPlayer)null, flag ? 1003 : 1006, pos, 0); + } + } + } + } + } + + @Override + public Item getItemDropped(IBlockState state, Random rand, int fortune){ + return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? null : Item.getItemFromBlock(state.getBlock()); + } + + @Override + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end){ + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.collisionRayTrace(worldIn, pos, start, end); + } + + @Override + public boolean canPlaceBlockAt(World worldIn, BlockPos pos){ + return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); + } + + @Override + public int getMobilityFlag(){ + return 1; + } + + private static int combineMetadata(IBlockAccess worldIn, BlockPos pos){ + IBlockState iblockstate = worldIn.getBlockState(pos); + int i = iblockstate.getBlock().getMetaFromState(iblockstate); + boolean flag = isTop(i); + IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); + int j = iblockstate1.getBlock().getMetaFromState(iblockstate1); + int k = flag ? j : i; + IBlockState iblockstate2 = worldIn.getBlockState(pos.up()); + int l = iblockstate2.getBlock().getMetaFromState(iblockstate2); + int i1 = flag ? i : l; + boolean flag1 = (i1 & 1) != 0; + boolean flag2 = (i1 & 2) != 0; + return removeHalfBit(k) | (flag ? 8 : 0) | (flag1 ? 16 : 0) | (flag2 ? 32 : 0); + } + + @Override + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player){ + BlockPos blockpos = pos.down(); + + if (player.capabilities.isCreativeMode && state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER && worldIn.getBlockState(blockpos).getBlock() == this) + { + worldIn.setBlockToAir(blockpos); + } + } + + @Override + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){ + if (state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER){ + IBlockState iblockstate = worldIn.getBlockState(pos.up()); + + if (iblockstate.getBlock() == this){ + state = state.withProperty(HINGE, iblockstate.getValue(HINGE)).withProperty(POWERED, iblockstate.getValue(POWERED)); + } + }else{ + IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); + + if (iblockstate1.getBlock() == this){ + state = state.withProperty(FACING, iblockstate1.getValue(FACING)).withProperty(OPEN, iblockstate1.getValue(OPEN)); + } + } + + return state; + } + + @Override + public IBlockState getStateFromMeta(int meta){ + return (meta & 8) > 0 ? this.getDefaultState().withProperty(HALF, BlockDoor.EnumDoorHalf.UPPER).withProperty(HINGE, (meta & 1) > 0 ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT).withProperty(POWERED, Boolean.valueOf((meta & 2) > 0)) : this.getDefaultState().withProperty(HALF, BlockDoor.EnumDoorHalf.LOWER).withProperty(FACING, EnumFacing.getHorizontal(meta & 3).rotateYCCW()).withProperty(OPEN, Boolean.valueOf((meta & 4) > 0)); + } + + @Override + @SideOnly(Side.CLIENT) + public EnumWorldBlockLayer getBlockLayer(){ + return EnumWorldBlockLayer.TRANSLUCENT; + } + + @Override + public int getMetaFromState(IBlockState state){ + int i = 0; + + if (state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER){ + i = i | 8; + + if (state.getValue(HINGE) == BlockDoor.EnumHingePosition.RIGHT) + { + i |= 1; + } + + if (state.getValue(POWERED).booleanValue()) + { + i |= 2; + } + }else{ + i = i | state.getValue(FACING).rotateY().getHorizontalIndex(); + + if (state.getValue(OPEN).booleanValue()){ + i |= 4; + } + } + + return i; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerModel(Item item, IModelManager manager) { + ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation("forestry:greenhouse.door", "inventory")); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerStateMapper() { + Proxies.render.registerStateMapper(this, new StateMap.Builder().ignore(new IProperty[] {BlockDoor.POWERED}).build()); + } + + protected static int removeHalfBit(int meta) + { + return meta & 7; + } + + public static boolean isOpen(IBlockAccess worldIn, BlockPos pos) + { + return isOpen(combineMetadata(worldIn, pos)); + } + + public static EnumFacing getFacing(IBlockAccess worldIn, BlockPos pos) + { + return getFacing(combineMetadata(worldIn, pos)); + } + + public static EnumFacing getFacing(int combinedMeta) + { + return EnumFacing.getHorizontal(combinedMeta & 3).rotateYCCW(); + } + + protected static boolean isOpen(int combinedMeta) + { + return (combinedMeta & 4) != 0; + } + + protected static boolean isTop(int meta) + { + return (meta & 8) != 0; + } + + protected static boolean isHingeLeft(int combinedMeta) + { + return (combinedMeta & 16) != 0; + } + + @Override + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {HALF, FACING, OPEN, HINGE, POWERED}); + } + + @Override + public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { + return state; + } + + @Override + public BlockGreenhouseType getGreenhouseType() { + return BlockGreenhouseType.DOOR; + } + +} diff --git a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseType.java b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseType.java index bcbd0df75..7a7ea2810 100644 --- a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseType.java +++ b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseType.java @@ -16,15 +16,16 @@ import forestry.core.render.TextureManager; import forestry.greenhouse.blocks.BlockGreenhouse.State; public enum BlockGreenhouseType { - PLAIN(true), - GLASS(true), + PLAIN, + GLASS, GEARBOX(true), VALVE(true), FAN(true, true), HEATER(true, true), DRYER(true, true), CONTROL(true), - SPRINKLER(false, true); + SPRINKLER(false, true), + DOOR; public static final BlockGreenhouseType[] VALUES = values(); @@ -40,21 +41,21 @@ public enum BlockGreenhouseType { private static final int TYPE_DRYER = 8; private static final int TYPE_CONTROL = 9; - public final boolean canCamouflage; + public final boolean hasOverlaySprite; public final boolean activatable; - BlockGreenhouseType(boolean canCamouflage, boolean activatable) { - this.canCamouflage = canCamouflage; + BlockGreenhouseType(boolean hasOverlaySprite, boolean activatable) { + this.hasOverlaySprite = hasOverlaySprite; this.activatable = activatable; } - BlockGreenhouseType(boolean canCamouflage) { - this.canCamouflage = canCamouflage; + BlockGreenhouseType(boolean hasOverlaySprite) { + this.hasOverlaySprite = hasOverlaySprite; this.activatable = false; } BlockGreenhouseType() { - this.canCamouflage = false; + this.hasOverlaySprite = false; this.activatable = false; } @@ -92,15 +93,17 @@ public enum BlockGreenhouseType { case VALVE: return sprites.get(TYPE_VALVE); case FAN: - if(state == null || state.getValue(BlockGreenhouse.STATE) == State.OFF) + if(state == null || state.getValue(BlockGreenhouse.STATE) == State.OFF) { return sprites.get(TYPE_FAN_OFF); - else + } else { return sprites.get(TYPE_FAN_ON); + } case HEATER: - if(state == null || state.getValue(BlockGreenhouse.STATE) == State.OFF) + if(state == null || state.getValue(BlockGreenhouse.STATE) == State.OFF) { return sprites.get(TYPE_HEATER_OFF); - else + } else { return sprites.get(TYPE_HEATER_ON); + } case DRYER: return sprites.get(TYPE_DRYER); case CONTROL: diff --git a/src/main/java/forestry/greenhouse/blocks/BlockRegistryGreenhouse.java b/src/main/java/forestry/greenhouse/blocks/BlockRegistryGreenhouse.java index b5ef2329d..ecfdaf632 100644 --- a/src/main/java/forestry/greenhouse/blocks/BlockRegistryGreenhouse.java +++ b/src/main/java/forestry/greenhouse/blocks/BlockRegistryGreenhouse.java @@ -4,6 +4,8 @@ import java.util.Map; import forestry.core.blocks.BlockRegistry; import forestry.core.items.ItemBlockForestry; +import forestry.greenhouse.items.ItemBlockGreenhouseDoor; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; public class BlockRegistryGreenhouse extends BlockRegistry{ @@ -13,7 +15,11 @@ public class BlockRegistryGreenhouse extends BlockRegistry{ public BlockRegistryGreenhouse() { greenhouseBlockMap = BlockGreenhouse.create(); for (BlockGreenhouse block : greenhouseBlockMap.values()) { - registerBlock(block, new ItemBlockForestry(block), "greenhouse." + block.getGreenhouseType()); + ItemBlock itemBlock = new ItemBlockForestry(block); + if(block instanceof BlockGreenhouseDoor){ + itemBlock = new ItemBlockGreenhouseDoor(block); + } + registerBlock(block, itemBlock, "greenhouse." + block.getGreenhouseType()); } } diff --git a/src/main/java/forestry/greenhouse/gui/ContainerGreenhouse.java b/src/main/java/forestry/greenhouse/gui/ContainerGreenhouse.java index f48b1775d..1972bc044 100644 --- a/src/main/java/forestry/greenhouse/gui/ContainerGreenhouse.java +++ b/src/main/java/forestry/greenhouse/gui/ContainerGreenhouse.java @@ -11,7 +11,7 @@ package forestry.greenhouse.gui; import net.minecraft.entity.player.InventoryPlayer; - +import net.minecraftforge.fluids.IFluidTank; import forestry.core.gui.ContainerTile; import forestry.core.network.packets.PacketGuiUpdate; import forestry.greenhouse.tiles.TileGreenhouse; @@ -28,5 +28,9 @@ public class ContainerGreenhouse extends ContainerTile { PacketGuiUpdate packet = new PacketGuiUpdate(tile); sendPacketToCrafters(packet); } + + public IFluidTank getTank(int slot) { + return tile.getMultiblockLogic().getController().getTankManager().getTank(slot); + } } diff --git a/src/main/java/forestry/greenhouse/gui/GuiGreenhouse.java b/src/main/java/forestry/greenhouse/gui/GuiGreenhouse.java index c35545f75..297b19b5b 100644 --- a/src/main/java/forestry/greenhouse/gui/GuiGreenhouse.java +++ b/src/main/java/forestry/greenhouse/gui/GuiGreenhouse.java @@ -11,11 +11,12 @@ package forestry.greenhouse.gui; import net.minecraft.entity.player.EntityPlayer; - +import forestry.api.core.EnumCamouflageType; import forestry.core.config.Constants; import forestry.core.gui.GuiForestryTitled; import forestry.core.gui.ledgers.ClimateLedger; import forestry.core.gui.widgets.TankWidget; +import forestry.greenhouse.gui.widgets.WidgetCamouflageSlot; import forestry.greenhouse.multiblock.IGreenhouseControllerInternal; import forestry.greenhouse.tiles.TileGreenhouse; @@ -24,12 +25,24 @@ public class GuiGreenhouse extends GuiForestryTitled { + + public ItemBlockGreenhouseDoor(Block block) { + super(block); + } + + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){ + if (side != EnumFacing.UP){ + return false; + }else{ + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (!block.isReplaceable(worldIn, pos)){ + pos = pos.offset(side); + } + + if (!playerIn.canPlayerEdit(pos, side, stack)){ + return false; + } else if (!this.block.canPlaceBlockAt(worldIn, pos)){ + return false; + }else{ + placeDoor(worldIn, pos, EnumFacing.fromAngle(playerIn.rotationYaw), this.block); + --stack.stackSize; + return true; + } + } + } + + private void placeDoor(World worldIn, BlockPos pos, EnumFacing facing, Block door){ + BlockPos blockpos = pos.offset(facing.rotateY()); + BlockPos blockpos1 = pos.offset(facing.rotateYCCW()); + int i = (worldIn.getBlockState(blockpos1).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getBlockState(blockpos1.up()).getBlock().isNormalCube() ? 1 : 0); + int j = (worldIn.getBlockState(blockpos).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getBlockState(blockpos.up()).getBlock().isNormalCube() ? 1 : 0); + boolean flag = worldIn.getBlockState(blockpos1).getBlock() == door || worldIn.getBlockState(blockpos1.up()).getBlock() == door; + boolean flag1 = worldIn.getBlockState(blockpos).getBlock() == door || worldIn.getBlockState(blockpos.up()).getBlock() == door; + boolean flag2 = false; + + if (flag && !flag1 || j > i){ + flag2 = true; + } + + BlockPos blockpos2 = pos.up(); + IBlockState iblockstate = door.getDefaultState().withProperty(BlockDoor.FACING, facing).withProperty(BlockDoor.HINGE, flag2 ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT); + worldIn.setBlockState(pos, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2); + worldIn.setBlockState(blockpos2, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2); + worldIn.notifyNeighborsOfStateChange(pos, door); + worldIn.notifyNeighborsOfStateChange(blockpos2, door); + } + +} diff --git a/src/main/java/forestry/greenhouse/models/ModelGreenhouse.java b/src/main/java/forestry/greenhouse/models/ModelGreenhouse.java index 9fbf39f48..b6814bf6f 100644 --- a/src/main/java/forestry/greenhouse/models/ModelGreenhouse.java +++ b/src/main/java/forestry/greenhouse/models/ModelGreenhouse.java @@ -1,7 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ package forestry.greenhouse.models; import forestry.greenhouse.blocks.BlockGreenhouse; import forestry.greenhouse.blocks.BlockGreenhouseType; +import forestry.greenhouse.multiblock.IGreenhouseControllerInternal; +import forestry.greenhouse.tiles.TileGreenhouse; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockModelShapes; @@ -15,9 +27,9 @@ import net.minecraftforge.common.property.IExtendedBlockState; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import forestry.api.core.ICamouflageHandler; import forestry.api.core.IModelBaker; import forestry.core.models.ModelBlockOverlay; -import forestry.core.tiles.ICamouflagedBlock; public class ModelGreenhouse extends ModelBlockOverlay { @@ -33,40 +45,39 @@ public class ModelGreenhouse extends ModelBlockOverlay { @Override protected void bakeWorldBlock(BlockGreenhouse block, IBlockAccess world, BlockPos pos, IExtendedBlockState stateExtended, IModelBaker baker) { TileEntity tile = world.getTileEntity(pos); - if(!(tile instanceof ICamouflagedBlock)){ + if(!(tile instanceof TileGreenhouse)){ return; } - bakeBlockModel(block, pos, stateExtended, baker, (ICamouflagedBlock) tile); + TileGreenhouse greenhouse = (TileGreenhouse) tile; + IGreenhouseControllerInternal greenhouseController = greenhouse.getMultiblockLogic().getController(); + + ICamouflageHandler camouflageHandler = greenhouse; + if(greenhouse.getCamouflageBlock(greenhouse.getCamouflageType()) == null && greenhouseController.getCamouflageBlock(greenhouse.getCamouflageType()) != null){ + camouflageHandler = greenhouseController; + } + bakeBlockModel(block, pos, stateExtended, baker, camouflageHandler.getCamouflageBlock(greenhouse.getCamouflageType())); } - private void bakeBlockModel(@Nonnull BlockGreenhouse block, @Nullable BlockPos pos, @Nullable IExtendedBlockState stateExtended, @Nonnull IModelBaker baker, @Nullable ICamouflagedBlock camouflageBlock){ + private void bakeBlockModel(@Nonnull BlockGreenhouse block, @Nullable BlockPos pos, @Nullable IExtendedBlockState stateExtended, @Nonnull IModelBaker baker, @Nullable ItemStack camouflageBlock){ if(camouflageBlock != null){ - ItemStack camouflageBlockStack = camouflageBlock.getCamouflageBlock(); - if(camouflageBlockStack != null){ - BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes(); - baker.addBakedModel(modelShapes.getModelForState(Block.getBlockFromItem(camouflageBlockStack.getItem()).getStateFromMeta(camouflageBlockStack.getItemDamage()))); - } - else if(block.getGreenhouseType() == BlockGreenhouseType.GLASS){ - TextureAtlasSprite glassSprite = BlockGreenhouseType.getSprite(BlockGreenhouseType.GLASS, null); - baker.addBlockModel(block, pos, BlockGreenhouseType.getSprite(BlockGreenhouseType.GLASS, null), 100); - baker.setParticleSprite(glassSprite); - }else{ - TextureAtlasSprite plainSprite = BlockGreenhouseType.getSprite(BlockGreenhouseType.PLAIN, null); - baker.addBlockModel(block, pos, BlockGreenhouseType.getSprite(BlockGreenhouseType.PLAIN, null), 100); - baker.setParticleSprite(plainSprite); - } - }else{ - if(block.getGreenhouseType() == BlockGreenhouseType.GLASS){ - TextureAtlasSprite glassSprite = BlockGreenhouseType.getSprite(BlockGreenhouseType.GLASS, null); - baker.addBlockModel(block, pos, BlockGreenhouseType.getSprite(BlockGreenhouseType.GLASS, null), 100); - baker.setParticleSprite(glassSprite); - }else{ - TextureAtlasSprite plainSprite = BlockGreenhouseType.getSprite(BlockGreenhouseType.PLAIN, null); - baker.addBlockModel(block, pos, BlockGreenhouseType.getSprite(BlockGreenhouseType.PLAIN, null), 100); - baker.setParticleSprite(plainSprite); - } + BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes(); + + baker.addBakedModel(modelShapes.getModelForState(Block.getBlockFromItem(camouflageBlock.getItem()).getStateFromMeta(camouflageBlock.getItemDamage()))); } - if(block.getGreenhouseType() != BlockGreenhouseType.PLAIN && block.getGreenhouseType() != BlockGreenhouseType.GLASS){ + + //Bake the default blocks + else if(block.getGreenhouseType() == BlockGreenhouseType.GLASS){ + TextureAtlasSprite glassSprite = BlockGreenhouseType.getSprite(BlockGreenhouseType.GLASS, null); + + baker.addBlockModel(block, pos, BlockGreenhouseType.getSprite(BlockGreenhouseType.GLASS, null), 100); + baker.setParticleSprite(glassSprite); + }else{ + TextureAtlasSprite plainSprite = BlockGreenhouseType.getSprite(BlockGreenhouseType.PLAIN, null); + + baker.addBlockModel(block, pos, BlockGreenhouseType.getSprite(BlockGreenhouseType.PLAIN, null), 100); + baker.setParticleSprite(plainSprite); + } + if(block.getGreenhouseType().hasOverlaySprite){ baker.addBlockModel(block, pos, BlockGreenhouseType.getSprite(block.getGreenhouseType(), stateExtended), 101); } } diff --git a/src/main/java/forestry/greenhouse/multiblock/FakeGreenhouseController.java b/src/main/java/forestry/greenhouse/multiblock/FakeGreenhouseController.java index 84550357c..7aa121099 100644 --- a/src/main/java/forestry/greenhouse/multiblock/FakeGreenhouseController.java +++ b/src/main/java/forestry/greenhouse/multiblock/FakeGreenhouseController.java @@ -10,10 +10,12 @@ ******************************************************************************/ package forestry.greenhouse.multiblock; +import forestry.api.core.EnumCamouflageType; import forestry.core.fluids.FakeTankManager; import forestry.core.fluids.ITankManager; import forestry.core.multiblock.FakeMultiblockController; import forestry.energy.EnergyManager; +import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; public class FakeGreenhouseController extends FakeMultiblockController implements IGreenhouseControllerInternal { @@ -38,4 +40,21 @@ public class FakeGreenhouseController extends FakeMultiblockController implement return false; } + @Override + public ItemStack getCamouflageBlock(EnumCamouflageType type) { + return null; + } + + @Override + public void setCamouflageBlock(EnumCamouflageType type, ItemStack camouflageBlock) { + + } + + @Override + public BlockPos getCoordinates() { + return null; + } + + + } diff --git a/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java b/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java index 87cc6e99d..bb8ae8f67 100644 --- a/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java +++ b/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java @@ -20,8 +20,10 @@ import java.util.Set; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import forestry.api.core.EnumCamouflageType; import forestry.api.core.EnumHumidity; import forestry.api.core.EnumTemperature; +import forestry.api.core.ICamouflagedBlock; import forestry.api.core.IClimateControlled; import forestry.api.multiblock.IGreenhouseComponent; import forestry.api.multiblock.IMultiblockComponent; @@ -37,13 +39,10 @@ import forestry.core.multiblock.RectangularMultiblockControllerBase; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.proxy.Proxies; -import forestry.core.tiles.ICamouflagedBlock; import forestry.core.tiles.ILiquidTankTile; import forestry.energy.EnergyManager; -import forestry.greenhouse.blocks.BlockGreenhouse; import forestry.greenhouse.network.packets.PacketCamouflageUpdate; import forestry.greenhouse.tiles.TileGreenhouseSprinkler; -import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -54,7 +53,7 @@ import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.fluids.FluidRegistry; -public class GreenhouseController extends RectangularMultiblockControllerBase implements IGreenhouseControllerInternal, IClimateControlled, ILiquidTankTile, ICamouflagedBlock { +public class GreenhouseController extends RectangularMultiblockControllerBase implements IGreenhouseControllerInternal, IClimateControlled, ILiquidTankTile { private final List internalBlocks = Lists.newArrayList(); private final Set listenerComponents = new HashSet<>(); @@ -67,7 +66,11 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im private final TankManager tankManager; private final StandardTank resourceTank; private final EnergyManager energyManager; - private ItemStack camouflageBlock; + + //Camouflage blocks + private ItemStack camouflagePlainBlock; + private ItemStack camouflageGlassBlock; + private ItemStack camouflageDoorBlock; public GreenhouseController(World world) { super(world, GreenhouseMultiblockSizeLimits.instance); @@ -165,11 +168,9 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im tankManager.writeToNBT(data); energyManager.writeToNBT(data); - if(camouflageBlock != null){ - NBTTagCompound nbtTag = new NBTTagCompound(); - camouflageBlock.writeToNBT(nbtTag); - data.setTag("CamouflageBlock", nbtTag); - } + writeCamouflageBlockToNBT(data, EnumCamouflageType.DEFAULT); + writeCamouflageBlockToNBT(data, EnumCamouflageType.GLASS); + writeCamouflageBlockToNBT(data, EnumCamouflageType.DOOR); } @Override @@ -181,8 +182,23 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im tankManager.readFromNBT(data); energyManager.readFromNBT(data); - if(data.hasKey("CamouflageBlock")){ - setCamouflageBlock(ItemStack.loadItemStackFromNBT(data.getCompoundTag("CamouflageBlock"))); + readCamouflageBlockFromNBT(data, EnumCamouflageType.DEFAULT); + readCamouflageBlockFromNBT(data, EnumCamouflageType.GLASS); + readCamouflageBlockFromNBT(data, EnumCamouflageType.DOOR); + } + + private void writeCamouflageBlockToNBT(NBTTagCompound data, EnumCamouflageType type){ + ItemStack camouflageBlock = getCamouflageBlock(type); + if(camouflageBlock != null){ + NBTTagCompound nbtTag = new NBTTagCompound(); + camouflageBlock.writeToNBT(nbtTag); + data.setTag("Camouflage" + type.name(), nbtTag); + } + } + + private void readCamouflageBlockFromNBT(NBTTagCompound data, EnumCamouflageType type){ + if(data.hasKey("Camouflage" + type.name())){ + setCamouflageBlock(type, ItemStack.loadItemStackFromNBT(data.getCompoundTag("Camouflage" + type.name()))); } } @@ -206,13 +222,9 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im data.writeVarInt(Math.round(humidChange * 100)); tankManager.writeData(data); energyManager.writeData(data); - ItemStack camouflageBlock = getCamouflageBlock(); - if(camouflageBlock != null){ - data.writeShort(1); - data.writeItemStack(camouflageBlock); - }else{ - data.writeShort(0); - } + writeCamouflageBlockToData(data, EnumCamouflageType.DEFAULT); + writeCamouflageBlockToData(data, EnumCamouflageType.GLASS); + writeCamouflageBlockToData(data, EnumCamouflageType.DOOR); } @Override @@ -221,28 +233,69 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im humidChange = data.readVarInt() / 100.0F; tankManager.readData(data); energyManager.readData(data); + readCamouflageBlockFromData(data); + readCamouflageBlockFromData(data); + readCamouflageBlockFromData(data); + } + + private void writeCamouflageBlockToData(DataOutputStreamForestry data, EnumCamouflageType type) throws IOException{ + ItemStack camouflageBlock = getCamouflageBlock(type); + if(camouflageBlock != null){ + data.writeShort(1); + data.writeShort(type.ordinal()); + data.writeItemStack(camouflageBlock); + }else{ + data.writeShort(0); + } + } + + private void readCamouflageBlockFromData(DataInputStreamForestry data) throws IOException{ if(data.readShort() == 1){ - setCamouflageBlock(data.readItemStack()); + setCamouflageBlock(EnumCamouflageType.VALUES[data.readShort()], data.readItemStack()); } } @Override - public boolean setCamouflageBlock(ItemStack camouflageBlock) { - this.camouflageBlock = camouflageBlock; + public void setCamouflageBlock(EnumCamouflageType type, ItemStack camouflageBlock) { + switch (type) { + case DEFAULT: + camouflagePlainBlock = camouflageBlock; + break; + case GLASS: + camouflageGlassBlock = camouflageBlock; + break; + case DOOR: + camouflageDoorBlock = camouflageBlock; + break; + default: + return; + } if (worldObj != null && worldObj.isRemote) { for(IMultiblockComponent comp : connectedParts){ - ICamouflagedBlock camBlock = (ICamouflagedBlock) comp; - worldObj.markBlockForUpdate(camBlock.getCoordinates()); - Proxies.net.sendToServer(new PacketCamouflageUpdate(this, true)); + if(comp instanceof ICamouflagedBlock){ + ICamouflagedBlock camBlock = (ICamouflagedBlock) comp; + if(camBlock.getCamouflageType() == type){ + worldObj.markBlockForUpdate(camBlock.getCoordinates()); + } + } } + Proxies.net.sendToServer(new PacketCamouflageUpdate(this, type, true)); } - return true; } @Override - public ItemStack getCamouflageBlock() { - return camouflageBlock; + public ItemStack getCamouflageBlock(EnumCamouflageType type) { + switch (type) { + case DEFAULT: + return camouflagePlainBlock; + case GLASS: + return camouflageGlassBlock; + case DOOR: + return camouflageDoorBlock; + default: + return null; + } } @Override @@ -310,9 +363,8 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im } boolean canWork = true; - for (IGreenhouseComponent.Listener listenerComponent : listenerComponents) { - canWork = listenerComponent.getGreenhouseListener().canWork(this); + canWork = listenerComponent.getGreenhouseListener().canWork(this, canWork); } if(canWork){ @@ -405,7 +457,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im Class myClass = this.getClass(); List internalBlocks = Lists.newArrayList(); - for (int y = minimumCoord.getY(); y <= maximumCoord.getY(); y++) { + height: for (int y = minimumCoord.getY(); y <= maximumCoord.getY(); y++) { for (int x = minimumCoord.getX(); x <= maximumCoord.getX(); x++) { for (int z = minimumCoord.getZ(); z <= maximumCoord.getZ(); z++) { // Okay, figure out what sort of block this should be. @@ -420,29 +472,40 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im // Validate block type against both part-level and material-level validators. int extremes = 0; + int sides = 0; if (x == minimumCoord.getX()) { extremes++; + sides++; + } + if (y == minimumCoord.getY()) { + extremes++; } if (z == minimumCoord.getZ()) { extremes++; + sides++; } if (x == maximumCoord.getX()) { extremes++; + sides++; } if (z == maximumCoord.getZ()) { extremes++; + sides++; } if (extremes >= 1) { // Side BlockPos posUp = pos.add(0, 1, 0); - IBlockState state = worldObj.getBlockState(posUp); - if(!(state.getBlock() instanceof BlockGreenhouse)){ - isNextRoof = true; - break; + TileEntity tileUp = worldObj.getTileEntity(posUp); + if(sides >= 1 && !(tileUp instanceof IGreenhouseComponent)){ + int delta = y - minimumCoord.getY(); + if(y - minimumCoord.getY() >= minY){ + isNextRoof = true; + } + break height; } int exteriorLevel = y - minimumCoord.getY(); @@ -467,14 +530,12 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im } } } - if(isNextRoof){ - InternalBlock iB = new InternalBlock(getMinimumCoord().add(1, 1, 1)); - internalBlocks.add(iB); - addInternalBlock(iB, internalBlocks); - break; - } } - if(internalBlocks.isEmpty()){ + if(isNextRoof){ + InternalBlock iB = new InternalBlock(getMinimumCoord().add(1, 1, 1)); + internalBlocks.add(iB); + addInternalBlock(iB, internalBlocks); + }else if(internalBlocks.isEmpty()){ throw new MultiblockValidationException(StatCollector.translateToLocalFormatted("for.multiblock.error.space.closed")); } this.internalBlocks.addAll(internalBlocks); @@ -487,7 +548,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im BlockPos posFacing = new BlockPos(internalBlock.pos.getX() + entry.getKey().getFrontOffsetX(), internalBlock.pos.getY() + entry.getKey().getFrontOffsetY(), internalBlock.pos.getZ() + entry.getKey().getFrontOffsetZ()); BlockPos minPos = getMinimumCoord(); BlockPos maxPos = getMaximumCoord(); - if(minPos.getX() > posFacing.getX() || minPos.getZ() > posFacing.getZ() || maxPos.getX() < posFacing.getX() || maxPos.getZ() < posFacing.getZ()){ + if(minPos.getX() > posFacing.getX() || minPos.getY() > posFacing.getY() || minPos.getZ() > posFacing.getZ() || maxPos.getX() < posFacing.getX() || maxPos.getY() < posFacing.getY() || maxPos.getZ() < posFacing.getZ()){ throw new MultiblockValidationException(StatCollector.translateToLocalFormatted("for.multiblock.error.space.closed")); } @@ -502,21 +563,16 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im } }else{ InternalBlock iB = new InternalBlock(posFacing, entry.getKey().getOpposite(), internalBlock); - if(!internalBlocks.contains(iB)){ + if(internalBlocks.contains(iB)){ + entry.setValue(true); + }else{ internalBlocks.add(iB); addInternalBlock(iB, internalBlocks); - }else{ - entry.setValue(true); } } } } } - - @Override - public CamouflageType getType() { - return CamouflageType.DEFAULT; - } private static class InternalBlock{ public BlockPos pos; diff --git a/src/main/java/forestry/greenhouse/multiblock/IGreenhouseControllerInternal.java b/src/main/java/forestry/greenhouse/multiblock/IGreenhouseControllerInternal.java index fda716c0e..e37ad543a 100644 --- a/src/main/java/forestry/greenhouse/multiblock/IGreenhouseControllerInternal.java +++ b/src/main/java/forestry/greenhouse/multiblock/IGreenhouseControllerInternal.java @@ -12,15 +12,15 @@ package forestry.greenhouse.multiblock; import javax.annotation.Nullable; +import forestry.api.core.ICamouflageHandler; import forestry.api.multiblock.IGreenhouseController; import forestry.core.access.IRestrictedAccess; import forestry.core.fluids.ITankManager; import forestry.core.multiblock.IMultiblockControllerInternal; import forestry.core.network.IStreamableGui; -import forestry.core.tiles.IClimatised; import forestry.energy.EnergyManager; -public interface IGreenhouseControllerInternal extends IGreenhouseController, IMultiblockControllerInternal, IRestrictedAccess, IStreamableGui { +public interface IGreenhouseControllerInternal extends IGreenhouseController, IMultiblockControllerInternal, IRestrictedAccess, IStreamableGui, ICamouflageHandler { ITankManager getTankManager(); diff --git a/src/main/java/forestry/greenhouse/network/packets/PacketCamouflageUpdate.java b/src/main/java/forestry/greenhouse/network/packets/PacketCamouflageUpdate.java index ff88aada7..10f1609c7 100644 --- a/src/main/java/forestry/greenhouse/network/packets/PacketCamouflageUpdate.java +++ b/src/main/java/forestry/greenhouse/network/packets/PacketCamouflageUpdate.java @@ -15,6 +15,8 @@ import java.io.IOException; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import forestry.api.core.EnumCamouflageType; +import forestry.api.core.ICamouflageHandler; import forestry.api.multiblock.IMultiblockComponent; import forestry.api.multiblock.IMultiblockController; import forestry.core.network.DataInputStreamForestry; @@ -22,26 +24,28 @@ import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IForestryPacketServer; import forestry.core.network.PacketIdServer; import forestry.core.network.packets.PacketCoordinates; -import forestry.core.tiles.ICamouflagedBlock; public class PacketCamouflageUpdate extends PacketCoordinates implements IForestryPacketServer { private ItemStack camouflageBlock; + private EnumCamouflageType type; private boolean isMultiblock; public PacketCamouflageUpdate() { } - public PacketCamouflageUpdate(ICamouflagedBlock tile, boolean isMultiblock) { + public PacketCamouflageUpdate(ICamouflageHandler tile, EnumCamouflageType type, boolean isMultiblock) { super(tile.getCoordinates()); - this.camouflageBlock = tile.getCamouflageBlock(); + this.camouflageBlock = tile.getCamouflageBlock(type); this.isMultiblock = isMultiblock; + this.type = type; } - public PacketCamouflageUpdate(ICamouflagedBlock tile) { + public PacketCamouflageUpdate(ICamouflageHandler tile, EnumCamouflageType type) { super(tile.getCoordinates()); - this.camouflageBlock = tile.getCamouflageBlock(); + this.camouflageBlock = tile.getCamouflageBlock(type); this.isMultiblock = false; + this.type = type; } @Override @@ -53,6 +57,7 @@ public class PacketCamouflageUpdate extends PacketCoordinates implements IForest protected void writeData(DataOutputStreamForestry data) throws IOException { super.writeData(data); data.writeBoolean(isMultiblock); + data.writeShort(type.ordinal()); data.writeItemStack(camouflageBlock); } @@ -60,23 +65,25 @@ public class PacketCamouflageUpdate extends PacketCoordinates implements IForest public void readData(DataInputStreamForestry data) throws IOException { super.readData(data); isMultiblock = data.readBoolean(); + type = EnumCamouflageType.VALUES[data.readShort()]; camouflageBlock = data.readItemStack(); } @Override public void onPacketData(DataInputStreamForestry data, EntityPlayerMP player) { TileEntity tile = getTarget(player.worldObj); - if (tile instanceof ICamouflagedBlock) { - if(isMultiblock){ - if(tile instanceof IMultiblockComponent){ - IMultiblockController controller = ((IMultiblockComponent) tile).getMultiblockLogic().getController(); - if(controller instanceof ICamouflagedBlock){ - ((ICamouflagedBlock) controller).setCamouflageBlock(camouflageBlock); - } - } - }else{ - ((ICamouflagedBlock) tile).setCamouflageBlock(camouflageBlock); + ICamouflageHandler handler = null; + if(isMultiblock && tile instanceof IMultiblockComponent){ + IMultiblockController controller = ((IMultiblockComponent) tile).getMultiblockLogic().getController(); + if(controller instanceof ICamouflageHandler){ + handler = (ICamouflageHandler) controller; } } + else if (tile instanceof ICamouflageHandler) { + handler = (ICamouflageHandler) tile; + } + if(handler != null){ + handler.setCamouflageBlock(type, camouflageBlock); + } } } diff --git a/src/main/java/forestry/greenhouse/proxy/ProxyGreenhouseClient.java b/src/main/java/forestry/greenhouse/proxy/ProxyGreenhouseClient.java index 0b0188d07..c9aa2da53 100644 --- a/src/main/java/forestry/greenhouse/proxy/ProxyGreenhouseClient.java +++ b/src/main/java/forestry/greenhouse/proxy/ProxyGreenhouseClient.java @@ -23,6 +23,9 @@ public class ProxyGreenhouseClient extends ProxyGreenhouse { @Override public void initializeModels() { for(BlockGreenhouseType greenhouseType : BlockGreenhouseType.VALUES){ + if(greenhouseType == BlockGreenhouseType.DOOR) { + return; + } Proxies.render.registerBlockModel(new BlockModelIndex(new ModelResourceLocation("forestry:greenhouse." + greenhouseType), new ModelResourceLocation("forestry:greenhouse", "inventory"), new ModelGreenhouse(), Block.getBlockFromItem(PluginGreenhouse.blocks.getGreenhouseBlock(greenhouseType).getItem()))); diff --git a/src/main/java/forestry/greenhouse/tiles/TileGreenhouse.java b/src/main/java/forestry/greenhouse/tiles/TileGreenhouse.java index 743332850..104253438 100644 --- a/src/main/java/forestry/greenhouse/tiles/TileGreenhouse.java +++ b/src/main/java/forestry/greenhouse/tiles/TileGreenhouse.java @@ -17,7 +17,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; - +import forestry.api.core.EnumCamouflageType; +import forestry.api.core.ICamouflageHandler; +import forestry.api.core.ICamouflagedBlock; import forestry.api.core.IErrorLogic; import forestry.api.core.IErrorLogicSource; import forestry.api.multiblock.IGreenhouseComponent; @@ -32,15 +34,15 @@ import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IStreamableGui; import forestry.core.proxy.Proxies; -import forestry.core.tiles.ICamouflagedBlock; import forestry.core.tiles.ITitled; +import forestry.greenhouse.blocks.BlockGreenhouse; import forestry.greenhouse.blocks.BlockGreenhouseType; import forestry.greenhouse.gui.ContainerGreenhouse; import forestry.greenhouse.gui.GuiGreenhouse; import forestry.greenhouse.multiblock.MultiblockLogicGreenhouse; import forestry.greenhouse.network.packets.PacketCamouflageUpdate; -public abstract class TileGreenhouse extends MultiblockTileEntityForestry implements IGreenhouseComponent, IHintSource, IStreamableGui, IErrorLogicSource, IRestrictedAccess, ITitled, ICamouflagedBlock { +public abstract class TileGreenhouse extends MultiblockTileEntityForestry implements IGreenhouseComponent, IHintSource, IStreamableGui, IErrorLogicSource, IRestrictedAccess, ITitled, ICamouflageHandler, ICamouflagedBlock { private ItemStack camouflageBlock; @@ -90,27 +92,22 @@ public abstract class TileGreenhouse extends MultiblockTileEntityForestry boolean canWork(G greenhouse) { - return hasRedstoneSignal(); + public boolean canWork(G greenhouse, boolean canWork) { + return canWork && hasRedstoneSignal(); } private boolean hasRedstoneSignal() { diff --git a/src/main/java/forestry/greenhouse/tiles/TileGreenhouseDoor.java b/src/main/java/forestry/greenhouse/tiles/TileGreenhouseDoor.java new file mode 100644 index 000000000..d38abca11 --- /dev/null +++ b/src/main/java/forestry/greenhouse/tiles/TileGreenhouseDoor.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.greenhouse.tiles; + +import forestry.api.core.IErrorLogic; +import forestry.api.core.IErrorLogicSource; +import forestry.api.multiblock.IGreenhouseComponent; +import forestry.api.multiblock.IMultiblockController; +import forestry.core.access.EnumAccess; +import forestry.core.access.IAccessHandler; +import forestry.core.access.IRestrictedAccess; +import forestry.core.multiblock.MultiblockTileEntityForestry; +import forestry.greenhouse.multiblock.MultiblockLogicGreenhouse; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; + +public class TileGreenhouseDoor extends MultiblockTileEntityForestry implements IGreenhouseComponent.Door, IErrorLogicSource, IRestrictedAccess { + + public TileGreenhouseDoor() { + super(new MultiblockLogicGreenhouse()); + } + + @Override + public void onMachineAssembled(IMultiblockController multiblockController, BlockPos minCoord, BlockPos maxCoord) { + worldObj.notifyBlockOfStateChange(getPos(), worldObj.getBlockState(pos).getBlock()); + markDirty(); + } + + @Override + public void onMachineBroken() { + worldObj.notifyBlockOfStateChange(getPos(), worldObj.getBlockState(pos).getBlock()); + markDirty(); + } + + @Override + public boolean allowsAutomation() { + return false; + } + + @Override + public IErrorLogic getErrorLogic() { + return getMultiblockLogic().getController().getErrorLogic(); + } + + @Override + public IAccessHandler getAccessHandler() { + return getMultiblockLogic().getController().getAccessHandler(); + } + + @Override + public void onSwitchAccess(EnumAccess oldAccess, EnumAccess newAccess) { + getMultiblockLogic().getController().onSwitchAccess(oldAccess, newAccess); + } + + @Override + public Object getGui(EntityPlayer player, int data) { + return null; + } + + @Override + public Object getContainer(EntityPlayer player, int data) { + return null; + } + +} diff --git a/src/main/java/forestry/greenhouse/tiles/TileGreenhouseGearbox.java b/src/main/java/forestry/greenhouse/tiles/TileGreenhouseGearbox.java index 9ddc32453..7265742b7 100644 --- a/src/main/java/forestry/greenhouse/tiles/TileGreenhouseGearbox.java +++ b/src/main/java/forestry/greenhouse/tiles/TileGreenhouseGearbox.java @@ -25,22 +25,25 @@ public class TileGreenhouseGearbox extends TileGreenhouse implements IEnergyRece /* IEnergyReceiver */ @Override public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) { - if(getEnergyManager() == null) + if(getEnergyManager() == null) { return 0; + } return getEnergyManager().receiveEnergy(from, maxReceive, simulate); } @Override public int getEnergyStored(EnumFacing from) { - if(getEnergyManager() == null) + if(getEnergyManager() == null) { return 0; + } return getEnergyManager().getEnergyStored(from); } @Override public int getMaxEnergyStored(EnumFacing from) { - if(getEnergyManager() == null) + if(getEnergyManager() == null) { return 0; + } return getEnergyManager().getMaxEnergyStored(from); } @@ -50,8 +53,9 @@ public class TileGreenhouseGearbox extends TileGreenhouse implements IEnergyRece } private EnergyManager getEnergyManager() { - if(!getMultiblockLogic().isConnected()) + if(!getMultiblockLogic().isConnected()) { return null; + } return getMultiblockLogic().getController().getEnergyManager(); } diff --git a/src/main/java/forestry/greenhouse/tiles/TileGreenhousePlain.java b/src/main/java/forestry/greenhouse/tiles/TileGreenhousePlain.java index 9ac011d68..faa72c872 100644 --- a/src/main/java/forestry/greenhouse/tiles/TileGreenhousePlain.java +++ b/src/main/java/forestry/greenhouse/tiles/TileGreenhousePlain.java @@ -11,5 +11,4 @@ package forestry.greenhouse.tiles; public class TileGreenhousePlain extends TileGreenhouse { - } diff --git a/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java b/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java index 30ed01259..f594386b6 100755 --- a/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java +++ b/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java @@ -30,7 +30,7 @@ public abstract class AIButterflyInteract extends AIButterflyBase { return false; } - rest = new BlockPos((int) entity.posX, ((int) Math.floor(entity.posY)) - 1, (int) entity.posZ); + rest = new BlockPos((int) entity.posX, (int) Math.floor(entity.posY) - 1, (int) entity.posZ); if (entity.worldObj.isAirBlock(rest)) { return false; } diff --git a/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java b/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java index dc3274cf1..e9a9a2f5b 100755 --- a/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java +++ b/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java @@ -36,7 +36,7 @@ public class AIButterflyRest extends AIButterflyBase { } int x = (int) entity.posX; - int y = ((int) Math.floor(entity.posY)); + int y = (int) Math.floor(entity.posY); int z = (int) entity.posZ; BlockPos pos = new BlockPos(x, y, z); diff --git a/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java b/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java index 44c9d6edd..a81182b7d 100755 --- a/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java +++ b/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java @@ -464,7 +464,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly motionY += (Math.signum(diffY) * 0.699999988079071d - motionY) * 0.10000000149011612d; motionZ += (Math.signum(diffZ) * 0.5d - motionZ) * 0.10000000149011612d; - float horizontal = (float) ((Math.atan2(motionZ, motionX) * 180d) / Math.PI) - 90f; + float horizontal = (float) (Math.atan2(motionZ, motionX) * 180d / Math.PI) - 90f; rotationYaw += MathHelper.wrapAngleTo180_float(horizontal - rotationYaw); setMoveForward(contained.getGenome().getSpeed()); diff --git a/src/main/java/forestry/lepidopterology/genetics/AlleleButterflySpecies.java b/src/main/java/forestry/lepidopterology/genetics/AlleleButterflySpecies.java index 5f02cf0a3..a0d7efbc9 100755 --- a/src/main/java/forestry/lepidopterology/genetics/AlleleButterflySpecies.java +++ b/src/main/java/forestry/lepidopterology/genetics/AlleleButterflySpecies.java @@ -123,7 +123,7 @@ public class AlleleButterflySpecies extends AlleleSpecies implements IAlleleButt /* RESEARCH */ @Override public int getComplexity() { - return (int) ((1.35f / rarity) * 1.5); + return (int) (1.35f / rarity * 1.5); } @Override diff --git a/src/main/java/forestry/lepidopterology/genetics/ButterflyDefinition.java b/src/main/java/forestry/lepidopterology/genetics/ButterflyDefinition.java index 624cb998d..9636a935a 100644 --- a/src/main/java/forestry/lepidopterology/genetics/ButterflyDefinition.java +++ b/src/main/java/forestry/lepidopterology/genetics/ButterflyDefinition.java @@ -310,7 +310,7 @@ public enum ButterflyDefinition implements IButterflyDefinition { String uid = "lepi" + name(); IClassification parent = branch.getBranch().getParent(); - String unlocalizedName = "for.butterflies.species." + parent.getUID().substring((parent.getLevel().name().toLowerCase(Locale.ENGLISH)).length() + 1) + '.' + speciesName; + String unlocalizedName = "for.butterflies.species." + parent.getUID().substring(parent.getLevel().name().toLowerCase(Locale.ENGLISH).length() + 1) + '.' + speciesName; String unlocalizedDescription = "for.description." + uid; String texture = "butterflies/" + uid; diff --git a/src/main/java/forestry/lepidopterology/genetics/MothDefinition.java b/src/main/java/forestry/lepidopterology/genetics/MothDefinition.java index 4f62c2462..64d22f09a 100644 --- a/src/main/java/forestry/lepidopterology/genetics/MothDefinition.java +++ b/src/main/java/forestry/lepidopterology/genetics/MothDefinition.java @@ -54,7 +54,7 @@ public enum MothDefinition implements IButterflyDefinition { String uid = "moth" + name(); IClassification parent = branch.getBranch().getParent(); - String unlocalizedName = "for.butterflies.species." + parent.getUID().substring((parent.getLevel().name().toLowerCase(Locale.ENGLISH)).length() + 1) + '.' + speciesName; + String unlocalizedName = "for.butterflies.species." + parent.getUID().substring(parent.getLevel().name().toLowerCase(Locale.ENGLISH).length() + 1) + '.' + speciesName; String unlocalizedDescription = "for.description." + uid; String texture = "butterflies/" + uid; diff --git a/src/main/java/forestry/lepidopterology/render/ModelButterfly.java b/src/main/java/forestry/lepidopterology/render/ModelButterfly.java index e8371c0b8..05c528713 100755 --- a/src/main/java/forestry/lepidopterology/render/ModelButterfly.java +++ b/src/main/java/forestry/lepidopterology/render/ModelButterfly.java @@ -78,7 +78,7 @@ public class ModelButterfly extends ModelBase { GL11.glPushMatrix(); GL11.glScalef(scale, scale, scale); - GL11.glTranslatef(0.0F, (20.0f / scale) * f5, 0.0F); + GL11.glTranslatef(0.0F, 20.0f / scale * f5, 0.0F); wingRight.render(f5); eyeRight.render(f5); eyeLeft.render(f5); diff --git a/src/main/java/forestry/mail/TradeStation.java b/src/main/java/forestry/mail/TradeStation.java index 103a387e0..9ada6ba70 100755 --- a/src/main/java/forestry/mail/TradeStation.java +++ b/src/main/java/forestry/mail/TradeStation.java @@ -310,7 +310,7 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve for (ItemStack stack : InventoryUtil.getStacks(inventory, SLOT_SEND_BUFFER, SLOT_SEND_BUFFER_COUNT)) { if (stack != null && stack.isItemEqual(tradegood) && ItemStack.areItemStackTagsEqual(stack, tradegood)) { - orderCount += (stack.stackSize / (float) tradegood.stackSize); + orderCount += stack.stackSize / (float) tradegood.stackSize; if (orderCount >= max) { return max; } diff --git a/src/main/java/forestry/mail/gui/ContainerTrader.java b/src/main/java/forestry/mail/gui/ContainerTrader.java index 4ec08bc55..4274b4391 100755 --- a/src/main/java/forestry/mail/gui/ContainerTrader.java +++ b/src/main/java/forestry/mail/gui/ContainerTrader.java @@ -59,7 +59,7 @@ public class ContainerTrader extends ContainerTile { for (int row = 0; row < 2; row++) { for (int col = 0; col < bufCols; col++) { - addSlotToContainer(new SlotFiltered(this.tile, TradeStation.SLOT_SEND_BUFFER + col + row * bufCols, 123 + col * 18, (19 + (18 * 4)) + row * 18)); + addSlotToContainer(new SlotFiltered(this.tile, TradeStation.SLOT_SEND_BUFFER + col + row * bufCols, 123 + col * 18, 19 + 18 * 4 + row * 18)); } } } diff --git a/src/main/java/forestry/mail/gui/GuiCatalogue.java b/src/main/java/forestry/mail/gui/GuiCatalogue.java index f1f2a1f6b..ef09ab118 100755 --- a/src/main/java/forestry/mail/gui/GuiCatalogue.java +++ b/src/main/java/forestry/mail/gui/GuiCatalogue.java @@ -55,7 +55,7 @@ public class GuiCatalogue extends GuiForestry { buttonList.add(new GuiButton(2, width / 2 + 44, guiTop + 150, 12, 20, ">")); buttonList.add(new GuiButton(3, width / 2 - 58, guiTop + 150, 12, 20, "<")); - buttonFilter = new GuiButton(4, (width / 2) - 44, guiTop + 150, 42, 20, StringUtil.localize("gui.mail.filter.all")); + buttonFilter = new GuiButton(4, width / 2 - 44, guiTop + 150, 42, 20, StringUtil.localize("gui.mail.filter.all")); buttonList.add(buttonFilter); buttonUse = new GuiButton(5, width / 2, guiTop + 150, 42, 20, StringUtil.localize("gui.mail.address.copy")); diff --git a/src/main/java/forestry/mail/network/packets/PacketTraderAddressRequest.java b/src/main/java/forestry/mail/network/packets/PacketTraderAddressRequest.java index bc3dfe752..b3f564a36 100644 --- a/src/main/java/forestry/mail/network/packets/PacketTraderAddressRequest.java +++ b/src/main/java/forestry/mail/network/packets/PacketTraderAddressRequest.java @@ -54,7 +54,7 @@ public class PacketTraderAddressRequest extends PacketCoordinates implements IFo @Override public void onPacketData(DataInputStreamForestry data, EntityPlayerMP player) throws IOException { TileEntity tile = getTarget(player.worldObj); - if ((tile instanceof TileTrader)) { + if (tile instanceof TileTrader) { ((TileTrader) tile).handleSetAddressRequest(addressName); } } diff --git a/src/main/java/forestry/mail/network/packets/PacketTraderAddressResponse.java b/src/main/java/forestry/mail/network/packets/PacketTraderAddressResponse.java index 28e4d4316..20b6e38c8 100644 --- a/src/main/java/forestry/mail/network/packets/PacketTraderAddressResponse.java +++ b/src/main/java/forestry/mail/network/packets/PacketTraderAddressResponse.java @@ -54,7 +54,7 @@ public class PacketTraderAddressResponse extends PacketCoordinates implements IF @Override public void onPacketData(DataInputStreamForestry data, EntityPlayer player) throws IOException { TileEntity tile = getTarget(player.worldObj); - if ((tile instanceof TileTrader)) { + if (tile instanceof TileTrader) { ((TileTrader) tile).handleSetAddressResponse(addressName); } } diff --git a/src/main/java/forestry/mail/tiles/TileTrader.java b/src/main/java/forestry/mail/tiles/TileTrader.java index bb9dc7560..792dc64c7 100644 --- a/src/main/java/forestry/mail/tiles/TileTrader.java +++ b/src/main/java/forestry/mail/tiles/TileTrader.java @@ -208,7 +208,7 @@ public class TileTrader extends TileBase { } } - return ((float) count / (float) total); + return (float) count / (float) total; } public boolean hasPaperMin(int count) { diff --git a/src/main/java/forestry/plugins/PluginManager.java b/src/main/java/forestry/plugins/PluginManager.java index 1f9999d0a..1a235a66a 100644 --- a/src/main/java/forestry/plugins/PluginManager.java +++ b/src/main/java/forestry/plugins/PluginManager.java @@ -109,7 +109,7 @@ public class PluginManager { IFuelHandler fuelHandler = plugin.getFuelHandler(); if (fuelHandler != null) { - GameRegistry.registerFuelHandler((fuelHandler)); + GameRegistry.registerFuelHandler(fuelHandler); } } diff --git a/src/main/java/forestry/storage/BackpackDefinition.java b/src/main/java/forestry/storage/BackpackDefinition.java index d8d25fdd4..78f475e52 100755 --- a/src/main/java/forestry/storage/BackpackDefinition.java +++ b/src/main/java/forestry/storage/BackpackDefinition.java @@ -51,7 +51,7 @@ public class BackpackDefinition implements IBackpackDefinition { @Override public String getName(ItemStack backpack) { Item item = backpack.getItem(); - String display = (StatCollector.translateToLocal(item.getUnlocalizedNameInefficiently(backpack) + ".name")).trim(); + String display = StatCollector.translateToLocal(item.getUnlocalizedNameInefficiently(backpack) + ".name").trim(); if (backpack.hasTagCompound() && backpack.getTagCompound().hasKey("display", 10)) { NBTTagCompound nbt = backpack.getTagCompound().getCompoundTag("display"); diff --git a/src/main/java/forestry/storage/PickupHandlerStorage.java b/src/main/java/forestry/storage/PickupHandlerStorage.java index f1d688ea8..ce1dfff43 100755 --- a/src/main/java/forestry/storage/PickupHandlerStorage.java +++ b/src/main/java/forestry/storage/PickupHandlerStorage.java @@ -52,7 +52,7 @@ public class PickupHandlerStorage implements IPickupHandler { continue; } - ItemBackpack backpack = ((ItemBackpack) pack.getItem()); + ItemBackpack backpack = (ItemBackpack) pack.getItem(); IBackpackDefinition backpackDefinition = backpack.getDefinition(); if (backpackDefinition.isValidItem(itemstack)) { ItemBackpack.tryStowing(player, pack, itemstack); diff --git a/src/main/java/forestry/storage/ResupplyHandler.java b/src/main/java/forestry/storage/ResupplyHandler.java index 420086e43..08d933a83 100755 --- a/src/main/java/forestry/storage/ResupplyHandler.java +++ b/src/main/java/forestry/storage/ResupplyHandler.java @@ -32,7 +32,7 @@ public class ResupplyHandler implements IResupplyHandler { private static List backpacks(InventoryPlayer playerInventory) { List backpacks = new ArrayList<>(); for (ItemStack itemStack : playerInventory.mainInventory) { - if (itemStack != null && itemStack.stackSize > 0 && (itemStack.getItem() instanceof ItemBackpack)) { + if (itemStack != null && itemStack.stackSize > 0 && itemStack.getItem() instanceof ItemBackpack) { backpacks.add(itemStack); } } @@ -61,7 +61,7 @@ public class ResupplyHandler implements IResupplyHandler { } // Load their inventory - ItemBackpack backpackItem = ((ItemBackpack) backpack.getItem()); + ItemBackpack backpackItem = (ItemBackpack) backpack.getItem(); ItemInventory backpackInventory = new ItemInventoryBackpack(player, backpackItem.getBackpackSize(), backpack); Event event = new BackpackResupplyEvent(player, backpackItem.getDefinition(), backpackInventory); diff --git a/src/main/java/forestry/storage/items/ItemBackpack.java b/src/main/java/forestry/storage/items/ItemBackpack.java index 94e5950a6..c2e7ed149 100755 --- a/src/main/java/forestry/storage/items/ItemBackpack.java +++ b/src/main/java/forestry/storage/items/ItemBackpack.java @@ -108,7 +108,7 @@ public class ItemBackpack extends ItemWithGui { public static ItemStack tryStowing(EntityPlayer player, ItemStack backpackStack, ItemStack stack) { - ItemBackpack backpack = ((ItemBackpack) backpackStack.getItem()); + ItemBackpack backpack = (ItemBackpack) backpackStack.getItem(); ItemInventory inventory = new ItemInventoryBackpack(player, backpack.getBackpackSize(), backpackStack); if (backpackStack.getItemDamage() == 1) { return stack; @@ -235,7 +235,7 @@ public class ItemBackpack extends ItemWithGui { @SideOnly(Side.CLIENT) @Override public void registerModel(Item item, IModelManager manager) { - EnumBackpackType t = (type == EnumBackpackType.NATURALIST) ? EnumBackpackType.NORMAL : type; + EnumBackpackType t = type == EnumBackpackType.NATURALIST ? EnumBackpackType.NORMAL : type; String typeTag = "backpacks/" + t.toString().toLowerCase(Locale.ENGLISH); models = new ModelResourceLocation[4]; models[0] = new ModelResourceLocation("forestry:" + typeTag + "_neutral", "inventory"); @@ -297,6 +297,7 @@ public class ItemBackpack extends ItemWithGui { } } + @SuppressWarnings("incomplete-switch") @Override public Object getGui(EntityPlayer player, ItemStack heldItem, int data) { if (data > EnumBackpackType.values().length) { @@ -312,6 +313,7 @@ public class ItemBackpack extends ItemWithGui { return null; } + @SuppressWarnings("incomplete-switch") @Override public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) { if (data > EnumBackpackType.values().length) { diff --git a/src/main/resources/assets/forestry/blockstates/greenhouse.door.json b/src/main/resources/assets/forestry/blockstates/greenhouse.door.json new file mode 100644 index 000000000..09c3e2d59 --- /dev/null +++ b/src/main/resources/assets/forestry/blockstates/greenhouse.door.json @@ -0,0 +1,36 @@ +{ + "variants": { + "facing=east,half=lower,hinge=left,open=false": { "model": "forestry:greenhouse.door_bottom" }, + "facing=south,half=lower,hinge=left,open=false": { "model": "forestry:greenhouse.door_bottom", "y": 90 }, + "facing=west,half=lower,hinge=left,open=false": { "model": "forestry:greenhouse.door_bottom", "y": 180 }, + "facing=north,half=lower,hinge=left,open=false": { "model": "forestry:greenhouse.door_bottom", "y": 270 }, + "facing=east,half=lower,hinge=right,open=false": { "model": "forestry:greenhouse.door_bottom_rh" }, + "facing=south,half=lower,hinge=right,open=false": { "model": "forestry:greenhouse.door_bottom_rh", "y": 90 }, + "facing=west,half=lower,hinge=right,open=false": { "model": "forestry:greenhouse.door_bottom_rh", "y": 180 }, + "facing=north,half=lower,hinge=right,open=false": { "model": "forestry:greenhouse.door_bottom_rh", "y": 270 }, + "facing=east,half=lower,hinge=left,open=true": { "model": "forestry:greenhouse.door_bottom_rh", "y": 90 }, + "facing=south,half=lower,hinge=left,open=true": { "model": "forestry:greenhouse.door_bottom_rh", "y": 180 }, + "facing=west,half=lower,hinge=left,open=true": { "model": "forestry:greenhouse.door_bottom_rh", "y": 270 }, + "facing=north,half=lower,hinge=left,open=true": { "model": "forestry:greenhouse.door_bottom_rh" }, + "facing=east,half=lower,hinge=right,open=true": { "model": "forestry:greenhouse.door_bottom", "y": 270 }, + "facing=south,half=lower,hinge=right,open=true": { "model": "forestry:greenhouse.door_bottom" }, + "facing=west,half=lower,hinge=right,open=true": { "model": "forestry:greenhouse.door_bottom", "y": 90 }, + "facing=north,half=lower,hinge=right,open=true": { "model": "forestry:greenhouse.door_bottom", "y": 180 }, + "facing=east,half=upper,hinge=left,open=false": { "model": "forestry:greenhouse.door_top" }, + "facing=south,half=upper,hinge=left,open=false": { "model": "forestry:greenhouse.door_top", "y": 90 }, + "facing=west,half=upper,hinge=left,open=false": { "model": "forestry:greenhouse.door_top", "y": 180 }, + "facing=north,half=upper,hinge=left,open=false": { "model": "forestry:greenhouse.door_top", "y": 270 }, + "facing=east,half=upper,hinge=right,open=false": { "model": "forestry:greenhouse.door_top_rh" }, + "facing=south,half=upper,hinge=right,open=false": { "model": "forestry:greenhouse.door_top_rh", "y": 90 }, + "facing=west,half=upper,hinge=right,open=false": { "model": "forestry:greenhouse.door_top_rh", "y": 180 }, + "facing=north,half=upper,hinge=right,open=false": { "model": "forestry:greenhouse.door_top_rh", "y": 270 }, + "facing=east,half=upper,hinge=left,open=true": { "model": "forestry:greenhouse.door_top_rh", "y": 90 }, + "facing=south,half=upper,hinge=left,open=true": { "model": "forestry:greenhouse.door_top_rh", "y": 180 }, + "facing=west,half=upper,hinge=left,open=true": { "model": "forestry:greenhouse.door_top_rh", "y": 270 }, + "facing=north,half=upper,hinge=left,open=true": { "model": "forestry:greenhouse.door_top_rh" }, + "facing=east,half=upper,hinge=right,open=true": { "model": "forestry:greenhouse.door_top", "y": 270 }, + "facing=south,half=upper,hinge=right,open=true": { "model": "forestry:greenhouse.door_top" }, + "facing=west,half=upper,hinge=right,open=true": { "model": "forestry:greenhouse.door_top", "y": 90 }, + "facing=north,half=upper,hinge=right,open=true": { "model": "forestry:greenhouse.door_top", "y": 180 } + } +} diff --git a/src/main/resources/assets/forestry/models/block/greenhouse.door_bottom.json b/src/main/resources/assets/forestry/models/block/greenhouse.door_bottom.json new file mode 100644 index 000000000..5f32e330b --- /dev/null +++ b/src/main/resources/assets/forestry/models/block/greenhouse.door_bottom.json @@ -0,0 +1,7 @@ +{ + "parent": "block/door_bottom", + "textures": { + "bottom": "blocks/glass_green", + "top": "blocks/glass_green" + } +} diff --git a/src/main/resources/assets/forestry/models/block/greenhouse.door_bottom_rh.json b/src/main/resources/assets/forestry/models/block/greenhouse.door_bottom_rh.json new file mode 100644 index 000000000..7225cc63f --- /dev/null +++ b/src/main/resources/assets/forestry/models/block/greenhouse.door_bottom_rh.json @@ -0,0 +1,7 @@ +{ + "parent": "block/door_bottom_rh", + "textures": { + "bottom": "blocks/glass_green", + "top": "blocks/glass_green" + } +} diff --git a/src/main/resources/assets/forestry/models/block/greenhouse.door_top.json b/src/main/resources/assets/forestry/models/block/greenhouse.door_top.json new file mode 100644 index 000000000..4487a9dae --- /dev/null +++ b/src/main/resources/assets/forestry/models/block/greenhouse.door_top.json @@ -0,0 +1,7 @@ +{ + "parent": "block/door_top", + "textures": { + "bottom": "blocks/glass_green", + "top": "blocks/glass_green" + } +} diff --git a/src/main/resources/assets/forestry/models/block/greenhouse.door_top_rh.json b/src/main/resources/assets/forestry/models/block/greenhouse.door_top_rh.json new file mode 100644 index 000000000..1820f8469 --- /dev/null +++ b/src/main/resources/assets/forestry/models/block/greenhouse.door_top_rh.json @@ -0,0 +1,7 @@ +{ + "parent": "block/door_top_rh", + "textures": { + "bottom": "blocks/glass_green", + "top": "blocks/glass_green" + } +} diff --git a/src/main/resources/assets/forestry/models/item/greenhouse.door.json b/src/main/resources/assets/forestry/models/item/greenhouse.door.json new file mode 100644 index 000000000..1b5501839 --- /dev/null +++ b/src/main/resources/assets/forestry/models/item/greenhouse.door.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "forestry:items/greenhouse.door" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/forestry/textures/gui/greenhouse.png b/src/main/resources/assets/forestry/textures/gui/greenhouse.png index 8f95f13b7..29387f8fd 100644 Binary files a/src/main/resources/assets/forestry/textures/gui/greenhouse.png and b/src/main/resources/assets/forestry/textures/gui/greenhouse.png differ diff --git a/src/main/resources/assets/forestry/textures/items/greenhouse.door.png b/src/main/resources/assets/forestry/textures/items/greenhouse.door.png new file mode 100644 index 000000000..f7c602e69 Binary files /dev/null and b/src/main/resources/assets/forestry/textures/items/greenhouse.door.png differ