
Naiten
Members-
Posts
325 -
Joined
-
Last visited
Everything posted by Naiten
-
Rendering sometimes too dark, changes with camera angle
Naiten replied to Reika's topic in Modder Support
Okay, just use second part of that. int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0); int l1 = l % 65536; int l2 = l / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2); Also, you can write Tessellator tessellator = Tessellator.instance; and still use your OGL renderer. And as renderer updates frequently, you will have dynamic lighting. Trust me. -
This mod will add a pretty old-fashioned folding plate camera allowing you to make in-game photos. Work is still in progress, just look at amazing sreenies.
-
I did it that way. --- Oh, i've fixed my bug. I just had to set block with flag 0x02 that will update blocks. Now it works fine.
-
Thanks, that helped.
-
So, no ideas?
-
I haven't wrote a tutorial on adding packets to tile entity renderer. --- While i was writing a tutorial, just placing packets in the TE worked... Now i need to s/l the game for TER to draw placed blocks correctly. If i place new, they are now rendered correctly. Wtf.
-
Aaaa!!! Okay. How do i do that?
-
Okay, you are right, sorry. Then, help me... I have this code in my block public void onNeighborBlockChange(World world, int i, int j, int k, int par5) { TileEntityBlockWRail tl = (TileEntityBlockWRail) world.getBlockTileEntity(i, j, k); if (tl != null) { System.out.println("mid = "+tl.mid); } } So, i'm sure it saves my variables. And in my tile entity renderer i have int id = tl.mid; switch (id) { case 0: renderStraight(); break; case 1: renderCurveRight(); break; and so on... } But it always renders the 0 renderer.
-
You saved my nerves, thanks. *blows a kiss
-
Well, since some time, the renderer i made for my tile entity started filling all console with 2013-05-04 17:16:23 [sEVERE] [Minecraft-Client] ########## GL ERROR ########## 2013-05-04 17:16:23 [sEVERE] [Minecraft-Client] @ Post render I have no idea what can that be... Also, now, if i place several blocks, only one is rendering. That wasn't so like a half-day ago...
-
I'm making a multiple item, and i managed to set different icons for it, but i'm stuck at names... Here's the code. package net.railowar.src; import java.util.List; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class ItemWideRails extends Item { public static final String[] wNames = new String[] {"Straight", "Right", "Left", "S", "Z"}; public static final String[] wTex = new String[] {"rails", "rails_r", "rails_l", "rails_s", "rails_z"}; @SideOnly(Side.CLIENT) private Icon[] ico; public ItemWideRails(int par1) { super(par1); this.setHasSubtypes(true); this.setMaxDamage(0); this.maxStackSize = 1; setCreativeTab(CreativeTabs.tabTransport); setUnlocalizedName("Rails"); } @SideOnly(Side.CLIENT) public Icon getIconFromDamage(int par1) { int j = MathHelper.clamp_int(par1, 0, 4); return this.ico[j]; } public String getUnlocalizedName(ItemStack par1ItemStack) { int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 4); return super.getUnlocalizedName() + "." + wNames[i]; } @SideOnly(Side.CLIENT) public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) { for (int j = 0; j < 5; ++j) { par3List.add(new ItemStack(par1, 1, j)); } } @SideOnly(Side.CLIENT) public void updateIcons(IconRegister par1IconRegister) { this.ico = new Icon[wTex.length]; for (int i = 0; i < wTex.length; ++i) { this.ico[i] = par1IconRegister.registerIcon("RoW:" + wTex[i]); } } } Please, help.
-
Oh. Tell me that way i should do that so it will save my variables and i'll do that. --- Added a tutorial on custom tile entity renderer. Enjoy.
-
TileEntitySignRenderer don't use packets, but can freely use tile entities fields. How that's made?
-
Oh, okay, not in all. But how is it made, i wonder? I does not save them for me without packet.
-
If i don't use them, my tile entity doesn't save variables. Why should i not use them if they are used in all default tile entity classes?
-
Hello. I've wrote some tutorials for modding in forge, you can find them here. If you have any suggestions or comments, post them here, i'll look if i can help.
-
diesieben07, don't know what you mean, but code works fine for me. Everything saves and loads perfectly.
-
Rendering sometimes too dark, changes with camera angle
Naiten replied to Reika's topic in Modder Support
I hope that will help. float f = block.getBlockBrightness(world, i, j, k); tessellator.setColorOpaque_F(f, f, f); int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0); int l1 = l % 65536; int l2 = l / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2); Don't forget pressing "Thank you" if it does... -
I'm not sure, but try EntityRegistry.registerModEntity(EntityYour.class, "uniqueStringName", 1, this, 64, 1, true); isnstead of registerGlobalEntityID and place it in your mod load method.
-
Make a tileEntity and tileEntityRender, bind them to your block. Then, in the renderer make methods to render sides and corners of the cauldron differently from each other, and check if there is a nearby cauldron block before rendering.
-
Well, i suggest more easy way — just add these few lines to tileEntity class, instead of that pile of code public Packet getDescriptionPacket() { NBTTagCompound nbtTag = new NBTTagCompound(); this.writeToNBT(nbtTag); return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag); } public void onDataPacket(INetworkManager net, Packet132TileEntityData packet) { readFromNBT(packet.customParam1); }
-
Hell yeah. That code saved me. public void breakBlock(World world, int i, int j, int k, int par5, int par6) { TileEntityBlockZRail tl = (TileEntityBlockZRail) world.getBlockTileEntity(i, j, k); if (tl != null) { world.destroyBlock(tl.px, j, tl.py, false); } } public void onNeighborBlockChange(World world, int i, int j, int k, int par5) { TileEntityBlockZRail tl = (TileEntityBlockZRail) world.getBlockTileEntity(i, j, k); if (tl != null) { if(world.getBlockId(tl.px, j, tl.py) != RoW.Rails.blockID) { world.destroyBlock(i, j, k, false); } } } Now, the only thing i need is my locomotive physics...
-
As for me, a have that as src/minecraft/mods/myMod/textures/items.
-
Making an item with next code helped me. public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffSet) { if (!player.capabilities.isCreativeMode) { --item.stackSize; } world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!world.isRemote) { EntityLocoChe ent = new EntityLocoChe(world); ent.setLocationAndAngles(x, y + 1, z, 0F, 0.0F); ent.entityInit(); world.spawnEntityInWorld(ent); return true; } return false; } }
-
http://pastebin.com/aBhB7ikB --- Yeah, when i try public void onBlockDestroyedByPlayer(World world, int i, int j, int k, int par5) { TileEntityBlockZRail tl = (TileEntityBlockZRail) world.getBlockTileEntity(i, j, k); System.out.println(tl); } It return null, and for some reason it does that four times. And game does not crash. However, i have tileentityrender class and it reads that data fine without any obvious reason... I think it's something with coordinates...