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

View file

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

View file

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