Jump to content

Eractnod

Members
  • Posts

    56
  • Joined

  • Last visited

Everything posted by Eractnod

  1. Thanks all. Was very helpful. I changed it to this. private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); Everything else stayed the same as before.
  2. In 1.15.2 I used DeferredRegister to register all my blocks and items. In 1.16.1, DeferredRegister is private. Is this an error and if no, then what is the preferred method to register blocks and items in 1.16.1? public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, MODID);
  3. That is what I thought. Thank you for the response.
  4. Just wondering if we are in a holding pattern on recipe registry, or am I missing something? @Deprecated //TODO Make IRecipe a registry public static IRecipe addShapedRecipe(ResourceLocation name, @Nonnull ItemStack output, Object... params) { throw new RuntimeException("TODO: Forge implement IRecipe registry"); //return CraftingManager.addRecipe(output, params); } @Deprecated //TODO Make IRecipe a registry public static void addShapelessRecipe(ResourceLocation name, @Nonnull ItemStack output, Ingredient... params) { throw new RuntimeException("TODO: Forge implement IRecipe registry"); //CraftingManager.getInstance().addShapelessRecipe(output, params); } @Deprecated //TODO Make IRecipe a registry public static void addRecipe(ResourceLocation name, IRecipe recipe) { throw new RuntimeException("TODO: Forge implement IRecipe registry"); //CraftingManager.getInstance().getRecipeList().add(recipe); }
  5. Just tried to build my mod and am getting a No Such version exists error pointing to line 25 of the build.gradle file. This line is the forge version line. Stack trace error FAILURE: Build failed with an exception. * Where: Build file 'C:\Users\User\Documents\Minecraft forge\1.7.10_DamPower\build.gradle' line: 25 * What went wrong: A problem occurred evaluating root project '1.7.10_DamPower'. > No such version exists! * Try: Run with --info or --debug option to get more log output. * Exception is: org.gradle.api.GradleScriptException: A problem occurred evaluating root project '1.7.10_DamPower'. at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54) at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:187) at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39) at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26) at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34) at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55) at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:470) at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:79) at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:128) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:105) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:85) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:81) at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33) at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:39) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:29) at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50) at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) at org.gradle.launcher.Main.doAction(Main.java:33) at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35) at org.gradle.launcher.GradleMain.main(GradleMain.java:23) at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:56) Caused by: net.minecraftforge.gradle.GradleConfigurationException: No such version exists! at net.minecraftforge.gradle.user.patch.UserPatchExtension.checkAndSetVersion(UserPatchExtension.java:170) at net.minecraftforge.gradle.user.patch.UserPatchExtension.setVersion(UserPatchExtension.java:81) at net.minecraftforge.gradle.user.patch.UserPatchExtension_Decorated.setVersion(Unknown Source) at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.setProperty(BeanDynamicObject.java:187) at org.gradle.api.internal.BeanDynamicObject.setProperty(BeanDynamicObject.java:112) at org.gradle.api.internal.CompositeDynamicObject.setProperty(CompositeDynamicObject.java:101) at net.minecraftforge.gradle.user.patch.UserPatchExtension_Decorated.setProperty(Unknown Source) at build_5mpvjavmuqlolqtj20lis32pao$_run_closure1.doCall(C:\Users\User\Documents\Minecraft forge\1.7.10_DamPower\build.gradle:25) at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:59) at org.gradle.api.internal.plugins.ExtensionsStorage$ExtensionHolder.configure(ExtensionsStorage.java:145) at org.gradle.api.internal.plugins.ExtensionsStorage.configureExtension(ExtensionsStorage.java:69) at org.gradle.api.internal.plugins.DefaultConvention$ExtensionsDynamicObject.invokeMethod(DefaultConvention.java:207) at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147) at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79) at build_5mpvjavmuqlolqtj20lis32pao.run(C:\Users\User\Documents\Minecraft forge\1.7.10_DamPower\build.gradle:24) at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52) ... 34 more BUILD FAILED Total time: 5.36 secs build.gradle 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 = "MC1.7.10_DP1.0.8.1448" group= "com.eractnod.dampower" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "dampower" minecraft { version = "1.7.10-10.13.4.1448-1.7.10" runDir = "eclipse" } dependencies { // you may put jars on which you depend on in ./libs // or you may define them like so.. //compile "some.group:artifact:version:classifier" //compile "some.group:artifact:version" // real examples //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env // for more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } So I downloaded the source code again and tried to run gradlew setupDecompWorkspace and getting the same fault on a fresh start. I was able to build this mod yesterday with no issues. Edit: I had to reboot my computer. It built after the reboot.
  6. The reason why the vanilla json works in vanilla is the POWERED property is ignored. Just found this. When I built my doors, there was no ModelLoader yet, so had to add the POWERED property to the json to get it to work. Same went with my gates. this.registerBlockWithStateMapper(Blocks.oak_door, (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] {BlockDoor.POWERED}).build()); this.registerBlockWithStateMapper(Blocks.spruce_door, (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] {BlockDoor.POWERED}).build()); this.registerBlockWithStateMapper(Blocks.birch_door, (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] {BlockDoor.POWERED}).build()); this.registerBlockWithStateMapper(Blocks.jungle_door, (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] {BlockDoor.POWERED}).build()); this.registerBlockWithStateMapper(Blocks.acacia_door, (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] {BlockDoor.POWERED}).build()); this.registerBlockWithStateMapper(Blocks.dark_oak_door, (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] {BlockDoor.POWERED}).build()); this.registerBlockWithStateMapper(Blocks.iron_door, (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] {BlockDoor.POWERED}).build());
  7. Show your door blockstates.json file. If you just copied the vanilla one, then you will need to add the powered states to the file like your errors were showing. Or remove the powered property from your door block like CoolAlias said. Vanilla "facing=east,half=lower,hinge=left,open=false": { "model": "wooden_door_bottom" }, My custom door "facing=east,half=lower,hinge=left,open=false,powered=true": { "model": "telvarianexpanse:door_purpleheart_bottom" },
  8. I think your woodPlank should be plankWood. This is what I have for ore dictionary recipe in my 1.8 mod. for(ItemStack s : OreDictionary.getOres("plankWood")) { GameRegistry.addRecipe(new ItemStack(TEBlocks.woodenDrawBridge), new Object[]{"SSS", "III","SSS", 'S', (s), 'I', Blocks.iron_block}); }
  9. Unless you changed some filenames in your assets from the screen shots in the above posts, it should have worked. This is what I have with my modeled lamps which are two blocks tall. Blockstates Filename TEFloorLamp.json { "variants": { "normal": { "model": "telvarianexpanse:lamp_floor" } } } Models.Blocks Filename lamp_floor.json with the texture name of floorLamp.png { "parent": "block/cube_all", "textures": { "all": "telvarianexpanse:blocks/floorLamp" } } Models.items Filename TEFloorLamp.json { "parent": "builtin/generated", "textures": { "layer0": "telvarianexpanse:items/floorLamp" }, "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 ] } } }
  10. The Blockstates json needs to point to the blocks json file. Try { "variants": { "normal": { "model": "fruitsmodpro:Tisch" } } }
  11. Show your Blockstates Tisch.json and your models.blocks Tisch.json please
  12. It is in the equation. You can harvest wood with your hand, but can not harvest cobblestone with your hand. You can break both with your hand. Since you can harvest wood with your hand the divisor is 30. You can't harvest cobblestone, so the divisor is 100. That is the difference.
  13. Not sure if this will help, but to fix shadowing on my stairs I had to useNeighborBrightness = true;
  14. Instead of "particle": "#side", try "particle": "#0". If this doesn't work then I would try "particle":"sureencore:blocks/zombie_spawner_north",. I think the second one would work better.
  15. In your Model Block json, since you are not using a parent json, try adding a particle texture to the bottom of your texture section "textures": { "0": "sureencore:blocks/zombie_spawner_north", "particle": "#side" },
  16. BlockState json file needs a ',' at the end of each line. Last line should have no punctuation. { "variants": { "age=0": { "model": "sureencore:zombie_spawner_block" }, "age=1": { "model": "sureencore:zombie_spawner_block" }, .... "age=15": { "model": "sureencore:zombie_spawner_block" } } }
  17. Check the logs when Minecraft starts. Is should tell you what is missing with regards to textures. But it looks like your BlockState.json is missing your MODID.
  18. Anyone know of a mini-map out for 1.8.0 forge yet? I have tried Voxel map, but Liteloader just does not want to load any mods. Have spent the last two days trying to get that thing to work.
  19. With the FML 1.8 release, you can start to update your mod. I have been able to get mine updated except for armor and the dimension which require forge. This way you can be that much further along when forge is released. You can start to see all the changes that are required in block rendering. I am running a 1.8 world now with two of my mods in it now. Just rem'ed out the things that needed forge.
  20. Thank you for the reply. Will add that Github link to my favorites.
  21. If you are talking about this in the EAQ, it does not work for FML 1.8.0 1014. It is looking for some cpw files that are no longer in FML. •java.lang.ConcurrentModificationException before Minecraft loads: Update to build 1217 or above, or install this mod: http://t.co/9olGYnwZBi (it's by Lex, you can trust it)
  22. This crash happens a lot when trying to enter into a world. Some times it happens when creating a world as well. Not sure if it caused by FML, or I need to add some argument to the launcher to stop this from happening. Any help would be appreciated. Also happened in 1012. Now that I am done with the mod and have moved to launcher environment from Development, would like to see if it can be corrected. Just tried with just FML loaded, no mod and it gives same crash, this time while creating the world. Crash report as well Latest crash FML only while creating world
  23. As always, the issue turned out to be me. I was using my single slab Itemblock which defaults to the default blockstate. Made changes to the Itemblock class, and now doubles are placing correctly. Code listed below. ItemBlock package com.eractnod.telvarianexpanse.itemblocks; import com.eractnod.telvarianexpanse.blocks.BlockTEStoneSlab; import com.eractnod.telvarianexpanse.blocks.BlockTEStoneSlabDouble; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemSlab; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ItemBlockModTEStoneSlab extends ItemBlock{ private final BlockSlab single; private final BlockSlab twoOf; public ItemBlockModTEStoneSlab(Block block, BlockTEStoneSlab single, BlockTEStoneSlabDouble twoOf) { super(block); this.single = single; this.twoOf = twoOf; this.setMaxDamage(0); this.setHasSubtypes(true); } /** * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is * placed as a Block (mostly used with ItemBlocks). */ public int getMetadata(int damage) { return damage; } /** * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have * different names based on their damage or NBT. */ public String getUnlocalizedName(ItemStack stack) { return this.single.getFullSlabName(stack.getMetadata()); } /** * Called when a Block is right-clicked with this Item * * @param pos The block being right-clicked * @param side The side being right-clicked */ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { if (stack.stackSize == 0) { return false; } else if (!playerIn.func_175151_a(pos.offset(side), side, stack)) { return false; } else { Object object = this.single.func_176553_a(stack); IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == this.single) { IProperty iproperty = this.single.func_176551_l(); Comparable comparable = iblockstate.getValue(iproperty); BlockSlab.EnumBlockHalf enumblockhalf = (BlockSlab.EnumBlockHalf)iblockstate.getValue(BlockSlab.HALF_PROP); if ((side == EnumFacing.UP && enumblockhalf == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && enumblockhalf == BlockSlab.EnumBlockHalf.TOP) && comparable == object) { IBlockState iblockstate1 = this.twoOf.getDefaultState().withProperty(iproperty, comparable); if (worldIn.checkNoEntityCollision(this.twoOf.getCollisionBoundingBox(worldIn, pos, iblockstate1)) && worldIn.setBlockState(pos, iblockstate1, 3)) { worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.twoOf.stepSound.getPlaceSound(), (this.twoOf.stepSound.getVolume() + 1.0F) / 2.0F, this.twoOf.stepSound.getFrequency() * 0.8F); --stack.stackSize; } return true; } } return this.placeDouble(stack, worldIn, pos.offset(side), object) ? true : super.onItemUse(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ); } } @SideOnly(Side.CLIENT) public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing facing, EntityPlayer player, ItemStack stack) { BlockPos blockpos1 = pos; IProperty iproperty = this.single.func_176551_l(); Object object = this.single.func_176553_a(stack); IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == this.single) { boolean flag = iblockstate.getValue(BlockSlab.HALF_PROP) == BlockSlab.EnumBlockHalf.TOP; if ((facing == EnumFacing.UP && !flag || facing == EnumFacing.DOWN && flag) && object == iblockstate.getValue(iproperty)) { return true; } } pos = pos.offset(facing); IBlockState iblockstate1 = worldIn.getBlockState(pos); return iblockstate1.getBlock() == this.single && object == iblockstate1.getValue(iproperty) ? true : super.canPlaceBlockOnSide(worldIn, blockpos1, facing, player, stack); } private boolean placeDouble(ItemStack stack, World worldIn, BlockPos pos, Object obj) { IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == this.single) { Comparable comparable = iblockstate.getValue(this.single.func_176551_l()); if (comparable == obj) { IBlockState iblockstate1 = this.twoOf.getDefaultState().withProperty(this.single.func_176551_l(), comparable); if (worldIn.checkNoEntityCollision(this.twoOf.getCollisionBoundingBox(worldIn, pos, iblockstate1)) && worldIn.setBlockState(pos, iblockstate1, 3)) { worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.twoOf.stepSound.getPlaceSound(), (this.twoOf.stepSound.getVolume() + 1.0F) / 2.0F, this.twoOf.stepSound.getFrequency() * 0.8F); --stack.stackSize; } return true; } } return false; } }
  24. It has taken a few days to finally get my meta data version of slabs to work in 1.8.0. However, when I place the slabs as a half block all is fine, but when I place as a double slab, they all revert to the setDefautState enumtype. In my case TELVARITE_COBBLE. When you break the block, you get two telvarite cobble half slabs, so it is not a texture issue. If I change the default enumtype to AMATITE_COBBLE, then all double slabs are of that type. I am not sure if it is a registration problem as the block used to find the iblockstate is always null. Any help would be greatly appreciated. Declaration and registration //Slabs public static BlockTEStoneSlab te_stone_slab; public static BlockTEStoneSlab te_stone_slab_double; te_stone_slab = new BlockTEStoneSlab(Material.rock, "slabStoneS", 2.0f, 15.0f); te_stone_slab_double = new BlockTEStoneSlabDouble(Material.rock, "slabStoneD", 2.0f, 15.0f); registerSlab("te_stone_slab", "te_stone_slab_double", te_stone_slab, te_stone_slab_double); public static void registerSlab(String name, String name2, Block one, Block two){ GameRegistry.registerBlock(two, ItemBlockModTEStoneSlab.class, name2, new Object[]{one, two}); GameRegistry.registerBlock(one, ItemBlockModTEStoneSlab.class, name, new Object[]{one, two}); blockList.add(name); } Itemblock class package com.eractnod.telvarianexpanse.itemblocks; import com.eractnod.telvarianexpanse.blocks.BlockTEStoneSlab; import com.eractnod.telvarianexpanse.blocks.BlockTEStoneSlabDouble; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemSlab; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ItemBlockModTEStoneSlab extends ItemBlock{ private final BlockSlab single; private final BlockSlab twoOf; public ItemBlockModTEStoneSlab(Block block, BlockTEStoneSlab single, BlockTEStoneSlabDouble twoOf) { super(block); this.single = single; this.twoOf = twoOf; this.setMaxDamage(0); this.setHasSubtypes(true); } /** * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is * placed as a Block (mostly used with ItemBlocks). */ public int getMetadata(int damage) { return damage; } /** * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have * different names based on their damage or NBT. */ public String getUnlocalizedName(ItemStack stack) { return this.single.getFullSlabName(stack.getMetadata()); } /** * Called when a Block is right-clicked with this Item * * @param pos The block being right-clicked * @param side The side being right-clicked */ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { if (stack.stackSize == 0) { return false; } else if (!playerIn.func_175151_a(pos.offset(side), side, stack)) { return false; } else { Object object = this.single.func_176553_a(stack); IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == this.single) { BlockSlab.EnumBlockHalf enumblockhalf = (BlockSlab.EnumBlockHalf)iblockstate.getValue(BlockSlab.HALF_PROP); if ((side == EnumFacing.UP && enumblockhalf == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && enumblockhalf == BlockSlab.EnumBlockHalf.TOP)) { IBlockState iblockstate1 = this.twoOf.getDefaultState(); if (worldIn.checkNoEntityCollision(this.twoOf.getCollisionBoundingBox(worldIn, pos, iblockstate1)) && worldIn.setBlockState(pos, iblockstate1, 3)) { worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.twoOf.stepSound.getPlaceSound(), (this.twoOf.stepSound.getVolume() + 1.0F) / 2.0F, this.twoOf.stepSound.getFrequency() * 0.8F); --stack.stackSize; } return true; } } return this.placeDouble(stack, worldIn, pos.offset(side), object) ? true : super.onItemUse(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ); } } @SideOnly(Side.CLIENT) public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing facing, EntityPlayer player, ItemStack stack) { BlockPos blockpos1 = pos; Object object = this.single.func_176553_a(stack); IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == this.single) { boolean flag = iblockstate.getValue(BlockSlab.HALF_PROP) == BlockSlab.EnumBlockHalf.TOP; if ((facing == EnumFacing.UP && !flag || facing == EnumFacing.DOWN && flag)) { return true; } } pos = pos.offset(facing); IBlockState iblockstate1 = worldIn.getBlockState(pos); return iblockstate1.getBlock() == this.single ? true : super.canPlaceBlockOnSide(worldIn, blockpos1, facing, player, stack); } private boolean placeDouble(ItemStack stack, World worldIn, BlockPos pos, Object obj) { IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == this.single) { IBlockState iblockstate1 = this.twoOf.getDefaultState(); if (worldIn.checkNoEntityCollision(this.twoOf.getCollisionBoundingBox(worldIn, pos, iblockstate1)) && worldIn.setBlockState(pos, iblockstate1, 3)) { worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.twoOf.stepSound.getPlaceSound(), (this.twoOf.stepSound.getVolume() + 1.0F) / 2.0F, this.twoOf.stepSound.getFrequency() * 0.8F); --stack.stackSize; } return true; } return false; } } Slab block class package com.eractnod.telvarianexpanse.blocks; import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.BlockStoneSlab; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.IStringSerializable; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BlockTEStoneSlab extends BlockSlab { public static final PropertyBool seamlessBool = PropertyBool.create("seamless"); public static final PropertyEnum typeVar = PropertyEnum.create("variant", BlockTEStoneSlab.EnumType.class); public BlockTEStoneSlab(Material mat, String name, float hardness, float resistance) { super(Material.rock); IBlockState iblockstate = this.blockState.getBaseState(); if (this.isDouble()) { iblockstate = iblockstate.withProperty(seamlessBool, Boolean.valueOf(false)); } else { iblockstate = iblockstate.withProperty(HALF_PROP, BlockSlab.EnumBlockHalf.BOTTOM); } this.setDefaultState(iblockstate.withProperty(typeVar, BlockTEStoneSlab.EnumType.TELVARITE_COBBLE)); this.setCreativeTab(CreativeTabs.tabBlock); this.setHardness(hardness); this.setResistance(resistance); } public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(TEBlocks.te_stone_slab); } @SideOnly(Side.CLIENT) public Item getItem(World worldIn, BlockPos pos) { return Item.getItemFromBlock(TEBlocks.te_stone_slab); } public String getFullSlabName(int meta) { return super.getUnlocalizedName() + "." + BlockTEStoneSlab.EnumType.func_176625_a(meta).func_176627_c(); } public IProperty func_176551_l() { return typeVar; } public Object func_176553_a(ItemStack stack) { return BlockTEStoneSlab.EnumType.func_176625_a(stack.getMetadata() & 7); } @SideOnly(Side.CLIENT) public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { if (itemIn != Item.getItemFromBlock(TEBlocks.te_stone_slab_double)) { BlockTEStoneSlab.EnumType[] aenumtype = BlockTEStoneSlab.EnumType.values(); int i = aenumtype.length; for (int j = 0; j < i; ++j) { BlockTEStoneSlab.EnumType enumtype = aenumtype[j]; list.add(new ItemStack(itemIn, 1, enumtype.func_176624_a())); } } } public IBlockState getStateFromMeta(int meta) { IBlockState iblockstate = this.getDefaultState().withProperty(typeVar, BlockTEStoneSlab.EnumType.func_176625_a(meta & 7)); if (this.isDouble()) { iblockstate = iblockstate.withProperty(seamlessBool, Boolean.valueOf((meta & != 0)); } else { iblockstate = iblockstate.withProperty(HALF_PROP, (meta & == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); } return iblockstate; } public int getMetaFromState(IBlockState state) { byte b0 = 0; int i = b0 | ((BlockTEStoneSlab.EnumType)state.getValue(typeVar)).func_176624_a(); if (this.isDouble()) { if (((Boolean)state.getValue(seamlessBool)).booleanValue()) { i |= 8; } } else if (state.getValue(HALF_PROP) == BlockSlab.EnumBlockHalf.TOP) { i |= 8; } return i; } protected BlockState createBlockState() { return this.isDouble() ? new BlockState(this, new IProperty[] {seamlessBool, typeVar}): new BlockState(this, new IProperty[] {HALF_PROP, typeVar}); } public int damageDropped(IBlockState state) { return ((BlockTEStoneSlab.EnumType)state.getValue(typeVar)).func_176624_a(); } public static enum EnumType implements IStringSerializable { TELVARITE_COBBLE(0, "te_stone_slab", "telvarite_cobble"), AMATITE_COBBLE(1, "amatite_te_stone_slab", "amatite_cobble"), VARIANITE_COBBLE(2, "varianite_te_stone_slab", "varianite_cobble"), ORAMIRITE_COBBLE(3, "oramirite_te_stone_slab", "oramirite_cobble"), TELVARITE_BRICK(4, "telvarite_brick_te_stone_slab", "telvarite_brick"), AMATITE_BRICK(5, "amatite_brick_te_stone_slab", "amatite_brick"), VARIANITE_BRICK(6, "varianite_brick_te_stone_slab", "varianite_brick"), ORAMIRITE_BRICK(7, "oramirite_brick_te_stone_slab", "oramirite_brick"); private static final BlockTEStoneSlab.EnumType[] field_176640_i = new BlockTEStoneSlab.EnumType[values().length]; private final int meta; private final String variantName; private final String name; private EnumType(int meta, String name) { this(meta, name, name); } private EnumType(int meta, String variantName, String name) { this.meta = meta; this.variantName = variantName; this.name = name; } public int func_176624_a() { return this.meta; } public String toString() { return this.variantName; } public static BlockTEStoneSlab.EnumType func_176625_a(int meta) { if (meta < 0 || meta >= field_176640_i.length) { meta = 0; } return field_176640_i[meta]; } public String getName() { return this.variantName; } public String func_176627_c() { return this.name; } static { BlockTEStoneSlab.EnumType[] var0 = values(); int var1 = var0.length; for (int var2 = 0; var2 < var1; ++var2) { BlockTEStoneSlab.EnumType var3 = var0[var2]; field_176640_i[var3.func_176624_a()] = var3; } } } @Override public boolean isDouble() { return false; } } Double slab block class package com.eractnod.telvarianexpanse.blocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BlockTEStoneSlabDouble extends BlockTEStoneSlab{ public BlockTEStoneSlabDouble(Material mat, String name, float hardness, float resistance) { super(mat, name, hardness, resistance); setCreativeTab(null); } @Override public boolean isDouble(){ return true; } } Client Proxy package com.eractnod.telvarianexpanse.client; import com.eractnod.telvarianexpanse.TelvarianExpanse; import com.eractnod.telvarianexpanse.blocks.TEBlocks; import com.eractnod.telvarianexpanse.items.TEItems; import com.eractnod.telvarianexpanse.lamps.TileEntityChandelier; import com.eractnod.telvarianexpanse.lamps.TileEntityChandelierRenderer; import com.eractnod.telvarianexpanse.lamps.TileEntityFloorLamp; import com.eractnod.telvarianexpanse.lamps.TileEntityFloorLampRenderer; import com.eractnod.telvarianexpanse.lamps.TileEntityStreetLamp; import com.eractnod.telvarianexpanse.lamps.TileEntityStreetLampRenderer; import com.eractnod.telvarianexpanse.machines.TEMachines; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ClientProxy { public static void init(){ for(String name : TEItems.itemList){ System.out.println("real item&&&&&&&&&&&&&&&&&&& " + name); registerItem(GameRegistry.findItem(TelvarianExpanse.MODID, name), TelvarianExpanse.MODID + ":" + name); } for(String name : TEBlocks.blockList){ Item i = GameRegistry.findItem(TelvarianExpanse.MODID, name); System.out.println("Item********************* " + name); registerItem(i, TelvarianExpanse.MODID + ":" + name); } for(String name : TEMachines.machineList){ Item i = GameRegistry.findItem(TelvarianExpanse.MODID, name); System.out.println("Item********************* " + name); registerItem(i, TelvarianExpanse.MODID + ":" + name); } Item te_stone_slab = GameRegistry.findItem(TelvarianExpanse.MODID, "te_stone_slab"); registerItem(te_stone_slab, 0, TelvarianExpanse.MODID + ":te_stone_slab"); registerItem(te_stone_slab, 1, TelvarianExpanse.MODID + ":amatite_te_stone_slab"); registerItem(te_stone_slab, 2, TelvarianExpanse.MODID + ":varianite_te_stone_slab"); registerItem(te_stone_slab, 3, TelvarianExpanse.MODID + ":oramirite_te_stone_slab"); registerItem(te_stone_slab, 4, TelvarianExpanse.MODID + ":telvarite_brick_te_stone_slab"); registerItem(te_stone_slab, 5, TelvarianExpanse.MODID + ":amatite_brick_te_stone_slab"); registerItem(te_stone_slab, 6, TelvarianExpanse.MODID + ":varianite_brick_te_stone_slab"); registerItem(te_stone_slab, 7, TelvarianExpanse.MODID + ":oramirite_brick_te_stone_slab"); Item te_stone_slab_double = GameRegistry.findItem(TelvarianExpanse.MODID, "te_stone_slab_double"); registerItem(te_stone_slab_double, 0, TelvarianExpanse.MODID + ":te_stone_slab_double"); registerItem(te_stone_slab_double, 1, TelvarianExpanse.MODID + ":amatite_te_stone_slab_double"); registerItem(te_stone_slab_double, 2, TelvarianExpanse.MODID + ":varianite_te_stone_slab_double"); registerItem(te_stone_slab_double, 3, TelvarianExpanse.MODID + ":oramirite_te_stone_slab_double"); registerItem(te_stone_slab_double, 4, TelvarianExpanse.MODID + ":telvarite_brick_te_stone_slab_double"); registerItem(te_stone_slab_double, 5, TelvarianExpanse.MODID + ":amatite_brick_te_stone_slab_double"); registerItem(te_stone_slab_double, 6, TelvarianExpanse.MODID + ":varianite_brick_te_stone_slab_double"); registerItem(te_stone_slab_double, 7, TelvarianExpanse.MODID + ":oramirite_brick_te_stone_slab_double"); } public static void preInit(){ ModelBakery.addVariantName(Item.getItemFromBlock(TEBlocks.te_stone_slab), new String[]{TelvarianExpanse.MODID + ":te_stone_slab", TelvarianExpanse.MODID + ":amatite_te_stone_slab", TelvarianExpanse.MODID + ":varianite_te_stone_slab", TelvarianExpanse.MODID + ":oramirite_te_stone_slab", TelvarianExpanse.MODID + ":telvarite_brick_te_stone_slab", TelvarianExpanse.MODID + ":amatite_brick_te_stone_slab", TelvarianExpanse.MODID + ":varianite_brick_te_stone_slab", TelvarianExpanse.MODID + ":oramirite_brick_te_stone_slab"}); } public static void registerItem(Item item, int metadata, String itemName) { ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); mesher.register(item, metadata, new ModelResourceLocation(itemName, "inventory")); } public static void registerBlock(Block block, int metadata, String blockName) { registerItem(Item.getItemFromBlock(block), metadata, blockName); } public static void registerBlock(Block block, String blockName) { registerBlock(block, 0, blockName); } public static void registerItem(Item item, String itemName) { registerItem(item, 0, itemName); } }
  25. Thank you for posting this Eternaldoom. I have been trying to figure this out for the last two days. I was looking at your code trying to figure out what I was doing wrong because I thought you had it working. I will keep plugging away at it as well.
×
×
  • Create New...

Important Information

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