Jump to content

c-ab-o-o-s-e

Members
  • Posts

    39
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am learning!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

c-ab-o-o-s-e's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. ok so I would send the packet ModID.network.sendToServer(new MessageGuiButton(button.id)); and then in the Handler class have the onMessage() take in the Id and get the player, container, and finally the TileEntity. And since we are getting the TileEntity that way it already knows what one we are talking about. Is that correct?
  2. All I am wanting to do is properly send a packet to the server and handle it properly when a user clicks a button in the Inventory. I have not messed with these before and looking at source code I have the packets setup and ready to go. I just don't know how to pass the button Id properly. Like wont I need the cordinates for where the TileEntity is? So in the gui when I send the packet I will need to send the TileEntity with it? I seen some people do the modID.network.sendToServer() and the modID.network.getPacketFrom() I don't know which one to use. My issue is that I got to see it finished to understand it. If I had a good source code that shows a process like that I would look at that. I tired looking at Mekanism, but seems like its all over the place. I'm pretty sure once I figure this one out afterwards it wont be too hard to understand. I got the Message class and all the needed classes for to send the packet I just don't know how to link it.
  3. Ahh ok, I thought there was a getItemFromBlock(), but I was trying to do itemstack.getItemFromBlock() and not just Item.getItemFromBLock().
  4. Whats the appropriate to check for if a certain block is placed in a slot. I know how to do items, but not blocks. I tried looking at some vanilla code but didn't find a good example. Guess the overall question is how do I pass the block into the itemstack parameter. If I had a good example to look at I would read it myself but haven't found one.
  5. I am trying to render the portal particle effect on an item in a players hand. I've gotten as far as the particles spawning in the world when the item is in the players hand. The only issue I am having is I do not know how to properly pass the player position. Since the onUpdate() for items has an Entity parameter I tried messing with that a bit doing a entity.PlayerLocation but during log testing it just returned null. Here is what I've done so far with the method: @Override @SideOnly(Side.CLIENT) public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean inHand){ if(entity instanceof EntityPlayer && inHand){ for(int i = 0; i < 4; i++){ float particleX = 660 + random.nextFloat();//Right now I have hard coded coordinates for testing and will switch out for proper positioning float particleY = 5 + random.nextFloat(); float particleZ = 340 + random.nextFloat(); float particleMotionX = -0.5F + random.nextFloat(); float particleMotionY = -0.5F + random.nextFloat(); float particleMotionZ = -0.5F + random.nextFloat(); world.spawnParticle("portal", particleX, particleY, particleZ, particleMotionX, particleMotionY, particleMotionZ); } } }
  6. Never mind I did some research and figure it out.
  7. I decided to take a crack at a looking into intelliJ, because a lot of people have suggested it now. I previously and still use Eclipse and have the it all set up. For some reason though, when I go to run the run configuration it pops up No JKD module 'Intel Rustic'. Intel Rustic is the name of the folder that has the workspace. Is there something I am missing that I need to do different from eclipse? Eclipse is just fine at running.
  8. Do you have your proxies setup? like... @SidedProxy(clientSide="com.yourModName.proxy.ClientProxy", serverSide = "com.yourModName.proxy.CommonProxy") public static CommonProxy proxy; As well as have the Client and Common Proxy classes that it points to. And if you have those, then do you have a preinit method in your proxy class?
  9. Well actually thinking about it more. I think I'm going to adjust the ShapedRecipes and shapless to check for the items in the Tile entity slots. It will make it a lot more easier to work with in the long run since I want them to take damage according to recipes. I was thinking that I would just add the check onto the end of the methods that already does it and have it loop through or whatever. But I am unsure on how I would make a call like that to pass in the appropriate information.
  10. I was wondering the best way to check if an item is in a slot that is part of a tileentity. I want it so that 4 tools are in 4 slots and only when they are there does the crafting table. I have done stuff like this before in using just the tileentity, so all I did was use getStackInSlot() to get the items. Won't it need to be static to be passed to the other class that handle crafting? If it's static though, then you wont be doing the proper override.
  11. Yea, ok I feel dumb as hell. For some reason I thought I had to add to the others and.... yea... I got that fix, but now I am getting a null pointer. I can't wait for class to start up again so I know more of what I'm doing. Anyways, the error is as follows. java.lang.NullPointerException: Ticking player at com.bigbaddevil7.rustic.container.ContainerPrototypingTable.canInteractWith(ContainerPrototypingTable.java:143) at net.minecraftforge.event.entity.player.PlayerOpenContainerEvent.<init>(PlayerOpenContainerEvent.java:27) at net.minecraftforge.common.ForgeHooks.canInteractWith(ForgeHooks.java:377) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:344) at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:341) at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:326) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:111) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:232) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:716) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:604) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:742) What is, "Ticking Player"? Does that just have to do with updates to the player?
  12. package com.bigbaddevil7.rustic.container; import com.bigbaddevil7.rustic.Rustic; import com.bigbaddevil7.rustic.crafting.PrototypingTableCraftingManager; import com.bigbaddevil7.rustic.tileentity.TileEntityCookStove; import com.bigbaddevil7.rustic.tileentity.TileEntityPrototypingTable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ContainerPrototypingTable extends Container { public InventoryCrafting craftMatrix; public IInventory craftResult; private World worldObj; private int posX, posY, posZ; public ContainerPrototypingTable(InventoryPlayer invPlayer, TileEntityPrototypingTable entity){ craftMatrix = new InventoryCrafting(this,5 ,5); craftResult = new InventoryCraftResult(); /*worldObj = world; posX = x; posY = y; posZ = z;*/ this.addSlotToContainer(new SlotCrafting(invPlayer.player, craftMatrix, craftResult, 0, 141, 11)); this.addSlotToContainer(new Slot(entity, 265, 115, 43)); this.addSlotToContainer(new Slot(entity, 266, 115, 79)); this.addSlotToContainer(new Slot(entity, 267, 151, 43)); this.addSlotToContainer(new Slot(entity, 268, 151, 79)); for(int i = 0; i < 5; i++){ for(int k = 0; k < 5; k++){ this.addSlotToContainer(new Slot(craftMatrix, k + i * 5, 8 + k * 18, 7 + i * 18)); } } for(int i = 0; i < 3; i++){ for(int k = 0; k < 9; k++){ this.addSlotToContainer(new Slot(invPlayer, k + i * 9 + 9, 8 + k * 18, 106 + i * 18)); } } for(int i = 0; i < 9; i++){ this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 164)); } onCraftMatrixChanged(craftMatrix); } public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot)this.inventorySlots.get(par2); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 == 0) { if (!this.mergeItemStack(itemstack1, 10, 46, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); } else if (par2 >= 10 && par2 < 37) { if (!this.mergeItemStack(itemstack1, 37, 46, false)) { return null; } } else if (par2 >= 37 && par2 < 46) { if (!this.mergeItemStack(itemstack1, 10, 37, false)) { return null; } } else if (!this.mergeItemStack(itemstack1, 10, 46, false)) { return null; } if (itemstack1.stackSize == 0) { slot.putStack((ItemStack)null); } else { slot.onSlotChanged(); } if (itemstack1.stackSize == itemstack.stackSize) { return null; } slot.onPickupFromSlot(par1EntityPlayer, itemstack1); } return itemstack; } public void onContainerClosed(EntityPlayer par1EntityPlayer) { super.onContainerClosed(par1EntityPlayer); if (!this.worldObj.isRemote) { for (int i = 0; i < 25; ++i) { ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i); if (itemstack != null) { par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false); } } } } public void onCraftMatrixChanged(IInventory inventory){ craftResult.setInventorySlotContents(0, PrototypingTableCraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); } @Override public boolean canInteractWith(EntityPlayer player) { if(worldObj.getBlock(posX, posY, posZ) != Rustic.prototypingTable){ return false; }else{ return player.getDistanceSq((double)posX + 0.5D, (double)posY + 0.5D, (double)posZ + 0.5D) <= 64.0D; } } }
  13. I been working on a custom crafting table, its is a 5x5 grid with 4 slots to hold tools. When I go to open the table I get. Here is the code
  14. Alright then. I think I understand what you guys are trying to say. If I don't I'll be here again. One more question. I made another post couple days ago that ties in with these questions, no response on that one. http://www.minecraftforge.net/forum/index.php/topic,19937.0.html I'm confused because I modified to loops just like I did for the shaped and the shaped recipes work fine for me as far as my testing went, but the shapeless will only work in a 3x3.
  15. So this is telling me that I need to do something different for the calls? At the moment I'm doing the standard handler for the container and GUI. It makes sense on why I have to do it, just not sure if it requires different ways of doing it. I may think about dong that. I been doing a lot of talking with IChun lately and he uses that and said he prefers it. The main reason I don't switch is because I have to learn a new IDE, but I guess on the grand scheme of things it wouldn't be that bad. Is the concept the same when it comes to setting up run configurations/ src code importing and exporting? Pretty much I want to make custom modeled armor. For example I want to make some goggles that you put on that looks similar to this as reference: http://gizmochunk.com/wp-content/uploads/2012/08/Steampunk-Goggles-Goth-Industrial-Brass-Cosplay-LARP-Telescope-BLK.jpg Like I said, I've done blocks before, but no idea on how to do armor. I've looked at other place for some info, but they all seem to be just the standard model re-textured with the values tweaked.
×
×
  • Create New...

Important Information

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