Jump to content

Nieue

Members
  • Posts

    141
  • Joined

  • Last visited

Everything posted by Nieue

  1. okay, but I won't respond till tomorrow (for me, in about 9 hours) because I'm gonna sleep now. Thanks for all the help you've given me so far, even though it hasn't gotton rid of the problem , it was still usefull I shall give you a "Thank you"
  2. A site said: static means that the method belongs to the class and not any instance of the class But I really can't get any further with that I'm in the process of learning java still from Vswe, but I really want to know how to do this!
  3. Oops, not bright right now:P Changed Clientproxy.registerRendering(); > ClientProxy client = new ClientProxy(); But still doesn't render
  4. So, in the PreInit I did: ClientProxy.registerRendering(); What else do I have to add to make it functional? Because now it is giving me an error and fixing it by changing the modifier of registerrendering to static. Which results in another error. Etc.
  5. YOU have to manually call this said method, theres no magic But how do I do that? Sorry that I keep asking this, but it's really late at night for me
  6. Followed this tutorial, and they didn't do it. Or I'm REAAAALLLY blind D: http://www.minecraftforge.net/wiki/Custom_Tile_Entity_Renderer
  7. I have this in my main mod class. GameRegistry.registerTileEntity(TileEntitySolarPanel.class, "TileEntitySolarPanel"); And this is my TileEntitySolarPanel: package assets.blutricity.common; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.Packet132TileEntityData; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class TileEntitySolarPanel extends TileEntity{ public int customField; @Override public void writeToNBT(NBTTagCompound par1) { super.writeToNBT(par1); par1.setInteger("customField", customField); } @Override public void readFromNBT(NBTTagCompound par1) { super.readFromNBT(par1); this.customField = par1.getInteger("customField"); } 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); } }
  8. I only followed a tutorial, so I don't know for sure what I need to change to call the registerRendering. But if I'm correct, I have to put it on the bottom of this class: package assets.blutricity.common; import net.minecraft.block.Block; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; import assets.blutricity.models.solarpanel; public class TileEntitySolarPanelRenderer extends TileEntitySpecialRenderer{ private static final ResourceLocation SolarPanel = new ResourceLocation("blutricity:textures/blocks/solarpanel.png"); //This method is called when minecraft renders a tile entity public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f) { GL11.glPushMatrix(); //This will move our renderer so that it will be on proper place in the world GL11.glTranslatef((float)d, (float)d1, (float)d2); TileEntitySolarPanel tileEntitySolarPanel = (TileEntitySolarPanel)tileEntity; /*Note that true tile entity coordinates (tileEntity.xCoord, etc) do not match to render coordinates (d, etc) that are calculated as [true coordinates] - [player coordinates (camera coordinates)]*/ renderBlockSolarPanel(tileEntitySolarPanel, tileEntity.worldObj, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, Mainclass.SolarPanel); GL11.glPopMatrix(); System.out.println(); } //And this method actually renders your tile entity public void renderBlockSolarPanel(TileEntitySolarPanel tl, World world, int i, int j, int k, Block block) { Tessellator tessellator = Tessellator.instance; //This will make your block brightness dependent from surroundings lighting. float f = block.getBlockBrightness(world, i, j, k); int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0); int l1 = l % 65536; int l2 = l / 65536; tessellator.setColorOpaque_F(f, f, f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2); /*This will rotate your model corresponding to player direction that was when you placed the block. If you want this to work, add these lines to onBlockPlacedBy method in your block class. int dir = MathHelper.floor_double((double)((player.rotationYaw * 4F) / 360F) + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, dir, 0);*/ int dir = world.getBlockMetadata(i, j, k); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0, 0.5F); //This line actually rotates the renderer. GL11.glRotatef(dir * (-90F), 0F, 1F, 0F); GL11.glTranslatef(-0.5F, 0, -0.5F); func_110628_a(SolarPanel); /* Place your rendering code here. */ final solarpanel model = new solarpanel(); model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } } At the place your rendering code here... is that correct?
  9. oh yeah, so the problem IS in there, isn't it?
  10. what can you conclude ? That the problem isn't in the Clientproxy....
  11. Here is the log with the string in the clientproxy I don't see the line I put in there
  12. ah, I'll try that at the first spot you said I should do it first
  13. So I did this in the clientproxy: package assets.blutricity.client; import assets.blutricity.common.CommonProxy; import assets.blutricity.common.TileEntitySolarPanelRenderer; import net.minecraftforge.client.MinecraftForgeClient; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { @Override public void registerRendering() { System.out.println(); ClientRegistry.bindTileEntitySpecialRenderer(assets.blutricity.common.TileEntitySolarPanel.class, new TileEntitySolarPanelRenderer()); } } That is correct right? The console for that:
  14. conclusion? you didnt rgister it correctly can we have the updated main mod class ? There you go
  15. Thanks for the tip that I should do this before asking questions, but nothing showed up in the console that was really weird. The only thing that had to do with the Solar Panel was 2013-07-23 21:47:46 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_1004_solarpanel.png
  16. Derp from me to not think of that... But it still doesn't render Here's all my code for this block: package assets.blutricity.common; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class SolarPanel extends Block { public SolarPanel(int par1) { super(par1, Material.rock); } //This will tell minecraft not to render any side of our cube. public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) { return false; } //And this tell it that you can see through this block, and neighbor blocks should be rendered. public boolean isOpaqueCube() { return false; } public TileEntity createTileEntity(World world, int metadata) { return new TileEntitySolarPanel(); } } package assets.blutricity.common; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.Packet132TileEntityData; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class TileEntitySolarPanel extends TileEntity{ public int customField; @Override public void writeToNBT(NBTTagCompound par1) { super.writeToNBT(par1); par1.setInteger("customField", customField); } @Override public void readFromNBT(NBTTagCompound par1) { super.readFromNBT(par1); this.customField = par1.getInteger("customField"); } 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); } } package assets.blutricity.common; import net.minecraft.block.Block; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; import assets.blutricity.models.solarpanel; public class TileEntitySolarPanelRenderer extends TileEntitySpecialRenderer{ private static final ResourceLocation SolarPanel = new ResourceLocation("blutricity:textures/blocks/solarpanel.png"); //This method is called when minecraft renders a tile entity public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f) { GL11.glPushMatrix(); //This will move our renderer so that it will be on proper place in the world GL11.glTranslatef((float)d, (float)d1, (float)d2); TileEntitySolarPanel tileEntitySolarPanel = (TileEntitySolarPanel)tileEntity; /*Note that true tile entity coordinates (tileEntity.xCoord, etc) do not match to render coordinates (d, etc) that are calculated as [true coordinates] - [player coordinates (camera coordinates)]*/ renderBlockSolarPanel(tileEntitySolarPanel, tileEntity.worldObj, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, Mainclass.SolarPanel); GL11.glPopMatrix(); } //And this method actually renders your tile entity public void renderBlockSolarPanel(TileEntitySolarPanel tl, World world, int i, int j, int k, Block block) { Tessellator tessellator = Tessellator.instance; //This will make your block brightness dependent from surroundings lighting. float f = block.getBlockBrightness(world, i, j, k); int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0); int l1 = l % 65536; int l2 = l / 65536; tessellator.setColorOpaque_F(f, f, f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2); /*This will rotate your model corresponding to player direction that was when you placed the block. If you want this to work, add these lines to onBlockPlacedBy method in your block class. int dir = MathHelper.floor_double((double)((player.rotationYaw * 4F) / 360F) + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, dir, 0);*/ int dir = world.getBlockMetadata(i, j, k); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0, 0.5F); //This line actually rotates the renderer. GL11.glRotatef(dir * (-90F), 0F, 1F, 0F); GL11.glTranslatef(-0.5F, 0, -0.5F); func_110628_a(SolarPanel); /* Place your rendering code here. */ final solarpanel model = new solarpanel(); model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } } package assets.blutricity.client; import assets.blutricity.common.CommonProxy; import assets.blutricity.common.TileEntitySolarPanelRenderer; import net.minecraftforge.client.MinecraftForgeClient; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { @Override public void registerRendering() { ClientRegistry.bindTileEntitySpecialRenderer(assets.blutricity.common.TileEntitySolarPanel.class, new TileEntitySolarPanelRenderer()); } } The model itself (.java): // Date: 23-7-2013 19:56:03 // Template version 1.1 // Java generated by Techne // Keep in mind that you still need to fill in some blanks // - ZeuX package assets.blutricity.models; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class solarpanel extends ModelBase { //fields ModelRenderer Shape1; public solarpanel() { textureWidth = 64; textureHeight = 32; Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(0F, 0F, 0F, 16, 4, 16); Shape1.setRotationPoint(-8F, 20F, -8F); Shape1.setTextureSize(64, 32); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Shape1.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity ent) { super.setRotationAngles(f, f1, f2, f3, f4, f5, ent); } }
  17. But when I remove public it still gives me the second error
  18. Updated the code to 1.6.2 (using another mod now) The TileEntityRenderer: package assets.blutricity.common; import net.minecraft.block.Block; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; import assets.blutricity.models.solarpanel; public class TileEntitySolarPanelRenderer extends TileEntitySpecialRenderer{ private static final ResourceLocation SolarPanel = new ResourceLocation("blutricity:textures/blocks/solarpanel.png"); //This method is called when minecraft renders a tile entity public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f) { GL11.glPushMatrix(); //This will move our renderer so that it will be on proper place in the world GL11.glTranslatef((float)d, (float)d1, (float)d2); TileEntitySolarPanel tileEntitySolarPanel = (TileEntitySolarPanel)tileEntity; /*Note that true tile entity coordinates (tileEntity.xCoord, etc) do not match to render coordinates (d, etc) that are calculated as [true coordinates] - [player coordinates (camera coordinates)]*/ renderBlockSolarPanel(tileEntitySolarPanel, tileEntity.worldObj, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, Mainclass.SolarPanel); GL11.glPopMatrix(); } //And this method actually renders your tile entity public void renderBlockSolarPanel(TileEntitySolarPanel tl, World world, int i, int j, int k, Block block) { Tessellator tessellator = Tessellator.instance; //This will make your block brightness dependent from surroundings lighting. float f = block.getBlockBrightness(world, i, j, k); int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0); int l1 = l % 65536; int l2 = l / 65536; tessellator.setColorOpaque_F(f, f, f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2); /*This will rotate your model corresponding to player direction that was when you placed the block. If you want this to work, add these lines to onBlockPlacedBy method in your block class. int dir = MathHelper.floor_double((double)((player.rotationYaw * 4F) / 360F) + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, dir, 0);*/ int dir = world.getBlockMetadata(i, j, k); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0, 0.5F); //This line actually rotates the renderer. GL11.glRotatef(dir * (-90F), 0F, 1F, 0F); GL11.glTranslatef(-0.5F, 0, -0.5F); func_110628_a(SolarPanel); /* Place your rendering code here. */ public final solarpanel [b]model [/b]= new solarpanel(); this.[b]model[/b].render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } } It gives me errors on the bold ones. the first error says as a fix: remove invalid modifiers, which removes the public statement, and it fixes the first error. but somehow I don't think that is the correct way of fixing the bug the secon error says as a fix: create fiel/constant in type TileEntitySolarPanelRenderer What did I do wrong?
  19. Hello, I've been trying to make an item so that when you hold it in your hand it gives you blindness. But, when I have the code set up like this (in the class of that item): @Override public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5) { super.onUpdate(stack, world, entity, par4, par5); if (entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; ItemStack equipped = player.getCurrentEquippedItem(); if (equipped == stack) { player.addPotionEffect(new PotionEffect(Potion.blindness.id, 1, 3)); } } It only gives me this in-game: And the only effect it gives me is that I am unable to sprint... Can someone help me?
  20. you didn't remember, did you?
  21. But then it will become an addon, so it would require IC2 to work at all, wouldn't it? I don't want it to do that Yeah, that's a hard dependency, as Chibill said just use 'after' rather than 'required-after' for a soft depend. So, if I want to load a new item when that other mod is loaded as well, do I just put: @Mod(modid = "modid" name = "modname", version = "v0.123", dependencies = "required-after:IC2") public static Item TestItem; @PreInit public void PreInit(FMLPreInitializationEvent event) { if(Loader.isModLoaded("IC2")) { TestItem= new TestItem(5013).setUnlocalizedName("testitem"); ItemStack test = new ItemStack(TestItem); ItemStack red = new ItemStack(Item.redstone); GameRegistry.addRecipe(new ItemStack (TestItem 4), " r", "aar", " r", 'a', test, 'r', red); } ?
  22. But then it will become an addon, so it would require IC2 to work at all, wouldn't it? I don't want it to do that
×
×
  • Create New...

Important Information

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