-
[UNSOLVED][1.8.9] Stairs not showing correct texture
Dear Gods of moddding , I have a problem with rendering stairs ingame. My code kind-a works, I mean the collision boxes work in my stair block -the problem is that the textures don't. When I load up my game, the stairs appear as and black n' purpel box (so the textures aren't loaded correctly). Also i get this error in the console: [13:51:00] [Client thread/ERROR] [FML]: Exception loading model for variant km:ruokakatto_portaat#facing=east,half=bottom,shape=outer_right for blockstate "km:ruokakatto_portaat[facing=east,half=bottom,shape=outer_right]" java.lang.Exception: Could not load model definition for variant km:ruokakatto_portaat#facing=east,half=bottom,shape=outer_right at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:215) ~[ModelLoader.class:?] at net.minecraft.client.resources.model.ModelBakery.loadVariants(ModelBakery.java:109) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:170) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:115) ~[ModelLoader.class:?] at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:130) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:111) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:772) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:326) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:532) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:360) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:116) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_65] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_65] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_65] 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_65] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_65] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_65] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of model km:blockstates/ruokakatto_portaat.json at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:165) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:211) ~[ModelLoader.class:?] ... 23 more Caused by: java.io.FileNotFoundException: km:blockstates/ruokakatto_portaat.json at net.minecraft.client.resources.FallbackResourceManager.getAllResources(FallbackResourceManager.java:93) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getAllResources(SimpleReloadableResourceManager.java:78) ~[simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:143) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:211) ~[ModelLoader.class:?] ... 23 more [13:51:00] [Client thread/ERROR] [FML]: Exception loading model for variant km:ruokakatto_portaat#facing=north,half=top,shape=outer_left for blockstate "km:ruokakatto_portaat[facing=north,half=top,shape=outer_left]" java.lang.Exception: Could not load model definition for variant km:ruokakatto_portaat#facing=north,half=top,shape=outer_left at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:215) ~[ModelLoader.class:?] at net.minecraft.client.resources.model.ModelBakery.loadVariants(ModelBakery.java:109) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:170) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:115) ~[ModelLoader.class:?] at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:130) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:111) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:772) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:326) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:532) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:360) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:116) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_65] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_65] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_65] 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_65] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_65] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_65] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of model km:blockstates/ruokakatto_portaat.json at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:165) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:211) ~[ModelLoader.class:?] ... 23 more Caused by: java.io.FileNotFoundException: km:blockstates/ruokakatto_portaat.json at net.minecraft.client.resources.FallbackResourceManager.getAllResources(FallbackResourceManager.java:93) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getAllResources(SimpleReloadableResourceManager.java:78) ~[simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:143) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:211) ~[ModelLoader.class:?] ... 23 more So the problem isn't my blockmodel. I think it's something to do with initializing my stair block.. I have spend a lot of time with this and still can't find the reason why it isn't working. Here is the code from the stairblock file: public BlockRuokoPortaat(Material material) { super(Blocks.oak_stairs.getStateFromMeta(0)); this.setHardness(1); this.setStepSound(soundTypePiston); this.useNeighborBrightness = true; } @Override public boolean isFullCube() { return false; } } and here is how I initialize it in my block init class: public class KivikausiBlocks { public static Block ruokokatto_portaat; public static void init() { ruokokatto_portaat = new BlockRuokoPortaat(Material.wood).setUnlocalizedName("ruokakatto_portaat").setCreativeTab(KivikausiMod.KivikausiTabBlocks); } public static void register() { GameRegistry.registerBlock(ruokokatto_portaat, ruokokatto_portaat.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRender(ruokokatto_portaat); } public static void registerRender(Block block) { Item item = Item.getItemFromBlock(block); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } } and here is the blockstate class { "variants": { "facing=east,half=bottom,shape=straight": { "model": "km:ruoko_porras" }, "facing=west,half=bottom,shape=straight": { "model": "km:ruoko_porras", "y": 180, "uvlock": true }, "facing=south,half=bottom,shape=straight": { "model": "km:ruoko_porras", "y": 90, "uvlock": true }, "facing=north,half=bottom,shape=straight": { "model": "km:ruoko_porras", "y": 270, "uvlock": true }, "facing=east,half=bottom,shape=outer_right": { "model": "km:ruoko_porras_ulko" }, "facing=west,half=bottom,shape=outer_right": { "model": "km:ruoko_porras_ulko", "y": 180, "uvlock": true }, "facing=south,half=bottom,shape=outer_right": { "model": "km:ruoko_porras_ulko", "y": 90, "uvlock": true }, "facing=north,half=bottom,shape=outer_right": { "model": "km:ruoko_porras_ulko", "y": 270, "uvlock": true }, "facing=east,half=bottom,shape=outer_left": { "model": "km:ruoko_porras_ulko", "y": 270, "uvlock": true }, "facing=west,half=bottom,shape=outer_left": { "model": "km:ruoko_porras_ulko", "y": 90, "uvlock": true }, "facing=south,half=bottom,shape=outer_left": { "model": "km:ruoko_porras_ulko" }, "facing=north,half=bottom,shape=outer_left": { "model": "km:ruoko_porras_ulko", "y": 180, "uvlock": true }, "facing=east,half=bottom,shape=inner_right": { "model": "km:ruoko_porras_sisa" }, "facing=west,half=bottom,shape=inner_right": { "model": "km:ruoko_porras_sisa", "y": 180, "uvlock": true }, "facing=south,half=bottom,shape=inner_right": { "model": "km:ruoko_porras_sisa", "y": 90, "uvlock": true }, "facing=north,half=bottom,shape=inner_right": { "model": "km:ruoko_porras_sisa", "y": 270, "uvlock": true }, "facing=east,half=bottom,shape=inner_left": { "model": "km:ruoko_porras_sisa", "y": 270, "uvlock": true }, "facing=west,half=bottom,shape=inner_left": { "model": "km:ruoko_porras_sisa", "y": 90, "uvlock": true }, "facing=south,half=bottom,shape=inner_left": { "model": "km:ruoko_porras_sisa" }, "facing=north,half=bottom,shape=inner_left": { "model": "km:ruoko_porras_sisa", "y": 180, "uvlock": true }, "facing=east,half=top,shape=straight": { "model": "km:ruoko_porras", "x": 180, "uvlock": true }, "facing=west,half=top,shape=straight": { "model": "km:ruoko_porras", "x": 180, "y": 180, "uvlock": true }, "facing=south,half=top,shape=straight": { "model": "km:ruoko_porras", "x": 180, "y": 90, "uvlock": true }, "facing=north,half=top,shape=straight": { "model": "km:ruoko_porras", "x": 180, "y": 270, "uvlock": true }, "facing=east,half=top,shape=outer_right": { "model": "km:ruoko_porras_ulko", "x": 180, "uvlock": true }, "facing=west,half=top,shape=outer_right": { "model": "km:ruoko_porras_ulko", "x": 180, "y": 180, "uvlock": true }, "facing=south,half=top,shape=outer_right": { "model": "km:ruoko_porras_ulko", "x": 180, "y": 90, "uvlock": true }, "facing=north,half=top,shape=outer_right": { "model": "km:ruoko_porras_ulko", "x": 180, "y": 270, "uvlock": true }, "facing=east,half=top,shape=outer_left": { "model": "km:ruoko_porras_ulko", "x": 180, "y": 90, "uvlock": true }, "facing=west,half=top,shape=outer_left": { "model": "km:ruoko_porras_ulko", "x": 180, "y": 270, "uvlock": true }, "facing=south,half=top,shape=outer_left": { "model": "km:ruoko_porras_ulko", "x": 180, "y": 180, "uvlock": true }, "facing=north,half=top,shape=outer_left": { "model": "km:ruoko_porras_ulko", "x": 180, "uvlock": true }, "facing=east,half=top,shape=inner_right": { "model": "km:ruoko_porras_sisa", "x": 180, "uvlock": true }, "facing=west,half=top,shape=inner_right": { "model": "km:ruoko_porras_sisa", "x": 180, "y": 180, "uvlock": true }, "facing=south,half=top,shape=inner_right": { "model": "km:ruoko_porras_sisa", "x": 180, "y": 90, "uvlock": true }, "facing=north,half=top,shape=inner_right": { "model": "km:ruoko_porras_sisa", "x": 180, "y": 270, "uvlock": true }, "facing=east,half=top,shape=inner_left": { "model": "km:ruoko_porras_sisa", "x": 180, "y": 90, "uvlock": true }, "facing=west,half=top,shape=inner_left": { "model": "km:ruoko_porras_sisa", "x": 180, "y": 270, "uvlock": true }, "facing=south,half=top,shape=inner_left": { "model": "km:ruoko_porras_sisa", "x": 180, "y": 180, "uvlock": true }, "facing=north,half=top,shape=inner_left": { "model": "km:ruoko_porras_sisa", "x": 180, "uvlock": true } } } If someone could point out what I am doing wrong, I would be realy gratefull!
-
[1.8.9] [SOLVED] Help with Mob model rotation rendering
Thanks mate. How dumb from me to first tell the x value and then override it in set RotationAngels. I just deleted the this.setrotation and add all the rotation values to set RotationAngels
-
[1.8.9] [SOLVED] Help with Mob model rotation rendering
So I am trying to make a deer mob. The AI works, the deer is being initialized correctly and the model looks almost right. I only have a problem with rendering cubes with custom rotation. The problem is some what weird because rotateAngel y and z does work, but I can't get rotate Angel x to work. Boxes like head (which is slightly rotated with x value) appear in-game with no rotation. Can someone please tell me what I am doing wrong here the code: public class ModelHirvi extends ModelBase{ public ModelRenderer body = new ModelRenderer(this, 0, 0); public ModelRenderer kaula; public ModelRenderer hanta; public ModelRenderer head; public ModelRenderer horno; public ModelRenderer hornv; public ModelRenderer lankieo; public ModelRenderer lankiev; public ModelRenderer lankito; public ModelRenderer lankitv; public ModelRenderer leg3eo; public ModelRenderer leg4ev; public ModelRenderer leg1to; public ModelRenderer leg2tv; public ModelHirvi() { textureWidth = 64; textureHeight = 64; this.horno = new ModelRenderer(this, 14, 0); this.horno.addBox(-2F, 1F, 1.5F, 1, 3, 4); this.horno.setRotationPoint(0F, -7F, -9F); this.setRotation(horno, 0.1308997F, -1.151917F, -0.4014257F); this.hornv = new ModelRenderer(this, 14, 0); this.hornv.addBox(1F, 1F, 2F, 1, 3, 4); this.hornv.setRotationPoint(0F, -7F, -9F); this.setRotation(hornv, 0.1308997F, 1.151917F, 0.4014257F); //rotation not rendering correctly: this.head = new ModelRenderer(this, 40, 0); this.head.addBox(-3F, 0F, -6F, 6, 9, 6); this.head.setRotationPoint(0F, -1F, -6F); this.head.setTextureOffset(0, 41).addBox(-2.5F, 9F, -5.5F, 5, 4, 5); this.setRotation(head, 0.2235988F, 0F, 0F); this.leg1to = new ModelRenderer(this, 0, 0); this.leg1to.addBox(-3F, 0F, -2F, 3, 12, 3); this.leg1to.setRotationPoint(-3F, 12F, 11F); this.leg2tv = new ModelRenderer(this, 0, 0); this.leg2tv.addBox(0F, 0F, 0F, 3, 12, 3); this.leg2tv.setRotationPoint(3F, 12F, 9F); this.leg3eo = new ModelRenderer(this, 0, 0); this.leg3eo.addBox(-3F, 0F, -3F, 3, 12, 3); this.leg3eo.setRotationPoint(-3F, 12F, -5F); this.leg4ev = new ModelRenderer(this, 0, 0); this.leg4ev.addBox(-1F, 0F, -3F, 3, 12, 3); this.leg4ev.setRotationPoint(4F, 12F, -5F); this.body = new ModelRenderer(this, 22, 32); this.body.addBox(-5F, -10F, -11F, 10, 21, 11); this.body.setRotationPoint(0F, 3F, 2F); this.lankieo = new ModelRenderer(this, 11, 16); this.lankieo.addBox(-6F, 5F, -10.5F, 1, 6, 4); this.lankieo.setRotationPoint(0F, 3F, 2F); this.setRotation(lankieo, 0F, 0F, 0F); this.lankiev = new ModelRenderer(this, 11, 16); this.lankiev.addBox(5F, 5F, -10.5F, 1, 6, 4); this.lankiev.setRotationPoint(0F, 3F, 2F); this.setRotation(lankiev, 0F, 0F, 0F); this.lankito = new ModelRenderer(this, 0, 16); this.lankito.addBox(-6F, 1F, 6.5F, 1, 10, 4); this.lankito.setRotationPoint(0F, 3F, 2F); this.setRotation(lankito, 0F, 0F, 0F); this.lankitv = new ModelRenderer(this, 0, 16); this.lankitv.addBox(5F, 1F, 6.5F, 1, 10, 4); this.lankitv.setRotationPoint(0F, 3F, 2F); this.setRotation(lankitv, 0F, 0F, 0F); //rotation not rendering correctly: this.kaula = new ModelRenderer(this, 0, 51); this.kaula.addBox(-3F, -8F, 0F, 6, 8, 5); this.kaula.setRotationPoint(0F, 7F, -8F); this.setRotation(kaula, 0.4461433F, 0F, 0F); //rotation not rendering correctly: this.hanta = new ModelRenderer(this, 26, 0); this.hanta.addBox(-1.5F, -3F, 0F, 3, 5, 3); this.hanta.setRotationPoint(0F, 4F, 13F); this.setRotation(hanta, 2.240011F, 0F, 0F); } public void render(Entity entity, float time, float limbSwingDistance, float p_78087_3_, float headYRot, float headXRot, float Ytrans) { this.setRotationAngles(time, limbSwingDistance, p_78087_3_, headYRot, headXRot, Ytrans, entity); if(this.isChild) { float div = 2.0F; GlStateManager.pushMatrix(); GlStateManager.scale(1.0F/div, 1.0F/div, 1.0F/div); GlStateManager.translate(0.0F, 24.0F * Ytrans, 0.0F); this.head.render(Ytrans); this.kaula.render(Ytrans); this.hanta.render(Ytrans); this.horno.render(Ytrans); this.hornv.render(Ytrans); this.body.render(Ytrans); this.leg1to.render(Ytrans); this.leg2tv.render(Ytrans); this.leg3eo.render(Ytrans); this.leg4ev.render(Ytrans); this.lankieo.render(Ytrans); this.lankiev.render(Ytrans); this.lankito.render(Ytrans); this.lankitv.render(Ytrans); GlStateManager.popMatrix(); } else { this.head.render(Ytrans); this.kaula.render(Ytrans); this.hanta.render(Ytrans); this.horno.render(Ytrans); this.hornv.render(Ytrans); this.body.render(Ytrans); this.leg1to.render(Ytrans); this.leg2tv.render(Ytrans); this.leg3eo.render(Ytrans); this.leg4ev.render(Ytrans); this.lankieo.render(Ytrans); this.lankiev.render(Ytrans); this.lankito.render(Ytrans); this.lankitv.render(Ytrans); } } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float time, float limbSwingDistance, float p_78087_3_, float headYRot, float headXRot, float p_78087_6_, Entity entity) { this.head.rotateAngleX = headXRot / (300F / (float)Math.PI); this.head.rotateAngleX = headYRot / (300F / (float)Math.PI); this.horno.rotateAngleX = headXRot / (180F / (float)Math.PI); this.horno.rotateAngleX = headYRot / (180F / (float)Math.PI); this.hornv.rotateAngleX = headXRot / (180F / (float)Math.PI); this.hornv.rotateAngleX = headYRot / (180F / (float)Math.PI); this.body.rotateAngleX = ((float)Math.PI / 2F); this.kaula.rotateAngleX = ((float)Math.PI / 2F); this.hanta.rotateAngleX = ((float)Math.PI / 2F); this.lankieo.rotateAngleX = ((float)Math.PI / 2F); this.lankiev.rotateAngleX = ((float)Math.PI / 2F); this.lankito.rotateAngleX = ((float)Math.PI / 2F); this.lankitv.rotateAngleX = ((float)Math.PI / 2F); this.leg1to.rotateAngleX = MathHelper.cos(time * 0.6662F) * 1.4F * limbSwingDistance; this.leg2tv.rotateAngleX = MathHelper.cos(time * 0.6662F + (float)Math.PI) * 1.4F * limbSwingDistance; this.leg3eo.rotateAngleX = MathHelper.cos(time * 0.6662F + (float)Math.PI) * 1.4F * limbSwingDistance; this.leg4ev.rotateAngleX = MathHelper.cos(time * 0.6662F) * 1.4F * limbSwingDistance; } }
-
[1.8.9] How to stop water breaking a crop?
So I'm trying to create a fishnet. To do so I'm implemeting IPlantable to Block (fishnets will grow like a crop. At the finish stage they will be changed to another block, which block model shows fish inside it and can be right clicked to aquire). Only problem that I have is that water currently destroys my block when it is being placed. So I make so that water that is toching this block, dosen't break it? Do I use doesBlockHaveSolidTopSurface or some other method and how? My code for the net file public BlocksVerkko() { super(Material.plants); float f = 0.375F; this.setTickRandomly(true); // TODO Auto-generated constructor stub } public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 7); protected boolean canPlaceBlockOn(Block ground) { return ground == Blocks.sand || ground == Blocks.gravel; } public boolean isReplaceable(World worldIn, BlockPos pos) { return true; } @Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { int par2 = pos.getX(); int par3 = pos.getY(); int par4 = pos.getZ(); if((worldIn.getBlockState(pos).getBlock() == Blocks.water && worldIn.getBlockState(pos.down()).getBlock() == Blocks.sand && worldIn.getBlockState(pos.up()).getBlock() == Blocks.water)) return true; else if(worldIn.getBlockState(pos.down()).getBlock() == Blocks.sand && worldIn.getBlockState(pos).getBlock() != Blocks.water) return true; else if((worldIn.getBlockState(pos).getBlock() == Blocks.water && worldIn.getBlockState(pos.down()).getBlock() == Blocks.gravel && worldIn.getBlockState(pos.up()).getBlock() == Blocks.water)) return true; else if(worldIn.getBlockState(pos.down()).getBlock() == Blocks.gravel && worldIn.getBlockState(pos).getBlock() != Blocks.water) return true; else return false; } @Override public void onNeighborBlockChange(World par1World, BlockPos pos, IBlockState state, Block par5) { super.onNeighborBlockChange(par1World, pos, state, par5); this.checkFlowerChange(par1World, pos, state); } protected final void checkFlowerChange(World worldIn, BlockPos pos, IBlockState state) { if (!this.canBlockStay(worldIn, pos, state)) { this.dropBlockAsItem(worldIn, pos, state, 0); if(worldIn.getBlockState(pos.down()).getBlock().equals(Blocks.air)) worldIn.setBlockToAir(pos); if(worldIn.getBlockState(pos.up()).getBlock().equals(Blocks.water)) worldIn.setBlockToAir(pos); else worldIn.setBlockToAir(pos); } } /** * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. */ public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) { BlockPos down = pos.down(); Block soil = worldIn.getBlockState(down).getBlock(); if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. return soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this); } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { int j = ((Integer)state.getValue(AGE)).intValue(); if (j == 7) { worldIn.setBlockState(pos, KivikausiBlocks.puska_marja.getDefaultState()); } else { worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(j + 1)), 4); } } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isFullCube() { return false; } public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta)); } public int getMetaFromState(IBlockState state) { return ((Integer)state.getValue(AGE)).intValue(); } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {AGE}); } @Override public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) { // TODO Auto-generated method stub return EnumPlantType.Desert; } @Override public IBlockState getPlant(IBlockAccess world, BlockPos pos) { // TODO Auto-generated method stub return this.getDefaultState(); } @Override public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) { // TODO Auto-generated method stub return false; } @Override public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) { // TODO Auto-generated method stub return false; } @Override public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) { // TODO Auto-generated method stub } }
-
[1.8.9] [SOLVED] Custom crop not rendering a bug??
After heavy code rewriting and using depugger, I manage to get the block to work. Thank you all for help
-
[1.8.9] [SOLVED] Custom crop not rendering a bug??
I tired it, still dosen't render correctly... Here is the code in current status. public class blockPuska extends BlockBush implements IGrowable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 7); public blockPuska(Material plants) { super(plants); float f = 0.375F; this.setTickRandomly(true); // TODO Auto-generated constructor stub } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { int j = ((Integer)state.getValue(AGE)).intValue(); if (j == 7) { worldIn.setBlockState(pos, KivikausiBlocks.puska_marja.getDefaultState()); } else { worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(j + 1)), 4); } } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isFullCube() { return false; } public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta)); } public int getMetaFromState(IBlockState state) { return ((Integer)state.getValue(AGE)).intValue(); } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {AGE}); } @Override public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) { // TODO Auto-generated method stub return false; } @Override public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) { // TODO Auto-generated method stub return false; } @Override public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) { // TODO Auto-generated method stub } And here is init code for blockPuska (there is also many other blocks in my init.java file, so i deleted them from this): public static Block puska; public class KivikausiBlocks { public static void init() { puska = new blockPuska(Material.plants).setUnlocalizedName("puska").setCreativeTab(KivikausiMod.KivikausiTabBlocks); } public static void register() { GameRegistry.registerBlock(puska, puska.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRender(puska); } public static void registerRender(Block block) { Item item = Item.getItemFromBlock(block); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } } Still thank you from trying to help me
-
[1.8.9] [SOLVED] Custom crop not rendering a bug??
I am creating a berry bush and I am having a problem with rendering it. After player has consumed berrys from my berrybush, the berrybush replaces it with this (normal)bush. The idea is that after X ammount time berrys will regrow and the block is changed back to berrybush block. (I know that I don't have to use two different blocks, I could use growstages. I just found this method easier.) Regrowing works. The only issue, as i sad, is that this (normal)bush (which parent class can be seen downbelow), doesn't render at all. If I delete the parent class, the block renders correctly. So the flaw isn't in blockstate, model or int. It has to be somewhere in this code. If you find a solution to my problem, please tell me . And some translate for ya' blockpuska is Finnish and means (normal)bush blockpuska_marja means berrybush public class blockPuska extends Block { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 7); public blockPuska(Material materialIn) { super(materialIn); float f = 0.375F; this.setTickRandomly(true); // TODO Auto-generated constructor stub } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { int j = ((Integer)state.getValue(AGE)).intValue(); if (j == 7) { //worldIn.setBlockState(pos.up(), this.getDefaultState()); worldIn.setBlockState(pos, KivikausiBlocks.puska_marja.getDefaultState()); // worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(0)), 4); } else { worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(j + 1)), 4); } } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isFullCube() { return false; } public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta)); } public int getMetaFromState(IBlockState state) { return ((Integer)state.getValue(AGE)).intValue(); } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {AGE}); } }
IPS spam blocked by CleanTalk.