Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Search the Community

Showing results for tags 'intermediate'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Minecraft Forge
    • Releases
    • Support & Bug Reports
    • Suggestions
    • General Discussion
  • Mod Developer Central
    • Modder Support
    • User Submitted Tutorials
  • Non-Forge
    • Site News (non-forge)
    • Minecraft General
    • Off-topic
  • Forge Mods
    • Mods

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


XMPP/GTalk


Gender


URL


Location


ICQ


AIM


Yahoo IM


MSN Messenger


Personal Text

  1. I am having an issue now where when I spawn my mob in, the game crashes when it starts trying to spawn particles around the entity. I have it set up where the user can specify the particles in the configs and it also allows them to use more than 1 particle. Because of this I have to use an array (protected static ParticleType<?>[] particleType;) to handle the particles. But when I fill the array and use it my editor is telling me I need to cast ParticleType to IParticleData, which cannot be done. How can I still use this array and also give the method the IParticleData it wants? This is my code trying spawning the particles. My code setting the paticleType variable My code building the array of particles.
  2. I'm creating a block based on the minecraft chorus plant block. To maintain compatibility I'm using the json forge. The question is if I wrote json correctly, although it is working as expected. Forge json: { "forge_marker": 1, "variants": { "north": { "true": { "submodel": "examplemod:chorus_plant_side" }, "false": { "submodel": { "noside": [ { "model": "examplemod:chorus_plant_noside", "weight": 2 }, { "model": "examplemod:chorus_plant_noside1" }, { "model": "examplemod:chorus_plant_noside2" }, { "model": "examplemod:chorus_plant_noside3" } ] } } }, "east": { "true": { "submodel": "examplemod:chorus_plant_side", "y": 90, "uvlock": true }, "false": { "submodel": { "noside1": [ { "model": "examplemod:chorus_plant_noside1", "y": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside2", "y": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside3", "y": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside", "weight": 2, "y": 90, "uvlock": true } ] } } }, "south": { "true": { "submodel": "examplemod:chorus_plant_side", "y": 180, "uvlock": true }, "false": { "submodel": { "noside2": [ { "model": "examplemod:chorus_plant_noside2", "y": 180, "uvlock": true }, { "model": "examplemod:chorus_plant_noside3", "y": 180, "uvlock": true }, { "model": "examplemod:chorus_plant_noside", "weight": 2, "y": 180, "uvlock": true }, { "model": "examplemod:chorus_plant_noside1", "y": 180, "uvlock": true } ] } } }, "west": { "true": { "submodel": "examplemod:chorus_plant_side", "y": 270, "uvlock": true }, "false": { "submodel": { "noside3": [ { "model": "examplemod:chorus_plant_noside3", "y": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside", "weight": 2, "y": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside1", "y": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside2", "y": 270, "uvlock": true } ] } } }, "up": { "true": { "submodel": "examplemod:chorus_plant_side", "x": 270, "uvlock": true }, "false": { "submodel": { "noside4": [ { "model": "examplemod:chorus_plant_noside", "weight": 2, "x": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside3", "x": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside1", "x": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside2", "x": 270, "uvlock": true } ] } } }, "down": { "true": { "submodel": "examplemod:chorus_plant_side", "x": 90, "uvlock": true }, "false": { "submodel": { "noside5": [ { "model": "examplemod:chorus_plant_noside3", "x": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside2", "x": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside1", "x": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside", "weight": 2, "x": 90, "uvlock": true } ] } } } } } Vanilla: { "multipart": [ { "when": { "north": true }, "apply": { "model": "chorus_plant_side" } }, { "when": { "east": true }, "apply": { "model": "chorus_plant_side", "y": 90, "uvlock": true } }, { "when": { "south": true }, "apply": { "model": "chorus_plant_side", "y": 180, "uvlock": true } }, { "when": { "west": true }, "apply": { "model": "chorus_plant_side", "y": 270, "uvlock": true } }, { "when": { "up": true }, "apply": { "model": "chorus_plant_side", "x": 270, "uvlock": true } }, { "when": { "down": true }, "apply": { "model": "chorus_plant_side", "x": 90, "uvlock": true } }, { "when": { "north": false }, "apply": [ { "model": "chorus_plant_noside", "weight": 2 }, { "model": "chorus_plant_noside1" }, { "model": "chorus_plant_noside2" }, { "model": "chorus_plant_noside3" } ] }, { "when": { "east": false }, "apply": [ { "model": "chorus_plant_noside1", "y": 90, "uvlock": true }, { "model": "chorus_plant_noside2", "y": 90, "uvlock": true }, { "model": "chorus_plant_noside3", "y": 90, "uvlock": true }, { "model": "chorus_plant_noside", "weight": 2, "y": 90, "uvlock": true } ] }, { "when": { "south": false }, "apply": [ { "model": "chorus_plant_noside2", "y": 180, "uvlock": true }, { "model": "chorus_plant_noside3", "y": 180, "uvlock": true }, { "model": "chorus_plant_noside", "weight": 2, "y": 180, "uvlock": true }, { "model": "chorus_plant_noside1", "y": 180, "uvlock": true } ] }, { "when": { "west": false }, "apply": [ { "model": "chorus_plant_noside3", "y": 270, "uvlock": true }, { "model": "chorus_plant_noside", "weight": 2, "y": 270, "uvlock": true }, { "model": "chorus_plant_noside1", "y": 270, "uvlock": true }, { "model": "chorus_plant_noside2", "y": 270, "uvlock": true } ] }, { "when": { "up": false }, "apply": [ { "model": "chorus_plant_noside", "weight": 2, "x": 270, "uvlock": true }, { "model": "chorus_plant_noside3", "x": 270, "uvlock": true }, { "model": "chorus_plant_noside1", "x": 270, "uvlock": true }, { "model": "chorus_plant_noside2", "x": 270, "uvlock": true } ] }, { "when": { "down": false }, "apply": [ { "model": "chorus_plant_noside3", "x": 90, "uvlock": true }, { "model": "chorus_plant_noside2", "x": 90, "uvlock": true }, { "model": "chorus_plant_noside1", "x": 90, "uvlock": true }, { "model": "chorus_plant_noside", "weight": 2, "x": 90, "uvlock": true } ] } ] } To prove that it somehow works, a screenshot taken in minecraft 1.8.9 (The mod will not be 1.8.9, just for testing.) : If there is a simpler and cleaner way to write the forge json with random models, please tell me how to do.
  3. So I'm trying to make a silly "mobile furnace". I have it mostly functional, but (inventory) items don't update on the client unless you reopen the GUI, and I feel like I'm doing something horribly, deeply wrong, as this should probably not be the case for any use of Container/IInventory (because detectAndSendChanges). I've been studying the TileEntityFurnace/TileEntityChest classes a LOT trying to figure out what to do here. But it's really really hard to do things, since there are no instances of items, so I can't use class variables or whatever. That's fine, I'll just load from NBT and then save it again in onUpdate. Which is bad, I hate it. So, I'm really, badly needing a code review. I need someone to look at my code, figure out what's wrong with it, and please please teach me how to do it right. I never thought something as simple as an item furnace could be so complicated... The simplest way for you to see how things are, my code, and etc. is to download the project and run it for yourself. ./gradlew setupDecompWorkspace idea genIntellijRuns and so on. The project's on GitHub. Here are some quick links to the Kotlin files, if you want to take a look without downloading it: ItemPotatoFurnace (the Item) ContainerPotatoFurnace (the ContainerFurnace) GuiPotatoFurnace (the GuiFurnace) InventoryPotatoFurnace (the IInventory) If you can teach me how to use capabilities for items, that would be great too. The forge docs are SO confusing on capabilities, I wouldn't even know how to use them for blocks. Basically, I'm just really looking for help on anything. If you can, teach me how to keep the items synchronized on client and server. Anything else would definitely be appreciated. I started modding about 2 days ago, never touched the MDK ever before that. This is also my first time with Kotlin, hehe. Notes for each thingy: The item: This isn't listed in a creative tab like the other items so you'll have to use /give @p diamond2potato:potato_furnace. Right click to open the furnace, obviously. Use it like a normal furnace. It'll keep smelting as long as it's in your inventory, I think. I haven't checked if onUpdate gets called in a chest. The container: It has a logger left over from when I made sure this was being called, it's weird. You can ignore it, or remove it (which would be nice for keeping your logs clean) The GUI: Just a GuiFurnace. I made it its own class in case I need to change anything, but I don't think I'll need to. The inventory: This is where I think my error is. There's, of course, the item implementation which mandates some sort of bad practice due to the way it handles things (advice would be appreciated by the way), but this inventory is probably the source of all my problems. I would love to use capabilities but I'm just not sure how. Please advise...
  4. There is a WIP PR for documentation on this that has everything that is on this tutorial, and will soon have more such as Items and Entities. Here is a link to the PR. In this tutorial I will be explaining how to use the Animation State Machine or Forge's Animation System on a TileEntity, though this can be applied to Items or Entities as well. Let's start off easy, with the code for the Block, TileEntity and the binding of the TESR. Block TileEntity TESR Binding This is where the confusion comes from for the animation system. The armature and ASM JSON files. The ASM file has it's own "grammar" which is outlined by fry, here. This is a little vague so I will try to explain this a bit more, so that it is easier to understand with what I have come to know through my own attempts at using this system. Armature File ASM File Sample BlockState File I'm sure there are typos or possibly something I have missed or not explained well enough, so I would love some feedback even on formatting issues. I will also post my raw notes on this stuff that might contain extra information.
  5. I'm trying to figure out how to get a player's Doggy Talents dogs and have all of their information saved on a separate file on the machine; and finally, when the player use the whistle item to call their dogs, it should (basically) recreate the dog using the data that was saved previously and have the 'new' dog spawn around the either the dog's owner or whoever used the whistle. However, there is some issues i need addressed, which are the following below: What would be the best and most reasonable way of doing this How can I actually save what is inside the dog's inventory, as the dogs do possess the ability to carry things (if they have the talent of course), in the same manner as the vanilla Donkey/Horse does. How often this should save, as to avoid data lost in case a player accidentally calls the dog before the data was saved or if the dog despawns How should this method deal with non-owner players (those whom do not own the dog, but the owner has allowed the dog to be manipulated by others. I did in a previous attempt make a way to call the dogs, but it did not account for despawning due to the chunk where the dog is located at being despawned. Here is the repo in 1.12.2: https://github.com/ProPercivalalb/DoggyTalents/tree/master/src-mc-universal
  6. My custom portal works perfectly if i face south or north(same yaw and pitch after teleport), but not when i face east or west. Then im rotated 90° facing the portal frame. Im using exactly the same code as the normal teleporter, setting the lastPortalPos, lastPortalVec, teleportDirection via Reflection(which does work). https://github.com/Dragonisser/CobaltMod-2
  7. The title itself sounds a bit confusion but here's a more explained version of it. Basically, I added in code that would give the dogs in the DoggyTalents mod genders. I have all of that working however, I want to have it togglable, in case some people do not like having genders in the game, so I added a configuration to it aswell. I have the configurations and checking system working.. but when I switch off the setting, the dogs that have a gender do not "lose" their gender, they still maintain it, as well as if I go and turn the switch on, the dogs that didn't have a gender at all does not get a gender at all. So far, what I have done to get the gender randomization system going was a simple if statement that would check to see if configuration for allowing genders was set to true, then check if datatracker had any gender names in. If it was empty (it's empty when the entity first spawns in), it will randomly pick between male and female. It looks like this: private void randomizeGender() { if(Constants.DOG_GENDER == true) { if (this.getGender() == "") { if (rand.nextInt(2) == 0) { this.setGender("male"); } else { this.setGender("female"); } } }else{ this.setGender(""); } } The entirety of the class right now looks like this
  8. Hey Team Forge - I have a question, very similar to this thread at the very bottom of this post answered back in July '17. I have seen crashes like the below reported on Animania reported since its launch 9 months ago. It does appear to be "heap pollution", as you suspect, as it only occurs in multi-mod environments (where at least one of the mods adds other custom entities) and in a server environment. There is nothing in my code that would or could even change the stored value from an Integer to a Boolean (that's just weird). Based on all evidence it is externally created, and can happen to any animal and any parameter. Example crash: https://github.com/capnkirok/animania/files/1652984/crash-2018-01-22_12.33.17-client.txt However, I have no idea of identifying which mods are causing the problem. I saw another discussion about this elsewhere where Vazkii chimed in and said the only real way avoid the issue altogether is to move from Data Parameters to Capabilities. Any suggestions here? I would love to be able to error trap it, but I can't even do that (unless you know a way). Or would you recommend moving to Capabilities? Thx, Purp
  9. Hi there, I've implemented myself the A* algorithm (mainly just for the purpose of learning) as seen below and looking for a way to test the code with JUnit and improvements. I'm also looking for reviews on best-practice and performance! Just to note, the implementation works in 2D space within the 3D world of Minecraft. public class AStar { /** * A {@link HashSet} of {@link Node} which holds all nodes which have been examined. * Some may refer to this as the <code>interior</code>. */ private HashSet<Node> closedSet = new HashSet<>(); /** * A {@link PriorityQueue} of {@link Node} which holds all candidates for the algorithm to explore. * Some may refer to this as the <code>openList</code>. */ private PriorityQueue<Node> frontier = new PriorityQueue<>( (firstNode, secondNode) -> { if(firstNode.priority > secondNode.priority) return 1; if(firstNode.priority < secondNode.priority) return -1; return 0; }); /** * A {@link HashSet} of {@link BlockPos} which holds all blocks the algorithm can move through. */ private HashSet<BlockPos> passableBlocks = new HashSet<>(); /** * Initialises this class with a list containing the 'level' the algorithm * uses to find the way. * * @param passableBlocks All blocks the algorithm can use. */ public AStar(HashSet<BlockPos> passableBlocks) { this.passableBlocks.addAll(passableBlocks); } /** * A* implementation * * @param start * @param end * @return null if no path was found or the path as a list */ public List<Node> getShortestPath(BlockPos start, BlockPos end) { if(start == null || end == null || !passableBlocks.contains(start) || !passableBlocks.contains(end)) return null; this.frontier.add(new Node(start, null, 0, this.computeHeuristic(start, end))); while(!this.frontier.isEmpty()) { Node current = this.frontier.poll(); if(current.location.equals(end)) { List<Node> path = new ArrayList<>(); while(current.parent != null) { path.add(current); current = current.parent; } this.frontier.clear(); this.closedSet.clear(); return path; } this.closedSet.add(current); this.getAdjacentNodes(current, end); } return null; } /** * The heuristic algorithm to calculate the cost from a * <code>start</code> {@link Node} to the <code>end</code> {@link Node}. * <br>The Manhatten distance is used for this calculation to create * an overestimated heuristics for better search algorithms. * * @param start The coordinates of the starting {@link Node}. * @param end The coordinates of the ending {@link Node}. * @return The calculated cost to get from the <code>start</code> point to the <code>end</code> point. */ private int computeHeuristic(BlockPos start, BlockPos end) { return Math.abs(start.getX() - end.getX()) + Math.abs(start.getY() - end.getY()); } private void getAdjacentNodes(Node node, BlockPos end) { // Create the set containing all neighbouring blocks BlockPos[] neighbourBlocks = new BlockPos[] { node.location.offset(EnumFacing.WEST), // x+1, y+0 node.location.offset(EnumFacing.EAST), // x-1, y+0 node.location.offset(EnumFacing.NORTH), // x+0, y+1 node.location.offset(EnumFacing.SOUTH) // x+0, y-1 }; for(BlockPos neighbourBlock : neighbourBlocks) { Node neighbour = new Node(neighbourBlock, node); if(this.closedSet.contains(neighbour) || !this.passableBlocks.contains(neighbourBlock)) continue; if(!this.frontier.contains(neighbour)) this.frontier.add(neighbour); float distance = node.distance + this.computeHeuristic(neighbour.location, end); if(distance >= neighbour.distance) continue; neighbour.setDistance(distance); } } /** * Represents the location ("node") of a graph within the A* algorithm. */ public class Node { /** * The location of this node in the world. */ private BlockPos location = null; /** * The previous node or the node we came from. */ private Node parent = null; /** * also w or d or l or length */ private float cost = 0.f; /** * also g or d or 'cost so far' */ private float distance = 0.f; /** * also f */ private float priority = 0.f; /** * Default constructor. */ public Node() { this.location = null; this.parent = null; this.cost = 0.f; this.distance = 0.f; this.priority = 0.f; } /** * Creates a {@link Node} at the given location. * * @param pos The location of the {@link Node} in the world. */ public Node(BlockPos pos) { this.location = pos; } /** * Creates a copy of the given {@link Node}. * * @param node The {@link Node} to copy. */ public Node(Node node) { this.location = node.location; this.parent = node.parent; this.cost = node.cost; this.distance = node.distance; this.priority = node.priority; } /** * Creates a new {@link Node}. * * @param pos The location of the {@link Node} in the world. * @param parent The previous {@link Node}. */ public Node(BlockPos pos, Node parent) { this(pos, parent, 0.f, 0.f); } /** * Creates a new {@link Node}. * * @param pos The location of the {@link Node} in the world. * @param parent The previous {@link Node}. * @param cost The cost to "move" through this {@link Node}. * @param distance The cost of all {@link Node}s from the start point to this {@link Node}. */ public Node(BlockPos pos, Node parent, float cost, float distance) { this.location = pos; this.parent = parent; this.setCost(cost); this.setDistance(distance); this.setPriority(); } private void setCost(float cost) { this.cost = cost; } private void setDistance(float distance) { this.distance = distance; } private void setPriority() { this.priority = this.distance + this.cost; } // TODO: research on hashCode & implement this & equals } } Note: I know that the memory usage could be improved by just using one list, but I'm not sure about the impact in performance this change would mean nor how I could implement this with my PriorityQueue. Thx in advance. Bektor
  10. Hey Forgers. I've just discovered a bug in Animania where when I register the Universal Bucket for one the cows' milks, it registers all Universal Buckets (e.g., slop, or liquids from other mods) into that category "listAllmilk" in OreDictionary. Here's the relevant code ItemStack milkHolstein = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, BlockHandler.fluidMilkHolstein); OreDictionary.registerOre("listAllmilk", milkHolstein); I know UniversalBucket.getFilledBucket is deprecated, but that does not seem to be the issue. Even trying FluidUtils.getFilledBucket with a proper FluidStack results in the same outcome from OreDictionary. Is this because UniversalBucket is using NBT? Is there a way around this?
  11. How is something like the variable Color in Leather Armour and Potions done? What methods does the Item class need?
  12. I have been slowing getting this thing working again and now I have found a chunk that is not working. I setup an int array which carries potion effect ids. When I cycle through it right after it is set, it has the correct information, but when I cycle through it to actually use the stored ids, for some reason it is empty. All other variable seem to work, except this one and possibly the arrays for the duration and amplification for each effect. I am declaring the variable here: https://github.com/saxon564/MoChickens/blob/master/src/main/java/com/saxon564/mochickens/entities/mobs/EntityMoChicken.java#L102 Initializing it here: https://github.com/saxon564/MoChickens/blob/master/src/main/java/com/saxon564/mochickens/entities/mobs/EntityMoChicken.java#L1025 and using it here: https://github.com/saxon564/MoChickens/blob/master/src/main/java/com/saxon564/mochickens/entities/mobs/EntityMoChicken.java#L473 Where this class is first called to build the entities is here: https://github.com/saxon564/MoChickens/blob/master/src/main/java/com/saxon564/mochickens/entities/mobs/EntityMoChicken.java#L230
  13. Basically, I want to make it so you need to have researched about a specific item before you can "know" how to craft it. I can't find a similar question anywhere and I have no idea where to start. I assume I'll be using forge events to detect if the player actually crafted the item. Which should be simple. But then... making it so there's no output... that'll probably be a bit more difficult. So yeah, any pointers would be helpful. I think I've got a decent grasp on the whole java stuff so I don't need like super detailed explanations... I think.
  14. I am experiencing a NullPointerExeption when adding a default/preset server to the server list. If you don't know what this means, the mod is adding a server by default into the user's server list when they run the mod. Here is my code: package com.geometrically.pixelmon; import net.minecraft.client.multiplayer.ServerData; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @Mod(modid = Pixelmon.MODID, name = Pixelmon.MODNAME, version = Pixelmon.VERSION) public class Pixelmon { public static final String MODID = "Pixelmon"; public static final String MODNAME = "Pixelmon"; public static final String VERSION = "1.0.0"; private ServerData pokeServerData; public static String pokeName = "PokeFiesta"; public static String pokeIP = "play.pokefiesta.org"; @Instance public static Pixelmon instance = new Pixelmon(); @EventHandler public void preInit(FMLPreInitializationEvent e) { } @EventHandler public void init(FMLInitializationEvent e) { this.pokeServerData.serverName = "PokeFiesta"; this.pokeServerData.serverIP = "play.pokefiesta.org"; } @EventHandler public void postInit(FMLPostInitializationEvent e) { } } The places where the server is being defined are lines 17-19 and 30-31. Lines 30-31 are where the NullPointerExeption is being caught. Thanks for helping!
  15. I have around 200 recipes that I registered in the code in 1.11. I built my mod in a way I could store recipes when I initialize my blocks. Everything was automatic that way. With the introduction of recipe .json files in 1.12, I noticed that I'm forced to use them. Now it seems that I will have to make a program that would convert all of my recipes into .json files. Is there a way to make a 'custom' crafting manager, aka can I do something so I can still register recipes from the code and if so what do I do?
  16. TL;DR reproduction case: import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import org.apache.logging.log4j.Logger; @Mod(modid = "itemstackholder") public class ISHMod { private Logger logger; @GameRegistry.ObjectHolder("minecraft:iron_bars") private static Item itemIronBars; @GameRegistry.ItemStackHolder("minecraft:iron_bars") private static ItemStack stackIronBars; public Logger getLogger() { return logger; } @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { logger = event.getModLog(); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { logger.info(itemIronBars.toString()); logger.info(stackIronBars.toString()); } } This crashes with: [20:24:57] [main/INFO] [FML]: Processing ObjectHolder annotations [20:24:57] [main/INFO] [FML]: Found 1169 ObjectHolder annotations [20:24:57] [main/INFO] [FML]: Identifying ItemStackHolder annotations [20:24:57] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: ---- Minecraft Crash Report ---- // Everything's going to plan. No, really, that was supposed to happen. Time: 7/6/17 8:24 PM Description: Initializing game java.lang.RuntimeException: java.lang.NoSuchFieldException: stackIronBars at com.google.common.base.Throwables.propagate(Throwables.java:240) at net.minecraftforge.fml.common.registry.ItemStackHolderInjector.addHolder(ItemStackHolderInjector.java:97) at net.minecraftforge.fml.common.registry.ItemStackHolderInjector.findHolders(ItemStackHolderInjector.java:63) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:602) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:266) at net.minecraft.client.Minecraft.init(Minecraft.java:508) at net.minecraft.client.Minecraft.run(Minecraft.java:416) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) Caused by: java.lang.NoSuchFieldException: stackIronBars at java.lang.Class.getField(Class.java:1703) at net.minecraftforge.fml.common.registry.ItemStackHolderInjector.addHolder(ItemStackHolderInjector.java:91) ... 18 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at com.google.common.base.Throwables.propagate(Throwables.java:240) at net.minecraftforge.fml.common.registry.ItemStackHolderInjector.addHolder(ItemStackHolderInjector.java:97) at net.minecraftforge.fml.common.registry.ItemStackHolderInjector.findHolders(ItemStackHolderInjector.java:63) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:602) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:266) at net.minecraft.client.Minecraft.init(Minecraft.java:508) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:416) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) -- System Details -- Details: Minecraft Version: 1.12 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_121, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 653341240 bytes (623 MB) / 789053440 bytes (752 MB) up to 3801088000 bytes (3625 MB) JVM Flags: 0 total; IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.40 Powered by Forge 14.21.1.2387 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UC minecraft{1.12} [Minecraft] (minecraft.jar) UC mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UC FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.12-14.21.1.2387.jar) UC forge{14.21.1.2387} [Minecraft Forge] (forgeSrc-1.12-14.21.1.2387.jar) UC itemstackholder{1.0} [itemstackholder] (itemstackholder_main) Loaded coremods (and transformers): GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 382.05' Renderer: 'GeForce GTX 860M/PCIe/SSE2' Launched Version: 1.12 LWJGL: 2.9.4 OpenGL: GeForce GTX 860M/PCIe/SSE2 GL version 4.5.0 NVIDIA 382.05, NVIDIA Corporation GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported. Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: Current Language: English (US) Profiler Position: N/A (disabled) CPU: 8x Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz [20:24:57] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: #@!@# Game crashed! Crash report saved to: #@!@# D:\...\itemstackholder\run\.\crash-reports\crash-2017-07-06_20.24.57-client.txt The crash comes from a catch/throw in Minecraft Forge with a comment // unpossible?, so should be worth looking into. The behaviors are different, so one is (probably) more wrong. The difference looks to be this: ItemStackHolderInjector uses Field f = clazz.getField(annotationTarget); and ObjectHolderRegistry uses Field f = clazz.getDeclaredField(annotationTarget);. Switching ItemStackHolderInjector to use Class::getDeclaredField like ObjectHolderRegistry would, at the very least, save future modders the confusion I felt when java told me that the field that is right there doesn't exist. This would also enable the use case where I discovered this: private fields populated with ItemStacks for use in recipe registration. Because I've caught Kotlin fever, the linked code there is in Kotlin, but compiles to the equivalent private static member (with a private set method and a public get method, as of the linked commit; I plan to make it fully private, this was just the work commit where I caught this issue). I can make this an issue and/or PR against the MinecraftForge GitHub, but I didn't want to needlessly clutter the repository if this is considered a non-issue. Consider my vote to apply this one-line patch, though. I haven't tested this, because I don't currently have the setup required to build a custom version of forge and test it.
  17. Hello I'll try to explain this by using spruce wood texture as an example since generalizing it would be a little difficult for you to understand. As far as I know, Minecraft uses a Map for all textures used by blocks (I'm probably wrong). What I want to do is take the spruce wood texture, make a copy of it, and rename and rotate that same texture and then "give" it to Minecraft to use it. I was wondering if I'm even able to do so (in an easier way) and if there is a way, how can I do it? P.S. Again the spruce wood texture is just an example, I have loads of other textures to rotate. I don't want to make copies of vanilla textures and place it in my mod file because if a player changes their resource pack, I want my blocks to change their appearance too.
  18. Hello modding Forge friends - I've been experimenting with BiomeDictionary recently, for WorldGen as well as for Entity Spawns. Today, doing some local testing on Inventory Pets, and noticed that when I started using BiomeDictionary for WorldGen I started seeing client chunk ticking. There's nothing special in my implementation. AFTER Biome biomegenbase = world.getBiome(new BlockPos(Xcoord, 60, Zcoord)); if(BiomeDictionary.hasType(biomegenbase, Type.FOREST)) { int Ycoord = 60 + random.nextInt(60); new WorldGenTreeTop(false).generate(world, random, new BlockPos(Xcoord, Ycoord, Zcoord)); } BEFORE (no ticking) Biome biomegenbase = world.getBiome(new BlockPos(Xcoord, 60, Zcoord)); if(biomegenbase.getBiomeName().equals("Forest")) { int Ycoord = 60 + random.nextInt(60); new WorldGenTreeTop(false).generate(world, random, new BlockPos(Xcoord, Ycoord, Zcoord)); } But this seemed to cause more frequent chunk loading infos in the Console. Question: Does BiomeDictionary come with the same caveats as OreDictionary? In other words, use it sparingly and don't use it in tick loops?
  19. Hello again In my mod, I have a 'property' called placement mode (it's just a custom object) that, as the name says, determines how a block is going to be placed, aka what properties should be set when placed in that mode. If I were to make this mod Client-Only, there wouldn't be any problems, however, I want this mod to be run on servers too and this is a client-specific property. What I want to do with it is send its ID to the server when a player tries to place the block right before the block itself is placed(or the code for the placement is run). So how could I accomplish that?
  20. Hi, I'm currently struggling with the hole energy system stuff. I've worked myself so far into the Capabilities that I can work with the Tesla Energy system and Forge Energy system and I know that mods who support both have some kind of internal energy. My problem now is that I've got no idea how I can combine all the pieces of Forge Energy and Tesla Energy together, so that my machines can work with boths. And I definitly don't want to have thousands of lines twice just because if-else cases for checking the which energy system is used and stuff like that, because that would be very inefficient. Before someone now says, look into EnderIO because it does those things: I know that EnderIO has exectly what I want, that machines can support both energy systems, but even after looking into the forge docs and into the source code 20 times... I just don't understand why it is done there in that way and for what some of those methods are.... So I hope there is someone who can help me with getting all those pieces together. Thx in advance. Bektor
  21. I am creating a mod someone, for a lets play series, and they want something like skyfactory. I want to create a default world that when an SP or a MP world is created, it will just override the world gen functions and replace it with this world. I have been searching for a couple hours now through MC's source code and haven't found a thing. Can anyone help me?
  22. Hey everyone, I am working on a custom GuiContainer in 1.11. I know that my problem is related to adding Slots to the Container. I added the code for my Custom Container, if you think the problem is elsewhere I will post related files public class ContainerBackpack extends Container{ private final int HOTBAR_SLOT_COUNT = 9; private final int PLAYER_INVENTORY_ROW_COUNT = 3; private final int PLAYER_INVENTORY_COLUMN_COUNT = 9; private final int PLAYER_INVENTORY_SLOT_COUNT = PLAYER_INVENTORY_COLUMN_COUNT * PLAYER_INVENTORY_ROW_COUNT; private final int VANILLA_SLOT_COUNT = HOTBAR_SLOT_COUNT + PLAYER_INVENTORY_SLOT_COUNT; private final int VANILLA_FIRST_SLOT_INDEX = 0; private final int TE_INVENTORY_FIRST_SLOT_INDEX = VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT; private final int TE_INVENTORY_SLOT_COUNT = 27; public ContainerBackpack(IItemHandler itemHandler, EntityPlayer player) { this.itemHandler = itemHandler; for (int l = 0; l < 3; ++l) { for (int j1 = 0; j1 < 9; ++j1) { this.addSlotToContainer(new SlotItemHandler(itemHandler, j1 + l * 9, 8 + j1 * 18, 18 + l * 18)); } } for (int i = 9; i < player.inventory.getSizeInventory()-5; i++) { addSlotToContainer(new Slot(player.inventory, i, 8 + i % 9 * 18, 61 + 18 * (i / 9))); } } @Override public boolean canInteractWith(EntityPlayer playerIn) { return true; } public static ContainerBackpack build(EntityPlayer player, World world, int x, int y, int z) { ItemStack stack; if(x == 0) { stack = player.getHeldItem(EnumHand.MAIN_HAND); } else { stack = player.getHeldItem(EnumHand.OFF_HAND); } IItemHandler handler = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); return new ContainerBackpack(handler,player); } @Override public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { Slot sourceSlot = (Slot)inventorySlots.get(index); if (sourceSlot == null || !sourceSlot.getHasStack()) return null; ItemStack sourceStack = sourceSlot.getStack(); ItemStack copyOfSourceStack = sourceStack.copy(); if (index >= VANILLA_FIRST_SLOT_INDEX && index < VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT) { // This is a vanilla container slot so merge the stack into the tile inventory if (!mergeItemStack(sourceStack, TE_INVENTORY_FIRST_SLOT_INDEX, TE_INVENTORY_FIRST_SLOT_INDEX + TE_INVENTORY_SLOT_COUNT, false)){ return null; } } else if (index >= TE_INVENTORY_FIRST_SLOT_INDEX && index < TE_INVENTORY_FIRST_SLOT_INDEX + TE_INVENTORY_SLOT_COUNT) { // This is a TE slot so merge the stack into the players inventory if (!mergeItemStack(sourceStack, VANILLA_FIRST_SLOT_INDEX, VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT, false)) { return null; } } else { System.err.print("Invalid slotIndex:" + index); return null; } if (sourceStack.getCount() == 0) { sourceSlot.putStack(null); } else { sourceSlot.onSlotChanged(); } return copyOfSourceStack; } } Greetz Failender
  23. So, I send a packet that contains one NBTTagCompound containing a lot of data(Mostly inventories within a tile entity). Unfortunately, it seems to be too large, since I get the following crash upon sending. http://paste.ubuntu.com/24062837/ My question to you is, how do you suggest I redesign the system to reduce the packet size? My current way of doing things involves sending the packet to the client just before the GUI opens. This packet contains all of the entity's data, including inventory, which the client needs or else it will crash upon opening the GUI. The creation of the NBT Tag Compound The packet If anyone knows of a way to reduce packet size or simply split this in to as many smaller packets as needed, it would be greatly appreciated.
  24. As the tittle says, I want to render a 2D texture/image in 3D in the same way Minecraft does items - the 2D image is rendered in 3D, with the 3rd dimension being 1 pixel thickness. The block I want to make is going to be a Block Entity, EDIT: To make myself clear. I'm making a block, that has it's own block entity and a special renderer. I'll have to use the special renderer since I'll have too many combinations.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.