Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.10.2] Forge Energy Capability in Item class


Tomson124
 Share

Recommended Posts

Hey everyone,

I am trying to implement ForgeEnergy as a second energy system in addtion to RF (and later also TELSA). I want to implement it in an item class wich extends the ItemArmor class. The page on ReadTheDocs about capabilities only describes it for TEs and ItemStacks... I am completly new to the capability system so I have absolutly no plan what to do.

Maybe someone can explain it to me in a few sentences and can even provide an example.

If it helps, the class I am talking about is this one: https://github.com/CyberdyneCC/SimplyJetpacks-2/blob/TomsonDev/src/main/java/tonius/simplyjetpacks/item/rewrite/ItemFluxpack.java

 

Tomson124

Link to comment
Share on other sites

Item capabilities are handled differently to Entity/TileEntity capabilities because Items are singletons, i.e. there's only one instance per item type.

 

Instead of Item implementing ICapabilityProvider directly, it has a method (Item#initCapabilities) that creates and returns a separate ICapabilityProvider instance. ItemStack (which implements ICapabilityProvider) calls this method from its constructors and stores the returned ICapabilityProvider, using it in its own implementation of the interface.

 

You can see some examples of items with capabilities here, here, here, here and here.

 

These all use one of two ICapabilityProvider implementations: CapabilityProviderSimple (only implements ICapabilityProvider, doesn't save/load capability data) and CapabilityProviderSerializable (implements both ICapabilityProvider and INBTSerialializable so it saves/loads capability data).

Edited by Choonster
  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

22 hours ago, Choonster said:

These all use one of two ICapabilityProvider implementations: CapabilityProviderSimple (only implements ICapabilityProvider, doesn't save/load capability data) and CapabilityProviderSerializable (implements both ICapabilityProvider and INBTSerialializable so it saves/loads capability data).

Thank you.

If I am right, I don't have to make my own ICapabilityProviders if I just use the default implementation from ForgeEnergy, right? Or do I need to do the exchange between ForgeEnergy and RF in the CapabilityProvider Implementation?

Link to comment
Share on other sites

28 minutes ago, Tomson124 said:

Thank you.

If I am right, I don't have to make my own ICapabilityProviders if I just use the default implementation from ForgeEnergy, right? Or do I need to do the exchange between ForgeEnergy and RF in the CapabilityProvider Implementation?

 

The ICapabilityProvider is responsible for storing the IEnergyStorage instance and providing it to external code. The IEnergyStorage implementation should be a completely separate class that stores the energy value and allows interaction with it through the IEnergyStorage methods.

 

You will need to create your own ICapabilityProvider implementation, Forge doesn't provide a stand-alone implementation for your use-case. The only implementations apart from vanilla classes are CapabilityDispatcher, which is designed to wrap multiple ICapabilityProviders into one; and FluidHandlerItemStackFluidHandlerItemStackSimple and FluidBucketWrapper, which implement IFluidHandlerItem in various ways.

 

If you want the RF IEnergyContainerItem and Forge IEnergyStorage interfaces to interact with the same energy value, you'll need to implement that yourself. There are two ways to do this:

  • Keep the current IEnergyContainerItem implementation and create an IEnergyStorage implementation that delegates to it
  • Use the default IEnergyStorage implementation (EnergyStorage) and change the IEnergyContainerItem implementation to delegate to it

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

So to sum this up, I have to create my own CapabilityProvider which is then used in initCapabilities and I have to make a custom implementation of IEnergyStorage (like EnergyStorage) which also includes interaction with IEngeryContainerItem. But how do I tell the ForgeEnergy Capability that it has to use my custom IEnergyStorage implementation instead of the default one?

Link to comment
Share on other sites

1 minute ago, Tomson124 said:

So to sum this up, I have to create my own CapabilityProvider which is then used in initCapabilities and I have to make a custom implementation of IEnergyStorage (like EnergyStorage) which also includes interaction with IEngeryContainerItem. But how do I tell the ForgeEnergy Capability that it has to use my custom IEnergyStorage implementation instead of the default one?

 

Your ICapabilityProvider class should store an instance of this custom IEnergyStorage implementation and return it from ICapabilityProvider#getCapability when the Capability argument is CapabilityEnergy.ENERGY. This is what allows other mods to access your IEnergyStorage instance.

 

You can either create the IEnergyStorage instance in the ICapabilityProvider or create it in the Item#initCapabilities override and pass it to the ICapabilityProvider's constructor.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

So I think I got it right, at least I did so until I ran into the first errors :/

It currently looks like this:

Spoiler

CapabilityProviderEnergy:

Spoiler


package tonius.simplyjetpacks.capability;

import net.minecraft.nbt.NBTBase;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;

import javax.annotation.Nullable;

public class CapabilityProviderEnergy<HANDLER> implements ICapabilitySerializable {

	protected final HANDLER instance;

	protected final Capability<HANDLER> capability;

	protected final EnumFacing facing;

	public CapabilityProviderEnergy(final Capability<HANDLER> capability, @Nullable final EnumFacing facing) {
		this(capability.getDefaultInstance(), capability, facing);
	}

	public CapabilityProviderEnergy(final HANDLER instance, Capability<HANDLER> capability, @Nullable EnumFacing facing) {
		this.instance = instance;
		this.capability = capability;
		this.facing = facing;
	}

	@Override
	public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
		return capability == getCapability();
	}

	@Override
	public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
		if (capability == getCapability()) {
			return getCapability().cast(getInstance());
		}

		return null;
	}

	@Override
	public NBTBase serializeNBT() {
		return getCapability().writeNBT(getInstance(), getFacing());
	}

	@Override
	public void deserializeNBT(NBTBase nbt) {
		getCapability().readNBT(getInstance(), getFacing(), nbt);
	}

	public final Capability<HANDLER> getCapability() {
		return capability;
	}

	@Nullable
	public EnumFacing getFacing() {
		return facing;
	}

	public final HANDLER getInstance() {
		return instance;
	}
}

 

Custom EnergyStorage:

Spoiler


package tonius.simplyjetpacks.capability;

import cofh.api.energy.IEnergyContainerItem;
import net.minecraft.item.ItemStack;
import net.minecraftforge.energy.EnergyStorage;
import net.minecraftforge.energy.IEnergyStorage;

public class EnergyConversionStorage extends EnergyStorage implements IEnergyContainerItem {

	protected int energy;
	protected int capacity;
	protected int maxReceive;
	protected int maxExtract;

	public IEnergyStorage energyStorage;

	/*public EnergyConversionStorage(int capacity)
	{
		this(capacity, capacity, capacity);
	}

	public EnergyConversionStorage(int capacity, int maxTransfer)
	{
		this(capacity, maxTransfer, maxTransfer);
	}*/

	public EnergyConversionStorage(int capacity)
	{
		super(capacity);
		//this.capacity = capacity;
		//this.maxReceive = maxReceive;
		//this.maxExtract = maxExtract;
	}

	//RF API
	@Override
	public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
		return receiveEnergy(maxReceive, simulate);
	}

	@Override
	public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
		return extractEnergy(maxExtract, simulate);
	}

	@Override
	public int getEnergyStored(ItemStack container) {
		return getEnergyStored();
	}

	@Override
	public int getMaxEnergyStored(ItemStack container) {
		return getMaxEnergyStored();
	}
}

 

ItemFluxpack:

Spoiler


package tonius.simplyjetpacks.item.rewrite;

import tonius.simplyjetpacks.SimplyJetpacks;
import tonius.simplyjetpacks.capability.CapabilityProviderEnergy;
import tonius.simplyjetpacks.capability.EnergyConversionStorage;
import tonius.simplyjetpacks.client.model.PackModelType;
import tonius.simplyjetpacks.client.util.RenderUtils;
import tonius.simplyjetpacks.config.Config;
import tonius.simplyjetpacks.item.IHUDInfoProvider;
import tonius.simplyjetpacks.setup.FuelType;
import tonius.simplyjetpacks.setup.ModCreativeTab;
import tonius.simplyjetpacks.setup.ModEnchantments;
import tonius.simplyjetpacks.setup.ModItems;
import tonius.simplyjetpacks.util.EquipmentSlotHelper;
import tonius.simplyjetpacks.util.NBTHelper;
import tonius.simplyjetpacks.util.SJStringHelper;
import cofh.api.energy.IEnergyContainerItem;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.List;

public class ItemFluxpack extends ItemArmor implements ISpecialArmor, /*IEnergyContainerItem,*/ IHUDInfoProvider {

	public boolean hasFuelIndicator = true;
	public boolean hasStateIndicators = true;
	public FuelType fuelType = FuelType.ENERGY;
	public boolean isFluxBased = false;
	public boolean showTier = true;
	public static final String TAG_ENERGY = "Energy";
	public static final String TAG_ON = "PackOn";

	public String name;
	private final int numItems;

	public ItemFluxpack(String name) {
		super(ArmorMaterial.IRON, 2, EntityEquipmentSlot.CHEST);
		this.name = name;
		this.setUnlocalizedName(SimplyJetpacks.PREFIX + name);
		this.setHasSubtypes(true);
		this.setMaxDamage(0);
		this.setCreativeTab(ModCreativeTab.instance);
		this.setRegistryName(name);

		numItems = Fluxpack.values().length;
	}

	@Override
	@SideOnly(Side.CLIENT)
	public void getSubItems(Item item, CreativeTabs creativeTabs, List<ItemStack> List) {
		if (ModItems.integrateEIO) {
			for (Fluxpack pack : Fluxpack.ALL_FLUXPACKS) {
				ItemStack stack;
				if (pack.usesFuel) {
					List.add(new ItemStack(item, 1, pack.ordinal()));
				} else {
					stack = new ItemStack(item, 1, pack.ordinal());
					if (item instanceof ItemFluxpack) {
						((ItemFluxpack) item).addFuel(stack, ((ItemFluxpack) item).getMaxEnergyStored(stack), false);
					}

					List.add(stack);
				}
			}
		}
		else {
			Fluxpack pack = Fluxpack.CREATIVE_FLUXPACK;

				ItemStack stack;
				if (pack.usesFuel) {
					List.add(new ItemStack(item, 1, pack.ordinal()));
				} else {
					stack = new ItemStack(item, 1, pack.ordinal());
					if (item instanceof ItemFluxpack) {
						((ItemFluxpack) item).addFuel(stack, ((ItemFluxpack) item).getMaxEnergyStored(stack), false);
					}
					List.add(stack);
				}
		}
	}

	@Override
	public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
	}

	@Override
	public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
		if(this.isOn(stack)) {
			this.chargeInventory(player, stack, this);
		}
	}

	public void toggleState(boolean on, ItemStack stack, String type, String tag, EntityPlayer player, boolean showInChat) {
		NBTHelper.setBoolean(stack, tag, !on);

		if (player != null && showInChat) {
			String color = on ? TextFormatting.RED.toString() : TextFormatting.GREEN.toString();
			type = type != null && !type.equals("") ? "chat." + this.name + "." + type + ".on" : "chat." + this.name + ".on";
			String msg = SJStringHelper.localize(type) + " " + color + SJStringHelper.localize("chat." + (on ? "disabled" : "enabled"));
			player.addChatMessage(new TextComponentString(msg));
		}
	}

	protected void chargeInventory(EntityLivingBase user, ItemStack stack, ItemFluxpack item)
	{
		int i = MathHelper.clamp_int(stack.getItemDamage(), 0, numItems - 1);

		if(this.fuelType == FuelType.ENERGY)
		{
			for(int j = 0; j <= 5; j++)
			{
				ItemStack currentStack = user.getItemStackFromSlot(EquipmentSlotHelper.fromSlot(j));
				if(currentStack != null && currentStack != stack && currentStack.getItem() instanceof IEnergyContainerItem)
				{
					IEnergyContainerItem heldEnergyItem = (IEnergyContainerItem) currentStack.getItem();
					if(Fluxpack.values()[i].usesFuel)
					{
						int energyToAdd = Math.min(item.useFuel(stack, Fluxpack.values()[i].getFuelPerTickOut(), true), heldEnergyItem.receiveEnergy(currentStack, Fluxpack.values()[i].getFuelPerTickOut(), true));
						item.useFuel(stack, energyToAdd, false);
						heldEnergyItem.receiveEnergy(currentStack, energyToAdd, false);
					}
					else
					{
						heldEnergyItem.receiveEnergy(currentStack, Fluxpack.values()[i].getFuelPerTickOut(), false);
					}
				}
			}
		}
	}

	@Override
	public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
		information(stack, this, tooltip);
		if (SJStringHelper.canShowDetails()) {
			shiftInformation(stack, tooltip);
		} else {
			tooltip.add(SJStringHelper.getShiftText());
		}
	}

	@SideOnly(Side.CLIENT)
	@SuppressWarnings("unchecked")
	public void information(ItemStack stack, ItemFluxpack item, List list) {
		int i = MathHelper.clamp_int(stack.getItemDamage(), 0, numItems - 1);
		if (this.showTier) {
			list.add(SJStringHelper.getTierText(Fluxpack.values()[i].getTier()));
		}
		list.add(SJStringHelper.getFuelText(this.fuelType, item.getFuelStored(stack), Fluxpack.values()[i].getFuelCapacity(), !Fluxpack.values()[i].usesFuel));
	}

	@SideOnly(Side.CLIENT)
	@SuppressWarnings("unchecked")
	public void shiftInformation(ItemStack stack, List list) {
		int i = MathHelper.clamp_int(stack.getItemDamage(), 0, numItems - 1);

		list.add(SJStringHelper.getStateText(this.isOn(stack)));
		list.add(SJStringHelper.getEnergySendText(Fluxpack.values()[i].getFuelPerTickOut()));
		if (Fluxpack.values()[i].getFuelPerTickIn() > 0) {
			list.add(SJStringHelper.getEnergyReceiveText(Fluxpack.values()[i].getFuelPerTickIn()));
		}
		SJStringHelper.addDescriptionLines(list, "fluxpack", TextFormatting.GREEN.toString());
	}

	// HUD info
	@Override
	@SideOnly(Side.CLIENT)
	public void addHUDInfo(List<String> list, ItemStack stack, boolean showFuel, boolean showState) {
		if (showFuel && this.hasFuelIndicator) {
			list.add(this.getHUDFuelInfo(stack, this));
		}
		if (showState && this.hasStateIndicators) {
			list.add(this.getHUDStatesInfo(stack));
		}
	}

	@SideOnly(Side.CLIENT)
	public String getHUDFuelInfo(ItemStack stack, ItemFluxpack item) {
		int fuel = item.getFuelStored(stack);
		int maxFuel = item.getMaxFuelStored(stack);
		int percent = (int) Math.ceil((double) fuel / (double) maxFuel * 100D);
		return SJStringHelper.getHUDFuelText(this.name, percent, this.fuelType, fuel);
	}

	@SideOnly(Side.CLIENT)
	public String getHUDStatesInfo(ItemStack stack) {
		return SJStringHelper.getHUDStateText(null, null, this.isOn(stack));
	}

	public boolean isOn(ItemStack stack) {
		return NBTHelper.getBooleanFallback(stack, TAG_ON, true);
	}

	@Override
	public EnumRarity getRarity(ItemStack stack) {
		int i = MathHelper.clamp_int(stack.getItemDamage(), 0, numItems - 1);
		if (Fluxpack.values()[i].getRarity() != null) {
			return Fluxpack.values()[i].getRarity();
		}
		return super.getRarity(stack);
	}

	@Override
	public boolean showDurabilityBar(ItemStack stack) {
		int i = MathHelper.clamp_int(stack.getItemDamage(), 0, numItems - 1);
		if (!Fluxpack.values()[i].usesFuel) {
			return false;
		}
		return this.hasFuelIndicator;
	}

	@Override
	public double getDurabilityForDisplay(ItemStack stack) {
		double stored = this.getMaxFuelStored(stack) - this.getFuelStored(stack) + 1;
		double max = this.getMaxFuelStored(stack) + 1;
		return stored / max;
	}

	@Override
	public String getUnlocalizedName(ItemStack itemStack) {
		int i = MathHelper.clamp_int(itemStack.getItemDamage(), 0, numItems - 1);
		return Fluxpack.values()[i].unlocalisedName;
	}

	// fuel
	public int getFuelStored(ItemStack stack) {
		return this.getEnergyStored(stack);
	}

	public int getMaxFuelStored(ItemStack stack) {
		return this.getMaxEnergyStored(stack);
	}

	public int addFuel(ItemStack stack, int maxAdd, boolean simulate) {
		int energy = this.getEnergyStored(stack);
		int energyReceived = Math.min(this.getMaxEnergyStored(stack) - energy, maxAdd);
		if (!simulate) {
			energy += energyReceived;
			NBTHelper.setInt(stack, TAG_ENERGY, energy);
		}
		return energyReceived;
	}

	public int useFuel(ItemStack stack, int maxUse, boolean simulate) {
		int energy = this.getEnergyStored(stack);
		int energyExtracted = Math.min(energy, maxUse);
		if (!simulate) {
			energy -= energyExtracted;
			NBTHelper.setInt(stack, TAG_ENERGY, energy);
		}
		return energyExtracted;
	}

	@Override
	public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
		int i = MathHelper.clamp_int(container.getItemDamage(), 0, numItems - 1);
		int energy = this.getEnergyStored(container);
		int energyReceived = Math.min(this.getMaxEnergyStored(container) - energy, Math.min(maxReceive, Fluxpack.values()[i].getFuelPerTickIn()));
		if (!simulate) {
			energy += energyReceived;
			NBTHelper.setInt(container, TAG_ENERGY, energy);
		}
		return energyReceived;
	}

	@Override
	public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
		int i = MathHelper.clamp_int(container.getItemDamage(), 0, numItems - 1);
		int energy = this.getEnergyStored(container);
		int energyExtracted = Math.min(energy, Math.min(maxExtract, Fluxpack.values()[i].getFuelPerTickOut()));
		if (!simulate) {
			energy -= energyExtracted;
			NBTHelper.setInt(container, TAG_ENERGY, energy);
		}
		return energyExtracted;
	}
/*
	@Override
	public int getEnergyStored(ItemStack container) {
		return NBTHelper.getInt(container, TAG_ENERGY);
	}

	@Override
	public int getMaxEnergyStored(ItemStack container) {
		int i = MathHelper.clamp_int(container.getItemDamage(), 0, numItems - 1);
		return Fluxpack.values()[i].getFuelCapacity();
	}*/
	public int getMaxEnergyStored(ItemStack armor) {
		int i = MathHelper.clamp_int(armor.getItemDamage(), 0, numItems - 1);
		return Fluxpack.values()[i].getFuelCapacity();
	}

	public int getEnergyStored(ItemStack container) {
		return NBTHelper.getInt(container, TAG_ENERGY);
	}

	@Override
	public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
		int i = MathHelper.clamp_int(armor.getItemDamage(), 0, numItems - 1);
		if (Fluxpack.values()[i].getIsArmored() && !source.isUnblockable()) {
			if (this.isFluxBased && source.damageType.equals("flux")) {
				return new ArmorProperties(0, 0.5D, Integer.MAX_VALUE);
			}
			int energyPerDamage = this.getFuelPerDamage(armor);
			int maxAbsorbed = energyPerDamage > 0 ? 25 * (this.getFuelStored(armor) / energyPerDamage) : 0;
			return new ArmorProperties(0, 0.85D * (Fluxpack.values()[i].getArmorReduction() / 20.0D), maxAbsorbed);
		}
		return new ArmorProperties(0, 1, 0);
	}

	@Override
	public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
		int i = MathHelper.clamp_int(armor.getItemDamage(), 0, numItems - 1);
		if (Fluxpack.values()[i].getIsArmored()) {
			if (this.getFuelStored(armor) >= Fluxpack.values()[i].getArmorFuelPerHit()) {
				return Fluxpack.values()[i].getArmorReduction();
			}
		}
		return 0;
	}

	@Override
	public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) {
		int i = MathHelper.clamp_int(itemStack.getItemDamage(), 0, numItems - 1);
		if (Config.enableArmor3DModels) {
			ModelBiped model = RenderUtils.getArmorModel(Fluxpack.values()[i], entityLiving);
			if (model != null) {
				return model;
			}
		}
		return super.getArmorModel(entityLiving, itemStack, armorSlot, _default);
	}

	@Override
	public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
		int i = MathHelper.clamp_int(stack.getItemDamage(), 0, numItems - 1);
		String flat = Config.enableArmor3DModels || Fluxpack.values()[i].armorModel == PackModelType.FLAT ? "" : ".flat";
		return SimplyJetpacks.RESOURCE_PREFIX + "textures/armor/" + Fluxpack.values()[i].getBaseName() + flat + ".png";
	}

	@Override
	public void damageArmor(EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot) {
		int i = MathHelper.clamp_int(armor.getItemDamage(), 0, numItems - 1);
		if (Fluxpack.values()[i].getIsArmored() && Fluxpack.values()[i].usesFuel) {
			if (this.fuelType == FuelType.ENERGY && this.isFluxBased && source.damageType.equals("flux")) {
				this.addFuel(armor, damage * (source.getEntity() == null ? Fluxpack.values()[i].getArmorFuelPerHit() / 2 : this.getFuelPerDamage(armor)), false);
			} else {
				this.useFuel(armor, damage * this.getFuelPerDamage(armor), false);
			}
		}
	}

	// armor
	protected int getFuelPerDamage(ItemStack stack) {
		int i = MathHelper.clamp_int(stack.getItemDamage(), 0, numItems - 1);
		if (ModEnchantments.fuelEffeciency == null) {
			return Fluxpack.values()[i].getArmorFuelPerHit();
		}

		int fuelEfficiencyLevel = MathHelper.clamp_int(EnchantmentHelper.getEnchantmentLevel(ModEnchantments.fuelEffeciency, stack), 0, 4);
		return (int) Math.round(Fluxpack.values()[i].getArmorFuelPerHit() * (5 - fuelEfficiencyLevel) / 5.0D);
	}

	@Override
	public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
		return new CapabilityProviderEnergy<>(new EnergyConversionStorage(1000), CapabilityEnergy.ENERGY, null);
	}

	public void registerItemModel() {
		for (int i = 0; i < numItems; i++) {
			SimplyJetpacks.proxy.registerItemRenderer(this, i, Fluxpack.getTypeFromMeta(i).getBaseName());
		}
	}
}

 

 

Edited by Tomson124
Adjusted Spoilers
Link to comment
Share on other sites

The RF API requires you to implement IEnergyContainerItem on an Item, it doesn't support capabilities.

 

Why does EnergyConversionStorage have an IEnergyStorage field?

 

If you're delegating the IEnergyStorage methods to the IEnergyContainerItem methods, EnergyConversionStorage should only implement IEnergyStorage without extending EnergyStorage. It should have an ItemStack field so it can call the IEnergyContainerItem methods on the Item.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

4 hours ago, Choonster said:

The RF API requires you to implement IEnergyContainerItem on an Item, it doesn't support capabilities.

 

Why does EnergyConversionStorage have an IEnergyStorage field?

 

If you're delegating the IEnergyStorage methods to the IEnergyContainerItem methods, EnergyConversionStorage should only implement IEnergyStorage without extending EnergyStorage. It should have an ItemStack field so it can call the IEnergyContainerItem methods on the Item.

The field was just a remaing piece of code from an earlier attempt...

 

I now changed the EnergyConversionStorage like you said:

Spoiler

package tonius.simplyjetpacks.capability;

import cofh.api.energy.IEnergyContainerItem;
import net.minecraft.item.ItemStack;
import net.minecraftforge.energy.IEnergyStorage;

public class EnergyConversionStorage implements IEnergyStorage {

	public ItemStack itemStack;

	public IEnergyContainerItem itemRF;

	public EnergyConversionStorage(IEnergyContainerItem itemRF, ItemStack itemStack) {
		this.itemStack = itemStack;
		this.itemRF = itemRF;
	}

	@Override
	public int receiveEnergy(int maxReceive, boolean simulate) {
		return itemRF.receiveEnergy(itemStack, maxReceive, simulate);
	}

	@Override
	public int extractEnergy(int maxExtract, boolean simulate) {
		return itemRF.extractEnergy(itemStack, maxExtract, simulate);
	}

	@Override
	public int getEnergyStored() {
		return itemRF.getEnergyStored(itemStack);
	}

	@Override
	public int getMaxEnergyStored() {
		return itemRF.getMaxEnergyStored(itemStack);
	}

	@Override
	public boolean canExtract() {
		return true;
	}

	@Override
	public boolean canReceive() {
		return true;
	}
}

 

And I adjusted the initCapabilities accordingly:

@Override
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
	return new CapabilityProviderEnergy<>(new EnergyConversionStorage(this, stack), CapabilityEnergy.ENERGY, null);
}

But when I start minecraft, or more specifically when I load a world it crashes with the error:

Spoiler

Description: Loading entity NBT

java.lang.IllegalArgumentException: Can not deserialize to an instance that isn't the default implementation
	at net.minecraftforge.energy.CapabilityEnergy$1.readNBT(CapabilityEnergy.java:30)
	at net.minecraftforge.energy.CapabilityEnergy$1.readNBT(CapabilityEnergy.java:19)
	at net.minecraftforge.common.capabilities.Capability.readNBT(Capability.java:99)
	at tonius.simplyjetpacks.capability.CapabilityProviderEnergy.deserializeNBT(CapabilityProviderEnergy.java:49)
	at net.minecraftforge.common.capabilities.CapabilityDispatcher.deserializeNBT(CapabilityDispatcher.java:133)
	at net.minecraft.item.ItemStack.setItem(ItemStack.java:1087)
	at net.minecraft.item.ItemStack.readFromNBT(ItemStack.java:221)
	at net.minecraft.item.ItemStack.loadItemStackFromNBT(ItemStack.java:113)
	at net.minecraft.entity.player.InventoryPlayer.readFromNBT(InventoryPlayer.java:640)
	at net.minecraft.entity.player.EntityPlayer.readEntityFromNBT(EntityPlayer.java:958)
	at net.minecraft.entity.player.EntityPlayerMP.readEntityFromNBT(EntityPlayerMP.java:205)
	at net.minecraft.entity.Entity.readFromNBT(Entity.java:1923)
	at net.minecraft.server.management.PlayerList.readPlayerDataFromFile(PlayerList.java:332)
	at net.minecraft.server.management.PlayerList.initializeConnectionToPlayer(PlayerList.java:122)
	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:263)
	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.access$100(NetworkDispatcher.java:73)
	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:212)
	at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:309)
	at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:197)
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:807)
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:688)
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:537)
	at java.lang.Thread.run(Thread.java:745)

 

 

Link to comment
Share on other sites

11 minutes ago, Tomson124 said:

java.lang.IllegalArgumentException: Can not deserialize to an instance that isn't the default implementation
	at net.minecraftforge.energy.CapabilityEnergy$1.readNBT(CapabilityEnergy.java:30)
	at net.minecraftforge.energy.CapabilityEnergy$1.readNBT(CapabilityEnergy.java:19)
	at net.minecraftforge.common.capabilities.Capability.readNBT(Capability.java:99)
	at tonius.simplyjetpacks.capability.CapabilityProviderEnergy.deserializeNBT(CapabilityProviderEnergy.java:49)

 

 

The IStorage for the energy capability (used by Capability#readNBT) can only desrialise from NBT into an instance of EnergyStorage. This is a general rule for most capabilities: The IStorage is only guaranteed to work with the capability's default implementation. If you're using a custom implementation, you'll need to read from/write to NBT yourself (or use that implementation's methods if it implements INBTSerializable).

 

Since your IEnergyStorage implementation isn't actually storing the energy value itself, the ICapabilityProvider doesn't need to implement INBTSerializable (or ICapabilitySerializable, which is simply a combination of the two interfaces).

Edited by Choonster
  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Thanks :) Now it works... kind of...

I did the Forge Energy implementation because EnderIO items can only be charged by Forge Energy or TESLA, even after the implementation my fluxpacks don't charge EnderIO items I don't know why... Is there a way to check if a capability is loaded correctly?

 

And I assume that I still can use the "normal" IEnergyContainerItem methods for energy usage, as I delegated them to the Capability in my EnergyConversionStorage

Link to comment
Share on other sites

9 minutes ago, Tomson124 said:

Thanks :) Now it works... kind of...

I did the Forge Energy implementation because EnderIO items can only be charged by Forge Energy or TESLA, even after the implementation my fluxpacks don't charge EnderIO items I don't know why... Is there a way to check if a capability is loaded correctly?

 

You've exposed the IEnergyStorage capability on your own item, which allows other mods to insert/extract energy from it; but are you accessing the IEnergyStorage capability on the items you're trying to charge?

 

 

Quote

And I assume that I still can use the "normal" IEnergyContainerItem methods for energy usage, as I delegated them to the Capability in my EnergyConversionStorage

 

Yes, they'll still work.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

3 minutes ago, Choonster said:

You've exposed the IEnergyStorage capability on your own item, which allows other mods to insert/extract energy from it; but are you accessing the IEnergyStorage capability on the items you're trying to charge?

I assume that I don't do that, as I did no changes to the Item classe except overriding the initCapabilities... I thought I access the IEnergyStorage through the IEnergyContainerItem methods as they are delegated to the ForgeEnergy Capability, but probably I am understanding something wrong here.

How would I access the IEnergyStorage then? By using the ForgeEnergy methods? If so, how would I use them? just returning the IEnergyContainerITem method or calculating it again?

Link to comment
Share on other sites

Just now, Tomson124 said:

I assume that I don't do that, as I did no changes to the Item classe except overriding the initCapabilities... I thought I access the IEnergyStorage through the IEnergyContainerItem methods as they are delegated to the ForgeEnergy Capability, but probably I am understanding something wrong here.

How would I access the IEnergyStorage then? By using the ForgeEnergy methods? If so, how would I use them? just returning the IEnergyContainerITem method or calculating it again?

 

All you've done is expose your own item's energy storage through the Forge Energy API, with an IEnergyStorage that calls the IEnergyContainerItem methods. This doesn't affect the energy stored in other items.

 

When you charge another item, you'll need to get its IEnergyStorage through the ItemStack's ICapabilityProvider methods and use IEnergyStorage#receiveEnergy to add energy to it. If it doesn't have one, check if it's an instance of IEnergyContainerItem and use the corresponding method to add energy to it. If it doesn't implement IEnergyContainerItem,

 

To simplify your code, you may want to create a method to get an IEnergyStorage from an ItemStack that does what I said above but returns an instance of EnergyConversionStorage if the item doesn't have an IEnergyStorage and implements IEnergyContainerItem. This way you can use IEnergyStorage#receiveEnergy regardless of which API the item supports.

 

You can use either API to extract energy from the Flux Pack (since you know they both use the same value).

  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Thank you so much it is working now :)

I wrote a small method which returns the IEnergyStorage of the item which should be charged:

public IEnergyStorage getIEnergyStorage(ItemStack chargeItem) {

		if (chargeItem.hasCapability(CapabilityEnergy.ENERGY, null)) {
			return chargeItem.getCapability(CapabilityEnergy.ENERGY, null);
		}
		else if (chargeItem.getItem() instanceof IEnergyContainerItem) {
			return new EnergyConversionStorage((IEnergyContainerItem) chargeItem.getItem(), chargeItem);
		}

		return null;
}

I am reffering to that method when charging the Items, and it works perfectly fine. Just have to see if it also works with Items that do not implement ForgeEnergy, as I am not sure about that part:

else if (chargeItem.getItem() instanceof IEnergyContainerItem) {
	return new EnergyConversionStorage((IEnergyContainerItem) chargeItem.getItem(), chargeItem);
}

But thank you a lot, I now also have a much better knowledge of Capabilites, too. Thank you for your patience with me ^^

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • today I was playing normal until my game crashed and returned to normal, after a while it crashed again and since then I can't play anymore I log in and the game closes with this error The game crashed whilst exception in server tick loop Error: java.util.ConcurrentModificationException Exit Code: -1 o crash completo : ---- Minecraft Crash Report ---- WARNING: coremods are present:   llibrary (llibrary-core-1.0.11-1.12.2.jar)   Inventory Tweaks Coremod (InventoryTweaks-1.63.jar)   EnderCorePlugin (EnderCore-1.12.2-0.5.76-core.jar)   AppleCore (AppleCore-mc1.12.2-3.2.0.jar)   CTMCorePlugin (CTM-MC1.12.2-1.0.1.30.jar)   ForgelinPlugin (Forgelin-1.8.4.jar)   MekanismCoremod (Mekanism-1.12.2-9.8.3.390.jar)   OpenModsCorePlugin (OpenModsLib-1.12.2-0.12.2.jar)   MalisisCorePlugin (malisiscore-1.12.2-6.5.1.jar) Contact their authors BEFORE contacting forge // Don't do that. Time: 10/17/21 2:26 AM Description: Exception in server tick loop java.util.ConcurrentModificationException     at java.util.HashMap$HashIterator.nextNode(HashMap.java:1429)     at java.util.HashMap$KeyIterator.next(HashMap.java:1453)     at net.minecraft.entity.EntityTracker.func_72788_a(EntityTracker.java:290)     at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:779)     at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668)     at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:185)     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)     at java.lang.Thread.run(Thread.java:745) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.12.2     Operating System: Windows 10 (amd64) version 10.0     Java Version: 1.8.0_51, Oracle Corporation     Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation     Memory: 1647489200 bytes (1571 MB) / 4127195136 bytes (3936 MB) up to 5726797824 bytes (5461 MB)     JVM Flags: 4 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx6144m -Xms256m -XX:PermSize=256m     IntCache: cache: 0, tcache: 0, allocated: 3, tallocated: 104     FML: MCP 9.42 Powered by Forge 14.23.5.2847 72 mods loaded, 72 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                                |     |:------ |:--------------------------------- |:------------------------ |:----------------------------------------------- |:---------------------------------------- |     | LCHIJA | minecraft                         | 1.12.2                   | minecraft.jar                                   | None                                     |     | LCHIJA | mcp                               | 9.42                     | minecraft.jar                                   | None                                     |     | LCHIJA | FML                               | 8.0.99.99                | forge-1.12.2-14.23.5.2847.jar                   | None                                     |     | LCHIJA | forge                             | 14.23.5.2847             | forge-1.12.2-14.23.5.2847.jar                   | None                                     |     | LCHIJA | openmodscore                      | 0.12.2                   | minecraft.jar                                   | None                                     |     | LCHIJA | securitycraft                     | v1.8.16                  | [1.12.2] SecurityCraft v1.8.16.jar              | None                                     |     | LCHIJA | applecore                         | 3.2.0                    | AppleCore-mc1.12.2-3.2.0.jar                    | None                                     |     | LCHIJA | ctm                               | MC1.12.2-1.0.1.30        | CTM-MC1.12.2-1.0.1.30.jar                       | None                                     |     | LCHIJA | appliedenergistics2               | rv6-stable-7             | appliedenergistics2-rv6-stable-7.jar            | dfa4d3ac143316c6f32aa1a1beda1e34d42132e5 |     | LCHIJA | biomesoplenty                     | 7.0.1.2441               | BiomesOPlenty-1.12.2-7.0.1.2441-universal.jar   | None                                     |     | LCHIJA | jei                               | 4.15.0.291               | jei_1.12.2-4.15.0.291.jar                       | None                                     |     | LCHIJA | chisel                            | MC1.12.2-1.0.1.44        | Chisel-MC1.12.2-1.0.1.44.jar                    | None                                     |     | LCHIJA | chiselsandbits                    | 14.33                    | chiselsandbits-14.33.jar                        | None                                     |     | LCHIJA | codechickenlib                    | 3.2.3.358                | CodeChickenLib-1.12.2-3.2.3.358-universal.jar   | f1850c39b2516232a2108a7bd84d1cb5df93b261 |     | LCHIJA | redstoneflux                      | 2.1.0                    | RedstoneFlux-1.12-2.1.0.6-universal.jar         | 8a6abf2cb9e141b866580d369ba6548732eff25f |     | LCHIJA | cofhcore                          | 4.6.3                    | CoFHCore-1.12.2-4.6.3.27-universal.jar          | None                                     |     | LCHIJA | cofhworld                         | 1.3.1                    | CoFHWorld-1.12.2-1.3.1.7-universal.jar          | 8a6abf2cb9e141b866580d369ba6548732eff25f |     | LCHIJA | crafttweaker                      | 4.1.20                   | CraftTweaker2-1.12-4.1.20.jar                   | None                                     |     | LCHIJA | ctgui                             | 1.0.0                    | CraftTweaker2-1.12-4.1.20.jar                   | None                                     |     | LCHIJA | crafttweakerjei                   | 2.0.3                    | CraftTweaker2-1.12-4.1.20.jar                   | None                                     |     | LCHIJA | cucumber                          | 1.1.3                    | Cucumber-1.12.2-1.1.3.jar                       | None                                     |     | LCHIJA | endercore                         | 1.12.2-0.5.76            | EnderCore-1.12.2-0.5.76.jar                     | None                                     |     | LCHIJA | thermalfoundation                 | 2.6.3                    | ThermalFoundation-1.12.2-2.6.3.27-universal.jar | 8a6abf2cb9e141b866580d369ba6548732eff25f |     | LCHIJA | thermalexpansion                  | 5.5.4                    | ThermalExpansion-1.12.2-5.5.4.43-universal.jar  | 8a6abf2cb9e141b866580d369ba6548732eff25f |     | LCHIJA | enderio                           | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | enderiointegrationtic             | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | enderiobase                       | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | enderioconduits                   | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | enderioconduitsappliedenergistics | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | enderioconduitsopencomputers      | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | enderioconduitsrefinedstorage     | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | enderiointegrationforestry        | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | enderiointegrationticlate         | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | enderioinvpanel                   | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | enderiomachines                   | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | enderiopowertools                 | 5.3.70                   | EnderIO-1.12.2-5.3.70.jar                       | None                                     |     | LCHIJA | extrautils2                       | 1.0                      | extrautils2-1.12-1.9.9.jar                      | None                                     |     | LCHIJA | zerocore                          | 1.12.2-0.1.2.8           | zerocore-1.12.2-0.1.2.8.jar                     | None                                     |     | LCHIJA | bigreactors                       | 1.12.2-0.4.5.67          | ExtremeReactors-1.12.2-0.4.5.67.jar             | None                                     |     | LCHIJA | fastleafdecay                     | v14                      | FastLeafDecay-v14.jar                           | None                                     |     | LCHIJA | forgelin                          | 1.8.4                    | Forgelin-1.8.4.jar                              | None                                     |     | LCHIJA | llibrary                          | 1.7.20                   | llibrary-1.7.20-1.12.2.jar                      | b9f30a813bee3b9dd5652c460310cfcd54f6b7ec |     | LCHIJA | fossil                            | 8.0.5                    | fossilsarcheology-8.0.5.jar                     | None                                     |     | LCHIJA | waila                             | 1.8.26                   | Hwyla-1.8.26-B41_1.12.2.jar                     | None                                     |     | LCHIJA | mekanism                          | 1.12.2-9.8.3.390         | Mekanism-1.12.2-9.8.3.390.jar                   | None                                     |     | LCHIJA | teslacorelib                      | 1.0.16                   | tesla-core-lib-1.12.2-1.0.16.jar                | d476d1b22b218a10d845928d1665d45fce301b27 |     | LCHIJA | industrialforegoing               | 1.12.2-1.12.2            | industrialforegoing-1.12.2-1.12.13-237.jar      | None                                     |     | LCHIJA | inventorytweaks                   | 1.63+release.109.220f184 | InventoryTweaks-1.63.jar                        | 55d2cd4f5f0961410bf7b91ef6c6bf00a766dcbe |     | LCHIJA | ironchest                         | 1.12.2-7.0.67.844        | ironchest-1.12.2-7.0.72.847.jar                 | None                                     |     | LCHIJA | journeymap                        | 1.12.2-5.5.9             | journeymap-1.12.2-5.5.9.jar                     | None                                     |     | LCHIJA | malisiscore                       | 1.12.2-6.5.1-SNAPSHOT    | malisiscore-1.12.2-6.5.1.jar                    | None                                     |     | LCHIJA | malisisdoors                      | 1.12.2-7.3.0             | malisisdoors-1.12.2-7.3.0 (1).jar               | None                                     |     | LCHIJA | mantle                            | 1.12-1.3.3.55            | Mantle-1.12-1.3.3.55.jar                        | None                                     |     | LCHIJA | mekanismgenerators                | 1.12.2-9.8.3.390         | MekanismGenerators-1.12.2-9.8.3.390.jar         | None                                     |     | LCHIJA | numina                            | 1.12.2-1.0.38            | Numina-1.12.2-1.0.38.jar                        | None                                     |     | LCHIJA | powersuits                        | 1.12.2-1.0.46            | ModularPowersuits-1.12.2-1.0.46.jar             | None                                     |     | LCHIJA | mousetweaks                       | 2.10                     | MouseTweaks-2.10-mc1.12.2.jar                   | None                                     |     | LCHIJA | mysticalagriculture               | 1.7.5                    | MysticalAgriculture-1.12.2-1.7.5.jar            | None                                     |     | LCHIJA | omlib                             | 3.1.4-249                | omlib-1.12.2-3.1.4-249.jar                      | None                                     |     | LCHIJA | ompd                              | 3.1.0-61                 | ompd-1.12.2-3.1.0-61.jar                        | None                                     |     | LCHIJA | openmods                          | 0.12.2                   | OpenModsLib-1.12.2-0.12.2.jar                   | d2a9a8e8440196e26a268d1f3ddc01b2e9c572a5 |     | LCHIJA | openblocks                        | 1.8.1                    | OpenBlocks-1.12.2-1.8.1.jar                     | d2a9a8e8440196e26a268d1f3ddc01b2e9c572a5 |     | LCHIJA | openmodularturrets                | 3.1.6-362                | openmodularturrets-1.12.2-3.1.6-362.jar         | None                                     |     | LCHIJA | oreexcavation                     | 1.4.143                  | OreExcavation-1.4.143.jar                       | None                                     |     | LCHIJA | harvestcraft                      | 1.12.2zb                 | Pam's HarvestCraft 1.12.2zf.jar                 | None                                     |     | LCHIJA | placebo                           | 1.6.0                    | Placebo-1.12.2-1.6.0.jar                        | None                                     |     | LCHIJA | reborncore                        | 3.18.0                   | RebornCore-1.12.2-3.18.1.514-universal.jar      | 8727a3141c8ec7f173b87aa78b9b9807867c4e6b |     | LCHIJA | thermaldynamics                   | 2.5.5                    | ThermalDynamics-1.12.2-2.5.5.21-universal.jar   | 8a6abf2cb9e141b866580d369ba6548732eff25f |     | LCHIJA | toastcontrol                      | 1.8.1                    | Toast Control-1.12.2-1.8.1.jar                  | None                                     |     | LCHIJA | wawla                             | 2.6.274                  | Wawla-1.12.2-2.6.274.jar                        | d476d1b22b218a10d845928d1665d45fce301b27 |     | LCHIJA | jurassicraft                      | 2.1.23                   | JurassiCraft-1.12.2-2.1.23.jar                  | None                                     |     | LCHIJA | teslacorelib_registries           | 1.0.16                   | tesla-core-lib-1.12.2-1.0.16.jar                | None                                     |     Loaded coremods (and transformers):  llibrary (llibrary-core-1.0.11-1.12.2.jar)   net.ilexiconn.llibrary.server.core.plugin.LLibraryTransformer   net.ilexiconn.llibrary.server.core.patcher.LLibraryRuntimePatcher Inventory Tweaks Coremod (InventoryTweaks-1.63.jar)   invtweaks.forge.asm.ContainerTransformer EnderCorePlugin (EnderCore-1.12.2-0.5.76-core.jar)   com.enderio.core.common.transform.EnderCoreTransformer   com.enderio.core.common.transform.SimpleMixinPatcher AppleCore (AppleCore-mc1.12.2-3.2.0.jar)   squeek.applecore.asm.TransformerModuleHandler CTMCorePlugin (CTM-MC1.12.2-1.0.1.30.jar)   team.chisel.ctm.client.asm.CTMTransformer ForgelinPlugin (Forgelin-1.8.4.jar)    MekanismCoremod (Mekanism-1.12.2-9.8.3.390.jar)   mekanism.coremod.KeybindingMigrationHelper OpenModsCorePlugin (OpenModsLib-1.12.2-0.12.2.jar)   openmods.core.OpenModsClassTransformer MalisisCorePlugin (malisiscore-1.12.2-6.5.1.jar)        GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.     OpenModsLib class transformers: [llama_null_fix:FINISHED],[horse_base_null_fix:FINISHED],[pre_world_render_hook:FINISHED],[player_render_hook:FINISHED],[horse_null_fix:FINISHED]     AE2 Version: stable rv6-stable-7 for Forge 14.23.5.2768     Ender IO: No known problems detected.     Authlib is : /C:/Users/User/Twitch/Minecraft/Install/libraries/com/mojang/authlib/1.5.25/authlib-1.5.25.jar     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!     !!!You are looking at the diagnostics information, not at the crash.       !!!     !!!Scroll up until you see the line with '---- Minecraft Crash Report ----'!!!     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!     RebornCore:          Plugin Engine: 0         RebornCore Version: 3.18.0         Runtime Debofucsation 1         RenderEngine: 0     AE2 Integration: IC2:OFF, RC:OFF, MFR:OFF, Waila:ON, InvTweaks:ON, JEI:ON, Mekanism:ON, OpenComputers:OFF, THE_ONE_PROBE:OFF, TESLA:OFF, CRAFTTWEAKER:ON     Profiler Position: N/A (disabled)     Player Count: 1 / 8; [EntityPlayerMP['AventureiroMax'/313, l='jurassic craft', x=231.44, y=90.00, z=117.46]]     Type: Integrated Server (map_client.txt)     Is Modded: Definitely; Client brand changed to 'fml,forge'    
    • I realized the error but I'm not sure how I'm supposed to solve it. Some vanilla feature in the biome I'm using in my dimensions uses an absolute upper bound but relative lower bound. So when I made the min built height of my dimension greater, the lower bound increased so much that it became higher than the upper bound. I'm not sure how to fix this other than change my dimension min height, but I was trying to center my dimension at about surface level so that the correct features were carved. 
    • The Forge team can't support every version of Minecraft in-perpetuity. No software company does that with their software. Forge has decided that they will support the most recent major version (1.17) and a single LTS version (1.15) 1.12 is 4 years old at this point.
    • I need help, I can't enter my server, from one day to another I couldn't connect anymore, that LOG is what I get when I log in, I already tried with another launcher and with another account but it marks the same error, my friends They can still play on the server, and I being the owner of the server I can't enter haha please help   [02:34:32] [Netty Epoll Server IO #2/ERROR] [ne.mi.fm.ne.NetworkRegistry/NETREGISTRY]: Channels [carryon:carryonpackets] rejected their client side version number[02:34:32] [Netty Epoll Server IO #2/ERROR] [ne.mi.fm.ne.FMLHandshakeHandler/FMLHANDSHAKE]: Terminating connection with client, mismatched mod list[02:34:32] [Server thread/INFO] [minecraft/ServerLoginNetHandler]: com.mojang.authlib.GameProfile@******[id=<null>,name=LeonardoRR,properties={},legacy=false] lost connection: Connection closed - mismatched mod channel list
    • I'm looking into UniformHeight because that seems to be the place where the message is logged. I'm not sure how the min > max thought because just finding usages of UniformHeight.of() shows that all the heights created seem to be constant. I'm not sure what's going on. 
  • Topics

  • Who's Online (See full list)

    There are no registered users currently online

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.