Add camouflage system, add greenhouse door and clean up

This commit is contained in:
Nedelosk committed 2016-03-13 21:00:45 +01:00
1 parent 7238886d00
commit bde92c4afc
158 files changed
+1476 -491

No files matched your search

@@ -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();
}
@@ -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);
}
@@ -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();
}
@@ -10,7 +10,7 @@ import forestry.api.multiblock.IGreenhouseController;
public class DefaultGreenhouseListener implements IGreenhouseListener {
@Override
public <G extends IGreenhouseController & IGreenhouseHousing> boolean canWork(G greenhouse) {
public <G extends IGreenhouseController & IGreenhouseHousing> boolean canWork(G greenhouse, boolean canWork) {
return true;
}
@@ -0,0 +1,7 @@
package forestry.api.greenhouse;
public class GreenhouseManager {
public static IGreenhouseItemAccess greenhouseItemAccess;
}
@@ -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;
@@ -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);
}
@@ -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.
*/
<G extends IGreenhouseController & IGreenhouseHousing> boolean canWork(G greenhouse);
<G extends IGreenhouseController & IGreenhouseHousing> boolean canWork(G greenhouse, boolean canWork);
}
@@ -16,6 +16,9 @@ public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> exte
interface Listener extends IGreenhouseComponent {
IGreenhouseListener getGreenhouseListener();
}
interface Door extends IGreenhouseComponent {
}
interface Climatiser extends IGreenhouseComponent {
<G extends IGreenhouseController & IGreenhouseHousing & IClimateControlled> void changeClimate(int tickCount, G greenhouse);
@@ -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);
@@ -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
@@ -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
@@ -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;
}
}
@@ -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) {
@@ -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) {
@@ -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);
@@ -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
@@ -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
@@ -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);
@@ -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) {
@@ -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
@@ -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);
@@ -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;
}
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
@@ -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;
@@ -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);
@@ -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);
@@ -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;
@@ -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);
@@ -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++) {
@@ -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<BlockPos> branchCoords = new ArrayList<>();
for (int yBranch = topHeight; yBranch < height; yBranch++) {
@@ -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;
}
@@ -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);
}
@@ -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() {
@@ -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;
@@ -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();
@@ -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);
}
@@ -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;
}
@@ -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;
}
}
@@ -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);
}
@@ -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();
}
}
@@ -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 {
@@ -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) {
@@ -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<? extends IMutation> combinations = getRoot().getCombinations(this);
if (combinations.size() > 0) {
IMutation[] candidates = combinations.toArray(new IMutation[combinations.size()]);
@@ -67,7 +67,7 @@ public class ContainerEntity<T extends Entity & IInventory> extends ContainerFor
IErrorLogicSource errorLogicSource = (IErrorLogicSource) entity;
ImmutableSet<IErrorState> errorStates = errorLogicSource.getErrorLogic().getErrorStates();
if ((previousErrorStates == null) || !errorStates.equals(previousErrorStates)) {
if (previousErrorStates == null || !errorStates.equals(previousErrorStates)) {
PacketErrorUpdateEntity packet = new PacketErrorUpdateEntity(entity, errorLogicSource);
sendPacketToCrafters(packet);
}
@@ -42,7 +42,7 @@ public class ContainerEscritoire extends ContainerTile<TileEscritoire> 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));
}
}
}
@@ -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()) {
@@ -77,7 +77,7 @@ public abstract class ContainerTile<T extends TileEntity> extends ContainerFores
IErrorLogicSource errorLogicSource = (IErrorLogicSource) tile;
ImmutableSet<IErrorState> errorStates = errorLogicSource.getErrorLogic().getErrorStates();
if ((previousErrorStates == null) || !errorStates.equals(previousErrorStates)) {
if (previousErrorStates == null || !errorStates.equals(previousErrorStates)) {
PacketErrorUpdate packet = new PacketErrorUpdate(tile, errorLogicSource);
sendPacketToCrafters(packet);
}
@@ -112,8 +112,8 @@ public abstract class GuiAlyzer extends GuiForestry<ContainerAlyzer, IInventory>
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<ContainerAlyzer, IInventory>
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);
}
}
@@ -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,
@@ -60,7 +60,7 @@ public class TextLayoutHelper {
}
public void newLineCompressed() {
line += (LINE_HEIGHT - 2);
line += LINE_HEIGHT - 2;
}
public void newLine(int lineHeight) {
@@ -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()) {
@@ -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();
@@ -63,8 +63,9 @@ public abstract class ModelBlockOverlay<B extends Block> 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<B extends Block> 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();
}
@@ -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.
@@ -43,8 +43,9 @@ public class ModelBakerModel implements IModelBakerModel {
public ModelBakerModel() {
general = new ArrayList<BakedQuad>();
for (EnumFacing f : EnumFacing.VALUES)
for (EnumFacing f : EnumFacing.VALUES) {
faces[f.ordinal()] = new ArrayList<BakedQuad>();
}
formate = DefaultVertexFormats.BLOCK;
isGui3d = true;
isAmbientOcclusion = false;
@@ -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
@@ -130,7 +130,7 @@ public abstract class MultiblockLogic<T extends IMultiblockControllerInternal> i
@Override
public final boolean isConnected() {
return (controller != null);
return controller != null;
}
public final void becomeMultiblockSaveDelegate() {
@@ -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);
}
}
@@ -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;
}
@@ -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];
}
@@ -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();
@@ -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;
@@ -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;
}
@@ -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
}
}
@@ -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;
@@ -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);
}
@@ -144,7 +144,7 @@ public abstract class TilePowered extends TileBase implements IRenderableTile, I
return 0;
}
return (workCounter * i) / ticksPerWorkCycle;
return workCounter * i / ticksPerWorkCycle;
}
@Override
@@ -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 */
@@ -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;
}
}
@@ -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);
@@ -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);
@@ -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();
@@ -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();
}
}
@@ -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);
}
}
@@ -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);
@@ -96,7 +96,7 @@ public class BlockEngine extends BlockBase<BlockTypeEngine> {
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;
}
}
@@ -59,7 +59,7 @@ public abstract class GuiEngine<C extends Container, I extends TileEngine> 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
@@ -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
@@ -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;
@@ -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
@@ -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);
@@ -37,9 +37,9 @@ public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWork
int slot = 0;
for (int y = 0; y < 3; y++) {
int yPos = 20 + (y * SPACING);
int yPos = 20 + y * SPACING;
for (int x = 0; x < 3; x++) {
int xPos = 110 + (x * SPACING);
int xPos = 110 + x * SPACING;
MemorizedRecipeSlot memorizedRecipeSlot = new MemorizedRecipeSlot(widgetManager, xPos, yPos, recipeMemory, slot++);
widgetManager.add(memorizedRecipeSlot);
}
@@ -59,7 +59,7 @@ public class InventoryMoistener extends InventoryAdapterTile<TileMoistener> {
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);
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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
@@ -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;
@@ -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
@@ -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;
}
}
@@ -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
@@ -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) {
@@ -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 */
@@ -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 */
@@ -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);
Loaded 100 of 158 files, more files were not shown because too many files have changed in this diff. Show more