mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-14 06:24:12 +01:00
Null checks and flap updates.
This commit is contained in:
parent
fe492c5d75
commit
9062f1c8fa
@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.block.belts.tunnel;
|
|||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticRenderMaterials;
|
import com.simibubi.create.content.contraptions.base.KineticRenderMaterials;
|
||||||
import com.simibubi.create.content.logistics.block.FlapData;
|
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.render.backend.instancing.*;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
@ -72,8 +73,12 @@ public class BeltTunnelInstance extends TileEntityInstance<BeltTunnelTileEntity>
|
|||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
tunnelFlaps.forEach((direction, keys) -> {
|
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) {
|
for (InstanceKey<FlapData> key : keys) {
|
||||||
key.modifyInstance(data -> data.setFlapness(flapness));
|
key.modifyInstance(data -> data.setFlapness(flapness));
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.block.belts.tunnel;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import com.simibubi.create.CreateClient;
|
import com.simibubi.create.CreateClient;
|
||||||
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendered;
|
import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendered;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
@ -113,6 +114,9 @@ public class BeltTunnelTileEntity extends SmartTileEntity implements IInstanceRe
|
|||||||
|
|
||||||
super.read(compound, clientPacket);
|
super.read(compound, clientPacket);
|
||||||
|
|
||||||
|
if (clientPacket)
|
||||||
|
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(this));
|
||||||
|
|
||||||
if (!clientPacket)
|
if (!clientPacket)
|
||||||
return;
|
return;
|
||||||
if (!compound.contains("TriggerFlaps"))
|
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.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||||
import com.simibubi.create.foundation.item.TooltipHelper;
|
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.render.backend.instancing.IInstanceRendered;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
@ -331,6 +332,9 @@ public class FunnelTileEntity extends SmartTileEntity implements IHaveHoveringIn
|
|||||||
int direction = compound.getInt("Flap");
|
int direction = compound.getInt("Flap");
|
||||||
flap.set(direction);
|
flap.set(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clientPacket)
|
||||||
|
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user