Ghostbusters

- Patched up yet another set of entry points to kinetic source loops
This commit is contained in:
simibubi 2021-04-10 03:26:38 +02:00
parent 939c640e14
commit 5de2e1ea9d
3 changed files with 10 additions and 8 deletions

View File

@ -1,6 +1,7 @@
package com.simibubi.create.content.contraptions.base;
import com.simibubi.create.foundation.item.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.Debug;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -10,6 +11,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
@ -54,7 +56,7 @@ public abstract class KineticBlock extends Block implements IRotate {
TileEntity tileEntity = worldIn.getTileEntity(pos);
if (tileEntity instanceof KineticTileEntity) {
KineticTileEntity kineticTileEntity = (KineticTileEntity) tileEntity;
kineticTileEntity.preventSpeedUpdate = false;
kineticTileEntity.preventSpeedUpdate = 0;
if (oldState.getBlock() != state.getBlock())
return;
@ -63,7 +65,7 @@ public abstract class KineticBlock extends Block implements IRotate {
if (!areStatesKineticallyEquivalent(oldState, state))
return;
kineticTileEntity.preventSpeedUpdate = true;
kineticTileEntity.preventSpeedUpdate = 2;
}
}
@ -94,8 +96,8 @@ public abstract class KineticBlock extends Block implements IRotate {
return;
KineticTileEntity kte = (KineticTileEntity) tileEntity;
if (kte.preventSpeedUpdate) {
kte.preventSpeedUpdate = false;
if (kte.preventSpeedUpdate > 0) {
kte.preventSpeedUpdate--;
return;
}

View File

@ -50,7 +50,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
public @Nullable BlockPos source;
public boolean networkDirty;
public boolean updateSpeed;
public boolean preventSpeedUpdate;
public int preventSpeedUpdate;
protected KineticEffectHandler effects;
protected float speed;

View File

@ -89,8 +89,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
@Override
protected boolean areStatesKineticallyEquivalent(BlockState oldState, BlockState newState) {
return super.areStatesKineticallyEquivalent(oldState.with(CASING, false), newState.with(CASING, false))
&& oldState.get(PART) == newState.get(PART);
return super.areStatesKineticallyEquivalent(oldState, newState) && oldState.get(PART) == newState.get(PART);
}
@Override
@ -381,7 +380,8 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
public static void initBelt(World world, BlockPos pos) {
if (world.isRemote)
return;
if (world instanceof ServerWorld && ((ServerWorld) world).getChunkProvider().getChunkGenerator() instanceof DebugChunkGenerator)
if (world instanceof ServerWorld && ((ServerWorld) world).getChunkProvider()
.getChunkGenerator() instanceof DebugChunkGenerator)
return;
BlockState state = world.getBlockState(pos);