You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.5 KiB
Java
63 lines
2.5 KiB
Java
package net.brokenmoon.afloydwiremod.tile;
|
|
|
|
import net.brokenmoon.afloydwiremod.WireMod;
|
|
import net.brokenmoon.afloydwiremod.item.ToolWiring;
|
|
import net.brokenmoon.afloydwiremod.mixinInterfaces.IEntityPlayer;
|
|
import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity;
|
|
import net.brokenmoon.afloydwiremod.tileentity.RedstoneLinkTileEntity;
|
|
import net.minecraft.src.*;
|
|
|
|
public class ChipTile extends BlockContainer {
|
|
public ChipTile(int i, Material material) {
|
|
super(i, material);
|
|
}
|
|
|
|
@Override
|
|
public void onBlockRemoval(World world, int i, int j, int k) {
|
|
super.onBlockRemoval(world, i, j, k);
|
|
}
|
|
@Override
|
|
public boolean blockActivated(World world, int x, int y, int z, EntityPlayer player){
|
|
ChipTileEntity chip = (ChipTileEntity)world.getBlockTileEntity(x, y, z);
|
|
if (!world.isMultiplayerAndNotHost) {
|
|
if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().itemID == WireMod.ToolProgrammer.itemID && chip.mode.equals("none")) {
|
|
this.displayProgrammingGui(player, chip);
|
|
return true;
|
|
} else if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().itemID == WireMod.ToolWiring.itemID && !chip.mode.equals("none")) {
|
|
ToolWiring tool = ((ToolWiring)player.inventory.getCurrentItem().getItem());
|
|
this.displayWiringGui(player, chip, tool, x, y, z);
|
|
return true;
|
|
}
|
|
if(chip instanceof RedstoneLinkTileEntity)
|
|
System.out.println(((RedstoneLinkTileEntity)chip).inputs[0].wire.x);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private void displayWiringGui(EntityPlayer player, ChipTileEntity chip, ToolWiring tool, int x, int y, int z) {
|
|
if(player instanceof EntityPlayerMP) {
|
|
//Multiplayer
|
|
((IEntityPlayer)player).displayGuiWiring(tool, chip, x, y, z);
|
|
return;
|
|
}
|
|
//Singleplayer
|
|
((IEntityPlayer)player).displayGuiWiring(tool, chip, x, y, z);
|
|
}
|
|
|
|
public static void displayProgrammingGui(EntityPlayer player, ChipTileEntity chip){
|
|
if(player instanceof EntityPlayerMP) {
|
|
//Multiplayer
|
|
((IEntityPlayer)player).displayGuiProgrammer(chip);
|
|
return;
|
|
}
|
|
//Singleplayer
|
|
((IEntityPlayer)player).displayGuiProgrammer(chip);
|
|
|
|
}
|
|
|
|
@Override
|
|
protected TileEntity getBlockEntity() {
|
|
return new ChipTileEntity();
|
|
}
|
|
}
|