Jump to content

Taji34

Forge Modder
  • Posts

    147
  • Joined

  • Last visited

Everything posted by Taji34

  1. Right...that would make sense...I guess I was just over complicating the problem. However, if the reference doesnt become null, how can I tell the player when the player logs out on SP if the player log out event wont work on SP? And I had already figured thr client thing out.
  2. I do have a reference to the thrower, but the player log out event only works on dedicated servers, not single player, and I need it to work on both. As for Minecraft throwables, I discovered that the client side entity does not store the thrower, only the server side. In addition, my entity bases its flight path on where the player is, so it's constantly using the reference to the thrower, where Minecraft throwables do not call their thrower. So they don't have null pointer issues while I do.
  3. Exactly, so when the thrower logs out/the server shuts down, I want to kill the entity so it doesn't try to get the thrower. Does that make sense?
  4. Basically, the entity has a value stored that becomes null if the player logs out. this causes a null pointer exception. My original solution was to look for player log out events, and delete the entity before the value becomes null (the entity is only relevant when the player it came from is online), but this only works on dedicated servers. To work on single player I figured the next best event would be the world unload event, since it happens when the player logs out on single player.
  5. First my code: @SubscribeEvent public void killIdentitytDiscs(WorldEvent.Unload event){ for(int i = 0; i < event.world.loadedEntityList.size(); i++){ Entity currentEntity = (Entity) event.world.loadedEntityList.get(i); if(currentEntity instanceof IdentityDiscEntity){ EntityPlayer player = (EntityPlayer) ((IdentityDiscEntity)currentEntity).getThrower(); if(!player.capabilities.isCreativeMode){ player.inventory.addItemStackToInventory(((IdentityDiscEntity)currentEntity).drop); } currentEntity.setDead(); System.out.println("I Ran"); } } } The console will print out "I Ran" when exiting the world, but when loading up the world again, the entity hasn't been deleted. Any ideas?
  6. So I've found that my custom flying entity (like a snowball) will crash a world if it is present in it when I exit the world. When I go to open the world, a null pointer exception happens and the game crashes. Basically, when the world saves, it doesn't save a certain value, which is then called on in the onUpdate() method, and causes a null pointer error. Is there anyway to tell the server to save that value when shutting down? Otherwise, it there a way to tell when the server is shutting down so I can just set all those entities to dead before? I figured this didn't need any code, but if I'm wrong just ask me to post it.
  7. Is this even possible? My goal is to take one itemStack and add to an integer stored in its NBT tag as a result of the crafting recipe. I've tried to do some googling but nothing seems to be what I want to do. Does anyone know how I would go about doing this? EDIT: Figured it out
  8. Well, after some investigating I found this code in the default block class: public boolean isToolEffective(String type, int metadata) { if ("pickaxe".equals(type) && (this == Blocks.redstone_ore || this == Blocks.lit_redstone_ore || this == Blocks.obsidian)) return false; if (harvestTool[metadata] == null) return false; return harvestTool[metadata].equals(type); } Which sorta explains why the redstone (which I can still mine properly) and obsidian are taking so long, though an iron pickaxe, even though it doesn't harvest obsidian, still doesn't take nearly as long to mine. Which means the iron pickaxe is getting around that somehow. I placed the following code into my pickaxe code:[s/] System.out.println(block.getHarvestTool(meta)); I when mining Stone Bricks or Quartz it prints out null, which doesn't make any sense, since an iron pickaxe works fine on both. So I've concluded there must be something that I am missing that I can't seem to figure out. After some looking at the Tinker's Construct code and some javadoc reading I figured out how to get everything working! Check out the Baton.java source code for my mod here to check out how I solved my problem.
  9. After some investigation, I found that the client is calling a different constructor (The object has three) so I think it's registered properly. After setting the dummy value in all constructors and then updating it using updateObject() in the constructor the server uses, everything works! Thanks!
  10. So I didn't use the built in tool material mechanic to make my custom pickaxe, and I wanted it to be upgradable and what not. So I use NBT data to store an int array in the itemstack: int[] material = {2, 6, 4}; //Harvest Level, efficiencyOnProperMaterial, damageVsEntities par1ItemStack.stackTagCompound.setIntArray("pickaxe", material); Then I overrode the default getHarvestLevel method inherited from the Item class to reflect this: @Override public int getHarvestLevel(ItemStack stack, String toolClass) { String batonClass = stack.stackTagCompound.getString("Class"); if (batonClass.equals("pickaxe")) { int[] material = stack.stackTagCompound.getIntArray(batonClass); return material[0]; } return -1; } I have also overriden the following two methods as well: @Override public Set<String> getToolClasses(ItemStack stack) { Set<String> set = new HashSet<>(); if (stack.stackTagCompound!= null) { set.add(stack.stackTagCompound.getString("Class")); } return set; } @Override public float getDigSpeed(ItemStack stack, Block block, int meta) { System.out.println(block.getHarvestTool(meta)); if (ForgeHooks.isToolEffective(stack, block, meta)) { String itemClass = stack.stackTagCompound.getString("Class"); int[] material = stack.stackTagCompound.getIntArray(itemClass); return (float)material[1]; } return super.getDigSpeed(stack, block, meta); } My pickaxe works just like an iron pickaxe on all blocks except the ones I listed.
  11. I was following the tutorial on the wiki. Should I just be calling it directly when I want to add something or no? Also, I took the If statement out of the constructor to check if it was on the server and it's still crashing with the same error. EDIT: I realized the constructor was only being called on the server, so the client never gets the info added. How would I go about doing this?
  12. Oh, that makes sense, I have it in the constuctor now. That's what I figured but I'm still having issues. private DataWatcher dw = this.getDataWatcher(); This is the global variable I have for the data watcher. if(!this.worldObj.isRemote){ dw.addObject(2, this.thrower.getEntityId()); //Thrower ID } This is what I have in the constructor. System.out.println(dw.getWatchableObjectInt(2) + " Read"); And this is the code the is causing a null pointer error in the onUpdate() function of the entity. Specifically this is what prints to the console when the entity is spawned:
  13. Nope, that's not it, I have the hardness level set equivalent to that of an iron pickaxe. But it is not behaving the same way, which is what is confusing me. I also had it print out the harvestTool to the console and StoneBrick and Quartz print out null. Which is obviously not true since iron pickaxes aren't slow against StoneBrick and Quartz.
  14. I've having some trouble with DataWatcher. The tutorial on the wiki says to put adding the values into the datawatcher in the entityInit() method, however the value I need to set gets set in the constructor, but entityInit() is called before the constructor for some reason. Also, will the client and server version of the entity have the same datawatcher? Or do I still need to pass the value to the client's datawatcher?
  15. I have stumbled upon the fact that Stone Bricks and Quartz don't have a tool that is efficient against them. This confuses me, since it seems vanilla Pickaxes are efficient against them, however my custom pickaxe is not. My pickaxe works perfectly on all blocks excluding Stone Bricks, Quartz, Redstone Ore (For a different reason), and Obsidian (for the same reason as redstone). Is there something I'm missing that the Vanilla Pickaxes are doing?
  16. Well, I'm making a an object that comes back to the player, so I need the throwers current position and I figured if I just changed the entities position on the server, then the client would go out of sync with the server, is that not the case?
  17. I've created a custom throwable class which is basically minecraft's default throwable class with a few values changed. I'm trying to do some math based on where the entity is in relation to the player that threw it. However, the client side copy of the entity has the thrower as null while the server doesn't. This causes null pointer errors when I try to access the thrower and it runs on the client. Any idea how to get the client and server synced correctly? Taji34EntityThrowable.java: package com.taji34.troncraft; import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IProjectile; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public abstract class Taji34EntityThrowable extends Entity implements IProjectile { private int field_145788_c = -1; private int field_145786_d = -1; private int field_145787_e = -1; private Block field_145785_f; protected boolean inGround; public int throwableShake; /** The entity that threw this throwable item. */ private EntityLivingBase thrower; private String throwerName; private int ticksInGround; private int ticksInAir; private static final String __OBFID = "CL_00001723"; public Taji34EntityThrowable(World par1World) { super(par1World); this.setSize(0.25F, 0.25F); } protected void entityInit() {} /** * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge * length * 64 * renderDistanceWeight Args: distance */ @SideOnly(Side.CLIENT) public boolean isInRangeToRenderDist(double par1) { double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; d1 *= 64.0D; return par1 < d1 * d1; } public Taji34EntityThrowable(World par1World, EntityLivingBase par2EntityLivingBase) { super(par1World); this.thrower = par2EntityLivingBase; this.setSize(0.25F, 0.25F); this.setLocationAndAngles(par2EntityLivingBase.posX, par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight(), par2EntityLivingBase.posZ, par2EntityLivingBase.rotationYaw, par2EntityLivingBase.rotationPitch); this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); this.posY -= 0.10000000149011612D; this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); this.setPosition(this.posX, this.posY, this.posZ); this.yOffset = 0.0F; float f = 0.4F; this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f); this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f); this.motionY = (double)(-MathHelper.sin((this.rotationPitch + this.func_70183_g()) / 180.0F * (float)Math.PI) * f); this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.func_70182_d(), 1.0F); } public Taji34EntityThrowable(World par1World, double par2, double par4, double par6) { super(par1World); this.ticksInGround = 0; this.setSize(0.25F, 0.25F); this.setPosition(par2, par4, par6); this.yOffset = 0.0F; } protected float func_70182_d() { return 1.5F; } protected float func_70183_g() { return 0.0F; } /** * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction. */ public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) { float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); par1 /= (double)f2; par3 /= (double)f2; par5 /= (double)f2; par1 += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; par3 += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; par5 += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; par1 *= (double)par7; par3 *= (double)par7; par5 *= (double)par7; this.motionX = par1; this.motionY = par3; this.motionZ = par5; float f3 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)f3) * 180.0D / Math.PI); this.ticksInGround = 0; } /** * Sets the velocity to the args. Args: x, y, z */ @SideOnly(Side.CLIENT) public void setVelocity(double par1, double par3, double par5) { this.motionX = par1; this.motionY = par3; this.motionZ = par5; if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5); this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)f) * 180.0D / Math.PI); } } /** * Called to update the entity's position/logic. */ public void onUpdate() { this.lastTickPosX = this.posX; this.lastTickPosY = this.posY; this.lastTickPosZ = this.posZ; super.onUpdate(); if (this.throwableShake > 0) { --this.throwableShake; } if (this.inGround) { if (this.worldObj.getBlock(this.field_145788_c, this.field_145786_d, this.field_145787_e) == this.field_145785_f) { ++this.ticksInGround; if (this.ticksInGround == 1200) { this.setDead(); } return; } this.inGround = false; this.motionX *= (double)(this.rand.nextFloat() * 0.2F); this.motionY *= (double)(this.rand.nextFloat() * 0.2F); this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); this.ticksInGround = 0; this.ticksInAir = 0; } else { ++this.ticksInAir; } Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31); vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { vec31 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); } if (!this.worldObj.isRemote) { Entity entity = null; List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; EntityLivingBase entitylivingbase = this.getThrower(); for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity)list.get(j); if (entity1.canBeCollidedWith() && (entity1 != entitylivingbase || this.ticksInAir >= 5)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f); MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); if (movingobjectposition1 != null) { double d1 = vec3.distanceTo(movingobjectposition1.hitVec); if (d1 < d0 || d0 == 0.0D) { entity = entity1; d0 = d1; } } } } if (entity != null) { movingobjectposition = new MovingObjectPosition(entity); } } if (movingobjectposition != null) { if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ) == Blocks.portal) { this.setInPortal(); } else { this.onImpact(movingobjectposition); } } this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f1) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { ; } while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { this.prevRotationPitch += 360.0F; } while (this.rotationYaw - this.prevRotationYaw < -180.0F) { this.prevRotationYaw -= 360.0F; } while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { this.prevRotationYaw += 360.0F; } this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; float f2 = 0.99F; float f3 = this.getGravityVelocity(); if (this.isInWater()) { for (int i = 0; i < 4; ++i) { float f4 = 0.25F; this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ); } f2 = 0.8F; } this.motionX *= (double)f2; this.motionY *= (double)f2; this.motionZ *= (double)f2; this.motionY -= (double)f3; this.setPosition(this.posX, this.posY, this.posZ); System.out.println(this.thrower); } /** * Gets the amount of gravity to apply to the thrown entity with each tick. */ protected float getGravityVelocity() { return 0.03F; } /** * Called when this EntityThrowable hits a block or entity. */ protected abstract void onImpact(MovingObjectPosition var1); /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setShort("xTile", (short)this.field_145788_c); par1NBTTagCompound.setShort("yTile", (short)this.field_145786_d); par1NBTTagCompound.setShort("zTile", (short)this.field_145787_e); par1NBTTagCompound.setByte("inTile", (byte)Block.getIdFromBlock(this.field_145785_f)); par1NBTTagCompound.setByte("shake", (byte)this.throwableShake); par1NBTTagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); if ((this.throwerName == null || this.throwerName.length() == 0) && this.thrower != null && this.thrower instanceof EntityPlayer) { this.throwerName = this.thrower.getCommandSenderName(); } par1NBTTagCompound.setString("ownerName", this.throwerName == null ? "" : this.throwerName); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { this.field_145788_c = par1NBTTagCompound.getShort("xTile"); this.field_145786_d = par1NBTTagCompound.getShort("yTile"); this.field_145787_e = par1NBTTagCompound.getShort("zTile"); this.field_145785_f = Block.getBlockById(par1NBTTagCompound.getByte("inTile") & 255); this.throwableShake = par1NBTTagCompound.getByte("shake") & 255; this.inGround = par1NBTTagCompound.getByte("inGround") == 1; this.throwerName = par1NBTTagCompound.getString("ownerName"); if (this.throwerName != null && this.throwerName.length() == 0) { this.throwerName = null; } } @SideOnly(Side.CLIENT) public float getShadowSize() { return 0.0F; } public EntityLivingBase getThrower() { if (this.thrower == null && this.throwerName != null && this.throwerName.length() > 0) { this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName); } return this.thrower; } } Specifically I call System.out.println(this.thrower); and my console prints out [15:00:44] [server thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: EntityPlayerMP['Player914'/0, l='Test', x=-190.50, y=4.00, z=-385.50] [15:00:44] [Client thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: null [15:00:44] [Client thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: null [15:00:44] [server thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: EntityPlayerMP['Player914'/0, l='Test', x=-190.50, y=4.00, z=-385.50] [15:00:44] [server thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: EntityPlayerMP['Player914'/0, l='Test', x=-190.50, y=4.00, z=-385.50] [15:00:44] [Client thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: null [15:00:44] [server thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: EntityPlayerMP['Player914'/0, l='Test', x=-190.50, y=4.00, z=-385.50] [15:00:44] [Client thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: null [15:00:44] [Client thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: null [15:00:44] [server thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: EntityPlayerMP['Player914'/0, l='Test', x=-190.50, y=4.00, z=-385.50] [15:00:44] [server thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: EntityPlayerMP['Player914'/0, l='Test', x=-190.50, y=4.00, z=-385.50] [15:00:44] [Client thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: null [15:00:44] [Client thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: null [15:00:44] [server thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: EntityPlayerMP['Player914'/0, l='Test', x=-190.50, y=4.00, z=-385.50] [15:00:44] [Client thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: null [15:00:44] [server thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: EntityPlayerMP['Player914'/0, l='Test', x=-190.50, y=4.00, z=-385.50] [15:00:44] [server thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: EntityPlayerMP['Player914'/0, l='Test', x=-190.50, y=4.00, z=-385.50] [15:00:44] [Client thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: null [15:00:44] [server thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: EntityPlayerMP['Player914'/0, l='Test', x=-190.50, y=4.00, z=-385.50] [15:00:44] [Client thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: null [15:00:44] [server thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: EntityPlayerMP['Player914'/0, l='Test', x=-190.50, y=4.00, z=-385.50] [15:00:44] [Client thread/INFO] [sTDOUT]: [com.taji34.troncraft.Taji34EntityThrowable:onUpdate:279]: null The client and server seem out of sync and I don't know how to fix them. Any suggestions?
  18. So the entity is basically a snowball (I copied the Throwable entity class and changed a few values to change how it flew). The throwable entity class has a Thrower value on it to track the entity that threw it, this is built into the vanilla throwable entity class too. I'm trying to do some calculations based on the thrower, yet, the client version of the entity doesn't register the thrower, only the server side entity does. Because of this, I keep getting null pointer exceptions! Would one of your suggestions help fix that?
  19. How do I get an entities ID client side? I'm trying to send a packet to the server to find the server side copy of the entity to get info from for the client side entity, but I can't figure out how to get the integer ID from the client side entity. Any ideas?
  20. Is this how I should register the Item renderer? It doesn't seem to be working: Troncraft.java MinecraftForgeClient.registerItemRenderer(baton, batonRenderer); Figured it out, thanks!
  21. Thanks! That isn't quite what I was trying to get at but it is useful! What I mean is could someone explain the actual code in the Item Renderer. For example, I don't understand the code in this method: The variables are so abstract, I'm having trouble figuring out what it is doing so I can base my custom renderer off of it. Could someone explain the basics of rendering an item in the players hand so I can begin to understand how to make my custom renderer?
  22. I'm trying to make a custom renderer that is similar to the default renderer for tools (3d in hand and what not), but with some changes. My problem is that I can seem to figure out how the default Item renderer is working since all the variables are named weirdly and what not. Could ssomeone point me to a tutorial or explain what some of the variables are? Thank you! EDIT: I originally put [1.7.2] but I meant [1.7.10] just updated my workspace and forgot which version I was using.
  23. I'm creating an extra pickaxe, what the strength and efficiency of an Iron pickaxe, and I noticed that it is slower at mining redstone than an Iron pickaxe. When I looked in the code I found this code: public boolean isToolEffective(String type, int metadata) { if ("pickaxe".equals(type) && (this == Blocks.redstone_ore || this == Blocks.lit_redstone_ore || this == Blocks.obsidian)) return false; if (harvestTool[metadata] == null) return false; return harvestTool[metadata].equals(type); } In the Block.class file. How is the iron pickaxe getting around this part of code? By all means as far as I can tell the Iron Pickaxe should be slow as well. Does anyone have any ideas? Redstone (and if this is the code causing the problem, obsidian also) is the only block that my pickaxe is slower than the Iron pickaxe on.
  24. First Version released!
  25. Thanks, that worked! For future reference, how would I what are forge events and what are FML events? Edit: So the event is running when I shift click the item, but the tags are still not being added. Here's my code for the event: public void onCrafted(PlayerEvent.ItemCraftedEvent event) { if(event.crafting.getItem() instanceof IdentityDisc){ System.out.println("I Ran"); event.crafting.stackTagCompound = new NBTTagCompound(); event.crafting.stackTagCompound.setString("Owner", event.player.getDisplayName()); } }
×
×
  • Create New...

Important Information

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