More Lathe logic
This commit is contained in:
@@ -3,6 +3,7 @@ package nmd.primal.energy;
|
||||
import nmd.primal.energy.common.CommonProxy;
|
||||
import nmd.primal.energy.common.ModInfo;
|
||||
import nmd.primal.energy.crafting.CraftingHandler;
|
||||
import nmd.primal.energy.item.ModItems;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
@@ -24,6 +25,7 @@ public class Energy {
|
||||
@EventHandler
|
||||
public void preinit(FMLPreInitializationEvent event) {
|
||||
Energy.proxy.preInit(event);
|
||||
ModItems.registerItems();
|
||||
// some example code
|
||||
// System.out.println("DIRT BLOCK >> "+Blocks.dirt.getUnlocalizedName());
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.energy.common.ModInfo;
|
||||
import nmd.primal.energy.item.ModItems;
|
||||
import nmd.primal.energy.render.RenderID;
|
||||
import nmd.primal.energy.tileents.TileEntLatheBase;
|
||||
import nmd.primal.energy.util.CustomTab;
|
||||
@@ -31,6 +32,7 @@ public abstract class LatheBase extends BlockContainer implements ITileEntityPro
|
||||
TileEntLatheBase tileEnt = (TileEntLatheBase) world.getTileEntity(x, y, z);
|
||||
if(!world.isRemote){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.inventory.getCurrentItem().getItem()!=ModItems.schiselItem){
|
||||
if (tileEnt.getStackInSlot(0)==null){
|
||||
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
@@ -51,6 +53,7 @@ public abstract class LatheBase extends BlockContainer implements ITileEntityPro
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
|
||||
@@ -72,7 +75,7 @@ public abstract class LatheBase extends BlockContainer implements ITileEntityPro
|
||||
}
|
||||
tileEnt.markForUpdate();
|
||||
tileEnt.markDirty();
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,15 +15,16 @@ public class CommonProxy {
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
CustomTab.NMDEnergyTab();
|
||||
ModItems.registerItems();
|
||||
ModBlocks.init();
|
||||
ModCrafting.init();
|
||||
RenderID.init();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
ModBlocks.init();
|
||||
ModCrafting.init();
|
||||
RenderID.init();
|
||||
TileRegistry.init();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ContainerLathe extends Container{
|
||||
public ContainerLathe (InventoryPlayer inventoryPlayer, TileEntLatheBase te){
|
||||
tile = te;
|
||||
addSlotToContainer(new Slot(tile, 0, 80, 34));
|
||||
addSlotToContainer(new Slot(tile, 1, 80, 34));
|
||||
//addSlotToContainer(new Slot(tile, 1, 80, 34));
|
||||
bindPlayerInventory(inventoryPlayer);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,61 @@
|
||||
package nmd.primal.energy.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.energy.common.ModInfo;
|
||||
import nmd.primal.energy.util.CustomTab;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class SChiselItem extends Item{
|
||||
|
||||
private String name = "schiselItem";
|
||||
private Item item;
|
||||
|
||||
|
||||
public SChiselItem(){
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setTextureName(ModInfo.MOD_ID + ":" + name);
|
||||
setMaxDamage(100);
|
||||
setNoRepair();
|
||||
|
||||
setCreativeTab(CustomTab.NMDEnergyTab);
|
||||
|
||||
item = this;
|
||||
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int count) {
|
||||
System.out.println(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called each tick while using an item.
|
||||
* @param stack The Item being used
|
||||
* @param player The Player using the item
|
||||
* @param count The amount of time in tick the item has been used for continuously
|
||||
*/
|
||||
@Override
|
||||
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
|
||||
/*
|
||||
* CLIENTSIDE
|
||||
* PlayerObjectMovingPosition to check the block the player is using this against.
|
||||
*
|
||||
* SERVERSIDE
|
||||
* Do Something to the inventory of the itemstack
|
||||
* or
|
||||
* maybe send PacketMessage to change the inventory
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
player.setItemInUse(stack, 72000);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
return false;
|
||||
@@ -33,5 +67,7 @@ public class SChiselItem extends Item{
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class TileEntLatheBase extends TileBase implements IInventory {
|
||||
|
||||
public TileEntLatheBase(String name) {
|
||||
super(name);
|
||||
this.inv = new ItemStack[2];
|
||||
this.inv = new ItemStack[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user