Jump to content
  • Home
  • Files
  • Docs
Status Updates
  • All Content

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • The_Fireplace

The_Fireplace

Forge Modder
 View Profile  See their activity
  • Content Count

    241
  • Joined

    August 24, 2013
  • Last visited

    August 22, 2019
  • Days Won

    1

 Content Type 

  • All Activity

Profiles

  • Status Updates
  • Status Replies

Forums

  • Topics
  • Posts

Calendar

  • Events

Posts posted by The_Fireplace

  • Prev
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Next
  • Page 1 of 9  
  1. <SOLVED>[1.12.2] Updating the client's inventory after cancelling BlockEvent.PlaceEvent on the server side

    in Modder Support

    Posted February 26, 2019


    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.

  2. <SOLVED>[1.12.2] Updating the client's inventory after cancelling BlockEvent.PlaceEvent on the server side

    in Modder Support

    Posted February 25, 2019 · Edited February 28, 2019 by The_Fireplace
    Added solution


    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)));

     

  3. setupDecompWorkspace not found

    in ForgeGradle

    Posted February 15, 2019


    The command is no longer needed. Just open IntelliJ Idea/Eclipse and import build.gradle as a gradle project.

    • Like 1
  4. Mod not detected in the dev environment

    in Modder Support

    Posted October 27, 2018


    After running "gradlew setupDecompWorkspace idea" and opening the project in Idea, running the game does not detect the mod I'm working on. The only 4 mods that load are Minecraft, MCP, FML, and Forge.

    My build.gradle

    My main mod file

    My run configuration:

     

    Spoiler

    image.thumb.png.8e7e2307ec6dd6206d807c6e2cf19705.png

     

    Forge 14.23.5.2768

    ForgeGradle 2.3-SNAPSHOT

     

    If there is any other information I can provide to help get this resolved, please let me know.

  5. What does the acronym SRG stand for?

    in Modder Support

    Posted June 7, 2017


    SRG stands for Searge. He is one of the guys that works/worked on MCP, possibly the one that came up with that naming system.

    • Like 1
  6. [Vanilla bug]1.11.2 crashing on launch

    in Support & Bug Reports

    Posted June 5, 2017 · Edited June 7, 2017 by The_Fireplace
    Found the issue


    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.

  7. Adapting objectMouseOver() method's logic to use server side data.

    in Modder Support

    Posted March 31, 2017 · Edited March 31, 2017 by The_Fireplace


    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.

  8. Increase OBJ brightness...

    in Modder Support

    Posted March 31, 2017 · Edited March 31, 2017 by The_Fireplace


    Can we see your block code? It looks to me like one of the methods used in calculating the block's light value needs to be overridden.

  9. Rendering an itemstack above an entity

    in Modder Support

    Posted March 31, 2017


    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.

  10. [1.10.2]Suggestions on how to rework this to reduce packet size

    in Modder Support

    Posted February 25, 2017


    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.

  11. [1.10.2]Suggestions on how to rework this to reduce packet size

    in Modder Support

    Posted February 25, 2017


    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.

  12. Custom TextureAtlasSprite renders like an ItemBlock instead of a regular Item.

    in Modder Support

    Posted January 24, 2017


    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.

  13. Custom TextureAtlasSprite renders like an ItemBlock instead of a regular Item.

    in Modder Support

    Posted January 24, 2017


    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.

  14. Custom TextureAtlasSprite renders like an ItemBlock instead of a regular Item.

    in Modder Support

    Posted January 23, 2017


    You need to provide a model for your block that makes it use a 2D inventory model.

    And how do you suggest going about doing that? I know I'm probably derping on this one, but when I change this line to use builtin/generated, the item switches from my custom TextureAtlasSprite to the vanilla Compass's TextureAtlasSprite.

  15. Custom TextureAtlasSprite renders like an ItemBlock instead of a regular Item.

    in Modder Support

    Posted January 23, 2017


    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.

  16. [1.10.2/1.11] Adding hidden achievements

    in Modder Support

    Posted October 11, 2016


    Still no progress on this. Anyone have any ideas on the best way to go about doing this now?

  17. [1.10.2/1.11] Adding hidden achievements

    in Modder Support

    Posted October 2, 2016


    Hey guys, I found an old tutorial on adding hidden achievements to pages, so they don't show up until they've been achieved. However, several changes have been made since then(Achievements are now world based), and the actual code shown is pretty old.

    Does anyone know of a simple way to do this now?

  18. [1.10.2] NPE when creating melee attack AI for a custom entity

    in Modder Support

    Posted September 27, 2016


    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.

  19. [1.10.2] Texture/model not working properly?

    in Modder Support

    Posted August 9, 2016


    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"));
    

  20. [SOLVED][1.8.9]Custom TNT Entity is a white cube

    in Modder Support

    Posted August 9, 2016


    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.

  21. [SOLVED]NullPointerException reading a value from DataWatcher

    in Modder Support

    Posted August 9, 2016


    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?

  22. [1.10] Entity Texture Not Rendering

    in Modder Support

    Posted July 2, 2016


    Well, I'm out of ideas; I don't see any reason for this to not work. Are there any errors that show up in the log related to texture loading?

  23. [1.10] Entity Texture Not Rendering

    in Modder Support

    Posted July 2, 2016


    When is registerRenders() being called?

    It sounds to me like it is being called during FMLInitializationEvent; it needs to be called in FMLPreInitializationEvent.

  24. [1.10] [DERAILED] Using A Vanilla Item

    in Modder Support

    Posted July 1, 2016


    Everything is working besides the texture. Also, if I get in front of the hitbox, it pushes me forwards as I shoot. Heres the code for my renderer, my render factory, and my entity class, can you tell me what's wrong?: Renderer

    package com.averysumner.randomstuff;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.GlStateManager;
    import net.minecraft.client.renderer.RenderItem;
    import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
    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.init.Items;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.ResourceLocation;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    @SideOnly(Side.CLIENT)
    public class RenderProjectile extends Render {
    
        protected final Item itr;
        private final RenderItem ri;
        private ResourceLocation itemTexture;
    
        public RenderProjectile(RenderManager rm, Item projectile) {
            super(rm);
            this.itr = projectile;
            this.ri = Minecraft.getMinecraft().getRenderItem();
        }
    
        public RenderProjectile(RenderManager rm, Item projectile, ResourceLocation texture) {
            super(rm);
            this.itr = projectile;
            this.ri = Minecraft.getMinecraft().getRenderItem();
            this.itemTexture = texture;
        }
    
        @Override
        protected ResourceLocation getEntityTexture(Entity entity) {
            if (this.itr == Items.SLIME_BALL)
                return new ResourceLocation("minecraft:items/slimeball");
            else if (this.itemTexture != null)
                return itemTexture;
            else
                return new ResourceLocation("minecraft:items/coal");
        }
    
        @Override
        public void doRender(Entity entity, double x, double y, double z, float f, float partialTicks) {
            GlStateManager.pushMatrix();
            GlStateManager.translate((float) x, (float) y, (float) z);
            GlStateManager.enableRescaleNormal();
            GlStateManager.scale(0.5F, 0.5F, 0.5F);
            GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
            this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            this.ri.renderItem(new ItemStack(this.itr), ItemCameraTransforms.TransformType.GROUND);
            GlStateManager.disableRescaleNormal();
            GlStateManager.popMatrix();
            super.doRender(entity, x, y, z, f, partialTicks);
        }
    }

    RenderFactory

    package com.averysumner.randomstuff;
    
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.client.renderer.entity.RenderManager;
    import net.minecraft.item.Item;
    import net.minecraft.util.ResourceLocation;
    import net.minecraftforge.fml.client.registry.IRenderFactory;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    @SideOnly(Side.CLIENT)
    public class ProjectileRenderFactory implements IRenderFactory<EntitySlimeball> {
    
        private Item projectile;
        private ResourceLocation location;
    
        public ProjectileRenderFactory(Item item){
            projectile=item;
        }
    
        public ProjectileRenderFactory(Item item, ResourceLocation loc){
            projectile=item;
            location=loc;
        }
    
        @Override
        public Render<? super EntitySlimeball> createRenderFor(RenderManager manager) {
            if(location != null)
                return new RenderProjectile(manager, projectile, location);
            else
                return new RenderProjectile(manager, projectile);
        }
    }

    Entity

    package com.averysumner.randomstuff;
    
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.monster.EntityBlaze;
    import net.minecraft.entity.projectile.EntityThrowable;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.EnumParticleTypes;
    import net.minecraft.util.datafix.DataFixer;
    import net.minecraft.util.math.RayTraceResult;
    import net.minecraft.world.World;
    
    public class EntitySlimeball extends EntityThrowable
    {
        public EntitySlimeball(World worldIn)
        {
            super(worldIn);
        }
    
        public EntitySlimeball(World worldIn, EntityLivingBase throwerIn)
        {
            super(worldIn, throwerIn);
        }
    
        public EntitySlimeball(World worldIn, double x, double y, double z)
        {
            super(worldIn, x, y, z);
        }
    
        public static void func_189662_a(DataFixer p_189662_0_)
        {
            EntityThrowable.func_189661_a(p_189662_0_, "Slimeball");
        }
    
        /**
         * Called when this EntityThrowable hits a block or entity.
         */
        protected void onImpact(RayTraceResult result)
        {
            if (result.entityHit != null)
            {
                int i = 0;
    
                if (result.entityHit instanceof EntityBlaze)
                {
                    i = 3;
                }
    
                result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)i);
            }
    
            for (int j = 0; j < 8; ++j)
            {
                this.worldObj.spawnParticle(EnumParticleTypes.SLIME, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
            }
    
            if (!this.worldObj.isRemote)
            {
                this.setDead();
            }
        }
    }

    I need to see the code where you register it to know what the problem is. Also, this code over complicates things a bit, I didn't expect you to make an almost exact copy of the more complex of my two projectile rendering classes. My code there is designed for multiple projectiles to use the same class.

     

    Here is a simpler example, which better suits your purpose, that you can use if you want something to copy, paste, and edit, though I strongly suggest you look in to it and make sure you understand what all of it does.

    My renderprojectile:

    https://bitbucket.org/The_Fireplace/fires-random-things/src/master/src/main/java/the_fireplace/frt/client/renderers/RenderPigderPearl.java

    My Render factory:

    https://bitbucket.org/The_Fireplace/fires-random-things/src/master/src/main/java/the_fireplace/frt/client/renderers/PigderPearlRenderFactory.java

    And how I registered this is on line 31 of the ClientProxy class I linked you to before.

     

    Edit: as for the entity pushing you, I am too tired to look in to it right now. I suggest you start a new thread about it, we have already derailed this one enough.

  25. [1.10] [DERAILED] Using A Vanilla Item

    in Modder Support

    Posted July 1, 2016


    I got everything working, besides rendering my slimeball entity. When I use "RenderingRegistry.registerEntityRenderingHandler" I get @Deprecated, even if I use the factory version.

    Take a look at how my rendering is handled at

    https://bitbucket.org/The_Fireplace/fires-random-things/src/master/src/main/java/the_fireplace/frt/client/ClientProxy.java

    It isn't a big change from how you're doing it now, it just needs an extra class, the render factory. Unless something has changed again in 1.10, this way of doing it isn't deprecated.

  • Prev
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Next
  • Page 1 of 9  
  • All Activity
  • Home
  • The_Fireplace
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community