Jump to content

gokiburi

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by gokiburi

  1. That does it. It was not immediately obvious to me what needed to be copied or what was being used from the original forge setup folder. I coped the build folder over and it built immediately without error. Thanks GotoLink. I'll update my main post with the solution.
  2. Solution: What I WAS doing: Creating new project folders with my src and resources folders along with build.gradle, gradlew, gradlew.bat and the gradle folder. What I WASN'T doing: Copying the build folder from the original forge setup as well. This is important because it contained the natives that need to exist for the mod to reference to successfully build. Once I put the build folder into the project folder the build worked immediately. Shoutouts to GotoLink for the solution. Original Post: I managed to update one of my basic 1.6.2 mods to 1.7.2 using the new forge gradle build system, but I'm running into issues updating the rest of them for this reason: error: package org.lwjgl.opengl does not exist import org.lwjgl.opengl.GL11; used mainly in Block rendering functions to push, pop, rotate, scale etc. Should I not be using org.lwjgl.opengl.GL11 functions? What should I be using if not? Example GL11 usage: GL11.glPushMatrix(); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glRotatef(-90, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); Am I missing a classpath or compile line in my gradle build file? I don't have a reference anywhere to org.lwjgl as the other mod I updated didn't need one. My build.gradle: buildscript { repositories { mavenCentral() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.1-SNAPSHOT' } } apply plugin: 'forge' minecraft{version = "1.7.2-10.12.0.1034"} version = "1.7.2-1.0" archivesBaseName = project.projectDir.name sourceSets.main{ java{ srcDirs 'src' } resources{ srcDirs 'resources' } } processResources { from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' expand 'version':project.version, 'mcversion':project.minecraft.version } from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } I'm not really sure where to go from here; I can update all my mods to 1.7.2 and they'll run from eclipse, but I can't get gradle to build them.
  3. Is there a hook or some workaround method for calling a function when an EntityXpOrb is picked up? Need access to the EntityPlayer that did the pickup and the EntityXpOrb itself.
  4. I return the ItemStack and don't proceed with the use call. The item itself isn't consumed; other items in the players inventory are supposed to be. I could access the ItemStack to change it around, but what's actually going on is that the recursive function tells the players inventory to decrease the stack size of the itemID with metadata if it exists and end recursion if it doesn't. Server side their items are decreased, client side they're still lingering and I don't know how to force the client to pick up on those changes without user interaction. I could send a packet but I feel that's the wrong answer. The other problem I have is that my raytrace returns the proper co-ordinates when par2World.isRemote is false but the block directly under the player when it's true, meaning I still have to figure out how to fix that before the function works properly. I figured I'd put that in another thread though.
  5. I must have been doing something else wrong before. Your solution above mostly works now, after moving things around. There are two separate problems now, but I'll make another thread for one of them. The solution was to use par2World.getPlayerEntityByUsername(par3EntityPlayer.username) instead of MinecraftServer.getServer.worldServers[0].getPlayerEntityByUsername(par3EntityPlayer) while !par2World.isRemote. Now the players items get consumed server side but not client side. I may just have to split up portions of the code to run onItemUse for if it's the client or server or add code to simply remove from client side as well.
  6. Here's a list of outcomes. par3EntityPlayer.worldObj.setBlock + par3EntityPlayer.inventory.consumeItem: onItemUse with par3EntityPlayer.worldObj.isRemote - Blocks placed, items consumed, changes do not persist. onItemUse with !par3EntityPlayer.worldObj.isRemote - No blocks placed, no items consumed. onItemUse with par3EntityPlayer.worldObj.isRemote and !player.worldObj.isRemote - Shows the blocks being placed and consumes the items, but after saving and reloading the changes have not persisted. This has the same effect as above. If I use MinecraftServer.getServer().worldServers[0].getPlayerEntityByUsername(par3EntityPlayer.username) it actually returns a "server" player and everything works exactly as expected, but that seems like an erroneous, not very proper way to get the current players multiplayer world.
  7. Remote or not, the changes don't persist unless I get the world from the worldServers array.
  8. Solution: Something else was causing the issue. Using !world.isRemote was the correct thing to do. With an onItemUse I consume an item from the players inventory. This command is run when world.isRemote. The server does not register these items as consumed if I pass in the player from onItemUse, but does consume the items if I pass in the player from MinecraftServer.getServer().worldServers[0].getPlayerEntityByUsername(player.username). Why?
  9. Similar to what is done in the Item.java file you make some public static variables you can access. They're already public static variables; public static Block denseStone; public static Block denseCobblestone; public static Item denseStoneShard; public static Item antiMatter; Which I declared like this: denseStone = new BlockStoneDense(1500, 0).setBlockName("DenseStone").setStepSound(Block.soundStoneFootstep).setHardness(7F).setResistance(10F); denseCobblestone = new BlockDenseCobble(1501, 1).setBlockName("DenseCobblestone").setStepSound(Block.soundStoneFootstep).setHardness(9F).setResistance(10F); denseStoneShard = new ItemStoneShardDense(1400).setItemName("DenseStoneShard").setIconIndex(1); antiMatter = new ItemNonMatter(1401).setItemName("AntiMatter").setIconIndex(2); So when you need to access those blocks in the current file, you should be able to use: denseStone denseCobblestone denseStoneShard antiMatter And when you need to access those blocks in another file, you should be able to use the below if the file is in the same package as your "experiment.java" file: experiment.denseStone experiment.denseCobblestone experiment.denseStoneShard experiment.antiMatter If you're accessing it from a different package, you need to import your experiment file, then you can use them the same way. It might also help to change your experiment file name or package name to something else. darkdestry.experiment.experiment.* is confusing. To make an item texture sheet, you need a 256x256 png file that you load in your ClientRegistry.java; public void registerRenderers() { MinecraftForgeClient.preloadTexture("path/to/the/texture/file.png"); } Then to set the item to use that texture, add this function to the Item's class: public String getTextureFile () { return "path/to/the/texture/file.png"; } The tutorial I used to figure this out was the basic tutorial found here.
  10. I looked at your code and saw that your order of doing things was a little weird. It read like this; Register Recipe Register Recipe Register Smelting Register Smelting Define Item Define Item Define Item Define Item Register Block Register Block Register Item Name Register Item Name Register Item Name So I reordered things to read like this: Define Item Define Item Define Item Define Item Define ItemStack Define ItemStack Define ItemStack Define ItemStack Register Recipe Register Recipe Register Smelting Register Smelting Register Block Register Block Register Item Name Register Item Name Register Item Name This adheres to a more structured, easily readable order of operations, assuring that things you will be using in the code are properly defined and exist. I also simplified your recipes a tiny bit and added some ItemStack variables for legibility. I think the main issue was that when you were creating your recipes (first thing you did, smelting in particular) you were using Blocks that didn't have their info set yet. BlockIDs for one. I'm not 100% certain if that was the issue or not, but it's what I noticed first and foremost. Glad that everything ended up working out. You probably already noticed, but I also left out defining "AntiMatter" in the language registry. I wasn't sure what you wanted to do with that, but make sure you register that as well. (-;
  11. I've subscribed to the Player.EntityInteractEvent so that when a Player clicks their tamed pet it stops it from attacking its target. Unfortunately, using all of the below, it still remembers its enemy/victim (mobs/neutrals) after telling it to stand up again. tameable.setTarget((Entity)null); tameable.setRevengeTarget((EntityLiving)null); tameable.setLastAttackingEntity((Entity)null); tameable.setPathToEntity((PathEntity)null); tameable.setAttackTarget((EntityLiving)null); Is there a working method to force an entity to completely forget about attacking something before it kills it to death?
  12. I won't pretend that this will work or that I have tested it, because I haven't. I just rewrote and rearranged your main file to follow a top down flow of instantiation and use. Might need some changes before it would compile but you shouldn't be accessing things that haven't been instantiated with this, at least. package darkdestry.experiment; import net.minecraft.src.Block; import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import darkdestry.common.CommonProxydarkdestry; @Mod(modid = "DarkDestry_Experiment", name = "Experiment", version = "1.0.0") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class experiment { public static Block denseStone; public static Block denseCobblestone; public static Item denseStoneShard; public static Item antiMatter; // Block Texture render @SidedProxy(clientSide = "darkdestry.client.ClientProxydarkdestry", serverSide = "darkdestry.common.CommonProxydarkdestry") public static CommonProxydarkdestry proxy; // Main Chunk @Init public void load(FMLInitializationEvent event) { denseStone = new BlockStoneDense(1500, 0).setBlockName("DenseStone").setStepSound(Block.soundStoneFootstep).setHardness(7F).setResistance(10F); denseCobblestone = new BlockDenseCobble(1501, 1).setBlockName("DenseCobblestone").setStepSound(Block.soundStoneFootstep).setHardness(9F).setResistance(10F); denseStoneShard = new ItemStoneShardDense(1400).setItemName("DenseStoneShard").setIconIndex(1); antiMatter = new ItemNonMatter(1401).setItemName("AntiMatter").setIconIndex(2); ItemStack denseCobblestoneStack = new ItemStack(denseStone); ItemStack denseStoneStack = new ItemStack(denseCobblestone); ItemStack denseStoneShardStack = new ItemStack(denseStoneShard); ItemStack antiMatterStack = new ItemStack(antiMatter); GameRegistry.addRecipe(denseCobblestoneStack, "SSS", "SLS", "SSS", 'S', Block.stone, 'L', Item.bucketLava); GameRegistry.addRecipe(denseStoneStack, "SSS", "SSS", "SSS", 'S', denseStoneShardStack); GameRegistry.addSmelting(denseCobblestone.blockID, denseStoneShardStack, 0.2F); GameRegistry.addSmelting(denseStone.blockID, antiMatterStack, 0.5F); GameRegistry.registerBlock(denseStone); GameRegistry.registerBlock(denseCobblestone); LanguageRegistry.addName(denseStoneShard, "Dense Stoneshard"); LanguageRegistry.addName(denseCobblestone, "Dense Cobblestone"); LanguageRegistry.addName(denseStone, "Dense Stone"); } } I'm only guessing here.
  13. Trace out the values of this, this.tileEntityRenderer and this.tileEntityRenderer.renderEngine right before the crash line. Look for which is null and make that variable not null. I'm only explaining why the error is thrown, not giving you alternatives. If you don't want to set the tileEntityRenderer on your TileEntitySpecialRenderer to something not null, you could rewrite the bindTextureByName function to not use a TileEntityRenderer. I can't tell you how to do that though. To answer your questions; If they were incompatible types, the TileEntitySpecialRenderer wouldn't be asking to set a TileEntityRenderer and the bindTextureByName function wouldn't be looking for one. You need to use one or make one alongside your TileEntitySpecialRenderer, I suppose. Secondly, if it isn't crashing when you load the world, then no, the error I'm describing wouldn't cause the world to crash on load, because I'm describing your error, which doesn't cause the world to crash on load.
  14. Judging from your error log, it looks like you're not returning a gui instance. You'll need to set a GuiHandler up to return one and register it.
  15. Sounds like a simple NPE. If this is the solution, you may want to look into basic programming tutorials. For now, I've gone through the steps one should take when they encounter a NPE. 1. 22:53:19 [sTDERR] java.lang.NullPointerException 2. 2012-10-19 22:53:19 [sTDERR] at net.minecraft.src.TileEntitySpecialRenderer.bindTextureByName(TileEntitySpecialRenderer.java:21) 3. 2012-10-19 22:53:19 [sTDERR] at jcm2606.te.client.tiles.TileEntityAnvilRenderer.renderAModelAt(TileEntityAnvilRenderer.java:49) 4. 2012-10-19 22:53:19 [sTDERR] at jcm2606.te.client.tiles.TileEntityAnvilRenderer.renderTileEntityAt(TileEntityAnvilRenderer.java:62) Your stack trace shows that your issue ends up in your class TileEntityAnvilRenderer. We know this thanks to lines 3 and 4. Following along the trace shows that the exception is actually thrown in the TileEntitySpecialRenderer.bindTextureByName function. It also shows the file and line number: TileEntitySpecialRenderer.java:21. Looking there, we find this section of code: ... 19. protected void bindTextureByName(String par1Str) 20. { 21. RenderEngine var2 = this.tileEntityRenderer.renderEngine; 22. 23. if (var2 != null) 24. { 25. var2.bindTexture(var2.getTexture(par1Str)); 26. } 27. } ... Line 21 shows that there are 3 possible null variables; this, this.tileEntityRenderer, and this.tileEntityRenderer.renderEngine. Looking at the TileEntitySpecialRenderer class we can see it does not set a tileEntityRenderer when created. ... 12. protected TileEntityRenderer tileEntityRenderer; ... There is a function to do so; ... 32. public void setTileEntityRenderer(TileEntityRenderer par1TileEntityRenderer) 33. { 34. this.tileEntityRenderer = par1TileEntityRenderer; 35. } ... We can also see that you never call this function in the code you provided. I can only assume that if you actually set the TileEntityRenderer and its renderEngine, the error would not be thrown.
  16. What version of Forge are you using? I don't have an onBlockDestroyBy function for Items. Also, what is the issue? Crashing? Nothing happening?
  17. First thing I would make sure is that the slotIndex is proper. It's not obvious how you have the slotIndex's right now and I can't guarantee they're returning the right number.Make sure you're getting the right slotIndex. If you're not, fix that. If it's not fixed after that, return here and read below. I can't personally see exactly (possibly missing @Overrides?) what the issue is if not the above, but I would try the following: You need to figure out what is null. The line in Slot.java: this.inventory.getStackInSlot(this.slotIndex); I would trace this and this.inventory. Figure out which of those is null. If it is "this" that is null, one of your slots is returning true for hasNext() but is returning null for the actual slot. If "inventory" is null (which I can't see why it would be) you need to properly set the Slots inventory to the TileEntityRuneCrafting. If "inventory" and "this" aren't null then the TileEntityRunCrafting's inventory may be null. (judging from the constructor it's probably not this) Once you know what is null just work backwards. There's probably someone who can read this and tell you your issue, but this is all I can offer.
  18. So I can't make a server side TileEntity that isn't a container, then? If I have a Tile that has nothing to do with inventory, I still need to extend a Container?
  19. Seeing the code would really help. Right now all I can imagine is that it is what it says it is, one of the variables on Line 82 is null. I couldn't tell you which one without more information.
  20. java.lang.ClassCastException: gokimods.xpstorage.client.GuiXPStorage cannot be cast to net.minecraft.src.Container at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:302) The function getServerGuiElement allows to take in a GuiScreen or Container (as expressed by the documentation) but openRemoteGui will throw the above error if it's not a Container. Why is this the case?
  21. I understand now. I expected that it would still fire if the mod was not loaded server side (since the client "picks up" the item as well), but it seems that I'll have to throw the event server side as well. Since it's a GUI I have to split up the mod into server side and client side, I suppose? I feel like I'm doing unnecessary things to get this working on client and server though. I ended up sending a packet when the forge event is thrown and when the game's pickup event is thrown. The client does handle them now (not properly, but it's progress), but I wonder if this was a very inefficient way to do it. I've managed to work around most of it so far, so it may not be lacking in a purely technical sense, but for what I want to do (though it's probably my lack of understanding; still working on that part) it doesn't seem very friendly. I'll keep trying to get a better understanding of it.
  22. Right now EntityItem.onCollideWithPlayer is the only method that the EntityItemPickupEvent is called from and the event doesn't get sent out to the client when they pick up an item while on a non-integrated server because it's not called when the server is remote. I've made an "item get" mod that will not work in SMP using the current event implementation. Because of the fact the event is only called when the player collides with the entity after its delay is up, it retriggers when the player's inventory is full. Any methods using this event will run even if the player actually hasn't picked up the item, making it a misleading event. In order to get the most out of this event I believe it would need a flag for successful pickup or even to be changed to only fire when an item was successfully picked up as well as carry information on the EntityItem the instant before pickup was attempted and after. Having that information fixes the issue of not knowing how much of the EntityItem was actually taken into the inventory (In the case of having 62 Fish and a full inventory, an EntityItem with a stack of 17 and only taking 2 of it, for example) and the event subscriber could easily see if the item was truly "picked up" based on if the stackSize had actually changed. As for throwing the event on a server, Packet22Collect is the earliest trace of the client handling an item pickup event that I can find. It looks like the servers NetHandler does not handle the packet (unexpectedPacket method is called) while the client plays the pop sound and what have you, but it also gets rid of the entity on the WorldClient. I'm not positive it's the right packet to be looking at. I don't really know what to do from here or how to dig any deeper into it. I'm also not entirely sure if the information above is absolutely correct, but I wouldn't release a mod making edits to base classes that aren't done absolutely correctly. I'll still attempt to look more into it, but for now I've put this out there to get feedback.
  23. I've not made an Achievement, but I'll try to help you out anyway. Some of classes you'll need for reference are EntityItemPickupEvent, EntityItem and Achievement. Make a new Achievement. Make sure to register it. Read how you trigger achievements from the EntityItem class. Add an EntityItemPickupEvent and when the event fires, trigger the achievement. If I missed anything, someone who has actually done it should feel free to correct any issues with the above.
  24. In the latest Forge, the getAuxillaryInfoPacket function was renamed to getDescriptionPacket.
×
×
  • Create New...

Important Information

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