Create/src/main/java/com/simibubi/create/foundation/BreakProgressHook.java
2021-05-11 11:39:13 -07:00

23 lines
823 B
Java

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);
}
}
}
}