Jump to content

3D Item wont render in Inventory


Thornack

Recommended Posts

I have made a custom 3D ball and wish to render it in my inventory. It is an item that throws like the snowball but in the ItemRenderBall.java class the following switch statement wants to return an entity but when I replace null with (Entity) data[1] I get an out of bounds error.

 

problem code

switch (type) {
	case INVENTORY:
		GL11.glPushMatrix();
		// rotates the item and translates the item
		GL11.glRotatef(0, 0, 0, 1);
		GL11.glRotatef(0, 0, 1, 0);
		GL11.glRotatef(180, 1, 0, 0);
		GL11.glTranslatef(0f, 0f, 0f);
		GL11.glScalef(0.5F, 0.5F, 0.5F);
		Minecraft.getMinecraft().renderEngine.bindTexture(this.itemBallTexture);
		// renders the item
		modelBall.render(null, 0.0f, 0.0f, 0.0f, 0.0f,
				0.0f, 0.0225f);
		GL11.glPopMatrix();
	default:
		break;
	}

 

related mod classes pertaining to this item

 

 

main mod class soccer.java

import soccer.entity.EntityBall;
import soccer.item.CustomItem;
import soccer.item.Ball;
import soccer.render.ItemRenderBall;
import soccer.render.RenderBall;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

//import cpw.mods.fml.common.registry.EntityRegistry;

@Mod(modid = Soccer.modid, name = "Soccer Mod", version = Soccer.version)
public class Soccer {

public static final String modid = "soccer";
public static final String version = "0.0.1";

// The instance of your mod that Forge uses.
@Instance(modid)
public static Soccer instance;

@SidedProxy(clientSide = "soccer.ClientProxy", serverSide = "soccer.CommonProxy")
public static CommonProxy proxy;

/** declare creative tabs here */
public static CreativeTabs soccerTab;
/** declare 3D Items here */
public static Item Ball;
/** declare Blocks here */
/** declare MobEntities here */

@EventHandler
public void preInit(FMLPreInitializationEvent preEvent) {
	this.instance = this;
	/** initialize and register Tabs here */
	soccerTab = new CreativeTabs("Soccer") {
		@SideOnly(Side.CLIENT)
		public Item getTabIconItem() {
			return Ball /**
			 * returns
			 * creative tab logo
			 */
			;
		}
	};
	/** initialize and register non 3D Items here */
	/** initialize and register 3D Items here */
	Ball = new Ball();
	GameRegistry.registerItem(Ball,
			"soccer" + Ball.setUnlocalizedName("Ball"));
	MinecraftForgeClient.registerItemRenderer(Ball,
			(IItemRenderer) new ItemRenderBall());
	/** initialize and register blocks here */
	/** initialize and register Ores here */
	/** initialize and register TileEntities here */
	/** initialize and register MobEntities here */

}

@EventHandler
public void init(FMLInitializationEvent event) {
	proxy.init();

	int soccerMobEntityID = 0;
	/**soccer Entities */
	EntityRegistry.registerModEntity(EntityBall.class, "Ball", ++soccerMobEntityID, this, 80, 1, true);
       // proxy.registerRenderInformation();
}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
		}

}

Common Proxy.java

import soccer.entity.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class CommonProxy implements IGuiHandler{

//do not remove. This is overridden in ClientProxy to add rendering data for the models (client side only).
public void registerRenderInformation(){}

public void init(){
	registerEntities();
	registerRenderInformation();
}

//registers all soccer entities in the game
public void registerEntities(){
	//register ball
	EntityRegistry.registerGlobalEntityID(EntityBall.class, "Ball", EntityRegistry.findGlobalUniqueEntityId());
	}
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
		int x, int y, int z) {
			return null;
}


public Object getClientGuiElement(int ID, EntityPlayer player, World world,
		int x, int y, int z) {
			return null;
}
}

Client Proxy.java

import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.Entity;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import soccer.entity.*;
import soccer.model.*;
import soccer.render.ItemRenderBall;
import soccer.render.RenderBall;
import cpw.mods.fml.client.registry.RenderingRegistry;

public class ClientProxy extends CommonProxy{
public void registerRenderInformation(){
	RenderingRegistry.registerEntityRenderingHandler(EntityBall.class, new RenderBall());
}
	}

EntityBall.java

import java.util.Iterator;
import java.util.List;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;

public class EntityBall extends EntityThrowable {

private static final String __OBFID = "CL_00001722";


    
public EntityBall(World world) {
	super(world);
	this.setSize(0.9F, 0.9F); // hit-box size?

}
public EntityBall(World world, EntityLivingBase par2EntityLivingBase)
    {
        super(world, par2EntityLivingBase);
    }

    public EntityBall(World world, double par2, double par4, double par6)
    {
        super(world, par2, par4, par6);
    }

public EntityBall(World par1World, EntityLiving par2EntityLiving) {
	super(par1World, par2EntityLiving);
}

/**
 * Called when this EntityThrowable hits a block or entity.
 */
@Override
protected void onImpact(MovingObjectPosition movingItemPosition) {
	if (movingItemPosition.entityHit != null)
        {
            float thrownItemDamage = 0;//how much damage the thrown item will inflict

            movingItemPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), thrownItemDamage);
        }

        for (int i = 0; i < 8; ++i)
        {
            this.worldObj.spawnParticle("crit", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
        }
    
        // this if statement is required or it will keep updating forever and you'll end up with lots of leftover entities in the world
        if (!this.worldObj.isRemote) 
        {
            this.setDead();}
		}
protected void entityInit() {
}}

Ball.java

import java.util.Iterator;
import java.util.List;

import soccer.Soccer;
import soccer.entity.EntityBall;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;

public class Ball extends CustomItem {

public static int itemID;

public Ball() {
	super();
	setUnlocalizedName("Ball");
	setCreativeTab(Soccer.soccerTab);
	setFull3D();

}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world,
		EntityPlayer player) {
	if (!player.capabilities.isCreativeMode) {
		--itemStack.stackSize;
	}
	world.playSoundAtEntity(player, "random.bow", 0.5F,
			0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
	if (!world.isRemote) {
		world.spawnEntityInWorld(new EntityBall(world, player));
	}
	return itemStack;
}

/**
 * Called when a player right clicks an entity with an item.
 */
public boolean itemInteractionForEntity(ItemStack ItemStack,
		EntityLiving EntityLiving) {
	return false;
}

/**
 * returns the action that specifies what animation to play when the items
 * is being used
 */
public EnumAction getItemUseAction(ItemStack ItemStack) {
	return EnumAction.none;
}

/**
 * Determines if this Item has a special entity for when they are in the
 * world. Is called when a EntityItem is spawned in the world, if true and
 * Item#createCustomEntity returns non null, the EntityItem will be
 * destroyed and the new Entity will be added to the world.
 * 
 * @param stack
 *            The current item stack
 * @return True of the item has a custom entity, If true,
 *         Item#createCustomEntity will be called
 */
public boolean hasCustomEntity(ItemStack stack) {
	return false;
}

/**
 * This function should return a new entity to replace the dropped item.
 * Returning null here will not kill the EntityItem and will leave it to
 * function normally. Called when the item it placed in a world.
 * 
 * @param world
 *            The world object
 * @param location
 *            The EntityItem object, useful for getting the position of the
 *            entity
 * @param itemstack
 *            The current item stack
 * @return A new Entity object to spawn or null
 */
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
	return null;
}
}

CustomItem.java

import soccer.Soccer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

public class CustomItem extends Item {

public CustomItem() {
	super();

	this.setCreativeTab(getCreativeTab().tabMisc);
	setMaxStackSize(64);

}

public String getUnlocalizedName2() {
	return getUnlocalizedName().substring(4);
}

@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) {
	this.itemIcon = iconRegister.registerIcon(Soccer.modid + ":"
			+ this.getUnlocalizedName().substring(5));
}
}

ItemRenderBall.java ( This class renders the 3D Ball model on the ground and in the hand as a 3D item and currently doesn’t show an icon for the item in the inventory or creative tab )

import org.lwjgl.opengl.GL11;

import soccer.Soccer;
import soccer.model.ItemModelBall;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;

public class ItemRenderBall implements IItemRenderer {

protected ItemModelBall modelBall;
private static final ResourceLocation itemBallTexture = new ResourceLocation(
		"soccer:textures/items/ball.png");
public ItemRenderBall() {
	modelBall = new ItemModelBall();
}

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	switch (type) {
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
	case ENTITY:
	case INVENTORY:
		return true;
	default:
		return false;
	}
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
		ItemRendererHelper helper) {
	return false;
}
//Renders the Ball in your hand
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	switch (type) {
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
		GL11.glPushMatrix();
		// rotates the item
		GL11.glRotatef(90, 0, 0, 1);
		GL11.glRotatef(90, 0, 1, 0);
		GL11.glRotatef(230, 1, 0, 0);
		GL11.glTranslatef(0, 0.2f, -0.6f);
		GL11.glScalef(1.5F, 1.5F, 1.5F);
		Minecraft.getMinecraft().renderEngine.bindTexture(this.itemBallTexture);
		// renders the item
		modelBall.render((Entity) data[1], 0.0f, 0.0f, 0.0f, 0.0f,
				0.0f, 0.0225f);
		GL11.glPopMatrix();

	default:
		break;
		//Renders the Ball on ground
	}
	switch (type) {
	case ENTITY:

		GL11.glPushMatrix();
		// rotates the item and translates the item
		GL11.glRotatef(0, 0, 0, 1);
		GL11.glRotatef(0, 0, 1, 0);
		GL11.glRotatef(180, 1, 0, 0);
		GL11.glTranslatef(0, 0f, 0f);
		GL11.glScalef(1.5F, 1.5F, 1.5F);
		Minecraft.getMinecraft().renderEngine.bindTexture(this.itemBallTexture);
		// renders the item
		modelBall.render((Entity) data[1], 0.0f, 0.0f, 0.0f, 0.0f,
				0.0f, 0.0225f);
		GL11.glPopMatrix();
	default:
		break;
	}
	switch (type) {
	case INVENTORY:
		GL11.glPushMatrix();
		// rotates the item and translates the item
		GL11.glRotatef(0, 0, 0, 1);
		GL11.glRotatef(0, 0, 1, 0);
		GL11.glRotatef(180, 1, 0, 0);
		GL11.glTranslatef(0, 0f, 0f);
		GL11.glScalef(1.5F, 1.5F, 1.5F);
		Minecraft.getMinecraft().renderEngine.bindTexture(this.itemBallTexture);
		/* renders the item except here inputting null doesn’t crash Minecraft whereas replacing null with (Entity) data[1] does crash Minecraft*/

		modelBall.render(null, 0.0f, 0.0f, 0.0f, 0.0f,
				0.0f, 0.0225f);
		GL11.glPopMatrix();
	default:
		break;
	}
}
 /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
    protected ResourceLocation getEntityTexture(Entity Ball)
    {
        return this.itemBallTexture;
    }
}

RenderBall.java ( This class renders the 3D ball model mid flight upon right click but currently the ball doesn't render properly and only flies in one plane)

import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import org.lwjgl.opengl.GL11;

import soccer.Soccer;
import soccer.model.ItemModelBall;

@SideOnly(Side.CLIENT)
public class RenderBall extends Render
{

private static final ResourceLocation itemBallTexture = new ResourceLocation("soccer:textures/items/ball.png");
   /**
     * instance of ModelBall for rendering
     */
    protected ModelBase modelBall;
    public RenderBall()
    {
        this.shadowSize = 0.5F;
        this.modelBall = new ItemModelBall();
    }

   public void doRender(Entity renderflyingball, double x, double y, double z, float yaw, float partialTickTime)
    {
        GL11.glPushMatrix();
        GL11.glScalef(-0.5F, -0.5F, 0.5F);
        GL11.glTranslated(x,y,z);
        GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F);
        this.bindEntityTexture(renderflyingball);
        this.modelBall.render(renderflyingball, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
        GL11.glPopMatrix();
    }
    
    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
    protected ResourceLocation getEntityTexture(Entity par1Entity)
    {
        return this.itemBallTexture;
    }
}

 

Link to comment
Share on other sites

here is the one that i have do  your renaming and rendirng stuff

 

shooter

package thrizzo.minibots.items;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import thrizzo.minibots.entities.throwable.EntityMiniJBullet;
import thrizzo.minibots.main.MiniBotsMain;

public class ItemBlasterRifle extends Item
{

  public ItemBlasterRifle(int par1)
  {
	 super();

 this.maxStackSize = 1;
  }
  @Override
  public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
  {
  if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(MiniBotsMain.MiniRifleAmmo)){
	  
	  if (!par3EntityPlayer.capabilities.isCreativeMode)
      		{
              par3EntityPlayer.inventory.consumeInventoryItem(MiniBotsMain.MiniRifleAmmo);
      		}
      	par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
      	if (!par2World.isRemote)
      		{
    	  	par2World.spawnEntityInWorld(new EntityMiniJBullet(par2World, par3EntityPlayer));
      		}
      	return par1ItemStack;
  }
 	return par1ItemStack;
  }
}

 

 

shooten entity

 


package thrizzo.minibots.entities.throwable;

import java.util.Random;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class EntityMiniJBullet extends EntityThrowable
{    
private Random rand ; 
int speed = 2;
    private double damage = 7.5D ;

   public EntityMiniJBullet(World par1World)
   {
       super(par1World);
   }
   
   
   
   public void setDamage(double par1)
   {
       this.damage = par1;
   }

   public double getDamage()
   {
       return this.damage;
   }

   
   public EntityMiniJBullet(World par1World, EntityLivingBase par2EntityLivingBase)
   {
       super(par1World, par2EntityLivingBase);
       this.motionX*=speed;
       this.motionY*=speed;
       this.motionZ*=speed;
   }
   public EntityMiniJBullet(World par1World, double par2, double par4, double par6)
   {
       super(par1World, par2, par4, par6);
   }
   @Override
   protected void onImpact(MovingObjectPosition movingobjectposition) 
   {
 this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ,(float) 0.25, true);		


    
 this.setDead();

 if (movingobjectposition.entityHit != null)
     {
	 movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float) damage);
     }

   }
   @Override
   protected float getGravityVelocity()
   {
       return 0F;
   }

   
}

 

hope it works for you, it does for 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.
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

    • That looks pretty cool, nice!   Sure, so looking at that JSON file I posted, I pretty much made a record class for each "custom" data type in that JSON. The Input is a good example of why ``` "inputs": [ { "ingredient": { "item": "relativedimensions:aberrant_shard" }, "count": 8 } ], ``` So here's the inputs, it's an array, which we can use the Codec builder's builder.listOf to define an array. Each Item is of some arbitrary object with keys "ingredient" (which we know is an Ingredient) and a "count" which is an int. You don't have to have an intermediate class to map this to necessarily but I found that it's just easier to see the data that way, hence the 'ParticleReboundIngredient' represents one of these inputs.   Let me know if that makes sense or not. 
    • Pretty much, although all the recipes im planning to make on it are shapeless. The idea is that the chamber uses energy to "fuse" the items in each of the center slots together, in this case an ingot. The two slots at the sides are fuel. (A special kind of wood in this case). Here is an image of the interface just for reference (The center slot is the output)   As for the code- Can you elaborate a little bit on it? Seeing three different record classes has confused me a lot. (Elaborate as in why make them in three different records. I understand the code itself more or less)
    • Hello im trying to make a mod and the past few days GSON has almost killed me, when i export the mod and then launch it through minecraft launcher i get java.lang.NoSuchMethodError: com.google.gson.JsonParser.parseString(Ljava/lang/String;)Lcom/google/gson/JsonElement; i have literally tried everything here is my build config   dependencies { minecraft("com.mojang:minecraft:1.8.9") mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9") forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9") compileOnly("cc.polyfrost:oneconfig-1.8.9-forge:0.2.2-alpha+") shadowImpl("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta+") { isTransitive = false exclude(module = "gson") } shadowImpl("org.spongepowered:mixin:0.7.11-SNAPSHOT") { isTransitive = false exclude(module = "gson") } annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT") shadowImpl("org.javassist:javassist:3.15.0-GA") { isTransitive = false exclude(module = "gson") } shadowImpl("com.neovisionaries:nv-i18n:1.28") { isTransitive = false exclude(module = "gson") } shadowImpl("org.apache.commons:commons-lang3:3.4") { isTransitive = false exclude(module = "gson") } shadowImpl("org.apache.httpcomponents:httpcore:4.4.5") { isTransitive = false exclude(module = "gson") } compileOnly("com.google.code.gson:gson:2.8.6") { isTransitive = false } configurations.all { resolutionStrategy { force("com.google.code.gson:gson:2.8.6") } } shadowImpl(fileTree( mapOf( "dir" to "libs", "include" to listOf("*.jar"), "exclude" to listOf( "asm", "asm-commons", "asm-tree", "gson", "unspecified", "nv-i18n" ) ) )) }  
    • @chxr Looks like you're making some sort of a crafting table / furnace hybrid? Are the inputs needing arranging like a shaped recipe, or is it shapeless? I'll assume it's shapeless since that just adds a lot more complexity. In that case I'd probably do something like this { "type": "relativedimensions:particle_rebound", "inputs": [ { "ingredient": { "item": "relativedimensions:aberrant_shard" }, "count": 8 } ], "fuel": { "tag": "relativedimensions:block/aberrant_fuel" }, "output": { "Count": 1, "id": "relativedimensions:aberrant_ingot" } } inputs: A list of ingredients and how many are needed. The count among each input adds up to 8. Since there's only 1 ingredient, the count is set to 8. fuel: Same thing as before but remove the list and just make it an object with a tag. output: Kept the same.   In this case the Codec I would make is public record ParticleReboundIngredient(Ingredient ingredient, int count) { public static final Codec<ParticleReboundIngredient> CODEC = RecordCodecBuilder.create( builder -> builder.group( Ingredient.CODEC.fieldOf("ingredient").forGetter((i) -> i.ingredient), Codec.INT.fieldOf("count").forGetter(i -> i.count) ).apply(builder, ParticleReboundIngredient::new) ); } public record ParticleReboundFuel(String tag) { public static final Codec<ParticleReboundFuel> CODEC = RecordCodecBuilder.create( builder -> builder.group(Codec.STRING.fieldOf("tag").forGetter(f -> f.tag)).apply(builder, ParticleReboundFuel::new) ); public boolean isFuel(ItemStack stack) { // TODO: Check if fuel item matches the tag } } public record ParticleReboundRecipe(List<ParticleReboundIngredient> inputs, ParticleReboundFuel fuel, ItemStack output) { public static final Codec<ParticleReboundRecipe> CODEC = RecordCodecBuilder.create( builder -> builder.group( ParticleReboundIngredient.CODEC.listOf().fieldOf("inputs").forGetter(r -> r.inputs), ParticleReboundFuel.CODEC.fieldOf("fuel").forGetter(r -> r.fuel), ItemStack.CODEC.fieldOf("output").forGetter(r -> r.output) ).apply(builder, ParticleReboundRecipe::new) ); }   There might be a more proper Codec for the fuel and the tag that's built into minecraft / forge, but I didn't look
    • Tested with 5900X, 64GB 3200 MHz, 3070 Ti, driver 551.86 GPU clock range: 200 - 1950 MHz, usually 210 MHz with 10-30% utilisation on desktop idle use Render settings: Vsync ON, Framerate unlimited, Render distance 32, Fullscreen ON (60hz monitor, so 60 fps with vsync) Vanilla minecraft: Main menu: 210mhz idle clock always, ingame clock around 400 - 1000 mhz with ~30% utilisation and after alt+tab stays at same. Modded install with curseforge app, only said forge added: Main menu: 210 mhz idle clock always, ingame clock around 400 - 1000 mhz with ~30% utilisation, but after alt+tab gpu clock shoots up to 1950 mhz and utilisation is at 50-60% After disabling all render and chunk related stuff in config, after alt+tab it goes up to 1500 mhz. So game turns gpu into space heater when its not even seen. GPU usage returns to expected when game comes back on top. If instead of unlimited fps, fps is set to ~60, then during alt+tab gpu stays at same range as vanilla, but minecraft has horrible limit logic and framerate limit causes lot of tearing, so its not an option. So it seems that when alt+tabbing, for some reason logic no longer takes vsync toggle into account. So expected behaviour would be for it to work like vanilla does. keep rendering in same manner, no matter if its seen and use same amount of resources. Essentially noticed this behaviour while playing Supersymmetry and after elimination testing, result was that only Forge was enough to cause it. And also confirmed it by doing fresh pack with only Forge added, so no other mods even in disabled state. Also happened with both singleplayer and remote multiplayer. Other offender was "Universal Tweaks" which introduced same effect to main menu with its # Removes the hardcoded 30 FPS limit in screens like the main menu B:"Uncap FPS"=true setting, meaning when game was on top, it still worked in limits of vsync cap, but after alt+tabbing even in main menu gpu usage shot up to max.
  • Topics

×
×
  • Create New...

Important Information

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