Create/src/main/java/com/simibubi/create/foundation/BreakProgressHook.java

23 lines
823 B
Java
Raw Normal View History

2021-05-11 20:39:13 +02:00
package com.simibubi.create.foundation;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.math.BlockPos;
public class BreakProgressHook {
public static void whenBreaking(ClientWorld world, WorldRenderer renderer, int playerEntityId, BlockPos pos, int progress) {
if (AllBlocks.BELT.has(world.getBlockState(pos))) {
BeltTileEntity belt = (BeltTileEntity) world.getTileEntity(pos);
for (BlockPos beltPos : BeltBlock.getBeltChain(world, belt.getController())) {
renderer.sendBlockBreakProgress(beltPos.hashCode(), beltPos, progress);
}
}
}
}