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.
37 lines
1.2 KiB
Java
37 lines
1.2 KiB
Java
package net.brokenmoon.afloydironchest.blocks;
|
|
|
|
import net.brokenmoon.afloydironchest.MixinInterfaces.IEntityPlayerMP;
|
|
import net.brokenmoon.afloydironchest.MixinInterfaces.IEntityPlayerSP;
|
|
import net.brokenmoon.afloydironchest.tileEntities.TileEntityIronChest;
|
|
import net.minecraft.src.*;
|
|
|
|
public class IronChest extends BlockContainer {
|
|
public IronChest(int id, Material blockMaterial){
|
|
super(id, blockMaterial);
|
|
}
|
|
|
|
@Override
|
|
public boolean blockActivated(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
|
IInventory chest = (TileEntityIronChest)world.getBlockTileEntity(x, y, z);
|
|
if (!world.isMultiplayerAndNotHost) {
|
|
this.displayGui(entityplayer, chest);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
protected TileEntity getBlockEntity() {
|
|
return new TileEntityIronChest();
|
|
}
|
|
|
|
public static void displayGui(EntityPlayer player, IInventory inventory){
|
|
if(player instanceof EntityPlayerMP) {
|
|
//Multiplayer
|
|
((IEntityPlayerMP)player).displayGUIIronChest(inventory);
|
|
return;
|
|
}
|
|
//Singleplayer
|
|
((IEntityPlayerSP)player).displayGUIIronChest(inventory);
|
|
}
|
|
}
|