Null checks and flap updates.
This commit is contained in:
parent
fe492c5d75
commit
9062f1c8fa
3 changed files with 14 additions and 1 deletions
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.block.belts.tunnel;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticRenderMaterials;
|
||||
import com.simibubi.create.content.logistics.block.FlapData;
|
||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||
import com.simibubi.create.foundation.render.backend.instancing.*;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
|
@ -72,8 +73,12 @@ public class BeltTunnelInstance extends TileEntityInstance<BeltTunnelTileEntity>
|
|||
@Override
|
||||
public void tick() {
|
||||
tunnelFlaps.forEach((direction, keys) -> {
|
||||
InterpolatedChasingValue flapValue = tile.flaps.get(direction);
|
||||
if (flapValue == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
float flapness = tile.flaps.get(direction).get(AnimationTickHolder.getPartialTicks());
|
||||
float flapness = flapValue.get(AnimationTickHolder.getPartialTicks());
|
||||
for (InstanceKey<FlapData> key : keys) {
|
||||
key.modifyInstance(data -> data.setFlapness(flapness));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.block.belts.tunnel;
|
|||
import java.util.*;
|
||||
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||
import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendered;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
@ -113,6 +114,9 @@ public class BeltTunnelTileEntity extends SmartTileEntity implements IInstanceRe
|
|||
|
||||
super.read(compound, clientPacket);
|
||||
|
||||
if (clientPacket)
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(this));
|
||||
|
||||
if (!clientPacket)
|
||||
return;
|
||||
if (!compound.contains("TriggerFlaps"))
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape;
|
|||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||
import com.simibubi.create.foundation.item.TooltipHelper;
|
||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||
import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendered;
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
|
@ -331,6 +332,9 @@ public class FunnelTileEntity extends SmartTileEntity implements IHaveHoveringIn
|
|||
int direction = compound.getInt("Flap");
|
||||
flap.set(direction);
|
||||
}
|
||||
|
||||
if (clientPacket)
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue