Jump to content

Kaneka

Members
  • Posts

    110
  • Joined

  • Last visited

Everything posted by Kaneka

  1. hi everybody, I am trying to make a greenhouse which let the plants grow faster, here is the update() method of my tileentity: @Override public void update() { World world = this.getWorld(); BlockPos pos = this.pos; if(i < ticksPerItem) { i++; } if(i >= 20) { if(checkmultiblockstructure() == true) { double a,b; int c, d; a = Math.random()*9; b = Math.random()*9; c = (int)a; d = (int)b; BlockPos target = pos.up().south(4).east(4).north(c).west(d); growplant(world, target); } i = 0; } } and the growplant() method: public void growplant(World worldIn, BlockPos target) { IBlockState iblockstate = worldIn.getBlockState(target); if (iblockstate.getBlock() instanceof IGrowable) { IGrowable igrowable = (IGrowable)iblockstate.getBlock(); if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote)) { System.out.println("1"); if (!worldIn.isRemote) { System.out.println("2"); if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate)) { System.out.println("3"); ItemDye.spawnBonemealParticles(worldIn,target,0); igrowable.grow(worldIn, worldIn.rand, target, iblockstate); } } } } } I only get 1 shown in the console, but not more, when I change the !worldIn.isRemote to worldIn.isRemote it shows me 2 and 3 too. But that doesnt make sence, cause on clientside applying bonemeal don´t change anything.... Any idea to solve this problem?
  2. When you installed Forge for development, did you specify "setupDecompWorkspace"? If not, then you may want to install it again. Once you have the "Decomp" setup, then you'll find a mostly deobfuscated transformation of vanilla source code in <ForgeDir>\build\tmp\recompSrc. The java is under "net", and json files are under "assets". All of the blocks and items and entities and achievements etc are there to be studied, called, extended, imitated (and copy-pasted and reflected). I can find the source code of vanilla in 1.8, but not that one for the watering can and imaginary time block How do you want to effect it? Do you want to use an item like a watering can to increase growth rate like ExtraUtilities adds? If so, I can help with the code in 1.7.10, I haven't looked into 1.8 just yet though as most mods I play are 1.7.10 still so I'm making mine in 1.7.10 for now. If that's the effect you want, look at bonemeal functions or just look at how a plant grows. It has a random chance during it's updateTick to increase metadata (aka the growth stage). So on your item's onItemUse you can check if the block you are using it on is an instance of blockCrop for example, if so give a random chance to increase metadata by one .setBlockMetadataWithNotify(...); Here is an example of a debug item I use as a tool to increment/decrement my crop's growth stage (metadata) if its an instance of my crops specifically (OrePlant), the player is in creative, and the metadata isn't already at full grown or lower than 0. You would replace 7 with whatever your max growth stage is, so you may want to call that into a variable. All of my ore plants have a stage of 7 so I hard coded it, but I will likely go recode that later into a variable just to make things better. I can include the full file if you need me to. thanks for the answer, but i thing i will try to use the code from the bonemeal to support other mods crops too. But i dont like your thinking of the 1.7.. the biggest problem of 1.8 is that all think " lets stay on 1.7" but as you can read in other threads of me that to get 1.8 focused, more modder have to jump on the 1.8 train and update to 1.8 or start in 1.8.
  3. Hello everybody, how can i effect plant? Like the Watering Can from Extra Utility or Imaginary Time Block from Quantum Flux? I cant find source code for 1.8 and want to know how i could add a greenhouse to my mod. Thanks for the answer, Kaneka
  4. Easiest way would be looking in this tutorial : http://bedrockminer.jimdo.com/modding-tutorials/basic-modding-1-8/first-item/ In 1.8 using textures had changes a lot and you have to handle JSON files. To test your json´s you could use this, cause eclipse don´t check json´s. http://jsonlint.com/ Kaneka
  5. I think the method, which unloads the mobs is the "protected void despawnEntity()" method in the "EntityLiving" class /** * Makes the entity despawn if requirements are reached */ protected void despawnEntity() { net.minecraftforge.fml.common.eventhandler.Event.Result result = null; if (this.persistenceRequired) { this.entityAge = 0; } else if ((this.entityAge & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) { if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) { this.entityAge = 0; } else { this.setDead(); } } else { EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, -1.0D); if (entityplayer != null) { double d0 = entityplayer.posX - this.posX; double d1 = entityplayer.posY - this.posY; double d2 = entityplayer.posZ - this.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; if (this.canDespawn() && d3 > 16384.0D) { this.setDead(); } if (this.entityAge > 600 && this.rand.nextInt(800) == 0 && d3 > 1024.0D && this.canDespawn()) { this.setDead(); } else if (d3 < 1024.0D) { this.entityAge = 0; } } } }
  6. ok, thanks a lot for all
  7. I only mean that when i click on the [insert code] button in the text editor of this forum, nothing changes...
  8. Thanks for the support, here the working code: (can´t insert the code background, don´t know why...) @Override public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune); ret.clear(); ret.add(new ItemStack(this.getSeed(), 1, 0)); return ret; }
  9. ok, thanks for the answer. Never worked with events before, but it seems that this will be my next topic to learn.
  10. yes, is there any quick way?
  11. I think you don´t understand me, this plant class extends BlockCrops, and yes, they drop seeds, but to much, I only want them to drop one, not more. It doesn´t matter on which AGE they are, they should drop only one seed.
  12. no, I want that every crop drops only one seed when harvested. As they do when they are in AGE 0-6
  13. I mean it should only drop the seed, the plant reproduces itself by placing itself on the next block. And if you harvest the Block, you should only get one seed, you should not reproduce it by getting more than 1 seed from harvesting the crop
  14. Hello everyone, I am trying to create a plant that only drops the seed once, not multiplied, what do I have to override to do so? Thanks for the answer, Kaneka
  15. thanks, i only looked on BlockLilipad, not ItemLiliPad
  16. Hello everybody, I am trying to add waterplants, but i don´t know how i can make blocks placeable on water like lily pad. I looked trought the source code of the lilypad, but I dont find the solution. thanks for helping, Kaneka
  17. Ok, thanks for the anwers, I will stay at 1.8, because Planttech is to big and it will be bigger soon.
  18. In my tread, following was mentioned: "Any plans on a 1.7.10 release because 1.8 is not the Most stable forge ATM" Source : http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2522408-planttech-1-0-0
  19. Hello everyone, I coded a Mod with forge 1.8( and learned it this way) and don´t know anything about 1.7.10, but atm I have a few questions, because a member asked me if I plan a 1.7.10 version, because it is the stable version. Now I want to know if and when there will be a stable version of 1.8 ? Atm there are a lot modpacks of 1.7.10, but only few modpacks for 1.8, why and will there be more in the future or will it be skipped because of 1.9? Would it be a better idea to stay at 1.8 and hope for a better future, or should I start relearning everything with 1.7.10?? Thanks, Kaneka
  20. thanks, had to change maxX, maxY and maxZ, but at the end it works
  21. Hello everyone! I had implemented plants as blocks and want to made them solid(you should not could work through and you could stand on) but don´t know how... Could someone help? Thanks for answers!
  22. Thanks thanks thanks! i feel so silly right now.... i will use it in the future
  23. hi everybody, Sorry for my bad English. I started programming a days before and try to learn it with online tutorials, and now i have a problem. i am trying to make a Crop like it is shown in this Tutorial(it is German) https://www.youtube.com/watch?v=L8_JeR7BR6A, but i tried to do it with proxys . The seeds working fine, and i can plant the Crop with the seed, but it doesn't load the texture... I think i have set the .json files right, but i would be happy if someone could look for the mistake i made. Console shows me this and for all the different states 0,1,2....7: Here are the important code passages: Diamondoreplant.java(extends crops import net.kaneka.planttech.Main; import net.kaneka.planttech.items.Moditems; import net.minecraft.block.BlockCrops; import net.minecraft.client.Minecraft; import net.minecraft.init.Items; import net.minecraft.item.Item; public class Diamondoreplant extends BlockCrops { @Override protected Item getSeed() { return null; } @Override protected Item getCrop() { return Items.diamond; } } Modblocks.java (register blocks) import net.kaneka.planttech.Main; import net.kaneka.planttech.blocks.plants.Diamondoreplant; import net.kaneka.planttech.blocks.plants.Oreplant; import net.minecraft.block.Block; import net.minecraft.block.BlockCrops; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; public class Modblocks { ... public static BlockCrops diamondoreplant; public static void CreateB() { ... GameRegistry.registerBlock(diamondoreplant = new Diamondoreplant(), "diamondoreplant"); } } CommonProxy.java (register blocks) package net.kaneka.planttech; import net.kaneka.planttech.blocks.Modblocks; import net.kaneka.planttech.items.Moditems; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.item.Item; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; public class CommonProxy { public void preInit(FMLPreInitializationEvent e) { Modblocks.CreateB(); Moditems.CreateI(); } BlockRenderRegister.java (register Blockrender) package net.kaneka.planttech.client.render.blocks; import net.kaneka.planttech.Main; import net.kaneka.planttech.blocks.Modblocks; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public final class BlockRenderRegister { public static String modid = Main.MODID; public static void renderBRegister() { ... register(Modblocks.diamondoreplant); } public static void register(Block block) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(modid + ":" + block.getUnlocalizedName().substring(5), "inventory")); } } ClientProxy.java [code] package net.kaneka.planttech; import net.kaneka.planttech.blocks.Modblocks; import net.kaneka.planttech.client.render.blocks.BlockRenderRegister; import net.kaneka.planttech.client.render.items.ItemRenderRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; public class ClientProxy extends CommonProxy{ @Override public void preInit(FMLPreInitializationEvent e) { super.preInit(e); } @Override public void init(FMLInitializationEvent e) { super.init(e); ItemRenderRegister.registerIRenderer(); BlockRenderRegister.renderBRegister(); } Now the .json files: assets/planttech/blockstats/diamondoreplant.json { "variants": { "age=0": { "model": "planttech:diamondoreplant_0" }, "age=1": { "model": "planttech:diamondoreplant_1" }, "age=2": { "model": "planttech:diamondoreplant_2" }, "age=3": { "model": "planttech:diamondoreplant_3" }, "age=4": { "model": "planttech:diamondoreplant_4" }, "age=5": { "model": "planttech:diamondoreplant_5" }, "age=6": { "model": "planttech:diamondoreplant_6" }, "age=7": { "model": "planttech:diamondoreplant_7" } } At least one from the other .json files, they are all the same with different numbers. assets/planttech/models/block/diamondoreplant_0.json { "parent": "block/crop", "textures": { "crop": "planttech:blocks/diamondoreplant_0" } } and so on with diamondoreplant 1,2,3...7 I have also add the .json file diamondoreplant to models/item. Thanks for reading and i am hopping somebody can help me. Kaneka
×
×
  • Create New...

Important Information

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