Non résolu Problème d'affichage de bloc et d'items
-
Bonjour,
Mon problème cette fois-ci est un bug d’affichage, mon bloc “BaiclairBush” (basé sur le “SweetBerryBush”) affiche du noir au lieu de la transparence et la baie correspondante au buisson (ItemBlock) affiche plusieurs pixels bleus qui ne sont pas présents dans ma texture “baiclair.png”.
Screenshot :
Textures :
Models :
“baiclair.json”
{ "parent": "item/generated", "textures": { "layer0": "jdn:item/baiclair" } }
“baiclair_bush_stage0.json”
{ "parent": "minecraft:block/cross", "textures": { "cross": "jdn:block/baiclair_bush_stage0" } }
“baiclair_bush_stage1.json”
{ "parent": "minecraft:block/cross", "textures": { "cross": "jdn:block/baiclair_bush_stage1" } }
“baiclair_bush_stage2.json”
{ "parent": "minecraft:block/cross", "textures": { "cross": "jdn:block/baiclair_bush_stage2" } }
“baiclair_bush_stage3.json”
{ "parent": "minecraft:block/cross", "textures": { "cross": "jdn:block/baiclair_bush_stage3" } }
Classes :
“BaiclairBushBlock.java”
package com.krafty.jdn.blocks; import java.util.Random; import com.krafty.jdn.JournalDuNoobMod; import com.krafty.jdn.items.JDNItems; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.BushBlock; import net.minecraft.block.IGrowable; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.NewChatGui; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.state.IntegerProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.ActionResultType; import net.minecraft.util.DamageSource; import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; public class BaiclairBushBlock extends BushBlock implements IGrowable { public static final IntegerProperty AGE = BlockStateProperties.AGE_3; private static final VoxelShape SAPLING_SHAPE = Block.box(3.0D, 0.0D, 3.0D, 13.0D, 8.0D, 13.0D); private static final VoxelShape MID_GROWTH_SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D); public BaiclairBushBlock() { super(AbstractBlock.Properties.of(Material.PLANT).randomTicks().noCollission().sound(SoundType.SWEET_BERRY_BUSH)); this.registerDefaultState(this.stateDefinition.any().setValue(AGE, Integer.valueOf(0))); setRegistryName(JournalDuNoobMod.MODID, "baiclair_bush"); } @Override public ItemStack getCloneItemStack(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) { return new ItemStack(JDNItems.BAICLAIR_ITEM); } @Override public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { if (p_220053_1_.getValue(AGE) == 0) { return SAPLING_SHAPE; } else { return p_220053_1_.getValue(AGE) < 3 ? MID_GROWTH_SHAPE : super.getShape(p_220053_1_, p_220053_2_, p_220053_3_, p_220053_4_); } } @Override public boolean isRandomlyTicking(BlockState p_149653_1_) { return p_149653_1_.getValue(AGE) < 3; } @Override public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { final int i = p_225542_1_.getValue(AGE); if (i < 3 && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(5) == 0)) { p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)), 2); net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); } } @Override public void entityInside(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { if (p_196262_4_ instanceof LivingEntity && p_196262_4_.getType() != EntityType.FOX && p_196262_4_.getType() != EntityType.BEE) { p_196262_4_.makeStuckInBlock(p_196262_1_, new Vector3d(0.8F, 0.75D, 0.8F)); if (!p_196262_2_.isClientSide && p_196262_1_.getValue(AGE) > 0 && (p_196262_4_.xOld != p_196262_4_.getX() || p_196262_4_.zOld != p_196262_4_.getZ())) { final double d0 = Math.abs(p_196262_4_.getX() - p_196262_4_.xOld); final double d1 = Math.abs(p_196262_4_.getZ() - p_196262_4_.zOld); if (d0 >= 0.003F || d1 >= 0.003F) { p_196262_4_.hurt(DamageSource.SWEET_BERRY_BUSH, 1.0F); new NewChatGui(Minecraft.getInstance()).addMessage(new StringTextComponent("Aïe")); } } } } @Override public ActionResultType use(BlockState p_225533_1_, World p_225533_2_, BlockPos p_225533_3_, PlayerEntity p_225533_4_, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) { final int i = p_225533_1_.getValue(AGE); final boolean flag = i == 3; if (!flag && p_225533_4_.getItemInHand(p_225533_5_).getItem() == Items.BONE_MEAL) { return ActionResultType.PASS; } else if (i > 1) { final int j = 1 + p_225533_2_.random.nextInt(2); popResource(p_225533_2_, p_225533_3_, new ItemStack(JDNItems.BAICLAIR_ITEM, j + (flag ? 1 : 0))); p_225533_2_.playSound((PlayerEntity) null, p_225533_3_, SoundEvents.SWEET_BERRY_BUSH_PICK_BERRIES, SoundCategory.BLOCKS, 1.0F, 0.8F + p_225533_2_.random.nextFloat() * 0.4F); p_225533_2_.setBlock(p_225533_3_, p_225533_1_.setValue(AGE, Integer.valueOf(1)), 2); return ActionResultType.sidedSuccess(p_225533_2_.isClientSide); } else { return ActionResultType.PASS; } } @Override protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) { p_206840_1_.add(AGE); } @Override public boolean isValidBonemealTarget(IBlockReader p_176473_1_, BlockPos p_176473_2_, BlockState p_176473_3_, boolean p_176473_4_) { return p_176473_3_.getValue(AGE) < 3; } @Override public boolean isBonemealSuccess(World p_180670_1_, Random p_180670_2_, BlockPos p_180670_3_, BlockState p_180670_4_) { return true; } @Override public void performBonemeal(ServerWorld p_225535_1_, Random p_225535_2_, BlockPos p_225535_3_, BlockState p_225535_4_) { final int i = Math.min(3, p_225535_4_.getValue(AGE) + 1); p_225535_1_.setBlock(p_225535_3_, p_225535_4_.setValue(AGE, Integer.valueOf(i)), 2); } }
“BaiclairItem.java”
package com.krafty.jdn.items; import com.krafty.jdn.JournalDuNoobMod; import com.krafty.jdn.blocks.JDNBlocks; import net.minecraft.item.BlockItem; import net.minecraft.item.Food; import net.minecraft.item.Item; import net.minecraft.item.Rarity; public class BaiclairItem extends BlockItem { public BaiclairItem() { super(JDNBlocks.BAICLAIR_BUSH_BLOCK, new Item.Properties().stacksTo(64).rarity(Rarity.COMMON).tab(JournalDuNoobMod.JDN_ITEM_GROUP) .food(new Food.Builder().nutrition(2).saturationMod(0.1F).build())); setRegistryName(JournalDuNoobMod.MODID, "baiclair"); } }
J’en peux plus de ce buug…
Je trouve absolument rien… La seule réponse que je vois c’est que les textures sont abimées/corrompues/mal faite, mais dans ce cas là comment le réparer ???Infos en + : mod 1.16.5, Eclipse pour le code, Gimp pour les textures.
Merci d’avance,
Krafty
-
Personne ?