Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Draco18s

Members
  • Joined

  • Last visited

Everything posted by Draco18s

  1. I think I hodge-poged my code together from looking at how other mods did it. And no, there's no registration in either the main mod class or the client registry (I just looked, and all of those classes are on git).
  2. Look at the line above that one. GameRegistry.addRecipe(new ItemStack(itemWand), new Object[]{" B ", //something missing here, yo
  3. Use the player's EntityNBT or IExtendedProperties.
  4. That kind of data shouldn't be stored in your Shield class at all, it needs to be stored on the player. Because if Tom uses his shield, you should be rendering it around Tom and only Tom, not Steve, Jane, and Boris.
  5. Well for starters, you should do player.experience >= amt Second the 1F/player.xpBarCap(); adjusts the bar...by 1 point of exp, you should use amt/player.xpBarCap(). Third, you'll have to similarly adjust the second block. Fourth, what if the player has less than that amount of exp and no levels?
  6. An example: https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/components/ComponentHealth.java#L53-58 (Note: this class is called from an Item class, so it contains the same functions, but is not actually an item)
  7. Technically. It's generally considered not a good idea and to create several "technical blocks" that render the remaining portions.
  8. Well, the furnace doesn't rotate to face the player either. It specifically rotates to face away from walls. So really you should be using the code in onBlockPlacedBy and not the code in onBlockAdded.
  9. You fucked up this part: (the direction method of BlastFurnace) if(direction.func_149730_j() && direction.func_149730_j()){ //this is "if (a() && a())" byte0 = 3; } if(direction1.func_149730_j() && direction1.func_149730_j()){ //as is this byte0 = 2; } if(direction2.func_149730_j() && direction2.func_149730_j()){ //and this byte0 = 5; } if(direction3.func_149730_j() && direction3.func_149730_j()){ //and this byte0 = 4; } Might want to look at BlockFurnace again
  10. 1) You can't, because of how vanilla chests become double chests. There's from 1.6.4 era (maybe earlier) of when there was a bug that let you do it and things basically fall apart. 2) Use trapped chests intersperced with regular chests instead
  11. Well, you should use if(player.experience > 0 && player.experienceLevel > 0) not if(player.experienceTotal >= 10) As your exact issue is what the second half of the code I posted is for.
  12. See that bit that says "modelPart.render"? Yeah. That's the bit responsible for rendering a given part.
  13. I have to say, the new JSON format for block models (and I mean the model, not the texture specification) better be documented somewhere.
  14. Here's some code from 1.6.4, not sure how valid it still is, but it did work at the time. if(player.experience > 0 && player.experienceLevel > 0) { player.experienceTotal--; player.experience -= 1F/player.xpBarCap(); } else if(player.experienceLevel > 0) { player.experienceTotal--; player.experienceLevel--; player.experience = (float)(player.xpBarCap()-1)/player.xpBarCap(); if(player.experienceLevel == 0) player.experience = 0; }
  15. You didn't show your spell class, you have the wand class in there twice. Second, the wand's right-click function makes no attempt to check to see if anything was said in chat. Third, your thread title is not useful. You should name your thread something that corresponds to your problem, like "How do I make an item only do something if the player typed something in chat first?"
  16. Null Pointer Exceptions are very easy to diagnose. It tells you what line it happened on (17): event.renderer.modelBipedMain.bipedLeftArm.showModel = false; Something there is null.
  17. TE's already have functions that handle this. @Override public Packet getDescriptionPacket() { NBTTagCompound nbtTag = new NBTTagCompound(); writeToNBT(nbtTag); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbtTag); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { readFromNBT(packet.func_148857_g()); }
  18. You have this on line 25: return new ContainerMicrobeExtractor(player.inventory, (TileEntityMicrobeExtractor) tileEntity); And this on line 42: return new ContainerMicrobeExtractor(player.inventory, (TileEntityMicrobeExtractor) tileEntity); I have this: return new ContainerSifter(player.inventory, (TileEntitySifter) tileEntity); and this: return new GuiContainerSifter(player.inventory, (TileEntitySifter) tileEntity); Spot the difference.
  19. Here's mine, works fine. package com.draco18s.ores; import com.draco18s.ores.client.*; import com.draco18s.ores.entities.*; import com.draco18s.ores.inventory.*; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { //System.out.println("This occurrs (client)" + id); if(id == 0) { TileEntity tileEntity = world.getTileEntity(x, y, z); if(tileEntity instanceof TileEntitySifter){ return new ContainerSifter(player.inventory, (TileEntitySifter) tileEntity); } } else if(id == 1) { TileEntity tileEntity = world.getTileEntity(x, y, z); if(tileEntity instanceof TileEntitySluice){ System.out.println("Returning new Container"); return new ContainerSluice(player.inventory, (TileEntitySluice) tileEntity); } } return null; } //returns an instance of the Gui you made earlier @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { //System.out.println("This occurrs (server)" + id); if(id == 0) { TileEntity tileEntity = world.getTileEntity(x, y, z); if(tileEntity instanceof TileEntitySifter){ return new GuiContainerSifter(player.inventory, (TileEntitySifter) tileEntity); } } else if(id == 1) { TileEntity tileEntity = world.getTileEntity(x, y, z); if(tileEntity instanceof TileEntitySluice){ System.out.println("Returning new GUIcontainer"); return new GuiContainerSluice(player.inventory, (TileEntitySluice) tileEntity); } } return null; } }
  20. They do, but the syntax is different for all of them. And because I switch languages frequently, that one's never stuck. :\ (I have, quite literally, had to code in AS3, Javascript, and Unity C# all in one day. And then figure out WTF Apple did that caused a working iOS application to no longer install, quickly followed up with trying to debug an AJAX problem we can't replicate in-house because we don't have iOS 8.0.1 and the client swears up down left and right that they're on 8.1).
  21. Oi! Blocks are singleton classes! This won't work! if(previousState != isNight) <-- the first block will see this as true, then the second block will see it as false! You can't store additional data at the block level, that's what metadata is for. If metadata isn't sufficient, then you must use a TileEntity.
  22. When I have to use an Iterator (for looping through the list of keys in a HashMap, for example) I still have to copy a known-good chunk of code and modify it. I've never used Iterators outside of Java (and I only do Java when modding Minecraft) so the still feel unwieldy and I'm more apt to fall back on "loops I know." I'd have caught this error myself sooner if it hadn't been after midnight and I wasn't still sick and I wasn't as overworked as I am: I've had to do stuff like this in ActionScript, Javascript, and Unity all the time and I normally iterate over arrays backwards (not just for the performance gain of only having to check the length/size once, but to avoid this exact issue).
  23. Its not about hardness, its about familiarity.
  24. I'm not familiar enough with iterators to use them over other methods. I understand them, but I'm not comfortable.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.