MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    [1.12.2]Ma Barre d'énergie ne veux pas se mettre a jour(ou n est pas syncro)

    Planifier Épinglé Verrouillé Déplacé Non résolu Sans suite
    1.12.2
    59 Messages 4 Publieurs 2.8k Vues 4 Watching
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • KporalK Hors-ligne
      Kporal
      dernière édition par Kporal

      	@Override
          protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
              int i = (this.width - this.xSize) / 2;
              int j = (this.height - this.ySize) / 2;
              this.drawDefaultBackground();
              this.mc.getTextureManager().bindTexture(background);
              this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
      
              if (this.tile.isBurning()) {
                  int c = ICI; // this.tile.getCookProgress();
                  this.drawTexturedModalRect(i + 41, j + 21, 178, 22, c,52 );
      
              }
      
              this.fontRenderer.drawString(this.tile.getName(), i + 80, j + 45, 0xFFFFFF);
          }
      

      Check out my mod : https://www.curseforge.com/minecraft/mc-mods/eygo

      1 réponse Dernière réponse Répondre Citer 0
      • HeavenH Hors-ligne
        Heaven
        dernière édition par Heaven

        non car ca c est pour la barre de cuisson de mon four 🙂
        voila la classe que j utilise pour la barre
        https://hastebin.com/vuquhoguto.java

        @Override
        	public void drawBackground(int mouseX, int mouseY, float gameTicks) {
        
        		//int amount = getScaled();
        		int amount = 20; //j ai modifier ca :)
        		RenderHelper.bindTexture(texture);
        		drawTexturedModalRect(posX, posY, 0, 0, sizeX, sizeY);
        		drawTexturedModalRect(posX, posY + DEFAULT_SCALE - amount, 16, DEFAULT_SCALE - amount, sizeX, amount);
        	}
        
        1 réponse Dernière réponse Répondre Citer 0
        • KporalK Hors-ligne
          Kporal
          dernière édition par Kporal

          AH ok ! donc en faite tu ne draw à aucun moment ta barre RF c’est donc pour sa que tu ne l’a vois pas, je ne connais pas les mod RF donc je en sais pas si tu utilise une librarie extérieur ou non, ou si tu te calque simplement sur le four pour exemple.

          Si tu te calque sur le four ( ou pas d’ailleur ), il te faut draw la barre d’énergie de la même manière que tu draw ta barre de combustion ( en récupérant évidement les valeurs correspondante ).

          Check out my mod : https://www.curseforge.com/minecraft/mc-mods/eygo

          1 réponse Dernière réponse Répondre Citer 0
          • HeavenH Hors-ligne
            Heaven
            dernière édition par Heaven

            j ai l api de redstone flux 🙂
            et ok je vois
            depuis que j ai, forcer voila le résultat :
            text alternatif

            1 réponse Dernière réponse Répondre Citer 0
            • KporalK Hors-ligne
              Kporal
              dernière édition par

              ok donc ta barre est bonne mais ne transmet pas les valeurs via this.tile.getCookProgress(); il font donc regarder à ce niveau ce qui cloche

              Check out my mod : https://www.curseforge.com/minecraft/mc-mods/eygo

              1 réponse Dernière réponse Répondre Citer 0
              • HeavenH Hors-ligne
                Heaven
                dernière édition par

                getCookProgress c est pour la barre pour le four qui cuit

                1 réponse Dernière réponse Répondre Citer 0
                • KporalK Hors-ligne
                  Kporal
                  dernière édition par

                  et donc ou as tu forcer la barre ? peut-tu passer ton code à jour ici stp ? en utilisant les balises de code c’est à dire ( 3x ` )

                  Check out my mod : https://www.curseforge.com/minecraft/mc-mods/eygo

                  1 réponse Dernière réponse Répondre Citer 0
                  • HeavenH Hors-ligne
                    Heaven
                    dernière édition par Heaven

                    Gui

                    package com.Nugarium.NuagrMod.machine;
                    
                    
                    import cofh.redstoneflux.api.IEnergyStorage;
                    import net.minecraft.entity.player.InventoryPlayer;
                    import net.minecraft.util.EnumFacing;
                    import net.minecraft.util.ResourceLocation;
                    
                    public class GuiUpgradeArmorMachine extends GuiBase {
                    
                        private static final ResourceLocation background = new ResourceLocation("nugar","textures/gui/container/nuagrmachine.png");
                    
                        private TileEntityUpgradeArmorMachine tile;
                    
                        @Override
                        public void initGui() {
                    
                            super.initGui();
                            addElement(new ElementEnergyStored(this, 150, 20, tile.getEnergyStorage()));
                        }
                    
                        public GuiUpgradeArmorMachine(TileEntityUpgradeArmorMachine tile, InventoryPlayer playerInv) {
                    
                            super(new ContainerUpgradeArmorMachine(tile, playerInv) {
                                @Override
                                protected int getSizeInventory() {
                                    return 0;
                                }
                            });
                    
                            this.tile = tile;
                    
                        }
                        @Override
                        protected void updateElementInformation() {
                    
                            super.updateElementInformation();
                    
                    
                        }
                    
                        @Override
                        protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
                            int i = (this.width - this.xSize) / 2;
                    
                            int j = (this.height - this.ySize) / 2;
                    
                            this.drawDefaultBackground();
                    
                            this.mc.getTextureManager().bindTexture(background);
                    
                            this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
                            this.drawElements(20, false);
                    
                    
                    
                    
                    
                    
                           /* if (this.tile.isBurning()) {
                    
                                int burningTime = this.tile.getField(0);
                    
                                int textureHeight = (int) (12f / this.tile.getFullBurnTime()* burningTime);
                    
                                this.drawTexturedModalRect(i + 41, j + 22, 178, 22 , textureHeight, 42);
                                int timePassed = this.tile.getField(1);
                    
                                int textureWidth = (int) (23f / 200f * timePassed);
                    
                                this.drawTexturedModalRect(i + 73, j + 23, 183, 79, 15, textureWidth);
                            }*/
                    
                            if (this.tile.isBurning()) {
                                int c = this.tile.getCookProgress();
                                this.drawTexturedModalRect(i + 41, j + 21, 178, 22, c,52 );
                    
                            }
                    
                            this.fontRenderer.drawString(this.tile.getName(), i + 80, j + 45, 0xFFFFFF);
                    
                        }
                    
                        protected void drawGuiContainerForegroundLayer(int x, int y)
                        {
                            drawElements(20, false);
                        }
                    
                    }
                    

                    TileEntity:

                    package com.Nugarium.NuagrMod.machine;
                    
                    
                    import cofh.redstoneflux.api.IEnergyContainerItem;
                    import cofh.redstoneflux.api.IEnergyInfo;
                    import cofh.redstoneflux.api.IEnergyReceiver;
                    import cofh.redstoneflux.api.IEnergyStorage;
                    import cofh.redstoneflux.impl.EnergyStorage;
                    import net.minecraft.util.EnumFacing;
                    import  net.minecraft.util.ITickable;
                    import net.minecraft.entity.player.EntityPlayer;
                    import net.minecraft.entity.player.InventoryPlayer;
                    import net.minecraft.inventory.Container;
                    import net.minecraft.inventory.ItemStackHelper;
                    import net.minecraft.item.ItemStack;
                    import net.minecraft.nbt.NBTTagCompound;
                    import net.minecraft.tileentity.TileEntityLockable;
                    import net.minecraft.util.NonNullList;
                    import net.minecraftforge.common.capabilities.Capability;
                    import net.minecraftforge.common.capabilities.ICapabilityProvider;
                    import net.minecraftforge.energy.CapabilityEnergy;
                    
                    import net.minecraftforge.fml.relauncher.Side;
                    import net.minecraftforge.fml.relauncher.SideOnly;
                    
                    public class TileEntityUpgradeArmorMachine extends TileEntityLockable implements ITickable , IEnergyInfo, IEnergyReceiver, ICapabilityProvider {
                        private NonNullList<ItemStack> stacks = NonNullList.withSize(4, ItemStack.EMPTY);
                        private String customName;
                       // private int	timePassed = 0;
                       // private int	burningTimeLeft	= 0;
                        private int workingTime = 0;
                        private int workingTimeNeeded = 200;
                        protected EnergyStorage energyStorage = new EnergyStorage(100000, 1000, 1000);
                    
                    
                    
                        @SideOnly(Side.CLIENT)
                        public int getCookProgress() {
                            return this.workingTime * 63 / this.workingTimeNeeded;
                        }
                    
                        public IEnergyStorage getEnergyStorage() {
                            return energyStorage;
                        }
                        @Override
                        public void readFromNBT(NBTTagCompound compound) {
                            super.readFromNBT(compound);
                            energyStorage.readFromNBT(compound);
                            this.stacks = NonNullList.<ItemStack>withSize(this.getSizeInventory(), ItemStack.EMPTY);
                            ItemStackHelper.loadAllItems(compound, this.stacks);
                            if (compound.hasKey("CustomName", 8))	 {
                                this.customName = compound.getString("CustomName");
                            }
                            //this.burningTimeLeft = compound.getInteger("burningTimeLeft");
                            //this.timePassed = compound.getInteger("timePassed");
                    
                            this.workingTime = compound.getShort("workingTime");
                            this.workingTimeNeeded = compound.getShort("workingTimeNeeded");
                        }
                        @Override
                        public NBTTagCompound writeToNBT(NBTTagCompound compound) {
                            super.writeToNBT(compound);
                            energyStorage.writeToNBT(compound);
                            ItemStackHelper.saveAllItems(compound, this.stacks);
                            if (this.hasCustomName()) {
                                compound.setString("CustomName", this.customName);
                            }
                            //compound.setInteger("burningTimeLeft", this.burningTimeLeft);
                            //compound.setInteger("timePassed", this.timePassed);
                    
                            compound.setShort("workingTime", (short)this.workingTime);
                            compound.setShort("workingTimeNeeded", (short)this.workingTimeNeeded);
                            return compound;
                        }
                        @Override
                        public int getField(int id) {
                            switch (id) {
                                case 0:
                                    return this.workingTime;
                                case 1:
                                    return this.workingTimeNeeded;
                            }
                            return 0;
                        }
                        @Override
                        public void setField(int id, int value) {
                            switch (id) {
                                case 0:
                                    this.workingTime = value;
                                    break;
                                case 1:
                                    this.workingTimeNeeded = value;
                            }
                        }
                        @Override
                        public int getFieldCount() {
                            return 2;
                        }
                        @Override
                        public int getSizeInventory() {
                            return this.stacks.size();
                        }
                        @Override
                        public ItemStack getStackInSlot(int index) {
                            return this.stacks.get(index);
                        }
                        @Override
                        public ItemStack decrStackSize(int index, int count) {
                            return ItemStackHelper.getAndSplit(this.stacks, index, count);
                        }
                        @Override
                        public ItemStack removeStackFromSlot(int index) {
                            return ItemStackHelper.getAndRemove(stacks, index);
                        }
                    
                    
                    
                        @Override
                    
                        public void setInventorySlotContents(int index, ItemStack stack) {
                    
                            this.stacks.set(index, stack);
                    
                    
                    
                            if (stack.getCount() > this.getInventoryStackLimit()) {
                    
                                stack.setCount(this.getInventoryStackLimit());
                    
                            }
                    
                        }
                    
                    
                    
                        @Override
                    
                        public int getInventoryStackLimit() {
                    
                            return 64;
                    
                        }
                    
                    
                    
                        @Override
                    
                        public boolean isEmpty() {
                    
                            for(ItemStack stack : this.stacks) {
                    
                                if (!stack.isEmpty()) {
                    
                                    return false;
                    
                                }
                    
                            }
                    
                            return true;
                    
                        }
                    
                    
                    
                        @Override
                    
                        public void clear() {
                    
                            for(int i = 0; i < this.stacks.size(); i++) {
                    
                                this.stacks.set(i, ItemStack.EMPTY);
                    
                            }
                    
                        }
                    
                        @Override
                    
                        public void openInventory(EntityPlayer player) {}
                    
                    
                    
                        @Override
                    
                        public void closeInventory(EntityPlayer player) {}
                    
                        @Override
                    
                        public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) {
                    
                            return null;//new ContainerUpgradeArmorMachine(this, playerInventory);
                    
                        }
                    
                    
                    
                        @Override
                    
                        public String getGuiID() {
                    
                            return null;
                    
                        }
                    
                        @Override
                    
                        public boolean isItemValidForSlot(int slot, ItemStack stack) {
                    
                            return slot != 4;
                    
                        }
                    
                        @Override
                        public boolean isUsableByPlayer(EntityPlayer player) {
                    
                            return this.world.getTileEntity(this.pos) != this ? false : player
                    
                                    .getDistanceSq(this.pos.getX() + 0.5D,
                    
                                            this.pos.getY() + 0.5D,
                    
                                            this.pos.getZ() + 0.5D) <= 64.0D;
                    
                        }
                    
                    
                    
                        public ItemStack getRecipeResult() {
                    
                            return RecipesUpgradeArmorMachine.getRecipeResult(new ItemStack[] {
                    
                                    this.getStackInSlot(0), this.getStackInSlot(1),  this.getStackInSlot(2) });
                    
                        }
                    
                        public boolean canSmelt() {
                    
                    
                            ItemStack result = this.getRecipeResult();
                    
                    
                    
                    
                            if (result != null) {
                    
                    
                    
                    
                                ItemStack slot4 = this.getStackInSlot(3);
                    
                    
                    
                    
                                if (slot4.isEmpty())
                    
                                    return true;
                    
                    
                    
                    
                                if (slot4.getItem() == result.getItem() && slot4.getItemDamage() == result.getItemDamage()) {
                    
                                    int newStackSize = slot4.getCount() + result.getCount();
                    
                                    if (newStackSize <= this.getInventoryStackLimit() && newStackSize <= slot4.getMaxStackSize()) {
                    
                                        return true;
                    
                                    }
                    
                                }
                    
                            }
                    
                            return false;
                    
                        }
                    
                    
                    
                        public void smelt() {
                            // Cette fonction n'est appelée que si result != null, c'est pourquoi on ne fait pas de null check
                            ItemStack result = this.getRecipeResult();
                            // On enlève un item de chaque ingrédient
                            this.decrStackSize(0, 1);
                            this.decrStackSize(1, 1);
                            this.decrStackSize(2, 1);
                            // On récupère le slot de résultat
                            ItemStack stack4 = this.getStackInSlot(3);
                            // Si il est vide
                            if (stack4.isEmpty()) {
                                // On y insère une copie du résultat
                                this.setInventorySlotContents(3, result.copy());
                            } else {
                                // Sinon on augmente le nombre d'objets de l'ItemStack
                                stack4.setCount(stack4.getCount() + result.getCount());
                            }
                        }
                    
                        public boolean isBurning() {
                    
                            return this.workingTime > 0;
                        }
                    
                    
                        @Override
                        public String getName() {
                            // TODO Auto-generated method stub
                            return null;
                        }
                        @Override
                        public boolean hasCustomName() {
                            // TODO Auto-generated method stub
                            return false;
                        }
                    
                    
                        EnumFacing e;
                        @Override
                        public void update() {
                            if (!this.world.isRemote) {
                    
                    
                            if (this.isBurning() && this.canSmelt() && this.getEnergyStored(e) > 0) {
                                ++this.workingTime;
                            }
                    
                            if (this.canSmelt() && !this.isBurning()) {
                                this.workingTime = 1;
                            }
                    
                            if (this.canSmelt() && this.workingTime == this.workingTimeNeeded) {
                                this.smelt();
                                this.workingTime = 0;
                            }
                            }
                        }
                    
                    
                    
                    
                        /*ENERGY*/
                    
                        /* IEnergyInfo */
                        @Override
                        public int getInfoEnergyPerTick() {
                    
                            return 0;
                        }
                    
                        @Override
                        public int getInfoMaxEnergyPerTick() {
                    
                            return 0;
                        }
                    
                        @Override
                        public int getInfoEnergyStored() {
                    
                            return energyStorage.getEnergyStored();
                        }
                    
                        @Override
                        public int getInfoMaxEnergyStored() {
                            return 0;
                        }
                    
                        /* IEnergyReceiver */
                        @Override
                        public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) {
                    
                            return energyStorage.receiveEnergy(maxReceive, simulate);
                        }
                    
                        @Override
                        public int getEnergyStored(EnumFacing from) {
                    
                            return energyStorage.getEnergyStored();
                        }
                    
                        @Override
                        public int getMaxEnergyStored(EnumFacing from) {
                    
                            return energyStorage.getMaxEnergyStored();
                        }
                    
                        @Override
                        public boolean canConnectEnergy(EnumFacing from) {
                    
                            return energyStorage.getMaxEnergyStored() > 0;
                        }
                    
                    
                        /* CAPABILITIES */
                        @Override
                        public boolean hasCapability(Capability<?> capability, EnumFacing from) {
                    
                            return capability == CapabilityEnergy.ENERGY || super.hasCapability(capability, from);
                        }
                    
                        @Override
                        public <T> T getCapability(Capability<T> capability, final EnumFacing from) {
                    
                            if (capability == CapabilityEnergy.ENERGY) {
                                return CapabilityEnergy.ENERGY.cast(new net.minecraftforge.energy.IEnergyStorage() {
                    
                                    @Override
                                    public int receiveEnergy(int maxReceive, boolean simulate) {
                    
                                        return TileEntityUpgradeArmorMachine.this.receiveEnergy(from, maxReceive, simulate);
                                    }
                    
                                    @Override
                                    public int extractEnergy(int maxExtract, boolean simulate) {
                    
                                        return 0;
                                    }
                    
                                    @Override
                                    public int getEnergyStored() {
                    
                                        return TileEntityUpgradeArmorMachine.this.getEnergyStored(from);
                                    }
                    
                                    @Override
                                    public int getMaxEnergyStored() {
                    
                                        return TileEntityUpgradeArmorMachine.this.getMaxEnergyStored(from);
                                    }
                    
                                    @Override
                                    public boolean canExtract() {
                    
                                        return false;
                                    }
                    
                                    @Override
                                    public boolean canReceive() {
                    
                                        return true;
                                    }
                                });
                            }
                            return super.getCapability(capability, from);
                        }
                    
                    
                    }
                    

                    Et la classe de draw de la barre d’énergie:

                    package com.Nugarium.NuagrMod.machine;
                    
                    
                    import cofh.redstoneflux.api.*;
                    import net.minecraft.util.ResourceLocation;
                    
                    import java.util.List;
                    
                    public class ElementEnergyStored extends ElementBase {
                    
                    	public static final ResourceLocation DEFAULT_TEXTURE = new ResourceLocation(GuiProps.PATH_ELEMENTS + "energy.png");
                    	public static final int DEFAULT_SCALE = 42;
                    
                    	protected IEnergyStorage storage;
                    	protected TileEntityUpgradeArmorMachine tile;
                    
                    	// If this is enabled, 1 pixel of energy will always show in the bar as long as it is non-zero.
                    	protected boolean alwaysShowMinimum = false;
                    
                    	public ElementEnergyStored(GuiBase gui, int posX, int posY, IEnergyStorage storage) {
                    
                    		super(gui, posX, posY);
                    		this.storage = storage;
                    
                    		this.texture = DEFAULT_TEXTURE;
                    		this.sizeX = 16;
                    		this.sizeY = DEFAULT_SCALE;
                    
                    		this.texW = 32;
                    		this.texH = 64;
                    	}
                    
                    	public ElementEnergyStored setAlwaysShow(boolean show) {
                    
                    		alwaysShowMinimum = show;
                    		return this;
                    	}
                    
                    	@Override
                    	public void drawBackground(int mouseX, int mouseY, float gameTicks) {
                    
                    		int amount = getScaled();// ou 20 si tu veux forcer a la place de getScaled()
                    		RenderHelper.bindTexture(texture);
                    		drawTexturedModalRect(posX, posY, 0, 0, sizeX, sizeY);
                    		drawTexturedModalRect(posX, posY + DEFAULT_SCALE - amount, 16, DEFAULT_SCALE - amount, sizeX, amount);
                    	}
                    
                    	@Override
                    	public void drawForeground(int mouseX, int mouseY) {
                    
                    	}
                    
                    	@Override
                    	public void addTooltip(List<String> list) {
                    
                    		if (storage.getMaxEnergyStored() < 0) {
                    			list.add("Infinite RF");
                    		} else {
                    			list.add(StringHelper.formatNumber(storage.getEnergyStored()) + " / " + StringHelper.formatNumber(storage.getMaxEnergyStored()) + " RF");
                    		}
                    	}
                    
                    	protected int getScaled() {
                    
                    		if (storage.getMaxEnergyStored() <= 0) {
                    			return sizeY;
                    		}
                    		long fraction = (long) storage.getEnergyStored() * sizeY / storage.getMaxEnergyStored();
                    
                    		return alwaysShowMinimum && storage.getEnergyStored() > 0 ? Math.max(1, MathHelper.round(fraction)) : MathHelper.round(fraction);
                    	}
                    
                    }
                    
                    

                    je pense que c est la méthode getScaled()

                    1 réponse Dernière réponse Répondre Citer 0
                    • KporalK Hors-ligne
                      Kporal
                      dernière édition par

                      Je sèche, j’ai beau regarder ton code pour moi je ne trouve pas d’erreur, tout à l’air d’être bien lié ( et je suppose que tu n’as pas d’erreur en jeux ? ).

                      Tu as bien de l’énergie qui rentre dans le bloque on est d’accord ? et si tu passe ton curseur sur la barre le tooltip affiche le nombre de RF ?

                      Check out my mod : https://www.curseforge.com/minecraft/mc-mods/eygo

                      1 réponse Dernière réponse Répondre Citer 0
                      • HeavenH Hors-ligne
                        Heaven
                        dernière édition par Heaven

                        non ca affiche pas non plus le nombre de rf par contre j en suis sûr que les rf rentre bien dans la machine

                        je pense qu il y a un problème avec ces méthodes:

                        @Override
                        	public void addTooltip(List<String> list) {
                        
                        		if (storage.getMaxEnergyStored() < 0) {
                        			list.add("Infinite RF");
                        		} else {
                        			list.add(StringHelper.formatNumber(storage.getEnergyStored()) + " / " + StringHelper.formatNumber(storage.getMaxEnergyStored()) + " RF");
                        		}
                        	}
                        
                        	protected int getScaled() {
                        
                        		if (storage.getMaxEnergyStored() <= 0) {
                        			return sizeY;
                        		}
                        		long fraction = (long) storage.getEnergyStored() * sizeY / storage.getMaxEnergyStored();
                        
                        		return alwaysShowMinimum && storage.getEnergyStored() > 0 ? Math.max(1, MathHelper.round(fraction)) : MathHelper.round(fraction);
                        	}
                        

                        en particulier ca

                        storage.getMaxEnergyStored()
                        
                        1 réponse Dernière réponse Répondre Citer 0
                        • KporalK Hors-ligne
                          Kporal
                          dernière édition par

                          Je ne pense pas, j’ai regardé et tout à l’air bon à ce niveau, 2 possibilité maintenant :
                          La première :

                          protected boolean alwaysShowMinimum = false; // Change sa par true pour voir si un résultat se fait ou pas
                          

                          Puis sur ton tile ou via un event peux importe, mais fait un System.out.printLn( storage.getEnergyStored() )
                          pour être sûr et certain que tu as bien une valeur dedans, ça nous aidera déjà à cerner un peu mieux d’où peux venir le problème.

                          Check out my mod : https://www.curseforge.com/minecraft/mc-mods/eygo

                          1 réponse Dernière réponse Répondre Citer 0
                          • HeavenH Hors-ligne
                            Heaven
                            dernière édition par Heaven

                            ok je vais faire ca sur Smelt
                            energy renvoi a IEnergyStorage ou EnergyStorage ?

                            Edit: ca a écrit 7960

                            donc j ai remplacer ces deux fonctions par

                            @Override
                            	public void addTooltip(List<String> list) {
                            
                            		if (tile.energyStorage.getMaxEnergyStored() < 0) {
                            			list.add("Infinite RF");
                            		} else {
                            			list.add(StringHelper.formatNumber(tile.energyStorage.getEnergyStored()) + " / " + StringHelper.formatNumber(tile.energyStorage.getMaxEnergyStored()) + " RF");
                            		}
                            	}
                            
                            	protected int getScaled() {
                            
                            		if (tile.energyStorage.getMaxEnergyStored() <= 0) {
                            			return sizeY;
                            		}
                            		long fraction = (long) tile.energyStorage.getEnergyStored() * sizeY / tile.energyStorage.getMaxEnergyStored();
                            
                            		return alwaysShowMinimum && tile.energyStorage.getEnergyStored() > 0 ? Math.max(1, MathHelper.round(fraction)) : MathHelper.round(fraction);
                            	}
                            

                            mais

                            
                            java.lang.NullPointerException: Rendering screen
                            	at com.Nugarium.NuagrMod.machine.ElementEnergyStored.getScaled(ElementEnergyStored.java:66)
                            	at com.Nugarium.NuagrMod.machine.ElementEnergyStored.drawBackground(ElementEnergyStored.java:43)
                            	at com.Nugarium.NuagrMod.machine.GuiBase.drawElements(GuiBase.java:307)
                            	at com.Nugarium.NuagrMod.machine.GuiUpgradeArmorMachine.drawGuiContainerForegroundLayer(GuiUpgradeArmorMachine.java:85)
                            	at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:135)
                            	at com.Nugarium.NuagrMod.machine.GuiBase.drawScreen(GuiBase.java:84)
                            	at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:381)
                            	at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1177)
                            	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1208)
                            	at net.minecraft.client.Minecraft.run(Minecraft.java:441)
                            	at net.minecraft.client.main.Main.main(Main.java:118)
                            	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                            	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                            	at java.lang.reflect.Method.invoke(Method.java:498)
                            	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                            	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                            	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                            	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                            	at java.lang.reflect.Method.invoke(Method.java:498)
                            	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
                            	at GradleStart.main(GradleStart.java:25)
                            
                            
                            A detailed walkthrough of the error, its code path and all known details is as follows:
                            ---------------------------------------------------------------------------------------
                            
                            -- Head --
                            Thread: Client thread
                            Stacktrace:
                            	at com.Nugarium.NuagrMod.machine.ElementEnergyStored.getScaled(ElementEnergyStored.java:66)
                            	at com.Nugarium.NuagrMod.machine.ElementEnergyStored.drawBackground(ElementEnergyStored.java:43)
                            	at com.Nugarium.NuagrMod.machine.GuiBase.drawElements(GuiBase.java:307)
                            	at com.Nugarium.NuagrMod.machine.GuiUpgradeArmorMachine.drawGuiContainerForegroundLayer(GuiUpgradeArmorMachine.java:85)
                            	at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:135)
                            	at com.Nugarium.NuagrMod.machine.GuiBase.drawScreen(GuiBase.java:84)
                            	at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:381)
                            
                            -- Screen render details --
                            Details:
                            	Screen name: com.Nugarium.NuagrMod.machine.GuiUpgradeArmorMachine
                            	Mouse location: Scaled: (213, 119). Absolute: (427, 240)
                            	Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2
                            
                            -- Affected level --
                            Details:
                            	Level name: MpServer
                            	All players: 1 total; [EntityPlayerSP['Player690'/370, l='MpServer', x=-219.67, y=64.00, z=260.85]]
                            	Chunk stats: MultiplayerChunkCache: 552, 552
                            	Level seed: 0
                            	Level generator: ID 00 - default, ver 1. Features enabled: false
                            	Level generator options: 
                            	Level spawn location: World: (-216,64,252), Chunk: (at 8,4,12 in -14,15; contains blocks -224,0,240 to -209,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
                            	Level time: 20973 game time, 20973 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: creative (ID 1). Hardcore: false. Cheats: false
                            	Forced entities: 67 total; [EntityCreeper['Creeper'/256, l='MpServer', x=-151.50, y=69.00, z=313.50], EntitySheep['Sheep'/257, l='MpServer', x=-159.50, y=68.00, z=320.50], EntityChicken['Chicken'/132, l='MpServer', x=-257.32, y=64.00, z=210.85], EntityChicken['Chicken'/133, l='MpServer', x=-256.25, y=64.00, z=220.13], EntityItem['item.item.egg'/134, l='MpServer', x=-256.04, y=64.00, z=220.53], EntityChicken['Chicken'/135, l='MpServer', x=-268.14, y=70.00, z=283.84], EntityChicken['Chicken'/136, l='MpServer', x=-264.50, y=70.00, z=287.50], EntityChicken['Chicken'/137, l='MpServer', x=-271.50, y=70.00, z=281.50], EntityChicken['Chicken'/138, l='MpServer', x=-266.80, y=70.00, z=275.92], EntityItem['item.item.egg'/139, l='MpServer', x=-267.12, y=70.00, z=275.03], EntityItem['item.item.egg'/140, l='MpServer', x=-271.44, y=70.00, z=281.14], EntitySpider['Spider'/141, l='MpServer', x=-264.31, y=75.00, z=336.33], EntityCreeper['Creeper'/270, l='MpServer', x=-142.50, y=63.00, z=194.50], EntitySpider['Spider'/272, l='MpServer', x=-141.50, y=64.00, z=250.50], EntityEnderman['Enderman'/148, l='MpServer', x=-250.48, y=65.00, z=189.39], EntityItem['item.item.egg'/149, l='MpServer', x=-250.27, y=63.00, z=222.13], EntityChicken['Chicken'/150, l='MpServer', x=-253.37, y=64.00, z=216.87], EntityChicken['Chicken'/151, l='MpServer', x=-255.50, y=64.00, z=221.50], EntitySkeleton['Skeleton'/279, l='MpServer', x=-142.50, y=30.00, z=318.50], EntityZombie['Zombie'/152, l='MpServer', x=-255.85, y=64.00, z=242.15], EntityCreeper['Creeper'/283, l='MpServer', x=-142.63, y=28.00, z=339.30], EntityCreeper['Creeper'/284, l='MpServer', x=-141.11, y=29.00, z=335.67], EntitySkeleton['Skeleton'/157, l='MpServer', x=-231.50, y=64.00, z=183.50], EntityBat['Bat'/158, l='MpServer', x=-239.82, y=61.10, z=229.71], EntitySkeleton['Skeleton'/159, l='MpServer', x=-231.14, y=64.00, z=231.46], EntityZombie['Zombie'/160, l='MpServer', x=-226.71, y=64.00, z=247.56], EntitySkeleton['Skeleton'/178, l='MpServer', x=-211.56, y=64.00, z=181.65], EntityZombie['Zombie'/179, l='MpServer', x=-214.65, y=64.00, z=186.35], EntityZombie['Zombie'/180, l='MpServer', x=-209.50, y=64.00, z=187.50], EntitySkeleton['Skeleton'/181, l='MpServer', x=-210.50, y=64.00, z=199.50], EntitySkeleton['Skeleton'/182, l='MpServer', x=-222.82, y=64.00, z=250.17], EntityRabbit['Rabbit'/198, l='MpServer', x=-195.19, y=64.00, z=180.93], EntityCreeper['Creeper'/199, l='MpServer', x=-200.34, y=64.00, z=190.62], EntityChicken['Chicken'/200, l='MpServer', x=-204.41, y=64.00, z=216.90], EntityItem['item.item.egg'/201, l='MpServer', x=-207.49, y=65.00, z=220.90], EntityCreeper['Creeper'/202, l='MpServer', x=-203.51, y=67.00, z=295.20], EntityZombie['Zombie'/203, l='MpServer', x=-201.50, y=70.00, z=329.50], EntityChicken['Chicken'/213, l='MpServer', x=-190.50, y=64.00, z=222.50], EntityItem['item.item.egg'/214, l='MpServer', x=-189.86, y=64.00, z=223.06], EntitySpider['Spider'/215, l='MpServer', x=-183.50, y=64.00, z=226.50], EntitySkeleton['Skeleton'/216, l='MpServer', x=-191.50, y=69.00, z=321.50], EntityBat['Bat'/217, l='MpServer', x=-175.90, y=24.37, z=335.36], EntityCreeper['Creeper'/94, l='MpServer', x=-294.50, y=36.00, z=213.50], EntityBat['Bat'/95, l='MpServer', x=-292.75, y=44.10, z=221.25], EntityBat['Bat'/96, l='MpServer', x=-290.81, y=36.16, z=216.18], EntityBat['Bat'/97, l='MpServer', x=-289.05, y=39.68, z=214.22], EntityBat['Bat'/98, l='MpServer', x=-298.79, y=40.10, z=307.39], EntityZombie['Zombie'/99, l='MpServer', x=-292.50, y=76.00, z=335.50], EntityWitch['Witch'/234, l='MpServer', x=-157.11, y=64.00, z=186.95], EntityCreeper['Creeper'/235, l='MpServer', x=-165.50, y=64.00, z=209.50], EntitySpider['Spider'/236, l='MpServer', x=-162.16, y=64.00, z=247.09], EntitySquid['Squid'/237, l='MpServer', x=-174.60, y=61.00, z=274.28], EntitySpider['Spider'/109, l='MpServer', x=-276.09, y=64.00, z=184.71], EntitySquid['Squid'/238, l='MpServer', x=-168.89, y=61.02, z=268.40], EntitySkeleton['Skeleton'/110, l='MpServer', x=-283.50, y=63.00, z=216.50], EntitySheep['Sheep'/239, l='MpServer', x=-174.26, y=69.00, z=319.42], EntitySheep['Sheep'/240, l='MpServer', x=-165.50, y=68.00, z=314.50], EntityCreeper['Creeper'/113, l='MpServer', x=-278.85, y=63.00, z=224.48], EntityZombie['Zombie'/241, l='MpServer', x=-169.18, y=20.00, z=326.51], EntitySkeleton['Skeleton'/114, l='MpServer', x=-281.70, y=67.00, z=242.19], EntitySheep['Sheep'/242, l='MpServer', x=-172.40, y=69.00, z=328.24], EntityCreeper['Creeper'/115, l='MpServer', x=-284.50, y=67.00, z=247.50], EntityBat['Bat'/116, l='MpServer', x=-291.56, y=21.06, z=310.47], EntityBat['Bat'/117, l='MpServer', x=-285.72, y=58.10, z=314.22], EntityBat['Bat'/118, l='MpServer', x=-283.41, y=51.12, z=340.48], EntityPlayerSP['Player690'/370, l='MpServer', x=-219.67, y=64.00, z=260.85], EntityCow['Cow'/255, l='MpServer', x=-145.32, y=63.00, z=263.16]]
                            	Retry entities: 0 total; []
                            	Server brand: fml,forge
                            	Server type: Integrated singleplayer server
                            Stacktrace:
                            	at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:461)
                            	at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2888)
                            	at net.minecraft.client.Minecraft.run(Minecraft.java:462)
                            	at net.minecraft.client.main.Main.main(Main.java:118)
                            	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                            	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                            	at java.lang.reflect.Method.invoke(Method.java:498)
                            	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                            	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                            	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                            	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                            	at java.lang.reflect.Method.invoke(Method.java:498)
                            	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
                            	at GradleStart.main(GradleStart.java:25)
                            
                            -- System Details --
                            Details:
                            	Minecraft Version: 1.12.2
                            	Operating System: Windows 10 (amd64) version 10.0
                            	Java Version: 1.8.0_201, Oracle Corporation
                            	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                            	Memory: 503838272 bytes (480 MB) / 1321730048 bytes (1260 MB) up to 2854223872 bytes (2722 MB)
                            	JVM Flags: 0 total; 
                            	IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
                            	FML: MCP 9.42 Powered by Forge 14.23.5.2768 12 mods loaded, 12 mods active
                            	States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
                            
                            	| State     | ID                | Version      | Source                                          | Signature                                |
                            	|:--------- |:----------------- |:------------ |:----------------------------------------------- |:---------------------------------------- |
                            	| UCHIJAAAA | minecraft         | 1.12.2       | minecraft.jar                                   | None                                     |
                            	| UCHIJAAAA | mcp               | 9.42         | minecraft.jar                                   | None                                     |
                            	| UCHIJAAAA | FML               | 8.0.99.99    | forgeSrc-1.12.2-14.23.5.2768.jar                | None                                     |
                            	| UCHIJAAAA | forge             | 14.23.5.2768 | forgeSrc-1.12.2-14.23.5.2768.jar                | None                                     |
                            	| UCHIJAAAA | redstoneflux      | 2.1.0        | NugaMod 1.12.2                                  | None                                     |
                            	| UCHIJAAAA | nugar             | 0.1          | NugaMod 1.12.2                                  | None                                     |
                            	| UCHIJAAAA | codechickenlib    | 3.2.3.358    | CodeChickenLib-1.12.2-3.2.3.358-universal.jar   | f1850c39b2516232a2108a7bd84d1cb5df93b261 |
                            	| UCHIJAAAA | cofhcore          | 4.6.3        | CoFHCore-1.12.2-4.6.3.27-universal.jar          | None                                     |
                            	| UCHIJAAAA | cofhworld         | 1.3.1        | CoFHWorld-1.12.2-1.3.1.7-universal.jar          | 8a6abf2cb9e141b866580d369ba6548732eff25f |
                            	| UCHIJAAAA | thermalfoundation | 2.6.3        | ThermalFoundation-1.12.2-2.6.3.27-universal.jar | 8a6abf2cb9e141b866580d369ba6548732eff25f |
                            	| UCHIJAAAA | thermalexpansion  | 5.5.4        | ThermalExpansion-1.12.2-5.5.4.43-universal.jar  | 8a6abf2cb9e141b866580d369ba6548732eff25f |
                            	| UCHIJAAAA | thermaldynamics   | 2.5.5        | ThermaDynamique-1.12.2-5.5.4.43-universal.jar   | 8a6abf2cb9e141b866580d369ba6548732eff25f |
                            
                            	Loaded coremods (and transformers): 
                            	GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 441.41' Renderer: 'GeForce GTX 1050/PCIe/SSE2'
                            	Launched Version: 1.12.2
                            	LWJGL: 2.9.4
                            	OpenGL: GeForce GTX 1050/PCIe/SSE2 GL version 4.6.0 NVIDIA 441.41, NVIDIA Corporation
                            	GL Caps: Using GL 1.3 multitexturing.
                            Using GL 1.3 texture combiners.
                            Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
                            Shaders are available because OpenGL 2.1 is supported.
                            VBOs are available because OpenGL 1.5 is supported.
                            
                            	Using VBOs: Yes
                            	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)
                            	CPU: 4x Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz
                            
                            1 réponse Dernière réponse Répondre Citer 0
                            • KporalK Hors-ligne
                              Kporal
                              dernière édition par

                              Hum tile.energyStorage.getMaxEnergyStored() ? a première vue c’est sa qui n’est pas bon, tu devrais le remplacer par tile.getMaxEnergyStored() ou alors energyStorage.getMaxEnergyStored() mais pas tile.energyStorage j’ai pas le code sous les yeux mais j’ai l’impression que le souci viens de là

                              Check out my mod : https://www.curseforge.com/minecraft/mc-mods/eygo

                              1 réponse Dernière réponse Répondre Citer 0
                              • HeavenH Hors-ligne
                                Heaven
                                dernière édition par Heaven

                                comme ca avec energyStorage en static

                                @Override
                                	public void addTooltip(List<String> list) {
                                
                                		if (energyStorage.getMaxEnergyStored() < 0) {
                                			list.add("Infinite RF");
                                		} else {
                                			list.add(StringHelper.formatNumber(energyStorage.getEnergyStored()) + " / " + StringHelper.formatNumber(energyStorage.getMaxEnergyStored()) + " RF");
                                		}
                                	}
                                
                                	protected int getScaled() {
                                
                                		if (energyStorage.getMaxEnergyStored() <= 0) {
                                			return sizeY;
                                		}
                                		long fraction = (long) energyStorage.getEnergyStored() * sizeY / energyStorage.getMaxEnergyStored();
                                
                                		return alwaysShowMinimum && energyStorage.getEnergyStored() > 0 ? Math.max(1, MathHelper.round(fraction)) : MathHelper.round(fraction);
                                	}
                                

                                non mais tile.getMaxEnergyStored() c est tile.getMaxEnergyStored(EnumFacing from) donc ca marchera pas apres l autre peut etre

                                1 réponse Dernière réponse Répondre Citer 0
                                • HeavenH Hors-ligne
                                  Heaven
                                  dernière édition par

                                  ca marche ! en static merci de ton aide 🙂

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • KporalK Hors-ligne
                                    Kporal
                                    dernière édition par

                                    Avec plaisir 🙂

                                    Check out my mod : https://www.curseforge.com/minecraft/mc-mods/eygo

                                    1 réponse Dernière réponse Répondre Citer 0
                                    • HeavenH Hors-ligne
                                      Heaven
                                      dernière édition par

                                      par contre les machine sont toute syncro genre quand y en a une chargé bah si je la casse et que j en pose une autre elle sera a la meme charge ?

                                      1 réponse Dernière réponse Répondre Citer 0
                                      • KporalK Hors-ligne
                                        Kporal
                                        dernière édition par

                                        Aucune idée, mais je ne pense pas … à moins que le tileentity soit syncro avec sont objet dropper

                                        Check out my mod : https://www.curseforge.com/minecraft/mc-mods/eygo

                                        1 réponse Dernière réponse Répondre Citer 0
                                        • HeavenH Hors-ligne
                                          Heaven
                                          dernière édition par

                                          non je pense que c est parce que j ai mis juste energyStorage donc ca prend toute les machine qui font ca ?? c bizzard

                                          1 réponse Dernière réponse Répondre Citer 0
                                          • KporalK Hors-ligne
                                            Kporal
                                            dernière édition par

                                            Du tout, rien de bizarre là dedans, si ta tileEntity dépend de sa propre instance il est normal que chaque tileEntity que tu vas créer dans le monde dispose des mêmes informations, par contre si tu lui attache une capability que tu auras créer au préalable pour sauvegarder de manière unique les informations de chaque tileEntity, alors tu auras des bloques indépendant le cas contraire non car toute lié par le même objet.

                                            Check out my mod : https://www.curseforge.com/minecraft/mc-mods/eygo

                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB