本文整理匯總了Java中net.minecraft.tileentity.TileEntityHopper.func_145889_a方法的典型用法代碼示例。如果您正苦於以下問題:Java TileEntityHopper.func_145889_a方法的具體用法?Java TileEntityHopper.func_145889_a怎麽用?Java TileEntityHopper.func_145889_a使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.tileentity.TileEntityHopper
的用法示例。
在下文中一共展示了TileEntityHopper.func_145889_a方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onNexusExportCall
import net.minecraft.tileentity.TileEntityHopper; //導入方法依賴的package包/類
@Override
public void onNexusExportCall(TileEntityTransporter nexus)
{
if (nexus.getStackInSlot(0) != null)
{
TileEntity tile = nexus.getAttachedTileEntity();
if (tile != null && tile instanceof IInventory)
{
IInventory inv = (IInventory) tile;
ItemStack remainder = TileEntityHopper.func_145889_a(inv, nexus.getStackInSlot(0),
nexus.getBlockMetadata());
nexus.setInventorySlotContents(0, remainder);
}
}
attemptTeleport(nexus);
}
示例2: cutTree
import net.minecraft.tileentity.TileEntityHopper; //導入方法依賴的package包/類
private void cutTree(){
if(inventory != null) {
Block block = worldObj.getBlock(xCoord, yCoord + 2, zCoord);
int offsetY = yCoord + 2;
while(block.getMaterial() == Material.wood) {
List<ItemStack> items = block.getDrops(worldObj, xCoord, offsetY, zCoord, worldObj.getBlockMetadata(xCoord, offsetY, zCoord), 0);
for(ItemStack item : items) {
ItemStack remainder = TileEntityHopper.func_145889_a(inventory, item, 0);
if(remainder != null) {
worldObj.spawnEntityInWorld(new EntityItem(worldObj, xCoord + 0.5, yCoord + 2.5, zCoord + 0.5, remainder));
}
}
worldObj.setBlock(xCoord, offsetY, zCoord, Blocks.air);
offsetY++;
block = worldObj.getBlock(xCoord, offsetY, zCoord);
}
}
}
示例3: onNeighborBlockChange
import net.minecraft.tileentity.TileEntityHopper; //導入方法依賴的package包/類
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block){
super.onNeighborBlockChange(world, x, y, z, block);
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileEntityElevatorBase) {
TileEntityElevatorBase thisTe = (TileEntityElevatorBase)te;
if(thisTe.isCoreElevator()) {
TileEntityElevatorBase teAbove = getCoreTileEntity(world, x, y, z);
if(teAbove != null && teAbove != thisTe) {
for(int i = 0; i < thisTe.getSizeInventory(); i++) {
ItemStack item = thisTe.getStackInSlot(i);
if(item != null) {
ItemStack leftover = TileEntityHopper.func_145889_a(teAbove, item, 0);
thisTe.setInventorySlotContents(i, null);
if(leftover != null) {
EntityItem entity = new EntityItem(world, teAbove.xCoord + 0.5, teAbove.yCoord + 1.5, teAbove.zCoord + 0.5, leftover);
world.spawnEntityInWorld(entity);
}
}
}
}
}
}
}
示例4: ejectItem
import net.minecraft.tileentity.TileEntityHopper; //導入方法依賴的package包/類
public static void ejectItem(World world, int x, int y, int z, ForgeDirection side, ItemStack item, Random random) {
if (item != null) {
TileEntity tile = world.getTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ);
if (tile != null && tile instanceof IInventory) {
ItemStack result = TileEntityHopper.func_145889_a((IInventory) tile, item, side.getOpposite().ordinal());
if (result != null) {
dropItem(world, x, y, z, side, result, random);
}
} else {
dropItem(world, x, y, z, side, item, random);
}
}
}
示例5: exportStackToInventory
import net.minecraft.tileentity.TileEntityHopper; //導入方法依賴的package包/類
public static ItemStack exportStackToInventory(TileEntity te, ItemStack stack, ForgeDirection side){
if(te instanceof IInventory) {
return TileEntityHopper.func_145889_a((IInventory)te, stack, side.ordinal());
} else {
stack = ModInteractionUtils.getInstance().exportStackToTEPipe(te, stack, side);
stack = ModInteractionUtils.getInstance().exportStackToBCPipe(te, stack, side);
return stack;
}
}
示例6: func_149941_e
import net.minecraft.tileentity.TileEntityHopper; //導入方法依賴的package包/類
protected void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
{
BlockSourceImpl var5 = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
TileEntityDispenser var6 = (TileEntityDispenser)var5.getBlockTileEntity();
if (var6 != null)
{
int var7 = var6.func_146017_i();
if (var7 < 0)
{
p_149941_1_.playAuxSFX(1001, p_149941_2_, p_149941_3_, p_149941_4_, 0);
}
else
{
ItemStack var8 = var6.getStackInSlot(var7);
int var9 = p_149941_1_.getBlockMetadata(p_149941_2_, p_149941_3_, p_149941_4_) & 7;
IInventory var10 = TileEntityHopper.func_145893_b(p_149941_1_, (double)(p_149941_2_ + Facing.offsetsXForSide[var9]), (double)(p_149941_3_ + Facing.offsetsYForSide[var9]), (double)(p_149941_4_ + Facing.offsetsZForSide[var9]));
ItemStack var11;
if (var10 != null)
{
var11 = TileEntityHopper.func_145889_a(var10, var8.copy().splitStack(1), Facing.oppositeSide[var9]);
if (var11 == null)
{
var11 = var8.copy();
if (--var11.stackSize == 0)
{
var11 = null;
}
}
else
{
var11 = var8.copy();
}
}
else
{
var11 = this.field_149947_P.dispense(var5, var8);
if (var11 != null && var11.stackSize == 0)
{
var11 = null;
}
}
var6.setInventorySlotContents(var7, var11);
}
}
}
示例7: func_149941_e
import net.minecraft.tileentity.TileEntityHopper; //導入方法依賴的package包/類
public void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_) // CraftBukkit - protected -> public
{
BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();
if (tileentitydispenser != null)
{
int l = tileentitydispenser.func_146017_i();
if (l < 0)
{
p_149941_1_.playAuxSFX(1001, p_149941_2_, p_149941_3_, p_149941_4_, 0);
}
else
{
ItemStack itemstack = tileentitydispenser.getStackInSlot(l);
int i1 = p_149941_1_.getBlockMetadata(p_149941_2_, p_149941_3_, p_149941_4_) & 7;
IInventory iinventory = TileEntityHopper.func_145893_b(p_149941_1_, (double)(p_149941_2_ + Facing.offsetsXForSide[i1]), (double)(p_149941_3_ + Facing.offsetsYForSide[i1]), (double)(p_149941_4_ + Facing.offsetsZForSide[i1]));
ItemStack itemstack1;
if (iinventory != null)
{
// CraftBukkit start - Fire event when pushing items into other inventories
CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.copy().splitStack(1));
org.bukkit.inventory.Inventory destinationInventory;
// Have to special case large chests as they work oddly
if (iinventory instanceof InventoryLargeChest)
{
destinationInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((InventoryLargeChest) iinventory);
}
else
{
destinationInventory = iinventory.getOwner().getInventory();
}
InventoryMoveItemEvent event = new InventoryMoveItemEvent(tileentitydispenser.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true);
p_149941_1_.getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
{
return;
}
itemstack1 = TileEntityHopper.func_145889_a(iinventory, CraftItemStack.asNMSCopy(event.getItem()), Facing.oppositeSide[i1]);
if (event.getItem().equals(oitemstack) && itemstack1 == null)
{
// CraftBukkit end
itemstack1 = itemstack.copy();
if (--itemstack1.stackSize == 0)
{
itemstack1 = null;
}
}
else
{
itemstack1 = itemstack.copy();
}
}
else
{
itemstack1 = this.field_149947_P.dispense(blocksourceimpl, itemstack);
if (itemstack1 != null && itemstack1.stackSize == 0)
{
itemstack1 = null;
}
}
tileentitydispenser.setInventorySlotContents(l, itemstack1);
}
}
}
示例8: func_149941_e
import net.minecraft.tileentity.TileEntityHopper; //導入方法依賴的package包/類
protected void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
{
BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();
if (tileentitydispenser != null)
{
int l = tileentitydispenser.func_146017_i();
if (l < 0)
{
p_149941_1_.playAuxSFX(1001, p_149941_2_, p_149941_3_, p_149941_4_, 0);
}
else
{
ItemStack itemstack = tileentitydispenser.getStackInSlot(l);
int i1 = p_149941_1_.getBlockMetadata(p_149941_2_, p_149941_3_, p_149941_4_) & 7;
IInventory iinventory = TileEntityHopper.func_145893_b(p_149941_1_, (double)(p_149941_2_ + Facing.offsetsXForSide[i1]), (double)(p_149941_3_ + Facing.offsetsYForSide[i1]), (double)(p_149941_4_ + Facing.offsetsZForSide[i1]));
ItemStack itemstack1;
if (iinventory != null)
{
itemstack1 = TileEntityHopper.func_145889_a(iinventory, itemstack.copy().splitStack(1), Facing.oppositeSide[i1]);
if (itemstack1 == null)
{
itemstack1 = itemstack.copy();
if (--itemstack1.stackSize == 0)
{
itemstack1 = null;
}
}
else
{
itemstack1 = itemstack.copy();
}
}
else
{
itemstack1 = this.field_149947_P.dispense(blocksourceimpl, itemstack);
if (itemstack1 != null && itemstack1.stackSize == 0)
{
itemstack1 = null;
}
}
tileentitydispenser.setInventorySlotContents(l, itemstack1);
}
}
}