本文整理汇总了Java中dan200.computercraft.api.turtle.ITurtleAccess.getWorld方法的典型用法代码示例。如果您正苦于以下问题:Java ITurtleAccess.getWorld方法的具体用法?Java ITurtleAccess.getWorld怎么用?Java ITurtleAccess.getWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dan200.computercraft.api.turtle.ITurtleAccess
的用法示例。
在下文中一共展示了ITurtleAccess.getWorld方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import dan200.computercraft.api.turtle.ITurtleAccess; //导入方法依赖的package包/类
@Override
public void update(ITurtleAccess turtle, TurtleSide side)
{
//CRMod.infoLog("chunky.update(): getUpgrade="+turtle.getUpgrade(side));
if(turtle.getWorld().isRemote)//on Client getPeripheral doesn't work (CC1.63pr3)
return;
IPeripheral p = turtle.getPeripheral(side);
if( p instanceof ChunkyPeripheral)
{
((ChunkyPeripheral) p).update();
}
else
{
if(p!=null)
ChunkyPeripherals.logger.error("update called on a turtle without chunky module ( p is "+p.getClass().getName()+")");
else
ChunkyPeripherals.logger.error("update called on a turtle without chunky module ( p is null )");
}
}
示例2: update
import dan200.computercraft.api.turtle.ITurtleAccess; //导入方法依赖的package包/类
@Override
public void update(ITurtleAccess turtle, TurtleSide side) {
if (!Config.enableRidableTurtle) {
return;
}
World world = turtle.getWorld();
if (!world.isRemote) {
try {
getEntity(turtle);
} catch (Exception e) {
EntityRidableTurtle ridableTurtle = new EntityRidableTurtle(world);
ridableTurtle.setPosition(turtle.getPosition().posX + 0.5, turtle.getPosition().posY,
turtle.getPosition().posZ + 0.5);
ridableTurtle.setTurtle(turtle);
world.spawnEntityInWorld(ridableTurtle);
}
}
}
示例3: update
import dan200.computercraft.api.turtle.ITurtleAccess; //导入方法依赖的package包/类
@Override
public void update(ITurtleAccess turtle, TurtleSide side)
{
//update the chunky part of the peripheral
super.update(turtle,side);
//do what dan does
if(turtle.getWorld().isRemote)
return;
IPeripheral p = turtle.getPeripheral(side);
if( p!=null && p instanceof WirelessChunkyPeripheral)
{
Object subPeripheral = ((WirelessChunkyPeripheral)p).getSubPeripheral();
if((Boolean) CCReflectionHelper.invokeMethod(subPeripheral, true, "pollChanged"))
{
turtle.getUpgradeNBTData(side).setBoolean("active", (Boolean) CCReflectionHelper.invokeMethod(subPeripheral, true, "isActive"));
turtle.updateUpgradeNBTData(side);
}
}
else
{
if(p!=null)
ChunkyPeripherals.logger.error("update called on a turtle without wireless chunky module ( p is "+p.getClass().getName()+")");
else
ChunkyPeripherals.logger.error("update called on a turtle without wireless chunky module ( p is null )");
}
}
示例4: PeripheralTank
import dan200.computercraft.api.turtle.ITurtleAccess; //导入方法依赖的package包/类
public PeripheralTank(ITurtleAccess turtle, TurtleSide side) {
this.turtle = turtle;
this.side = side;
if (!turtle.getWorld().isRemote) {
NBTTagCompound turtleTag = turtle.getUpgradeNBTData(side);
NBTTagCompound tankData = turtleTag.getCompoundTag("TankData");
if (tankData != null) {
fluidTank.readFromNBT(tankData);
}
}
}
示例5: getNearbyEntities
import dan200.computercraft.api.turtle.ITurtleAccess; //导入方法依赖的package包/类
public static List getNearbyEntities(ITurtleAccess turtle, int radiusStart, int radiusEnd, Class entityType) {
World world = turtle.getWorld();
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(
turtle.getPosition().posX - radiusStart, turtle.getPosition().posY - radiusStart,
turtle.getPosition().posZ - radiusStart, turtle.getPosition().posX + radiusEnd,
turtle.getPosition().posY + radiusEnd, turtle.getPosition().posZ + radiusEnd);
return world.getEntitiesWithinAABB(entityType, bb);
}
示例6: TileEntityPlayerSensor
import dan200.computercraft.api.turtle.ITurtleAccess; //导入方法依赖的package包/类
public TileEntityPlayerSensor(ITurtleAccess turtle) {
location = new Location(turtle.getPosition().posX,turtle.getPosition().posY, turtle.getPosition().posZ, turtle.getWorld());
this.turtle = turtle;
this.xCoord = turtle.getPosition().posX;
this.yCoord = turtle.getPosition().posY;
this.zCoord = turtle.getPosition().posZ;
this.setWorldObj(turtle.getWorld());
}
示例7: TileEntityNoteBlock
import dan200.computercraft.api.turtle.ITurtleAccess; //导入方法依赖的package包/类
public TileEntityNoteBlock(ITurtleAccess turtle) {
location = new Location(turtle.getPosition().posX, turtle.getPosition().posY, turtle.getPosition().posZ, turtle.getWorld());
this.xCoord = (int) location.getX();
this.yCoord = (int) location.getY();
this.zCoord = (int) location.getZ();
this.setWorldObj(location.getWorld());
this.turtle = turtle;
}
示例8: setTurtle
import dan200.computercraft.api.turtle.ITurtleAccess; //导入方法依赖的package包/类
public void setTurtle(ITurtleAccess turtle, int direction) {
this.turtle = turtle;
this.world = turtle.getWorld();
this.pos = turtle.getPosition();
this.direction = direction;
this.offsetX = pos.posX + Facing.offsetsXForSide[direction];
this.offsetY = pos.posY + Facing.offsetsYForSide[direction];
this.offsetZ = pos.posZ + Facing.offsetsZForSide[direction];
if (!this.world.isRemote) {
WorldServer server = DimensionManager.getWorld(this.world.provider.dimensionId);
this.fakePlayer = new FakePlayer(server, new GameProfile(null, "turtlePlayer"));
}
}
示例9: PlayerTurtle
import dan200.computercraft.api.turtle.ITurtleAccess; //导入方法依赖的package包/类
public PlayerTurtle(ITurtleAccess turtle) {
super((WorldServer) turtle.getWorld(), new GameProfile(null, "MoarPeripheralsTurtle"));
final ChunkCoordinates coordinates = turtle.getPosition();
setPosition(coordinates.posX + 0.5d, coordinates.posY + 0.5d, coordinates.posZ + 0.5d);
}
示例10: FakeTurtlePlayer
import dan200.computercraft.api.turtle.ITurtleAccess; //导入方法依赖的package包/类
public FakeTurtlePlayer(ITurtleAccess turtle) {
this((WorldServer) turtle.getWorld());
ChunkCoordinates position = turtle.getPosition();
setPosition(position.posX + 0.5D, position.posY + 0.5D, position.posZ + 0.5D);
}
示例11: isTurtleValid
import dan200.computercraft.api.turtle.ITurtleAccess; //导入方法依赖的package包/类
public static boolean isTurtleValid(ITurtleAccess access) {
World world = access.getWorld();
if (world == null) return false;
ChunkCoordinates coords = access.getPosition();
return world.blockExists(coords.posX, coords.posY, coords.posZ);
}