diff --git a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java index 55f0c5065..45fe84643 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java +++ b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java @@ -2,11 +2,11 @@ * This class was created by . It's distributed as * part of the Botania Mod. Get the Source Code in github: * https://github.com/Vazkii/Botania - * + * * Botania is Open Source and distributed under a * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) - * + * * File Created @ [? (GMT)] */ package vazkii.botania.common.block.subtile.generating; @@ -19,95 +19,126 @@ import vazkii.botania.api.subtile.SubTileGenerating; import vazkii.botania.common.Botania; import vazkii.botania.common.lexicon.LexiconData; -public class SubTileHydroangeas extends SubTileGenerating { +import java.util.Random; - private static final String TAG_BURN_TIME = "burnTime"; - int burnTime = 0; - int currentTime = 0; +public class SubTileHydroangeas extends SubTileGenerating +{ - @Override - public void onUpdate(){ - super.onUpdate(); + private static final String TAG_BURN_TIME = "burnTime"; + int burnTime = 0; - int range = 1; + @Override + public void onUpdate() + { + super.onUpdate(); - boolean didSomething = false; + boolean didSomething = false; - if(burnTime == 0) { - if(supertile.getWorldObj().getWorldTime() % 40L == 0) { - if(mana < getMaxMana() && !supertile.getWorldObj().isRemote) - for(int i = -range; i <= range; i++) - for(int j = -range; j <= range; j++) { - if(supertile.getWorldObj().getBlock(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j) == getBlockToSearchFor() && supertile.getWorldObj().getBlockMetadata(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j) == 0) { - supertile.getWorldObj().setBlockToAir(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j); - didSomething = true; - burnTime += getBurnTime(); + System.out.println(burnTime); - break; + 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(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); - } + if(didSomething) + sync(); + } + } else + { + if(supertile.getWorldObj().rand.nextInt(8) == 0) + doBurnParticles(); + burnTime--; + } + } - public Block getBlockToSearchFor() { - return Blocks.water; - } + 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 int getBurnTime() { - return 10; - } + public Block getBlockToSearchFor() + { + return Blocks.water; + } - @Override - public int getMaxMana() { - return 150; - } + public int getBurnTime() + { + return 10; + } - @Override - public int getColor(){ - return 0x532FE0; - } + @Override + public int getMaxMana() + { + return 150; + } - @Override - public LexiconEntry getEntry() { - return LexiconData.hydroangeas; - } + @Override + public int getColor() + { + return 0x532FE0; + } - @Override - public void writeToPacketNBT(NBTTagCompound cmp) { - super.writeToPacketNBT(cmp); + @Override + public LexiconEntry getEntry() + { + return LexiconData.hydroangeas; + } - cmp.setInteger(TAG_BURN_TIME, burnTime); - } + @Override + public void writeToPacketNBT(NBTTagCompound cmp) + { + super.writeToPacketNBT(cmp); - @Override - public void readFromPacketNBT(NBTTagCompound cmp) { - super.readFromPacketNBT(cmp); + cmp.setInteger(TAG_BURN_TIME, burnTime); + } - burnTime = cmp.getInteger(TAG_BURN_TIME); - } + @Override + public void readFromPacketNBT(NBTTagCompound cmp) + { + super.readFromPacketNBT(cmp); - @Override - public boolean canGeneratePassively() { - return burnTime > 0; - } + burnTime = cmp.getInteger(TAG_BURN_TIME); + } - @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 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; + } }