Jump to content

Recommended Posts

Posted

Hey guys,

 

I want to render some things from a tile entities container physically into the model. However, I'm having a bit of trouble with it.

 

I believe all I need to do is "sync" the container from the server to the client; but I'm not exactly sure how. My code is failing when doing a null check for the itemstack though, so I think that's a good guess.

 

Here is my renderer, tile entity, and container. Anyone able to point me in the right direction?

 

package co.uk.silvania.cities.core.client.models;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

import org.lwjgl.opengl.GL11;

import co.uk.silvania.cities.econ.store.entity.TileEntityAdminShop;


public class TileEntityFloatingShelvesRenderer extends TileEntitySpecialRenderer {

private final FloatingShelvesModel model;
private final RenderItem renderer;

private TileEntityAdminShop shelvesEntity;

public TileEntityFloatingShelvesRenderer() {
	this.model = new FloatingShelvesModel();
	this.renderer = new RenderItem();

	renderer.setRenderManager(RenderManager.instance);
}

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
	this.shelvesEntity = (TileEntityAdminShop) te;
	int i = te.getBlockMetadata();
	int meta = 180;

	if (i == 0) {
		meta = 0;
	}

	if (i == 3) {
		meta = 90;
	}

	if (i == 2) {
		meta = 180;
	}

	if (i == 1) {
		meta = 270;
	}

	Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("flenixcities", "textures/entities/floatingshelves.png"));
	GL11.glPushMatrix();
	GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
	GL11.glRotatef(meta, 0.0F, 1.0F, 0.0F);
	//GL11.glRotatef(((TileEntityBarrierEntity)tile).getRotationPivot()), 0.0F, 1.0F, 0.0F);
	GL11.glScalef(1.0F, -1F, -1F);
	this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
	GL11.glPopMatrix();

	GL11.glPushMatrix();
	System.out.println("Begin item renderer");
	if (shelvesEntity.getStackInSlot(0) != null) {
		System.out.println("Slot 0 contains an item!");
		EntityItem entity = new EntityItem(te.worldObj);
		entity.hoverStart = 0.0F;
		GL11.glTranslated((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
		GL11.glRotatef(0, 0.0F, 1.0F, 0.0F);
		entity.setEntityItemStack(shelvesEntity.getStackInSlot(0));
		System.out.println("Render it now");
		renderer.doRenderItem(entity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
	}
	System.out.println("End item renderer");
	GL11.glPopMatrix();
}

private void adjustLightFixture(World world, int i, int j, int k, Block block) {
	Tessellator tess = Tessellator.instance;
	float brightness = block.getBlockBrightness(world, i, j, k);
	int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
	int modulousModifier = skyLight % 65536;
	int divModifier = skyLight / 65536;
	tess.setColorOpaque_F(brightness, brightness, brightness);
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,  (float) modulousModifier,  divModifier);
}
}

 

 

package co.uk.silvania.cities.econ.store.entity;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import co.uk.silvania.cities.econ.EconUtils;
import co.uk.silvania.cities.econ.money.ItemCoin;
import co.uk.silvania.cities.econ.money.ItemNote;

public class TileEntityAdminShop extends TileEntity implements IInventory {

public String ownerName;
public String userName;
private ItemStack[] items;
public double buyPrice1;
public double sellPrice1;
public double buyPrice2;
public double sellPrice2;
public double buyPrice3;
public double sellPrice3;
public double buyPrice4;
public double sellPrice4;
public int tabButton;

@Override
public void writeToNBT(NBTTagCompound nbt) {
	super.writeToNBT(nbt);
	NBTTagList nbtTagList = new NBTTagList();
	//Credit to Lumien
	for (int i = 0; i < this.items.length; ++i) {
		if (this.items[i] != null) {
			System.out.println("Writing Item in Slot " + i);
			NBTTagCompound compound = new NBTTagCompound();
			nbt.setByte("Slot", (byte)i);
			this.items[i].writeToNBT(compound);
			nbtTagList.appendTag(compound);
		}
	}
	nbt.setTag("Items",  nbtTagList);
	nbt.setString("ownerName", ownerName);
	nbt.setDouble("buyPrice1", buyPrice1);
	nbt.setDouble("sellPrice1", sellPrice1);
	nbt.setDouble("buyPrice2", buyPrice2);
	nbt.setDouble("sellPrice2", sellPrice2);
	nbt.setDouble("buyPrice3", buyPrice3);
	nbt.setDouble("sellPrice3", sellPrice3);
	nbt.setDouble("buyPrice4", buyPrice4);
	nbt.setDouble("sellPrice4", sellPrice4);

}

@Override
public void readFromNBT(NBTTagCompound nbt) {
	super.readFromNBT(nbt);
	NBTTagList nbtTagList = nbt.getTagList("Items");
	for (int i = 0; i < nbtTagList.tagCount(); i++) {
		NBTTagCompound nbt1 = (NBTTagCompound)nbtTagList.tagAt(i);
		int j = nbt1.getByte("Slot") & 255;
		System.out.println("Reading Item in Slot " + i + "/" + j);
		this.items[i] = ItemStack.loadItemStackFromNBT(nbt1);
	}
	this.ownerName = nbt.getString("ownerName");
	this.buyPrice1 = nbt.getDouble("buyPrice1");
	this.sellPrice1 = nbt.getDouble("sellPrice1");
	this.buyPrice2 = nbt.getDouble("buyPrice2");
	this.sellPrice2 = nbt.getDouble("sellPrice2");
	this.buyPrice3 = nbt.getDouble("buyPrice3");
	this.sellPrice3 = nbt.getDouble("sellPrice3");
	this.buyPrice4 = nbt.getDouble("buyPrice4");
	this.sellPrice4 = nbt.getDouble("sellPrice4");

}

public int getQuantity(int i) {
	int qty;
	int startSlot;
	int endSlot;
	if (i == 0) {

	} else if (i == 1) {

	} else if (i == 2) {

	} else if (i == 3) {

	}
	//For loop.
	return 0;
}

public boolean isShopOpen() {
	return true;
}

public void sellItem(int i, int qty, EntityPlayer entityPlayer) {
	System.out.println("Beginning Sale Process");
	double itemCost = 0;
	if (i == 1) {
		itemCost = buyPrice1;
	}
	if (i == 2) {
		itemCost = buyPrice2;
	}
	if (i == 3) {
		itemCost = buyPrice3;
	}
	if (i == 4) {
		itemCost = buyPrice4;
	}
	double totalItemCost = itemCost * qty;
	double invCash = EconUtils.getInventoryCash(entityPlayer);
	System.out.println("Item Cost: " + totalItemCost + ", Inventory Cash: " + EconUtils.getInventoryCash(entityPlayer));

	if (invCash >= totalItemCost) {
		//Two birds, one stone. Charges the player for us, then tells us how much they paid so we can calculate change.
		double paidAmount = EconUtils.findCashInInventoryWithChange(entityPlayer, totalItemCost); //Complex code to charge the player's inventory
		if (paidAmount == 0) {
			//They didn't pay enough. Don't take the money, and tell 'em to piss off.
			return;
		} else {
			ItemStack item = getStackInSlot(i - 1);
			System.out.println("Item: " + item);
			System.out.println("Qty: " + qty);
			while (qty >= 1) {
				System.out.println("Giving " + item.stackSize + " items, " + qty + " more stacks of this to go.");
				entityPlayer.inventory.addItemStackToInventory(new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
				qty--;
			}
		}
	}
}


public TileEntityAdminShop() {
	items = new ItemStack[4]; //Amount of stacks
}

@Override
public int getSizeInventory() {
	return items.length;
}

@Override
public ItemStack getStackInSlot(int i) {
	return items[i];
}

@Override
public ItemStack decrStackSize(int i, int amount) {
	ItemStack itemStack = getStackInSlot(i);

	if (itemStack != null) {
		if (itemStack.stackSize <= amount) {
			setInventorySlotContents(i, null);
		} else {
			itemStack = itemStack.splitStack(amount);
			onInventoryChanged(); //Update the inventory. TODO use this for card removal
		}
	}
	return itemStack;
}

@Override
public ItemStack getStackInSlotOnClosing(int i) {
	ItemStack itemStack = getStackInSlot(i);
	setInventorySlotContents(i, null);
	return itemStack;
}

@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
	if (isItemValidForSlot(i, itemStack)) {
		items[i] = itemStack;

		if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
			itemStack.stackSize = getInventoryStackLimit();
		}

		onInventoryChanged();
	}
}

public void addMoneyToShopInventory(int i, ItemStack itemStack, double amount) {
	if (isItemValidForSlot(i, itemStack)) {
		items[i] = itemStack;

		if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
			itemStack.stackSize = getInventoryStackLimit();
		}

		onInventoryChanged();
	}
}

@Override
public String getInvName() {
	return "Floating Shelves";
}

@Override //Apparently not used...
public boolean isInvNameLocalized() {
	return true;
}

//Max size of stacks placed inside.
@Override
public int getInventoryStackLimit() {
	return 64;
}

//Checks if the player can use it.
//Wouldn't work for owner only- if I did that, no one else would be able to interact (Maybe? Need to test that.)
@Override
public boolean isUseableByPlayer(EntityPlayer entityPlayer) {
	return entityPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) <= 64;
}

//Not used
@Override
public void openChest() {}

//Not used
@Override
public void closeChest() {}

//Checks that the item is valid. For shelves, use instanceof to see if it's item or block.
@Override
public boolean isItemValidForSlot(int i, ItemStack item) {
	ItemStack slot1 = getStackInSlot(0);
	ItemStack slot2 = getStackInSlot(1);
	ItemStack slot3 = getStackInSlot(2);
	ItemStack slot4 = getStackInSlot(3);
	if (item != null) {
		if (i > 3 && i <= 39) {
			return item.itemID == slot1.itemID;
		}
		if (i > 39 && i <= 75) {
			return item.itemID == slot2.itemID;
		}
		if (i > 75 && i <= 111) {
			return item.itemID == slot3.itemID;
		}
		if (i > 111 && i <= 147) {
			return item.itemID == slot4.itemID;
		}
		if (i > 147 && i <= 184) {
			if (item.getItem() instanceof ItemCoin || item.getItem() instanceof ItemNote) {
				return true;
			} else {
				return false;
			}
		} if (i > 184) {
			return false;
		}
	}
	return true;
}
}

 

 

package co.uk.silvania.cities.econ.store.container;

import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import co.uk.silvania.cities.econ.store.entity.TileEntityAdminShop;

public class ContainerAdminShop extends Container {

private TileEntityAdminShop te;
private IInventory adminShopInventory;
public static int tabButton;

private int field_94536_g;
private int field_94535_f = -1;
private final Set field_94537_h = new HashSet();

public ContainerAdminShop(InventoryPlayer invPlayer, TileEntityAdminShop te) {
	this.te = te;
	addSlotToContainer(new Slot(te, 0, 8, 50));
	addSlotToContainer(new Slot(te, 1, 8, 72));
	addSlotToContainer(new Slot(te, 2, 8, 94));
	addSlotToContainer(new Slot(te, 3, 8, 116));
	bindPlayerInventory(invPlayer);
}



protected void bindPlayerInventory(InventoryPlayer invPlayer) {
	//C = vertical inventory slots, "columns"
	//R = horizontal inventory slots, "rows"
	for (int c = 0; c < 3; c++) {
		for (int r = 0; r < 9; r++) {
			addSlotToContainer(new Slot(invPlayer, r + c * 9 + 9, 8 + r * 18, 141 + c * 18));
		}
	}
	//H = hotbar slots
	for (int h = 0; h <9; h++) {
		addSlotToContainer(new Slot(invPlayer, h, 8 + h * 18, 199));
	}
}

@Override
public boolean canInteractWith(EntityPlayer entityPlayer) {
	return true;
}

@Override
    public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
	ItemStack stack = null;
        Slot slotObject = (Slot) inventorySlots.get(slot);

        if (slotObject != null && slotObject.getHasStack()) {
        	ItemStack stackInSlot = slotObject.getStack();
        	stack = stackInSlot.copy();

        	if (slot < 9) {
        		if (!this.mergeItemStack(stackInSlot, 9, 45, true)) {
        			return null;
        		}
        	}

        	else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) {
        		return null;
        	}

        	if (stackInSlot.stackSize == 10) {
        		slotObject.putStack(null);
        	} else {
        		slotObject.onSlotChanged();
        	}

        	if (stackInSlot.stackSize == stack.stackSize) {
        		return null;
        	}
        	slotObject.onPickupFromSlot(player, stackInSlot);
        }
        return stack;
}

@Override
    public void putStackInSlot(int slot, ItemStack item) {
        this.getSlot(slot).putStack(item);
    }

public IInventory getFloatingShelvesInveotry() {
	return this.adminShopInventory;
}

@Override
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer entityPlayer) {
	System.out.println("Slot clicked!");
	if (entityPlayer.capabilities.isCreativeMode) {
		super.slotClick(par1, par2, par3, entityPlayer);
	}
	return null;
}
}

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Posted

I'm not entirely sure, but you may be able to do all the calculation on the server and use a packet handler to send the data to the client and have the client render the model.

Don't be afraid to ask question when modding, there are no stupid question! Unless you don't know java then all your questions are stupid!

Posted

You can do this by creating a method in your tile entity to check for the item in the slot like so

 

public boolean hasBook(int slot)
{
// on phone so can't remember method but there is a method in IInventory to check for items in slot
if(items.unknownMethod[slot] instanceof ItemBook)
      return items.unknownMethod[slot];

 

Then do a check in your renderer and if so render that part of the model.

Posted
  On 3/16/2014 at 4:38 AM, Jdb100 said:

You can do this by creating a method in your tile entity to check for the item in the slot like so

 

public boolean hasBook(int slot)
{
// on phone so can't remember method but there is a method in IInventory to check for items in slot
if(items.unknownMethod[slot] instanceof ItemBook)
      return items.unknownMethod[slot];

 

That would only work for something like Bibliocraft's bookshelf, where the physical item in the slot has no relevance to what is rendered. I need to know what itemstack is in the slot, because I'll be rendering that exact stack

 

Then do a check in your renderer and if so render that part of the model.

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

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

    • My Crazy Craft Updated pack for 1.16.5 crashes whenever I use items from Mowzie's Mobs that have animations. Specifically the ones that I have tried are the Ice Crystal and the Axe of a Thousand Metals. The crash only happens when I use the ability of it, aka right click, which triggers the animation. I should note that I added around 50 other mods to the pack, two of which are the Female Gender mod and More Player Models. Could they be the source of the crash? Here is the crash log: https://mclo.gs/ZhsC793
    • Hello, i've tried to make a minecraft server for my friends on old laptop. But im getting this error   ---- Minecraft Crash Report ---- WARNING: coremods are present:   DCLoadingPlugin (DummyCoreUnofficial-2.4.112.3.jar)   HCASM (HammerLib-1.12.2-2.0.6.23.jar) Contact their authors BEFORE contacting forge // I feel sad now Time: 19.06.25 22:26 Description: Exception in server tick loop java.lang.NoClassDefFoundError: net/minecraft/client/Minecraft     at nukeduck.armorchroma.ArmorChroma.<clinit>(ArmorChroma.java:23)     at java.lang.Class.forName0(Native Method)     at java.lang.Class.forName(Class.java:348)     at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:539)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219)     at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136)     at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:595)     at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98)     at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:333)     at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125)     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486)     at java.lang.Thread.run(Thread.java:750) Caused by: java.lang.ClassNotFoundException: net.minecraft.client.Minecraft     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)     at java.lang.ClassLoader.loadClass(ClassLoader.java:418)     at java.lang.ClassLoader.loadClass(ClassLoader.java:351)     ... 35 more Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@57fae983 from coremod FMLCorePlugin     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:260)     at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)     ... 37 more Caused by: java.lang.RuntimeException: Attempted to load class bib for invalid side SERVER     at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:62)     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:256)     ... 39 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.12.2     Operating System: Linux (amd64) version 6.8.0-51-generic     Java Version: 1.8.0_452, Private Build     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Private Build     Memory: 1088926088 bytes (1038 MB) / 1634205696 bytes (1558 MB) up to 4194304000 bytes (4000 MB)     JVM Flags: 2 total; -Xms1024M -Xmx4500M     IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0     FML: MCP 9.42 Powered by Forge 14.23.5.2859 44 mods loaded, 44 mods active     States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored     | State | ID                       | Version            | Source                                        | Signature                                |     |:----- |:------------------------ |:------------------ |:--------------------------------------------- |:---------------------------------------- |     | LC    | minecraft                | 1.12.2             | minecraft.jar                                 | None                                     |     | LC    | mcp                      | 9.42               | minecraft.jar                                 | None                                     |     | LC    | FML                      | 8.0.99.99          | forge-1.12.2-14.23.5.2859.jar                 | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | forge                    | 14.23.5.2859       | forge-1.12.2-14.23.5.2859.jar                 | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | codechickenlib           | 3.2.3.358          | CodeChickenLib-1.12.2-3.2.3.358-universal.jar | f1850c39b2516232a2108a7bd84d1cb5df93b261 |     | LC    | ancientwarfare           | 1.12.2-2.7.0.1032  | ancientwarfare-1.12.2-2.7.0.1032.jar          | None                                     |     | LC    | ancientwarfareautomation | 1.12.2-2.7.0.1032  | ancientwarfare-1.12.2-2.7.0.1032.jar          | None                                     |     | LC    | ancientwarfarenpc        | 1.12.2-2.7.0.1032  | ancientwarfare-1.12.2-2.7.0.1032.jar          | None                                     |     | LC    | ancientwarfarestructure  | 1.12.2-2.7.0.1032  | ancientwarfare-1.12.2-2.7.0.1032.jar          | None                                     |     | LC    | ancientwarfarevehicle    | 1.12.2-2.7.0.1032  | ancientwarfare-1.12.2-2.7.0.1032.jar          | None                                     |     | L     | armorchroma              | 1.4-beta           | armorchroma-1.12.2-1.4.jar                    | None                                     |     | L     | baubles                  | 1.5.2              | Baubles-1.12-1.5.2.jar                        | None                                     |     | L     | betterburning            | 0.9.2              | BetterBurning-1.12.2-0.9.2.jar                | None                                     |     | L     | bettercaves              | 1.12.2             | bettercaves-1.12.2-2.0.4.jar                  | None                                     |     | L     | betterinvisibility       | 1.0.1              | betterinvisibility-1.0.1.jar                  | None                                     |     | L     | bettermineshafts         | 1.12.2-2.2         | BetterMineshaftsForge-1.12.2-2.2.jar          | None                                     |     | L     | bookshelf                | 2.3.590            | Bookshelf-1.12.2-2.3.590.jar                  | None                                     |     | L     | collective               | 2.11               | collective-1.12.2-2.11.jar                    | None                                     |     | L     | extendedrenderer         | v1.0               | coroutil-1.12.1-1.2.37.jar                    | None                                     |     | L     | coroutil                 | 1.12.1-1.2.37      | coroutil-1.12.1-1.2.37.jar                    | None                                     |     | L     | configmod                | v1.0               | coroutil-1.12.1-1.2.37.jar                    | None                                     |     | L     | dummycore                | 2.4.112.3.         | DummyCoreUnofficial-2.4.112.3.jar             | None                                     |     | L     | dynamictrees             | 1.12.2-0.9.22      | DynamicTrees-1.12.2-0.9.22.jar                | None                                     |     | L     | thaumcraft               | 6.1.BETA26         | Thaumcraft_1.12.2_6.1.BETA26.jar              | None                                     |     | L     | dynamictreestc           | 1.12.2-1.4.2       | DynamicTreesTC-1.12.2-1.4.2.jar               | None                                     |     | L     | hammercore               | 2.0.6.23           | HammerLib-1.12.2-2.0.6.23.jar                 | None                                     |     | L     | waila                    | 1.8.26             | Hwyla-1.8.26-B41_1.12.2.jar                   | None                                     |     | L     | jei                      | 4.16.1.302         | jei_1.12.2-4.16.1.302.jar                     | None                                     |     | L     | keepinginventory         | 2.4                | KeepingInventory-1.12.2-2.4.jar               | None                                     |     | L     | libraryex                | 1.2.1              | LibraryEx-1.12.2-1.2.1.jar                    | None                                     |     | L     | netherex                 | 2.2.4              | NetherEx-1.12.2-2.2.4.jar                     | None                                     |     | L     | recipehandler            | 0.13               | NoMoreRecipeConflict-0.13(1.12.2).jar         | None                                     |     | L     | nei                      | 2.4.3              | NotEnoughItems-1.12.2-2.4.3.245-universal.jar | None                                     |     | L     | thaumadditions           | 12.6.6             | ThaumicAdditions-1.12.2-12.6.6.jar            | None                                     |     | L     | thaumicbases             | 3.3.500.6r         | thaumicbases-3.3.500.6r.jar                   | None                                     |     | L     | thaumictinkerer          | 1.12.2-5.0-620a0c5 | thaumictinkerer-1.12.2-5.0-620a0c5.jar        | None                                     |     | L     | thaumicwaila             | 1.12.2-0.0.2       | ThaumicWaila-1.12.2-0.0.2.jar                 | None                                     |     | L     | tumbleweed               | 1.12-0.4.7         | tumbleweed-1.12-0.4.7.jar                     | None                                     |     | L     | villagespawnpoint        | 1.5                | villagespawnpoint_1.12.2-1.5.jar              | None                                     |     | L     | wawla                    | 2.6.275            | Wawla-1.12.2-2.6.275.jar                      | None                                     |     | L     | wooltostring             | 1.12.2             | WoolToString-1.12.2-1.0.0.jar                 | None                                     |     | L     | zombieawareness          | 1.12.1-1.11.16     | zombieawareness-1.12.1-1.11.16.jar            | None                                     |     | L     | betteranimalsplus        | 9.0.1              | betteranimalsplus-1.12.2-9.0.1.jar            | None                                     |     | L     | orelib                   | 3.6.0.1            | OreLib-1.12.2-3.6.0.1.jar                     | None                                     |     Loaded coremods (and transformers):  DCLoadingPlugin (DummyCoreUnofficial-2.4.112.3.jar)   DummyCore.ASM.DCASMManager HCASM (HammerLib-1.12.2-2.0.6.23.jar)   com.zeitheron.hammercore.asm.HammerCoreTransformer     Profiler Position: N/A (disabled)     Is Modded: Definitely; Server brand changed to 'fml,forge'     Type: Dedicated Server (map_server.txt)
    • Hey! I noticed you're trying to register your alexandrite item and possibly set its resource location manually with setId(...). I wanted to help clarify a few things that might simplify your code and avoid errors. ✅ The issue: You're using setId(...) inside the item registration like this:   public static final RegistryObject<Item> ALEXANDRITE = ITEMS.register("alexandrite", () -> new Item(new Item.Properties().useItemDescriptionPrefix() .setId(ResourceKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(TutorialMod.MOD_ID, "alexandrite"))))); But: Item.Properties does not have a setId(...) method — this line will either fail or do nothing meaningful. useItemDescriptionPrefix() is mostly used for translation keys (like "item.modid.name") but isn't needed unless you have a very specific reason. 🛠 The fix: You only need to register your item like this:   public static final RegistryObject<Item> ALEXANDRITE = ITEMS.register("alexandrite", () -> new Item(new Item.Properties())); Forge automatically handles the ResourceLocation (modid:alexandrite) based on the name passed into .register(...), so there’s no need to manually assign it. 📝 For the texture: Make sure you have this file in your resources: src/main/resources/assets/tutorialmod/models/item/alexandrite.json { "parent": "item/generated", "textures": { "layer0": "tutorialmod:item/alexandrite" } } And your texture PNG goes here: src/main/resources/assets/tutorialmod/textures/item/alexandrite.png 🌍 For the name in-game: Add this to your en_us.json under: src/main/resources/assets/tutorialmod/lang/en_us.json { "item.tutorialmod.alexandrite": "Alexandrite" }   Note: if im wrong about the issues you are encountering, i apologize.
    • 🛠️ Fix for Transparent or Clipping Item Render Issues When Held in First Person (Forge 1.20+) Hey everyone! I recently ran into a frustrating bug while making a custom item (a rocket) for my Forge mod, and I’m sharing the fix because it’s a bit obscure — and it worked wonders. 💥 The Problem: My item rendered semi-transparent and see-through — but only in first person. It also clipped through nearby blocks when held, unlike default items like swords or leads. The texture file was confirmed to be fully opaque (alpha 255), so the issue wasn’t the PNG itself. Interestingly, when no texture was present and the default purple-black checkerboard appeared, the clipping issue disappeared. ✅ The Fix: I ended up resolving it by randomly trying something I found on a Forge forum post about block rendering. I added this property to my item's model JSON — even though it's typically only used for blocks: { "parent": "item/generated", "textures": { "layer0": "farbeyond:item/rocket_item" }, "render_type": "minecraft:cutout" } Boom. That single line forced the item to render using a proper opaque (cutout) layer, removing all the unwanted transparency and clipping behavior in first person. 🙌 Credit: I originally found the "render_type" trick mentioned here, in a block rendering context: 👉 https://forums.minecraftforge.net/topic/149644-1201-help-with-transparent-blocks/ Even though it was meant for blocks, I thought, why not try it on an item? And it worked! Big thanks to the poster — this fix wouldn’t have happened without that tip. Hopefully this helps anyone else stuck on a weird rendering bug like I was. This isn’t a common item solution, so feel free to share it further. I’d love to know if it works for you too.
    • Use Java 21 instead of Java 24   Also make a test without modernfix
  • Topics

×
×
  • Create New...

Important Information

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