当前位置: 首页>>代码示例>>Java>>正文


Java EntityPainting类代码示例

本文整理汇总了Java中net.minecraft.entity.item.EntityPainting的典型用法代码示例。如果您正苦于以下问题:Java EntityPainting类的具体用法?Java EntityPainting怎么用?Java EntityPainting使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EntityPainting类属于net.minecraft.entity.item包,在下文中一共展示了EntityPainting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:25,代码来源:CustomPaintingRender.java

示例2: doRender

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:RenderPainting.java

示例3: onItemUse

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
@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;
	}
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:22,代码来源:CustomPaintingItem.java

示例4: func_77008_a

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
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);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:27,代码来源:RenderPainting.java

示例5: setPainting

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
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);
}
 
开发者ID:GotoLink,项目名称:Generatormods,代码行数:20,代码来源:Building.java

示例6: setPaintingArt

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:coolAlias,项目名称:StructureGenerationAPI,代码行数:26,代码来源:GenHelper.java

示例7: onClientPacket

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
@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));
	}
}
 
开发者ID:DavidGoldman,项目名称:PaintingSelectionGui,代码行数:22,代码来源:ClientProxy.java

示例8: getEntityTrackingRange

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
/**
 * 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 );
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:38,代码来源:TrackingRange.java

示例9: S10PacketSpawnPainting

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
public S10PacketSpawnPainting(EntityPainting painting)
{
    this.entityID = painting.getEntityId();
    this.position = painting.getHangingPosition();
    this.facing = painting.facingDirection;
    this.title = painting.art.title;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:S10PacketSpawnPainting.java

示例10: readPacketData

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:11,代码来源:S10PacketSpawnPainting.java

示例11: handleSpawnPainting

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:10,代码来源:NetHandlerPlayClient.java

示例12: setLightmap

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
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);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:34,代码来源:RenderPainting.java

示例13: handleSpawnPainting

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:10,代码来源:NetHandlerPlayClient.java

示例14: handleSpawnPainting

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:11,代码来源:NetHandlerPlayClient.java

示例15: SPacketSpawnPainting

import net.minecraft.entity.item.EntityPainting; //导入依赖的package包/类
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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:SPacketSpawnPainting.java


注:本文中的net.minecraft.entity.item.EntityPainting类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。