本文整理汇总了Java中net.minecraft.tileentity.TileEntityBanner类的典型用法代码示例。如果您正苦于以下问题:Java TileEntityBanner类的具体用法?Java TileEntityBanner怎么用?Java TileEntityBanner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TileEntityBanner类属于net.minecraft.tileentity包,在下文中一共展示了TileEntityBanner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCraftingResult
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
public ItemStack getCraftingResult(InventoryCrafting inv)
{
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack != null && TileEntityBanner.getPatterns(itemstack) > 0)
{
ItemStack itemstack1 = itemstack.copy();
itemstack1.stackSize = 1;
return itemstack1;
}
}
return null;
}
示例2: getRemainingItems
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
for (int i = 0; i < aitemstack.length; ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack != null)
{
if (itemstack.getItem().hasContainerItem())
{
aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
}
else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
{
aitemstack[i] = itemstack.copy();
aitemstack[i].stackSize = 1;
}
}
}
return aitemstack;
}
示例3: dropBlockAsItemWithChance
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
/**
* Spawns this Block's drops into the World as EntityItems.
*/
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityBanner)
{
ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor());
NBTTagCompound nbttagcompound = new NBTTagCompound();
tileentity.writeToNBT(nbttagcompound);
nbttagcompound.removeTag("x");
nbttagcompound.removeTag("y");
nbttagcompound.removeTag("z");
nbttagcompound.removeTag("id");
itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
spawnAsEntity(worldIn, pos, itemstack);
}
else
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
}
示例4: harvestBlock
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
if (te instanceof TileEntityBanner)
{
TileEntityBanner tileentitybanner = (TileEntityBanner)te;
ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)te).getBaseColor());
NBTTagCompound nbttagcompound = new NBTTagCompound();
TileEntityBanner.func_181020_a(nbttagcompound, tileentitybanner.getBaseColor(), tileentitybanner.func_181021_d());
itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
spawnAsEntity(worldIn, pos, itemstack);
}
else
{
super.harvestBlock(worldIn, player, pos, state, (TileEntity)null);
}
}
示例5: addInformation
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
/**
* allows items to add custom lines of information to the mouseover description
*/
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
if (nbttagcompound != null && nbttagcompound.hasKey("Patterns"))
{
NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10);
for (int i = 0; i < nbttaglist.tagCount() && i < 6; ++i)
{
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(nbttagcompound1.getInteger("Color"));
TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound1.getString("Pattern"));
if (tileentitybanner$enumbannerpattern != null)
{
tooltip.add(StatCollector.translateToLocal("item.banner." + tileentitybanner$enumbannerpattern.getPatternName() + "." + enumdyecolor.getUnlocalizedName()));
}
}
}
}
示例6: handleUpdateTileEntity
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
/**
* Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
* beacons, skulls, flowerpot
*/
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
{
TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
int i = packetIn.getTileEntityType();
if (i == 1 && tileentity instanceof TileEntityMobSpawner || i == 2 && tileentity instanceof TileEntityCommandBlock || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner)
{
tileentity.readFromNBT(packetIn.getNbtCompound());
}
}
}
示例7: TileEntityRendererDispatcher
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
private TileEntityRendererDispatcher()
{
this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
{
tileentityspecialrenderer.setRendererDispatcher(this);
}
}
示例8: handleUpdateTileEntity
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
/**
* Updates the NBTTagCompound metadata of instances of the following
* entitytypes: Mob spawners, command blocks, beacons, skulls, flowerpot
*/
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) {
TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
int i = packetIn.getTileEntityType();
if (i == 1 && tileentity instanceof TileEntityMobSpawner
|| i == 2 && tileentity instanceof TileEntityCommandBlock
|| i == 3 && tileentity instanceof TileEntityBeacon
|| i == 4 && tileentity instanceof TileEntitySkull
|| i == 5 && tileentity instanceof TileEntityFlowerPot
|| i == 6 && tileentity instanceof TileEntityBanner) {
tileentity.readFromNBT(packetIn.getNbtCompound());
}
}
}
示例9: handleUpdateTileEntity
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
/**
* Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
* beacons, skulls, flowerpot
*/
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (this.gameController.world.isBlockLoaded(packetIn.getPos()))
{
TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos());
int i = packetIn.getTileEntityType();
boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;
if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox)
{
tileentity.readFromNBT(packetIn.getNbtCompound());
}
if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
{
((GuiCommandBlock)this.gameController.currentScreen).updateGui();
}
}
}
示例10: getCraftingResult
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
public ItemStack getCraftingResult(InventoryCrafting inv)
{
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (!itemstack.func_190926_b() && TileEntityBanner.getPatterns(itemstack) > 0)
{
ItemStack itemstack1 = itemstack.copy();
itemstack1.func_190920_e(1);
return itemstack1;
}
}
return ItemStack.field_190927_a;
}
示例11: getRemainingItems
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);
for (int i = 0; i < nonnulllist.size(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (!itemstack.func_190926_b())
{
if (itemstack.getItem().hasContainerItem())
{
nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
}
else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
{
ItemStack itemstack1 = itemstack.copy();
itemstack1.func_190920_e(1);
nonnulllist.set(i, itemstack1);
}
}
}
return nonnulllist;
}
示例12: TileEntityRendererDispatcher
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
private TileEntityRendererDispatcher()
{
this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer());
this.mapSpecialRenderers.put(TileEntityShulkerBox.class, new TileEntityShulkerBoxRenderer(new ModelShulker()));
for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
{
tileentityspecialrenderer.setRendererDispatcher(this);
}
}
示例13: craftItem
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void craftItem(net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemCraftedEvent event) {
ItemStack withPattern=ItemStack.EMPTY;
ItemStack noPattern=ItemStack.EMPTY;
for(int i=0; i<event.craftMatrix.getSizeInventory();i++){
ItemStack stack=event.craftMatrix.getStackInSlot(i);
if(!stack.isEmpty() && stack.getItem() instanceof ItemBanner){
if(TileEntityBanner.getPatterns(stack)>0){
withPattern=stack;
}
else{
noPattern=stack;
}
if(!withPattern.isEmpty()&&!noPattern.isEmpty()){
withPattern.shrink(1);
}
}
}
}
示例14: getPatterns
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
public static List<BannerPattern> getPatterns(TileEntityBanner banner){
List<BannerPattern> patterns = new ArrayList<>();
patterns.add(BannerPattern.BASE);
NBTTagList patternsnbt = banner.writeToNBT(new NBTTagCompound()).getTagList("Patterns", 10);
for (int i = 0; i < patternsnbt.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = patternsnbt.getCompoundTagAt(i);
for(BannerPattern pattern:BannerPattern.values()) {
if (pattern.getHashname().equals(nbttagcompound.getString("Pattern")))
{
patterns.add(pattern);
break;
}
}
}
return patterns;
}
示例15: detectBanner
import net.minecraft.tileentity.TileEntityBanner; //导入依赖的package包/类
public boolean detectBanner(){
Iterator<BlockPos> iterator=this.world.getCapability(TF2weapons.WORLD_CAP, null).banners.iterator();
while(iterator.hasNext()){
BlockPos pos=iterator.next();
if(pos.distanceSq(this.getPosition())<1200){
TileEntity banner=this.world.getTileEntity(pos);
if(banner != null && banner instanceof TileEntityBanner){
boolean fast=false;
for(BannerPattern pattern: TF2EventsCommon.getPatterns((TileEntityBanner)banner)){
if(pattern==TF2weapons.redPattern)
this.bannerTeam=0;
else if(pattern==TF2weapons.bluPattern)
this.bannerTeam=1;
else if(pattern==TF2weapons.fastSpawn)
fast=true;
}
return fast && pos.distanceSq(this.getPosition())<512;
}
else{
iterator.remove();
return false;
}
}
}
return false;
}