Everything posted by Choonster
-
Custom Ores not spawning in
Are you getting any crashes or errors in the log? Have the gem ores been instantiated and registered properly?
-
Item Crafting Damage with Vanilla Items
This is easier if you extend an existing recipe class like ShapedRecipes or ShapelessRecipes (or the equivalent ore recipe classes), this way you only need to override getRemainingItems to return the appropriate array and don't need to re-implement the matches method. I have an example of this here.
-
1.7.10 - How to keep item when crafting?
Set the hammer's container item to itself with Item#setContainerItem . If you need to preserve anything like metadata or NBT, override Item#getContainerItem(ItemStack) to return the appropriate ItemStack of the hammer instead.
-
Trying to make wood be unbreakable by hand unless right tools
I have a working solution here. The BreakSpeed handler should prevent a log from being broken by a player without the correct tool (the block will never actually start to break, like bedrock), but if that somehow fails the BreakEvent handler will revert the block to its original state when broken. If you only cancel BreakEvent , the player will appear to be able to break the block and the block breaking particles will be spawned; but the block will revert to its original state immediately after it's broken. I haven't tested this in every possible situation, so I can't guarantee that it will always work.
-
[SOLVED] Two drops while overriding Block.removedByPlayer
Block#getDrops adds the return of getItemDropped (which is the Item form of the Block by default) to the drops list, so you're adding the same drop again with the NBT. Override getItemDropped to return null and prevent the drop without the NBT from being added. Side note: if you create a compound tag with the key "BlockEntityTag" in an ItemStack 's compound tag and your Block has a TileEntity , ItemBlock will call TileEntity#readFromNBT with it after placing the Block .
-
[1.8] Leaf blocks [[Solved]]
The issue is that you're using the localised name instead of the unlocalised name to register mango_leaf and mango_leaves with GameRegistry . Since you haven't localised these names, it's using the unlocalised name with the .name suffix. If all of your blocks are going to be registered using their unlocalised name, I'd recommend making a method that takes a Block argument and registers it using its unlocalised name so you don't need to write the same code over and over.
-
Trying to make wood be unbreakable by hand unless right tools
That should work for Oak, Spruce, Birch and Jungle leaves ( Blocks.leaves ); but it won't work for Acacia, Dark Oak ( Blocks.leaves2 ) or any modded leaves. You should use Block#isLeaves to determine if the Block is a leaves block.
-
[1.7.10] Tile Entity ceases to work after world reload
It's hard to help without seeing your code. Post it on Gist with syntax highlighting or post a link to your repository (e.g. GitHub, BitBucket).
-
Trying to make wood be unbreakable by hand unless right tools
Are you still comparing event.state directly to a Block , or have you fixed that? If you've fixed it, post the latest HNEvents code on Gist with syntax highlighting (give the file the .java extension).
-
Trying to make wood be unbreakable by hand unless right tools
You didn't post the class where the crash is happening (HarshNatureItems). For future reference, you can add multiple files to a single Gist and give each file the proper extension to enable syntax highlighting.
-
Trying to make wood be unbreakable by hand unless right tools
event.state is an IBlockState object. It will never be equal to a Block object like Blocks.leaves. Use the method I described in my previous post to get the Block from the IBlockState. Your crash has nothing to do with this class, the exception is being thrown on line 46 of HarshNatureItems. Post that class on Gist and link it here.
-
[!SOLVED!] [1.8] Getting localized block name
The ClassName#memberName notation means that memberName is an instance method or field of ClassName. You can't access instance methods/fields without an instance of the class. This is a basic Java concept. You need to call getPickBlock on an instance of Block (the one you want to show the display name of).
-
Trying to make wood be unbreakable by hand unless right tools
You can either subscribe to the event multiple times or subscribe to it once and check for each condition. BlockEvent and the events that extend from it don't have a block field in 1.8, they have a state field (of type IBlockState) instead. Use IBlockState#getBlock to get the Block. Your IDE should bring up a list of fields and methods when you type a dot after a variable. You should also be able to view the source of any Minecraft/Forge class in your IDE to see which fields and methods it has.
-
[1.8] Leaf blocks [[Solved]]
Are you getting any errors in the log? Upload your FML log to Gist and link it here.
-
Trying to make wood be unbreakable by hand unless right tools
To determine which bus an event is fired on, look at its doc comment or use your IDE's Find Usages/Call Hierarchy feature. In this case, all the events you need are fired on MinecraftForge.EVENT_BUS.
-
[1.7.10] Do I have to save and read my TileEntities fields from NBTTags?
For a TileEntity's data to persist through reloads, it needs to be written to and then read back from NBT in the writeToNBT and readFromNBT methods. If you don't do this, the data won't be saved.
-
[1.8] [RESOLVED] Sprinting's UUID?
EntityLivingBase.sprintingSpeedBoostModifierUUID contains the UUID of the sprinting speed boost modifier (as the name suggests). I found this by looking at EntityLivingBase#setSprinting.
-
Forge 1.8 addRecipe() limit crash
The crash has nothing to do with the number of recipes, it's caused by one of the recipes having an invalid shape string. Each shape string of a shaped recipe must be the same length, but one of your recipes has one string that's longer than the other two. The issue is with the recipe on line 15 of DMiscModRecipes, I suspect that this is the starInfusedShovel recipe. You don't need to explicitly create an array to call a varargs method like GameRegistry.addRecipe, just pass the arguments to it directly and Java will create the array for you.
-
ReflectionHelper vs. ObfuscationReflectionHelper
Is there a specific reason to use one of these classes vs. the other in normal Forge mod code (i.e. not dealing with ASM)? cpw said a few years ago in this FML pull request that ReflectionHelper is internal and implied that ObfuscationReflectionHelper is essentially the "public API". Is this still the case? (I'm guessing it is since ReflectionHelper is in the fml.relauncher package whereas ObfuscationReflectionHelper is in fml.common)
-
[1.8] [Solved] Where to find deobfuscated method/field list
You can download MCP mappings (both stable and snaphots) from MCPBot.
-
[SOLVED] [1.8] Buggy textures after forge update?
Did you try disabling the splash screen in config/splash.properties (like LexManos told you to)?
-
Texture Application Error
I'd recommend using a lowercase mod ID to avoid any trouble. Though looking at the icon registering code in 1.7.10, the icon name always gets used in the ResourceLocation(String) constructor first; so your mod ID should be converted to lowercase for icons anyway.
-
[1.8.7] Trouble with SetBlockState
Only use events when you need to react to things outside of your control (usually vanilla blocks, items, entities, etc.). For your own classes, you can usually override a method that's called at the appropriate time instead. Your current code is wrong in several ways: You're not registering your instance on the appropriate event bus Even if you were registering it, you'd be replacing every broken block with Main.CastleWall1 since you never check which block was broken In this case, you'll probably want to override Block#breakBlock or Block#removedByPlayer.
-
[1.8] Checking for blocks (noob question :/ really sorry) [[Solved]]
Use World#getBlockState to get the IBlockState at a BlockPos and IBlockState#getBlock to get the Block from an IBlockState.
-
Texture Application Error
This is possible, since 1.7.10 only converts the domain of a ResourceLocation to lowercase from the ResourceLocation(String) constructor but not the ResourceLocation(String,String) constructor.
IPS spam blocked by CleanTalk.