Jump to content

Choonster

Moderators
  • Posts

    5161
  • Joined

  • Last visited

  • Days Won

    76

Everything posted by Choonster

  1. You don't. TileEntities are only written to NBT when the world is being saved, at runtime you should use the TileEntity 's fields directly. Treat it like a normal Java object. Get the TileEntity at the Block 's position ( World#getTileEntity ), cast it to TileEntityMimicBlock and call the getState method on it to get the IBlockState that particular instance is mimicing.
  2. You should probably review the basics of Java before you try to mod. A class can only extend a single class. Just extend BlockLog instead of Block . You don't need to override Block#getRenderType unless you want to use a different renderer to the super class. Block uses 3 (JSON model) and BlockLog doesn't override it. Your addInformation method won't do anything unless you're calling it yourself. It doesn't override any super method.
  3. TileEntity#getTileData isn't meant to be used for your own TileEntities , it's meant to be used with TileEntities from vanilla or other mods. It returns an NBT tag completely separate from the NBT you read from/write to in TileEntity#readFromNBT and TileEntity#writeToNBT . Your Block#getExtendedState override should be calling TileEntityMimicBlock#getState on the TileEntity at the Block 's position.
  4. You'll need to be a bit more specific than that. What are you trying to do, how is it not working, what errors are you getting?
  5. Waila calls IWailaDataProvider#getNBTData on the server, so you can just write the appropriate values from the TileEntity to the NBT. If you don't register an NBT provider for the Block or TileEntity, Waila will simply call TileEntity#wrtieToNBT for you. You should use the IWailaDataAccessor 's NBT directly rather than the TileEntity in getWailaStack , getWailaHead , getWailaBody and getWailaTail methods.
  6. BlockLog overrides onBlockPlaced to set the rotation of the log from the side of the other Block that the player clicked on. If you extend BlockLog , this will be done for you. The log models use block/cube_column and block/column_side as the parent models for the regular and side models, respectively. Look at the blockstates file for any log type to see how it selects the model to use.
  7. ChunkProviderHell and ChunkProviderEnd in the net.minecraft.world.gen package. In IDEA, you can press Ctrl-N and start typing a class name to search your project and libraries for matching classes. Eclipse probably has a similar feature.
  8. Are you not aware that 1.8 uses JSON models for most blocks and items?
  9. I see, thanks for that explanation then. That makes me curious how the entitydata command works, perhaps it calls the readfromNBT function again. If you look at its implementation in 1.8, you'll see that it tells the Entity to write itself to NBT, merges that with the NBT specified in the command and then tells the Entity to read from the merged NBT. To address your initial confusion of ThrownPotion vs. EntityPotion : every Entity class is registered with a unique name. ThrownPotion is the name that the EntityPotion class is registered with.
  10. Use World#getBlockState to get the current block state at the specified position, then use IBlockState#getValue to get the value of each property. Some blocks have properties that aren't stored in the metadata (e.g. connection state of panes), you can use Block#getExtendedState to get an IBlockState with the actual values of these properties.
  11. You should pass the actual state ( World#getBlockState ) rather than the default state ( Block#getDefaultState ) to harvestBlock . At the time of removedByPlayer being called, the Block is still in the world.
  12. You can also download exports of the mappings from the MCPBot site. Alternatively, you can view the mappings used by your ForgeGradle workspaces in the ~/.gradle/caches/minecraft/de/oceanlabs/mcp/<channel>/<version> directory (replace ~ with %USERPROFILE% on Windows).
  13. Override the BiomeGenBase#getGrassColorAtPos method that Failender mentioned.
  14. Not unless you create your own wire, vanilla redstone can only store power levels 0-15.
  15. Try overriding Block#removedByPlayer to call Block#harvestBlock if the player that destroyed the block is in creative mode.
  16. Simply returning true from Block#onBlockActivated should prevent the Eye of Ender from spawning. I just wrote this simple example and it works without issue.
  17. Gradle skips a task if it has previously completed it and the result is still valid. Your log doesn't have any errors in it, have you tried running gradlew eclipse or gradlew idea to generate an IDE project?
  18. Re-run gradlew setupDecompWorkspace eclipse .
  19. Okay, I thought I could use the vanilla spawn egg; but I'll implement my own egg and manually increment the stats.
  20. The Fluid constructor takes a ResourceLocation each for the still and flowing icons. To change the colour of the fluid, you'll need to extend Fluid and override Fluid#getColor . You'll need to register the forge fluid model for your BlockFluid . You can see an example of this here and here.
  21. You're calling ItemStack#getItem before checking if the ItemStack (returned from player.getCurrentEquippedItem() ) is null . When it's null , you'll get a NullPointerException because you tried to call a method of a null value. getHeldItem and getCurrentEquippedItem do the exact same thing, you should really only use one. Don't use System.out.println for output that the player is supposed to see in-game. Use EntityPlayer#addChatComponentMessage to send a chat message to a player (make sure you only do it on the client or server, not both). For general logging output, use FMLLog or a wrapper around it.
  22. For the stats to be incremented, the class to ID mapping is needed. For the egg to work, the ID to class mapping is needed. For the /summon command's auto-complete to work (not a big priority), the string (name) to ID mapping is needed (though the IDs are never actually used). Should I let FML create the class <-> name mappings with EntityRegistry.addModEntity and then manually add the three ID mappings and the egg?
  23. Is the basic premise of what I'm doing (using IDs >= 256 with vanilla spawn eggs) correct? Is there a specific part of my code you think is unnecessary? EntityRegistry.registerGlobalEntityID will log an ERROR message when the ID isn't an unsigned byte, though it will still add the mapping and the egg with EntityList.addMapping . My code calls the same method.
  24. This is only for a test mod which I don't plan to update to 1.8, I have a separate test mod for each version. I ended up going with a slightly different solution, but your reference to invalid IDs pointed me in the right direction. Thanks. The solution I ended up with was using IDs in the range [256, Short.MAX_VALUE ] and calling EntityList.addMapping instead of EntityRegistry.registerGlobalEntityID to add the spawn egg. You can see the code here. In the process of testing this, I realised that Biomes O' Plenty was already using IDs >= 300 for its own entities; so I found its implementation here. This is simpler than mine, but it doesn't add the class to ID mapping so kill statistics don't work.
  25. Following the comments from diesieben07 in this thread, I thought I'd try and implement my own spawn egg that didn't use global IDs. I quickly ran into an issue: the entity kill statistics rely on EntityList.EntityEggInfo , which is tied to the global ID list. I can create my own stats for each of my entities and increment them myself; but they won't show up in the vanilla statistics GUI (the mobs section of which also relies on global IDs). Is there any way to have kill statistics that display in the vanilla GUI without global IDs?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.