本文整理汇总了Java中ic2.api.tile.IWrenchable类的典型用法代码示例。如果您正苦于以下问题:Java IWrenchable类的具体用法?Java IWrenchable怎么用?Java IWrenchable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IWrenchable类属于ic2.api.tile包,在下文中一共展示了IWrenchable类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onBlockAdded
import ic2.api.tile.IWrenchable; //导入依赖的package包/类
/**
* Called whenever the block is added into the world.
*/
@Override
public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x, y, z);
int metadata = world.getBlockMetadata(x, y, z);
if (metadata > BlockDamages.DAMAGE_MAX) {
metadata = 0;
}
if (isSolidBlockRequired(metadata))
for (int face = 0; face < 6; face++) {
int side = Facing.oppositeSide[face];
if (world.isSideSolid(x + Facing.offsetsXForSide[side], y
+ Facing.offsetsYForSide[side], z
+ Facing.offsetsZForSide[side],
ForgeDirection.getOrientation(face))) {
TileEntity tileentity = world.getTileEntity(x, y, z);
if (tileentity instanceof IWrenchable) {
((IWrenchable) tileentity).setFacing((short) face);
}
break;
}
}
dropBlockIfCantStay(world, x, y, z);
}
开发者ID:xbony2,项目名称:Nuclear-Control,代码行数:28,代码来源:BlockNuclearControlMain.java
示例2: onNeighborBlockChange
import ic2.api.tile.IWrenchable; //导入依赖的package包/类
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
int side = 0;
TileEntity tileentity = world.getTileEntity(x, y, z);
if (tileentity instanceof IWrenchable) {
side = Facing.oppositeSide[((IWrenchable) tileentity).getFacing()];
}
int metadata = world.getBlockMetadata(x, y, z);
if (isSolidBlockRequired(metadata)
&& !world.isSideSolid(x + Facing.offsetsXForSide[side], y
+ Facing.offsetsYForSide[side], z
+ Facing.offsetsZForSide[side], ForgeDirection
.getOrientation(side).getOpposite())) {
if (!world.isRemote) {
dropBlockAsItem(world, x, y, z, metadata, 0);
}
world.setBlock(x, y, z, Blocks.air, 0, 3);
} else {
RedstoneHelper.checkPowered(world, tileentity);
}
super.onNeighborBlockChange(world, x, y, z, neighbor);
}
开发者ID:xbony2,项目名称:Nuclear-Control,代码行数:24,代码来源:BlockNuclearControlMain.java
示例3: rotateBlock
import ic2.api.tile.IWrenchable; //导入依赖的package包/类
@Override
public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) {
if (axis == ForgeDirection.UNKNOWN) return false;
TileEntity tileEntity = worldObj.getBlockTileEntity(x, y, z);
if (tileEntity instanceof IWrenchable) {
IWrenchable te = (IWrenchable)tileEntity;
int newFacing = ForgeDirection.getOrientation(te.getFacing()).getRotation(axis).ordinal();
if (te.wrenchCanSetFacing(null, newFacing)) {
te.setFacing((short)newFacing);
}
}
return false;
}
开发者ID:Gaarnik,项目名称:bsamod,代码行数:19,代码来源:ThermalGeneratorMachBlock.java
示例4: isWrenchClicked
import ic2.api.tile.IWrenchable; //导入依赖的package包/类
public static boolean isWrenchClicked(TileEntity tileEntity, EntityPlayer player, int side) {
if (player != null && tileEntity != null) {
ItemStack equipped = player.getCurrentEquippedItem();
if (equipped != null) {
boolean ic2Wrench = IC2NuclearControl.instance.crossIc2.isWrench(equipped);
boolean bcWrench = IC2NuclearControl.instance.crossBC.isWrench(equipped, tileEntity, player);// TODO: DMF
if (player.isSneaking() && tileEntity instanceof IRotation) {
if (ic2Wrench || bcWrench) {
if (bcWrench) {
IC2NuclearControl.instance.crossBC.useWrench(equipped, tileEntity, player);
}
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
((IRotation) tileEntity).rotate();
}
return true;
}
}else if (bcWrench && tileEntity instanceof IWrenchable){
IWrenchable wrenchable = (IWrenchable) tileEntity;
if (player.isSneaking()) {
side += side % 2 * -2 + 1;
}
if (wrenchable.wrenchCanSetFacing(player, side)) { //TODO: yo Xbony2, the thing with wrenches only working BC wise... right here!
IC2NuclearControl.instance.crossBC.useWrench(equipped, tileEntity, player);
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
wrenchable.setFacing((short) side);
}
return true;
}
}
}
}
return false;
}
开发者ID:xbony2,项目名称:Nuclear-Control,代码行数:38,代码来源:WrenchHelper.java
示例5: onBlockPlacedBy
import ic2.api.tile.IWrenchable; //导入依赖的package包/类
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item, int metadata) {
TileEntity block = world.getTileEntity(x, y, z);
int side = metadata >> 8;
metadata = metadata & 0xff;
if (metadata > BlockDamages.DAMAGE_MAX) {
metadata = 0;
}
if (block instanceof IWrenchable) {
IWrenchable wrenchable = (IWrenchable) block;
wrenchable.setFacing((short) side);
if (player != null && !isSolidBlockRequired(metadata)) {
int rotationSegment = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if (player.rotationPitch >= 65) {
wrenchable.setFacing((short) 1);
} else if (player.rotationPitch <= -65) {
wrenchable.setFacing((short) 0);
} else {
switch (rotationSegment) {
case 0:
wrenchable.setFacing((short) 2);
break;
case 1:
wrenchable.setFacing((short) 5);
break;
case 2:
wrenchable.setFacing((short) 3);
break;
case 3:
wrenchable.setFacing((short) 4);
break;
default:
wrenchable.setFacing((short) 0);
break;
}
}
}
}
}
开发者ID:xbony2,项目名称:Nuclear-Control,代码行数:40,代码来源:BlockNuclearControlMain.java
示例6: getBlockTexture
import ic2.api.tile.IWrenchable; //导入依赖的package包/类
public IIcon getBlockTexture(IBlockAccess blockaccess, int x, int y, int z, int side) {
TileEntity tileentity = blockaccess.getTileEntity(x, y, z);
int metaSide = 0;
if (tileentity instanceof IWrenchable) {
metaSide = Facing.oppositeSide[((IWrenchable) tileentity).getFacing()];
}
int texture = getMapping()[metaSide][side];
if (tileentity instanceof ITextureHelper) {
texture = ((ITextureHelper) tileentity).modifyTextureIndex(texture);
}
return getIcon(texture);
}
开发者ID:xbony2,项目名称:Nuclear-Control,代码行数:14,代码来源:Subblock.java
注:本文中的ic2.api.tile.IWrenchable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论