-
-
Save NikolaTheProgrammingNoob/cb74bb80f813a4a3686c to your computer and use it in GitHub Desktop.
The Block Class
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.nikola.carbonmod.blocks; | |
import com.nikola.carbonmod.CarbonMod; | |
import com.nikola.carbonmod.Reference; | |
import com.nikola.carbonmod.container.ContainerIronForge; | |
import com.nikola.carbonmod.init.CarbonBlocks; | |
import net.minecraft.block.Block; | |
import net.minecraft.block.BlockWorkbench; | |
import net.minecraft.block.material.Material; | |
import net.minecraft.block.state.IBlockState; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.entity.player.InventoryPlayer; | |
import net.minecraft.inventory.Container; | |
import net.minecraft.util.BlockPos; | |
import net.minecraft.util.ChatComponentTranslation; | |
import net.minecraft.util.EnumFacing; | |
import net.minecraft.util.IChatComponent; | |
import net.minecraft.world.IInteractionObject; | |
import net.minecraft.world.World; | |
public class IronForge extends Block { | |
private static final String __OBFID = "CL_00000221"; | |
private BlockPos blockPos; | |
public IronForge(Material materialIn) { | |
super(materialIn); | |
this.setHardness(3.0F); | |
this.setResistance(15.0F); | |
this.setStepSound(soundTypeAnvil); | |
this.setBlockBounds(0, 0, 0, 1, 0.867F, 1); | |
} | |
@Override | |
public boolean onBlockActivated(World worldIn,BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) | |
{ | |
if (!worldIn.isRemote) | |
{ | |
playerIn.displayGui(new IronForge.InterfaceCraftingTable(worldIn, pos)); | |
return true; | |
} | |
else | |
{ | |
playerIn.openGui(CarbonMod.instance, CarbonBlocks.guiIDIronForge, worldIn, pos.getX(), pos.getY(), pos.getZ()); | |
return true; | |
} | |
} | |
@Override | |
public boolean isOpaqueCube() { | |
return false; | |
} | |
public static class InterfaceCraftingTable implements IInteractionObject | |
{ | |
private final World world; | |
private final BlockPos position; | |
private static final String __OBFID = "CL_00002127"; | |
public InterfaceCraftingTable(World worldIn, BlockPos pos) | |
{ | |
this.world = worldIn; | |
this.position = pos; | |
} | |
public String getName() | |
{ | |
return null; | |
} | |
public boolean hasCustomName() | |
{ | |
return false; | |
} | |
public IChatComponent getDisplayName() | |
{ | |
return new ChatComponentTranslation(CarbonBlocks.ironForge.getUnlocalizedName() + ".name", new Object[0]); | |
} | |
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) | |
{ | |
return new ContainerIronForge(playerInventory, this.world, this.position); | |
} | |
public String getGuiID() | |
{ | |
return "carbonmod:ironForge"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment