本文整理汇总了Java中dan200.computercraft.api.turtle.TurtleSide类的典型用法代码示例。如果您正苦于以下问题:Java TurtleSide类的具体用法?Java TurtleSide怎么用?Java TurtleSide使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TurtleSide类属于dan200.computercraft.api.turtle包,在下文中一共展示了TurtleSide类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的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: useTool
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
@Override
public TurtleCommandResult useTool(ITurtleAccess turtle, TurtleSide side, TurtleVerb verb, int direction)
{
return TurtleCommandResult.failure();
/*
if(FMLCommonHandler.instance().getEffectiveSide()==Side.CLIENT)//on Client getPeripheral doesn't work (CC1.63pr3)
return TurtleCommandResult.failure();
if(verb==TurtleVerb.Dig)
{
IPeripheral p = turtle.getPeripheral(side);
if(direction>1)//se la direzione non è su o giù
direction = 2;
ITurtleCommand dig = new MinyChunkyPeripheral.DigCommand(direction);
return dig.execute(turtle);
}
else
{
return TurtleCommandResult.failure("Unsupported action");
}
*/
}
示例3: PeripheralBarrel
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
public PeripheralBarrel(ITurtleAccess turtle, TurtleSide side) {
this.turtle = turtle;
this.side = side;
NBTTagCompound tag = turtle.getUpgradeNBTData(side);
if (tag.getInteger("maxSize") > 0)
MAX_SIZE = tag.getInteger("maxSize");
if (tag.getInteger("stackSize") > 0)
STACK_SIZE = tag.getInteger("stackSize");
CURRENT_USAGE = tag.getInteger("currentUsage");
if (tag.getBoolean("isKnown"))
{
ITEM_TYPE_STORED = Item.getItemById(tag.getInteger("itemID"));
ITEM_META_STORED = tag.getInteger("stackMeta");
}
checkUsageStats();
}
示例4: update
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的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);
}
}
}
示例5: activate
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
@ScriptCallable(description = "Activate magnet")
public void activate() {
EntityMagnet magnet = this.magnet.get();
Preconditions.checkState(magnet == null || magnet.isDead, "Magnet already active");
World world = getWorld();
Preconditions.checkNotNull(world, "Trying to spawn magnet, but turtle is unloaded");
Preconditions.checkState(canSpawn(world), "Can't deploy magnet");
Preconditions.checkState(consumeFuel(5), "No fuel");
magnetOwner = new Owner();
magnetOwner.setTargetPosition(0, side == TurtleSide.Left? -1 : 1, 0);
magnet = new EntityMagnet(world, magnetOwner, true);
world.spawnEntity(magnet);
magnet.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1, 1);
this.magnet = new WeakReference<>(magnet);
}
示例6: WirelessChunkyPeripheral
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
public WirelessChunkyPeripheral(ITurtleAccess t, TurtleSide side)
{
super(t);
Class wirelessModemClass = null;
ITurtleUpgrade turtleModemObject = (ITurtleUpgrade) CCReflectionHelper.runMainCCClassMethod("getTurtleUpgrade", 1);
wirelessModemSubPeripheral = turtleModemObject.createPeripheral(t,side);
methodsNumber = wirelessModemSubPeripheral.getMethodNames().length;
}
示例7: update
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的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 )");
}
}
示例8: getIcon
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
@Override
public IIcon getIcon(ITurtleAccess turtle, TurtleSide side)
{
if(side==TurtleSide.Left)
return iconLeft;
else
return iconRight;
}
示例9: getMeta
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
@Override
public Object getMeta(Object target, ItemStack stack) {
Map<String, Object> map = Maps.newHashMap();
addSideInfo(map, "left", GET_UPGRADE.call(target, stack, TurtleSide.Left));
addSideInfo(map, "right", GET_UPGRADE.call(target, stack, TurtleSide.Right));
int fuelLevel = GET_FUEL_LEVEL.call(target, stack);
map.put("fuel", fuelLevel);
return map;
}
示例10: SynthResponsePacket
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
public SynthResponsePacket(String text, int x, int y, int z, World world, TurtleSide side) {
this.text = text;
this.x = x;
this.y = y;
this.z = z;
this.world = world;
this.side = side;
}
示例11: fromBytes
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tag = ByteBufUtils.readTag(buf);
text = tag.getString("text");
x = tag.getInteger("x");
y = tag.getInteger("y");
z = tag.getInteger("z");
world = MinecraftServer.getServer().worldServerForDimension(tag.getInteger("dim"));
side = tag.getString("side").equals("null") ? null : TurtleSide.valueOf(tag.getString("side"));
}
示例12: AudioPacket
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
public AudioPacket(String lang, String text, int x, int y, int z, int world, TurtleSide side) {
this.lang = lang;
this.text = text;
this.x = x;
this.y = y;
this.z = z;
this.side = side;
}
示例13: fromBytes
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tag = ByteBufUtils.readTag(buf);
lang = tag.getString("lang");
text = tag.getString("text");
x = tag.getInteger("x");
y = tag.getInteger("y");
z = tag.getInteger("z");
side = tag.getString("side").equals("null") ? null : TurtleSide.valueOf(tag.getString("side"));
}
示例14: AudioResponsePacket
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
public AudioResponsePacket(String text, String lang, int x, int y, int z, World world, TurtleSide side) {
this.text = text;
this.lang = lang;
this.x = x;
this.y = y;
this.z = z;
this.world = world;
this.side = side;
}
示例15: fromBytes
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tag = ByteBufUtils.readTag(buf);
lang = tag.getString("lang");
text = tag.getString("text");
x = tag.getInteger("x");
y = tag.getInteger("y");
z = tag.getInteger("z");
world = MinecraftServer.getServer().worldServerForDimension(tag.getInteger("dim"));
side = tag.getString("side").equals("null") ? null : TurtleSide.valueOf(tag.getString("side"));
}