Jump to content

tlr38usd

Members
  • Posts

    93
  • Joined

  • Last visited

Everything posted by tlr38usd

  1. How could you get another players inventory. Would you need to use EntityPlayerMP? What I'm trying to do is add a back tools render and I want to get all the other players item stacks in there last inventory slot then render it on their backs. I have the rendering code working great I just need to know how to get the itemstack.
  2. Is there a method for getting the current resource pack? I'm currently using Minecraft.getMinecraft().func_110438_M().field_110620_b which returns the vanilla pack, and Minecraft.getMinecraft().gameSettings.skin is a String. How do I get the current resource pack object?
  3. Thank you so much! I had seen a solution similar to that on google, but it really helped to see it in context =D
  4. How would I get all of the potentialChild classes or objects? If I had a list or an array I'd have to manually add to it whenever I was adding support. If there's no better way I guess I could do it, but I'd like it to be completely dynamic.
  5. Just finished watching this video - From what I understood, reflection is awesome. Wish I had known about it before, could have solved a lot of problems I was having =D However I don't understand how to use it to get subclasses, or classes that implement an interface. Everything else I can do.
  6. I'll take a look at the buildcraft API, the forge code left me utterly confused =P How would I do that? Reflection / quava libs that is. Also I'm going to be adding all the weapon B mod support files in my own jar, I was just looking for an example. With that in mind though could I run a for loop that gets all the classes in a package and runs a method that way?
  7. How could I make an api for my mod so that a method can be called from a mod support class without it being referenced in any of my main mod files. For example, mod B wants to add a weapon type to my mod, mod A. So when my mod A is loaded a method in mod B's mod support class will activate adding the weapon type to my mod. I know forge has an @ForgeSubscribe function, might I need to look at the source for that to get an example?
  8. Well as I mentioned earlier I have a weird texture system so if a texturer packer wanted to support my mod they'd have to work with that. Maybe what I need to do is add a mcmeta file similar to how mojang does it. How might I do that?
  9. But as GotoLink mentioned earlier, which I completely forgot, texture packers don't use jars.
  10. Not really. What I'm doing currently is that each of my items has two different textures that are recolored depending on different variables. I have gotten requests from texture packers that I have an option for them to not use the default coloring system and instead use there own textures.
  11. Good point. But hopefully you kinda know what I mean. I want my mod to check he current texture pack and if there is a png file with a certain name than overwrite my weird texturing system and use that png instead. How could I do this?
  12. I have a weird system for texturing in my mod and I'd like to make it so that if texture packers include a png file with a certain name it will override my weird texturing system. I know in java there's a file.exists() function but that doesn't seem to work in a compiled jar.
  13. nvm, found the answer within this method getEntitiesWithinAABB. However my question about doing this without a tile entity spawning another entity still stands. also is there a way to set an entity.task by force?
  14. I'm trying to make a block that will lure all the animals in a 5 block radius to it. Right now I have a mess of tile entities and entities to get the closest animal with this... EntityLiving closestEntity = (EntityLiving) this.worldObj.findNearestEntityWithinAABB(watchedClass, this.boundingBox.expand(5, 4, 5), this); However that only returns the closest entity. How would I get all the entities in an area? Also, if there is a way to do this without tile entities how could it be done?
  15. Their plants and those variables store the breeding mechanics for each individual plant Neither of those suggestions worked =/ Actually I am, I'm using seeds that are based off of the itemReeds code. public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { int i1 = par3World.getBlockId(par4, par5, par6); if (i1 == Block.snow.blockID && (par3World.getBlockMetadata(par4, par5, par6) & 7) < 1) { par7 = 1; } else if (i1 != Block.vine.blockID && i1 != Block.tallGrass.blockID && i1 != Block.deadBush.blockID) { if (par7 == 0) { --par5; } if (par7 == 1) { ++par5; } if (par7 == 2) { --par6; } if (par7 == 3) { ++par6; } if (par7 == 4) { --par4; } if (par7 == 5) { ++par4; } } if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) { return false; } else if (par1ItemStack.stackSize == 0) { return false; } else { if (par3World.canPlaceEntityOnSide(this.spawnIDP, par4, par5, par6, false, par7, (Entity) null, par1ItemStack)) { Block block = Block.blocksList[this.spawnIDP]; int j1 = block.onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10, 0); if (par3World.setBlock(par4, par5, par6, this.spawnIDP, j1, 3)) { if (par3World.getBlockId(par4, par5, par6) == this.spawnIDP) { Block.blocksList[this.spawnIDP].onBlockPlacedBy( par3World, par4, par5, par6, par2EntityPlayer, par1ItemStack); Block.blocksList[this.spawnIDP].onPostBlockPlaced( par3World, par4, par5, par6, j1); } par3World.playSoundEffect((double) ((float) par4 + 0.5F), (double) ((float) par5 + 0.5F), (double) ((float) par6 + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); --par1ItemStack.stackSize; } } return true; } }
  16. I have a custom block with a tile entity and when I place it in-game it's fine and works as it should. But when I quit the game and reopen the block is gone! I narrowed the problem down to the read / write nbt methods because when I comment them out the block doesn't disappear. Here's the code public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setIntArray("group", this.group); nbt.setIntArray("partners", this.partners); nbt.setInteger("speed", this.speed); nbt.setInteger("ticksTillCheck", this.ticksTillCheck); } public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.group = nbt.getIntArray("group"); this.partners = nbt.getIntArray("partners"); this.speed = nbt.getInteger("speed"); this.ticksTillCheck = nbt.getInteger("ticksTillCheck"); }
  17. I'm having trouble with my custom blocks. I place them in the world and then I quit the game and when I reopen the game they're gone! I've narrowed the problem down to my blocks tile entity, it seems when I comment out the nbt write / read functions it works fine. I'm not sure what the problem is Here's my nbt code public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setIntArray("group", this.group); nbt.setInteger("speed", this.speed); nbt.setInteger("ticksTillCheck", this.ticksTillCheck); } public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.group = nbt.getIntArray("group"); this.speed = nbt.getInteger("speed"); this.ticksTillCheck = nbt.getInteger("ticksTillCheck"); }
  18. That fixed it thanks! Although, however, now the text decided to not render
  19. My client tick handler. Do you need anything else? package TuxWeapons.TuxCraft; import java.util.Collection; import java.util.EnumSet; import java.util.Iterator; import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ResourceLocation; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; public class ClientTickHandler implements ITickHandler { private ResourceLocation location = new ResourceLocation( TuxWeaponsCore.modidLowerCase, "textures/gui/statusEffects.png"); Minecraft mc = Minecraft.getMinecraft(); @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { //onClientTick(); } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { onClientTick(); } private void onClientTick() { ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); int i = ((width - 176) / 2) - 64; int j = (height - 166) / 2; boolean flag = true; Collection collection = this.mc.thePlayer.getActivePotionEffects(); if (!collection.isEmpty()) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); int k = 33; if (collection.size() > 5) { k = 132 / (collection.size() - 1); } for (Iterator iterator = this.mc.thePlayer.getActivePotionEffects().iterator(); iterator.hasNext(); j += k) { PotionEffect potioneffect = (PotionEffect)iterator.next(); Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.func_110434_K().func_110577_a(location); this.drawTexturedModalRect(i, j, 0, 166, 140, 32); if (potion.hasStatusIcon()) { int l = potion.getStatusIconIndex(); this.drawTexturedModalRect(i + 6, j + 7, 0 + l % 8 * 18, 198 + l / 8 * 18, 18, 18); } String s = I18n.func_135053_a(potion.getName()); if (potioneffect.getAmplifier() == 1) { s = s + " II"; } else if (potioneffect.getAmplifier() == 2) { s = s + " III"; } else if (potioneffect.getAmplifier() == 3) { s = s + " IV"; } mc.fontRenderer.drawStringWithShadow(s, i + 10 + 18, j + 6, 16777215); String s1 = Potion.getDurationString(potioneffect); mc.fontRenderer.drawStringWithShadow(s1, i + 10 + 18, j + 6 + 10, 8355711); } } } public void drawTexturedModalRect(int par1, int par2, int par3, int par4, int par5, int par6) { float zLevel = 200.0F; float f = 0.00390625F; float f1 = 0.00390625F; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + par6), (double)zLevel, (double)((float)(par3 + 0) * f), (double)((float)(par4 + par6) * f1)); tessellator.addVertexWithUV((double)(par1 + par5), (double)(par2 + par6), (double)zLevel, (double)((float)(par3 + par5) * f), (double)((float)(par4 + par6) * f1)); tessellator.addVertexWithUV((double)(par1 + par5), (double)(par2 + 0), (double)zLevel, (double)((float)(par3 + par5) * f), (double)((float)(par4 + 0) * f1)); tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)zLevel, (double)((float)(par3 + 0) * f), (double)((float)(par4 + 0) * f1)); tessellator.draw(); } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.PLAYER); } @Override public String getLabel() { return null; } }
  20. Okay, put it in a client tick handler and it works. Kind of. It keeps randomly blinking and I'm not sure how to fix that.
  21. Okay, that kind of works, but I use methods like drawTexturedModalRect that only work if the class it is inside extends Gui.
  22. I tried something like that, but the only problem is I don't know how to make something render outside of a render class.
  23. I have made a potion for my mod and I have also made its effect, the only problem is I don't know how to make it render a custom icon when it is applied to the player. I have found a way to do it in normal minecraft when a gui is not open with the RenderGameOverlayEvent. How would I make it so that when the players inventory is open my effect renderer (which only has a different texture btw) will render over the existing mine craft potion buff renderer. Or even better is there a way I can simply change the mine craft inventory texture without a resource pack.
  24. That doesn't work either, it just makes a bunch of weird client-server mismatches.
×
×
  • Create New...

Important Information

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