Jump to content

themistik

Members
  • Posts

    10
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    At home

themistik's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello again. Well, i've decided to add more block to my mod. But then, this happends : ---- Minecraft Crash Report ---- // I feel sad now :( Time: 14/08/17 15:01 Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Steamhouse's Mod (stm) Caused by: java.lang.NullPointerException at fr.steamhouse.mod.init.ModBlocks.registerBlock(ModBlocks.java:257) at fr.steamhouse.mod.init.ModBlocks.register(ModBlocks.java:193) at fr.steamhouse.mod.MainClass.preInit(MainClass.java:48) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:618) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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:243) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:221) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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:145) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:624) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:259) at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) at net.minecraft.client.Minecraft.run(Minecraft.java:386) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.10.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_131, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 802307184 bytes (765 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 9.32 Powered by Forge 12.18.3.2281 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.3.2281.jar) UCH Forge{12.18.3.2281} [Minecraft Forge] (forgeSrc-1.10.2-12.18.3.2281.jar) UCE stm{Stable Alpha} [Steamhouse's Mod] (bin) UCH JEI{3.14.6.409} [Just Enough Items] (jei_1.10.2-3.14.6.409.jar) Loaded coremods (and transformers): GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 384.76' Renderer: 'GeForce GTX 770/PCIe/SSE2' And here's my code for all the blocks : package fr.steamhouse.mod.init; import com.ibm.icu.impl.Norm2AllModes.Normalizer2WithImpl; import fr.steamhouse.mod.MainClass; import fr.steamhouse.mod.References; import fr.steamhouse.mod.blocks.BlockSystemShock; import fr.steamhouse.mod.blocks.BlockColor; import fr.steamhouse.mod.blocks.BlockRPGM; import fr.steamhouse.mod.utilities.Utools; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraft.world.NextTickListEntry; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraft.block.Block; public class ModBlocks { public static Block matrix; public static Block fondVert; public static Block Rouge; public static Block Bleu; public static Block Vert; public static Block Noir; public static Block Jaune; public static Block Blanc; public static Block Gris; public static Block Rose; public static Block Marron; public static Block Orange; public static Block Violet; public static Block carrelage; public static Block bridgeblack1176; public static Block bridgeblack1178; public static Block bridgeblack1180; public static Block bridgeblack1181; public static Block bridgeblack1184; public static Block bridgeblack1187; public static Block bridgegray1179; public static Block bridgegray1231; public static Block bridgegray1231_1; public static Block bridgetan1228; public static Block citmatblue2183; public static Block citmatbluegreen2180; public static Block citmatgray2186; public static Block citmatgray2187; public static Block citmatgray2188; public static Block citmatgray2189; public static Block citmatgray2192; public static Block citmatgraynocontain; public static Block citmatorange2184; public static Block citmatorange2185; public static Block citmatorange2190; public static Block citmatorange2194; public static Block citmatred2182; public static Block citmatyellow2181; public static Block sharedtan1118; public static Block brickpath; public static Block brickwall; public static Block brickwall2; public static Block brickwall3; public static Block dalle1; public static Block dalle2; public static Block desertpath; public static Block desertpath2; public static Block frozenwall; public static Block frozenpath; public static Block kitchencal; public static Block rockpath; public static Block rockpath2; public static Block rockwall; public static Block woodpath; public static void init() { matrix = new BlockSystemShock("matrix", "matrix").setLightLevel(0.6F); fondVert = new BlockColor("fondvert", "fondvert"); Rouge = new BlockColor("red", "red"); Bleu = new BlockColor("blue", "blue"); Vert = new BlockColor("green", "green"); Noir = new BlockColor("black", "black"); Jaune = new BlockColor("yellow", "yellow"); Blanc = new BlockColor("white", "white"); Violet = new BlockColor("purple", "purple"); Rose = new BlockColor(("pink"), "pink"); Gris = new BlockColor("gray", "gray"); Orange = new BlockColor("orange", "orange"); Marron = new BlockColor("brown", "brown"); carrelage = new BlockSystemShock("carrelage", "carrelage"); bridgeblack1176 = new BlockSystemShock("bridgeblack1176", "bridgeblack1176"); bridgeblack1178 = new BlockSystemShock("bridgeblack1178", "bridgeblack1178"); bridgeblack1180 = new BlockSystemShock("bridgeblack1180", "bridgeblack1180"); bridgeblack1181 = new BlockSystemShock("bridgeblack1181", "bridgeblack1181"); bridgeblack1184 = new BlockSystemShock("bridgeblack1184", "bridgeblack1184"); bridgeblack1187 = new BlockSystemShock("bridgeblack1187", "bridgeblack1187"); bridgegray1179 = new BlockSystemShock("bridgegray1179", "bridgegray1179"); bridgegray1231 = new BlockSystemShock("bridgegray1231", "bridgegray1231"); bridgegray1231_1 = new BlockSystemShock("bridgegray1231_1", "bridgegray1231_1"); bridgetan1228 = new BlockSystemShock("bridgetan1228", "bridgetan1228"); citmatblue2183 = new BlockSystemShock("citmatblue2183", "citmatblue2183"); citmatbluegreen2180 = new BlockSystemShock("citmatbluegreen2180", "citmatbluegreen2180"); citmatgray2186 = new BlockSystemShock("citmatgray2186", "citmatgray2186"); citmatgray2187 = new BlockSystemShock("citmatgray2187", "citmatgray2187"); citmatgray2188 = new BlockSystemShock("citmatgray2188", "citmatgray2188"); citmatgray2189 = new BlockSystemShock("citmatgray2189", "citmatgray2189"); citmatgray2192 = new BlockSystemShock("citmatgray2192", "citmatgray2192"); citmatgraynocontain = new BlockSystemShock("citmatgraynocontain", "citmatgraynocontain"); citmatorange2184 = new BlockSystemShock("citmatorange2184", "citmatorange2184"); citmatorange2185 = new BlockSystemShock("citmatorange2185", "citmatorange2185"); citmatorange2190 = new BlockSystemShock("citmatorange2190", "citmatorange2190"); citmatorange2194 = new BlockSystemShock("citmatorange2194", "citmatorange2194"); citmatred2182 = new BlockSystemShock("citmatred2182", "citmatred2182"); citmatyellow2181 = new BlockSystemShock("citmatyellow2181", "citmatyellow2181"); sharedtan1118 = new BlockSystemShock("sharedtan1118", "sharedtan1118"); brickpath = new BlockRPGM("brickpath", "brickpath"); brickwall = new BlockRPGM("brickwall", "brickwall"); brickwall2 = new BlockRPGM("brickwall2", "brickwall2"); brickwall3 = new BlockRPGM("brickwall3", "brickwall3"); dalle1 = new BlockRPGM("dalle1", "dalle1"); dalle2 = new BlockRPGM("dalle2", "dalle2"); desertpath = new BlockRPGM("desertpath", "desertpath"); desertpath2 = new BlockRPGM("desertpath2", "desertpath2"); frozenpath = new BlockRPGM("frozenpath", "frozenpath"); frozenwall = new BlockRPGM("frozenwall", "frozenwall"); kitchencal = new BlockRPGM("kitchencal", "kitchencal"); rockpath = new BlockRPGM("rockpath", "rockpath"); rockpath2 = new BlockRPGM("rockpath2", "rockpath2"); woodpath = new BlockRPGM("woodpath", "woodpath"); } public static void register() { registerBlock(matrix); registerBlock(Bleu); registerBlock(Noir); registerBlock(Rouge); registerBlock(Vert); registerBlock(Jaune); registerBlock(Blanc); registerBlock(Gris); registerBlock(Violet); registerBlock(Marron); registerBlock(Rose); registerBlock(Orange); registerBlock(fondVert); registerBlock(carrelage); registerBlock(bridgeblack1176); registerBlock(bridgeblack1178); registerBlock(bridgeblack1180); registerBlock(bridgeblack1181); registerBlock(bridgeblack1184); registerBlock(bridgeblack1187); registerBlock(bridgegray1179); registerBlock(bridgegray1231); registerBlock(bridgegray1231_1); registerBlock(bridgetan1228); registerBlock(citmatblue2183); registerBlock(citmatbluegreen2180); registerBlock(citmatgray2186); registerBlock(citmatgray2187); registerBlock(citmatgray2188); registerBlock(citmatgray2189); registerBlock(citmatgray2192); registerBlock(citmatgraynocontain); registerBlock(citmatorange2184); registerBlock(citmatorange2185); registerBlock(citmatorange2190); registerBlock(citmatorange2194); registerBlock(citmatred2182); registerBlock(citmatyellow2181); registerBlock(sharedtan1118); registerBlock(brickpath); registerBlock(brickwall); registerBlock(brickwall2); registerBlock(brickwall3); registerBlock(dalle1); registerBlock(dalle2); registerBlock(desertpath); registerBlock(desertpath2); registerBlock(frozenpath); registerBlock(frozenwall); registerBlock(kitchencal); registerBlock(rockpath); registerBlock(rockpath2); registerBlock(rockwall); registerBlock(woodpath); } public static void registerRenders() { registerRender(matrix); registerRender(Bleu); registerRender(Noir); registerRender(Rouge); registerRender(Vert); registerRender(Jaune); registerRender(Blanc); registerRender(Gris); registerRender(Violet); registerRender(Marron); registerRender(Rose); registerRender(Orange); registerRender(fondVert); registerRender(carrelage); registerRender(bridgeblack1176); registerRender(bridgeblack1178); registerRender(bridgeblack1180); registerRender(bridgeblack1181); registerRender(bridgeblack1184); registerRender(bridgeblack1187); registerRender(bridgegray1179); registerRender(bridgegray1231); registerRender(bridgegray1231_1); registerRender(bridgetan1228); registerRender(citmatblue2183); registerRender(citmatbluegreen2180); registerRender(citmatgray2186); registerRender(citmatgray2187); registerRender(citmatgray2188); registerRender(citmatgray2189); registerRender(citmatgray2192); registerRender(citmatgraynocontain); registerRender(citmatorange2184); registerRender(citmatorange2185); registerRender(citmatorange2190); registerRender(citmatorange2194); registerRender(citmatred2182); registerRender(citmatyellow2181); registerRender(sharedtan1118); registerRender(brickpath); registerRender(brickwall); registerRender(brickwall2); registerRender(brickwall3); registerRender(dalle1); registerRender(dalle2); registerRender(desertpath); registerRender(desertpath2); registerRender(frozenpath); registerRender(frozenwall); registerRender(kitchencal); registerRender(rockpath); registerRender(rockpath2); registerRender(rockwall); registerRender(woodpath); } public static void registerBlock(Block block) { block.setCreativeTab(MainClass.TabB); GameRegistry.register(block); GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName())); Utools.getLogger().info("Register block for" + block.getUnlocalizedName().substring(5)); } public static void registerRender(Block block) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(new ResourceLocation(References.MODID, block.getUnlocalizedName().substring(5)), "inventory")); Utools.getLogger().info("Register render for" + block.getUnlocalizedName().substring(5));; } } I just make this the exact same way than before, so, why this time, it dosent work ? Did I make something wrong ? Thanks for the help !
  2. Hello. I've created a bunch of simple blocks. But the light dosen't work. I don't know why because everthing seems to be correct. public Blockbridgeblack1180(String unlocalizedName, String registryName) { super(Material.ROCK); this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(References.MODID, registryName)); this.setLightLevel(1.0F); this.setHardness(20); //Sets how hard the block is to break this.setResistance(20); //Sets the blocks blast resistance to explosions } And there is my ModBlock class : public class ModBlocks { public static Block bridgeblack1176; public static Block bridgeblack1178; public static Block bridgeblack1180; public static void init() { bridgeblack1176 = new Blockbridgeblack1176("bridgeblack1176", "bridgeblack1176"); bridgeblack1178 = new Blockbridgeblack1178("bridgeblack1178", "bridgeblack1178"); bridgeblack1180 = new Blockbridgeblack1178("bridgeblack1180", "bridgeblack1180"); } public static void register() { registerBlock(bridgeblack1176); registerBlock(bridgeblack1178); registerBlock(bridgeblack1180); } public static void registerRenders() { registerRender(bridgeblack1176); registerRender(bridgeblack1178); registerRender(bridgeblack1180); } public static void registerBlock(Block block) { block.setCreativeTab(MainClass.TabB); GameRegistry.register(block); GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName())); Utools.getLogger().info("Register block for" + block.getUnlocalizedName().substring(5)); } public static void registerRender(Block block) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(new ResourceLocation(References.MODID, block.getUnlocalizedName().substring(5)), "inventory")); Utools.getLogger().info("Register render for" + block.getUnlocalizedName().substring(5));; } } Where is the problem ? I don't find anything wrong. Thanks for the help
  3. Beacause for the story, I wanted to make a block rotate with a texture, first I have followed this tutorial : But it dosen't work, so for help me I've searched a lot of tutorial, but I've find NOTHING, I have even search on the source code for, by exemple, the Oak Wood Block, but same : Nothing. Many Documentations : Nothing. After one day of searching (a REAL day), I've finally find the code for the Oak Wood Block, But I was 100% salty, so I just copy and past the code like a retard and modify some things to work out. But this happends. So I Guess I just need to extends to Block ?
  4. Hello, I've got a big problem and I can't figured what is the problem. First, the error : java.lang.IllegalArgumentException: Cannot set property PropertyEnum{name=axis, clazz=class fr.steamhouse.mod.blocks.BlockFaiteMoi$EnumAxis, values=[x, y, z, none]} as it does not exist in BlockStateContainer{block=stm:faitemoi, properties=[axis]} at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:216) ~[BlockStateContainer$StateImplementation.class:?] at fr.steamhouse.mod.blocks.BlockFaiteMoi.onBlockPlaced(BlockFaiteMoi.java:42) ~[BlockFaiteMoi.class:?] at net.minecraft.block.Block.getStateForPlacement(Block.java:2309) ~[Block.class:?] at net.minecraft.item.ItemBlock.onItemUse(ItemBlock.java:58) ~[ItemBlock.class:?] at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:160) ~[ItemStack.class:?] at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:486) ~[PlayerControllerMP.class:?] at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1603) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2281) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2058) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1846) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1118) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:406) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] [14:02:04] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: ---- Minecraft Crash Report ---- // Everything's going to plan. No, really, that was supposed to happen. Time: 03/07/17 14:02 Description: Unexpected error java.lang.IllegalArgumentException: Cannot set property PropertyEnum{name=axis, clazz=class fr.steamhouse.mod.blocks.BlockFaiteMoi$EnumAxis, values=[x, y, z, none]} as it does not exist in BlockStateContainer{block=stm:faitemoi, properties=[axis]} at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:216) at fr.steamhouse.mod.blocks.BlockFaiteMoi.onBlockPlaced(BlockFaiteMoi.java:42) at net.minecraft.block.Block.getStateForPlacement(Block.java:2309) at net.minecraft.item.ItemBlock.onItemUse(ItemBlock.java:58) at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:160) at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:486) at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1603) at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2281) at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2058) at net.minecraft.client.Minecraft.runTick(Minecraft.java:1846) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1118) at net.minecraft.client.Minecraft.run(Minecraft.java:406) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) Annnd here the code: package fr.steamhouse.mod.blocks; import java.util.Random; import fr.steamhouse.mod.References; import net.minecraft.block.Block; import net.minecraft.block.BlockHorizontal; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockFaiteMoi extends BlockRotatedPillar{ public static final PropertyEnum<BlockFaiteMoi.EnumAxis> FAITEMOI_AXIS = PropertyEnum.<BlockFaiteMoi.EnumAxis>create("axis", BlockFaiteMoi.EnumAxis.class); public BlockFaiteMoi(String unlocalizedName, String registryName) { super(Material.WOOD); this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(References.MODID, registryName)); this.setHardness(20); //Sets how hard the block is to break this.setResistance(20); //Sets the blocks blast resistance to explosions } /** * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getStateFromMeta(meta).withProperty(FAITEMOI_AXIS, BlockFaiteMoi.EnumAxis.fromFacingAxis(facing.getAxis())); } /** * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed * blockstate. */ public IBlockState withRotation(IBlockState state, Rotation rot) { switch (rot) { case COUNTERCLOCKWISE_90: case CLOCKWISE_90: switch ((BlockFaiteMoi.EnumAxis)state.getValue(FAITEMOI_AXIS)) { case X: return state.withProperty(FAITEMOI_AXIS, BlockFaiteMoi.EnumAxis.Z); case Z: return state.withProperty(FAITEMOI_AXIS, BlockFaiteMoi.EnumAxis.X); default: return state; } default: return state; } } public static enum EnumAxis implements IStringSerializable { X("x"), Y("y"), Z("z"), NONE("none"); private final String name; private EnumAxis(String name) { this.name = name; } public String toString() { return this.name; } public static BlockFaiteMoi.EnumAxis fromFacingAxis(EnumFacing.Axis axis) { switch (axis) { case X: return X; case Y: return Y; case Z: return Z; default: return NONE; } } public String getName() { return this.name; } } } The question is : why the console says "error with BlockContainer" when I don't have used any BlockContainer in this code ? thanks for the help.
  5. Thanks for all of you. Now its works. The problem was the ItemStack.
  6. The tutorial i'm using uses PotionEffect with an Id. I don't want to screw up things so I don't try anything this way Same thing for " this.setRegistryName(new ResourceLocation(References.MODID, unlocalizedName)); " For the signature, yes your are correct.
  7. Are you sure ? Beacause I have this : I'll give a try for the PrintIn. EDIT : It seems its my For who dosen't work. I have tried that : The console dosent show me anything about it.
  8. Hello. A pretty simple question for you maybe, but for me, I just feel PAIN. I've search for hours, and no one technique works... Like the title of the topic, all I want is to add a Potion effect to an armor. public class ItemModArmor extends ItemArmor{ private PotionEffect[] effects; public ItemModArmor(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn, String unlocalizedName) { super(materialIn, renderIndexIn, equipmentSlotIn); this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(References.MODID, unlocalizedName)); } public ItemModArmor(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn, String unlocalizedName, PotionEffect...potionEffects) { super(materialIn, renderIndexIn, equipmentSlotIn); this.setUnlocalizedName(unlocalizedName); this.effects = potionEffects; this.setRegistryName(new ResourceLocation(References.MODID, unlocalizedName)); } protected void onArmorTick(ItemStack stack, World worldIn, EntityPlayer player) { if (stack.getItem() == ModArmor.canardChestplate) { for(PotionEffect effect : effects) { player.addPotionEffect(new PotionEffect(effect)); } } } this is my main class for the armor. Easy to use. First, I wanted to stay in this "easy to use" way. So I was think if the armor works like the food ; You added a potion effect to your constructor, like this : public class ItemModFood extends ItemFood{ private PotionEffect[] effects; public ItemModFood(String unlocalizedName, int amount, boolean isWolfFood, PotionEffect...potionEffects) { super(amount, isWolfFood); this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(References.MODID, unlocalizedName)); this.effects = potionEffects; // TODO Auto-generated constructor stub } public ItemModFood(String unlocalizedName, int amount, float saturation, boolean isWolfFood, PotionEffect...potionEffects) { super(amount, saturation, isWolfFood); this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(References.MODID, unlocalizedName)); this.effects = potionEffects; // TODO Auto-generated constructor stub } protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) { for(PotionEffect effect : effects) { player.addPotionEffect(new PotionEffect(effect)); } } And I define the potion effects in my ModFood class, the one who is initalized. public static void init() { weed = new ItemModFood("weed", 1, 1, false, new PotionEffect(Potion.getPotionById(9), 500, 0), new PotionEffect(Potion.getPotionById(1), 500, 0)); } public static void register() { registerItem(weed); } public static void registerRenders() { registerRender(weed); } public static void registerItem(Item item) { item.setCreativeTab(MainClass.Tab); GameRegistry.register(item); Utools.getLogger().info("Register item for" + item.getUnlocalizedName().substring(5)); } public static void registerRender(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(new ResourceLocation(References.MODID, item.getUnlocalizedName().substring(5)), "inventory")); Utools.getLogger().info("Registered render for " + item.getUnlocalizedName().substring(5)); } } (Sorry for the weed'joke, It was a request from a friend of mine, and I've seen in this item a good way to learn how to add potion effect to food stuff) So, this works. There is a way to make this for an armor ? Because I've tried, but it dosen't work this way, obviously. So I've tried many things from other tutorials/videos, but I dosen't work. After a decade, I've abandonned this "easy to use" method, and try an "harder" method. BUT ! This one dosen't work too ! protected void onArmorTick(ItemStack stack, World worldIn, EntityPlayer player) { if (stack.getItem() == ModArmor.canardChestplate) { for(PotionEffect effect : effects) { player.addPotionEffect(new PotionEffect(effect)); } } } This is in my main class for armor. I'm so lost I'm ready to throw anything up... All I want, is to add a potion effect to an armor. If this is possibile, making the potion effect easy to add like the food method. Thanks for the help. Ps : Sorry if you don't understand all of this, English is not my native langage. Don't hestitate to ask me something.
×
×
  • Create New...

Important Information

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