
ItsMartNotMert
Members-
Posts
19 -
Joined
-
Last visited
Everything posted by ItsMartNotMert
-
Item textures for subitems not showing
ItsMartNotMert replied to ItsMartNotMert's topic in Modder Support
What do you expect to get passed to ModelResourceLocation if id is solar:rune ? I think I get it now, I am just confused as to why its working with my blocks and not with my rune item. BaseBlocks: BlockRegistry: -
Item textures for subitems not showing
ItsMartNotMert replied to ItsMartNotMert's topic in Modder Support
Thats before the : and the id = solar.rune for some reason. I think I really screwed up. As you see it works totally fine with the blocks I have, and with the item without the sub items it also worked. But with the itemrune it seems to add another "solar:" https://gyazo.com/73f1fed1d58d2ecc1d834b9c57156e79 -
Item textures for subitems not showing
ItsMartNotMert replied to ItsMartNotMert's topic in Modder Support
I really can't figure out where I am doing it. This are the lines involved: In the item (extends Item), this is in the constructor: setRegistryName("itemrune"); registry: public static ItemRune itemRune; public static void init() { itemRune = register(new ItemRune()); } private static <T extends Item> T register(T item) { GameRegistry.register(item); if (item instanceof ItemBase) { ((ItemBase)item).registerItemModel(); } else{ Solar.proxy.registerItemRenderer(item, 0, item.getRegistryName().toString()); } return item; } registerItemRenderer: @Override public void registerItemRenderer(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(Solar.MODID + ":" + id, "inventory")); } -
Item textures for subitems not showing
ItsMartNotMert replied to ItsMartNotMert's topic in Modder Support
Errors you say? Post 'em With getRegistryName().toString(): -
Item textures for subitems not showing
ItsMartNotMert replied to ItsMartNotMert's topic in Modder Support
I hope im supposed to use getResourcePath() after that? Because .toString generates errors. Im not getting an error but my item has a blank texture. And my second item has the broken texture. (black pink) -
This is my Item class: The json i have for the item called "ItemRune.json": { "forge_marker": 1, "defaults": { "model": "builtin/generated", "transform": "forge:default-item" }, "variants": { "type": { "runedefault": { "textures": { "layer0": "solar:items/runeDefault" } }, "runeFire": { "textures": { "layer0": "solar:items/runeDefault" } } } } } How I register the item: package com.mart.solar.registry; import com.mart.solar.Solar; import com.mart.solar.items.ItemBase; import com.mart.solar.items.ItemRune; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; public class ModItems { public static ItemRune itemRune; public static void init() { itemRune = register(new ItemRune()); } private static <T extends Item> T register(T item) { GameRegistry.register(item); if (item instanceof ItemBase) { ((ItemBase)item).registerItemModel(); } else{ Solar.proxy.registerItemRenderer(item, 0, item.getRegistryName().getResourcePath()); } return item; } } And These are the errors I get:
-
So I have a render class for my tileentity that is supposed to render the item put in the tileEntity. The item is there but the function to retrieve the item doesnt seem to work right. Heres my TileEntity Class: My render class: Block class: Blockstate: The item is set because I can also retrieve it, but it returns null to the Render class.. any idea on whats causing this?
-
This is the class that this topic is about: So this is how it goes. I add an rune. It gets placed in the rune variable. I add a modifier like a diamond and it will get placed in the modifier variable. This all works with rightclicking Then it looks for the recipe having the modifier and it finds it. It sets the rune value to null and the modifier to the item. I rightclick again and extract the item via the extractItem function and get the output. Then when I do this all over again it does not seem to work. The item doesnt get added to my inventory anymore. It gives all the right information with the println's but just doesnt add the itemstack to the inventory. Does anybody know a fix?
-
When I get the ItemStack from the nbt tag it returns an ItemStack with the stacksize of 0. This is the code: is anything wrong with it? I may be blind but it looks fine to me. @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); NBTTagList tagList = new NBTTagList(); NBTTagCompound itemCompound = new NBTTagCompound(); rune.writeToNBT(itemCompound); tagList.appendTag(itemCompound); compound.setTag("rune", tagList); return compound; } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); NBTTagList tagList = (NBTTagList) compound.getTag("rune"); NBTTagCompound tagCompound = tagList.getCompoundTagAt(0); rune = ItemStack.loadItemStackFromNBT(tagCompound); } Adding the itemstack to the inventory: player.inventory.addItemStackToInventory(rune); What is weird is, if I ask for the itemstack size it displays the right size. But adding it to the inventory makes the itemstack go 0. Only if I do not have the item in my inventory it seems to give the the right item.
-
WorldSavedData Thanks! And I did it with sending packets all going smooth now
-
Thanks, will do! And yes I just thought about it too. I need to find a way of doing it on the world specified. I do
-
There
-
So I am editing the worldTime but it seems the sky is only updating per 1 second. Is there a way to let the sky update manually? @SubscribeEvent public void methodName(TickEvent.WorldTickEvent event) { if(activated){ if(event.world.getWorldTime() % 24000 > 0 && event.world.getWorldTime() % 24000 < 13000){ activated = false; } else{ event.world.setWorldTime(event.world.getWorldTime() + 10); } } }
-
Whats Line 39? Im sure there are imports so we cant really see.
-
So I have a block with an TileEntity and an Item with the method onItemRightClick(). The onBlockActivate() method runs before the onItemRightClick() and then never runs the onItemRightClick(). This is how the code looks: @Override public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { RayTraceResult raytraceresult = this.rayTrace(worldIn, playerIn, false); if (raytraceresult == null) { return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand); } else if (raytraceresult.typeOfHit != RayTraceResult.Type.BLOCK) { return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand); } else { BlockPos blockpos = raytraceresult.getBlockPos(); TileEntity tileEntity = worldIn.getTileEntity(blockpos); System.out.println(blockpos.getX()); System.out.println(blockpos.getY()); System.out.println(blockpos.getZ()); if(tileEntity instanceof TileEntitySunTotem){ System.out.println("Hey"); TileEntitySunTotem tileEntitySunTotem = (TileEntitySunTotem) tileEntity; } } return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand); } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ){ if(!worldIn.isRemote){ TileEntity tileEntity = worldIn.getTileEntity(pos); if(tileEntity instanceof TileEntitySunTotem){ TileEntitySunTotem tileEntitySunTotem = (TileEntitySunTotem) tileEntity; playerIn.addChatMessage(new TextComponentString("" + tileEntitySunTotem.getSolarEnergy())); } } return true; } It does work when I shift + right click with the item. But I want it to work without.