Jump to content

LazyOptional crushes casting to IEnergyStorage


dyno

Recommended Posts

When Generator's charge slot contains a battery, crush

SettableEnergyStorage:

package com.olivemod.energy.SeattableEnergyStorage;

import net.minecraftforge.energy.EnergyStorage;

public class SettableEnergyStorage extends EnergyStorage{

	public SettableEnergyStorage(final int capacity) {
		super(capacity);
		// TODO Auto-generated constructor stub
	}
	
	public SettableEnergyStorage(final int capacity, final int maxTransfer) {
		super(capacity, maxTransfer);
		// TODO Auto-generated constructor stub
	}
	
	public SettableEnergyStorage(final int capacity, final int maxReceive, final int maxExtract) {
		super(capacity, maxReceive, maxExtract);
		// TODO Auto-generated constructor stub
	}
	
	public SettableEnergyStorage(final int capacity, final int maxReceive, final int maxExtract, final int energy) {
		super(capacity, maxReceive, maxExtract, energy);
		// TODO Auto-generated constructor stub
	}
	
	//@Return the amount of energy was put into the storage
	@SuppressWarnings("unused")
	public int setEnergy(final int maxSet) {

		return this.energy = Math.min(this.capacity, maxSet);
	}
	


}

TEGenerator:

package com.olivemod.blocks.machine.energy.generator.glowstone_generator;

import javax.annotation.Nonnull;

import com.olivemod.energy.SeattableEnergyStorage.CapabilityProviderEnergy;
import com.olivemod.energy.SeattableEnergyStorage.SettableEnergyStorage;
import com.olivemod.init.BlockInit;
import com.olivemod.utils.ModTileEntityTypes;
import com.sun.istack.internal.Nullable;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.EnergyStorage;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.wrapper.RangedWrapper;

public class TileEntityGlowStoneGenerator extends TileEntity implements ITickableTileEntity, INamedContainerProvider {

	public static final int INPUT_SLOT = 0;
	public static final int OUTPUT_SLOT = 1;
	
	private int cookTime;

	private static final String INVENTORY_TAG = "inventory";
	private static final String SMELT_TIME_LEFT_TAG = "smeltTimeLeft";
	private static final String MAX_SMELT_TIME_TAG = "maxSmeltTime";
	private static final String ENERGY_TAG = "energy";
	
	
	public final ItemStackHandler inventory = new ItemStackHandler(2){
		
		public boolean isItemValid(int slot, net.minecraft.item.ItemStack stack) {
			if(slot == INPUT_SLOT)
				return getEnergyFromItem(stack) > 0;
			else if(slot == OUTPUT_SLOT)
				return stack.getCapability(CapabilityEnergy.ENERGY) != null;
			
			return false;
		};
		
		protected void onContentsChanged(int slot) {
			
			super.onContentsChanged(slot);
			//Make the tile entiy as having changed whenever its inventory changes
			//"markDirty()" tells game the chunk contaong tile entity has changed and it will save to disk later
			TileEntityGlowStoneGenerator.this.markDirty();
		}
	};
	
	public final SettableEnergyStorage energy = new SettableEnergyStorage(10000, 0, 1000);
	
	//Store the capability lazy optionals as field to keep the amout of object we use to a minium 
	private final LazyOptional<ItemStackHandler> inventoryCapabilities = LazyOptional.of(() -> this.inventory);
	//Hoppers and Duct can connect to this generator's top to extract/insert items from Input Slot
	private final LazyOptional<IItemHandlerModifiable> InventorycapabilitiesUpAndSides = LazyOptional.of(() -> new RangedWrapper(inventory, INPUT_SLOT, INPUT_SLOT+1));
	//Hoppers and duct can connect to this generator's bottom to extract/insert items from Output Slot
	private final LazyOptional<IItemHandlerModifiable> InventoryCapabilitiesDown = LazyOptional.of(() -> new RangedWrapper(inventory, OUTPUT_SLOT, OUTPUT_SLOT+1));
	//Duct can connect to all side to extract energy
	private final LazyOptional<EnergyStorage> energyCapabilitiesExternal = LazyOptional.of(() -> this.energy);
	
	public short smeltTimeLeft = -1;
	public short maxSmeltTime = -1;
	@SuppressWarnings("unused")
	private int lastEnergy = -1;
	
	public TileEntityGlowStoneGenerator() {
		
		super(ModTileEntityTypes.GLOWSTONE_GENERATOR_TE.get()); 
	}
	
	public TileEntityGlowStoneGenerator(TileEntityType<?> typeIn) {
		super(typeIn);
	}

	@Override
	public void tick() {
		
		if(world == null && world.isRemote)
			return;
		
		//This method will push out energy passing it to a wire/machine
		outputEnergy();
		produceEnergy();
		charge();
	}

	private void charge() {
		ItemStack itemStack = this.inventory.getStackInSlot(1);
		if(!itemStack.isEmpty())
		{
			if(this.energy.getEnergyStored() > 0)
			{
				IEnergyStorage storageToCharge = (IEnergyStorage) itemStack.getCapability(CapabilityEnergy.ENERGY);
				
				if(storageToCharge != null && storageToCharge.getEnergyStored() < storageToCharge.getMaxEnergyStored())
				{
					
					int accepted = storageToCharge.receiveEnergy(10, false);
					this.energy.receiveEnergy(this.energy.getEnergyStored() - accepted, false);
					//let vanilla update chunk
					this.markDirty();	
					//Notify client of a block update
					//This will result in the packet from getUpdatePacket beong sent to the client
					//Energy will be synced
					//Flag 2 send change to client
					world.notifyBlockUpdate(pos, this.getBlockState(), this.getBlockState(), 2);
					//Update the last energy to the current
					lastEnergy = energy.getEnergyStored();
				}
			}
		}
		
	}

	private void produceEnergy() {
		
		if(energy.getEnergyStored() < energy.getMaxEnergyStored())
		{
			ItemStack input = inventory.getStackInSlot(0);
			if(!input.isEmpty() && getEnergyFromItem(input) > 0)
			{		
				cookTime++;
				if(cookTime >= 25)
				{
					input.shrink(1);
					this.energy.setEnergy(this.energy.getEnergyStored() + getEnergyFromItem(input));
					//let vanilla update chunk
					this.markDirty();	
					//Notify client of a block update
					//This will result in the packet from getUpdatePacket beong sent to the client
					//Energy will be synced
					//Flag 2 send change to client
					world.notifyBlockUpdate(pos, this.getBlockState(), this.getBlockState(), 2);
					//Update the last energy to the current
					lastEnergy = energy.getEnergyStored();
				}
			}
		}
	}

	private int getEnergyFromItem(ItemStack input) {

		if(input.getItem() == Items.GLOWSTONE_DUST)
			return 200;
		else if(input.getItem() == Items.GLOWSTONE)
			return 1800;
		
		return 0;
	}

	private void outputEnergy() {
		
		if(energy.getEnergyStored() > 0)
		{
			for(Direction direction : Direction.values())
			{
				if(world.getTileEntity(pos.offset(direction)) != null)
				{
					TileEntity tileEntity = world.getTileEntity(pos.offset(direction));
					if(tileEntity.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite()) != null)
					{
						IEnergyStorage storage = (IEnergyStorage) tileEntity.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite());
						if(storage.getEnergyStored() < storage.getMaxEnergyStored())
						{
							int accepted = energy.extractEnergy(10, false);
							storage.receiveEnergy(accepted, false);
							//let vanilla update chunk
							this.markDirty();	
							//Notify client of a block update
							//This will result in the packet from getUpdatePacket beong sent to the client
							//Energy will be synced
							//Flag 2 send change to client
							world.notifyBlockUpdate(pos, this.getBlockState(), this.getBlockState(), 2);
							//Update the last energy to the current
							lastEnergy = energy.getEnergyStored();
						}
					}
				}
			}
		}
	}
	
	@Override
	public <T> LazyOptional<T> getCapability(@Nullable final Capability<T> cap, @Nullable final Direction side) {

		if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
		{
			if(side == null)
				return inventoryCapabilities.cast();
			else if(side != Direction.DOWN)
				return InventorycapabilitiesUpAndSides.cast();
			else 
				return InventoryCapabilitiesDown.cast();
		}
		
		if(cap == CapabilityEnergy.ENERGY)
			return energyCapabilitiesExternal.cast();
		
		return super.getCapability(cap, side);
	}
	
	/*
	 * Handle a packet created in (@link #getUpdatePacket())
	 */
	@Override
	public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) {

		this.energy.setEnergy(pkt.getNbtCompound().getInt(ENERGY_TAG));
	}
	
	
	@Override
	public void onLoad() {
		
		super.onLoad();
		//Set this in onLoad instead of the constructor so that TileEntities constructed from NBT(saved tile entities) have this set to the proper value
		if(world != null && !world.isRemote)
			this.lastEnergy = this.energy.getEnergyStored();
	}
	
	
	/*
	 * 	Read saved data from disk into the tile entity
	 */
	@Override
	public void read(CompoundNBT compound) {

		super.read(compound);
		this.inventory.deserializeNBT(compound.getCompound(INVENTORY_TAG));
		this.smeltTimeLeft = compound.getShort(SMELT_TIME_LEFT_TAG);
		this.maxSmeltTime = compound.getShort(MAX_SMELT_TIME_TAG);
		this.energy.setEnergy(compound.getInt(ENERGY_TAG));
	}
	
	
	/*
	 * 	Write data from tile entity into a compound for saving to disk
	 */
	@Nonnull
	@Override
	public CompoundNBT write(CompoundNBT compound) {

		super.write(compound);
		compound.put(INVENTORY_TAG, this.inventory.serializeNBT());
		compound.putInt(ENERGY_TAG, this.energy.getEnergyStored());
		compound.putShort(MAX_SMELT_TIME_TAG, this.maxSmeltTime);
		compound.putShort(SMELT_TIME_LEFT_TAG, smeltTimeLeft);
		
		return compound;
	}
	
	
	/*
	 * Retrieves packet to send to the client whenever this Tile Entity is re-sinced via World#notifyBlockUpdate. 
	 * This packet comes back client-side via (@link #onDataPacket)
	 */
	@Nullable
	public SUpdateTileEntityPacket getUpdatePacket() {

		final CompoundNBT tag = new CompoundNBT();
		tag.putInt(ENERGY_TAG, this.energy.getEnergyStored());
		//We pass 0 for TileEntityTypesIn because we have a modded TE.See ClientPlayNetHandler#handlerUpdateTileEntity(SUpdateTileEntityPacket)
		return new SUpdateTileEntityPacket(this.pos, 0, tag);
	}
	
	
	/*
	 * Get an NBT compount to sync to the client with SPacketChunkData, used to initial loading of the chunk or when many blocks change at once
	 * This compound comes back to the client-side in (@link #handleUpdateTag)
	 * The default implementation ({@link TileEntity#handleUpdateTag}) calls {@link #writeInternal)}
	 * wich doesn't save any of our extra data so we override it to call {@link #write} instead 
	 */
	@Nonnull
	public CompoundNBT getUpdateTag() {

		return this.write(new CompoundNBT());
	}
	
	
	/*
	 * Invalidates our Tile Entity 
	 */
	@Override
	public void remove() {

		super.remove();
		//We need to invalidate our capability references so that any cached references (by other mod) don't continue to reference our capablities
		//and try to use them and/or prevent them from being garbage collected
		inventoryCapabilities.invalidate();
		energyCapabilitiesExternal.invalidate();
	}
	
	@Nonnull
	@Override
	public Container createMenu(final int windowID, final PlayerInventory playerInventory, final PlayerEntity player) {

		return new GlowStoneGeneratorContainer(windowID, playerInventory, this);
	}

	@Override
	public ITextComponent getDisplayName() {

		return new TranslationTextComponent(BlockInit.GLOWSTONE_GENERATOR.get().getTranslationKey());
	}

}

Battery

package com.olivemod.items.battery;

import com.olivemod.energy.SeattableEnergyStorage.CapabilityProviderEnergy;
import com.olivemod.energy.SeattableEnergyStorage.SettableEnergyStorage;
import com.olivemod.utils.Reference.Reference;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.EnergyStorage;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

public class Battery extends Item implements ICapabilitySerializable<CompoundNBT>{

	private SettableEnergyStorage storage = new SettableEnergyStorage(2500, 100, 100);	
	private final LazyOptional<EnergyStorage> energyCapabilitiesExternal = LazyOptional.of(() -> this.storage);
	private final ItemStack itemStack;
	
	public Battery(Properties properties) {
		super(properties);
		this.itemStack = new ItemStack(this);
	}
	
	@SubscribeEvent
	public void onAttachCapabilities(AttachCapabilitiesEvent<ItemStack> event){
		if(event.getObject().hasTag())
		{
			if(event.getObject().getTag().contains("Energy"))
			{
				event.addCapability(new ResourceLocation(Reference.MOD_ID + "battery"), new ICapabilityProvider() {
					
					@Override
					public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {

						if(cap == CapabilityEnergy.ENERGY)
							return energyCapabilitiesExternal.cast();
						
						return null;
					}
				} );
			}
		}
		else 
		{
			event.getObject().setTag(new CompoundNBT());
		}
	}
	

	@Override
	public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {

		if(cap == CapabilityEnergy.ENERGY)
			return energyCapabilitiesExternal.cast();
		
		return null;
	}

	@Override
	public CompoundNBT serializeNBT() {

		if(!itemStack.hasTag())
			itemStack.setTag(new CompoundNBT());
		
		CompoundNBT nbt = itemStack.getTag();
		assert nbt != null;
		nbt.putInt("Energy", this.storage.getEnergyStored());
		
		return nbt;
	}

	@Override
	public void deserializeNBT(CompoundNBT nbt) {
		
		if(itemStack.hasTag())
			this.storage.setEnergy(nbt.getInt("Energy"));
	}

}

Console:

---- Minecraft Crash Report ----
// There are four lights!

Time: 19/05/20 9.35
Description: Ticking block entity

java.lang.ClassCastException: net.minecraftforge.common.util.LazyOptional cannot be cast to net.minecraftforge.energy.IEnergyStorage
	at com.olivemod.blocks.machine.energy.generator.glowstone_generator.TileEntityGlowStoneGenerator.charge(TileEntityGlowStoneGenerator.java:111) ~[?:?] {re:classloading}
	at com.olivemod.blocks.machine.energy.generator.glowstone_generator.TileEntityGlowStoneGenerator.tick(TileEntityGlowStoneGenerator.java:102) ~[?:?] {re:classloading}
	at net.minecraft.world.World.func_217391_K(World.java:671) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:370) ~[?:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:867) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:802) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:648) [?:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Server thread
Stacktrace:
	at com.olivemod.blocks.machine.energy.generator.glowstone_generator.TileEntityGlowStoneGenerator.charge(TileEntityGlowStoneGenerator.java:111)
	at com.olivemod.blocks.machine.energy.generator.glowstone_generator.TileEntityGlowStoneGenerator.tick(TileEntityGlowStoneGenerator.java:102)

-- Block entity being ticked --
Details:
	Name: olivemod:glowstone_generator // com.olivemod.blocks.machine.energy.generator.glowstone_generator.TileEntityGlowStoneGenerator
	Block: Block{olivemod:glowstone_generator}[facing=north]
	Block location: World: (127,4,-196), Chunk: (at 15,0,12 in 7,-13; contains blocks 112,0,-208 to 127,255,-193), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
	Block: Block{olivemod:glowstone_generator}[facing=north]
	Block location: World: (127,4,-196), Chunk: (at 15,0,12 in 7,-13; contains blocks 112,0,-208 to 127,255,-193), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
Stacktrace:
	at net.minecraft.world.World.func_217391_K(World.java:671)
	at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:370)

-- Affected level --
Details:
	All players: 0 total; []
	Chunk stats: ServerChunkCache: 2025
	Level dimension: DimensionType{minecraft:overworld}
	Level name: New World
	Level seed: 7690030581214142000
	Level generator: ID 01 - flat, ver 0. Features enabled: true
	Level generator options: {}
	Level spawn location: World: (128,4,-192), Chunk: (at 0,0,0 in 8,-12; contains blocks 128,0,-192 to 143,255,-177), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
	Level time: 941 game time, 941 day time
	Level storage version: 0x04ABD - Anvil
	Level weather: Rain time: 113334 (now: false), thunder time: 79221 (now: false)
	Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:867)
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:802)
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:648)
	at java.lang.Thread.run(Thread.java:748)

-- System Details --
Details:
	Minecraft Version: 1.14.4
	Minecraft Version ID: 1.14.4
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 1.8.0_231, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 2652407688 bytes (2529 MB) / 3642753024 bytes (3474 MB) up to 7635730432 bytes (7282 MB)
	CPUs: 4
	JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx8G
	ModLauncher: 4.1.0+62+5bfa59b
	ModLauncher launch target: fmluserdevclient
	ModLauncher naming: mcp
	ModLauncher services: 
		/eventbus-1.0.0-service.jar eventbus PLUGINSERVICE 
		/forge-1.14.4-28.2.10_mapped_snapshot_20190719-1.14.3-launcher.jar object_holder_definalize PLUGINSERVICE 
		/forge-1.14.4-28.2.10_mapped_snapshot_20190719-1.14.3-launcher.jar runtime_enum_extender PLUGINSERVICE 
		/accesstransformers-1.0.5-shadowed.jar accesstransformer PLUGINSERVICE 
		/forge-1.14.4-28.2.10_mapped_snapshot_20190719-1.14.3-launcher.jar capability_inject_definalize PLUGINSERVICE 
		/forge-1.14.4-28.2.10_mapped_snapshot_20190719-1.14.3-launcher.jar runtimedistcleaner PLUGINSERVICE 
		/forge-1.14.4-28.2.10_mapped_snapshot_20190719-1.14.3-launcher.jar fml TRANSFORMATIONSERVICE 
	FML: 28.2
	Forge: net.minecraftforge:28.2.10
	FML Language Providers: 
		[email protected]
		minecraft@1
	Mod List: 
		client-extra.jar Minecraft {[email protected] DONE}
		forge-1.14.4-28.2.10_mapped_snapshot_20190719-1.14.3-recomp.jar Forge {[email protected] DONE}
		main Example Mod {olivemod@NONE DONE}
	Player Count: 0 / 8; []
	Data Packs: vanilla, mod:forge, mod:olivemod
	Type: Integrated Server (map_client.txt)
	Is Modded: Definitely; Client brand changed to 'forge'

 

Sorry for all topics I am creating in these days, I was learning in 1.12.2 and switch to 1.14.4 seems a nightmare.

If someone could give me some gitHub'projects to learn from, too, would be great.

Link to comment
Share on other sites

LazyOptional's are wrappers for a supplier that may or may not be stored at that time.

With LazyOptional's you gotta check the type for whether it has a supplier or not by checking isPresent() on it, then use getValue(). You could also just skip the check and use getValue() but you'd have to then check to see if the returned value is null. So basically anywhere you are using a LazyOptional you have to use the getValue() method on it if you actually want the value.

EDIT: yeah ignore this I messed up reading the LazyOptional methods last night and didn't notice getValue() was a private method and that it forces you to supply a consumer to ifPresent.

Edited by AtlaStar
Made a dumb dumb when tired
Link to comment
Share on other sites

1 hour ago, AtlaStar said:

LazyOptional's are wrappers for a supplier that may or may not be stored at that time.

With LazyOptional's you gotta check the type for whether it has a supplier or not by checking isPresent() on it, then use getValue(). You could also just skip the check and use getValue() but you'd have to then check to see if the returned value is null. So basically anywhere you are using a LazyOptional you have to use the getValue() method on it if you actually want the value.

Could you give me link some project on gitHub, just to understand better?

Thanks

Link to comment
Share on other sites

3 hours ago, AtlaStar said:

LazyOptional's are wrappers for a supplier that may or may not be stored at that time.

With LazyOptional's you gotta check the type for whether it has a supplier or not by checking isPresent() on it, then use getValue(). You could also just skip the check and use getValue() but you'd have to then check to see if the returned value is null. So basically anywhere you are using a LazyOptional you have to use the getValue() method on it if you actually want the value.

?? that is all false

 

if you dont know if it has a cap use for interfacing w/ other tileEntitys

energyCapabilitiesExternal.ifPesent(lambda goes here)

 

if you know if you have a cap there use

energyCapabilitiesExternal.orElsethrow(throw a runtimeexception there)

 

  • Like 1
Link to comment
Share on other sites

2 hours ago, loordgek said:

?? that is all false

 

if you dont know if it has a cap use for interfacing w/ other tileEntitys

energyCapabilitiesExternal.ifPesent(lambda goes here)

 

if you know if you have a cap there use

energyCapabilitiesExternal.orElsethrow(throw a runtimeexception there)

 

Please, you all are getting me confused. 

I just wanna make an item with Energy Capability(and lears something new), and the glowstone generatore should charge It.

But please, I am new in modding, so try to don't get confused me.

 

To make that item, what I should do? Last topic that said to attach AttachingCapabilitiesEvent, but I cannot did it

And how I should check the Capability of item in the charge slot of Glowstone generator

 

And I say again, if someone could give me some project, It would be easier. So I won't annoy anybody more.

Anyway, thanks for support

Edited by dyno
Link to comment
Share on other sites

I'm not using the energy capability, but rather items, but the same features apply.

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/block/MillstoneBlock.java#L61

I'm also using orElse(null), but I wrote the code before figuring out ifPresent.

 

cap = getCap(CapType).orElse(null)
if(cap != null) {
    //code here
}

directly converts to

getCap(CapType).ifPresent(cap -> {
    //code here
}

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

dont use AttachingCapabilitiesEvent override initCapablilty in your item class.

 

7 hours ago, dyno said:

private SettableEnergyStorage storage = new SettableEnergyStorage(2500, 100, 100);

private final LazyOptional<EnergyStorage> energyCapabilitiesExternal = LazyOptional.of(() -> this.storage);

 

you cant do that because items are singeton

 

1 hour ago, dyno said:

if someone could give me some project

https://gist.github.com/e3986c6684e536940bba5494a51c13f2

Link to comment
Share on other sites

1 hour ago, loordgek said:

dont use AttachingCapabilitiesEvent override initCapablilty in your item class.

 

 

you cant do that because items are singeton

 

https://gist.github.com/e3986c6684e536940bba5494a51c13f2

 

Ok, thanks. What about charge() in TileEntityGlowstoneGenerator? I have still that crush. I have It on the cast from CapabilitEnergy.Energy to IEnergyStorage

 

How could I make to generator's TE get the Energy storage of the battery and charge It?

 

Link to comment
Share on other sites

19 minutes ago, loordgek said:

dont cast use


itemStack.getCapability(CapabilityEnergy.ENERGY).ifPresent(storage -> {do your stuff here})

 

Sure a stupid question, whose storage is that?

Suppose battery's, how TE get It?

 

And how could it return the storage? Because then I should use IEnergyStorage#receiveEnergy()

 

Could you link a gitHub's project about something like? A generator

Edited by dyno
Link to comment
Share on other sites

1 hour ago, dyno said:

Sure a stupid question, whose storage is that?

It is the ENERGY capability attached to itemstack. As evidenced by the code, itemstack.getCapability(ENERGY) method call.

If that stack represents a battery, then its the battery.

1 hour ago, dyno said:

how TE get It?

Presumably your TE has item slots, using an ItemHandler capability, so your TE just needs to look into its inventory and go "hey, batteries!"

Your TE also has an energy storage capability it does the same thing, only on its own capability (there's no need to call getCapability inside your own TE, all that does is return a field the TE already has, wrapped in a LazyOptional, so you may as well just access the field).

1 hour ago, dyno said:

And how could it return the storage?

You ... don't?

1 hour ago, dyno said:

Could you link a gitHub's project about something like? A generator

I don't know of any, but the process here is the same as it would be for items, just a different capability that returns a different data type. You call ifPresent, do some operations on that data, and it's automatically saved. Because that's what happens when you operate directly on the stored data.

 

ItemStackHandler is the ITEM capability equivalent to EVERGY's EnergyStorage.

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/entity/SifterTileEntity.java#L39

The lazy optional wrapper:

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/entity/SifterTileEntity.java#L42

Accessing the field data directly:

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/entity/SifterTileEntity.java#L109

The TE's getCapability, returning the wrapper
https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/entity/SifterTileEntity.java#L164-L166

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

8 hours ago, loordgek said:

?? that is all false

 

if you dont know if it has a cap use for interfacing w/ other tileEntitys

energyCapabilitiesExternal.ifPesent(lambda goes here)

 

if you know if you have a cap there use

energyCapabilitiesExternal.orElsethrow(throw a runtimeexception there)

 

I was dead tired looking at the LasyOptional type and didn't notice getValue was a private member and that the class forces you to pass a consumer, so my mistake.

Link to comment
Share on other sites

If you really want to return something obtained from the value of a LazyOptional, you could use LazyOptional#orElse.

 

Note that in 99% of the cases you could just use ifPresent and do what you want in there.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

2 hours ago, DavidM said:

If you really want to return something obtained from the value of a LazyOptional, you could use LazyOptional#orElse.

 

Note that in 99% of the cases you could just use ifPresent and do what you want in there.

My problem Is that I wanna charge item when Is in the slot, but I didn't understand how because I am new in 1.14.4(before I made in 1.12.2), and it was easier.

 

What I would do is this:

IEnergyStorage storage = itemstack.getCapability(CapabilityEnergy.ENERGY), how did in 1.12.2.

I should write ifPresent, but I don't understand what write at ifPresent(energy -> ...).

I should call method to charge battery, but how if I don't get the its storage.

I tried (energy -> enegy.receiveEnergy()) but of course battery doesn't charge because It Is the generator's storage

 

Link to comment
Share on other sites

23 hours ago, Draco18s said:

This


cap = getCap(CapType).orElse(null)
if(cap != null) {
    //code here
}

directly converts to


getCap(CapType).ifPresent(cap -> {
    //code here
}

 

 

  • Haha 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I am making a mod for 1.20.6 I want to make a randomly generated structure using jigsaw but want to guarantee that a specific room is generated and not more than once. I cant generate starting from this room as I need to do this for 2 different rooms. I cant find more info on this in the Minecraft wiki or the forums. is it possible to set a min and max count for structure pieces?
    • the problem is I am using java 17, and the is no error log. the latest I have is from 02.04.2024. Its like the server just refuses to start. Here is a screenshot: https://ibb.co/S3kffy0
    • ---- Minecraft Crash Report ---- // There are four lights! Time: 22/05/24 03:33 Description: Initializing game java.lang.InternalError: Should not get here     at sun.nio.fs.WindowsNativeDispatcher.GetFinalPathNameByHandle(Native Method) ~[?:1.8.0_51] {}     at sun.nio.fs.WindowsLinkSupport.getFinalPath(WindowsLinkSupport.java:77) ~[?:1.8.0_51] {}     at sun.nio.fs.WindowsLinkSupport.getRealPath(WindowsLinkSupport.java:242) ~[?:1.8.0_51] {}     at sun.nio.fs.WindowsPath.toRealPath(WindowsPath.java:836) ~[?:1.8.0_51] {}     at sun.nio.fs.WindowsPath.toRealPath(WindowsPath.java:44) ~[?:1.8.0_51] {}     at net.minecraft.world.storage.SaveFormat.<init>(SaveFormat.java:75) ~[?:?] {re:mixin,re:classloading,pl:mixin:APP:modernfix-forge.mixins.json:perf.skip_first_datapack_reload.SaveFormatAccessor,pl:mixin:A}     at net.minecraft.client.Minecraft.<init>(Minecraft.java:445) [?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:modernfix-common.mixins.json:feature.measure_time.MinecraftMixin,pl:mixin:APP:modernfix-common.mixins.json:perf.dedicated_reload_executor.MinecraftMixin,pl:mixin:APP:modernfix-common.mixins.json:bugfix.concurrency.MinecraftMixin,pl:mixin:APP:modernfix-common.mixins.json:bugfix.world_leaks.MinecraftMixin,pl:mixin:APP:modernfix-forge.mixins.json:feature.measure_time.MinecraftMixin_Forge,pl:mixin:APP:modernfix-forge.mixins.json:perf.skip_first_datapack_reload.MinecraftMixin,pl:mixin:APP:modernfix-forge.mixins.json:perf.blast_search_trees.MinecraftMixin,pl:mixin:APP:flywheel.mixins.json:ShaderCloseMixin,pl:mixin:APP:architectury.mixins.json:MixinMinecraft,pl:mixin:APP:assets/botania/botania.mixins.json:AccessorMinecraft,pl:mixin:APP:create.mixins.json:WindowResizeMixin,pl:mixin:APP:securitycraft.mixins.json:camera.MinecraftMixin,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:149) [?:?] {re:classloading,pl:runtimedistcleaner:A}     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {}     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {}     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {}     at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:37) [forge-1.16.5-36.2.42.jar:36.2] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$533/1770125555.call(Unknown Source) [forge-1.16.5-36.2.42.jar:36.2] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?] {re:classloading}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] {re:classloading} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at sun.nio.fs.WindowsNativeDispatcher.GetFinalPathNameByHandle(Native Method) ~[?:1.8.0_51] {}     at sun.nio.fs.WindowsLinkSupport.getFinalPath(WindowsLinkSupport.java:77) ~[?:1.8.0_51] {}     at sun.nio.fs.WindowsLinkSupport.getRealPath(WindowsLinkSupport.java:242) ~[?:1.8.0_51] {}     at sun.nio.fs.WindowsPath.toRealPath(WindowsPath.java:836) ~[?:1.8.0_51] {}     at sun.nio.fs.WindowsPath.toRealPath(WindowsPath.java:44) ~[?:1.8.0_51] {}     at net.minecraft.world.storage.SaveFormat.<init>(SaveFormat.java:75) ~[?:?] {re:mixin,re:classloading,pl:mixin:APP:modernfix-forge.mixins.json:perf.skip_first_datapack_reload.SaveFormatAccessor,pl:mixin:A}     at net.minecraft.client.Minecraft.<init>(Minecraft.java:445) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:modernfix-common.mixins.json:feature.measure_time.MinecraftMixin,pl:mixin:APP:modernfix-common.mixins.json:perf.dedicated_reload_executor.MinecraftMixin,pl:mixin:APP:modernfix-common.mixins.json:bugfix.concurrency.MinecraftMixin,pl:mixin:APP:modernfix-common.mixins.json:bugfix.world_leaks.MinecraftMixin,pl:mixin:APP:modernfix-forge.mixins.json:feature.measure_time.MinecraftMixin_Forge,pl:mixin:APP:modernfix-forge.mixins.json:perf.skip_first_datapack_reload.MinecraftMixin,pl:mixin:APP:modernfix-forge.mixins.json:perf.blast_search_trees.MinecraftMixin,pl:mixin:APP:flywheel.mixins.json:ShaderCloseMixin,pl:mixin:APP:architectury.mixins.json:MixinMinecraft,pl:mixin:APP:assets/botania/botania.mixins.json:AccessorMinecraft,pl:mixin:APP:create.mixins.json:WindowResizeMixin,pl:mixin:APP:securitycraft.mixins.json:camera.MinecraftMixin,pl:mixin:A,pl:runtimedistcleaner:A} -- Initialization -- Details: Stacktrace:     at net.minecraft.client.main.Main.main(Main.java:149) [?:?] {re:classloading,pl:runtimedistcleaner:A}     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {}     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {}     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {}     at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:37) [forge-1.16.5-36.2.42.jar:36.2] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$533/1770125555.call(Unknown Source) [forge-1.16.5-36.2.42.jar:36.2] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?] {re:classloading}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] {re:classloading} -- System Details -- Details:     Minecraft Version: 1.16.5     Minecraft Version ID: 1.16.5     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: 4067827920 bytes (3879 MB) / 6358564864 bytes (6064 MB) up to 10737418240 bytes (10240 MB)     CPUs: 12     JVM Flags: 9 total; -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M -Xmx10240m -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -XX:+IgnoreUnrecognizedVMOptions     ModLauncher: 8.1.3+8.1.3+main-8.1.x.c94d18ec     ModLauncher launch target: fmlclient     ModLauncher naming: srg     ModLauncher services:          /mixin-0.8.4.jar mixin PLUGINSERVICE          /eventbus-4.0.0.jar eventbus PLUGINSERVICE          /forge-1.16.5-36.2.42.jar object_holder_definalize PLUGINSERVICE          /forge-1.16.5-36.2.42.jar runtime_enum_extender PLUGINSERVICE          /accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE          /forge-1.16.5-36.2.42.jar capability_inject_definalize PLUGINSERVICE          /forge-1.16.5-36.2.42.jar runtimedistcleaner PLUGINSERVICE          /mixin-0.8.4.jar mixin TRANSFORMATIONSERVICE          /forge-1.16.5-36.2.42.jar fml TRANSFORMATIONSERVICE      FML: 36.2     Forge: net.minecraftforge:36.2.42     FML Language Providers:          [email protected]         minecraft@1     Mod List:          SaveMyStronghold-1.16.4-1.0.jar                   |Save My Stronghold!           |savemystronghold              |1.16.4-1.0          |COMMON_SET|Manifest: NOSIGNATURE         create-stuff-additions1.16.5_v1.1.6.jar           |Create Stuff Additions        |create_stuff_additions        |1.1.6               |COMMON_SET|Manifest: NOSIGNATURE         mowziesmobs-1.5.27.jar                            |Mowzie's Mobs                 |mowziesmobs                   |1.5.27              |COMMON_SET|Manifest: NOSIGNATURE         blue_skies-1.16.5-1.1.3.jar                       |Blue Skies                    |blue_skies                    |1.1.3               |COMMON_SET|Manifest: NOSIGNATURE         supermartijn642configlib-1.1.8-forge-mc1.16.jar   |SuperMartijn642's Config Libra|supermartijn642configlib      |1.1.8               |COMMON_SET|Manifest: NOSIGNATURE         TrashSlot_1.16.3-12.2.1.jar                       |TrashSlot                     |trashslot                     |12.2.1              |COMMON_SET|Manifest: NOSIGNATURE         Tinkers Reforged 1.16.5-0.0.6.jar                 |Tinkers Reforged              |tinkers_reforged              |0.0.6               |COMMON_SET|Manifest: NOSIGNATURE         tinkersarchery-1.2.0.jar                          |Tinkers' Archery              |tinkersarchery                |1.2.0               |COMMON_SET|Manifest: NOSIGNATURE         rechiseled-1.1.6-forge-mc1.16.jar                 |Rechiseled                    |rechiseled                    |1.1.6               |COMMON_SET|Manifest: NOSIGNATURE         infernal-expansion-1.16.5-2.5.0.jar               |Infernal Expansion            |infernalexp                   |2.5.0               |COMMON_SET|Manifest: NOSIGNATURE         Bountiful Baubles FORGE-1.16.3-0.0.2.jar          |Bountiful Baubles             |bountifulbaubles              |NONE                |COMMON_SET|Manifest: NOSIGNATURE         TinkersLevellingAddon-1.16.5-1.1.1.jar            |Tinkers' Levelling Addon      |tinkerslevellingaddon         |1.1.1               |COMMON_SET|Manifest: NOSIGNATURE         libraryferret-forge-1.16.5-4.0.0.jar              |Library ferret                |libraryferret                 |4.0.0               |COMMON_SET|Manifest: NOSIGNATURE         stalwart-dungeons-1.16.5-1.1.7.jar                |Stalwart Dungeons             |stalwart_dungeons             |1.1.7               |COMMON_SET|Manifest: NOSIGNATURE         obscure_api-11.jar                                |Obscure API                   |obscure_api                   |11                  |COMMON_SET|Manifest: NOSIGNATURE         InsaneLib-1.4.2-mc1.16.5.jar                      |InsaneLib                     |insanelib                     |1.4.2               |COMMON_SET|Manifest: NOSIGNATURE         Waystones_1.16.5-7.6.4.jar                        |Waystones                     |waystones                     |7.6.4               |COMMON_SET|Manifest: NOSIGNATURE         journeymap-1.16.5-5.8.5p7.jar                     |Journeymap                    |journeymap                    |5.8.5p7             |COMMON_SET|Manifest: NOSIGNATURE         modernfix-forge-5.17.0+mc1.16.5.jar               |ModernFix                     |modernfix                     |5.17.0+mc1.16.5     |COMMON_SET|Manifest: NOSIGNATURE         jei-1.16.5-7.8.0.1011.jar                         |Just Enough Items             |jei                           |7.8.0.1011          |COMMON_SET|Manifest: NOSIGNATURE         citadel-1.8.1-1.16.5.jar                          |Citadel                       |citadel                       |1.8.1               |COMMON_SET|Manifest: NOSIGNATURE         alexsmobs-1.12.1.jar                              |Alex's Mobs                   |alexsmobs                     |1.12.1              |COMMON_SET|Manifest: NOSIGNATURE         Artifacts-1.16.5-2.10.5.jar                       |Artifacts                     |artifacts                     |1.16.5-2.10.5       |COMMON_SET|Manifest: NOSIGNATURE         OPF-1.16.x-v2.jar                                 |Online Picture Frame 2        |opf                           |0                   |COMMON_SET|Manifest: NOSIGNATURE         Obscuria's Tooltips 1.0.0.jar                     |Obscuria's Tooltips           |ob_tooltips                   |1.0.0               |COMMON_SET|Manifest: NOSIGNATURE         create-confectionery1.16.5_v1.0.2.jar             |Create Confectionery          |create_confectionery          |1.0.2               |COMMON_SET|Manifest: NOSIGNATURE         sophisticatedbackpacks-1.16.5-3.15.20.755.jar     |Sophisticated Backpacks       |sophisticatedbackpacks        |1.16.5-3.15.20.755  |COMMON_SET|Manifest: NOSIGNATURE         Desert Upgrade 1.2.7 - 1.16.5.jar                 |Desert Upgrade                |desert_upgrade                |1.2.7               |COMMON_SET|Manifest: NOSIGNATURE         ProgressiveBosses-3.4.3-mc1.16.5.jar              |Progressive Bosses            |progressivebosses             |3.4.3               |COMMON_SET|Manifest: NOSIGNATURE         mahoutsukai-1.16.5-v1.34.62.jar                   |Mahou Tsukai                  |mahoutsukai                   |1.16.5-v1.34.62     |COMMON_SET|Manifest: NOSIGNATURE         iceandfire-2.1.12-1.16.5-patch-1.jar              |Ice and Fire                  |iceandfire                    |2.1.12-1.16.5-patch-|COMMON_SET|Manifest: NOSIGNATURE         fusion-1.1.1-forge-mc1.16.jar                     |Fusion                        |fusion                        |1.1.1               |COMMON_SET|Manifest: NOSIGNATURE         immersive-armors-1.5.1+1.16.5-forge.jar           |Immersive Armors              |immersive_armors              |1.5.1+1.16.5        |COMMON_SET|Manifest: NOSIGNATURE         carryon-1.16.5-1.15.6.24.jar                      |Carry On                      |carryon                       |1.15.6.24           |COMMON_SET|Manifest: NOSIGNATURE         mysticalworld-1.16.5-0.3.6.27.jar                 |Mystical World                |mysticalworld                 |0.3.6.27            |COMMON_SET|Manifest: NOSIGNATURE         forge-1.16.5-36.2.42-universal.jar                |Forge                         |forge                         |36.2.42             |COMMON_SET|Manifest: 22:af:21:d8:19:82:7f:93:94:fe:2b:ac:b7:e4:41:57:68:39:87:b1:a7:5c:c6:44:f9:25:74:21:14:f5:0d:90         LostTrinkets-1.16.5-0.1.27.jar                    |Lost Trinkets                 |losttrinkets                  |0.1.27              |COMMON_SET|Manifest: NOSIGNATURE         dmcloot-1.16.5-beta-sept0722.jar                  |DMCLoot                       |dmcloot                       |1.16.5              |COMMON_SET|Manifest: NOSIGNATURE         BloodMagic-1.16.4-3.1.13-39.jar                   |Blood Magic                   |bloodmagic                    |1.16.4-3.1.13-39    |COMMON_SET|Manifest: NOSIGNATURE         chococraft-1.16.5-0.3.9.jar                       |Chococraft 4                  |chococraft                    |0.3.9               |COMMON_SET|Manifest: NOSIGNATURE         structure_gel-1.16.5-1.7.8.jar                    |Structure Gel API             |structure_gel                 |1.7.8               |COMMON_SET|Manifest: NOSIGNATURE         DungeonsArise-1.16.5-2.1.49-beta.jar              |When Dungeons Arise           |dungeons_arise                |2.1.49              |COMMON_SET|Manifest: NOSIGNATURE         CraftingTweaks_1.16.5-12.2.1.jar                  |Crafting Tweaks               |craftingtweaks                |12.2.1              |COMMON_SET|Manifest: NOSIGNATURE         dungeons_1.10.3_mc1.16.5.jar                      |Minecraft Dungeons            |duneons                       |1.10.3              |COMMON_SET|Manifest: NOSIGNATURE         forge-1.16.5-36.2.42-client.jar                   |Minecraft                     |minecraft                     |1.16.5              |COMMON_SET|Manifest: NOSIGNATURE         TConstruct-1.16.5-3.3.4.335.jar                   |Tinkers' Construct            |tconstruct                    |3.3.4.335           |COMMON_SET|Manifest: NOSIGNATURE         FarmersDelight-1.16.5-0.6.0.jar                   |Farmer's Delight              |farmersdelight                |1.16.5-0.6.0        |COMMON_SET|Manifest: NOSIGNATURE         culturaldelights-1.16.5-0.9.2.jar                 |Cultural Delights             |culturaldelights              |0.9.2               |COMMON_SET|Manifest: NOSIGNATURE         ends_delight-1.16.5-1.8.jar                       |End's Delight                 |ends_delight                  |1.16.5-1.8          |COMMON_SET|Manifest: NOSIGNATURE         tinker_rapier-1.1.4-1.16.5.jar                    |Tinkers' Rapier               |tinker_rapier                 |1.1.4-1.16.5        |COMMON_SET|Manifest: NOSIGNATURE         Jade-1.16.4-2.8.3.jar                             |Jade                          |jade                          |2.8.3               |COMMON_SET|Manifest: NOSIGNATURE         Lollipop-1.16.5-3.2.9.jar                         |Lollipop                      |lollipop                      |3.2.9               |COMMON_SET|Manifest: NOSIGNATURE         CreativeCore_v2.2.1_mc1.16.5.jar                  |CreativeCore                  |creativecore                  |2.0.0               |COMMON_SET|Manifest: NOSIGNATURE         supermartijn642corelib-1.1.17a-forge-mc1.16.jar   |SuperMartijn642's Core Lib    |supermartijn642corelib        |1.1.17a             |COMMON_SET|Manifest: NOSIGNATURE         Botania-1.16.5-420.3.jar                          |Botania                       |botania                       |1.16.5-420.3        |COMMON_SET|Manifest: NOSIGNATURE         born_in_chaos_1.16_1.3.jar                        |Born in Chaos                 |born_in_chaos_v1              |1.0.0               |COMMON_SET|Manifest: NOSIGNATURE         jeiintegration_1.16.5-7.1.0.22.jar                |JEI Integration               |jeiintegration                |7.1.0.22            |COMMON_SET|Manifest: NOSIGNATURE         TheForbidden-1.0.2-ByShadowMech.jar               |The Forbidden                 |theforbidden                  |1.0.1               |COMMON_SET|Manifest: NOSIGNATURE         Goblins_Dungeons_1.0.6-1.16.jar                   |Goblins & Dungeons            |goblinsanddungeons            |1.0.6               |COMMON_SET|Manifest: NOSIGNATURE         L_Enders Cataclysm-0.48 Changed Theme -1.16.5.jar |Cataclysm Mod                 |cataclysm                     |1.0                 |COMMON_SET|Manifest: NOSIGNATURE         flywheel-1.16-0.2.5.jar                           |Flywheel                      |flywheel                      |1.16-0.2.5          |COMMON_SET|Manifest: NOSIGNATURE         create-mc1.16.5_v0.3.2g.jar                       |Create                        |create                        |v0.3.2g             |COMMON_SET|Manifest: NOSIGNATURE         createdeco-1.1.2-1.16.5.jar                       |Create Deco                   |createdeco                    |1.1.2-1.16.5        |COMMON_SET|Manifest: NOSIGNATURE         curios-forge-1.16.5-4.1.0.0.jar                   |Curios API                    |curios                        |1.16.5-4.1.0.0      |COMMON_SET|Manifest: NOSIGNATURE         Atum-1.16.5-2.2.12.jar                            |Atum 2                        |atum                          |1.16.5-2.2.12       |COMMON_SET|Manifest: NOSIGNATURE         SpartanShields-1.16.5-2.1.2.jar                   |Spartan Shields               |spartanshields                |2.1.2               |COMMON_SET|Manifest: NOSIGNATURE         Patchouli-1.16.4-53.3.jar                         |Patchouli                     |patchouli                     |1.16.4-53.3         |VALIDATE  |Manifest: NOSIGNATURE         Mantle-1.16.5-1.6.157.jar                         |Mantle                        |mantle                        |1.6.157             |COMMON_SET|Manifest: NOSIGNATURE         arsomega-1.5.jar                                  |Ars Omega                     |arsomega                      |1.16.5-1.5          |COMMON_SET|Manifest: NOSIGNATURE         AutoRegLib-1.6-49.jar                             |AutoRegLib                    |autoreglib                    |1.6-49              |COMMON_SET|Manifest: NOSIGNATURE         Quark-r2.4-322.jar                                |Quark                         |quark                         |r2.4-322            |COMMON_SET|Manifest: NOSIGNATURE         [1.16.5] SecurityCraft v1.9.9.jar                 |SecurityCraft                 |securitycraft                 |v1.9.9              |COMMON_SET|Manifest: NOSIGNATURE         elevatorid-1.16.5-1.7.13.jar                      |Elevator Mod                  |elevatorid                    |1.16.5-1.7.13       |COMMON_SET|Manifest: NOSIGNATURE         tombstone-1.16.5-6.8.16.jar                       |Corail Tombstone              |tombstone                     |6.8.16              |COMMON_SET|Manifest: NOSIGNATURE         Argentina's delight 1.16.5 (3.0 beta).jar         |Argentina's Delight           |argentinas_delight            |1.3                 |COMMON_SET|Manifest: NOSIGNATURE         swiaf-1.16.5-1.1.2.jar                            |Spartan Weaponry: Ice and Fire|swiaf                         |1.16.5-1.1.2        |COMMON_SET|Manifest: NOSIGNATURE         TheAbyss2 2.2.3-4 1.16.5.jar                      |TheAbyss                      |theabyss                      |2.2.3-4             |COMMON_SET|Manifest: NOSIGNATURE         SpartanWeaponry-1.16.5-2.2.2.jar                  |Spartan Weaponry              |spartanweaponry               |2.2.2               |COMMON_SET|Manifest: NOSIGNATURE         architectury-1.32.68.jar                          |Architectury                  |architectury                  |1.32.68             |COMMON_SET|Manifest: NOSIGNATURE         lootr-1.16.5-0.2.19.51.jar                        |Lootr                         |lootr                         |0.2.19.51           |COMMON_SET|Manifest: NOSIGNATURE         ferritecore-2.1.1-forge.jar                       |Ferrite Core                  |ferritecore                   |2.1.1               |COMMON_SET|Manifest: 41:ce:50:66:d1:a0:05:ce:a1:0e:02:85:9b:46:64:e0:bf:2e:cf:60:30:9a:fe:0c:27:e0:63:66:9a:84:ce:8a         moredragoneggs-2.5.jar                            |More Dragon Eggs              |moredragoneggs                |2.5                 |COMMON_SET|Manifest: NOSIGNATURE         cloth-config-4.17.101-forge.jar                   |Cloth Config v4 API           |cloth-config                  |4.17.101            |COMMON_SET|Manifest: NOSIGNATURE         PuzzlesLib-v1.0.15-1.16.5-Forge.jar               |Puzzles Lib                   |puzzleslib                    |1.0.15              |COMMON_SET|Manifest: 9a:09:85:98:65:c4:8c:11:c5:49:f6:d6:33:23:39:df:8d:b4:ff:92:84:b8:bd:a5:83:9f:ac:7f:2a:d1:4b:6a         the_bumblezone_forge-3.2.1+1.16.5.jar             |The Bumblezone                |the_bumblezone                |3.2.1+1.16.5        |COMMON_SET|Manifest: NOSIGNATURE         Obscuria's Essentials 3.0.0.jar                   |Obscuria's Essentials         |ob_core                       |3.0.0               |COMMON_SET|Manifest: NOSIGNATURE         Blood-Smeltery-1.16.5-1.1.5a.jar                  |Blood Smeltery                |bloodsmeltery                 |1.1.5a              |COMMON_SET|Manifest: NOSIGNATURE         expandability-2.0.1-forge.jar                     |ExpandAbility                 |expandability                 |2.0.1               |COMMON_SET|Manifest: NOSIGNATURE         JustEnoughGolems - Magma Release (v2.2.1-HF) 1.16.|JustEnoughGolems              |justenoughgolems              |Magma Release (v2.2.|COMMON_SET|Manifest: NOSIGNATURE         PlayerRevive_v2.0.0-pre04_mc1.16.5.jar            |PlayerRevive                  |playerrevive                  |2.0.0               |COMMON_SET|Manifest: NOSIGNATURE         geckolib-forge-1.16.5-3.0.106.jar                 |GeckoLib                      |geckolib3                     |3.0.106             |COMMON_SET|Manifest: NOSIGNATURE         ars_nouveau-1.16.5-1.25.10.jar                    |Ars Nouveau                   |ars_nouveau                   |1.25.10             |COMMON_SET|Manifest: NOSIGNATURE         EnchantingInfuser-v1.0.2-1.16.5-Forge.jar         |Enchanting Infuser            |enchantinginfuser             |1.0.2               |COMMON_SET|Manifest: 9a:09:85:98:65:c4:8c:11:c5:49:f6:d6:33:23:39:df:8d:b4:ff:92:84:b8:bd:a5:83:9f:ac:7f:2a:d1:4b:6a         aquamirae-5.4.API11.jar                           |Aquamirae                     |aquamirae                     |5.4.API11           |COMMON_SET|Manifest: NOSIGNATURE         createaddition-1.16.5-20220129a.jar               |Create Crafts & Additions     |createaddition                |1.16.5-20220129a    |COMMON_SET|Manifest: NOSIGNATURE         xptome-1.16.5-v2.1.5.jar                          |XP Tome                       |xpbook                        |v2.1.5              |COMMON_SET|Manifest: NOSIGNATURE     Crash Report UUID: 57fb9766-0046-4b87-ace9-446de1e70ad0     Launched Version: 1.16.5-forge-36.2.42     Backend library: LWJGL version 3.2.2 build 10     Backend API: NVIDIA GeForce RTX 2060 SUPER/PCIe/SSE2 GL version 4.6.0 NVIDIA 555.85, NVIDIA Corporation     GL Caps: Using framebuffer using OpenGL 3.0     Using VBOs: Yes     Is Modded: Definitely; Client brand changed to 'forge'     Type: Client (map_client.txt)     CPU: 12x AMD Ryzen 5 5600G with Radeon Graphics 
    • Im having this problem where i open the run.bat file with the following code: "C:\Program Files\Java\jre-1.8\bin\javaw.exe" -Xmx6000M -Xms6000M -jar forge-1.12.2-14.23.5.2860.jar nogui PAUSE This creates all the folders and files that it would normally create (eula.txt, mods, server.properties, etc) but it wont generate a world, the eula has been accepted, but it still does nothing, and it wont say anything on the cmd besides leaving a blank paragraph and the PAUSE code. I dont know what to do, i updated the last version of java 8, i tried many forge versions, including the latest, the recomended and a few others, i restarted my pc various times, nothing. Normal vanilla servers work just fine, its the forge one that doesnt do the thing. Im desperate, i've been trying to create a 1.20.2 server and for some reason every tweak i made for ram usage never worked, it still used 1gb to 3gb max, world not loading correctly, countless ticks behind. try a 1.12.2 server, got nowhere, and the weirdest thing is that i already made some 1.12.2 forge servers on this same pc a few years ago and had no trouble at all. if anybody knows what is happening please leave a comment, i will thank you with all my heart.
    • We've actually started running into a new problem, whilst adding more mods may work, it makes it so that we're unable to connect to our server, even on LAN. Does anyone know what this error message means? We're not getting any helpful output into console either. Edit: found the logs for attempting to connect [21:46:00] [Netty Epoll Client IO #0/WARN]: Your custom tfmg:coking recipe (tfmg:coking/coal_coke) specified a duration. Durations have no impact on this type of recipe. [21:46:00] [Render thread/INFO]: Reloaded entity icon resources! [21:46:00] [Netty Epoll Client IO #0/WARN]: Your custom createaddition:rolling/copper_plate recipe (createaddition:rolling/copper_plate) specified a duration. Durations have no impact on this type of recipe. [21:46:00] [Render thread/INFO]: Redirecting net/minecraft/world/level/chunk/LevelChunk$EntityCreationType [21:46:00] [Render thread/INFO]: Redirecting com/possible_triangle/flightlib/api/FlyingPose [21:46:00] [Render thread/INFO]: Redirecting net/minecraft/world/BossEvent$BossBarColor [21:46:00] [Render thread/INFO]: Redirecting fuzs/overflowingbars/client/handler/HealthBarRenderer$HeartType [21:46:00] [Render thread/INFO]: Curios has been initialized with 17 slot(s) after 1 tries [21:46:00] [Render thread/INFO]: Redirecting org/violetmoon/quark/api/event/UsageTickerEvent$Pass [21:46:00] [Render thread/INFO]: Redirecting net/minecraft/world/level/block/SupportType [21:46:00] [Render thread/INFO]: Redirecting com/tom/cpm/shared/MinecraftClientAccess$ServerStatus [21:46:00] [Render thread/INFO]: Redirecting io/socol/betterthirdperson/api/TickPhase [21:46:00] [Render thread/INFO]: Redirecting net/minecraft/world/scores/Team$CollisionRule [21:46:00] [Render thread/INFO]: Redirecting net/blf02/vrapi/client/VRDataGrabber$PlayerType [21:46:00] [Render thread/INFO]: Redirecting com/corosus/watut/PlayerStatus$PlayerChatState [21:46:00] [Render thread/WARN]: Unable to play empty soundEvent: biomemusic:music.game [21:46:01] [Render thread/INFO]: Stopping worker threads [21:46:01] [Render thread/INFO]: Started 6 worker threads [21:46:01] [Netty Epoll Client IO #0/WARN]: Your custom createaddition:rolling/electrum_ingot recipe (createaddition:rolling/electrum_ingot) specified a duration. Durations have no impact on this type of recipe. [21:46:01] [Netty Epoll Client IO #0/WARN]: Your custom tfmg:casting recipe (tfmg:casting/steel) specified a duration. Durations have no impact on this type of recipe. [21:46:01] [Netty Epoll Client IO #0/WARN]: Your custom tfmg:casting recipe (tfmg:casting/steel) has more fluid inputs (1) than supported (0). [21:46:01] [Netty Epoll Client IO #0/WARN]: Your custom createaddition:rolling/brass_ingot recipe (createaddition:rolling/brass_ingot) specified a duration. Durations have no impact on this type of recipe. [21:46:01] [Render thread/INFO]: Redirecting net/minecraft/client/gui/components/toasts/Toast$Visibility [21:46:01] [CullThread/INFO]: Redirecting com/logisticscraft/occlusionculling/OcclusionCullingInstance$Relative [21:46:01] [Netty Epoll Client IO #0/WARN]: Your custom createaddition:rolling/electrum_plate recipe (createaddition:rolling/electrum_plate) specified a duration. Durations have no impact on this type of recipe. [21:46:01] [Netty Epoll Client IO #0/WARN]: Your custom createaddition:rolling/gold_plate recipe (createaddition:rolling/gold_plate) specified a duration. Durations have no impact on this type of recipe. [21:46:01] [Netty Epoll Client IO #0/WARN]: Your custom createaddition:rolling/gold_ingot recipe (createaddition:rolling/gold_ingot) specified a duration. Durations have no impact on this type of recipe. [21:46:01] [Netty Epoll Client IO #0/WARN]: Your custom createaddition:rolling/iron_plate recipe (createaddition:rolling/iron_plate) specified a duration. Durations have no impact on this type of recipe. [21:46:01] [Netty Epoll Client IO #0/WARN]: Your custom createaddition:rolling/iron_ingot recipe (createaddition:rolling/iron_ingot) specified a duration. Durations have no impact on this type of recipe. [21:46:02] [Netty Epoll Client IO #0/WARN]: Your custom tfmg:industrial_blasting recipe (tfmg:industrial_blasting/steel) specified a duration. Durations have no impact on this type of recipe. [21:46:02] [Netty Epoll Client IO #0/WARN]: Your custom createaddition:rolling/copper_ingot recipe (createaddition:rolling/copper_ingot) specified a duration. Durations have no impact on this type of recipe. [21:46:02] [Netty Epoll Client IO #0/WARN]: Your custom createaddition:rolling/straw recipe (createaddition:rolling/straw) specified a duration. Durations have no impact on this type of recipe. [21:46:02] [Netty Epoll Client IO #0/INFO]: Redirecting net/minecraft/world/entity/RelativeMovement [21:46:02] [Netty Epoll Client IO #0/INFO]: Redirecting dev/xkmc/l2library/capability/player/PlayerCapToClient$Action [21:46:02] [Render thread/WARN]: Unknown recipe category: cataclysm:weapon_fusion/cataclysm:weapon_infusion/void_assault_shoulder_weapon [21:46:03] [Netty Epoll Client IO #0/WARN]: Packet not registered: ClientboundDisconnectPacket [21:46:03] [Netty Epoll Client IO #0/WARN]: Packet:ClientboundDisconnectPacket [21:46:03] [Netty Epoll Client IO #0/WARN]: Packet data: { "f_132075_": "translation{key='disconnect.genericReason', args=[Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(12) + length(8) exceeds writerIndex(13): PooledUnsafeDirectByteBuf(ridx: 12, widx: 13, cap: 13/14)]}" } [21:46:03] [Render thread/WARN]: Unknown recipe category: deep_aether:poison_recipe/deep_aether:golden_dart_from_poison [21:46:03] [Render thread/WARN]: Unknown recipe category: deep_aether:poison_recipe/deep_aether:holystone_from_poison [21:46:03] [Render thread/WARN]: Unknown recipe category: deep_aether:poison_recipe/deep_aether:gravitite_ore_from_poison [21:46:03] [Render thread/WARN]: Unknown recipe category: deep_aether:poison_recipe/deep_aether:purple_squash_from_blue_squash [21:46:03] [Render thread/WARN]: Unknown recipe category: cataclysm:weapon_fusion/cataclysm:weapon_infusion/gauntlet_of_bulwark [21:46:03] [Render thread/WARN]: Unknown recipe category: cataclysm:weapon_fusion/cataclysm:weapon_infusion/void_forge [21:46:03] [Render thread/WARN]: Unknown recipe category: deep_aether:poison_recipe/deep_aether:quicksoil_from_poison [21:46:03] [Render thread/WARN]: Unknown recipe category: deep_aether:poison_recipe/deep_aether:blueberry_from_poison [21:46:03] [Render thread/WARN]: Unknown recipe category: deep_aether:poison_recipe/deep_aether:skyroot_poison_bucket_from_poison [21:46:03] [Render thread/WARN]: Unknown recipe category: cataclysm:weapon_fusion/cataclysm:weapon_infusion/ignitium_elytra_chestplate [21:46:03] [Render thread/WARN]: Unknown recipe category: deep_aether:poison_recipe/deep_aether:purple_squash_from_green_squash  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.