Jump to content

xwerswoodx

Forge Modder
  • Posts

    80
  • Joined

  • Last visited

Everything posted by xwerswoodx

  1. how did you add steelIngot? You have to add to item .setCreativeTab(Your Creative Tab) Also your item Unlocalized Name should be same with json file (case-sensitive)
  2. for 1.7.10 you need to use json file, you have it but names in json file should be same as disc name. If you use 1.8 I can give you my code, it works for 1.8 but I didn't try it for 1.7.10
  3. ref.uid is my mod reference.unique ID so it is extend, you need to type your modid there like yourmodid:blabla.ogg Ok, I found my old codes; Adddisc function; public class adddisc extends ItemRecord { public String music; public adddisc(int uid, String name, String music) { super(uid, music); this.setMaxStackSize(1); this.setCreativeTab(CreativeTabs.tabMisc); this.setUnlocalizedName(name); this.music = music; GameRegistry.registerItem(this, name); } @SideOnly(Side.CLIENT) @Override public void registerIcons(IconRegister reg) { this.itemIcon = reg.registerIcon(ref.uid + ":" + (this.getUnlocalizedName().substring(5))); } } This leds you to register discs to game. How?: in Main Class: public static Item discWish; inside to PreInit: discWish = new adddisc(configref.discWishID, "discwish", "wish"); inside to Init; MinecraftForge.EVENT_BUS.register(new SoundLoadHandler()); I didn't find anything else about this but it worked for me.
  4. it should be like this; buildscript { repositories { mavenCentral() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' } } apply plugin: 'forge' version = "1.8.0-0.2" group= "net.extend.mod" archivesBaseName = "extend" minecraft { version = "1.8-11.14.1.1354" runDir = "eclipse" mappings = "snapshot_20141130" } dependencies { } processResources { inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' expand 'version':project.version, 'mcversion':project.minecraft.version } from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } if you change this code, you need to register projectDir if you didn't.
  5. if you using Java 8 newest version it isn't work, you have to use jdk 7 or jdk 8u5 version.
  6. You can do it on onPlayerTick event like player.getCurrentItem and player.isSneaking() but I don't know scrolling.
  7. I have two questions; First: When I create an item named blockchecker, it's texture works well, but when I give model like blockchecker_activated, it isn't work. When I create a new item named blockchecker_activated, it's texture works well and when I give a blockchecker_activated render to blockchecker item it works as well. So I understand this, when I create an item same name with json file, minecraft render item, but when I don't give, it isn't render. So how can I fix this without create casting item, like fishing rod, I found something in ModelBakery.java but it is very long way to do this, is there any way to do this? Secondly: I have onPlayerTick event. It works fine, but when a player tick I want to upload my blockchecker item I did it, but here it updates all of the blockcheckers in server, doesn't it? So how can I do this for an item which is in player's inventory. @SubscribeEvent public void onPlayerTick(TickEvent.PlayerTickEvent event) { EntityPlayer player = event.player; InventoryPlayer inventory = player.inventory; if (inventory.hasItem(itemref.blockChecker)) { ((addmeter)itemref.blockChecker).initProps(); } } I did something like this but I am not sure it is work or not; for (int x = 0; x < inventory.getSizeInventory(); x++) { if (inventory.getStackInSlot(x).getItem().equals(itemref.blockChecker)) { ((addmeter)inventory.getStackInSlot(x).getItem()).initProps(); } }
  8. Yes, you need to create, it doesn't come with forge
  9. Site blocked for me could you please send your crash report from eclipse/crash_report/ folder in tag. [code] [code]Your Report [/code] Also what is your modid. I need for checking.
  10. public Multimap getItemAttributeModifiers() { Multimap multimap = super.getItemAttributeModifiers(); multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Bow modifier", (double)2.0F, 0)); return multimap; }
  11. <your_forge_folder>/src/main/resources/assets/<your_mod_id>/textures/items/ (for blocks blocks/)
  12. I remember at 1.6.4 you have to register sounds to SoundPoolStreaming, I check my old codes and find something like this but I don't remember clearly how was it works; package net.extend.mod.handler; import java.lang.annotation.Retention; import java.lang.annotation.Target; import net.extend.mod.ref; import net.minecraft.client.audio.SoundManager; import net.minecraftforge.client.event.sound.PlayStreamingEvent; import net.minecraftforge.client.event.sound.SoundLoadEvent; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class SoundLoadHandler { @SideOnly(Side.CLIENT) public void onSoundsLoaded(SoundLoadEvent event) { SoundManager src = event.manager; src.soundPoolStreaming.addSound(ref.uid + ":carol.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":jingle.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":wish.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":birgoruskabininde.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":ahsensiz.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":konewyear.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":numb.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":beautifulmind.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":somebodytoldme.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":kids.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":ghostsnstuff.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":vivalavida.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":applause.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":diamonds.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":moveslikejagger.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":rapgod.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":setfiretorain.ogg"); src.soundPoolStreaming.addSound(ref.uid + ":survival.ogg"); } @SideOnly(Side.CLIENT) public void onPlayStreaming(PlayStreamingEvent event) { boolean isCont; isCont = event.name.contains(ref.uid); if (!isCont) { FMLClientHandler.instance().getClient().SoundManager.playStreaming(ref.uid + ":" + event.name, event.x + 0.5F, event.y + 0.5F, event.z + 0.5F); } } }
  13. pastebin is blocked by my network server so I can't see your code, if you paste it here, I can help you better, ah sorry I answered you question for 1.7.10 because you said I still got 1.7.10 so I think you use it, ok for 1.8 my item class is this; package net.extend.mod.functions; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; public class additem extends Item { public additem(int stack, String name, CreativeTabs tab, boolean craftReturn) { super(); this.setMaxStackSize(stack); this.setCreativeTab(tab); this.setUnlocalizedName(name); if (craftReturn) { this.setContainerItem(this); } GameRegistry.registerItem(this, name); } } I am using that way to register; public static Item blackDiamond; for Preinit: blackDiamond = new additem(64, "blackdiamond", CreativeTabs.tabMaterials, false); for Renders, add this to your main class; public static void registerRender(Item item) { String name = ref.uid + ":" + (item.getUnlocalizedName().substring(5)); //You have to use your modid for ref.uid. ModelResourceLocation location = new ModelResourceLocation(name, "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, location); } After that in init section; (Not preinit!) registerRender(blackDiamond); blackdiamond.json: (extend is my mod id, you need to type there your modid.) { "parent": "builtin/generated", "textures": { "layer0": "extend:items/blackdiamond" }, "display": { "thirdperson": { "rotation": [-90, 0, 0], "translation": [0, 1, -3], "scale": [0.55, 0.55, 0.55] }, "firstperson": { "rotation": [0, -135, 25], "translation": [0, 4, 2], "scale": [1.7, 1.7, 1.7] } } }
  14. 1.7.10 version you need to use IIcon for texture. You need a png file as assets/<your_mode_name>/textures/items/<your_item_name>.png. This is the code for giving texture; @SideOnly(Side.CLIENT) @Override public void registerIcons(IIconRegister reg) { this.itemIcon = reg.registerIcon(ref.uid + ":" + (this.getUnlocalizedName().substring(5))); } Or you can only use this.setTextureName when you register item. Also maybe you forgot to register item like; GameRegistry.registerItem(<item_uid>, "<item_name>"); There can be many mistakes, if you explain what the problem is and what you changed clearly, we can help you.
  15. Ah ok, I will read it again, but it is about blocks I want to change texture of item, is it same? because items don't have face. { "parent": "builtin/generated", "textures": { "layer0": "extend:items/block_checker" }, "display": { "thirdperson": { "rotation": [-90, 0, 0], "translation": [0, 1, -3], "scale": [0.55, 0.55, 0.55] }, "firstperson": { "rotation": [0, -135, 25], "translation": [0, 4, 2], "scale": [1.7, 1.7, 1.7] } } }
  16. First you need to delete imports from import sections and you need to import new folders. After that, some codes totally change, you can paste here, if I know, I can help you, or mods can help you.
  17. I did something like this before, I really don't remember everything, but I remember, you need to create new arrow handler and when it hit, you need to give a poison potion to victim
  18. I add my favorites that sites but my question isn't this. Before your post I asked new question, maybe you didn't see
  19. I didn't want to post new topic and up my topic because I have another question. How can I update texture in game? How can I explain, for example diamond meter, when you go nearest, it's texture change, I want to know how can I update my texture in game. I tried this but it didn't work. public void setRender(Item item, int level) { if (level < 1) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(ref.uid + ":" + (item.getUnlocalizedName().substring(5)), "inventory")); } else { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(ref.uid + ":" + (item.getUnlocalizedName().substring(5)) + "_" + level, "inventory")); } } in onPlayerTick section; setTexture(this, level);
  20. Edit: I fixed it, The mistake is I was exclude my blockstates folder. I include it again and fix it thanks all for help. Also thanks for MrCrayFish for registerRender video.
  21. Yeah, I realize it 5 mins before but now, json files isn't working, I am trying to give a texture but it isn't work. I have png file in textures/blocks, I have blackdiamondblock.json in models/block and blockstates folders. I have been working on that for 3 days, I am really tired to update from 1.7.10 to 1.8.0! I liked IIcon it was easy
  22. There is no another mistake, because as I said before when I cancel blockref.registerRenders(); it works when I try to give texture to blocks it crashes. Crash reports doesn't have anything for help just error at preinit section at net.extend.mod.blockref.registerRender(blockref.java:62) at net.extend.mod.blockref.registerRenders(blockref.java:57) at net.extend.mod.extend.preInit(extend.java:101) This is the error. If you need I can paste all file but you can see same things ---- Minecraft Crash Report ---- // This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~] Time: 07.04.2015 22:16 Description: Initializing game java.lang.NullPointerException: Initializing game at net.extend.mod.blockref.registerRender(blockref.java:62) at net.extend.mod.blockref.registerRenders(blockref.java:57) at net.extend.mod.extend.preInit(extend.java:101) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:518) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:514) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243) at net.minecraft.client.Minecraft.startGame(Minecraft.java:446) at net.minecraft.client.Minecraft.run(Minecraft.java:356) at net.minecraft.client.main.Main.main(Main.java:117) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.extend.mod.blockref.registerRender(blockref.java:62) at net.extend.mod.blockref.registerRenders(blockref.java:57) at net.extend.mod.extend.preInit(extend.java:101) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:518) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:514) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243) at net.minecraft.client.Minecraft.startGame(Minecraft.java:446) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:356) at net.minecraft.client.main.Main.main(Main.java:117) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) -- System Details -- Details: Minecraft Version: 1.8 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_05, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 721074048 bytes (687 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.10 FML v8.0.69.1354 Minecraft Forge 11.14.1.1354 5 mods loaded, 5 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{8.0.69.1354} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1354.jar) Unloaded->Constructed->Pre-initialized Forge{11.14.1.1354} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1354.jar) Unloaded->Constructed->Pre-initialized examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed->Pre-initialized extend{0.0.1} [Extend] (bin) Unloaded->Constructed->Errored Loaded coremods (and transformers): Launched Version: 1.8 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics Family GL version 3.1.0 - Build 8.15.10.2476, Intel GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported. Using VBOs: No Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: English (US) Profiler Position: N/A (disabled)
  23. When I try to give texture to items, blocks or anything else, minecraft crashes. I don't understand why, and where I did mistake; Pre Init: @EventHandler public void preInit(FMLPreInitializationEvent event) { configref.Settings(event); new blockref(); // blockref.registerRenders(); // new itemref(); // new armorref(); // new foodref(); // new reciperef(); //Generation GameRegistry.registerWorldGenerator(new generation(), 1); } When cancel blockref.registerRenders(); it works without problem, but when I activate it it crashes. package net.extend.mod; import net.extend.mod.functions.addblock; import net.extend.mod.functions.addore; import net.extend.mod.functions.addramp; import net.extend.mod.functions.addstair; import net.minecraft.block.Block; import net.minecraft.block.BlockStairs; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.extend.mod.itemref; public class blockref { //Blocks public static Block acidBlock; public static Block acidOre; public static Block blackDiamondOre; public static Block blackDiamondBlock; public static Block nightOre; public static Block nightBlock; /* public static Block owen; public static Block owenActive; */ //Stairs public static Block blackDiamondStair; public static Block nightStair; //Ramps public static Block ironRamp; public blockref() { //Add Block /*this.acidBlock = new addblock(configref.acidBlockID, "acidblock", Material.rock , Block.soundStoneFootstep, 2.0F); MinecraftForge.setBlockHarvestLevel(acidBlock, "pickaxe", 2); this.acidOre = new addore(configref.acidOreID, "acidore", Block.soundStoneFootstep, 2.0F); MinecraftForge.setBlockHarvestLevel(acidOre, "pickaxe", 3);*/ this.blackDiamondBlock = new addblock("blackdiamondblock", Material.iron, Block.soundTypeStone, 2.0F, "pickaxe", 2); // this.blackDiamondOre = new addore("blackdiamondore", Block.soundTypeStone, 4.0F, "pickaxe", 2); // this.nightOre = new addore("nightore", Block.soundTypeStone, 4.0F, "pickaxe", 2); // this.nightBlock = new addblock("nightblock", Material.iron, Block.soundTypeStone, 2.0F, "pickaxe", 2); // this.tomatoCrop = new tomatoCrop(); // this.nightStair = new addstair("nightstair", this.nightBlock); // this.blackDiamondStair = new addstair("blackdiamondstair", this.blackDiamondBlock); // this.ironRamp = new addramp("ironramp", blockref.blackDiamondBlock); } public static void registerRenders() { registerRender(blackDiamondBlock); } public static void registerRender(Block block) { Item item = Item.getItemFromBlock(block); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(ref.uid + ":" + (block.getUnlocalizedName().substring(5)), "inventory")); } } this.blackDiamondBlock = new addblock("blackdiamondblock", Material.iron, Block.soundTypeStone, 2.0F, "pickaxe", 2); this is the only activated line on blockref section. I cant give any textures to them, how can I fix this? This is addblock, maybe you need it. package net.extend.mod.functions; import net.extend.mod.ref; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class addblock extends Block { public addblock(String name, Material material, SoundType sound, float hardness, String item, int level) { super(material); this.setHardness(hardness); this.setStepSound(sound); this.setCreativeTab(CreativeTabs.tabBlock); this.setUnlocalizedName(name); this.setHarvestLevel(item, level); GameRegistry.registerBlock(this, name); } }
  24. Ah thank you I hope it works, I can try it after I fixed all of my errors because I am trying to update my items from 1.7.10 to 1.8.0 so it little bit hard. What about second question, how can I get IBlockState for custom block. There is a function like getBlockState but it isn't IBlockState so how can I get it? I found a function like this; world.getBlockState(BlockPos) : IBlockState and I tried like this; BlockPos pos1 = new BlockPos(oreX, oreY, oreZ); (new WorldGenMinable(world.getBlockState(pos1), amount)).generate(world, random, pos1); It works without error, I am not sure but if there is someone stuck about this maybe help them. Thanks for help.
  25. Oh, not I mean like this; I have a code like this; if (world.getBlock(x1, y1, z1) == Blocks.coal_ore) { found.add(new int[] { x1, y1, z1 }); } But there is no getblock in 1.8 so if I change this to; BlockPos pos1 = new BlockPos(x1, y1, z1); if (world.getBlockState(pos1) == Blocks.coal_ore.getBlockState()) { found.add(new int[] { x1, y1, z1 }); } Is it work correctly? And also you said blockstate and Iblockstate is very different so how can I fix my worldminable code public void generateSurface(World world, Random random, int chunkX, int chunkZ, Block str, int amount, int chunkY) { for (int i=0; i < 20; i++) { int oreX = chunkX + random.nextInt(16); int oreY = random.nextInt(chunkY); int oreZ = chunkZ + random.nextInt(16); BlockPos pos1 = new BlockPos(oreX, oreY, oreZ); IBlockState state = (IBlockState)str.getBlockState(); (new WorldGenMinable(state, amount)).generate(world, random, pos1); } } I did something like this generateSurface(world, random, chunkX * 16, chunkZ * 16, blockref.blackDiamondOre, 4, 12); generateSurface(world, random, chunkX * 16, chunkZ * 16, blockref.nightOre, 3, 10);
×
×
  • Create New...

Important Information

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