/
Belyash5
/
Flu
Обзор
Документация
Войти
/
Belyash5
/
Flu
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/main/java/com/hbm/items/tool/ItemAnalysisTool.java
48 строк
1 KB
Boblet
universal analysis tool, pipe debugging
08 авг 2023, 16:13
08 авг 2023, 16:13
dcfa7fe
Код
Авторство
О чём код?
package com.hbm.items.tool; import java.util.List; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.IAnalyzable; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; public class ItemAnalysisTool extends Item { @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) { Block b = world.getBlock(x, y, z); if(b instanceof BlockDummyable) { int[] pos = ((BlockDummyable) b).findCore(world, x, y, z); if(pos != null) { x = pos[0]; y = pos[1]; z = pos[2]; } } if(b instanceof IAnalyzable) { List<String> debug = ((IAnalyzable) b).getDebugInfo(world, x, y, z); if(debug != null && !world.isRemote) { for(String line : debug) { player.addChatComponentMessage(new ChatComponentText(line).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW))); } } return true; } return false; } }