mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 23:47:38 +01:00
More Calls
- Fixed dist error spam with Contraption interaction on servers
This commit is contained in:
parent
3e1312e695
commit
3a186c1286
1 changed files with 12 additions and 2 deletions
|
@ -8,6 +8,9 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
||||
public abstract class MovingInteractionBehaviour {
|
||||
|
||||
|
@ -17,12 +20,19 @@ public abstract class MovingInteractionBehaviour {
|
|||
MovementContext ctx) {
|
||||
contraptionEntity.contraption.actors.remove(index);
|
||||
contraptionEntity.contraption.actors.add(index, MutablePair.of(info, ctx));
|
||||
ContraptionRenderDispatcher.invalidate(contraptionEntity.contraption);
|
||||
if (contraptionEntity.level.isClientSide)
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> invalidate(contraptionEntity.contraption));
|
||||
}
|
||||
|
||||
protected void setContraptionBlockData(AbstractContraptionEntity contraptionEntity, BlockPos pos, BlockInfo info) {
|
||||
contraptionEntity.contraption.blocks.put(pos, info);
|
||||
ContraptionRenderDispatcher.invalidate(contraptionEntity.contraption);
|
||||
if (contraptionEntity.level.isClientSide)
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> invalidate(contraptionEntity.contraption));
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
protected void invalidate(Contraption contraption) {
|
||||
ContraptionRenderDispatcher.invalidate(contraption);
|
||||
}
|
||||
|
||||
public boolean handlePlayerInteraction(PlayerEntity player, Hand activeHand, BlockPos localPos,
|
||||
|
|
Loading…
Reference in a new issue