本文整理汇总了Java中dan200.computercraft.api.turtle.TurtleSide类的典型用法代码示例。如果您正苦于以下问题:Java TurtleSide类的具体用法?Java TurtleSide怎么用?Java TurtleSide使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TurtleSide类属于dan200.computercraft.api.turtle包,在下文中一共展示了TurtleSide类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 )");
}
}
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:20,代码来源:ChunkyUpgrade.java
示例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");
}
*/
}
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:25,代码来源:MinyChunkyUpgrade.java
示例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();
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:17,代码来源:PeripheralBarrel.java
示例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);
}
}
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:19,代码来源:TurtleRidable.java
示例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);
}
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:18,代码来源:MagnetControlAdapter.java
示例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;
}
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:12,代码来源:WirelessChunkyPeripheral.java
示例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 )");
}
}
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:29,代码来源:WirelessChunkyUpgrade.java
示例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;
}
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:9,代码来源:MinyChunkyUpgrade.java
示例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;
}
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:13,代码来源:TurtleMetaProvider.java
示例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;
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:9,代码来源:SynthResponsePacket.java
示例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"));
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:11,代码来源:SynthResponsePacket.java
示例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;
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:9,代码来源:AudioPacket.java
示例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"));
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:11,代码来源:AudioPacket.java
示例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;
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:10,代码来源:AudioResponsePacket.java
示例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"));
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:12,代码来源:AudioResponsePacket.java
示例16: SynthPacket
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
public SynthPacket(String text, String voice, Float pitch, Float pitchRange, Float pitchShift, Float rate, Float volume,
int x, int y, int z, int world, TurtleSide side) {
this.text = text;
this.voice = voice;
this.pitch = pitch;
this.pitchRange = pitchRange;
this.pitchShift = pitchShift;
this.rate = rate;
this.volume = volume;
this.x = x;
this.y = y;
this.z = z;
this.side = side;
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:15,代码来源:SynthPacket.java
示例17: fromBytes
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tag = ByteBufUtils.readTag(buf);
text = tag.getString("text");
voice = tag.getString("voice");
pitch = tag.getString("pitch").equals("null") ? null : Float.parseFloat(tag.getString("pitch"));
pitchRange = tag.getString("pitchRange").equals("null") ? null : Float.parseFloat(tag.getString("pitchRange"));
pitchShift = tag.getString("pitchShift").equals("null") ? null : Float.parseFloat(tag.getString("pitchShift"));
rate = tag.getString("pitch").equals("null") ? null : Float.parseFloat(tag.getString("pitch"));
volume = tag.getString("volume").equals("null") ? null : Float.parseFloat(tag.getString("volume"));
x = tag.getInteger("x");
y = tag.getInteger("y");
z = tag.getInteger("z");
side = tag.getString("side").equals("null") ? null : TurtleSide.valueOf(tag.getString("side"));
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:16,代码来源:SynthPacket.java
示例18: getPeripheral
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
public static <T> T getPeripheral(ITurtleAccess turtle, Class<T> clazz) {
for (TurtleSide side : EnumSet.allOf(TurtleSide.class)) {
IPeripheral peripheral = turtle.getPeripheral(side);
if (peripheral != null && clazz.isAssignableFrom(peripheral.getClass()))
return (T)peripheral;
}
return null;
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:10,代码来源:TurtleUtil.java
示例19: getPeripheralSide
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
public static TurtleSide getPeripheralSide(ITurtleAccess turtle, Class clazz) {
for (TurtleSide side : EnumSet.allOf(TurtleSide.class)) {
IPeripheral peripheral = turtle.getPeripheral(side);
if (peripheral != null && clazz.isAssignableFrom(peripheral.getClass()))
return side;
}
return null;
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:10,代码来源:TurtleUtil.java
示例20: update
import dan200.computercraft.api.turtle.TurtleSide; //导入依赖的package包/类
@Override
public void update(ITurtleAccess turtle, TurtleSide side) {
IPeripheral peripheral = turtle.getPeripheral(side);
if (peripheral instanceof TileEntityNoteBlock) {
((TileEntityNoteBlock) peripheral).updateEntity(true);
}
}
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:8,代码来源:TurtleNoteBlock.java
注:本文中的dan200.computercraft.api.turtle.TurtleSide类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论