Jump to content

Choonster

Moderators
  • Posts

    5117
  • Joined

  • Last visited

  • Days Won

    75

Posts posted by Choonster

  1. Only spawn the grenade entity and play the sound if you successfully consumed the reagent (in the

    if (player.inventory.consumeItem(...))

    block).

     

    Item#setMaxStackSize

    should only be called once (in the constructor or wherever you instantiate the class). There's no reason to call it every time the item is right clicked.

  2. That is the correct way to get the client player, but you probably shouldn't be changing this on the client side unless it's a client-only mechanic.

     

    If other players need to know about the change, you should send a packet to the server to tell it that the key was pressed and then handle the change there.

     

    You shouldn't be using block or item IDs at all unless you have a very good reason to (which is almost never the case). To get the

    Block

    form of an

    Item

    , use

    Block.getBlockFromItem

    .

  3. That would work if i was using 1.7, but 1.8 doesn't work with that. any other way to make a worldgenMineable for end stone?

    1.8 is slightly different, but it's still possible to do. Look at the

    WorldGenMinable(IBlockState, int, Predicate)

    constructor and how it's called by the two-argument constructor.

  4. Yes, you can have as many states as you want; it's just that you can only store 16 possible states in the metadata. Beyond that you have to use a

    TileEntity

    and one of the two methods I mentioned. Most Forge and vanilla code uses

    Block#getActualState

    ,

    Block#getExtendedState

    is only used for rendering

    ISmartBlockModel

    s and returns the result of

    Block#getActualState

    by default.

  5. How would I load the NBT Data from the current Tile Entity?

    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.

     

    I'm sorry..  I'm not quite sure I understand.  I would pass the blockPos instead of the TileEntity?

     

    Thanks!

    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.

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. What JSON are you referring to? there are several places in the code that use JSON. If you're referring to custom block models, I'd be interested to see why you're using JSON instead of a custom block renderer? Since the JSON needs to be parsed, it's be better optimized to do it with a custom renderer.

     

    Are you not aware that 1.8 uses JSON models for most blocks and items?

  11. Entities don't have NBT data. Entities are saved to NBT. The getEntityData is abusing the NBT system.
    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.

  12. 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.

  13. http://pastebin.com/DUr5wEFm

     

    here is the log of the "gradlew setupDecompWorkspace --refresh-dependencies"

    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?

×
×
  • Create New...

Important Information

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