Created
May 2, 2017 10:51
-
-
Save dazsim/79a679912709d5e1d8bb2330d481b1d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.immersiveminds.beimcraft.item; | |
import com.immersiveminds.beimcraft.BeimCraft; | |
import com.immersiveminds.beimcraft.tile.TileBlock; | |
import com.immersiveminds.beimcraft.tile.TileSupport; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemStack; | |
import net.minecraft.tileentity.TileEntity; | |
import net.minecraft.world.World; | |
public class ItemTheodolite extends Item { | |
protected String textureName; | |
public ItemTheodolite (String unlocalizedName, String textureName ) { | |
super(); | |
this.textureName = textureName; | |
this.setTextureName(BeimCraft.MODID+ ":"+unlocalizedName); | |
this.setUnlocalizedName(unlocalizedName); | |
this.setCreativeTab(BeimCraft.tabItems); | |
} | |
@Override | |
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int r, float dx, float dy, float dz) | |
{ | |
//we examine the TE that we have just clicked and see what stability level it has. | |
if (!world.isRemote) | |
{ | |
TileEntity te = world.getTileEntity(x, y, z); | |
TileSupport ts; | |
TileBlock tb; | |
if (te!=null) | |
{ | |
if (te instanceof TileSupport) | |
{ | |
ts = (TileSupport)te; | |
System.out.print("This TileSupport is "); | |
if (ts.stable) | |
{ | |
System.out.println("stable "+ts.stability); | |
} else | |
{ | |
System.out.println("unstable "+ts.breakTimer + " " + ts.stability); | |
} | |
return false; | |
} | |
if (te instanceof TileBlock) | |
{ | |
tb = (TileBlock)te; | |
System.out.print("This TileBlock is "); | |
if (tb.stable) | |
{ | |
System.out.println("stable "+tb.stability); | |
} else | |
{ | |
System.out.println("unstable "+tb.breakTimer+ " " + tb.stability); | |
} | |
System.out.println("Owner: "+tb.owner); | |
return false; | |
} | |
} | |
return false; | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment