Java 类net.minecraft.tileentity.MobSpawnerBaseLogic 实例源码

项目:pnc-repressurized    文件:BlockTrackEntryMobSpawner.java   
@Override
    public void addInformation(World world, BlockPos pos, TileEntity te, List<String> infoList) {
        if (te instanceof TileEntityMobSpawner) {
            MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner) te).getSpawnerBaseLogic();
            ResourceLocation rl = Reflections.getEntityId(spawner);
//            infoList.add("Spawner Type: " + I18n.format("entity." + spawner.getEntityNameToSpawn() + ".name"));
            infoList.add("Spawner Type: " + (rl == null ? "?" : rl.toString()));

            if (Reflections.isActivated(spawner) || SemiBlockManager.getInstance(world).getSemiBlock(SemiBlockSpawnerAgitator.class, world, pos) != null) {
                infoList.add("Time until next spawn: " + PneumaticCraftUtils.convertTicksToMinutesAndSeconds(spawner.spawnDelay, false));
            } else if (HackableMobSpawner.isHacked(world, pos)) {
                infoList.add("Spawner is hacked");
            } else {
                infoList.add("Spawner is standing by");
            }
        }

    }
项目:pnc-repressurized    文件:SemiBlockSpawnerAgitator.java   
@Override
public void update() {
    super.update();
    if (!world.isRemote) {
        TileEntityMobSpawner te = getTileEntity();
        if(te != null){
            MobSpawnerBaseLogic spawnerLogic = te.getSpawnerBaseLogic();

            //Only tick the logic if it wasn't ticked already by the TE itself, to prevent double ticking.
            if(!Reflections.isActivated(spawnerLogic)){

                //Temporarily add a fake player to the world to trick the spawner into thinking there's a player nearby
                EntityPlayer fakePlayer = FakePlayerFactory.get((WorldServer)world, FAKE_PLAYER_PROFILE);
                fakePlayer.posX = getPos().getX();
                fakePlayer.posY = getPos().getY();
                fakePlayer.posZ = getPos().getZ();

                world.playerEntities.add(fakePlayer);
                spawnerLogic.updateSpawner();
                world.playerEntities.remove(fakePlayer);
            }                
        }
    }
}
项目:DecompiledMinecraft    文件:TileEntityMobSpawnerRenderer.java   
/**
 * Render the mob inside the mob spawner.
 */
public static void renderMob(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks)
{
    Entity entity = mobSpawnerLogic.func_180612_a(mobSpawnerLogic.getSpawnerWorld());

    if (entity != null)
    {
        float f = 0.4375F;
        GlStateManager.translate(0.0F, 0.4F, 0.0F);
        GlStateManager.rotate((float)(mobSpawnerLogic.getPrevMobRotation() + (mobSpawnerLogic.getMobRotation() - mobSpawnerLogic.getPrevMobRotation()) * (double)partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.translate(0.0F, -0.4F, 0.0F);
        GlStateManager.scale(f, f, f);
        entity.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F);
        Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks);
    }
}
项目:BaseClient    文件:TileEntityMobSpawnerRenderer.java   
/**
 * Render the mob inside the mob spawner.
 */
public static void renderMob(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks)
{
    Entity entity = mobSpawnerLogic.func_180612_a(mobSpawnerLogic.getSpawnerWorld());

    if (entity != null)
    {
        float f = 0.4375F;
        GlStateManager.translate(0.0F, 0.4F, 0.0F);
        GlStateManager.rotate((float)(mobSpawnerLogic.getPrevMobRotation() + (mobSpawnerLogic.getMobRotation() - mobSpawnerLogic.getPrevMobRotation()) * (double)partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.translate(0.0F, -0.4F, 0.0F);
        GlStateManager.scale(f, f, f);
        entity.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F);
        Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks);
    }
}
项目:BaseClient    文件:TileEntityMobSpawnerRenderer.java   
/**
 * Render the mob inside the mob spawner.
 */
public static void renderMob(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks)
{
    Entity entity = mobSpawnerLogic.func_180612_a(mobSpawnerLogic.getSpawnerWorld());

    if (entity != null)
    {
        float f = 0.4375F;
        GlStateManager.translate(0.0F, 0.4F, 0.0F);
        GlStateManager.rotate((float)(mobSpawnerLogic.getPrevMobRotation() + (mobSpawnerLogic.getMobRotation() - mobSpawnerLogic.getPrevMobRotation()) * (double)partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.translate(0.0F, -0.4F, 0.0F);
        GlStateManager.scale(f, f, f);
        entity.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F);
        Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks);
    }
}
项目:Backmemed    文件:TileEntityMobSpawnerRenderer.java   
/**
 * Render the mob inside the mob spawner.
 */
public static void renderMob(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks)
{
    Entity entity = mobSpawnerLogic.getCachedEntity();

    if (entity != null)
    {
        float f = 0.53125F;
        float f1 = Math.max(entity.width, entity.height);

        if ((double)f1 > 1.0D)
        {
            f /= f1;
        }

        GlStateManager.translate(0.0F, 0.4F, 0.0F);
        GlStateManager.rotate((float)(mobSpawnerLogic.getPrevMobRotation() + (mobSpawnerLogic.getMobRotation() - mobSpawnerLogic.getPrevMobRotation()) * (double)partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.translate(0.0F, -0.2F, 0.0F);
        GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.scale(f, f, f);
        entity.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F);
        Minecraft.getMinecraft().getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, false);
    }
}
项目:CustomWorldGen    文件:TileEntityMobSpawnerRenderer.java   
/**
 * Render the mob inside the mob spawner.
 */
public static void renderMob(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks)
{
    Entity entity = mobSpawnerLogic.getCachedEntity();

    if (entity != null)
    {
        float f = 0.53125F;
        float f1 = Math.max(entity.width, entity.height);

        if ((double)f1 > 1.0D)
        {
            f /= f1;
        }

        GlStateManager.translate(0.0F, 0.4F, 0.0F);
        GlStateManager.rotate((float)(mobSpawnerLogic.getPrevMobRotation() + (mobSpawnerLogic.getMobRotation() - mobSpawnerLogic.getPrevMobRotation()) * (double)partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.translate(0.0F, -0.2F, 0.0F);
        GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.scale(f, f, f);
        entity.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F);
        Minecraft.getMinecraft().getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, false);
    }
}
项目:PopularMMOS-EpicProportions-Mod    文件:BombySpawnerBaseLogic.java   
private void resetTimer()
{
    if (this.maxSpawnDelay <= this.minSpawnDelay)
    {
        this.spawnDelay = this.minSpawnDelay;
    }
    else
    {
        int i = this.maxSpawnDelay - this.minSpawnDelay;
        this.spawnDelay = this.minSpawnDelay + this.getSpawnerWorld().rand.nextInt(i);
    }

    if (this.potentialEntitySpawns != null && this.potentialEntitySpawns.size() > 0)
    {
        this.setRandomEntity((MobSpawnerBaseLogic.WeightedRandomMinecart)WeightedRandom.getRandomItem(this.getSpawnerWorld().rand, this.potentialEntitySpawns));
    }

    this.func_98267_a(1);
}
项目:PopularMMOS-EpicProportions-Mod    文件:Fred2_0SpawnerBaseLogic.java   
private void resetTimer()
{
    if (this.maxSpawnDelay <= this.minSpawnDelay)
    {
        this.spawnDelay = this.minSpawnDelay;
    }
    else
    {
        int i = this.maxSpawnDelay - this.minSpawnDelay;
        this.spawnDelay = this.minSpawnDelay + this.getSpawnerWorld().rand.nextInt(i);
    }

    if (this.potentialEntitySpawns != null && this.potentialEntitySpawns.size() > 0)
    {
        this.setRandomEntity((MobSpawnerBaseLogic.WeightedRandomMinecart)WeightedRandom.getRandomItem(this.getSpawnerWorld().rand, this.potentialEntitySpawns));
    }

    this.func_98267_a(1);
}
项目:Resilience-Client-Source    文件:TileEntityMobSpawnerRenderer.java   
public static void func_147517_a(MobSpawnerBaseLogic p_147517_0_, double p_147517_1_, double p_147517_3_, double p_147517_5_, float p_147517_7_)
{
    Entity var8 = p_147517_0_.func_98281_h();

    if (var8 != null)
    {
        var8.setWorld(p_147517_0_.getSpawnerWorld());
        float var9 = 0.4375F;
        GL11.glTranslatef(0.0F, 0.4F, 0.0F);
        GL11.glRotatef((float)(p_147517_0_.field_98284_d + (p_147517_0_.field_98287_c - p_147517_0_.field_98284_d) * (double)p_147517_7_) * 10.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(0.0F, -0.4F, 0.0F);
        GL11.glScalef(var9, var9, var9);
        var8.setLocationAndAngles(p_147517_1_, p_147517_3_, p_147517_5_, 0.0F, 0.0F);
        RenderManager.instance.func_147940_a(var8, 0.0D, 0.0D, 0.0D, 0.0F, p_147517_7_);
    }
}
项目:ExpandedRailsMod    文件:TileEntityMobSpawnerRenderer.java   
/**
 * Render the mob inside the mob spawner.
 */
public static void renderMob(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks)
{
    Entity entity = mobSpawnerLogic.getCachedEntity();

    if (entity != null)
    {
        float f = 0.53125F;
        float f1 = Math.max(entity.width, entity.height);

        if ((double)f1 > 1.0D)
        {
            f /= f1;
        }

        GlStateManager.translate(0.0F, 0.4F, 0.0F);
        GlStateManager.rotate((float)(mobSpawnerLogic.getPrevMobRotation() + (mobSpawnerLogic.getMobRotation() - mobSpawnerLogic.getPrevMobRotation()) * (double)partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.translate(0.0F, -0.2F, 0.0F);
        GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.scale(f, f, f);
        entity.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F);
        Minecraft.getMinecraft().getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, false);
    }
}
项目:Cauldron    文件:TileEntityMobSpawnerRenderer.java   
public static void func_147517_a(MobSpawnerBaseLogic p_147517_0_, double p_147517_1_, double p_147517_3_, double p_147517_5_, float p_147517_7_)
{
    Entity entity = p_147517_0_.func_98281_h();

    if (entity != null)
    {
        entity.setWorld(p_147517_0_.getSpawnerWorld());
        float f1 = 0.4375F;
        GL11.glTranslatef(0.0F, 0.4F, 0.0F);
        GL11.glRotatef((float)(p_147517_0_.field_98284_d + (p_147517_0_.field_98287_c - p_147517_0_.field_98284_d) * (double)p_147517_7_) * 10.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(0.0F, -0.4F, 0.0F);
        GL11.glScalef(f1, f1, f1);
        entity.setLocationAndAngles(p_147517_1_, p_147517_3_, p_147517_5_, 0.0F, 0.0F);
        RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, p_147517_7_);
    }
}
项目:Cauldron    文件:TileEntityMobSpawnerRenderer.java   
public static void func_147517_a(MobSpawnerBaseLogic p_147517_0_, double p_147517_1_, double p_147517_3_, double p_147517_5_, float p_147517_7_)
{
    Entity entity = p_147517_0_.func_98281_h();

    if (entity != null)
    {
        entity.setWorld(p_147517_0_.getSpawnerWorld());
        float f1 = 0.4375F;
        GL11.glTranslatef(0.0F, 0.4F, 0.0F);
        GL11.glRotatef((float)(p_147517_0_.field_98284_d + (p_147517_0_.field_98287_c - p_147517_0_.field_98284_d) * (double)p_147517_7_) * 10.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(0.0F, -0.4F, 0.0F);
        GL11.glScalef(f1, f1, f1);
        entity.setLocationAndAngles(p_147517_1_, p_147517_3_, p_147517_5_, 0.0F, 0.0F);
        RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, p_147517_7_);
    }
}
项目:RuneCraftery    文件:WeightedRandomMinecart.java   
public WeightedRandomMinecart(MobSpawnerBaseLogic p_i1945_1_, NBTTagCompound p_i1945_2_) {
   super(p_i1945_2_.func_74762_e("Weight"));
   this.field_98221_d = p_i1945_1_;
   NBTTagCompound var3 = p_i1945_2_.func_74775_l("Properties");
   String var4 = p_i1945_2_.func_74779_i("Type");
   if(var4.equals("Minecart")) {
      if(var3 != null) {
         switch(var3.func_74762_e("Type")) {
         case 0:
            var4 = "MinecartRideable";
            break;
         case 1:
            var4 = "MinecartChest";
            break;
         case 2:
            var4 = "MinecartFurnace";
         }
      } else {
         var4 = "MinecartRideable";
      }
   }

   this.field_98222_b = var3;
   this.field_98223_c = var4;
}
项目:RuneCraftery    文件:WeightedRandomMinecart.java   
public WeightedRandomMinecart(MobSpawnerBaseLogic p_i1946_1_, NBTTagCompound p_i1946_2_, String p_i1946_3_) {
   super(1);
   this.field_98221_d = p_i1946_1_;
   if(p_i1946_3_.equals("Minecart")) {
      if(p_i1946_2_ != null) {
         switch(p_i1946_2_.func_74762_e("Type")) {
         case 0:
            p_i1946_3_ = "MinecartRideable";
            break;
         case 1:
            p_i1946_3_ = "MinecartChest";
            break;
         case 2:
            p_i1946_3_ = "MinecartFurnace";
         }
      } else {
         p_i1946_3_ = "MinecartRideable";
      }
   }

   this.field_98222_b = p_i1946_2_;
   this.field_98223_c = p_i1946_3_;
}
项目:RuneCraftery    文件:TileEntityMobSpawnerRenderer.java   
public static void func_98144_a(MobSpawnerBaseLogic par0MobSpawnerBaseLogic, double par1, double par3, double par5, float par7)
{
    Entity entity = par0MobSpawnerBaseLogic.func_98281_h();

    if (entity != null)
    {
        entity.setWorld(par0MobSpawnerBaseLogic.getSpawnerWorld());
        float f1 = 0.4375F;
        GL11.glTranslatef(0.0F, 0.4F, 0.0F);
        GL11.glRotatef((float)(par0MobSpawnerBaseLogic.field_98284_d + (par0MobSpawnerBaseLogic.field_98287_c - par0MobSpawnerBaseLogic.field_98284_d) * (double)par7) * 10.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(0.0F, -0.4F, 0.0F);
        GL11.glScalef(f1, f1, f1);
        entity.setLocationAndAngles(par1, par3, par5, 0.0F, 0.0F);
        RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, par7);
    }
}
项目:BetterNutritionMod    文件:TileEntityMobSpawnerRenderer.java   
public static void func_98144_a(MobSpawnerBaseLogic par0MobSpawnerBaseLogic, double par1, double par3, double par5, float par7)
{
    Entity entity = par0MobSpawnerBaseLogic.func_98281_h();

    if (entity != null)
    {
        entity.setWorld(par0MobSpawnerBaseLogic.getSpawnerWorld());
        float f1 = 0.4375F;
        GL11.glTranslatef(0.0F, 0.4F, 0.0F);
        GL11.glRotatef((float)(par0MobSpawnerBaseLogic.field_98284_d + (par0MobSpawnerBaseLogic.field_98287_c - par0MobSpawnerBaseLogic.field_98284_d) * (double)par7) * 10.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(0.0F, -0.4F, 0.0F);
        GL11.glScalef(f1, f1, f1);
        entity.setLocationAndAngles(par1, par3, par5, 0.0F, 0.0F);
        RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, par7);
    }
}
项目:Hats    文件:HatHandler.java   
public static MobSpawnerBaseLogic getMobSpawnerLogic(Class<? extends TileEntity> clz, TileEntity instance)
{
    try
    {
        Field field = mobSpawnerLogic.get(clz);
        if(field != null)
        {
            field.setAccessible(true);
            Object obj = field.get(instance);
            if(obj instanceof MobSpawnerBaseLogic)
            {
                return (MobSpawnerBaseLogic)obj;
            }
        }
    }
    catch(Exception e)
    {
    }
    return null;
}
项目:minecraft-roguelike    文件:Spawnable.java   
public void generate(IWorldEditor editor, Random rand, Coord cursor, int level){
    Coord pos = new Coord(cursor);
    editor.setBlock(pos, new MetaBlock(Blocks.MOB_SPAWNER.getDefaultState()), true, true);

    TileEntity tileentity = editor.getTileEntity(pos);
    if (!(tileentity instanceof TileEntityMobSpawner)) return;

    TileEntityMobSpawner spawner = (TileEntityMobSpawner)tileentity;
    MobSpawnerBaseLogic spawnerLogic = spawner.getSpawnerBaseLogic();

    NBTTagCompound nbt = new NBTTagCompound();
    nbt.setInteger("x", pos.getX());
    nbt.setInteger("y", pos.getY());
    nbt.setInteger("z", pos.getZ());

    nbt.setTag("SpawnPotentials", getSpawnPotentials(rand, level));

    spawnerLogic.readFromNBT(nbt);
    spawnerLogic.updateSpawner();
    tileentity.markDirty();
}
项目:pnc-repressurized    文件:HackableMobSpawner.java   
@Override
public boolean afterHackTick(World world, BlockPos pos) {
    MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner) world.getTileEntity(pos)).getSpawnerBaseLogic();
    spawner.prevMobRotation = spawner.getMobRotation();
    spawner.spawnDelay = 10;
    return false;
}
项目:pnc-repressurized    文件:Reflections.java   
public static void init() {
    msbl_isActivated = ReflectionHelper.findMethod(MobSpawnerBaseLogic.class, "isActivated", "func_98279_f");
    msbl_getEntityId = ReflectionHelper.findMethod(MobSpawnerBaseLogic.class, "getEntityId", "func_190895_g");

    // access to non-public entity AI's for hacking purposes
    blaze_aiFireballAttack = findEnclosedClass(EntityBlaze.class, "AIFireballAttack", "a");
    ghast_aiFireballAttack = findEnclosedClass(EntityGhast.class, "AIFireballAttack", "c");
}
项目:pnc-repressurized    文件:Reflections.java   
public static ResourceLocation getEntityId(MobSpawnerBaseLogic msbl) {
    try {
        return (ResourceLocation) msbl_getEntityId.invoke(msbl);
    } catch (IllegalAccessException | InvocationTargetException e) {
        e.printStackTrace();
        return null;
    }
}
项目:pnc-repressurized    文件:Reflections.java   
public static boolean isActivated(MobSpawnerBaseLogic msbl) {
    try {
        return (boolean) msbl_isActivated.invoke(msbl);
    } catch (IllegalAccessException | InvocationTargetException e) {
        e.printStackTrace();
        return false;
    }
}
项目:pnc-repressurized    文件:SemiBlockSpawnerAgitator.java   
private void setSpawnPersistentEntities(boolean persistent){
    TileEntityMobSpawner te = getTileEntity();
    if(te != null){
        MobSpawnerBaseLogic spawnerLogic = te.getSpawnerBaseLogic();
        spawnerLogic.spawnData.getNbt().setBoolean("PersistenceRequired", persistent);
    }
}
项目:ExtraUtilities    文件:BlockCursedEarth.java   
public void resetTimer(final MobSpawnerBaseLogic logic) {
    if (this.cache == null) {
        this.cache = ReflectionHelper.findMethod((Class)MobSpawnerBaseLogic.class, (Object)logic, new String[] { "resetTimer", "func_98273_j" }, new Class[0]);
    }
    try {
        this.cache.invoke(logic, new Object[0]);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
项目:InspiringWorld    文件:EnderSpiderSpawnerGen.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
    IChunkProvider chunkProvider) {
    for (TileEntity tileEntity : world.getChunkFromChunkCoords(chunkX, chunkZ).getTileEntityMap().values()) {
        if (tileEntity instanceof TileEntityMobSpawner) {
            MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner) tileEntity).getSpawnerBaseLogic();
            if ("CaveSpider".equals(spawner.getEntityNameToSpawn()) && random.nextInt(4) == 0) {
                spawner.setEntityName("EnderSpider");
            }
        }
    }
}
项目:PopularMMOS-EpicProportions-Mod    文件:BombySpawnerBaseLogic.java   
public void writeToNBT(NBTTagCompound p_98280_1_)
{
    p_98280_1_.setString("EntityId", this.getEntityNameToSpawn());
    p_98280_1_.setShort("Delay", (short)this.spawnDelay);
    p_98280_1_.setShort("MinSpawnDelay", (short)this.minSpawnDelay);
    p_98280_1_.setShort("MaxSpawnDelay", (short)this.maxSpawnDelay);
    p_98280_1_.setShort("SpawnCount", (short)this.spawnCount);
    p_98280_1_.setShort("MaxNearbyEntities", (short)this.maxNearbyEntities);
    p_98280_1_.setShort("RequiredPlayerRange", (short)this.activatingRangeFromPlayer);
    p_98280_1_.setShort("SpawnRange", (short)this.spawnRange);

    if (this.getRandomEntity() != null)
    {
        p_98280_1_.setTag("SpawnData", this.getRandomEntity().field_98222_b.copy());
    }

    if (this.getRandomEntity() != null || this.potentialEntitySpawns != null && this.potentialEntitySpawns.size() > 0)
    {
        NBTTagList nbttaglist = new NBTTagList();

        if (this.potentialEntitySpawns != null && this.potentialEntitySpawns.size() > 0)
        {
            Iterator iterator = this.potentialEntitySpawns.iterator();

            while (iterator.hasNext())
            {
                MobSpawnerBaseLogic.WeightedRandomMinecart weightedrandomminecart = (MobSpawnerBaseLogic.WeightedRandomMinecart)iterator.next();
                nbttaglist.appendTag(weightedrandomminecart.func_98220_a());
            }
        }
        else
        {
            nbttaglist.appendTag(this.getRandomEntity().func_98220_a());
        }

        p_98280_1_.setTag("SpawnPotentials", nbttaglist);
    }
}
项目:PopularMMOS-EpicProportions-Mod    文件:TileEntityBombySpawner.java   
public void setRandomEntity(MobSpawnerBaseLogic.WeightedRandomMinecart p_98277_1_)
{
    super.setRandomEntity(p_98277_1_);

    if (this.getSpawnerWorld() != null)
    {
        this.getSpawnerWorld().markBlockForUpdate(TileEntityBombySpawner.this.xCoord, TileEntityBombySpawner.this.yCoord, TileEntityBombySpawner.this.zCoord);
    }
}
项目:PopularMMOS-EpicProportions-Mod    文件:Fred2_0SpawnerBaseLogic.java   
public void writeToNBT(NBTTagCompound p_98280_1_)
{
    //p_98280_1_.setString("EntityId", this.getEntityNameToSpawn());
    p_98280_1_.setShort("Delay", (short)this.spawnDelay);
    p_98280_1_.setShort("MinSpawnDelay", (short)this.minSpawnDelay);
    p_98280_1_.setShort("MaxSpawnDelay", (short)this.maxSpawnDelay);
    p_98280_1_.setShort("SpawnCount", (short)this.spawnCount);
    p_98280_1_.setShort("MaxNearbyEntities", (short)this.maxNearbyEntities);
    p_98280_1_.setShort("RequiredPlayerRange", (short)this.activatingRangeFromPlayer);
    p_98280_1_.setShort("SpawnRange", (short)this.spawnRange);

    if (this.getRandomEntity() != null)
    {
        p_98280_1_.setTag("SpawnData", this.getRandomEntity().field_98222_b.copy());
    }

    if (this.getRandomEntity() != null || this.potentialEntitySpawns != null && this.potentialEntitySpawns.size() > 0)
    {
        NBTTagList nbttaglist = new NBTTagList();

        if (this.potentialEntitySpawns != null && this.potentialEntitySpawns.size() > 0)
        {
            Iterator iterator = this.potentialEntitySpawns.iterator();

            while (iterator.hasNext())
            {
                MobSpawnerBaseLogic.WeightedRandomMinecart weightedrandomminecart = (MobSpawnerBaseLogic.WeightedRandomMinecart)iterator.next();
                nbttaglist.appendTag(weightedrandomminecart.func_98220_a());
            }
        }
        else
        {
            nbttaglist.appendTag(this.getRandomEntity().func_98220_a());
        }

        p_98280_1_.setTag("SpawnPotentials", nbttaglist);
    }
}
项目:RuneCraftery    文件:TileEntityMobSpawnerRenderer.java   
public static void func_98144_a(MobSpawnerBaseLogic p_98144_0_, double p_98144_1_, double p_98144_3_, double p_98144_5_, float p_98144_7_) {
   Entity var8 = p_98144_0_.func_98281_h();
   if(var8 != null) {
      var8.func_70029_a(p_98144_0_.func_98271_a());
      float var9 = 0.4375F;
      GL11.glTranslatef(0.0F, 0.4F, 0.0F);
      GL11.glRotatef((float)(p_98144_0_.field_98284_d + (p_98144_0_.field_98287_c - p_98144_0_.field_98284_d) * (double)p_98144_7_) * 10.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
      GL11.glTranslatef(0.0F, -0.4F, 0.0F);
      GL11.glScalef(var9, var9, var9);
      var8.func_70012_b(p_98144_1_, p_98144_3_, p_98144_5_, 0.0F, 0.0F);
      RenderManager.field_78727_a.func_78719_a(var8, 0.0D, 0.0D, 0.0D, 0.0F, p_98144_7_);
   }

}
项目:Hats    文件:HatHandler.java   
public static boolean isMobSpawner(Class clz, Class callingClz)
{
    if(!TileEntity.class.isAssignableFrom(clz))
    {
        return false;
    }
    Boolean bool = mobSpawners.get(clz);
    if(bool == null)
    {
        try
        {
            Field[] fields = clz.getDeclaredFields();
            for(Field field : fields)
            {
                field.setAccessible(true);
                if(MobSpawnerBaseLogic.class.isAssignableFrom(field.getType()))
                {
                    bool = true;
                    mobSpawnerLogic.put(callingClz, field);
                    mobSpawners.put(callingClz, bool);
                    break;
                }
            }
            if(bool == null)
            {
                bool = clz.getSuperclass() == TileEntity.class ? false : isMobSpawner(clz.getSuperclass(), callingClz);
                mobSpawners.put(callingClz, bool);
            }
        }
        catch(Throwable e)
        {
            bool = false;
            mobSpawners.put(callingClz, bool);
        }
    }
    return bool;
}
项目:PneumaticCraft    文件:HackableMobSpawner.java   
@Override
public boolean afterHackTick(World world, int x, int y, int z){
    MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner)world.getTileEntity(x, y, z)).func_145881_a();
    spawner.field_98284_d = spawner.field_98287_c;//oldRotation = rotation, to stop render glitching
    spawner.spawnDelay = 10;
    return false;
}
项目:PneumaticCraft    文件:BlockTrackEntryMobSpawner.java   
@Override
public void addInformation(World world, int x, int y, int z, TileEntity te, List<String> infoList){
    if(te instanceof TileEntityMobSpawner) {
        MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner)te).func_145881_a();
        infoList.add("Spawner Type: " + StatCollector.translateToLocal("entity." + spawner.getEntityNameToSpawn() + ".name"));
        if(spawner.isActivated()) {
            infoList.add("Time until next spawn: " + PneumaticCraftUtils.convertTicksToMinutesAndSeconds(spawner.spawnDelay, false));
        } else if(HackableMobSpawner.isHacked(world, x, y, z)) {
            infoList.add("Spawner is hacked");
        } else {
            infoList.add("Spawner is standing by");
        }
    }

}
项目:EnderIO    文件:BrokenSpawnerHandler.java   
@SubscribeEvent
public static void onBreakEvent(BlockEvent.BreakEvent evt) {
  if (evt.getState().getBlock() instanceof BlockMobSpawner) {
    if (evt.getPlayer() != null && !evt.getPlayer().capabilities.isCreativeMode && !evt.getPlayer().world.isRemote && !evt.isCanceled()) {
      TileEntity tile = evt.getPlayer().world.getTileEntity(NullHelper.notnullF(evt.getPos(), "BlockEvent.BreakEvent.getPos()"));
      if (tile instanceof TileEntityMobSpawner) {

        if (Math.random() > SpawnerConfig.brokenSpawnerDropChance.get()) {
          return;
        }

        ItemStack equipped = evt.getPlayer().getHeldItemMainhand();
        if (Prep.isValid(equipped) && SpawnerConfig.brokenSpawnerToolBlacklist.get().contains(equipped)) {
          return;
        }

        TileEntityMobSpawner spawner = (TileEntityMobSpawner) tile;
        MobSpawnerBaseLogic logic = spawner.getSpawnerBaseLogic();
        ResourceLocation entityName = getEntityName(logic);
        if (entityName != null && !isBlackListed(entityName)) {
          final CapturedMob capturedMob = CapturedMob.create(entityName);
          if (capturedMob != null) {
            ItemStack drop = capturedMob.toStack(ModObject.itemBrokenSpawner.getItemNN(), 0, 1);
            dropCache.put(evt.getPos().toImmutable(), drop);

            for (int i = (int) (Math.random() * 7); i > 0; i--) {
              setSpawnDelay(logic);
              logic.updateSpawner();
            }
          } else {
            dropCache.put(evt.getPos().toImmutable(), Prep.getEmpty());
          }
        }
      }
    } else {
      dropCache.put(evt.getPos().toImmutable(), Prep.getEmpty());
    }
  }
}
项目:EnderIO    文件:BrokenSpawnerHandler.java   
@SubscribeEvent
public static void onHarvestDropsEvent(BlockEvent.HarvestDropsEvent evt) {
  if (!evt.isCanceled() && evt.getState().getBlock() instanceof BlockMobSpawner) {
    if (dropCache.containsKey(evt.getPos())) {
      ItemStack stack = dropCache.get(evt.getPos());
      if (Prep.isValid(stack)) {
        evt.getDrops().add(stack);
        dropCache.put(evt.getPos().toImmutable(), Prep.getEmpty());
      }
    } else {
      // A spawner was broken---but not by a player. The TE has been
      // invalidated already, but we might be able to recover it.
      try {
        for (Object object : evt.getWorld().loadedTileEntityList) {
          if (object instanceof TileEntityMobSpawner) {
            TileEntityMobSpawner spawner = (TileEntityMobSpawner) object;
            BlockPos p = spawner.getPos();
            if (spawner.getWorld() == evt.getWorld() && p.equals(evt.getPos())) {
              // Bingo!
              MobSpawnerBaseLogic logic = spawner.getSpawnerBaseLogic();
              ResourceLocation entityName = getEntityName(logic);
              if (entityName != null && !isBlackListed(entityName)) {
                final CapturedMob capturedMob = CapturedMob.create(entityName);
                if (capturedMob != null) {
                  evt.getDrops().add(capturedMob.toStack(ModObject.itemBrokenSpawner.getItemNN(), 0, 1));
                }
              }
            }
          }
        }
      } catch (Exception e) {
        // Risky recovery failed. Happens.
      }
    }
  }
}
项目:EnderIO    文件:BrokenSpawnerHandler.java   
private static ResourceLocation getEntityName(MobSpawnerBaseLogic logic) {
  if (getEntityIdMethod != null) {
    try {
      return (ResourceLocation) getEntityIdMethod.invoke(logic, new Object[0]);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  return null;
}
项目:EnderIO    文件:BrokenSpawnerHandler.java   
private static void setSpawnDelay(MobSpawnerBaseLogic logic) {
  if (spawnDelayField != null) {
    try {
      spawnDelayField.set(logic, 0);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
项目:DecompiledMinecraft    文件:ItemMonsterPlacer.java   
/**
 * Called when a Block is right-clicked with this Item
 */
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else if (!playerIn.canPlayerEdit(pos.offset(side), side, stack))
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (iblockstate.getBlock() == Blocks.mob_spawner)
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityMobSpawner)
            {
                MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic();
                mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata()));
                tileentity.markDirty();
                worldIn.markBlockForUpdate(pos);

                if (!playerIn.capabilities.isCreativeMode)
                {
                    --stack.stackSize;
                }

                return true;
            }
        }

        pos = pos.offset(side);
        double d0 = 0.0D;

        if (side == EnumFacing.UP && iblockstate instanceof BlockFence)
        {
            d0 = 0.5D;
        }

        Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D);

        if (entity != null)
        {
            if (entity instanceof EntityLivingBase && stack.hasDisplayName())
            {
                entity.setCustomNameTag(stack.getDisplayName());
            }

            if (!playerIn.capabilities.isCreativeMode)
            {
                --stack.stackSize;
            }
        }

        return true;
    }
}
项目:DecompiledMinecraft    文件:EntityMinecartMobSpawner.java   
public MobSpawnerBaseLogic func_98039_d()
{
    return this.mobSpawnerLogic;
}
项目:DecompiledMinecraft    文件:ItemMonsterPlacer.java   
/**
 * Called when a Block is right-clicked with this Item
 */
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else if (!playerIn.canPlayerEdit(pos.offset(side), side, stack))
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (iblockstate.getBlock() == Blocks.mob_spawner)
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityMobSpawner)
            {
                MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic();
                mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata()));
                tileentity.markDirty();
                worldIn.markBlockForUpdate(pos);

                if (!playerIn.capabilities.isCreativeMode)
                {
                    --stack.stackSize;
                }

                return true;
            }
        }

        pos = pos.offset(side);
        double d0 = 0.0D;

        if (side == EnumFacing.UP && iblockstate instanceof BlockFence)
        {
            d0 = 0.5D;
        }

        Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D);

        if (entity != null)
        {
            if (entity instanceof EntityLivingBase && stack.hasDisplayName())
            {
                entity.setCustomNameTag(stack.getDisplayName());
            }

            if (!playerIn.capabilities.isCreativeMode)
            {
                --stack.stackSize;
            }
        }

        return true;
    }
}