Java 类net.minecraft.entity.item.EntityPainting 实例源码

项目:DecompiledMinecraft    文件:RenderPainting.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doe
 */
public void doRender(EntityPainting entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F);
    GlStateManager.enableRescaleNormal();
    this.bindEntityTexture(entity);
    EntityPainting.EnumArt entitypainting$enumart = entity.art;
    float f = 0.0625F;
    GlStateManager.scale(f, f, f);
    this.renderPainting(entity, entitypainting$enumart.sizeX, entitypainting$enumart.sizeY, entitypainting$enumart.offsetX, entitypainting$enumart.offsetY);
    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
项目:BaseClient    文件:RenderPainting.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doe
 */
public void doRender(EntityPainting entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F);
    GlStateManager.enableRescaleNormal();
    this.bindEntityTexture(entity);
    EntityPainting.EnumArt entitypainting$enumart = entity.art;
    float f = 0.0625F;
    GlStateManager.scale(f, f, f);
    this.renderPainting(entity, entitypainting$enumart.sizeX, entitypainting$enumart.sizeY, entitypainting$enumart.offsetX, entitypainting$enumart.offsetY);
    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
项目:BaseClient    文件:RenderPainting.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doe
 */
public void doRender(EntityPainting entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F);
    GlStateManager.enableRescaleNormal();
    this.bindEntityTexture(entity);
    EntityPainting.EnumArt entitypainting$enumart = entity.art;
    float f = 0.0625F;
    GlStateManager.scale(f, f, f);
    this.renderPainting(entity, entitypainting$enumart.sizeX, entitypainting$enumart.sizeY, entitypainting$enumart.offsetX, entitypainting$enumart.offsetY);
    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
项目:TaleCraft    文件:CustomPaintingRender.java   
@Override
public void render(Item item, ItemStack stack, Tessellator tessellator, BufferBuilder buffer, double partialTick, BlockPos playerPos, EntityPlayerSP player, WorldClient world) {
    EnumArt painting = EnumArt.valueOf(stack.getTagCompound().getString("art"));
    RayTraceResult result = player.rayTrace(5, (float)partialTick);
    if(result.typeOfHit == Type.BLOCK){
        BlockPos pos = result.getBlockPos();
        EnumFacing facing = result.sideHit;
        if(!facing.getAxis().isHorizontal())return;
        EntityPainting ent = new EntityPainting(world, pos.offset(facing.getOpposite(), 1), facing);
        ent.art = painting;
        GlStateManager.enableBlend();
        GL11.glColor4f(1f, 1f, 1f, 0.5f);
        double xMove = 0;
        if(facing.getFrontOffsetX() == 0)xMove = (painting.sizeX != 32 ?  painting.sizeX >= 48 ? -painting.sizeX/16/8 : 0.5 : 0);
        double zMove = 0;
        if(facing.getFrontOffsetZ() == 0)zMove = (painting.sizeX != 32 ?  painting.sizeX >= 48 ? -painting.sizeX/16/8 : 0.5 : 0);
        if(painting.sizeX == 16){
            if(facing.getOpposite() == EnumFacing.EAST)zMove -= 1;
            if(facing.getOpposite() == EnumFacing.NORTH)xMove -= 1;
        }
        double yMove = (painting.sizeY == 16  || painting.sizeY == 16*3 ? 0 : 0.5);
        RENDER.doRender(ent, ent.posX + facing.getFrontOffsetX()*2 + xMove, ent.posY + yMove, ent.posZ + facing.getFrontOffsetZ()*2 + zMove, ent.rotationYaw, (float)partialTick);
    }
}
项目:TaleCraft    文件:CustomPaintingItem.java   
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack stack = player.getHeldItem(hand);
    BlockPos blockpos = pos.offset(facing);
    if (facing != EnumFacing.DOWN && facing != EnumFacing.UP && player.canPlayerEdit(blockpos, facing, stack)){
        EntityPainting painting = new EntityPainting(worldIn, blockpos, facing);

        if (painting != null && painting.onValidSurface()){
            if (!worldIn.isRemote){
                painting.playPlaceSound();
                painting.art = EnumArt.valueOf(stack.getTagCompound().getString("art"));
                worldIn.spawnEntity(painting);
            }
        }

        return EnumActionResult.SUCCESS;
    }
    else{
        return EnumActionResult.FAIL;
    }
}
项目:RuneCraftery    文件:RenderPainting.java   
private void func_77008_a(EntityPainting p_77008_1_, float p_77008_2_, float p_77008_3_) {
   int var4 = MathHelper.func_76128_c(p_77008_1_.field_70165_t);
   int var5 = MathHelper.func_76128_c(p_77008_1_.field_70163_u + (double)(p_77008_3_ / 16.0F));
   int var6 = MathHelper.func_76128_c(p_77008_1_.field_70161_v);
   if(p_77008_1_.field_82332_a == 2) {
      var4 = MathHelper.func_76128_c(p_77008_1_.field_70165_t + (double)(p_77008_2_ / 16.0F));
   }

   if(p_77008_1_.field_82332_a == 1) {
      var6 = MathHelper.func_76128_c(p_77008_1_.field_70161_v - (double)(p_77008_2_ / 16.0F));
   }

   if(p_77008_1_.field_82332_a == 0) {
      var4 = MathHelper.func_76128_c(p_77008_1_.field_70165_t - (double)(p_77008_2_ / 16.0F));
   }

   if(p_77008_1_.field_82332_a == 3) {
      var6 = MathHelper.func_76128_c(p_77008_1_.field_70161_v + (double)(p_77008_2_ / 16.0F));
   }

   int var7 = this.field_76990_c.field_78722_g.func_72802_i(var4, var5, var6, 0);
   int var8 = var7 % 65536;
   int var9 = var7 / 65536;
   OpenGlHelper.func_77475_a(OpenGlHelper.field_77476_b, (float)var8, (float)var9);
   GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
项目:Generatormods    文件:Building.java   
public void setPainting(int[] pt, int metadata) {
    // painting uses same orientation meta as ladders.
    // Have to adjust ijk since unlike ladders the entity exists at the
    // block it is hung on.
    int dir = orientDirToBDir(LADDER_META_TO_DIR[metadata % LADDER_META_TO_DIR.length]);
    pt[0] -= DIR_TO_I[dir];
    pt[2] -= DIR_TO_K[dir];
    if (dir == DIR_NORTH)
        pt[2]++;
    else if (dir == DIR_SOUTH)
        pt[2]--;
    else if (dir == DIR_WEST)
        pt[0]++;
    else
        pt[0]--;
    EntityPainting entitypainting = new EntityPainting(world, pt[0], pt[1], pt[2], PAINTING_DIR_TO_FACEDIR[dir]);
    if (entitypainting.onValidSurface())
        world.spawnEntityInWorld(entitypainting);
}
项目:StructureGenerationAPI    文件:GenHelper.java   
/**
 * Sets the art for a painting at location x/y/z and sends a packet to update players.
 * @param direction Use the value returned from the setHangingEntity method
 * @return false if 'name' didn't match any EnumArt values.
 */
public static final boolean setPaintingArt(World world, String name, int x, int y, int z, int direction) {
    List<EntityPainting> paintings = world.getEntitiesWithinAABB(EntityPainting.class, getHangingEntityAxisAligned(x, y, z, direction));
    if (paintings != null && !paintings.isEmpty() && name.length() > 0) {
        for (EntityPainting toEdit : paintings) {
            EnumArt[] aenumart = EnumArt.values();
            int i1 = aenumart.length;
            for (int j1 = 0; j1 < i1; ++j1) {
                EnumArt enumart = aenumart[j1];
                if (enumart.title.equals(name)) {
                    toEdit.art = enumart;
                    // TODO PacketDispatcher.sendPacketToAllAround(x, y, z, 64, world.provider.dimensionId, new Packet25EntityPainting(toEdit));
                    return true;
                }
            }
            LogHelper.warning(name + " does not match any values in EnumArt; unable to set painting art.");
        }
    }
    LogHelper.warning("No EntityPainting was found at " + x + "/" + y + "/" + z);
    return false;
}
项目:PaintingSelectionGui    文件:ClientProxy.java   
@Override
public void onClientPacket(EntityPlayer player, PaintingPacket packet) { 
    if(packet.id == -1) { //What painting is selected?
        MovingObjectPosition pos = Minecraft.getMinecraft().objectMouseOver;
        if (pos != null && pos.entityHit instanceof EntityPainting) 
            PaintingSelectionMod.DISPATCHER.sendToServer(new PaintingPacket(pos.entityHit.getEntityId(), new String[0]));
        else
            player.addChatMessage(new ChatComponentText(PaintingSelectionMod.COLOR + "cError - No painting selected"));
    }
    else if (packet.art.length == 1) { //Set Painting
        EnumArt enumArt = getEnumArt(packet.art[0]);
        Entity e = player.worldObj.getEntityByID(packet.id);
        if (e instanceof EntityPainting)
            setPaintingArt((EntityPainting)e, enumArt);
    }
    else { //Show art GUI
        Minecraft mc = Minecraft.getMinecraft();
        if (mc.currentScreen == null)
            mc.displayGuiScreen(new PaintingSelectionScreen(packet.art, packet.id));
    }
}
项目:Uranium    文件:TrackingRange.java   
/**
 * Gets the range an entity should be 'tracked' by players and visible in
 * the client.
 *
 * @param entity
 * @param defaultRange Default range defined by Mojang
 * @return
 */
public static int getEntityTrackingRange(Entity entity, int defaultRange)
{
    SpigotWorldConfig config = entity.worldObj.getSpigotConfig(); // Cauldron
    int range = defaultRange;
    if ( entity instanceof EntityPlayerMP )
    {
        range = config.playerTrackingRange;
    } else if ( entity.defaultActivationState || entity instanceof EntityGhast )
    {
        range = defaultRange;
    } else if ( entity.activationType == 1 )
    {
        range = config.monsterTrackingRange;
    } else if ( entity.activationType == 2 )
    {
        range = config.animalTrackingRange;
    } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb )
    {
        range = config.miscTrackingRange;
    }
    // Cauldron start - allow for 0 to disable tracking ranges
    if (range == 0)
    {
        return defaultRange;
    }
    // Cauldron end

    return Math.min( config.maxTrackingRange, range );
}
项目:DecompiledMinecraft    文件:S10PacketSpawnPainting.java   
public S10PacketSpawnPainting(EntityPainting painting)
{
    this.entityID = painting.getEntityId();
    this.position = painting.getHangingPosition();
    this.facing = painting.facingDirection;
    this.title = painting.art.title;
}
项目:DecompiledMinecraft    文件:S10PacketSpawnPainting.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.entityID = buf.readVarIntFromBuffer();
    this.title = buf.readStringFromBuffer(EntityPainting.EnumArt.field_180001_A);
    this.position = buf.readBlockPos();
    this.facing = EnumFacing.getHorizontal(buf.readUnsignedByte());
}
项目:DecompiledMinecraft    文件:S10PacketSpawnPainting.java   
public S10PacketSpawnPainting(EntityPainting painting)
{
    this.entityID = painting.getEntityId();
    this.position = painting.getHangingPosition();
    this.facing = painting.facingDirection;
    this.title = painting.art.title;
}
项目:DecompiledMinecraft    文件:S10PacketSpawnPainting.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.entityID = buf.readVarIntFromBuffer();
    this.title = buf.readStringFromBuffer(EntityPainting.EnumArt.field_180001_A);
    this.position = buf.readBlockPos();
    this.facing = EnumFacing.getHorizontal(buf.readUnsignedByte());
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Handles the spawning of a painting object
 */
public void handleSpawnPainting(S10PacketSpawnPainting packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(), packetIn.getFacing(), packetIn.getTitle());
    this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting);
}
项目:DecompiledMinecraft    文件:RenderPainting.java   
private void setLightmap(EntityPainting painting, float p_77008_2_, float p_77008_3_)
{
    int i = MathHelper.floor_double(painting.posX);
    int j = MathHelper.floor_double(painting.posY + (double)(p_77008_3_ / 16.0F));
    int k = MathHelper.floor_double(painting.posZ);
    EnumFacing enumfacing = painting.facingDirection;

    if (enumfacing == EnumFacing.NORTH)
    {
        i = MathHelper.floor_double(painting.posX + (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.WEST)
    {
        k = MathHelper.floor_double(painting.posZ - (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.SOUTH)
    {
        i = MathHelper.floor_double(painting.posX - (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.EAST)
    {
        k = MathHelper.floor_double(painting.posZ + (double)(p_77008_2_ / 16.0F));
    }

    int l = this.renderManager.worldObj.getCombinedLight(new BlockPos(i, j, k), 0);
    int i1 = l % 65536;
    int j1 = l / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);
    GlStateManager.color(1.0F, 1.0F, 1.0F);
}
项目:BaseClient    文件:S10PacketSpawnPainting.java   
public S10PacketSpawnPainting(EntityPainting painting)
{
    this.entityID = painting.getEntityId();
    this.position = painting.getHangingPosition();
    this.facing = painting.facingDirection;
    this.title = painting.art.title;
}
项目:BaseClient    文件:S10PacketSpawnPainting.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.entityID = buf.readVarIntFromBuffer();
    this.title = buf.readStringFromBuffer(EntityPainting.EnumArt.field_180001_A);
    this.position = buf.readBlockPos();
    this.facing = EnumFacing.getHorizontal(buf.readUnsignedByte());
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Handles the spawning of a painting object
 */
public void handleSpawnPainting(S10PacketSpawnPainting packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(), packetIn.getFacing(), packetIn.getTitle());
    this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting);
}
项目:BaseClient    文件:RenderPainting.java   
private void setLightmap(EntityPainting painting, float p_77008_2_, float p_77008_3_)
{
    int i = MathHelper.floor_double(painting.posX);
    int j = MathHelper.floor_double(painting.posY + (double)(p_77008_3_ / 16.0F));
    int k = MathHelper.floor_double(painting.posZ);
    EnumFacing enumfacing = painting.facingDirection;

    if (enumfacing == EnumFacing.NORTH)
    {
        i = MathHelper.floor_double(painting.posX + (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.WEST)
    {
        k = MathHelper.floor_double(painting.posZ - (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.SOUTH)
    {
        i = MathHelper.floor_double(painting.posX - (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.EAST)
    {
        k = MathHelper.floor_double(painting.posZ + (double)(p_77008_2_ / 16.0F));
    }

    int l = this.renderManager.worldObj.getCombinedLight(new BlockPos(i, j, k), 0);
    int i1 = l % 65536;
    int j1 = l / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);
    GlStateManager.color(1.0F, 1.0F, 1.0F);
}
项目:BaseClient    文件:S10PacketSpawnPainting.java   
public S10PacketSpawnPainting(EntityPainting painting)
{
    this.entityID = painting.getEntityId();
    this.position = painting.getHangingPosition();
    this.facing = painting.facingDirection;
    this.title = painting.art.title;
}
项目:BaseClient    文件:S10PacketSpawnPainting.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.entityID = buf.readVarIntFromBuffer();
    this.title = buf.readStringFromBuffer(EntityPainting.EnumArt.field_180001_A);
    this.position = buf.readBlockPos();
    this.facing = EnumFacing.getHorizontal(buf.readUnsignedByte());
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Handles the spawning of a painting object
 */
public void handleSpawnPainting(S10PacketSpawnPainting packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(),
            packetIn.getFacing(), packetIn.getTitle());
    this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting);
}
项目:BaseClient    文件:RenderPainting.java   
private void setLightmap(EntityPainting painting, float p_77008_2_, float p_77008_3_)
{
    int i = MathHelper.floor_double(painting.posX);
    int j = MathHelper.floor_double(painting.posY + (double)(p_77008_3_ / 16.0F));
    int k = MathHelper.floor_double(painting.posZ);
    EnumFacing enumfacing = painting.facingDirection;

    if (enumfacing == EnumFacing.NORTH)
    {
        i = MathHelper.floor_double(painting.posX + (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.WEST)
    {
        k = MathHelper.floor_double(painting.posZ - (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.SOUTH)
    {
        i = MathHelper.floor_double(painting.posX - (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.EAST)
    {
        k = MathHelper.floor_double(painting.posZ + (double)(p_77008_2_ / 16.0F));
    }

    int l = this.renderManager.worldObj.getCombinedLight(new BlockPos(i, j, k), 0);
    int i1 = l % 65536;
    int j1 = l / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);
    GlStateManager.color(1.0F, 1.0F, 1.0F);
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * Handles the spawning of a painting object
 */
public void handleSpawnPainting(SPacketSpawnPainting packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(), packetIn.getFacing(), packetIn.getTitle());
    entitypainting.setUniqueId(packetIn.getUniqueId());
    this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting);
}
项目:Backmemed    文件:SPacketSpawnPainting.java   
public SPacketSpawnPainting(EntityPainting painting)
{
    this.entityID = painting.getEntityId();
    this.uniqueId = painting.getUniqueID();
    this.position = painting.getHangingPosition();
    this.facing = painting.facingDirection;
    this.title = painting.art.title;
}
项目:Backmemed    文件:SPacketSpawnPainting.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.entityID = buf.readVarIntFromBuffer();
    this.uniqueId = buf.readUuid();
    this.title = buf.readStringFromBuffer(EntityPainting.EnumArt.MAX_NAME_LENGTH);
    this.position = buf.readBlockPos();
    this.facing = EnumFacing.getHorizontal(buf.readUnsignedByte());
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Handles the spawning of a painting object
 */
public void handleSpawnPainting(SPacketSpawnPainting packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(), packetIn.getFacing(), packetIn.getTitle());
    entitypainting.setUniqueId(packetIn.getUniqueId());
    this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting);
}
项目:Backmemed    文件:RenderPainting.java   
/**
 * Renders the desired {@code T} type Entity.
 */
public void doRender(EntityPainting entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F);
    GlStateManager.enableRescaleNormal();
    this.bindEntityTexture(entity);
    EntityPainting.EnumArt entitypainting$enumart = entity.art;
    float f = 0.0625F;
    GlStateManager.scale(0.0625F, 0.0625F, 0.0625F);

    if (this.renderOutlines)
    {
        GlStateManager.enableColorMaterial();
        GlStateManager.enableOutlineMode(this.getTeamColor(entity));
    }

    this.renderPainting(entity, entitypainting$enumart.sizeX, entitypainting$enumart.sizeY, entitypainting$enumart.offsetX, entitypainting$enumart.offsetY);

    if (this.renderOutlines)
    {
        GlStateManager.disableOutlineMode();
        GlStateManager.disableColorMaterial();
    }

    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
项目:Backmemed    文件:RenderPainting.java   
private void setLightmap(EntityPainting painting, float p_77008_2_, float p_77008_3_)
{
    int i = MathHelper.floor(painting.posX);
    int j = MathHelper.floor(painting.posY + (double)(p_77008_3_ / 16.0F));
    int k = MathHelper.floor(painting.posZ);
    EnumFacing enumfacing = painting.facingDirection;

    if (enumfacing == EnumFacing.NORTH)
    {
        i = MathHelper.floor(painting.posX + (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.WEST)
    {
        k = MathHelper.floor(painting.posZ - (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.SOUTH)
    {
        i = MathHelper.floor(painting.posX - (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.EAST)
    {
        k = MathHelper.floor(painting.posZ + (double)(p_77008_2_ / 16.0F));
    }

    int l = this.renderManager.worldObj.getCombinedLight(new BlockPos(i, j, k), 0);
    int i1 = l % 65536;
    int j1 = l / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);
    GlStateManager.color(1.0F, 1.0F, 1.0F);
}
项目:CustomWorldGen    文件:SPacketSpawnPainting.java   
public SPacketSpawnPainting(EntityPainting painting)
{
    this.entityID = painting.getEntityId();
    this.uniqueId = painting.getUniqueID();
    this.position = painting.getHangingPosition();
    this.facing = painting.facingDirection;
    this.title = painting.art.title;
}
项目:CustomWorldGen    文件:SPacketSpawnPainting.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.entityID = buf.readVarIntFromBuffer();
    this.uniqueId = buf.readUuid();
    this.title = buf.readStringFromBuffer(EntityPainting.EnumArt.MAX_NAME_LENGTH);
    this.position = buf.readBlockPos();
    this.facing = EnumFacing.getHorizontal(buf.readUnsignedByte());
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * Handles the spawning of a painting object
 */
public void handleSpawnPainting(SPacketSpawnPainting packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(), packetIn.getFacing(), packetIn.getTitle());
    entitypainting.setUniqueId(packetIn.getUniqueId());
    this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting);
}
项目:CustomWorldGen    文件:RenderPainting.java   
/**
 * Renders the desired {@code T} type Entity.
 */
public void doRender(EntityPainting entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F);
    GlStateManager.enableRescaleNormal();
    this.bindEntityTexture(entity);
    EntityPainting.EnumArt entitypainting$enumart = entity.art;
    float f = 0.0625F;
    GlStateManager.scale(0.0625F, 0.0625F, 0.0625F);

    if (this.renderOutlines)
    {
        GlStateManager.enableColorMaterial();
        GlStateManager.enableOutlineMode(this.getTeamColor(entity));
    }

    this.renderPainting(entity, entitypainting$enumart.sizeX, entitypainting$enumart.sizeY, entitypainting$enumart.offsetX, entitypainting$enumart.offsetY);

    if (this.renderOutlines)
    {
        GlStateManager.disableOutlineMode();
        GlStateManager.disableColorMaterial();
    }

    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
项目:CustomWorldGen    文件:RenderPainting.java   
private void setLightmap(EntityPainting painting, float p_77008_2_, float p_77008_3_)
{
    int i = MathHelper.floor_double(painting.posX);
    int j = MathHelper.floor_double(painting.posY + (double)(p_77008_3_ / 16.0F));
    int k = MathHelper.floor_double(painting.posZ);
    EnumFacing enumfacing = painting.facingDirection;

    if (enumfacing == EnumFacing.NORTH)
    {
        i = MathHelper.floor_double(painting.posX + (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.WEST)
    {
        k = MathHelper.floor_double(painting.posZ - (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.SOUTH)
    {
        i = MathHelper.floor_double(painting.posX - (double)(p_77008_2_ / 16.0F));
    }

    if (enumfacing == EnumFacing.EAST)
    {
        k = MathHelper.floor_double(painting.posZ + (double)(p_77008_2_ / 16.0F));
    }

    int l = this.renderManager.worldObj.getCombinedLight(new BlockPos(i, j, k), 0);
    int i1 = l % 65536;
    int j1 = l / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);
    GlStateManager.color(1.0F, 1.0F, 1.0F);
}
项目:Gravestone-mod-Extended    文件:ComponentVillageUndertaker.java   
protected void generatePainting(World world, int x, int y, int z, EnumFacing direction) {
    z += getPaintingZCoordinateShift(direction);
    int xCoord = this.getXWithOffset(x, z);
    int yCoord = this.getYWithOffset(y);
    int zCoord = this.getZWithOffset(x, z);

    if (checkPainting(world, xCoord, yCoord, zCoord)) {
        EntityPainting painting = new EntityPainting(world, new BlockPos(xCoord, yCoord, zCoord), getPaintingDirection(direction));
        painting.art = paintings[world.rand.nextInt(paintings.length)];
        world.spawnEntity(painting);
    }
}
项目:ThermosRebased    文件:TrackingRange.java   
/**
 * Gets the range an entity should be 'tracked' by players and visible in
 * the client.
 *
 * @param entity
 * @param defaultRange Default range defined by Mojang
 * @return
 */
public static int getEntityTrackingRange(Entity entity, int defaultRange)
{
    SpigotWorldConfig config = entity.worldObj.getSpigotConfig(); // Cauldron
    int range = defaultRange;
    if ( entity instanceof EntityPlayerMP )
    {
        range = config.playerTrackingRange;
    } else if ( entity.defaultActivationState || entity instanceof EntityGhast )
    {
        range = defaultRange;
    } else if ( entity.activationType == 1 )
    {
        range = config.monsterTrackingRange;
    } else if ( entity.activationType == 2 )
    {
        range = config.animalTrackingRange;
    } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb )
    {
        range = config.miscTrackingRange;
    }
    // Cauldron start - allow for 0 to disable tracking ranges
    if (range == 0)
    {
        return defaultRange;
    }
    // Cauldron end

    return Math.min( config.maxTrackingRange, range );
}
项目:Thermos    文件:TrackingRange.java   
/**
 * Gets the range an entity should be 'tracked' by players and visible in
 * the client.
 *
 * @param entity
 * @param defaultRange Default range defined by Mojang
 * @return
 */
public static int getEntityTrackingRange(Entity entity, int defaultRange)
{
    SpigotWorldConfig config = entity.worldObj.getSpigotConfig(); // Cauldron
    int range = defaultRange;
    if ( entity instanceof EntityPlayerMP )
    {
        range = config.playerTrackingRange;
    } else if ( entity.defaultActivationState || entity instanceof EntityGhast )
    {
        range = defaultRange;
    } else if ( entity.activationType == 1 )
    {
        range = config.monsterTrackingRange;
    } else if ( entity.activationType == 2 )
    {
        range = config.animalTrackingRange;
    } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb )
    {
        range = config.miscTrackingRange;
    }
    // Cauldron start - allow for 0 to disable tracking ranges
    if (range == 0)
    {
        return defaultRange;
    }
    // Cauldron end

    return Math.min( config.maxTrackingRange, range );
}
项目:KCauldron    文件:TrackingRange.java   
/**
 * Gets the range an entity should be 'tracked' by players and visible in
 * the client.
 *
 * @param entity
 * @param defaultRange Default range defined by Mojang
 * @return
 */
public static int getEntityTrackingRange(Entity entity, int defaultRange)
{
    SpigotWorldConfig config = entity.worldObj.getSpigotConfig(); // Cauldron
    int range = defaultRange;
    if ( entity instanceof EntityPlayerMP )
    {
        range = config.playerTrackingRange;
    } else if ( entity.defaultActivationState || entity instanceof EntityGhast )
    {
        range = defaultRange;
    } else if ( entity.activationType == 1 )
    {
        range = config.monsterTrackingRange;
    } else if ( entity.activationType == 2 )
    {
        range = config.animalTrackingRange;
    } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb )
    {
        range = config.miscTrackingRange;
    }
    // Cauldron start - allow for 0 to disable tracking ranges
    if (range == 0)
    {
        return defaultRange;
    }
    // Cauldron end

    return Math.min( config.maxTrackingRange, range );
}
项目:CauldronGit    文件:TrackingRange.java   
/**
 * Gets the range an entity should be 'tracked' by players and visible in
 * the client.
 *
 * @param entity
 * @param defaultRange Default range defined by Mojang
 * @return
 */
public static int getEntityTrackingRange(Entity entity, int defaultRange)
{
    SpigotWorldConfig config = entity.worldObj.getSpigotConfig(); // Cauldron
    int range = defaultRange;
    if ( entity instanceof EntityPlayerMP )
    {
        range = config.playerTrackingRange;
    } else if ( entity.defaultActivationState || entity instanceof EntityGhast )
    {
        range = defaultRange;
    } else if ( entity.activationType == 1 )
    {
        range = config.monsterTrackingRange;
    } else if ( entity.activationType == 2 )
    {
        range = config.animalTrackingRange;
    } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb )
    {
        range = config.miscTrackingRange;
    }
    // Cauldron start - allow for 0 to disable tracking ranges
    if (range == 0)
    {
        return defaultRange;
    }
    // Cauldron end

    return Math.min( config.maxTrackingRange, range );
}