Everything posted by Choonster
-
[1.12] Block destroyed method
Block#breakBlock is called when a block is replaced by another block, regardless of what caused the replacement.
-
[1.11.2] [Unsolved] Accessing an entity's gui container
Override GuiButton#drawButton to set GuiButton#displayString based on the villager's following state and then call the super method.
-
[1.11.2] [Unsolved] Accessing an entity's gui container
That looks correct, but you should use NBTTagCompound#getCompoundTag rather than NBTTagCompoundTag#getTag in readEntityFromNBT. There's no need to read/write values that are already handled by the parent class, e.g. the Forge profession.
-
[1.11.2] [Unsolved] Accessing an entity's gui container
In writeEntityToNBT, call INBTSerializable#serializeNBT to serialise the ItemStackHandler to a compound tag and then call NBTTagCompound#setTag on the compound tag argument, passing the serialised ItemStackHandler compound tag as the second argument. In readEntityFromNBT, call NBTTagCompound#getCompoundTag on the compound tag argument to get the serialised ItemStackHandler compound tag, then pass it to INBTSerializable#deserializeNBT to deserialise the ItemStackHandler. That's not an error, that's someone printing a UUID to stdout. I don't think Vanilla or Forge do this, so it's probably your code.
-
Versioning and server compatibility
That's correct. @Mod#acceptableRemoteVerions expects a version range, not just a single version. It's parsed using VersionRange.createFromVersionSpec, which has a doc comment explaining the format.
-
[1.11.2] [Unsolved] Accessing an entity's gui container
That's the right method, but you actually need to store the compound tag returned by it in the compound tag you receive as an argument to writeEntityToNBT. Currently you're just discarding it. You also need to do the reverse with INBTSerializable#deserializeNBT in the readEntityFromNBT method. Why are you checking World#isRemote? It's not necessary in these methods and may break things.
-
[1.11.2] [Unsolved] Accessing an entity's gui container
You never write the IItemHandler to or read it from NBT, so it's not persisted when the entity is unloaded/reloaded. Do this using the INBTSerialializable methods implemented by ItemStackHandler.
-
[SOLVED][1.11.2] EventListeners
You're registering the Class with the event bus, but your event handler method isn't static. If you register the Class, you need to use a static method. If you register an instance, you need to use an instance method. The documentation explains this. There's no reason to create a new object of a known class and immediately call Object#getClass on it, just use a class literal.
-
[SOLVED][1.11.2] EventListeners
@Mod.EventHandler is only for FML lifecycle events that extend net.minecraftforge.fml.common.event.FMLEvent, e.g. FMLPreInitializationEvent or FMLServerStartedEvent and only works in your @Mod class. @SubscribeEvent is used for gameplay events that extend net.minecraftforge.fml.common.eventhandler.Event, e.g. PlayerInteractEvent.RightClickItem or TickEvent.ServerTickEvent. Forge's documentation explains events in more detail here. The ItemStack returned by PlayerInteractEvent#getItemStack will never be reference equal to an ItemStack you've just created, because they're not the same object (which is what the == operator checks). To compare ItemStacks, either get the Item, metadata, etc. and compare those or use the static equality methods in the ItemStack class. Since you're only checking the Item, use ItemStack#getItem to get the Item and check if it's equal to (==) Items.GLASS_BOTTLE.
-
[1.10.2] Item Model Variants
Forge tries to load the item model first and only tries to load the model from the blockstates file if that fails. I have a more detailed explanation of the model loading process here. If it's not loading your item models, the FML log should have an error message explaining why.
-
Issues with Forge 1.11.2
Upload the log to Gist and reply here with a post containing the URL.
-
Issues with Forge 1.11.2
Post the FML log (logs/fml-client-latest.log in the game directory) using Gist.
-
Minecraft Forge crashing when trying to start up game
It's a plain text file, open it in a text editor like Notepad.
-
[1.12] How do I create the recipes in this MC version?
In short, you don't. 1.12 isn't ready yet:
-
[1.11.2, Solved] Get the projectile, that has hit entity
If you update to the latest MCP mappings, DamageSource#getSourceOfDamage/getEntity have been renamed to DamageSource#getImmediateSource/getTrueSource respectively. This makes it clearer which entity is which.
-
[1.11.2] [Unsolved] Accessing an entity's gui container
I encountered several issues with your code: You're registering two different IMessageHandlers (HireVillagerPacket and ChangeFollowPacket) for the same IMessage class (MessageSendEntityId), which doesn't work. Each IMessage class can only have a single IMessageHandler. These classes are poorly named. HireVillagerPacket and ChangeFollowPacket are packet handlers, not packets. MessageSendEntityId tells me what the packet sends, but it doesn't tell me the most important piece of information: why the packet is sent, i.e. what action does it perform? You use Packet in the handler names but you use Message in the packet name, pick one and stick with it. GuiHandler#getClientGuiElement incorrectly returns a Container instead of a GuiScreen for the Hauler ID. GuiIvVillagerHauler uses ContainerIvVillagerHireNitwit instead of ContainerIvVillagerHauler. ContainerIvVillagerHauler adds 15 Slots for the villager's inventory, but the IItemHandler created in IvVillager only has one slot. The Button_Hire and Button_Follow classes no longer serve a purpose, you can replace their usages with regular GuiButtons. When you have an if statement that does nothing but set the value of a boolean variable (like in GuiIvVillagerHireNitwit#actionPerformed), you can move the expression used as the condition of the if statement directly to the initialisation of the boolean variable and remove the if statement. When you have a boolean variable declared directly before and only used in the condition of the if statement, you can move the expression used to initialise it directly into the condition of the if statement and remove the boolean variable. If the condition of an if statement is particularly complex, it can be clearer to keep some parts of it as variables. I've fixed these issues and pushed the changes to GitHub. You can view and/or merge the changes here. You appear to be using GitHub's web UI to upload changes to your repository, I highly recommend using a proper local Git client instead. This will allow you to create more fine-grained commits with descriptive messages rather than lumping all your changes into a single commit with a message like "Add files via upload".
-
[1.8.9] Help with rendering EntityThrowable
You don't create the RenderManager or RenderItem instances yourself, you use the instances Minecraft has already created. To register a Render for an Entity class, call RenderingRegistry.registerEntityRenderingHandler(Class<T>, IRenderFactory<? super T>) in preInit. In the IRenderFactory#createRenderFor implementation, create and return the Render instance. You receive the RenderManager instance as an argument of IRenderFactory#createRenderFor and you can get the RenderItem instance using Minecraft#getRenderItem. This advice applies to all versions from 1.8.9 onwards. 1.7.10 and earlier are still available for download, but they're not supported on this forum. I believe 1.8.9 is still supported, but you should really update.
-
.project is missing in MDKExample
I'm assuming you mean "still" rather than "steel". If it's not working, describe exactly what the problem is. Did you follow the instructions I linked? What happened when you did so? Also post any error messages you're getting.
-
1.12 Forge Update?
There are already experimental builds of Forge for 1.12 available, but they're not ready for general use.
-
Forge 1.7.10 server not starting
1.7.10 is no longer supported on this forum, update if you want help.
-
Walk trough walls [1.7.10]
1.7.10 is no longer supported on this forum, update if you want help.
-
.project is missing in MDKExample
Gradle generates the Eclipse project when you run the eclipse task. Forge's documentation explains how to set up a development environment here.
-
How can I create a fluid pipe system? 1.7.10
1.7.10 is no longer supported on this forum, update if you want help.
-
[1.10.2] [SOLVED] Saving additional information to chunk data
World Saved Data lets you store data per-dimension or per-map. World Capabilities are just a nicer wrapper around per-dimension WorldSavedData. For a public API, I recommend using Capabilities rather than World Saved Data. I helped someone with a similar system and created my own implementation of it in this thread. You can see the API here and the implementation here.
-
[1.11.2] Editing Vanilla Structure Generation
The getBiomeSpecificBlockState method fires the BiomeEvent.GetVillageBlockID event, which allows you to change the IBlockState returned by it based on the Biome. To change the IBlockState: Subscribe to the event. Note that it's fired on MinecraftForge.TERRAIN_GEN_BUS rather than MinecraftForge.EVENT_BUS. Check that the Biome is Ice Plains. Use BiomeEvent.GetVillageBlockID#getOriginal to get the original IBlockState. Set the replacement IBlockState with BiomeEvent.GetVillageBlockID#setReplacement. Set the event's result to Event.Result.DENY with Event#setResult to use the replacement IBlockState instead of the original.
IPS spam blocked by CleanTalk.