Jump to content

theoneandonly2004

Members
  • Posts

    19
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

theoneandonly2004's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. ok I have pickups and smelting working now, just one problem of shift clicking an item from the furnace and crafting bench, since it'll set the owner if it's a single item takn at a time but not a stack although the single items can then be placed into a stack with others of the same owner. Any suggestions?
  2. yeah i had thought that but then when i was able to get a furnace to display its owner when crafted. Then it wouldn't stack with others(as i had expected) but would stack with anotherr one with the same name
  3. OK so I am working on a feature and I have the base of it somewhat functional. Currently whenever the player crafts an item it will display who owns it. However I am having a few problems which include 1)information will only display whenever a single item is selected it will not add if you shift click an item from the crafting slot 2)even through repeating this process similarly for smelting and EntityItemPickups they do not show the information . item pickup Event @SubscribeEvent public void ItemPickup(EntityItemPickupEvent event) { System.out.println("pick up called"); if(event.item.getEntityItem().stackTagCompound == null) { event.item.getEntityItem().stackTagCompound=new NBTTagCompound(); } if(event.item.getEntityItem().stackTagCompound.getString("Owner")== null) { event.item.getEntityItem().stackTagCompound.setString("Owner", event.entityPlayer.getDisplayName()); } } Smelting event @SubscribeEvent public void onSmelting(PlayerEvent.ItemSmeltedEvent event) { if(event.smelting.stackTagCompound==null) { event.smelting.setTagCompound(new NBTTagCompound()); } if(event.smelting.stackTagCompound.getString("Owner")== null) { event.smelting.stackTagCompound.setString("Owner",event.player.getCommandSenderName()); } } crafting handler @SubscribeEvent public void onPlayerItemCrafted(PlayerEvent.ItemCraftedEvent event) { if(event.crafting.stackTagCompound==null) { event.crafting.stackTagCompound=new NBTTagCompound(); } if(event.crafting.stackTagCompound.getString("Owner")==null) { event.crafting.stackTagCompound.setString("Owner", event.player.getCommandSenderName()); } } tooltip display code @SubscribeEvent public void ToolTip(ItemTooltipEvent event) { if(event.itemStack.stackTagCompound==null) { event.itemStack.setTagCompound(new NBTTagCompound()); } event.toolTip.add("Items owner is: "+ event.itemStack.stackTagCompound.getString("Owner")) ; } not sure what the problem is so any help is appreciated. Thanks
  4. I am looking a tooltip so when the mouse rolls over it then it would display the owner under the name. But am looking into the NBT compounds now so thanks for the help guys
  5. OK so to explain quickly what I want to do,I want to add information to items when they are crafted to say who the items owner is (for multiplayer to help prevent item stealing etc). I know how to add info to my own items but would also like it added to vanilla ones as well So I have a crafting handler set up and am trying to add the info but i'm not sure if i'm adding it right to be called (mustn't be if it isn't working). I do however know that the handler works for its other purposes so it is set up right just not the adding info part. so anyone know what i'm doing wrong with it? I'm sure it's something simple. But thanks for any help public class CraftingHandler { @SubscribeEvent public void onPlayerItemCrafted(PlayerEvent.ItemCraftedEvent event) { List<String> info=new ArrayList<String>(); info.add(event.crafting.getItem().getUnlocalizedName()+ ": owned by " + event.player.getCommandSenderName()); System.out.println(info.get(0)); event.crafting.getItem().addInformation(new ItemStack(event.crafting.getItem()),event.player,info,false); } }
  6. Hi everyone So i have started to try adding some interfaces/inventories to my items and I have hit an issue trying to apply it to my item. The item is an egg launcher that I want the player to be able toshoot eggs for guaranteed hatching if the invenory has an egg in it. However there is a problem, as when I open the inventory and place an item in a slot it duplicates it by adding it to the slot and keeping the item in my selected item and when left clicking to take the item from the slot the items simply disappear. Any advice? (if it helps I am following VSWEs tutorial series for 1.6 and trying to bring it over for 1.7) Item class package items; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import entities.FunEgg; import entities.PotatoGrenade; import keystuff.myMod; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntitySnowball; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemSnowball; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class BlasterThingy extends ItemSnowball implements IInventory { public BlasterThingy() { super(); setCreativeTab(myMod.daftcraft); setUnlocalizedName("blaster thingy"); setMaxDamage(300); } @Override public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { String checkName="ForgeDevName"; String name=player.getDisplayName(); if(player.isSneaking()) { FMLNetworkHandler.openGui(player, myMod.modInstance, 0, world, (int) player.posX, (int) player.posY, (int) player.posZ); } if (!player.capabilities.isCreativeMode) { if(getStackInSlot(0)!= null) { if(doesInventoryContain(Items.egg) && !player.isSneaking()) { world.spawnEntityInWorld(new FunEgg(world, player)); this.decrStackSize(0,1); //player.inventory.consumeInventoryItem(Items.egg); itemStack.setItemDamage(itemStack.getItemDamage()+1); return itemStack; } } System.out.println(this.getStackInSlot(0)); } else { if(!player.isSneaking()) { world.spawnEntityInWorld(new FunEgg(world, player)); } } world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); return itemStack; } //begining of Inventory Code ItemStack[] items=new ItemStack[3]; @Override public int getSizeInventory() { return items.length; } @Override public ItemStack getStackInSlot(int slot) { return items[slot]; } public boolean doesInventoryContain(Item item) { for(int count=0;count < items.length;count++) { if(items[count].getItem()==item) { return true; } } return false; } @Override public ItemStack decrStackSize(int slot, int count) { ItemStack itemstack=getStackInSlot(slot); if(itemstack !=null) { if(itemstack.stackSize <= count) { setInventorySlotContents(slot,null); } else { itemstack =itemstack.splitStack(count); } } return itemstack; } @Override public ItemStack getStackInSlotOnClosing(int slot) { ItemStack itemstack=getStackInSlot(slot); setInventorySlotContents(slot,null); return itemstack; } @Override public void setInventorySlotContents(int slot, ItemStack itemStack) { items[slot]=itemStack; if(itemStack !=null && itemStack.stackSize > getInventoryStackLimit()) { itemStack.stackSize=getInventoryStackLimit(); } } @Override public String getInventoryName() { return null; } @Override public boolean hasCustomInventoryName() { return false; //To change body of implemented methods use File | Settings | File Templates. } @Override public int getInventoryStackLimit() { return 64; //To change body of implemented methods use File | Settings | File Templates. } @Override public void markDirty() { } @Override public boolean isUseableByPlayer(EntityPlayer player) { return true; } @Override public void openInventory() {} @Override public void closeInventory() {} @Override public boolean isItemValidForSlot(int slot, ItemStack itemStack) { return itemStack.getItem()== Items.egg; } } GUI class @SideOnly(Side.CLIENT) public class GUIBow extends GuiContainer { public GUIBow(InventoryPlayer inventoryPlayer, ItemStack bow) { super(new BowContainer(inventoryPlayer,bow)); xSize=176; ySize=154; } private static final ResourceLocation texture=new ResourceLocation(myMod.MODID, "textures/gui/machine.png"); @Override protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int x, int y) { GL11.glColor4f(1,1,1,1); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft,guiTop,0,0,xSize,ySize); } @Override protected void drawGuiContainerForegroundLayer(int x, int y) { fontRendererObj.drawString("blaster container",8,6,0x40404040); } @Override public void initGui() { super.initGui(); buttonList.clear(); buttonList.add(new GuiButton(0,guiLeft+100,guiTop+14,60,20,"disable")); } }//class GUI handler class package GUIStuff; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; import items.BlasterThingy; import items.TestBow; import items.daftcraftItems; import keystuff.myMod; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class GUIHandler implements IGuiHandler { public GUIHandler() { NetworkRegistry.INSTANCE.registerGuiHandler(myMod.modInstance,this); } @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch(ID) { case 0: ItemStack bow=player.getHeldItem(); if(bow !=null && bow.getItem()instanceof BlasterThingy) { return new BowContainer(player.inventory,bow); } break; } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch(ID) { case 0: ItemStack bow=player.getHeldItem(); if(bow !=null && bow.getItem()instanceof BlasterThingy) { return new GUIBow(player.inventory,bow); } break; } return null; } }//class GUI container class public class BowContainer extends Container { private ItemStack bow; private BlasterThingy blaster; public BowContainer(InventoryPlayer inventoryPlayer, ItemStack bow) { this.bow=bow; if(inventoryPlayer.player.getHeldItem().getItem()==daftcraftItems.blasterThingy) { blaster=(BlasterThingy)inventoryPlayer.player.getHeldItem().getItem(); } for(int x=0;x<9;x++) { addSlotToContainer(new Slot(inventoryPlayer,x,8+18*x,130)); } for(int y=0;y<3;y++) { for(int x=0;x<9;x++) { addSlotToContainer(new Slot(inventoryPlayer,x+y*9+9,8+18*x,72+y*18)); } } for(int x=0;x<3;x++) { addSlotToContainer(new ProjectileSlot(blaster,x,8+18*x,17)); } } @Override public boolean canInteractWith(EntityPlayer player) { return true; } @Override public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) { return null; } }//class Any help is appreciated
  7. Daftcraft Update for 1.7.10 This update brings with it a few additions. These include -an egg launcher -some achievements -a new boss entity -the digger block(it will mine ores but you have to retrieve them yourself from bedrock for now) -stone armor(gives slowness when worn) -the super belt of speed and the visor of super sight -3 extra coals (better,ultra and uber coal(trust me uber lives up to its name)) As usual I do expect bugs so let me know if you find any and send me whatever info you have on the crash and i'll see if I can fix it, Thanks
  8. i'll have to look into my code then to check thanks for pointing it out, so how would i compare my item properly? any suggestions?
  9. but i've compared itemstacks like this before and they have worked across the various damages...
  10. Ok I got some of the block class setup and it now responds whenever a player breaks a block...but it isn't realising that the player is using my item to perform the code...here's what I have so far, and i'm almost 90% certain it's something super simple i've overlooked...it always is package handlers; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import items.daftcraftItems; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.oredict.OreDictionary; public class BlockBreakEvent { @SubscribeEvent public void onBreak(BlockEvent.HarvestDropsEvent event) { if(event.harvester!=null) { EntityPlayer player=event.harvester; System.out.println("there was a harvester"); if(player.getCurrentEquippedItem()== new ItemStack(daftcraftItems.doubler,1,OreDictionary.WILDCARD_VALUE)) //1 ore doubler any damage? { System.out.println("you used the ore doubler"); if(event.block== Blocks.iron_ore) { event.drops.clear();//will this permenantly clear the items when used by doubler once? event.drops.add(new ItemStack(daftcraftItems.ironDust)); } else if(event.block== Blocks.gold_ore) { event.drops.clear(); event.drops.add(new ItemStack(daftcraftItems.goldDust)); } else if(event.block== Blocks.diamond_ore) { event.drops.clear(); event.drops.add(new ItemStack(daftcraftItems.diamondDust)); } } else { System.out.println("you used item " + event.harvester.getHeldItem()); } } } }//class
  11. Ok so I am currently writing a basic ore doubling tool that will act sort of like a pickaxe however instead of dropping he block as an ore I want it to drop 2 dusts instead. My question is how would I make the block drop the dusts when the player is using tmy doubling item but still act normally when using any other normal pickaxe. Thanks for any help with this
  12. Ok so what I am trying to create is a new villager to act similar to an iron golem that will attack mobs. So I have most of what I want setup for the base of the mob, except I have run into a problem within the rendering/texture of the mob. https://www.dropbox.com/s/0r4mzycbkxt37an/Screenshot%202014-09-07%2019.17.49.png?dl=0 for some reason it appears as if there is an extra body layer rendering on top of the head despite not being in the techne model. The model itself however will appear fie within techne If anyone can help it would be appreciated techne model code Entity class render class code any help is appreciated
  13. Hello minecrafters and thank you for checking out my daft mod, hence the name of it being daftcraft. Daftcraft is my first mod which I made to help improve my coding ability. Basically the mod adds some stuff that came to my mind that i Decided that I wanted to have in minecraft. I'm hoping you'll also enjoy what is Involved. Below is the progress I have made so far on the mod. Items Blocks Mod pack permissions Let's plays bug support downloads FAQ
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.