-
Posts
5160 -
Joined
-
Last visited
-
Days Won
76
Everything posted by Choonster
-
[1.7.10]Crash when trying to spawn in biped entity
Choonster replied to theOriginalByte's topic in Modder Support
Don't you still need a global ID if you want an egg for the entity? Recent versions of Forge for 1.8 removed this requirement, but I don't think it was backported to 1.7.10. -
Your initial code didn't work because you never change the values in the TileEntity 's dir array once it's detected a connecting pipe on each side at least once (so it still thinks it's connected to a neighbouring pipe when you remove the pipe next to it); and even if you did, you ignore the values in the array when rendering it. I'm not sure why you were storing an int array in the first place, wouldn't a boolean array make more sense?
-
[1.7.10] [Solved] Add custom recipe to Thermal Expansion machine
Choonster replied to Niverton's topic in Modder Support
You need to send an IMC message to "ThermalExpansion" by calling FMLInterModComms.sendMessage before the postInit phase or FMLInterModComms.sendRuntimeMessage during the postInit phase. The reason you can use both methods is because TE subscribes to IMCEvent (fired between init and postInit) and also explicitly checks for runtime IMC messages when FMLLoadCompleteEvent fires (after postInit). Some mods only subscribe to IMCEvent , so they won't process runtime messages. As far as I can tell there's no formal documentation of TE's expected IMC format, but you can download a recent dev version and view the IMCHandler class in a decompiler to see how it handles each message. You'll need to use ItemStack#writeToNBT and FluidStack#writeToNBT to write the inputs and outputs to the NBT message you send to TE. Edit: I forgot some words. -
MineMaarten has tutorials on multiblock structures and . This is a fairly advanced topic, so you'll need have a good understanding of Java and Minecraft/Forge to understand it completely.
-
Look at RenderFallingBlock to see how it's done for anvils, gravel and sand.
-
DamageSource is simply the base class. EntityDamageSource and EntityDamageSourceIndirect are used for damage caused by entities and correctly override DamageSource#getEntity and DamageSource#getSourceOfDamage .
-
IBlockState s are immutable. IBlockState#withProperty returns a different IBlockState instance with the property set to the specified value rather than modifying the existing instance. If you want to change the state of a block in the world, you have to use World#setBlockState . Simply calling IBlockState#withProperty and not doing anything with the result does nothing. Your code will correctly preserve any properties except the ones you change, though.
-
If it's your own Item class, use the ItemStack argument of getMaxDamage to determine the max damage (e.g. store the Blacksmith level in the NBT when crafted, read it back in getMaxDamage ).
-
Are you getting any crashes or errors in the log? Have the gem ores been instantiated and registered properly?
-
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.
-
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
Choonster replied to Mr.sKrabs's topic in Modder Support
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
Choonster replied to SnowyEgret's topic in Modder Support
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 . -
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
Choonster replied to Mr.sKrabs's topic in Modder Support
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
Choonster replied to TheDoctorSoda's topic in Modder Support
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
Choonster replied to Mr.sKrabs's topic in Modder Support
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
Choonster replied to Mr.sKrabs's topic in Modder Support
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
Choonster replied to Mr.sKrabs's topic in Modder Support
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
Choonster replied to ecbercnl's topic in Modder Support
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
Choonster replied to Mr.sKrabs's topic in Modder Support
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. -
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
Choonster replied to Mr.sKrabs's topic in Modder Support
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. -
EntityLivingBase.sprintingSpeedBoostModifierUUID contains the UUID of the sprinting speed boost modifier (as the name suggests). I found this by looking at EntityLivingBase#setSprinting.