Bonjour à vous !
Je revient vers vous pour encore un autre problème que j’arrive pas à résoudre même en cherchant de partout, je n’arrive pas à trouver la solution pour mon problème.
Le problème est que lorsque je plante ma plantation, mon jeu crash immédiatement. Je suis que ça vient des textures mais je n’arrive pas à le régler.
Voici les codes de ma plantation :
BlockCropsMod :
import static net.minecraftforge.common.EnumPlantType.Crop;
import static net.minecraftforge.common.EnumPlantType.Desert;
import static net.minecraftforge.common.EnumPlantType.Nether;
import static net.minecraftforge.common.EnumPlantType.Plains;
import static net.minecraftforge.common.EnumPlantType.Water;
import java.util.ArrayList;
import java.util.Map;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import fr.irisium.irisiummod.IrisiumMod;
import fr.irisium.irisiummod.init.BlocksMod;
import fr.irisium.irisiummod.init.ItemsMod;
import fr.irisium.irisiummod.util.ConfigHandler;
import fr.irisium.irisiummod.util.ConfigMain;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.IGrowable;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockCropsMod extends BlockBush implements IGrowable
{
@SideOnly(Side.CLIENT)
private IIcon[] iconArray;
private static final String __OBFID = "CL_00000222";
protected int maxGrowthStage = 7;
public BlockCropsMod()
{
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.setHardness(0.0F);
this.setStepSound(soundTypeGrass);
this.disableStats();
}
protected boolean canPlaceBlockOn(Block block)
{
return block == BlocksMod.fertilizedDirt || block == Blocks.farmland;
}
public boolean canBlockStay(World world, int x, int y, int z)
{
return world.getBlock(x, y - 1, z).canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this);
}
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {
super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9) {
int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
if (l < 7) {
float f = this.func_149864_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
if (p_149674_5_.nextInt((int)(25.0F / f) + 1) == 0) {
++l;
p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l, 2);
}
}
}
}
private float func_149864_n(World p_149864_1_, int p_149864_2_, int p_149864_3_, int p_149864_4_) {
float f = 0.1F;
Block block = p_149864_1_.getBlock(p_149864_2_, p_149864_3_, p_149864_4_ - 1);
Block block1 = p_149864_1_.getBlock(p_149864_2_, p_149864_3_, p_149864_4_ + 1);
Block block2 = p_149864_1_.getBlock(p_149864_2_ - 1, p_149864_3_, p_149864_4_);
Block block3 = p_149864_1_.getBlock(p_149864_2_ + 1, p_149864_3_, p_149864_4_);
Block block4 = p_149864_1_.getBlock(p_149864_2_ - 1, p_149864_3_, p_149864_4_ - 1);
Block block5 = p_149864_1_.getBlock(p_149864_2_ + 1, p_149864_3_, p_149864_4_ - 1);
Block block6 = p_149864_1_.getBlock(p_149864_2_ + 1, p_149864_3_, p_149864_4_ + 1);
Block block7 = p_149864_1_.getBlock(p_149864_2_ - 1, p_149864_3_, p_149864_4_ + 1);
boolean flag = block2 == this || block3 == this;
boolean flag1 = block == this || block1 == this;
boolean flag2 = block4 == this || block5 == this || block6 == this || block7 == this;
for(int l = p_149864_2_ - 1; l <= p_149864_2_ + 1; ++l) {
for(int i1 = p_149864_4_ - 1; i1 <= p_149864_4_ + 1; ++i1) {
float f1 = 0.0F;
if (p_149864_1_.getBlock(l, p_149864_3_ - 1, i1).canSustainPlant(p_149864_1_, l, p_149864_3_ - 1, i1, ForgeDirection.UP, this)) {
f1 = 1.0F;
if (p_149864_1_.getBlock(l, p_149864_3_ - 1, i1).isFertile(p_149864_1_, l, p_149864_3_ - 1, i1)) {
f1 = 3.0F;
}
}
if (l != p_149864_2_ || i1 != p_149864_4_) {
f1 /= 4.0F;
}
f += f1;
}
}
if (flag2 || flag && flag1) {
f /= 2.0F;
}
return f;
}
public int getRenderType()
{
return 1;
}
protected Item func_149866_i()
{
return Items.apple;
}
protected Item func_149865_P()
{
return Items.wheat;
}
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return p_149650_1_ == 7 ? this.func_149865_P() : this.func_149866_i();
}
public int quantityDropped(Random p_149745_1_)
{
return 0;
}
@SideOnly(Side.CLIENT)
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_)
{
return this.func_149866_i();
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int p_149691_1_, int meta)
{
if (meta < 0 || meta > 7)
{
meta = 7;
}
return this.iconArray[meta];
}
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
{
ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune);
if (metadata >= 7 && !ConfigMain.PLANT_ON_BREAK)
{
for (int i = 0; i < 1 + fortune; i++) {
if (world.rand.nextInt(7) <= metadata)
{
ret.add(new ItemStack(func_149866_i(), 1, 0));
}
}
}
if (metadata >= 7 && ConfigMain.SECOND_SEED_CHANCE > 0)
{
for (int i = 0; i < 1 + fortune; i++) {
if (world.rand.nextInt(100) <= Math.max(1, ConfigMain.SECOND_SEED_CHANCE))
{
ret.add(new ItemStack(func_149866_i(), 1, 0));
}
}
}
return ret;
}
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
super.randomDisplayTick(par1World, par2, par3, par4, par5Random);
int meta = par1World.getBlockMetadata(par2, par3, par4);
if (ConfigHandler.cropEffects)
{
if (par5Random.nextInt(5) == 0 && meta >= 7)
{
par1World.spawnParticle("instantSpell", (double)((float)par2 + par5Random.nextFloat()), (double)((float)par3 + 0.6F), (double)((float)par4 + par5Random.nextFloat()), 0.0D, 0.0D, 0.0D);
} else if (par5Random.nextInt(5) == 0 && meta <= 6)
{
par1World.spawnParticle("enchantmenttable", (double)((float)par2 + par5Random.nextFloat()), (double)((float)par3 + 0.9F), (double)((float)par4 + par5Random.nextFloat()), 0.0D, 0.0D, 0.0D);
}
}
}
public void fertilize(World world, int x, int y, int z)
{
int l = world.getBlockMetadata(x, y, z) + MathHelper.getRandomIntegerInRange(world.rand, 2, 5);
if (l > 7)
{
l = 7;
}
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
}
@Override
public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
{
if (this == BlocksMod.silveriteCrop) return Crop;
if (this == BlocksMod.eboneriteCrop) return Crop;
if (this == BlocksMod.irisiteCrop) return Crop;
if (this == BlocksMod.galaxineCrop) return Crop;
return Crop;
}
@Override
public Block getPlant(IBlockAccess world, int x, int y, int z)
{
return this;
}
@Override
public int getPlantMetadata(IBlockAccess world, int x, int y, int z)
{
return world.getBlockMetadata(x, y, z);
}
public boolean canFertilize(World world, int x, int y, int z, boolean p_149851_5_)
{
return (world.getBlockMetadata(x, y, z) != 7);
}
public boolean shouldFertilize(World world, Random random, int x, int y, int z)
{
return true;
}
public void fertilize(World world, Random random, int x, int y, int z)
{
}
@Override
public boolean func_149851_a(World p_149851_1_, int p_149851_2_, int p_149851_3_, int p_149851_4_,
boolean p_149851_5_) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_,
int p_149852_5_) {
// TODO Auto-generated method stub
return false;
}
@Override
public void func_149853_b(World p_149853_1_, Random p_149853_2_, int p_149853_3_, int p_149853_4_,
int p_149853_5_) {
// TODO Auto-generated method stub
}
}
BlockSilveriteCrops :
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import fr.irisium.irisiummod.IrisiumMod;
import fr.irisium.irisiummod.blocks.utils.BlockCropsMod;
import fr.irisium.irisiummod.init.ItemsMod;
import fr.irisium.irisiummod.util.ConfigHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class BlockSilveriteCrops extends BlockCropsMod
{
@SideOnly(Side.CLIENT)
private IIcon[] iconArray;
public BlockSilveriteCrops()
{
setBlockName("silveriteCrop");
}
public Item func_149866_i()
{
return ItemsMod.silveriteSeed;
}
public Item func_149865_P()
{
return ItemsMod.itemGarlic;
}
public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) {
super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0);
if (!p_149690_1_.isRemote && p_149690_5_ >= 7 && p_149690_1_.rand.nextInt(80) == 0 && ConfigHandler.essdrop)
{
this.dropBlockAsItem(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(ItemsMod.silveriteEssence));
}
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister p_149651_1_)
{
this.iconArray = new IIcon[4];
for (int i = 0; i < this.iconArray.length; i++)
{
this.iconArray[i] = p_149651_1_.registerIcon("irisiummod:silveriteCrop_" + i);
}
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int par1, int par2)
{
if (par2 < 7)
{
if (par2 == 6)
{
par2 = 5;
}
return this.iconArray[par2 >> 1];
}
return this.iconArray[3];
}
}
Le crash-report :
// Quite honestly, I wouldn't worry myself about that.
Time: 29/08/19 14:42
Description: Rendering entity in world
java.lang.NullPointerException: Rendering entity in world
at fr.irisium.irisiummod.blocks.crops.BlockSilveriteCrops.getIcon(BlockSilveriteCrops.java:65)
at net.minecraft.block.Block.getBlockTextureFromSide(Block.java:686)
at net.minecraft.item.ItemBlock.getIconFromDamage(ItemBlock.java:51)
at net.minecraft.item.Item.getIconIndex(Item.java:457)
at net.minecraft.item.ItemStack.getIconIndex(ItemStack.java:131)
at net.minecraft.client.renderer.entity.RenderItem.doRender(RenderItem.java:211)
at net.minecraft.client.renderer.entity.RenderItem.doRender(RenderItem.java:783)
at net.minecraft.client.renderer.entity.RenderManager.func_147939_a(RenderManager.java:300)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:283)
at net.minecraft.client.particle.EntityPickupFX.renderParticle(EntityPickupFX.java:53)
at net.minecraft.client.particle.EffectRenderer.renderLitParticles(EffectRenderer.java:216)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1347)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067)
at net.minecraft.client.Minecraft.run(Minecraft.java:962)
at net.minecraft.client.main.Main.main(Main.java:164)
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 net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at fr.irisium.irisiummod.blocks.crops.BlockSilveriteCrops.getIcon(BlockSilveriteCrops.java:65)
at net.minecraft.block.Block.getBlockTextureFromSide(Block.java:686)
at net.minecraft.item.ItemBlock.getIconFromDamage(ItemBlock.java:51)
at net.minecraft.item.Item.getIconIndex(Item.java:457)
at net.minecraft.item.ItemStack.getIconIndex(ItemStack.java:131)
at net.minecraft.client.renderer.entity.RenderItem.doRender(RenderItem.java:211)
at net.minecraft.client.renderer.entity.RenderItem.doRender(RenderItem.java:783)
-- Entity being rendered --
Details:
Entity Type: Item (net.minecraft.entity.item.EntityItem)
Entity ID: 103295
Entity Name: item.tile.silveriteCrop
Entity's Exact location: 59,44, 6,31, -313,78
Entity's Block location: World: (59,6,-314), Chunk: (at 11,0,6 in 3,-20; contains blocks 48,0,-320 to 63,255,-305), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
Entity's Momentum: -0,13, -0,14, 0,13
-- Renderer details --
Details:
Assigned renderer: net.minecraft.client.renderer.entity.RenderItem@fd01951
Location: -0,02,-0,33,-0,00 - World: (-1,-1,-1), Chunk: (at 15,-1,15 in -1,-1; contains blocks -16,0,-16 to -1,255,-1), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)
Rotation: 22.5
Delta: 0.13246632
Stacktrace:
at net.minecraft.client.renderer.entity.RenderManager.func_147939_a(RenderManager.java:300)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:283)
at net.minecraft.client.particle.EntityPickupFX.renderParticle(EntityPickupFX.java:53)
at net.minecraft.client.particle.EffectRenderer.renderLitParticles(EffectRenderer.java:216)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1347)
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player618'/140, l='MpServer', x=59,46, y=6,62, z=-313,78]]
Chunk stats: MultiplayerChunkCache: 279, 279
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options:
Level spawn location: World: (100,64,-206), Chunk: (at 4,4,2 in 6,-13; contains blocks 96,0,-208 to 111,255,-193), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
Level time: 14255 game time, 14255 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
Forced entities: 25 total; [EntityPig['Pig'/64, l='MpServer', x=83,47, y=69,00, z=-237,50], EntityChicken['Chicken'/66, l='MpServer', x=83,47, y=65,00, z=-234,69], EntityClientPlayerMP['Player618'/140, l='MpServer', x=59,46, y=6,62, z=-313,78], EntityBat['Bat'/19, l='MpServer', x=-17,34, y=59,10, z=-370,41], EntityChicken['Chicken'/84, l='MpServer', x=121,50, y=88,00, z=-244,50], EntityBat['Bat'/20, l='MpServer', x=-19,91, y=59,10, z=-369,34], EntityChicken['Chicken'/85, l='MpServer', x=120,50, y=88,00, z=-243,50], EntityBat['Bat'/21, l='MpServer', x=-16,25, y=60,10, z=-366,25], EntityChicken['Chicken'/86, l='MpServer', x=121,50, y=88,00, z=-243,50], EntityChicken['Chicken'/87, l='MpServer', x=120,50, y=88,00, z=-240,50], EntityBat['Bat'/27, l='MpServer', x=-17,25, y=59,00, z=-364,25], EntityBat['Bat'/30, l='MpServer', x=0,00, y=25,82, z=-263,47], EntityChicken['Chicken'/31, l='MpServer', x=-0,63, y=64,00, z=-244,41], EntityBat['Bat'/99, l='MpServer', x=135,16, y=59,85, z=-342,44], EntityChicken['Chicken'/36, l='MpServer', x=4,56, y=64,00, z=-251,44], EntityBat['Bat'/100, l='MpServer', x=135,69, y=59,10, z=-341,78], EntityBat['Bat'/101, l='MpServer', x=139,00, y=58,10, z=-340,50], EntityChicken['Chicken'/38, l='MpServer', x=0,50, y=63,00, z=-235,50], EntityItem['item.tile.stonebrick'/39, l='MpServer', x=31,13, y=6,13, z=-314,88], EntityChicken['Chicken'/40, l='MpServer', x=41,50, y=63,00, z=-325,50], EntityChicken['Chicken'/41, l='MpServer', x=42,50, y=64,00, z=-321,50], EntityChicken['Chicken'/42, l='MpServer', x=47,47, y=64,00, z=-329,44], EntityItem['item.tile.stonebrick'/43, l='MpServer', x=33,13, y=5,13, z=-304,31], EntityChicken['Chicken'/44, l='MpServer', x=45,47, y=64,00, z=-318,53], EntityItem['item.tile.stonebrick'/51, l='MpServer', x=61,88, y=5,13, z=-311,88]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2566)
at net.minecraft.client.Minecraft.run(Minecraft.java:984)
at net.minecraft.client.main.Main.main(Main.java:164)
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 net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 8.1 (amd64) version 6.3
Java Version: 1.8.0_221, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 706293592 bytes (673 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1614 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
UCHIJAAAA Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
UCHIJAAAA irisiummod{0.1} [IrisiumMod] (bin)
GL info: ' Vendor: 'Intel' Version: '4.3.0 - Build 10.18.14.4264' Renderer: 'Intel(R) HD Graphics 4600'
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: Intel(R) HD Graphics 4600 GL version 4.3.0 - Build 10.18.14.4264, Intel
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
Merci d’avance