• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EnumArt类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: render

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的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: onItemUse

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的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


示例3: setPaintingArt

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的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


示例4: onClientPacket

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的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


示例5: getArt

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
@Override
public Art getArt() {
    for(EnumArt art : EnumArt.values()) {
        if(art.title.equals(title)) return (Art)(Object)art;
    }
    return Arts.KEBAB;
}
 
开发者ID:Guichaguri,项目名称:PacketControl,代码行数:8,代码来源:MixinPacketSpawnPainting.java


示例6: addInformation

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
@Override
public void addInformation(ItemStack stack, World player, List<String> tooltip, ITooltipFlag advanced) {
	if(!stack.hasTagCompound())return;
	EnumArt painting = EnumArt.valueOf(stack.getTagCompound().getString("art"));
	tooltip.add("Painting: " + painting.title);
	tooltip.add("Size: " + painting.sizeX/16 + "x" + painting.sizeY/16);
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:8,代码来源:CustomPaintingItem.java


示例7: onUpdate

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
@Override
public void onUpdate(ItemStack stack, World world, Entity entityIn, int itemSlot, boolean isSelected) {
	if(world.isRemote)return;
	if(stack.hasTagCompound())return;
	NBTTagCompound tag = new NBTTagCompound();
	tag.setString("art", EnumArt.KEBAB.name());
	stack.setTagCompound(tag);
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:9,代码来源:CustomPaintingItem.java


示例8: trigger

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
@Override
public void trigger(World world, EntityPlayerMP player, ItemStack stack) {
	if(world.isRemote) return;
	int current = EnumArt.valueOf(stack.getTagCompound().getString("art")).ordinal();
	current++;
	if(current >= EnumArt.values().length)current = 0;
	EnumArt art = EnumArt.values()[current];
	stack.getTagCompound().setString("art", art.name());
	player.sendMessage(new TextComponentString("Changed painting to " + TextFormatting.GOLD + art.title + TextFormatting.GREEN + " (" + art.sizeX/16 + "x" + art.sizeY/16 + ")"));
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:11,代码来源:CustomPaintingItem.java


示例9: execute

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
@Override
public String execute(CommandSender sender, String[] params) throws CommandException {
	Entity entity = getSenderAsEntity(sender.getMinecraftISender(), Entity.class);
	
	boolean sneaking = entity.isSneaking();
	Entity hit = EntityUtils.traceEntity(entity, 128.0D);
	
	if (!(hit instanceof EntityPainting) || hit.isDead)
		throw new CommandException("command.cyclepainting.noPainting", sender);
	
	EntityPainting picture = (EntityPainting) hit;
	EntityPainting newPicture = new EntityPainting(picture.world, picture.getHangingPosition(), picture.facingDirection);
			
	EnumArt oldArt = picture.art;
	int current = 0;
			
	List<EnumArt> arts = new ArrayList<EnumArt>();
	EnumArt[] all = EnumArt.values();
			
	for (int i = 0; i < all.length; ++i) {
		arts.add(all[i]);
		if (oldArt == all[i]) current = i;
	}
	        
	if (arts.size() <= 1) {
		newPicture.art = oldArt;
		entity.world.removeEntity(picture);
		entity.world.spawnEntity(newPicture);
		throw new CommandException("command.cyclepainting.noMoreArts", sender);
	}
	        
	int newArt = sneaking ? (current == 0 ? arts.size() - 1 : current - 1) : (current == arts.size() - 1 ? 0 : current + 1);

	newPicture.art = arts.get(newArt);
	entity.world.removeEntity(picture);
	entity.world.spawnEntity(newPicture);
	
	return null;
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:40,代码来源:CommandCyclepainting.java


示例10: compare

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
@Override
public int compare(EnumArt a, EnumArt b) {
	if (a.sizeY > b.sizeY)
		return -1;
	if (a.sizeY < b.sizeY)
		return 1;
	return b.sizeX - a.sizeX;
}
 
开发者ID:DavidGoldman,项目名称:PaintingSelectionGui,代码行数:9,代码来源:ArtComparator.java


示例11: createGui

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
@Override
protected void createGui() {
	scrollbar = new ScrollbarVanilla(10);
	paintingContainer = new Container(scrollbar, 0, 4);
	container = new Container();
	title = new Label("Select a Painting");
	back = new ButtonVanilla("Cancel", new CloseHandler());
	
	EnumArt[] enumArts = EnumArt.values();
	ArrayList<EnumArt> validArts = new ArrayList<EnumArt>();
	for (String s : art)
		for (EnumArt enumArt : enumArts)
			if (enumArt.title.equals(s)){
				validArts.add(enumArt);
				break;
			}
	
	EnumArt[] validArtsArray = validArts.toArray(new EnumArt[0]);
	buttons = new PaintingButton[validArtsArray.length];
	for (int i = 0; i < validArtsArray.length; ++i)
		buttons[i] = new PaintingButton(validArtsArray[i], this);
	
	container.addWidgets(title, back);
	paintingContainer.addWidgets(buttons);
	
	containers.add(paintingContainer);
	containers.add(container);
	selectedContainer = paintingContainer;
}
 
开发者ID:DavidGoldman,项目名称:PaintingSelectionGui,代码行数:30,代码来源:PaintingSelectionScreen.java


示例12: setArt

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
@Override
public void setArt(Art art) {
    title = ((EnumArt)(Object)art).title;
}
 
开发者ID:Guichaguri,项目名称:PacketControl,代码行数:5,代码来源:MixinPacketSpawnPainting.java


示例13: addArt

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
public static EnumArt addArt(String name, String tile, int sizeX, int sizeY, int offsetX, int offsetY)
{
    return addEnum(EnumArt.class, name, tile, sizeX, sizeY, offsetX, offsetY);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:EnumHelper.java


示例14: getEnumArt

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
protected EnumArt getEnumArt(String artName) {
	for (EnumArt art : EnumArt.values())
		if (art.title.equals(artName))
			return art;
	return EnumArt.Kebab;
}
 
开发者ID:DavidGoldman,项目名称:PaintingSelectionGui,代码行数:7,代码来源:NetProxy.java


示例15: setPaintingArt

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
protected void setPaintingArt(EntityPainting p, EnumArt art) {
	p.art = art;
	p.setDirection(p.hangingDirection);
}
 
开发者ID:DavidGoldman,项目名称:PaintingSelectionGui,代码行数:5,代码来源:NetProxy.java


示例16: PaintingButton

import net.minecraft.entity.item.EntityPainting.EnumArt; //导入依赖的package包/类
public PaintingButton(EnumArt art, ButtonHandler handler) {
	super(art.sizeX, art.sizeY, handler);
	
	this.art = art;
}
 
开发者ID:DavidGoldman,项目名称:PaintingSelectionGui,代码行数:6,代码来源:PaintingButton.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FFmpeg类代码示例发布时间:2022-05-22
下一篇:
Java RegistryType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap