mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +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.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);
|
||||||
|
|
|
@ -113,13 +113,17 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,6 +131,7 @@ public abstract class BlockContainerBase extends BlockContainer{
|
||||||
|
|
||||||
@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()){
|
||||||
|
|
|
@ -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...");
|
||||||
|
|
Loading…
Reference in a new issue