From 8c4e3da2538123aa0b83fe86c7ecc219218847ce Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Sun, 25 May 2014 22:20:56 +0100 Subject: [PATCH] Format Pokefenn's mess. --- .../generating/SubTileHydroangeas.java | 183 ++++++++---------- 1 file changed, 83 insertions(+), 100 deletions(-) diff --git a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java index 45fe84643..7f169ff1a 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java +++ b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java @@ -21,124 +21,107 @@ import vazkii.botania.common.lexicon.LexiconData; import java.util.Random; -public class SubTileHydroangeas extends SubTileGenerating -{ +public class SubTileHydroangeas extends SubTileGenerating { - private static final String TAG_BURN_TIME = "burnTime"; - int burnTime = 0; + private static final String TAG_BURN_TIME = "burnTime"; + int burnTime = 0; - @Override - public void onUpdate() - { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - boolean didSomething = false; + boolean didSomething = false; - System.out.println(burnTime); + System.out.println(burnTime); - if(burnTime == 0) - { - if(supertile.getWorldObj().getWorldTime() % 40L == 0) - if(mana < getMaxMana() && !supertile.getWorldObj().isRemote) - { - Random random = new Random(); - int randomInt = random.nextInt(3); - int randomInt2 = random.nextInt(3); - int randomBoolean = random.nextBoolean() ? 1 : -1; - int[] positions = new int[]{supertile.xCoord + randomBoolean, supertile.zCoord + random.nextInt(1)}; - System.out.println(randomInt); - if(randomInt == 0) - positions[0] = supertile.xCoord; - if(randomInt == 1) - positions[0] = supertile.xCoord + 1; - if(randomInt == 2) - positions[0] = supertile.xCoord - 1; - if(randomInt2 == 0) - positions[1] = supertile.zCoord; - if(randomInt2 == 1) - positions[1] = supertile.zCoord + 1; - if(randomInt2 == 2) - positions[1] = supertile.zCoord - 1; + if(burnTime == 0) { + if(supertile.getWorldObj().getWorldTime() % 40L == 0) + if(mana < getMaxMana() && !supertile.getWorldObj().isRemote) { + Random random = new Random(); + int randomInt = random.nextInt(3); + int randomInt2 = random.nextInt(3); + int randomBoolean = random.nextBoolean() ? 1 : -1; + int[] positions = new int[]{supertile.xCoord + randomBoolean, supertile.zCoord + random.nextInt(1)}; + System.out.println(randomInt); + if(randomInt == 0) + positions[0] = supertile.xCoord; + if(randomInt == 1) + positions[0] = supertile.xCoord + 1; + if(randomInt == 2) + positions[0] = supertile.xCoord - 1; + if(randomInt2 == 0) + positions[1] = supertile.zCoord; + if(randomInt2 == 1) + positions[1] = supertile.zCoord + 1; + if(randomInt2 == 2) + positions[1] = supertile.zCoord - 1; - if(supertile.getWorldObj().getBlock(positions[0], supertile.yCoord, positions[1]) == getBlockToSearchFor() && supertile.getWorldObj().getBlockMetadata(positions[0], supertile.yCoord, positions[1]) == 0) - { - supertile.getWorldObj().setBlockToAir(positions[0], supertile.yCoord, positions[1]); - didSomething = true; - burnTime += getBurnTime(); - } + if(supertile.getWorldObj().getBlock(positions[0], supertile.yCoord, positions[1]) == getBlockToSearchFor() && supertile.getWorldObj().getBlockMetadata(positions[0], supertile.yCoord, positions[1]) == 0) { + supertile.getWorldObj().setBlockToAir(positions[0], supertile.yCoord, positions[1]); + didSomething = true; + burnTime += getBurnTime(); + } + if(didSomething) + sync(); + } + } else { + if(supertile.getWorldObj().rand.nextInt(8) == 0) + doBurnParticles(); + burnTime--; + } + } - if(didSomething) - sync(); - } - } else - { - if(supertile.getWorldObj().rand.nextInt(8) == 0) - doBurnParticles(); - burnTime--; - } - } + public void doBurnParticles() { + Botania.proxy.wispFX(supertile.getWorldObj(), supertile.xCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.yCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.zCoord + 0.5, 0.05F, 0.05F, 0.7F, (float) Math.random() / 6, (float) -Math.random() / 60); + } - public void doBurnParticles() - { - Botania.proxy.wispFX(supertile.getWorldObj(), supertile.xCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.yCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.zCoord + 0.5, 0.05F, 0.05F, 0.7F, (float) Math.random() / 6, (float) -Math.random() / 60); - } + public Block getBlockToSearchFor() { + return Blocks.water; + } - public Block getBlockToSearchFor() - { - return Blocks.water; - } + public int getBurnTime() { + return 10; + } - public int getBurnTime() - { - return 10; - } + @Override + public int getMaxMana() { + return 150; + } - @Override - public int getMaxMana() - { - return 150; - } + @Override + public int getColor() { + return 0x532FE0; + } - @Override - public int getColor() - { - return 0x532FE0; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.hydroangeas; + } - @Override - public LexiconEntry getEntry() - { - return LexiconData.hydroangeas; - } + @Override + public void writeToPacketNBT(NBTTagCompound cmp) { + super.writeToPacketNBT(cmp); - @Override - public void writeToPacketNBT(NBTTagCompound cmp) - { - super.writeToPacketNBT(cmp); + cmp.setInteger(TAG_BURN_TIME, burnTime); + } - cmp.setInteger(TAG_BURN_TIME, burnTime); - } + @Override + public void readFromPacketNBT(NBTTagCompound cmp) { + super.readFromPacketNBT(cmp); - @Override - public void readFromPacketNBT(NBTTagCompound cmp) - { - super.readFromPacketNBT(cmp); + burnTime = cmp.getInteger(TAG_BURN_TIME); + } - burnTime = cmp.getInteger(TAG_BURN_TIME); - } + @Override + public boolean canGeneratePassively() { + return burnTime > 0; + } - @Override - public boolean canGeneratePassively() - { - return burnTime > 0; - } - - @Override - public int getDelayBetweenPassiveGeneration() - { - boolean rain = supertile.getWorldObj().getWorldChunkManager().getBiomeGenAt(supertile.xCoord, supertile.zCoord).getIntRainfall() > 0 && (supertile.getWorldObj().isRaining() || supertile.getWorldObj().isThundering()); - return rain ? 3 : 4; - } + @Override + public int getDelayBetweenPassiveGeneration() { + boolean rain = supertile.getWorldObj().getWorldChunkManager().getBiomeGenAt(supertile.xCoord, supertile.zCoord).getIntRainfall() > 0 && (supertile.getWorldObj().isRaining() || supertile.getWorldObj().isThundering()); + return rain ? 3 : 4; + } }