Everything posted by shucke
-
Custom block renderer without TileEntity
i know. the Renderer is using the tessellator to draw the models. however i want to use GL11 to draw the method since that is the way models are outputted trough techne.
-
Custom block renderer without TileEntity
How can i render my custom model without the use of an TileEntity and TileEntitySpecialRenderer. since i dont want my Block class to extends BlockContainer i want to know how to render a block without the tile entity. i tried using the ISimpleBlockRenderingHandler but it gives me an error when i try to render my model. this is the code im using the the ISimpleBlockRenderingHandler: public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { if(block instanceof IBlockRenderer){ GL11.glPushMatrix(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/hydrocraft/textures/models/gearBox.png")); GL11.glPushMatrix(); GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); GL11.glScalef(1.0F, -1F, -1F); ModelGearBox model = new ModelGearBox(); model.renderModel(0.0625F, 0, 1); GL11.glPopMatrix(); GL11.glPopMatrix(); } return false; } and this is the error im getting. i tried returning true and that didnt make a difference either. does any knows how to solve this problem?
-
Entity's keep falling trough blocks
my custom entity's keep falling trough blocks. its most of the time 1 block but they dont sufficate either. it only happens with the smaller entity's. anyone knows how to fix this?
-
Entity's keep falling trough blocks
my custom entity's keep falling trough blocks. its most of the time 1 block but they dont sufficate either. it only happens with the smaller entity's. anyone knows how to fix this?
-
Draw an Icon in gui.
The way i handle my icons works fine for me. and i want to draw a 18*18 image from the npcdialog.png and that works fine to. The only problem i have is that the icon wont draw. and since i want to draw the icon that is used by the ItemStack called reward on the screen i cant use a 256 by 256 texture. that would be way to much work to do and unnessecary since there is a better way. now the problem im experiencing is that something is drawn but not from the Icon given by the reward field. i printed the icon name and it does give me the corresponding names for the icons. my only guess is that it draws it from the texture binded by the minecraft render engine. and i dont know how to bind the Icon to the render engine and if that is rigth a good solution to this problem.
-
Draw an Icon in gui.
The way i handle my icons works fine for me. and i want to draw a 18*18 image from the npcdialog.png and that works fine to. The only problem i have is that the icon wont draw. and since i want to draw the icon that is used by the ItemStack called reward on the screen i cant use a 256 by 256 texture. that would be way to much work to do and unnessecary since there is a better way. now the problem im experiencing is that something is drawn but not from the Icon given by the reward field. i printed the icon name and it does give me the corresponding names for the icons. my only guess is that it draws it from the texture binded by the minecraft render engine. and i dont know how to bind the Icon to the render engine and if that is rigth a good solution to this problem.
-
Draw an Icon in gui.
Im trying to draw an icon in a custom gui. but it doesnt work properly. instead of drawing the icon it draws a part of the gui. this is the code that im using. FontRenderer fontrenderer = par1Minecraft.fontRenderer; par1Minecraft.renderEngine.bindTexture("/mods/legendz/textures/gui/npcdialog.png"); boolean var1 = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; this.drawTexturedModalRect(xPosition, yPosition, 144, 0, width, height); Icon var2 = reward.getIconIndex(); System.out.println(var2.getIconName()); GL11.glPushMatrix(); this.drawTexturedModelRectFromIcon(0, 0, var2, 16, 16); GL11.glPopMatrix(); i cant figure out what is wrong with it. some help would be greatly apreciated;
-
Draw an Icon in gui.
Im trying to draw an icon in a custom gui. but it doesnt work properly. instead of drawing the icon it draws a part of the gui. this is the code that im using. FontRenderer fontrenderer = par1Minecraft.fontRenderer; par1Minecraft.renderEngine.bindTexture("/mods/legendz/textures/gui/npcdialog.png"); boolean var1 = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; this.drawTexturedModalRect(xPosition, yPosition, 144, 0, width, height); Icon var2 = reward.getIconIndex(); System.out.println(var2.getIconName()); GL11.glPushMatrix(); this.drawTexturedModelRectFromIcon(0, 0, var2, 16, 16); GL11.glPopMatrix(); i cant figure out what is wrong with it. some help would be greatly apreciated;
-
Smaller fonts
Hello, is there a way to get smaller fonts in minecraft? and i dont mean change the font i just want it to get smaller. i tried using the GL11.glScalef and it resized but the result was that the font was all messed up (dont know how else to put it) and it also didnt stay at the same place when the screen was resized. anyone who knows how to do this?
-
Detecting when mouse is on gui element
How can i detect when the position of the mouse is on a certain part of the gui. i looked into the gui button class but i cant make much of it. so does anyone knows how to do this?
-
Syncing Gui
thx it works now . but the only problem is that when i pick up an item from the players hotbar slots it drops the item on the ground. here is the container code btw forget to include that in the first post. public class ContainerInventoryLegendz extends Container{ public ContainerInventoryLegendz(InventoryPlayer par1InventoryPlayer, InventoryLegendz par2InventoryLegendz){ this.addSlotToContainer(new Slot(par2InventoryLegendz, 0, 62, 17)); this.addSlotToContainer(new Slot(par2InventoryLegendz, 1, 62, 53)); int var3; for (var3 = 0; var3 < 3; ++var3) { for (int var4 = 0; var4 < 9; ++var4) { this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 29+84 + var3 * 18)); } } for (var3 = 0; var3 < 9; ++var3) { this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 29+142)); } } @Override public boolean canInteractWith(EntityPlayer var1) { return true; } public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { return null; } }
-
Syncing Gui
Im trying to open a gui container when a button is pressed by the player. since the button press event is client side only i send a packet to the server to open the container. but when i try to open the gui by pressing the button it closes imediatly. this is code for my key handler: @Override public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { if(kb.keyCode == isBinding.keyCode){ if(mc.currentScreen == null){ player.addChatMessage("Key Pressed"); this.SendPacket(1, (byte)10, -1); FMLNetworkHandler.openGui(player, BaseLegendz.LegendzInstance, 4, mc.theWorld, 0, 0, 0); } } } private void SendPacket(int par1, byte par2, int par3){ int byteAmount = par1; ByteArrayOutputStream bos = new ByteArrayOutputStream(byteAmount); DataOutputStream outputStream = new DataOutputStream(bos); try { outputStream.writeByte(par2); if(par3 > -1){ outputStream.writeInt(par3); } } catch (Exception ex) { ex.printStackTrace(); } Packet250CustomPayload packet = new Packet250CustomPayload(); packet.channel = "MinecraftLegendz"; packet.data = bos.toByteArray(); packet.length = bos.size(); PacketDispatcher.sendPacketToServer(packet); } here is my gui handler. @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity te = world.getBlockTileEntity(x, y, z); EntityPlayerMP var1 = (EntityPlayerMP) player; IPlayerLegendz playerLegendz = (IPlayerLegendz) var1.getServerPlayerBase("MinecraftLegendz"); InventoryLegendz inventory = playerLegendz.getInventory(); if(te != null){ switch(ID){ default: return null; case 1: return new ContainerLegendzCraftingTable(player.inventory, (TileEntityLegendzCraftingTable)te); case 2: return new ContainerLegendzFurnace(player.inventory, (TileEntityLegendzFurnace)te); } } else{ switch(ID){ case 4: return new ContainerInventoryLegendz(player.inventory, inventory); } } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity te = world.getBlockTileEntity(x, y, z); EntityPlayerSP var1 = (EntityPlayerSP) player; IPlayerLegendz playerLegendz = (IPlayerLegendz) var1.getPlayerBase("MinecraftLegendz"); InventoryLegendz inventory = playerLegendz.getInventory(); if(ID < 200){ if(te != null){ switch(ID){ case 0: return new GuiLegendzCraftingTable(player.inventory, (TileEntityLegendzCraftingTable)te, player, world, x, y, z); case 1: return new GuiLegendzCrafting(player.inventory, (TileEntityLegendzCraftingTable)te); case 2: return new GuiLegendzFurnace(player.inventory, (TileEntityLegendzFurnace)te); case 3: return new GuiQuest(1, player, world, x, y, z); } }else{ switch(ID){ case 4: return new GuiLegendzInventory(player.inventory, inventory); case 5: return new GuiStore(player); case 6: return new GuiSkillTree(); } } } return null; } and the gui itself. package legendz; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; public class GuiLegendzInventory extends GuiContainer{ private PlayerClient player; public GuiLegendzInventory(InventoryPlayer inv, InventoryLegendz inventory) { super(new ContainerInventoryLegendz(inv,inventory)); EntityPlayer var1 = Minecraft.getMinecraft().thePlayer; EntityPlayerSP var2 = (EntityPlayerSP) var1; player = (PlayerClient) var2.getPlayerBase("MinecraftLegendz"); } public boolean doesGuiPauseGame(){ return false; } protected void drawGuiContainerForegroundLayer(int i, int j){ this.fontRenderer.drawString(StatCollector.translateToLocal("Legendz Inventory"), 30, -28, 0xFFFFFF); this.fontRenderer.drawString(StatCollector.translateToLocal("Inventory"), 10, this.ySize - 58, 0xFFFFFF); } @Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { drawDefaultBackground(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture("/mods/legendz/textures/gui/inventory.png"); int var5 = (this.width - 176) / 2; int var6 = (this.height - 224) / 2; this.drawTexturedModalRect(var5, var6, 0, 0, 176, 224); this.drawCenteredString(fontRenderer, player.getBattleClass().getName(), var5+43, var6+25, 0xFFFFFF); int[] var1 = player.getStats().getTotalStats(); int var2 = 36; int var3 = 42; for(int k = 0; k < player.statNamesShort.length; k++){ this.drawString(fontRenderer, player.statNamesShort[k], var5+var2, (var6+var3)+(k*10), 0xFFFFFF); String var4 = ""+var1[k]; int xOffset = var4.length()*5; this.drawString(fontRenderer, var4, var5+var2+34-xOffset, (var6+var3)+(k*10), 0xFFFFFF); } } }
-
More inventory slots
i tried that but i cant seem to figure out how it works. can someone pls give me a little push in the right direction where to start and where to save the custom data. if anyone knows a open source mod that does this can you please send me the link to it cuz this is driving me crazy
-
More inventory slots
Hey guys, ive been trying to figure this out for a while now but it just doesnt work. so what im trying to do is create a few extra inventory slots to the players inventory for special items and stuff. i installed the player api and added a playerbase class to the player but i still cant seem to work out how to add new slots. and im trying to do this without editing any base classes. so if any of you have any clue or experience on how to do this please leave a comment.
-
weird fonts
can i ask you which method that is? the method used before 1.5 doesnt exists anymore.
-
weird fonts
i'm trying to draw a health new health bar on the in game in my tick handler. but the font is acting really weird. never had a problem with this before but since i updated to 1.5 it stated happening. what happens is for 1 sec when the game loads it gives the normal font. but afterwards the font gets the texture of the image i rendered underneath it. this is my code: GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture("/mods/legendz/textures/gui/hud.png")); GL11.glPushMatrix(); gig.drawTexturedModalRect((width/2)-91, (height)-39, 0, 96, 82, 9); gig.drawTexturedModalRect((width/2)-89, height-37, 0, 105, 78, 5); gig.drawCenteredString(fontrenderer, player.getHealth()+"/"+player.getMaxHealth(), width/2-45, height-39, 0xFFFFFF); GL11.glPopMatrix();
-
Arrow rotation render.
Everytime i shoot my arrow the rotation isn't correct. the arrow still fly's straight forward but it looks like its not. i did register everything and all. anyone knows how to fix this?
-
[Help]I need someone to code for me
i can give it a try shouldn't be to difficult i guess.
-
New damage calculations
I was wondering if there is a way to change the damage calculations whitouth editing base classes. i want my armor to add physycal attack to the player which pierces through the armour of the player and deal the damage based on the remaining def that is left. i dont care if i can't do this with diamond swords or anything. i just want this to happen with my own custom swords. so is there a way to do this whitout editing base classes?
-
[SOLVED] GUI not displaying accurate data
send a packet to the player when gui is opend. the nbt saves only on the servers side so when you quit minecraft the client side varaibles reset.
-
Don't Know How To Animate Mobs!
did you set your offset right in techne? this tutorial might be helpfull to you. and can you post you render registry code and render file code and you model code pls? maybe i can figure out why it's rendering a player.
-
Creative Tabs Error
i solved it. some classes weren't obfuscated. dont know how this happens but after a few times recompilen and reobfuscating i finnaly got a working mod maybe a fresh mcp will prevent any future issue's.
-
Creative Tabs Error
yes i got the classes from the there. i out my main source file and put them in a zip. i also coppied my textures from my resources and put them in the same zip file. this worked with some of my previous mods but now it doesnt.
-
Creative Tabs Error
what do you excactly mean by reobfuscate? i executed the bat file reobfuscate. is that what you meant? and what parts of the code you need?
-
Creative Tabs Error
i did reobfuscate my code. and this is my creativeTab code public static CreativeTabs tabBlocks = new CreativeTab("Blocks", 7); public static CreativeTabs tabRecipes = new CreativeTab("Recipe's", 1); public static CreativeTabs tabQuest = new CreativeTab("Quest", ; public static CreativeTabs tabJewelry = new CreativeTab("Jewelry", 2); public static CreativeTabs tabMisc = new CreativeTab("Miscellaneous", 3); public static CreativeTabs tabTools = new CreativeTab("Tools", 6); public static CreativeTabs tabArmor = new CreativeTab("Armor", 4); public static CreativeTabs tabWeapons = new CreativeTab("Weapons", 5); public static CreativeTabs tabConsumables = new CreativeTab("Consumables", 9); public static CreativeTabs tabMaterials = new CreativeTab("Materials", 0); and for example in a item class: public ItemBasicFood(int i, int j, float b) { super(i, j, b, true); res = j; sat = b; this.setCreativeTab(BaseLegendz.tabConsumables); } and my creative tab code: package legendz.common; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; public class CreativeTab extends CreativeTabs{ private int ID; public CreativeTab(String label, int id) { super(label); ID = id; } @Override public ItemStack getIconItemStack() { switch(ID){ default: return null; case 0: return new ItemStack(BaseLegendz.gemItem, 1, 0); case 1: return new ItemStack(BaseLegendz.recipeItem, 1, 0); case 2: return new ItemStack(BaseLegendz.earringItem, 1, 0); case 3: return new ItemStack(BaseLegendz.portalIgniter, 1, 0); case 4: return new ItemStack(BaseLegendz.aquaticChest, 1, 0); case 5: return new ItemStack(BaseLegendz.frozenFlamesBlade); case 6: return new ItemStack(BaseLegendz.energyPickaxe); case 7: return new ItemStack(BaseLegendz.legendzCraftingTable); case 8: return new ItemStack(BaseLegendz.questItem, 1, 0); case 9: return new ItemStack(BaseLegendz.mammothMeatItem); } } }
IPS spam blocked by CleanTalk.