Everything posted by Draco18s
-
Adding particles
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).
-
[1.7.10]
Look at the line above that one. GameRegistry.addRecipe(new ItemStack(itemWand), new Object[]{" B ", //something missing here, yo
-
Share a boolean between all clients
Use the player's EntityNBT or IExtendedProperties.
-
Share a boolean between all clients
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.
-
Removing XP From Player
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?
-
[1.7.10] Trees, Names and Lores, And Configurations
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)
-
How do you render non-living entities
Technically. It's generally considered not a good idea and to create several "technical blocks" that render the remaining portions.
-
Custom Furnace not turning when placed
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.
-
Custom Furnace not turning when placed
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
-
Help, FMLInitialization !
- [1.7.10] Help With Chests
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- Removing XP From Player
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.- Rendering multiple models
See that bit that says "modelPart.render"? Yeah. That's the bit responsible for rendering a given part.- [1.8] Textures of items and blocks
I have to say, the new JSON format for block models (and I mean the model, not the texture specification) better be documented somewhere.- Removing XP From Player
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; }- How do I make an item only do something if the player typed something in chat fi
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?"- [1.7.10] [Solved] Manipulating the players model.
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.- Saving up CPU (Packets, etc.)
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()); }- [1.7.10][SOLVED]Using multiple Guis with the IGuiHandler?
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.- [1.7.10][SOLVED]Using multiple Guis with the IGuiHandler?
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; } }- Removing Recipes: What on Earth is up with the Stone Hoe?
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).- Blocks with different behaviour at night?
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.- Removing Recipes: What on Earth is up with the Stone Hoe?
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).- Removing Recipes: What on Earth is up with the Stone Hoe?
Its not about hardness, its about familiarity.- Removing Recipes: What on Earth is up with the Stone Hoe?
I'm not familiar enough with iterators to use them over other methods. I understand them, but I'm not comfortable. - [1.7.10] Help With Chests
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.