• 0

    posted a message on Plant Generation Instead of Ore Generation

    See my World Generation Tutorial, where I demonstrate world gen concepts by spawning cookie bushes on the world surface at random.

    Posted in: Modification Development
  • 0

    posted a message on Make a block drop a item just sometimes

    I was purposely NOT posting real code... I want to verify that they know how to solve problems on their own.

    Also the OP is provided a Random in the method signature, they don't need to make a new one.

    Posted in: Modification Development
  • 0

    posted a message on Make a block drop a item just sometimes

    Override quantityDropped to use the Random that is passed in. There are several techniques to use Random to make something happen X amount of the time.

    For situations where a percentage gives context, I prefer getting a random number between 0 and 100 and checking it against a (constant) percentage chance.

    if(random number 0-100 < PERCENT_CHANCE)
        // do something PERCENT_CHANCE percent of the time

    For situations where something should happen less than 1/100 of the time, I check if a random number from 0 to X is 0.

    if(random number 0-FREQUENCY == 0)
        // do something 1 in FREQUENCY times

    Note: since this is obviously an MCreator piece of code, it is likely that you 1) don't know Java or 2) don't know what you're doing. I suggest looking up how to use Random for either of those cases.

    Posted in: Modification Development
  • 1

    posted a message on How can a "permanent" property be stored?

    Use WorldSavedData to store NBT information per-world (or per-dimension, depending on your needs).


    The readthedocs explain WorldSavedData here, and I have a (large) example here. Remember to call markDirty() any time you change a value that you want saved.


    Another way to do this would be writing a file to the world save folder, but trust me -- WorldSavedData is easier and more reliable.

    Posted in: Modification Development
  • 0

    posted a message on Help with CraftingHandler

    I am trying to get my item to take durability damage on crafting.

    There are other ways to do this, without using a complicated event. If this is your item, all you need to do is override getContainerItemStack and hasContainerItem in your item class to return an ItemStack that is damaged.


    See this post, this post, or this example.

    Posted in: Modification Development
  • 2

    posted a message on Thoughts on the future of modding.

    As a modder who started in 1.7.10 and has updated/built mods all the way to 1.10.2, here are my two cents:


    People who enter modding as a pasttime or a nice way to learn Java will often be discouraged. This was true for 1.7.10 would-be-modders and it is true of 1.10.2 would-be-modders.

    People who love coding and modding, on the other hand, will not be stopped, no matter how complex it becomes to make a "simple" mod. Personally, I enjoy the challenge of writing working code (and then transforming it into good working code) and work with whatever changes are made simply because I like trying.


    Was I excited by the JSON system and many rendering changes? No -- until I discovered the power of special models without a TESR or complicated vertex code. Was I excited by BlockPos and the need to change every single method signature in my block classes? No -- until I discovered the helper methods and convenience of such a container class. Was I excited by IProperty and IBlockState requiring several bridges just to get block metadata? No -- until I discovered how much easier it was to remember a property name than the significance of each bit in stair or door metadata (structure generation got a lot easier with that change). There are still some changes that I am not excited about, but I look at those as changes of which I have not learned the true power yet.


    What I'm saying here is that the people who sincerely enjoy coding and modding will find a way to use every change to their benefit. At the very least they will accept the need to work with changes instead of against them. The learning curve may be steeper than it once was, but for people who love learning and trying, that steepness makes no difference.

    Posted in: Modification Development
  • 0

    posted a message on mc forge 1.7.10 runtime error "cannot be cast"
    buildcraft.factory.TileAutoWorkbench cannot be cast to com.silvercraft.tile_entity.TileAutoWorkbench

    There are 2 classes named TileAutoWorkbench and you're importing the wrong one in the class where you cast the TileEntity.

    Try changing the import from this:

    import com.silvercraft.tile_entity.TileAutoWorkbench;

    to this:

    import buildcraft.factory.TileAutoWorkbench;

    Or, if it is very important to have the com.silvercraft TileAutoWorkbench (which I'm guessing is your own), rename it and change the imports accordingly.


    Or, like Upcraft said, add && world.getTileEntity(x, y, z) instanceof TileAutoWorkbench to the if-statement

    Posted in: Modification Development
  • 0

    posted a message on How to get multiple modules run at once?

    Hmm... I know you can edit the gradle.build to compile modules / dependencies into the final .jar file. I'm not totally sure why you want your workspace set up this way, and I am not familiar enough with it to be of more help.

    Posted in: Modification Development
  • 0

    posted a message on Flying with Limited Terms
    And also, shouldn't the player.inventory.hasItem(Item item) work in detecting the item in the inventory? It triggers flight for me.


    Yes, it detects whether the given item is there. That's not the problem.
    Also, I made a mistake, I realized that you do --rs.stackSize to subtract the stack from the inventory.

    Yes, that is how you subtract stack size. But 'rs' is still not an actual ItemStack in the player's inventory, it's an ItemStack that you made right then and there. It does not share anything with the actual redstone ItemStack that is in the player's inventory, so any methods or stacksize changes will not affect the player's inventory in any way.
    You have to search the player's inventory to get the ItemStack instance that contains the redstone that is in the player's inventory, not the redstone that is randomly in your code.
    No, I mean creative mode flight not working.

    Oops, I meant gamemode 1 flight. I don't play enough Minecraft to remember commands :P

    And no, I still don't know why your code is interfering with that flight.

    Posted in: Modification Development
  • 0

    posted a message on How can you make unlock-able item recipes?

    I was going to suggest a custom IRecipe class that checks if the player has unlocked the recipe, but there is no good way to access the player from an IRecipe.


    Instead, I suggest making a custom crafting table just for these 'unlockable' items along with a custom Container. This container can extend ContainerWorkbench and override canInteractWith(EntityPlayer), canCraft(EntityPlayer), and setCanCraft(EntityPlayer, boolean) to unlock recipes on a per-player basis.

    If you are familiar with Thaumcraft, the approach I am suggesting is similar to their Arcane Workbench and research system.


    I also suggest using a Capability to store information about which recipes are unlocked for that player.


    If this is too complicated for your current skills / knowledge, you may have to come up with a different approach. Maybe have a non-craftable item as part of this recipe, and right-clicking your other item gives you that important crafting component. That would have the same effect -- only players who have right-clicked that item can craft that recipe.

    Posted in: Modification Development
  • 0

    posted a message on How to get multiple modules run at once?

    Are you trying to run multiple modules in-game or in a development environment?


    If you are developing modules, set up a new workspace for each non-core module. Add the core module to the dependencies by placing that in /libs and running the setup command. Make sure to add that mod's id to the mcmod.info dependencies and/or the @Mod dependencies tag so they load in the right order.


    See Making Addons for Mods (where the addon is your new module and the mod is your core module). It was written for 1.7.10 but still applies to 1.10.2. Note that mods are no longer required to be deobfuscated in a development environment, as Forge can do that in run-time.


    To see how I add the mod as a dependency for Eclipse, see this post specifically.

    Posted in: Modification Development
  • 0

    posted a message on Flying with Limited Terms
    rs.damageItem(1, player);

    I'm not sure what you expected this to do. You made a new ItemStack (that doesn't even exist in the player inventory) and you're increasing the metadata of the ItemStack. I thought you wanted to decrease stack size of an actual ItemStack that the player has.

    For that, you need to search the inventory of the player for an ItemStack containing redstone, then decrement the stack size of that ItemStack if (player.ticksExisted % (ticksBetweenConsuming) == 0) where ticksBetweenConsuming is how many ticks before a redstone is consumed. Make sure to delete the ItemStack if its size is 0 or less.


    Look at ItemBow's findAmmo method for examples of getting an ItemStack from the player inventory. Look at ItemBow's onItemUseFinish method for examples of using up that ItemStack. Although come to think of it, those methods may only have been added in 1.9 with tipped arrows. In that case, look for a method that involves the phrase 'consumeItem' that is called from ItemBow.


    As for your problem with gamemode 0 flight not working, I can't tell why that would happen.

    Posted in: Modification Development
  • 0

    posted a message on setupDecompWorkspace skips almost everything then at 73% Crashes

    Copy everything in the command console and paste it to Pastebin or Gist.


    Those "few lines" are our only clue as to why it's crashing. If you want help, you need to provide us with all the information you can.

    Posted in: Modification Development
  • 0

    posted a message on Flying with Limited Terms

    There are 2 main ways of doing something special while a player wears armor:

    1) override onArmorTick in the armor class. Note that this will be called for every piece of armor (if you have more than just a chestplate)

    2) handle the PlayerTickEvent and check for your armor there.


    For flight, you almost always have to go the event-handling route. The hard part about armor that gives flight is taking that flight off when the player removes the armor. It's simple enough to set allowFlying to false, but what if there are multiple mods that have flying armor or items? You don't want to break those mods just by taking the easy route.


    If you want to have creative-style flight or directly enable the flying capability, you should handle the PlayerTickEvent. For a complicated but inter-mod compatible technique of doing this, see this post. If you want 'jetpack' style flight, where space applies upward motion but the player still falls (though slowly), see this slightly old post.

    Posted in: Modification Development
  • 0

    posted a message on Minecraft creates a new TileEntity every time I log in to my world?

    Yes, Minecraft makes a new TileEntity every time you load that chunk. It relies on the NBT read/write methods for the TileEntity to act the same.


    Make sure to call markDirty() whenever your TileEntity changes a value that you want to save. It will only call writeToNBT if you mark dirty.


    Also, why are you re-setting the TileEntity in your block? You do this for no real reason:

    w.setTileEntity(x, y, z, b);

    Try removing that line. There is no reason to have it there.

    Posted in: Modification Development
  • To post a comment, please .