本文整理汇总了Java中net.minecraft.tileentity.TileEntity.getPos方法的典型用法代码示例。如果您正苦于以下问题:Java TileEntity.getPos方法的具体用法?Java TileEntity.getPos怎么用?Java TileEntity.getPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.tileentity.TileEntity
的用法示例。
在下文中一共展示了TileEntity.getPos方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTileEntitiesIn
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public List<TileEntity> getTileEntitiesIn(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
{
List<TileEntity> list = Lists.<TileEntity>newArrayList();
for (int i = 0; i < this.loadedTileEntityList.size(); ++i)
{
TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(i);
BlockPos blockpos = tileentity.getPos();
if (blockpos.getX() >= minX && blockpos.getY() >= minY && blockpos.getZ() >= minZ && blockpos.getX() < maxX && blockpos.getY() < maxY && blockpos.getZ() < maxZ)
{
list.add(tileentity);
}
}
return list;
}
示例2: addTileEntity
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public boolean addTileEntity(TileEntity tile)
{
if (tile.getWorld() != null) // Forge - set the world early as vanilla doesn't set it until next tick
tile.setWorldObj(this);
List<TileEntity> dest = processingLoadedTiles ? addedTileEntityList : loadedTileEntityList;
boolean flag = dest.add(tile);
if (flag && tile instanceof ITickable)
{
this.tickableTileEntities.add(tile);
}
if (this.isRemote)
{
BlockPos blockpos = tile.getPos();
IBlockState iblockstate = this.getBlockState(blockpos);
this.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 2);
}
return flag;
}
示例3: addTileEntity
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public boolean addTileEntity(TileEntity tile)
{
boolean flag = this.loadedTileEntityList.add(tile);
if (flag && tile instanceof ITickable)
{
this.tickableTileEntities.add(tile);
}
if (this.isRemote)
{
BlockPos blockpos = tile.getPos();
IBlockState iblockstate = this.getBlockState(blockpos);
this.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 2);
}
return flag;
}
示例4: renderTileEntity
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public void renderTileEntity(TileEntity tileentityIn, float partialTicks, int destroyStage)
{
if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared())
{
RenderHelper.enableStandardItemLighting();
boolean flag = true;
if (Reflector.ForgeTileEntity_hasFastRenderer.exists())
{
flag = !this.drawingBatch || !Reflector.callBoolean(tileentityIn, Reflector.ForgeTileEntity_hasFastRenderer, new Object[0]);
}
if (flag)
{
int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
BlockPos blockpos = tileentityIn.getPos();
this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage);
}
}
示例5: GhostSlotUpdateMessage
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public GhostSlotUpdateMessage(EntityPlayerSP player, TileEntity entity, int slot, ItemStack itemStack) {
this.playerId = player.getUniqueID().toString();
BlockPos pos = entity.getPos();
this.x = pos.getX();
this.y = pos.getY();
this.z = pos.getZ();
this.slot = slot;
this.stack = itemStack;
}
示例6: sendButtonPacket
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public static void sendButtonPacket(TileEntity tile, int buttonID) {
NBTTagCompound tag = new NBTTagCompound();
BlockPos pos = tile.getPos();
tag.setInteger("x", pos.getX());
tag.setInteger("y", pos.getY());
tag.setInteger("z", pos.getZ());
tag.setInteger("PlayerID", Minecraft.getMinecraft().player.getEntityId());
tag.setInteger("ButtonID", buttonID);
network.sendToServer(new PacketToServer(tag, ButtonHandler.GUI_BUTTON_HANDLER));
}
示例7: onRender
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
@SubscribeEvent
public void onRender(RenderEvent event) {
event.getBuffer().begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
for(TileEntity tileEntity : getWorld().loadedTileEntityList) {
if(tileEntity instanceof TileEntityMobSpawner) {
BlockPos pos = tileEntity.getPos();
GeometryTessellator.drawCuboid(event.getBuffer(), pos, GeometryMasks.Line.ALL, Utils.Colors.RED);
}
}
event.getTessellator().draw();
}
示例8: renderTileEntity
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public void renderTileEntity(TileEntity tileentityIn, float partialTicks, int destroyStage)
{
if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared())
{
int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
BlockPos blockpos = tileentityIn.getPos();
this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage);
}
}
示例9: canPlayerSilkHarvestChest
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public static boolean canPlayerSilkHarvestChest(TileEntity te, EntityPlayer player) {
if (!Mods.IRONCHESTS.isLoaded()) {
return false;
}
BlockPos pos = te.getPos();
Block block = te.getWorld() == null ? null : te.getWorld().getBlockState(pos).getBlock();
return te != null && block != null && isIronChest(block) && player != null && player.getHeldItemMainhand() != null && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, player.getHeldItemMainhand()) > 0 && !player.isCreative();
}
示例10: PacketUpdateTextfield
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public PacketUpdateTextfield(TileEntity te, int textfieldID) {
super(te.getPos());
textFieldID = textfieldID;
text = ((IGUITextFieldSensitive) te).getText(textfieldID);
}
示例11: PacketSecurityStation
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public PacketSecurityStation(TileEntity te, String player) {
super(te.getPos());
this.username = player;
}
示例12: PacketRenderRangeLines
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public PacketRenderRangeLines(TileEntity te) {
super(te.getPos());
}
示例13: PacketSendNBTPacket
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public PacketSendNBTPacket(TileEntity te) {
super(te.getPos());
tag = new NBTTagCompound();
te.writeToNBT(tag);
}
示例14: updateTrackedItems
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
private void updateTrackedItems() {
if (trackedItemIds != null) {
trackedItems.clear();
for (Entity entity : getWorld().loadedEntityList) {
if (trackedItemIds.contains(entity.getUniqueID()) && entity instanceof EntityItem) {
trackedItems.add((EntityItem) entity);
}
}
trackedItemIds = null;
}
Iterator<EntityItem> iterator = trackedItems.iterator();
while (iterator.hasNext()) {
EntityItem item = iterator.next();
if (item.world != getWorld() || item.isDead) {
iterator.remove();
} else {
Map<BlockPos, EnumFacing> positions = new HashMap<>();
double range = 0.2;
for (EnumFacing d : EnumFacing.VALUES) {
double posX = item.posX + d.getFrontOffsetX() * range;
double posY = item.posY + d.getFrontOffsetY() * range;
double posZ = item.posZ + d.getFrontOffsetZ() * range;
positions .put(new BlockPos((int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ)), d.getOpposite());
}
for (Entry<BlockPos, EnumFacing> entry : positions.entrySet()) {
BlockPos pos = entry.getKey();
TileEntity te = getWorld().getTileEntity(pos);
if (te == null) continue;
IItemHandler inv = IOHelper.getInventoryForTE(te, entry.getValue());
ItemStack remainder = ItemHandlerHelper.insertItem(inv, item.getItem(), false);
if (!remainder.isEmpty()) {
item.setItem(remainder);
} else {
item.setDead();
iterator.remove();
lastInsertingInventory = te.getPos();
lastInsertingInventorySide = entry.getValue();
break;
}
}
}
}
}
示例15: spawnDummyTracks
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
/**
* Spawns dummy tracks based on flag linking.
*
* @return {@code null} if successful, otherwise the {@link net.minecraft.util.math.BlockPos BlockPos} of the first obstructing block.
*/
public BlockPos spawnDummyTracks() {
/*
* Make sure other tile entity is a flag.
*/
TileEntity tile = worldObj.getTileEntity(this.pos.add(linkedCurve.endPos));
if (!(tile instanceof TileEntitySurveyFlag)) {
return tile.getPos();
}
float width = getSleeperType().getDefaultWidth() - 1.0F;
if (width <= 0.0F) {
width = 0.0F;
}
final int ballast = MathHelper.ceiling_float_int( width / 2.0F );
final OFTCurve thisFlagCurve = linkedCurve;
final OFTCurve otherFlagCurve = ((TileEntitySurveyFlag) tile).linkedCurve;
final Map<BlockPos, Byte> blockMap = new HashMap<BlockPos, Byte>();
/*
* Need to see which end of the curve is higher.
* If we go top-down, the fake tracks are too high and ballast looks weird.
* On the other hand, if we went from the other direction we might miss ballast below the track.
* Steep hills tend to do this, so go in both directions just in case.
*/
BlockPos blockingBlock = addFakeTracksToMap(thisFlagCurve, this.pos, blockMap, ballast);
if(blockingBlock != null){
return blockingBlock;
}
blockingBlock = addFakeTracksToMap(otherFlagCurve, this.pos.add(linkedCurve.endPos), blockMap, ballast);
if(blockingBlock != null){
return blockingBlock;
}
/*
* Finally create fake tracks.
*/
BlockTrackFake.toggleMainTrackBreakage(false);
{
/* Set block states at selected positions. */
IBlockState defState = OFTRegistry.trackStructureFake.getDefaultState();
for (BlockPos placementPos : blockMap.keySet()) {
worldObj.setBlockState(placementPos, defState.withProperty(BlockTrackFake.height, (int) blockMap.get(placementPos)));
}
/* Set block states and tile entities at start and end. */
worldObj.setBlockState(this.pos, OFTRegistry.trackStructure.getDefaultState());
worldObj.setBlockState(this.pos.add(thisFlagCurve.endPos), OFTRegistry.trackStructure.getDefaultState());
TileEntityTrack startTile = new TileEntityTrack(thisFlagCurve);
TileEntityTrack endTile = new TileEntityTrack(otherFlagCurve);
startTile.setFakeTracks(new ArrayList<BlockPos>(blockMap.keySet()));
endTile.setFakeTracks(new ArrayList<BlockPos>(blockMap.keySet()));
worldObj.setTileEntity(this.pos, startTile);
worldObj.setTileEntity(this.pos.add(thisFlagCurve.endPos), endTile);
}
BlockTrackFake.toggleMainTrackBreakage(true);
return null;
}