Fix pulsable blocks being block update detectors (xdjackiexd)

This commit is contained in:
Ellpeck 2016-01-02 21:36:42 +01:00
parent f21ce7eacf
commit 6e262e2426
3 changed files with 12 additions and 9 deletions

View file

@ -44,7 +44,6 @@ import de.ellpeck.actuallyadditions.update.UpdateChecker;
import de.ellpeck.actuallyadditions.util.FakePlayerUtil; import de.ellpeck.actuallyadditions.util.FakePlayerUtil;
import de.ellpeck.actuallyadditions.util.ModUtil; import de.ellpeck.actuallyadditions.util.ModUtil;
import de.ellpeck.actuallyadditions.util.Util; import de.ellpeck.actuallyadditions.util.Util;
import de.ellpeck.actuallyadditions.util.compat.minetweaker.MineTweaker;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@ -106,7 +105,6 @@ public class ActuallyAdditions{
TreasureChestHandler.init(); TreasureChestHandler.init();
LensNoneRecipeHandler.init(); LensNoneRecipeHandler.init();
InitForeignPaxels.init(); InitForeignPaxels.init();
MineTweaker.init();
InitBooklet.init(); InitBooklet.init();
proxy.postInit(event); proxy.postInit(event);

View file

@ -113,20 +113,25 @@ public abstract class BlockContainerBase extends BlockContainer{
public void updateRedstoneState(World world, int x, int y, int z){ public void updateRedstoneState(World world, int x, int y, int z){
if(!world.isRemote){ if(!world.isRemote){
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z);
if(tile instanceof TileEntityBase){ if(tile instanceof TileEntityBase){
((TileEntityBase)tile).setRedstonePowered(powered); boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z);
} boolean wasPowered = ((TileEntityBase)tile).isRedstonePowered;
if(tile instanceof IRedstoneToggle){ if(powered && !wasPowered){
if(((IRedstoneToggle)tile).isPulseMode() && powered){ if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world)); world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
} }
((TileEntityBase)tile).setRedstonePowered(true);
}
else if(!powered && wasPowered){
((TileEntityBase)tile).setRedstonePowered(false);
}
} }
} }
} }
@Override @Override
public void updateTick(World world, int x, int y, int z, Random random){ public void updateTick(World world, int x, int y, int z, Random random){
System.out.println("UPDATE!!");
if(!world.isRemote){ if(!world.isRemote){
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){ if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){

View file

@ -25,7 +25,7 @@ import net.minecraft.world.World;
public abstract class TileEntityBase extends TileEntity{ public abstract class TileEntityBase extends TileEntity{
protected int ticksElapsed; protected int ticksElapsed;
protected boolean isRedstonePowered; public boolean isRedstonePowered;
public static void init(){ public static void init(){
ModUtil.LOGGER.info("Registering TileEntities..."); ModUtil.LOGGER.info("Registering TileEntities...");