Jump to content

The_Fireplace

Forge Modder
  • Posts

    243
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by The_Fireplace

  1. Looks great, thanks. Specifically, I have an annotation processor that produces a configuration file in json format. Rather than scanning for that file from all places at once, I've set it up so a given mod will only pull in its own configuration and those of its dependencies, to reduce risk of another mod's configuration getting pulled in during setup, breaking, and crashing with the wrong ModContainer reported as causing the crash.

  2. Is there a way to get a resource file from a given mod container on 1.16.5? I've found modContainer.get().getModInfo().getOwningFile().getFile().findResource() on 1.18.2, but IModFileInfo#getFile() doesn't seem to be present in the ForgeSPI version used for 1.16.5. Is there an alternate way to get a resource file (or the IModFile) from a specific mod on 1.16.5?

  3. 16 hours ago, Laike_Endaril said:

    I've solved this in my build protection system by canceling the event on both server and client side, using the same conditions.  I can do this in my system, but it may not be feasible in yours if the data needed for the check only exists server-side.

    Cancelling the event server-side ensures nobody can cheat their way past your protection (for the most part).

    Cancelling the event client-side doesn't, but if used in addition to the server-side function can make your protection "prettier" by preventing the inventory desync.  If someone hacks past it, it will just prevent it server-side (again, only if you're also doing the check server-side, in an identical fashion), and give them the inventory desync, so no benefit for them aside from the very brief window of the block not existing client-side which could allow them to jump on top of it or w/e...but if they're hacking past your protection to do that, they could just as easily use simpler hacks to accomplish the same thing.

     

    Once again, I only suggest this if you can do your check identically on both server and client.

    Yeah, the entire mod, including the data used for the check, is only on the server side.

     

    Since the original post, I've also tried decreasing the stack size of the block when I cancel the event then adding the block to the inventory, but that didn't fix it either.

  4. Hello,

    After cancelling BlockEvent.PlaceEvent on the server side, I'd like to make sure the client knows the block hasn't been placed.

    I've tried EntityPlayer.inventory.markDirty(), as well as overwriting the stack in the slot with itself, but neither updated the client. Ideally I'd like a way to do this on the server side only, without having to make changes to the client, because the mod I'm doing this in is intended to run on the server side only. If anyone has any suggestions about how to make this work, please let me know. I'll edit the post if I come up with a solution.

     

    EDIT: Solved by adding the following after cancelling the event:

    EntityEquipmentSlot hand = event.getHand().equals(EnumHand.MAIN_HAND) ? EntityEquipmentSlot.MAINHAND : EntityEquipmentSlot.OFFHAND;
    ((EntityPlayerMP) event.getPlayer()).connection.sendPacket(new SPacketEntityEquipment(event.getPlayer().getEntityId(), hand, event.getPlayer().getItemStackFromSlot(hand)));

     

  5. For a while, it was working fine, then my game started crashing on launch. First thing I did was disable all mods and attempt to reproduce the issue, and it continued.

    Here is my latest.log:

    http://paste.ubuntu.com/24779792/

    And (I don't see how this helps any more than the log), the crash report:

    http://paste.ubuntu.com/24779841/

     

    Forge 13.20.0.2313

    Minecraft 1.11.2

     

    EDIT: It looks like the resolution it was trying to run at was wrong; I had switched monitors before the crash started occurring. To fix the issue, I disabled fullscreen in options.txt and tweaked the resolution in the launcher settings.

     

    EDIT 2: This is a huge pain, it happens every time I launch the game and it tries to enter fullscreen. Going to test on a new instance and see if I can reproduce the issue. If so, I'd assume it's a Forge bug.

     

    EDIT 3: After a bit of research, it turns out it is a vanilla bug.

  6. Depends. Is it just that you need to use server-side data for something on the client? Or are you actually trying to have the server do something? If what you want is the former, I would use packets to request the information from the server and have it sent back to the client. If you want the latter, I would look in to using LivingUpdateEvent, check if the entity is a player, and write code similar to Entity::rayTrace() (A client only method, which is why you would need to recreate something similar) to determine if the player is looking at an entity.

  7. Hey guys, I want to render an itemstack from a slot in my entity's inventory above the entity. I would prefer for it to render like the EntityItem does. My question is, how do you recommend I do this? I would like to avoid causing a noticeable performance hit if possible.

    It should also be noted that I plan to have this rendering disabled by default, and enabled by either using a keybind or equipping an item.

  8. 10 hours ago, Choonster said:

    This exception is caused by a client-to-server message (which Forge limits to a single CPacketCustomPayload, i.e. 32,767 bytes), not a server-to-client message.(which Forge splits into a a maximum of 255 SPacketCustomPayloads, i.e. 267,366,480 bytes).

     

    Do you need to send all of that data to the server at once? Can you send individual parts that have changed, possibly through the Container?

     

    You shouldn't be storing mutable game data in a field of your @Mod class (Caterpillar#mainContainers), since it's shared between logical sides in single player. You should be using World Capabilities or World Saved Data (if storing the data directly in the TileEntity isn't an option).

     

    Iterating through a server's World's to find a block at a specific position is very unreliable, what happens when two dimensions have a drill at the same position?

    Ah, I see. Thanks for the explanation, it should be somewhat easy to fix now, since the client shouldn't have any reason in this mod to need to send that much data to the server.

     

    Thanks for the suggestions, I will work on them today. You've pointed out several problems and ways to fix them that I wouldn't have caught. As for the why of all of that bad design, that was the original author's doing, and I have been working on fixing it for a while now.

  9. So, I send a packet that contains one NBTTagCompound containing a lot of data(Mostly inventories within a tile entity). Unfortunately, it seems to be too large, since I get the following crash upon sending.

    http://paste.ubuntu.com/24062837/

    My question to you is, how do you suggest I redesign the system to reduce the packet size?

    My current way of doing things involves sending the packet to the client just before the GUI opens. This packet contains all of the entity's data, including inventory, which the client needs or else it will crash upon opening the GUI.

    The creation of the NBT Tag Compound

    The packet

     

    If anyone knows of a way to reduce packet size or simply split this in to as many smaller packets as needed, it would be greatly appreciated.

  10. Alright, found kind of a workaround. If you manipulate the item json correctly with rotation and scaling, you can flatten it and make it look like a normal item. The only part I have done so far is the gui part, which I will post below, and if I ever do the in-hand renderings, I will post that too. If anyone else needs to do it before I do, I have found that Item Transform Helper is very useful for doing this.

    "display": {
        "gui": {
          "rotation": [ 0, 45, 32 ],
          "translation": [ 0.00, 0.00, 0.00 ],
          "scale": [ 1.50, 1.50, 1.50 ]
        }
      }

    Thanks for trying to help out, and feel free to respond if you have a code fix.

  11. Try item/generated

     

    Not that I've used a custom TextureAtlasSprite with the new model system yet.

    item/generated wasn't introduced until 1.9(or at least, wasn't used for the vanilla items before then, idk if it existed code-wise), and I am working on 1.8.9. Still, I went ahead and gave it a shot, and it still rendered like an itemblock(same as I showed in the first post), along with giving me this error in the console.

     

    Edit: It appears that setting it to anything vanilla causes it to switch to the vanilla Compass's TextureAtlasSprite. I just tried making that line item/potato and it caused it to switch to the vanilla Compass's.

  12. Hey guys, I have made something with a custom TextureAtlasSprite, but when it renders, it looks like this:

    width=32 height=32kNKSEnM.png?1 [/img]

    Functionally, the texture works fine, I just need it to render like an item.

    My TextureAtlasSprite class:

    https://github.com/The-Fireplace/UHC-Compass/blob/master/src/main/java/the_fireplace/uhccompass/TextureUHCCompass.java

     

    Note that this is currently for 1.8.9, though I plan on updating it once it is completed.

  13. Hello everyone, I am trying to add combat AI to my custom entity, and I get the following NPE when it is trying to create Melee attack AI:

    http://paste.ubuntu.com/23243073/

    Honestly, I' a little confused about this one, because I see no way this should throw an NPE. Anyways, the code for my entity:

    https://github.com/The-Fireplace/Overlord/blob/master/src/main/java/the_fireplace/overlord/entity/EntitySkeletonWarrior.java

    Any help with solving this would be greatly appreciated.

  14. You need to have it use your modid as well. For example:

    ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation("everythinginbetween:"+item.getRegistryName(), "inventory"));
    

    If that doesn't work, try the following code instead(this is how I register mine, so I know this method works):

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("everythinginbetween:" + item.getRegistryName(), "inventory"));
    

  15. I have searched the forums for this issue, and after looking at about 10 different threads, I have only found a single answer that (should have) helped me with this issue:

     

     

    I suspect that your fuse counter (variable within your entity class) does only change within the serverside scope, which means the fuse won't be visible to the client and thus rendering your entity white all the time.

    You need to sync the fuse with the client and the easiest way to do this is to use a DataWatcher.

    Define a new DataWatcherObject (with this.dataWatcher.addObject(...)) within entityInit

    on the server side (if worldObj.isRemote == false) set the object's value to the fuse variable in your onUpdate method after it gets updated with dataWatcher.updateObject(...)

    on the client side (if worldObj.isRemote == true)  set the value of the fuse variable to the dataWatcherObject's value with getWatchableObjectInt(...)

     

    If you don't understand what I mean, here have some pseudocode:

    Entity Class
    ----------
    entityInit():
        dataWatcher->addObject(id, Integer.valueOf(0))    | id must be unique! If you get a crash because an already given ID, try another one
                                                          | second param must be casted to the datatype you wanna put in there, here Integer (BTW, the cast is not pseudocode)
    
    onUpdate(): (at the end within the method)
        if world is not remote:
            dataWatcher->updateObject(id, fuse)    | id must be the same as the above defined one
        else:
            fuse = dataWatcher->getWatchableObjectInt(id)    | id, same as above

    http://www.minecraftforge.net/forum/index.php/topic,16627.msg84436.html#msg84436

     

     

    After following these instructions, my entity is still a white cube. Here is my code:

     

     

    Render class:

    package the_fireplace.wars.client.render;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.BlockRendererDispatcher;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.client.renderer.entity.RenderManager;
    import net.minecraft.client.renderer.texture.TextureMap;
    import net.minecraft.entity.Entity;
    import net.minecraft.util.ResourceLocation;
    import org.lwjgl.opengl.GL11;
    import the_fireplace.wars.entities.EntityPTNTPrimed;
    import the_fireplace.wars.init.WarsBlocks;
    
    /**
    * @author The_Fireplace
    */
    public class RenderPTNTPrimed extends Render {
        public RenderPTNTPrimed(RenderManager rm)
        {
            super(rm);
            this.shadowSize = 0.5F;
        }
    
        public void doRender(EntityPTNTPrimed entity, double x, double y, double z, float p_76986_8_, float partialTicks)
        {
            BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
            GL11.glPushMatrix();
            GL11.glTranslatef((float)x, (float)y, (float)z);
            float f2;
    
            if ((float)entity.fuse - partialTicks + 1.0F < 10.0F)
            {
                f2 = 1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 10.0F;
    
                if (f2 < 0.0F)
                {
                    f2 = 0.0F;
                }
    
                if (f2 > 1.0F)
                {
                    f2 = 1.0F;
                }
    
                f2 *= f2;
                f2 *= f2;
                float f3 = 1.0F + f2 * 0.3F;
                GL11.glScalef(f3, f3, f3);
            }
    
            f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F;
            this.bindEntityTexture(entity);
            blockRenderer.renderBlockBrightness(WarsBlocks.playerTNT.getDefaultState(), entity.getBrightness(partialTicks));
    
            if (entity.fuse / 5 % 2 == 0)
            {
                GL11.glDisable(GL11.GL_TEXTURE_2D);
                GL11.glDisable(GL11.GL_LIGHTING);
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, f2);
                blockRenderer.renderBlockBrightness(WarsBlocks.playerTNT.getDefaultState(), 1.0F);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                GL11.glDisable(GL11.GL_BLEND);
                GL11.glEnable(GL11.GL_LIGHTING);
                GL11.glEnable(GL11.GL_TEXTURE_2D);
            }
    
            GL11.glPopMatrix();
        }
    
        @Override
        protected ResourceLocation getEntityTexture(Entity entity)
        {
            return TextureMap.locationBlocksTexture;
        }
    
        @Override
        public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTicks)
        {
            this.doRender((EntityPTNTPrimed) entity, x, y, z, p_76986_8_, partialTicks);
        }
    }
    

    Entity class:

    package the_fireplace.wars.entities;
    
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.util.AxisAlignedBB;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.EnumParticleTypes;
    import net.minecraft.world.World;
    
    import java.util.List;
    
    public class EntityPTNTPrimed extends Entity {
    /** How long the fuse is */
    public int fuse;
    
    public EntityPTNTPrimed(World par1World) {
    	super(par1World);
    	fuse = 50;
    	preventEntitySpawning = true;
    	setSize(0.98F, 0.98F);
    	posY = height / 2.0F;
    }
    
    public EntityPTNTPrimed(World par1World, double par2, double par4, double par6, EntityLivingBase placer) {
    	this(par1World);
    	setPosition(par2, par4, par6);
    	float var8 = (float) (Math.random() * Math.PI * 2.0D);
    	motionX = -((float) Math.sin(var8)) * 0.02F;
    	motionY = 0.20000000298023224D;
    	motionZ = -((float) Math.cos(var8)) * 0.02F;
    	fuse = 50;
    	prevPosX = par2;
    	prevPosY = par4;
    	prevPosZ = par6;
    }
    
    @Override
    protected void entityInit() {
    	this.dataWatcher.addObject(31, new Integer(fuse));
    }
    
    /**
     * returns if this entity triggers Block.onEntityWalking on the blocks they
     * walk on. used for spiders and wolves to prevent them from trampling crops
     */
    @Override
    protected boolean canTriggerWalking() {
    	return false;
    }
    
    /**
     * Returns true if other Entities should be prevented from moving through
     * this Entity.
     */
    @Override
    public boolean canBeCollidedWith() {
    	return !isDead;
    }
    
    /**
     * Called to update the entity's position/logic.
     */
    @Override
    public void onUpdate() {
    	dataWatcher.updateObject(31, Integer.valueOf(fuse));
    	fuse = dataWatcher.getWatchableObjectInt(31);
    	prevPosX = posX;
    	prevPosY = posY;
    	prevPosZ = posZ;
    	motionY -= 0.03999999910593033D;
    	moveEntity(motionX, motionY, motionZ);
    	motionX *= 0.9800000190734863D;
    	motionY *= 0.9800000190734863D;
    	motionZ *= 0.9800000190734863D;
    
    	if (onGround) {
    		motionX *= 0.699999988079071D;
    		motionZ *= 0.699999988079071D;
    		motionY *= -0.5D;
    	}
    
    	if (fuse-- <= 0) {
    		worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, posX, posY, posZ, 1.0D, 0.0D, 0.0D);
    		worldObj.playSoundEffect(posX, posY, posZ, "random.explode", 4.0F, (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
    
    		setDead();
    
    		if (!worldObj.isRemote) {
    
    			explode();
    
    		}
    	} else {
    		worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, posX, posY + 0.5D, posZ, 0.0D, 0.0D, 0.0D);
    	}
    }
    
    @SuppressWarnings("unchecked")
    private void explode() {
    
    	List<EntityLiving> nearbyEntities = worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.fromBounds(posX - 5, posY - 5, posZ - 5, posX + 5, posY + 5, posZ + 5));
    	for (EntityLiving living : nearbyEntities) {
    		living.attackEntityFrom(DamageSource.setExplosionSource(null), 10);
    	}
    
    }
    
    /**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
    @Override
    protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
    	par1NBTTagCompound.setByte("Fuse", (byte) fuse);
    }
    
    /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
    @Override
    protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
    	fuse = par1NBTTagCompound.getByte("Fuse");
    }
    }
    

     

     

    If any more code is needed, here is my source code.

  16. Ok, so, my initial issue was that my custom TNT was rendering as a white cube. I searched every thread I could find related to that issue, and the only real answer I found was this:

     

     

    I suspect that your fuse counter (variable within your entity class) does only change within the serverside scope, which means the fuse won't be visible to the client and thus rendering your entity white all the time.

    You need to sync the fuse with the client and the easiest way to do this is to use a DataWatcher.

    Define a new DataWatcherObject (with this.dataWatcher.addObject(...)) within entityInit

    on the server side (if worldObj.isRemote == false) set the object's value to the fuse variable in your onUpdate method after it gets updated with dataWatcher.updateObject(...)

    on the client side (if worldObj.isRemote == true)  set the value of the fuse variable to the dataWatcherObject's value with getWatchableObjectInt(...)

     

    If you don't understand what I mean, here have some pseudocode:

    Entity Class
    ----------
    entityInit():
        dataWatcher->addObject(id, Integer.valueOf(0))    | id must be unique! If you get a crash because an already given ID, try another one
                                                          | second param must be casted to the datatype you wanna put in there, here Integer (BTW, the cast is not pseudocode)
    
    onUpdate(): (at the end within the method)
        if world is not remote:
            dataWatcher->updateObject(id, fuse)    | id must be the same as the above defined one
        else:
            fuse = dataWatcher->getWatchableObjectInt(id)    | id, same as above

    http://www.minecraftforge.net/forum/index.php/topic,16627.msg84436.html#msg84436

     

     

    So, I tried following what it said, and it seems that when I try to read the data from the DataWatcher, it throws a NullPointerException repeatedly as long as the entity exists:

     

     

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: java.lang.NullPointerException

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at net.minecraft.entity.DataWatcher.getWatchableObjectInt(DataWatcher.java:93)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at the_fireplace.wars.entities.EntityPTNTPrimed.onUpdate(EntityPTNTPrimed.java:73)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2011)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at net.minecraft.world.World.updateEntity(World.java:1976)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at net.minecraft.world.World.updateEntities(World.java:1805)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at net.minecraft.client.Minecraft.runTick(Minecraft.java:2176)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1080)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at net.minecraft.client.Minecraft.run(Minecraft.java:380)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at net.minecraft.client.main.Main.main(Main.java:116)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at java.lang.reflect.Method.invoke(Method.java:497)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at java.lang.reflect.Method.invoke(Method.java:497)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at GradleStart.main(GradleStart.java:26)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at java.lang.reflect.Method.invoke(Method.java:497)

    [20:37:10] [Client thread/INFO]: [the_fireplace.wars.entities.EntityPTNTPrimed:onUpdate:75]: at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

     

     

    And here is the important part of my code:

     

     

    @Override
    protected void entityInit() {
    	if(!worldObj.isRemote)
    		this.dataWatcher.addObject(fuseID, Integer.valueOf(fuse));
    }
    

    @Override
    public void onUpdate() {
    	if(!worldObj.isRemote)
    		dataWatcher.updateObject(fuseID, Integer.valueOf(fuse));
    	else
    		try {
    			fuse = dataWatcher.getWatchableObjectInt(fuseID);
    		}catch(Exception e){
    			e.printStackTrace();
    		}
    

     

     

    The part surrounded by try/catch is what throws the NPE. If you need to see the full file, here is a link to it on github.

    Could anyone tell me what I am doing wrong?

×
×
  • Create New...

Important Information

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