Everything posted by Choonster
-
Need help with the replacement BlockMetadata in 1.8
World#getBlockMetadata returned the block metadata at the specified position, World#setBlockMetadata set the block metadata at the specified position. Metadata was replaced by the block state system, you can read an introduction to it here. Use World#getBlockState and World#setBlockState instead of World#getBlock/World#getBlockMetadata and World#setBlock/World#setBlockMetadata. Use IBlockState#getValue to get the value of an IProperty in an IBlockState and IBlockState#withProperty to get an IBlockState with the IProperty set to specified value. I would recommend against updating to 1.8, since it's outdated and not really supported by Forge any more. I recommend updating straight to 1.11.2, or at least to 1.8.9 if you have to use a 1.8.x version.
-
Item Model Rendering Question
I'm not too sure why that's not working, sorry. It could be something to do with your textures, since I downloaded the model and switched the textures to vanilla ones and the inner sphere was rendered. The screenshot below uses minecraft:blocks/glass as the charm texture and minecraft:blocks/itemframe_background as the element texture.
-
[1.11.2] onItemUse & onItemRightClick not being called
Put a breakpoint in each of the methods and run Minecraft in debug mode. Are the breakpoints hit? If not, post your mod as a Git repository. Look at my mod and its .gitignore file for an example of which files you should include in the repository.
-
[1.11.2] onItemUse & onItemRightClick not being called
Have you actually registered an instance of the class that contains those methods?
-
ItemStack capabilities behaving oddly when playing on server
I think the doc comment is outdated or just incorrect, ItemFireworkCharge and ItemMonsterPlacer are both stackable items that use NBT.
-
ItemStack capabilities behaving oddly when playing on server
Your client-side code will need to get its data from the ItemStack's compound tag instead of the capability instance.
-
Duplicated item in CreativeTabs.MISC
Looking into this further, the original Item is never returned by the registry iterator used in CreativeTabs#displayAllRelevantItems; the substitution is returned twice. This explains why setting the creative tab of the original Item doesn't work. I'm not sure if there's any way to fix this.
-
[Solved] Client-side event when joining a server
It looks like FMLNetworkEvent.ClientConnectedToServerEvent may be too early to send packets, so you should probably use EntityJoinWorldEvent instead. Something is sending an SPacketEntityStatus when there's no client World. Set a breakpoint in the SPacketEntityStatus(Entity, byte) constructor to see where the packet is being sent from.
-
Duplicated item in CreativeTabs.MISC
He said it's a side effect, not a sided effect. This has nothing to do with the client/server sides.
-
[Solved] Client-side event when joining a server
Try using FMLNetworkEvent.ClientConnectedToServerEvent. Keep in mind that this is fired on a network thread rather than the main thread, so you need to schedule a task to run on the main thread before you can safely interact with normal Minecraft classes. I'm not entirely sure whether a SimpleNetworkWrapper can be safely used from multiple threads at once. You could check that the event's entity is the client player before sending the packet.
-
ItemStack capabilities behaving oddly when playing on server
Item capabilities are hard to sync properly, as discussed here and in the referenced issues. The best option at the moment may be overriding Item#getNBTShareTag to include the capability data required for display purposes. If you're attaching your capability to external items (from vanilla or other mods), you may have to put the capability data directly in the ItemStack's compound tag.
-
Duplicated item in CreativeTabs.MISC
I reported this here, cpw isn't intending to fix it. You can probably set the vanilla Item's creative tab to null before you substitute it to prevent it from showing up in the creative menu.
-
1.7.10 getblock to 1.11 BlockPos in for loop
Don't rely on numeric IDs of singletons like Block and Item, they're automatically assigned and can be different in every save. Compare the objects directly instead (e.g. state.getBlock() == Blocks.OBSIDIAN).
-
Item Model Rendering Question
ItemBlocks are rendered in exactly the same way as any other Item (except if they use a TESR, which the beacon item doesn't). The beacon block and item themselves use regular JSON models, the TESR is only used to render the beam. I added a regular Item that uses the beacon model here and it renders just like the vanilla beacon (as you can see in the screenshot below). @MitchB Post your model and a screenshot demonstrating how it's not working.
-
Sound detection
Then iterate through the values of SoundManager#playingSounds (or use a Stream) and check if any of the ISounds match the SoundEvent you're checking for.
-
Sound detection
SoundManager#playingSounds is a Map with String keys and ISound values. Printing it to the log won't help you much, since PositionedSoundRecord (an ISound implementation) doesn't override Object#toString to provide custom output. The ISound#getSoundLocation returns the name of the SoundEvent that the ISound represents, this is the smae name that's returned by SoundEvent#getSoundName, What exactly are you trying to do? Are you trying to take an action when a sound starts playing, or are you trying to detect whether a sound is playing at an arbitrary point in time?
-
[1.11.2] Village like structure
You can probably use the structure system to choose which components are generated and then use the template system to generate each component. It's entirely possible that nobody has done this before, so you'll likely have to figure it out yourself.
-
Sound detection
You'd need to use an AT or reflection to access the field, yes. I'd personally recommend using reflection to avoid modifying the vanilla code, but either method should work. Another way to gain access to the SoundManager instance without ATs/reflection is by subscribing to SoundSetupEvent and storing the instance. This is probably the best option.
-
[1.10.2] Packets not working?
The EventPacket no-argument constructor is private, but it needs to be public so it can be accessed by FML/Netty.
-
Sound detection
You're trying to access the field through the class (SoundManager) rather than an instance of it (the one stored in the private SoundHandler#sndManager field, you can use Minecraft#getSoundHandler to get the SoundHandler instance). It's not a static field, so you can't do this.
-
Newbe Texture Troubles
I'm not too sure. Try setting a breakpoint in the first loop in ModelLoader#loadItemModels (for(Item item : items), line 325 in my workspace) with the condition item == <your Item instance> and stepping through the code to see what's going on. If that fails, post your whole mod as a Git repository. Look at my mod and its .gitignore file for an example of the files to include. In the Referenced Libraries (Eclipse) or External Libraries (IDEA) section of the project window, there should be a library called forgeSrc-<forgeVersion>.jar that contains the code and assets from Forge and Minecraft. Eclipse can't actually open most files in JARs by default, you need to associate JSON files with the internal text editor (in Window > Preferences > General > Editors > File Associations) or install a plugin. You also need to install a plugin to view PNG files in JARs. IDEA can open JSON and PNG files in JARs by default and allows you to navigate to a file (including those in JARS) with Ctrl-Shift-N.
-
NBT integer var update wrong
I completely missed the fact that this is an Entity rather than a TileEntity. Still, overriding Entity#readFromNBT and Entity#writeToNBT should work (though you're meant to override Entity#readEntityFromNBT and Entity#writeEntityToNBT instead).
-
NBT integer var update wrong
That code should work, since TileEntity#writeToNBT writes its data to and then returns its argument.
-
[1.10.2] [SOLVED] Apply damage when colliding with block
You need to override Block#isFullCube to return false. This will stop players being pushed out of the block and stop them suffocating in the block.
- [1.11.2] Registering blocks
IPS spam blocked by CleanTalk.