mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Fix pulsable blocks being block update detectors (xdjackiexd)
This commit is contained in:
parent
f21ce7eacf
commit
6e262e2426
3 changed files with 12 additions and 9 deletions
|
@ -44,7 +44,6 @@ import de.ellpeck.actuallyadditions.update.UpdateChecker;
|
|||
import de.ellpeck.actuallyadditions.util.FakePlayerUtil;
|
||||
import de.ellpeck.actuallyadditions.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.util.Util;
|
||||
import de.ellpeck.actuallyadditions.util.compat.minetweaker.MineTweaker;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
|
@ -106,7 +105,6 @@ public class ActuallyAdditions{
|
|||
TreasureChestHandler.init();
|
||||
LensNoneRecipeHandler.init();
|
||||
InitForeignPaxels.init();
|
||||
MineTweaker.init();
|
||||
|
||||
InitBooklet.init();
|
||||
proxy.postInit(event);
|
||||
|
|
|
@ -113,13 +113,17 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
public void updateRedstoneState(World world, int x, int y, int z){
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
if(tile instanceof TileEntityBase){
|
||||
((TileEntityBase)tile).setRedstonePowered(powered);
|
||||
}
|
||||
if(tile instanceof IRedstoneToggle){
|
||||
if(((IRedstoneToggle)tile).isPulseMode() && powered){
|
||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
||||
boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
boolean wasPowered = ((TileEntityBase)tile).isRedstonePowered;
|
||||
if(powered && !wasPowered){
|
||||
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
|
||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
||||
}
|
||||
((TileEntityBase)tile).setRedstonePowered(true);
|
||||
}
|
||||
else if(!powered && wasPowered){
|
||||
((TileEntityBase)tile).setRedstonePowered(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -127,6 +131,7 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random){
|
||||
System.out.println("UPDATE!!");
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.world.World;
|
|||
public abstract class TileEntityBase extends TileEntity{
|
||||
|
||||
protected int ticksElapsed;
|
||||
protected boolean isRedstonePowered;
|
||||
public boolean isRedstonePowered;
|
||||
|
||||
public static void init(){
|
||||
ModUtil.LOGGER.info("Registering TileEntities...");
|
||||
|
|
Loading…
Reference in a new issue