Jump to content

c-ab-o-o-s-e

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by c-ab-o-o-s-e

  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.
  16. So I'm mainly looking for responses to point me into the right direction. Not asking for code, just ideas and theories on how to accomplish the tasks. 1. How would I update a container in real time. My plan is you have an inventory then you use a button to switch and it denies use of certain slots. So wouldn't I need to make the container adjust to keep those slots from being used, draw it back out and update it? 2. Custom rendered armor. I've done Blocks, and I've looked at Modular Powersuits, but that also has Scala written into it right? Or am I just being stupid and looking at the wrong parts. 3. Is there a good place to look to see how to setup repositories for eclipse regarding the pushing to github. I have Git and github all setup, but grabbing the files from eclipse is being weird. Is there a better way to do it without using eclipse?
  17. So basically like the title says, I have made a custom crafting table that is a 5x5 grid. Everything works fine apart from the shapeless recipes. They will not work unless they are in the original 3x3 grid's location(Top Left hand corner). I have made the changes to the For loops to have it cycle through a 5x5 instead of a 3x3, yet it still doesn't work. From what I can tell the shaped recipes work fine. Here is my ShaplessRecipes Class. Not sure what else you may need. I'll provide the manager as well.
  18. So I am trying to craft with a hammer and it will work the first time around but as soon as I try again it won't work. I tried looking around for this issue because I'm fairly sure this question has been asked multiple times, but haven't found anything. This is my Hammer's class I am registering the recipe normally because I thought if you didn't defined a metadata value in recipes it ignores the value(like how you can use all 3 anvils in a recipe with just, Blocks.anvil) and it wasn't until you did something like, new ItemStack(Blocks.anvil, 1 ,0) that it cared what metadata was used in the recipe. This is how I have the recipe now. GameRegistry.addRecipe(new ItemStack(Rustic.formedCopper), "HC", 'H', Rustic.hammer, 'C', Rustic.copperIngot);
  19. Here is what I have so far I have the problem with receiving a null pointer during the getIcon method. I trying to take old tutorials and make them usable for 1.7, but as you will most likely tell, I didn't do something right. What is it that I'm missing during this process here.
  20. I been trying to figure out how to do blocks with metadata, and I've found some tutorials on how to do it, but they seem to be slightly dated to work with 1.7. Is there a good place you can point me at to learn properly for 1.7?
  21. Well... I did a update of my JDK and changed my path variable to match it, and it seemed to fix the issue. I'm a bit confused cause if I was to do javac and the system responded fine. It wasn't until I tried the setupDecompWorkspace that you suggested, that it started complaining about not being able to find the JDK compiler. Looking at the path variable and it does seem like other programs I have may have messed with it. I can't be sure, don't take my word, could just be a fluke. Anyways its working just fine.
  22. Due to hardware failure I need to re-install the 1.7 Forge Dev Workspace for Eclipse. I am currently using the recommended forge build (1.7.2-10.12.1.1060). When I go to open eclipse it says there is a Java Build Path Problem. Project 'Minecraft' is missing required library: 'C:\Users\william\Desktop\Rustic\unresolved dependency - forgeSrc 1.7.2-10.12.1.1060' I double checked with LexManos's video for setting up Gradle and saw that mine skipped the applyBinPatches, genSrgs, and deobfBinJar. Where his didn't. That's the only thing I can think of that could be causing the problem. Any suggestion on what I did wrong and/or how to fix it? I downloaded this before using the guide and didn't have any problems.
  23. ahhh ok I knew of the items being reserved but didn't realize that there were ones reserved for terrain
  24. How come its assigning values such: panelBlockID = 800 decorGlassID = 4095 clockLampID = 4094 When it should be 200, 201, 202 respectively? Is it because of the dev environment?
×
×
  • Create New...

Important Information

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