Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

NerdicusUltimus

Members
  • Joined

  • Last visited

Everything posted by NerdicusUltimus

  1. Nope, it still doesn't work. Thanks anyways though!
  2. I have a new entity, but when I log out of the world, the entity despawns and isn't there when I come back in. I'm using the latest version of forge (I think) and MC 1.4.2. EntityMech.java (without the pointless parts, only the important ones I think) package nerdicus.fwc; import java.util.Iterator; import java.util.List; import java.util.UUID; import net.minecraft.src.AxisAlignedBB; import net.minecraft.src.Block; import net.minecraft.src.DamageSource; import net.minecraft.src.Entity; import net.minecraft.src.EntityBoat; import net.minecraft.src.EntityPlayer; import net.minecraft.src.EntityTracker; import net.minecraft.src.Item; import net.minecraft.src.Material; import net.minecraft.src.MathHelper; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagDouble; import net.minecraft.src.NBTTagFloat; import net.minecraft.src.NBTTagList; import net.minecraft.src.World; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; public class EntityMech extends Entity { private boolean field_70279_a; private double field_70276_b; private int mechPosRotationIncrements; private double mechX; private double mechY; private double mechZ; private double mechYaw; private double mechPitch; @SideOnly(Side.CLIENT) private double velocityX; @SideOnly(Side.CLIENT) private double velocityY; @SideOnly(Side.CLIENT) private double velocityZ; public EntityMech(World par1World) { super(par1World); this.field_70279_a = true; this.field_70276_b = 0.07D; this.preventEntitySpawning = true; this.setSize(1.5F, 0.6F); this.yOffset = this.height / 2.0F; } protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ})); par1NBTTagCompound.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ})); par1NBTTagCompound.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch})); par1NBTTagCompound.setFloat("FallDistance", this.fallDistance); //par1NBTTagCompound.setShort("Fire", (short)this.fire); par1NBTTagCompound.setShort("Air", (short)this.getAir()); par1NBTTagCompound.setBoolean("OnGround", this.onGround); par1NBTTagCompound.setInteger("Dimension", this.dimension); //if (persistentID != null) //{ // par1NBTTagCompound.setLong("PersistentIDMSB", persistentID.getMostSignificantBits()); // par1NBTTagCompound.setLong("PersistentIDLSB", persistentID.getLeastSignificantBits()); //} //if (customEntityData != null) //{ // par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData); //} this.writeEntityToNBT(par1NBTTagCompound); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { NBTTagList var2 = par1NBTTagCompound.getTagList("Pos"); NBTTagList var3 = par1NBTTagCompound.getTagList("Motion"); NBTTagList var4 = par1NBTTagCompound.getTagList("Rotation"); this.motionX = ((NBTTagDouble)var3.tagAt(0)).data; this.motionY = ((NBTTagDouble)var3.tagAt(1)).data; this.motionZ = ((NBTTagDouble)var3.tagAt(2)).data; if (Math.abs(this.motionX) > 10.0D) { this.motionX = 0.0D; } if (Math.abs(this.motionY) > 10.0D) { this.motionY = 0.0D; } if (Math.abs(this.motionZ) > 10.0D) { this.motionZ = 0.0D; } this.prevPosX = this.lastTickPosX = this.posX = ((NBTTagDouble)var2.tagAt(0)).data; this.prevPosY = this.lastTickPosY = this.posY = ((NBTTagDouble)var2.tagAt(1)).data; this.prevPosZ = this.lastTickPosZ = this.posZ = ((NBTTagDouble)var2.tagAt(2)).data; this.prevRotationYaw = this.rotationYaw = ((NBTTagFloat)var4.tagAt(0)).data; this.prevRotationPitch = this.rotationPitch = ((NBTTagFloat)var4.tagAt(1)).data; this.fallDistance = par1NBTTagCompound.getFloat("FallDistance"); //this.fire = par1NBTTagCompound.getShort("Fire"); this.setAir(par1NBTTagCompound.getShort("Air")); this.onGround = par1NBTTagCompound.getBoolean("OnGround"); this.dimension = par1NBTTagCompound.getInteger("Dimension"); this.setPosition(this.posX, this.posY, this.posZ); this.setRotation(this.rotationYaw, this.rotationPitch); //if (par1NBTTagCompound.hasKey("ForgeData")) //{ // customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData"); //} //if (par1NBTTagCompound.hasKey("PersistentIDMSB") && par1NBTTagCompound.hasKey("PersistentIDLSB")) //{ // persistentID = new UUID(par1NBTTagCompound.getLong("PersistentIDMSB"), par1NBTTagCompound.getLong("PersistentIDLSB")); //} this.readEntityFromNBT(par1NBTTagCompound); } Sorry about indentation issues FutureWarCraft.java package nerdicus.fwc; //Change this to your package import net.minecraft.src.Block; import net.minecraft.src.EnumCreatureType; import net.minecraft.src.FurnaceRecipes; import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraft.src.ModLoader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @NetworkMod(clientSideRequired=true, serverSideRequired=false) @Mod(modid="FWC", name="Future Warcraft", version="Alpha v0.1") public class FutureWarCraft { @Instance public FutureWarCraft instance; @Init public void FWCInit(FMLInitializationEvent initEvent) { EntityRegistry.registerModEntity(EntityMech.class, "FWCMech", EntityRegistry.findGlobalUniqueEntityId(), instance, 50, 50, true); } Again, sorry about any possible issues. Any ideas? The entity spawns fine, but it just doesn't save itself. I just copied the boat code and modified it a little bit, but it's not working. If you need any more of the code, I'd be glad to supply it. I've had this problem for about 1.5 months.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.