Jump to content

Try4W

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by Try4W

  1. Good time of day!

     

    I wanna give access to some right click by item if player have permission like -dc.useTools. How i can use permissions from plugin by forge?

    In CustomNPCs source code i found one class and interface, but i don't understand, how it works.

     

    package noppes.npcs.permissions;
    
    import noppes.npcs.permissions.PermissionsInterface;
    
    public class CustomNpcsPermissions implements PermissionsInterface {
    
       public static PermissionsInterface Instance = new CustomNpcsPermissions();
       private static final String[] permissions = new String[]{"-customnpcs.*"};
    
    
       public boolean hasPermission(String username, String permission) {
          return true;
       }
    
    }
    

     

    package noppes.npcs.permissions;
    
    
    public interface PermissionsInterface {
    
       boolean hasPermission(String var1, String var2);
    }
    

  2. Since Experience Orbs are entities I'd assume they're still spawned, so you can mess around with things like LivingSpawnEvent.CheckSpawn or LivingSpawnEvent.SpecialSpawn.

     

    Maybe even the EntityConstructingEvent.

     

    Another option might be to subscribe to LivingDeathEvent, and then make it die in a way that you define, that might work.

     

    If I understand correctly, these methods do not give 100% accurate.

     

    The last resort I can think of right now is that if none of the above work, you can try using the spawn events to make every creeper spawned actually spawn an instance of your own creeper class that extends EntityCreeper or whatever its called, and then override that method there. This would probably be a bad idea though, as it can mess with compatibility with other mods.

    This method may not be compatible with other mods. I create some constructor for change drops of mobs. It must works with all mobs.

     

    Maybe I should read about ASM-lib and somehow insert custom xp-drop event in the method OnDathUpdate?

  3. Do you mean to do something whenever a mob drops experience?

     

    You can use LivingDropsEvent or PlayerPickupXpEvent. I'm not exactly sure what you want to do, but these seem like a good place to start.

     

    Nope, but thanks. I wanna remove experience orbs if it will drop, for example from creeper. But mobs drops orbs with this stupid metod:

        protected void onDeathUpdate()
        {
            ++this.deathTime;
    
            if (this.deathTime == 20)
            {
                int i;
    
                if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && !this.isChild() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
                {
                    i = this.getExperiencePoints(this.attackingPlayer);
    
                    // !
                    while (i > 0)
                    {
                        int j = EntityXPOrb.getXPSplit(i);
                        i -= j;
                        this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j));
                    }
                }
    
                this.setDead();
    
                for (i = 0; i < 20; ++i)
                {
                    double d0 = this.rand.nextGaussian() * 0.02D;
                    double d1 = this.rand.nextGaussian() * 0.02D;
                    double d2 = this.rand.nextGaussian() * 0.02D;
                    this.worldObj.spawnParticle("explode", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2);
                }
            }
        }
    

  4. Good time of day :)

    I need to create empty world, without structures and terrain.

     

    I sucssesful:

    public class ERROREDEmptyDimChunkProvider implements IChunkProvider
    {
        /** RNG. */
        private Random rand;
    
        /** Reference to the World object. */
        private World worldObj;
    
        public ERROREDEmptyDimChunkProvider(World par1World, long par2, boolean par4)
        {
            this.worldObj = par1World;
            this.rand = new Random(par2);
        }
    
        /**
         * loads or generates the chunk at the chunk location specified
         */
        @Override
        public Chunk loadChunk(int par1, int par2)
        {
            return this.provideChunk(par1, par2);
        }
    
        /**
         * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
         * specified chunk from the map seed and chunk seed
         */
        @Override
        public Chunk provideChunk(int par1, int par2)
        {
            byte[] abyte = new byte[32768];
    
            Chunk chunk = new Chunk(this.worldObj, abyte, par1, par2);
            byte[] abyte1 = chunk.getBiomeArray();
    
            chunk.generateSkylightMap();
            return chunk;
        }
    
        /**
         * Checks to see if a chunk exists at x, y
         */
        @Override
        public boolean chunkExists(int par1, int par2)
        {
            return true;
        }
    
        /**
         * Two modes of operation: if passed true, save all Chunks in one go.  If passed false, save up to two chunks.
         * Return true if all chunks have been saved.
         */
        @Override
        public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)
        {
            return true;
        }
    
        /**
         * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
         */
        @Override
        public boolean unloadQueuedChunks()
        {
            return false;
        }
    
        /**
         * Returns if the IChunkProvider supports saving.
         */
        @Override
        public boolean canSave()
        {
            return true;
        }
    
        /**
         * Converts the instance data to a readable string.
         */
        @Override
        public String makeString()
        {
            return "RandomLevelSource";
        }
    
        /**
         * Returns a list of creatures of the specified type that can spawn at the given location.
         */
        @Override
        public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
        {
            return null;
        }
    
        /**
         * Returns the location of the closest structure of the specified type. If not found returns null.
         */
        @Override
        public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5)
        {
            return null; //"Stronghold".equals(par2Str) && this.strongholdGenerator != null ? this.strongholdGenerator.getNearestInstance(par1World, par3, par4, par5) : null;
        }
    
        @Override
        public int getLoadedChunkCount()
        {
            return 0;
        }
    
        public void recreateStructures(int par1, int par2) {}
    
        @Override
        public void saveExtraData() {
        }
    
        @Override
        public void populate(IChunkProvider ichunkprovider, int i, int j) {
            /*
            if(this.worldObj.getBlockId(0, 40, 0) != Block.bedrock.blockID)
                this.worldObj.setBlock(0, 40, 0, Block.bedrock.blockID, 0, 2);
            }
            */
        }
    }
    

     

    But with this ChunkProvider have errors with IC2, because it try to read some fields in my world(biomeList, for example), but i delete it. And so...

    What fields/methods i can remove, and what not?

     

    p.s. - Apologies for the ignorance, if that :)

×
×
  • Create New...

Important Information

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