Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

obock

Members
  • Joined

  • Last visited

  1. sorry I suck in english I don't understand really well
  2. Thank you so much ! Your website is very useful and now it works ! If anyone has the same error it's just: { "variants": { "age=0": { "model": "obockmod:orge_crops_0" }, "age=1": { "model": "obockmod:orge_crops_1" }, "age=2": { "model": "obockmod:orge_crops_2" }, "age=3": { "model": "obockmod:orge_crops_3" }, "age=4": { "model": "obockmod:orge_crops_4" }, } } at the last line "age=4": { "model": "obockmod:orge_crops_4" }, so the good code is: { "variants": { "age=0": { "model": "obockmod:orge_crops_0" }, "age=1": { "model": "obockmod:orge_crops_1" }, "age=2": { "model": "obockmod:orge_crops_2" }, "age=3": { "model": "obockmod:orge_crops_3" }, "age=4": { "model": "obockmod:orge_crops_4" } } } dont put "," at the end ! Thanks again TheGreyGhost
  3. With or without ","? Exactly the same [11:48:01] [Client thread/WARN]: Unable to load definition obockmod:orge_crops#age=2 java.lang.RuntimeException: Encountered an exception when loading model definition of 'obockmod:orge_crops#age=2' from: 'obockmod:blockstates/orge_crops.json' in resourcepack: 'FMLFileResourcePack:Obock Mod' at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:167) ~[ModelBakery.class:?] at net.minecraft.client.resources.model.ModelBakery.loadVariants(ModelBakery.java:118) [ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:119) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:89) [ModelLoader.class:?] at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:767) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:306) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:521) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:356) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_25] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 4 column 10 at com.google.gson.internal.Streams.parse(Streams.java:56) ~[streams.class:?] at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[TreeTypeAdapter.class:?] at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?] at net.minecraft.client.renderer.block.model.ModelBlockDefinition.parseFromReader(ModelBlockDefinition.java:35) ~[ModelBlockDefinition.class:?] at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:162) ~[ModelBakery.class:?] ... 19 more Caused by: com.google.gson.stream.MalformedJsonException: Unterminated object at line 4 column 10 at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505) ~[JsonReader.class:?] at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:480) ~[JsonReader.class:?] at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:403) ~[JsonReader.class:?] at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:666) ~[TypeAdapters$25.class:?] at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:667) ~[TypeAdapters$25.class:?] at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:642) ~[TypeAdapters$25.class:?] at com.google.gson.internal.Streams.parse(Streams.java:44) ~[streams.class:?] at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[TreeTypeAdapter.class:?] at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?] at net.minecraft.client.renderer.block.model.ModelBlockDefinition.parseFromReader(ModelBlockDefinition.java:35) ~[ModelBlockDefinition.class:?] at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:162) ~[ModelBakery.class:?] ... 19 more
  4. I try but it still doesn't work I took the same code used for weath : { "variants": { "age=0": { "model": "wheat_stage0" }, "age=1": { "model": "wheat_stage1" }, "age=2": { "model": "wheat_stage2" }, "age=3": { "model": "wheat_stage3" }, "age=4": { "model": "wheat_stage4" }, "age=5": { "model": "wheat_stage5" }, "age=6": { "model": "wheat_stage6" }, "age=7": { "model": "wheat_stage7" } } }
  5. I already read your blog and i'm honored you answered me but i did'nt found my error. But I found this error in the console. It's the same for every age=. [00:59:27] [Client thread/WARN]: Unable to load definition obockmod:orge_crops#age=1 java.lang.RuntimeException: Encountered an exception when loading model definition of 'obockmod:orge_crops#age=1' from: 'obockmod:blockstates/orge_crops.json' in resourcepack: 'FMLFileResourcePack:Obock Mod' at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:167) ~[ModelBakery.class:?] at net.minecraft.client.resources.model.ModelBakery.loadVariants(ModelBakery.java:118) [ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:119) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:89) [ModelLoader.class:?] at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:767) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:306) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:521) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:356) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_25] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 4 column 10 at com.google.gson.internal.Streams.parse(Streams.java:56) ~[streams.class:?] at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[TreeTypeAdapter.class:?] at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?] at net.minecraft.client.renderer.block.model.ModelBlockDefinition.parseFromReader(ModelBlockDefinition.java:35) ~[ModelBlockDefinition.class:?] at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:162) ~[ModelBakery.class:?] ... 19 more Caused by: com.google.gson.stream.MalformedJsonException: Unterminated object at line 4 column 10 at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505) ~[JsonReader.class:?] at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:480) ~[JsonReader.class:?] at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:403) ~[JsonReader.class:?] at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:666) ~[TypeAdapters$25.class:?] at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:667) ~[TypeAdapters$25.class:?] at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:642) ~[TypeAdapters$25.class:?] at com.google.gson.internal.Streams.parse(Streams.java:44) ~[streams.class:?] at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[TreeTypeAdapter.class:?] at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?] at net.minecraft.client.renderer.block.model.ModelBlockDefinition.parseFromReader(ModelBlockDefinition.java:35) ~[ModelBlockDefinition.class:?] at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:162) ~[ModelBakery.class:?] ... 19 more EDIT: I've got this error too: [04:23:52] [Client thread/ERROR] [FML]: Model definition for location obockmod:orge_crops#inventory not found
  6. Hi everyone ! I am new here and I am not english so sorry for my bad language . I started to update my old mods to the 1.8 and I see it's dificult to render a texture. It works on basic blocks but I don't know why it doesn't work with a crop. Here my codes: ObockBlocks.java package com.obock.obockmod.init; import com.obock.obockmod.ObockMod; import com.obock.obockmod.Reference; import com.obock.obockmod.blocks.BlockOrgeCrops; import com.obock.obockmod.blocks.YellowBricks; import com.obock.obockmod.blocks.YellowBricksStairs; 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.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; public class ObockBlocks { public static Block yellowbricks; public static Block multi_faces; public static Block yellow_bricks_stairs; public static Block orge_crops; public static void init() { yellowbricks = new YellowBricks(Material.rock).setUnlocalizedName("yellowbricks").setCreativeTab(ObockMod.tabObock); multi_faces = new YellowBricks(Material.rock).setUnlocalizedName("multi_faces").setCreativeTab(ObockMod.tabObock); yellow_bricks_stairs = new YellowBricksStairs(yellowbricks).setUnlocalizedName("yellow_bricks_stairs").setCreativeTab(ObockMod.tabObock); orge_crops = new BlockOrgeCrops().setUnlocalizedName("orge_crops"); } public static void register() { GameRegistry.registerBlock(yellowbricks, yellowbricks.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(multi_faces, multi_faces.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(yellow_bricks_stairs, yellow_bricks_stairs.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(orge_crops, orge_crops.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRenders(yellowbricks); registerRenders(multi_faces); registerRenders(yellow_bricks_stairs); registerRenders(orge_crops); } public static void registerRenders(Block block) { Item item = Item.getItemFromBlock(block); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } } BlockOrgeCrops.java : I just copy all BlockCrops package com.obock.obockmod.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.IGrowable; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyInteger; 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.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BlockOrgeCrops extends BlockBush implements IGrowable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 5); private static final String __OBFID = "CL_00000222"; public BlockOrgeCrops() { this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0))); this.setTickRandomly(true); float f = 0.5F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); this.setCreativeTab((CreativeTabs)null); this.setHardness(0.0F); this.setStepSound(soundTypeGrass); this.disableStats(); } /** * is the block grass, dirt or farmland */ protected boolean canPlaceBlockOn(Block ground) { return ground == Blocks.farmland; } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { super.updateTick(worldIn, pos, state, rand); if (worldIn.getLightFromNeighbors(pos.up()) >= 9) { int i = ((Integer)state.getValue(AGE)).intValue(); if (i < 5) { float f = getGrowthChance(this, worldIn, pos); if (rand.nextInt((int)(25.0F / f) + 1) == 0) { worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i + 1)), 2); } } } } public void grow(World worldIn, BlockPos pos, IBlockState state) { int i = ((Integer)state.getValue(AGE)).intValue() + MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); if (i > 5) { i = 5; } worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i)), 2); } protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos) { float f = 1.0F; BlockPos blockpos1 = pos.down(); for (int i = -1; i <= 1; ++i) { for (int j = -1; j <= 1; ++j) { float f1 = 0.0F; IBlockState iblockstate = worldIn.getBlockState(blockpos1.add(i, 0, j)); if (iblockstate.getBlock().canSustainPlant(worldIn, blockpos1.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn)) { f1 = 1.0F; if (iblockstate.getBlock().isFertile(worldIn, blockpos1.add(i, 0, j))) { f1 = 3.0F; } } if (i != 0 || j != 0) { f1 /= 4.0F; } f += f1; } } BlockPos blockpos2 = pos.north(); BlockPos blockpos3 = pos.south(); BlockPos blockpos4 = pos.west(); BlockPos blockpos5 = pos.east(); boolean flag = blockIn == worldIn.getBlockState(blockpos4).getBlock() || blockIn == worldIn.getBlockState(blockpos5).getBlock(); boolean flag1 = blockIn == worldIn.getBlockState(blockpos2).getBlock() || blockIn == worldIn.getBlockState(blockpos3).getBlock(); if (flag && flag1) { f /= 2.0F; } else { boolean flag2 = blockIn == worldIn.getBlockState(blockpos4.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos5.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos5.south()).getBlock() || blockIn == worldIn.getBlockState(blockpos4.south()).getBlock(); if (flag2) { f /= 2.0F; } } return f; } public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) { return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); } protected Item getSeed() { return Items.wheat_seeds; } protected Item getCrop() { return Items.wheat; } /** * Spawns this Block's drops into the World as EntityItems. * * @param chance The chance that each Item is actually spawned (1.0 = always, 0.0 = never) * @param fortune The player's fortune level */ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); } /** * Get the Item that this Block should drop when harvested. * * @param fortune the level of the Fortune enchantment on the player's tool */ public Item getItemDropped(IBlockState state, Random rand, int fortune) { return ((Integer)state.getValue(AGE)).intValue() == 5 ? this.getCrop() : this.getSeed(); } /** * Whether this IGrowable can grow */ public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) { return ((Integer)state.getValue(AGE)).intValue() < 5; } public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) { return true; } @SideOnly(Side.CLIENT) public Item getItem(World worldIn, BlockPos pos) { return this.getSeed(); } public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) { this.grow(worldIn, pos, state); } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta)); } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { return ((Integer)state.getValue(AGE)).intValue(); } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {AGE}); } @Override public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune); int age = ((Integer)state.getValue(AGE)).intValue(); Random rand = world instanceof World ? ((World)world).rand : new Random(); if (age >= 5) { int k = 3 + fortune; for (int i = 0; i < 3 + fortune; ++i) { if (rand.nextInt(15) <= age) { ret.add(new ItemStack(this.getSeed(), 1, 0)); } } } return ret; } } orge_crops.json (in blockstates) { "variants": { "age=0": { "model": "obockmod:orge_crops_0" }, "age=1": { "model": "obockmod:orge_crops_1" }, "age=2": { "model": "obockmod:orge_crops_2" }, "age=3": { "model": "obockmod:orge_crops_3" }, "age=4": { "model": "obockmod:orge_crops_4" }, } } orge_crops_0.json (it's the same for every orge_crops_number, I just change the number every times) { "parent": "block/crop", "textures": { "crop": "obockmod:blocks/orge_crops_0" } } Thank you for reading. Sorry to bother you but I really want to make this crops

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.