本文整理汇总了Java中net.minecraft.tileentity.TileEntityBanner.getPatterns方法的典型用法代码示例。如果您正苦于以下问题:Java TileEntityBanner.getPatterns方法的具体用法?Java TileEntityBanner.getPatterns怎么用?Java TileEntityBanner.getPatterns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.tileentity.TileEntityBanner
的用法示例。
在下文中一共展示了TileEntityBanner.getPatterns方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getCraftingResult
import net.minecraft.tileentity.TileEntityBanner; //导入方法依赖的package包/类
/**
* Returns an Item that is the result of this recipe
*/
@Nullable
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;
}
示例4: 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);
}
}
}
}
示例5: 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;
}
示例6: 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(itemstack))
{
aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack);
}
else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
{
aitemstack[i] = itemstack.copy();
aitemstack[i].stackSize = 1;
}
}
}
return aitemstack;
}
示例7: matches
import net.minecraft.tileentity.TileEntityBanner; //导入方法依赖的package包/类
public boolean matches(InventoryCrafting inv, World worldIn)
{
boolean flag = false;
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack != null && itemstack.getItem() == Items.banner)
{
if (flag)
{
return false;
}
if (TileEntityBanner.getPatterns(itemstack) >= 6)
{
return false;
}
flag = true;
}
}
if (!flag)
{
return false;
}
else
{
return this.func_179533_c(inv) != null;
}
}
示例8: matches
import net.minecraft.tileentity.TileEntityBanner; //导入方法依赖的package包/类
/**
* Used to check if a recipe matches current crafting inventory
*/
public boolean matches(InventoryCrafting inv, World worldIn)
{
boolean flag = false;
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack != null && itemstack.getItem() == Items.BANNER)
{
if (flag)
{
return false;
}
if (TileEntityBanner.getPatterns(itemstack) >= 6)
{
return false;
}
flag = true;
}
}
if (!flag)
{
return false;
}
else
{
return this.matchPatterns(inv) != null;
}
}
示例9: removeDye
import net.minecraft.tileentity.TileEntityBanner; //导入方法依赖的package包/类
private boolean removeDye(World world, BlockPos pos, EntityPlayer player, EnumHand hand, @Nonnull ItemStack stack, TileFluidTank tank) {
IFluidHandler handler = FluidUtil.getFluidHandler(world, pos, null);
if (handler == null) return false;
if (tank.getFluid() != null && tank.getFluid().getFluid() == FluidRegistry.WATER && tank.getFluidAmount() >= 250) {
if (stack.getItem() instanceof ItemArmor && ((ItemArmor) stack.getItem()).hasColor(stack)) {
if (!world.isRemote) {
((ItemArmor) stack.getItem()).removeColor(stack);
player.addStat(StatList.ARMOR_CLEANED);
handler.drain(250, true);
}
player.playSound(SoundEvents.ENTITY_BOBBER_SPLASH, 0.16F, 0.66F);
return true;
}
if (stack.getItem() instanceof ItemBanner) {
if (TileEntityBanner.getPatterns(stack) > 0) {
if (!world.isRemote) {
ItemStack banner = stack.copy();
banner.setCount(1);
TileEntityBanner.removeBannerData(banner);
player.addStat(StatList.BANNER_CLEANED);
if (!player.capabilities.isCreativeMode) {
stack.shrink(1);
handler.drain(250, true);
}
InventoryHandlerHelper.giveItem(player, hand, banner);
}
player.playSound(SoundEvents.ENTITY_BOBBER_SPLASH, 0.16F, 0.66F);
}
return true;
}
}
return false;
}
示例10: onBlockActivated
import net.minecraft.tileentity.TileEntityBanner; //导入方法依赖的package包/类
@Beta
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
EnumFacing side, float hitX, float hitY, float hitZ) {
TileEntityCauldron cauldron = getTileEntityCauldron(world, pos);
ItemStack heldItem = player.getHeldItem(hand);
CauldronActivatedEvent event;
if (MinecraftForge.EVENT_BUS.post(event = new CauldronActivatedEvent(world, pos, state, player, hand, cauldron,
heldItem, side, hitX, hitY, hitZ)))
return event.getResult() == Result.DEFAULT;
LinkedList<ItemStack> list = getTileEntityCauldron(world, pos).getContainer();
if (heldItem == null) {
if (Always.isServer()) {
if (list.size() > 0) {
player.setHeldItem(hand, list.removeLast());
player.inventory.markDirty();
cauldron.onContainerChange();
cauldron.updateTracker();
}
}
} else {
int i = getWaterLevel(world, pos, state);
Item item = heldItem.getItem();
if (item == ModItems.botania$waterRod) {
// if (i > -1 && i < 3 && ManaItemHandler.requestManaExact(heldItem, player, ItemWaterRod.COST, true))
// setWaterLevel(world, pos, state, 3);
} else if (FluidUtil.getFluidHandler(heldItem) != null) {
FluidUtil.interactWithFluidHandler(player, hand, cauldron.getTank());
} else if (!list.isEmpty()) {
if (Always.isServer()) {
boolean flag = false;
int limit = heldItem.getMaxStackSize();
if (heldItem.getCount() >= limit)
return false;
for (Iterator<ItemStack> iterator = list.iterator(); iterator.hasNext();) {
ItemStack citem = iterator.next();
if (InventoryHelper.canMergeItemStack(heldItem, citem))
if (heldItem.getCount() < limit) {
heldItem.setCount(heldItem.getCount() + 1);
iterator.remove();
flag = true;
} else
break;
}
if (flag) {
player.inventory.markDirty();
cauldron.onContainerChange();
cauldron.updateTracker();
}
}
} else {
if (item instanceof ItemArmor) {
if (i > 0) {
ItemArmor armor = (ItemArmor) item;
if (armor.getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER && armor.hasColor(heldItem)) {
armor.removeColor(heldItem);
player.addStat(StatList.ARMOR_CLEANED);
setWaterLevel(world, pos, state, i - 1);
}
}
} else if (item instanceof ItemBanner) {
if (i > 0 && TileEntityBanner.getPatterns(heldItem) > 0) {
ItemStack banner = heldItem.copy();
banner.setCount(1);
TileEntityBanner.removeBannerData(banner);
InventoryHelper.addItemStackOrSetToHand(player, hand, heldItem, banner);
player.addStat(StatList.BANNER_CLEANED);
setWaterLevel(world, pos, state, i - 1);
}
}
}
}
return true;
}