-
Notifications
You must be signed in to change notification settings - Fork 497
/
ItemDebugger.java
46 lines (41 loc) · 1.28 KB
/
ItemDebugger.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package buildcraft.core;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.tiles.IDebuggable;
import buildcraft.core.lib.items.ItemBuildCraft;
/**
* Created by asie on 3/7/15.
*/
public class ItemDebugger extends ItemBuildCraft {
public ItemDebugger() {
super();
setFull3D();
setMaxStackSize(1);
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (world.isRemote) {
return false;
}
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof IDebuggable) {
ArrayList<String> info = new ArrayList<String>();
((IDebuggable) tile).getDebugInfo(info, ForgeDirection.getOrientation(side), stack, player);
for (String s : info) {
player.addChatComponentMessage(new ChatComponentText(s));
}
return true;
}
return false;
}
@Override
public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) {
return true;
}
}