diff --git a/src/main/java/vazkii/botania/api/subtile/TileEntityGeneratingFlower.java b/src/main/java/vazkii/botania/api/subtile/TileEntityGeneratingFlower.java index 6cdf482df..3bec78ae2 100644 --- a/src/main/java/vazkii/botania/api/subtile/TileEntityGeneratingFlower.java +++ b/src/main/java/vazkii/botania/api/subtile/TileEntityGeneratingFlower.java @@ -48,8 +48,6 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower { private int mana; - public int redstoneSignal = 0; - int sizeLastCheck = -1; protected TileEntity linkedCollector = null; public int passiveDecayTicks; @@ -60,38 +58,20 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower { super(type); } - /** - * If set to true, redstoneSignal will be updated every tick. - */ - public boolean acceptsRedstone() { - return false; - } - @Override public void tickFlower() { super.tickFlower(); linkCollector(); - if (canGeneratePassively()) { + if (!getWorld().isRemote && canGeneratePassively()) { int delay = getDelayBetweenPassiveGeneration(); - if (delay > 0 && ticksExisted % delay == 0 && !getWorld().isRemote) { - if (shouldSyncPassiveGeneration()) { - sync(); - } + if (delay > 0 && ticksExisted % delay == 0) { addMana(getValueForPassiveGeneration()); } } emptyManaIntoCollector(); - if (acceptsRedstone()) { - redstoneSignal = 0; - for (Direction dir : Direction.values()) { - int redstoneSide = getWorld().getRedstonePower(getPos().offset(dir), dir); - redstoneSignal = Math.max(redstoneSignal, redstoneSide); - } - } - if (getWorld().isRemote) { double particleChance = 1F - (double) getMana() / (double) getMaxMana() / 3.5F; int color = getColor(); @@ -106,12 +86,14 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower { double z = getPos().getZ() + offset.z; BotaniaAPI.instance().sparkleFX(getWorld(), x + 0.3 + Math.random() * 0.5, y + 0.5 + Math.random() * 0.5, z + 0.3 + Math.random() * 0.5, red, green, blue, (float) Math.random(), 5); } - } - - boolean passive = isPassiveFlower(); - if (!getWorld().isRemote) { + } else { + boolean passive = isPassiveFlower(); int muhBalance = BotaniaAPI.instance().getPassiveFlowerDecay(); + if (passive) { + passiveDecayTicks++; + } + if (passive && muhBalance > 0 && passiveDecayTicks > muhBalance) { getWorld().destroyBlock(getPos(), false); if (Blocks.DEAD_BUSH.getDefaultState().isValidPosition(getWorld(), getPos())) { @@ -119,10 +101,6 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower { } } } - - if (passive) { - passiveDecayTicks++; - } } public void linkCollector() { @@ -175,6 +153,7 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower { int manaval = Math.min(getMana(), collector.getMaxMana() - collector.getCurrentMana()); addMana(manaval); collector.receiveMana(manaval); + sync(); } } } @@ -183,10 +162,6 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower { return false; } - public boolean shouldSyncPassiveGeneration() { - return false; - } - public boolean canGeneratePassively() { return false; } diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileArcaneRose.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileArcaneRose.java index 72e2d9426..37da5e48a 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileArcaneRose.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileArcaneRose.java @@ -30,7 +30,7 @@ public class SubTileArcaneRose extends TileEntityGeneratingFlower { public void tickFlower() { super.tickFlower(); - if (getMana() >= getMaxMana()) { + if (world.isRemote || getMana() >= getMaxMana()) { return; } @@ -39,6 +39,7 @@ public class SubTileArcaneRose extends TileEntityGeneratingFlower { if (ExperienceHelper.getPlayerXP(player) >= 1 && player.func_233570_aj_()) { ExperienceHelper.drainPlayerXP(player, 1); addMana(50); + sync(); return; } } @@ -48,6 +49,7 @@ public class SubTileArcaneRose extends TileEntityGeneratingFlower { if (orb.isAlive()) { addMana(orb.getXpValue() * 35); orb.remove(); + sync(); return; } } diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java index c9197c0aa..8e1b48ef8 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java @@ -11,6 +11,7 @@ package vazkii.botania.common.block.subtile.generating; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -49,8 +50,10 @@ public class SubTileDandelifeon extends TileEntityGeneratingFlower { public void tickFlower() { super.tickFlower(); - if (!getWorld().isRemote && redstoneSignal > 0 && ticksExisted % SPEED == 0) { - runSimulation(); + if (!getWorld().isRemote) { + if (ticksExisted % SPEED == 0 && getWorld().isBlockPowered(getPos())) { + runSimulation(); + } } } @@ -189,11 +192,6 @@ public class SubTileDandelifeon extends TileEntityGeneratingFlower { } } - @Override - public boolean acceptsRedstone() { - return true; - } - @Override public RadiusDescriptor getRadius() { return new RadiusDescriptor.Square(getEffectivePos(), RANGE); diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java index 0f5ce40e0..bd4f83b35 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java @@ -69,10 +69,7 @@ public class SubTileHydroangeas extends TileEntityGeneratingFlower { FluidState fstate = getWorld().getFluidState(pos); ITag search = getMaterialToSearchFor(); - if (fstate.isTagged(search) - && (getBlockToSearchBelow() == null - || getWorld().getBlockState(pos.down()).getBlock() == getBlockToSearchBelow()) - && fstate.isSource()) { + if (fstate.isTagged(search) && fstate.isSource()) { if (search != FluidTags.WATER) { getWorld().setBlockState(pos, Blocks.AIR.getDefaultState()); } else { @@ -121,10 +118,6 @@ public class SubTileHydroangeas extends TileEntityGeneratingFlower { return FluidTags.WATER; } - public Block getBlockToSearchBelow() { - return null; - } - public void playSound() { getWorld().playSound(null, getEffectivePos(), SoundEvents.ENTITY_GENERIC_DRINK, SoundCategory.BLOCKS, 0.01F, 0.5F + (float) Math.random() * 0.5F); } diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileShulkMeNot.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileShulkMeNot.java index a30cfea3c..69d07f8b6 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileShulkMeNot.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileShulkMeNot.java @@ -44,8 +44,8 @@ public class SubTileShulkMeNot extends TileEntityGeneratingFlower { World world = getWorld(); BlockPos pos = getEffectivePos(); Vector3d posD = new Vector3d(pos.getX(), pos.getY(), pos.getZ()); - List shulkers = world.getEntitiesWithinAABB(ShulkerEntity.class, new AxisAlignedBB(pos).grow(RADIUS)); if (!world.isRemote) { + List shulkers = world.getEntitiesWithinAABB(ShulkerEntity.class, new AxisAlignedBB(pos).grow(RADIUS)); for (ShulkerEntity shulker : shulkers) { if (getMaxMana() - getMana() < generate) { break; @@ -53,8 +53,8 @@ public class SubTileShulkMeNot extends TileEntityGeneratingFlower { if (shulker.isAlive() && shulker.getDistanceSq(posD) < RADIUS * RADIUS) { LivingEntity target = shulker.getAttackTarget(); - if (target != null && target instanceof IMob && target.isAlive() - && target.getDistanceSq(posD) < RADIUS * RADIUS && target.getActivePotionEffect(Effects.LEVITATION) != null) { + if (target instanceof IMob && target.isAlive() + && target.getDistanceSq(posD) < RADIUS * RADIUS && target.getActivePotionEffect(Effects.LEVITATION) != null) { target.remove(); shulker.remove();