Everything posted by Draco18s
-
[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.- Removing Recipes: What on Earth is up with the Stone Hoe?
Turns out I'm an idiot. Iterating over an array in the positive direction and removing elements causes everything to shift downwards.- [1.7.10][Solved]New rail recipe only works when playtesting in Eclipse.
Jesus F-ing Christ! YOU can't find one of YOUR desired recipe removals (but its in my list) and I can't find one of MINE (but its in your list)! ...And I think I know what the issue is. Add an i-- right after you remove the recipe (or change the iteration to start at list.size()-1 and count backwards). Because we're both itterating over the array from front to back, we're accidentally skipping over array elements. I'm such an idiot. (I blame it on being sick and overworked: 36.5 hours logged last week and I wasn't in the office Monday or Tuesday).- [1.7.10][Solved]New rail recipe only works when playtesting in Eclipse.
Does the gold rail show up in the console log anywhere? It should: 192: net.minecraft.item.ItemBlock@c94504 -- tile.goldenRail- Removing Recipes: What on Earth is up with the Stone Hoe?
So in my own kerjiggering of recipes, I want to replace the recipes for the stone tools. Axe, pick, shovel, gone. Hoe...apparently does not have a recipe in the CraftingManager. In part of debugging why the hell it isn't being removed, I printed out every damn entry: 210: wood hoe 213: iron hoe 215: diamond hoe 217: gold hoe No stone hoe. Code:- [1.7.10][Solved]New rail recipe only works when playtesting in Eclipse.
Having just now started poking at the removal of vanilla recipes... You can't remove a recipe by its output. You need to find ShapedRecipes object that has a getRecipeOutput().getItem() that matches the result you're trying to remove. Note, this might not be the best way, but here's what I'm trying now: (And I'm sure that if I'm wrong, someone will step in and correct me) ArrayList list = (ArrayList) CraftingManager.getInstance().getRecipeList(); //get all recipes IRecipe recipe; int recipesFound = 0; for(int i=0; i<list.size(); i++) { //loop through them Object o =list.get(i); if(o instanceof IRecipe) { recipe = (IRecipe) o; if(recipe.getRecipeOutput() != null) { //your missing this line. Sometimes a result can be null (no, I don't know why) System.out.println(i + ": " + recipe.getRecipeOutput().getItem().getUnlocalizedName()); if(recipe.getRecipeOutput().getItem() == Items.stone_pickaxe) { //if the item result is the item result I am looking for list.remove(recipe); //remove it } } } } This is compiled and running along side other mods: - [1.7.10] Help With Chests
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.