Java 类net.minecraft.util.math.BlockPos 实例源码
项目:MeeCreeps
文件:WorkerHelper.java
@Override
public boolean findItemOnGroundOrInChest(Predicate<ItemStack> matcher, int maxAmount, String message, String... parameters) {
List<BlockPos> meeCreepChests = findMeeCreepChests(worker.getSearchBox());
if (meeCreepChests.isEmpty()) {
if (!findItemOnGround(worker.getSearchBox(), matcher, this::pickup)) {
if (!findInventoryContainingMost(worker.getSearchBox(), matcher, p -> fetchFromInventory(p, matcher, maxAmount))) {
showMessage(message, parameters);
return false;
}
}
} else {
if (!findInventoryContainingMost(meeCreepChests, matcher, p -> fetchFromInventory(p, matcher, maxAmount))) {
showMessage(message, parameters);
return false;
}
}
return true;
}
项目:CustomWorldGen
文件:BlockFlowerPot.java
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
{
TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos);
if (tileentityflowerpot != null)
{
ItemStack itemstack = tileentityflowerpot.getFlowerItemStack();
if (itemstack != null)
{
return itemstack;
}
}
return new ItemStack(Items.FLOWER_POT);
}
项目:CustomWorldGen
文件:BlockPortal.java
/**
* Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
* change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
* block, etc.
*/
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
{
EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS);
if (enumfacing$axis == EnumFacing.Axis.X)
{
BlockPortal.Size blockportal$size = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.X);
if (!blockportal$size.isValid() || blockportal$size.portalBlockCount < blockportal$size.width * blockportal$size.height)
{
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
}
}
else if (enumfacing$axis == EnumFacing.Axis.Z)
{
BlockPortal.Size blockportal$size1 = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.Z);
if (!blockportal$size1.isValid() || blockportal$size1.portalBlockCount < blockportal$size1.width * blockportal$size1.height)
{
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
}
}
}
项目:ThermionicsWorld
文件:ChunkProviderNeo.java
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
if (pos==null) return ImmutableList.of();
if (creatureType == EnumCreatureType.MONSTER) {
//if (this.genNetherBridge.isInsideStructure(pos)) {
// return this.genNetherBridge.getSpawnList();
//}
if (this.genNetherBridge.isPositionInStructure(this.world, pos) && this.world.getBlockState(pos.down()).getBlock() == Blocks.NETHER_BRICK) {
return this.genNetherBridge.getSpawnList();
}
return Biomes.HELL.getSpawnableList(EnumCreatureType.MONSTER); //TODO: Replace with actual-biome lists.
}
return ImmutableList.of();
//Biome biome = this.world.getBiome(pos);
//return biome.getSpawnableList(creatureType);
}
项目:CustomWorldGen
文件:EntityMinecart.java
/**
* Moved to allow overrides.
* This code handles minecart movement and speed capping when on a rail.
*/
public void moveMinecartOnRail(BlockPos pos)
{
double mX = this.motionX;
double mZ = this.motionZ;
if (this.isBeingRidden())
{
mX *= 0.75D;
mZ *= 0.75D;
}
double max = this.getMaxSpeed();
mX = MathHelper.clamp_double(mX, -max, max);
mZ = MathHelper.clamp_double(mZ, -max, max);
this.moveEntity(mX, 0.0D, mZ);
}
项目:Backmemed
文件:BlockDispenser.java
protected void dispense(World worldIn, BlockPos pos)
{
BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();
if (tileentitydispenser != null)
{
int i = tileentitydispenser.getDispenseSlot();
if (i < 0)
{
worldIn.playEvent(1001, pos, 0);
}
else
{
ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack);
if (ibehaviordispenseitem != IBehaviorDispenseItem.DEFAULT_BEHAVIOR)
{
tileentitydispenser.setInventorySlotContents(i, ibehaviordispenseitem.dispense(blocksourceimpl, itemstack));
}
}
}
}
项目:uniquecrops
文件:Wafflonia.java
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
if (this.getAge(state) >= getMaxAge())
return;
int friends = 0;
Iterable<BlockPos> getBox = BlockPos.getAllInBox(pos.add(-4, 0, -4), pos.add(4, 0, 4));
Iterator it = getBox.iterator();
while (it.hasNext()) {
BlockPos looppos = (BlockPos)it.next();
Block loopblock = world.getBlockState(looppos).getBlock();
if (loopblock != null && !world.isAirBlock(looppos) && loopblock == UCBlocks.cropWafflonia) {
if (!world.isRemote)
friends++;
}
}
if ((friends != 0 && friends % 4 != 0) || friends == 0)
return;
super.updateTick(world, pos, state, rand);
}
项目:CustomWorldGen
文件:WorldGenVines.java
public boolean generate(World worldIn, Random rand, BlockPos position)
{
for (; position.getY() < 128; position = position.up())
{
if (worldIn.isAirBlock(position))
{
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL.facings())
{
if (Blocks.VINE.canPlaceBlockOnSide(worldIn, position, enumfacing))
{
IBlockState iblockstate = Blocks.VINE.getDefaultState().withProperty(BlockVine.NORTH, Boolean.valueOf(enumfacing == EnumFacing.NORTH)).withProperty(BlockVine.EAST, Boolean.valueOf(enumfacing == EnumFacing.EAST)).withProperty(BlockVine.SOUTH, Boolean.valueOf(enumfacing == EnumFacing.SOUTH)).withProperty(BlockVine.WEST, Boolean.valueOf(enumfacing == EnumFacing.WEST));
worldIn.setBlockState(position, iblockstate, 2);
break;
}
}
}
else
{
position = position.add(rand.nextInt(4) - rand.nextInt(4), 0, rand.nextInt(4) - rand.nextInt(4));
}
}
return true;
}
项目:craftsman
文件:LinePts.java
private List<BlockPos> xDominant(BlockPos start, BlockPos end) {
int x = start.getX();
int y = start.getY();
int z = start.getZ();
int yd = ay - (ax >> 1);
int zd = az - (ax >> 1);
List<BlockPos> posLt = new ArrayList<>();
do {
posLt.add(new BlockPos(x, y, z));
if(yd >= 0) {
y += sy;
yd -= ax;
}
if(zd >= 0) {
z += sz;
zd -= ax;
}
x += sx;
yd += ay;
zd += az;
} while(x != end.getX());
return posLt;
}
项目:UniversalRemote
文件:ItemUniversalRemote.java
private int computeEnergyCost(EntityPlayer player, int blockDim, BlockPos pos)
{
// check fuel type
if (UniversalRemoteConfiguration.fuel.fuelType.equals(UniversalRemoteConfiguration.FuelType.Energy.toString()) &&
UniversalRemoteConfiguration.fuel.energy.energyCapacity > 0)
{
if (player.dimension == blockDim) {
return Math.min(UniversalRemoteConfiguration.fuel.energy.energyCostMax, (int)(Math.sqrt(player.getDistanceSq(pos)) * UniversalRemoteConfiguration.fuel.energy.energyCostPerBlock));
} else {
return UniversalRemoteConfiguration.fuel.energy.energyCostMax;
}
} else {
return 0;
}
}
项目:Firma
文件:TreeGeneric.java
@Override
public boolean generateTree(World worldIn, Random rand, BlockPos pos) {
filler.leaf = leaf;
// Check light levels
if(worldIn.getLight(pos)<7){
return false;
}
// Check height of trunk
int h = rand.nextInt(heightVar) + height;
for(int y = 0; y<h; y++){
if(!checkBlockAt(worldIn,pos.add(0,h,0))){
return false;
}
}
// Place central trunk
for(int y = 0; y<h; y++){
fill(worldIn, pos.add(0, y, 0));
}
filler.fillLeaves(worldIn, pos.add(0,h-1,0), rand);
return false;
}
项目:Backmemed
文件:BlockEnchantmentTable.java
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
{
if (worldIn.isRemote)
{
return true;
}
else
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityEnchantmentTable)
{
playerIn.displayGui((TileEntityEnchantmentTable)tileentity);
}
return true;
}
}
项目:CustomWorldGen
文件:WorldGenHugeTrees.java
/**
* grow leaves in a circle with the outsides being within the circle
*/
protected void growLeavesLayerStrict(World worldIn, BlockPos layerCenter, int width)
{
int i = width * width;
for (int j = -width; j <= width + 1; ++j)
{
for (int k = -width; k <= width + 1; ++k)
{
int l = j - 1;
int i1 = k - 1;
if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i)
{
BlockPos blockpos = layerCenter.add(j, 0, k);
IBlockState state = worldIn.getBlockState(blockpos);
if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos))
{
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
}
}
}
}
}
项目:Bewitchment
文件:CropKelp.java
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
BlockPos I = pos.add(-1, 0, -1);
BlockPos F = pos.add(1, 1, 1);
for (BlockPos blockPos : BlockPos.getAllInBox(I, F)) {
Block block = worldIn.getBlockState(blockPos).getBlock();
if (block != this && block != Blocks.WATER && block != Blocks.FLOWING_WATER) {
checkAndDropBlock(worldIn, pos, state);
break;
}
}
if (!canBlockStay(worldIn, pos, state) || !canSustainBush(worldIn.getBlockState(pos.down()))) {
checkAndDropBlock(worldIn, pos, state);
}
}
项目:ExPetrum
文件:BlockFarmland.java
@Override
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor)
{
super.onNeighborChange(world, pos, neighbor);
if (world instanceof World)
{
World w = (World) world;
if (this.canFall(w, world.getBlockState(pos), pos, neighbor))
{
w.setBlockState(pos, ExPBlocks.soil.getDefaultState().withProperty(DIRT_CLASS, world.getBlockState(pos).getValue(DIRT_CLASS)));
}
}
}
项目:Backmemed
文件:BlockLiquid.java
public int getPackedLightmapCoords(IBlockState state, IBlockAccess source, BlockPos pos)
{
int i = source.getCombinedLight(pos, 0);
int j = source.getCombinedLight(pos.up(), 0);
int k = i & 255;
int l = j & 255;
int i1 = i >> 16 & 255;
int j1 = j >> 16 & 255;
return (k > l ? k : l) | (i1 > j1 ? i1 : j1) << 16;
}
项目:pnc-repressurized
文件:BlockPressureTube.java
@Override
public boolean rotateBlock(World world, EntityPlayer player, BlockPos pos, EnumFacing side) {
TileEntityPressureTube tube = ModInteractionUtils.getInstance().getTube(getTE(world, pos));
if (player.isSneaking()) {
TubeModule module = getLookedModule(world, pos, player);
if (module != null) {
// detach and drop the module as an item
if (!player.capabilities.isCreativeMode) {
List<ItemStack> drops = module.getDrops();
for (ItemStack drop : drops) {
EntityItem entity = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
entity.setItem(drop);
world.spawnEntity(entity);
entity.onCollideWithPlayer(player);
}
}
tube.setModule(null, module.getDirection());
neighborChanged(world.getBlockState(pos), world, pos, this, pos.offset(side));
world.notifyNeighborsOfStateChange(pos, this, true);
} else {
// drop the pipe as an item
if (!player.capabilities.isCreativeMode) dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
world.setBlockToAir(pos);
}
} else {
// close (or reopen) this side of the pipe
Pair<Boolean, EnumFacing> lookData = getLookedTube(world, pos, player);
if (lookData != null) {
boolean isCore = lookData.getLeft();
EnumFacing sideHit = lookData.getRight();
tube.sidesClosed[sideHit.ordinal()] = !tube.sidesClosed[sideHit.ordinal()];
neighborChanged(world.getBlockState(pos), world, pos, this, pos.offset(side));
world.notifyNeighborsOfStateChange(pos, this, true);
}
}
return true;
}
项目:CustomWorldGen
文件:ForgeHooks.java
public static boolean isLivingOnLadder(IBlockState state, World world, BlockPos pos, EntityLivingBase entity)
{
boolean isSpectator = (entity instanceof EntityPlayer && ((EntityPlayer)entity).isSpectator());
if (isSpectator) return false;
if (!ForgeModContainer.fullBoundingBoxLadders)
{
return state != null && state.getBlock().isLadder(state, world, pos, entity);
}
else
{
AxisAlignedBB bb = entity.getEntityBoundingBox();
int mX = MathHelper.floor_double(bb.minX);
int mY = MathHelper.floor_double(bb.minY);
int mZ = MathHelper.floor_double(bb.minZ);
for (int y2 = mY; y2 < bb.maxY; y2++)
{
for (int x2 = mX; x2 < bb.maxX; x2++)
{
for (int z2 = mZ; z2 < bb.maxZ; z2++)
{
BlockPos tmp = new BlockPos(x2, y2, z2);
state = world.getBlockState(tmp);
if (state.getBlock().isLadder(state, world, tmp, entity))
{
return true;
}
}
}
}
return false;
}
}
项目:SimpleTubes
文件:PacketDisplacerGuiColor.java
@Override
public void fromBytes(ByteBuf buf) {
int dim = buf.readInt();
BlockPos pos = BlockPos.fromLong(buf.readLong());
World world = SimpleTubes.proxy.getWorld(dim);
this.tile = world.getTileEntity(pos);
if (this.col == null)
this.col = new int[buf.readInt()];
if (this.col != null)
for (int i = 0; i < this.col.length; i++)
this.col[i] = buf.readInt();
}
项目:CharcoalPit
文件:BlockPotteryKiln.java
@Override
public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) {
switch((EnumKilnTypes)blockState.getValue(TYPE)){
case EMPTY:return 0.6F;
case THATCH:return 0.6F;
case WOOD:return 2F;
case ACTIVE:return 2F;
case COMPLETE:return 0.6F;
default:return 1F;
}
}
项目:Backmemed
文件:EntityEvoker.java
protected void func_190868_j()
{
for (int i = 0; i < 3; ++i)
{
BlockPos blockpos = (new BlockPos(EntityEvoker.this)).add(-2 + EntityEvoker.this.rand.nextInt(5), 1, -2 + EntityEvoker.this.rand.nextInt(5));
EntityVex entityvex = new EntityVex(EntityEvoker.this.world);
entityvex.moveToBlockPosAndAngles(blockpos, 0.0F, 0.0F);
entityvex.onInitialSpawn(EntityEvoker.this.world.getDifficultyForLocation(blockpos), (IEntityLivingData)null);
entityvex.func_190658_a(EntityEvoker.this);
entityvex.func_190651_g(blockpos);
entityvex.func_190653_a(20 * (30 + EntityEvoker.this.rand.nextInt(90)));
EntityEvoker.this.world.spawnEntityInWorld(entityvex);
}
}
项目:Backmemed
文件:EntityAnimal.java
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
public boolean getCanSpawnHere()
{
int i = MathHelper.floor(this.posX);
int j = MathHelper.floor(this.getEntityBoundingBox().minY);
int k = MathHelper.floor(this.posZ);
BlockPos blockpos = new BlockPos(i, j, k);
return this.world.getBlockState(blockpos.down()).getBlock() == this.spawnableBlock && this.world.getLight(blockpos) > 8 && super.getCanSpawnHere();
}
项目:uniquecrops
文件:ItemSeedsUC.java
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
IBlockState state = world.getBlockState(pos);
if (SeedBehavior.canPlantCrop(stack, player, world, pos, side, cropBlock)) {
--stack.stackSize;
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
项目:VanillaExtras
文件:BlockBreaker.java
@Override
public int getComparatorInputOverride(IBlockState blockState, World world, BlockPos pos) {
TileEntityBlockBreaker te = (TileEntityBlockBreaker) world.getTileEntity(pos);
ItemStackHandler handler = (ItemStackHandler) te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,
null);
return Utils.calculateRedstone(handler);
}
项目:ExPetrum
文件:CropEvent.java
public WaterConsumption(IExPCrop crop, World w, BlockPos at, long l, ImmutableCalendar c, float f, long l1, IFarmland of)
{
super(crop, w, at, l, c);
this.waterConsumed = f;
this.ticksWaterConsumedFor = l1;
this.farmland = of;
}
项目:Backmemed
文件:EntityLivingBase.java
protected void frostWalk(BlockPos pos)
{
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FROST_WALKER, this);
if (i > 0)
{
EnchantmentFrostWalker.freezeNearby(this, this.world, pos, i);
}
}
项目:Backmemed
文件:Block.java
@Deprecated
@Nullable
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
{
if(Hacks.findMod(Freecam.class).isEnabled())
return NULL_AABB;
else
return blockState.getBoundingBox(worldIn, pos);
}
项目:pnc-repressurized
文件:BlockElevatorBase.java
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
super.onBlockAdded(world, pos, state);
TileEntityElevatorBase elevatorBase = getCoreTileEntity(world, pos);
if (elevatorBase != null) {
elevatorBase.updateMaxElevatorHeight();
}
}
项目:harshencastle
文件:BloodCollector.java
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand,
EnumFacing facing, float hitX, float hitY, float hitZ) {
boolean flag = false;
if(worldIn.getBlockState(pos).getBlock() instanceof BloodVessel)
{
TileEntityBloodVessel vessel = ((TileEntityBloodVessel)worldIn.getTileEntity(pos));
switch (hand) {
case MAIN_HAND:
int tileEntityRemove = player.isSneaking() ? getNBT(player.getHeldItem(hand)).getInteger("Blood") : 1;
if(vessel.canAdd(tileEntityRemove) && remove(player, hand, tileEntityRemove))
vessel.change(tileEntityRemove);
else if(vessel.canAdd(vessel.getPossibleAdd()) && remove(player, hand, vessel.getPossibleAdd()))
vessel.change(vessel.getPossibleAdd());
break;
default:
int tileEntityRemoveOffHand = player.isSneaking() ? Math.min(vessel.getPossibleRemove(), 50 - getNBT(player.getHeldItem(hand)).getInteger("Blood")) : 1;
if(vessel.canRemove(tileEntityRemoveOffHand) && fill(player, hand, tileEntityRemoveOffHand))
vessel.change(-tileEntityRemoveOffHand);
break;
}
}
else if(!flag && player.isSneaking() && worldIn.getBlockState(pos.offset(facing).down()).isSideSolid(worldIn, pos, EnumFacing.UP) && remove(player, hand, 1))
{
worldIn.setBlockState(pos.offset(facing), HarshenBlocks.BLOOD_BLOCK.getDefaultState(), 3);
worldIn.getBlockState(pos.offset(facing)).getBlock().onBlockAdded(worldIn, pos.offset(facing), worldIn.getBlockState(pos.offset(facing)));
worldIn.playSound(pos.getX(), pos.getY(), pos.getZ(), HarshenSounds.BLOOD_COLLECTOR_USE, SoundCategory.BLOCKS, 1f, new Random().nextFloat(), false);
}
return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
}
项目:rezolve
文件:RemoteShellGuiContainer.java
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
int rfBarX = 231;
int rfBarY = 20;
int rfBarHeight = 88;
int rfBarWidth = 14;
int usedHeight = rfBarHeight - (int)(this.entity.getEnergyStored(EnumFacing.DOWN) / (double)this.entity.getMaxEnergyStored(EnumFacing.DOWN) * rfBarHeight);
Gui.drawRect(rfBarX, rfBarY, rfBarX + rfBarWidth, rfBarY + usedHeight, 0xFF000000);
DatabaseServerEntity db = this.entity.getDatabase();
this.nameField.setVisible(this.selectedMachine != null && db != null);
if (this.selectedMachine != null) {
BlockPos pos = this.selectedMachine;
ItemStack stack = getItemFromBlock(this.entity, pos);
if (stack != null) {
String name = stack.getDisplayName();
String stackName = stack.getDisplayName();
String position = pos.getX()+", "+pos.getY()+", "+pos.getZ();
if (!this.nameField.getVisible()) {
this.fontRendererObj.drawString(stackName, 10, 126, 0xFF000000);
this.fontRendererObj.drawString(position, 10, 141, 0xFF666666);
} else {
this.fontRendererObj.drawString(stackName, 10, 141, 0xFF666666);
this.fontRendererObj.drawString(position, 10, 153, 0xFF666666);
}
}
} else {
this.fontRendererObj.drawString("Right click a machine for info.", 10, 126, 0xFF666666);
}
}
项目:Backmemed
文件:BiomePlains.java
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
{
double d0 = GRASS_COLOR_NOISE.getValue((double)pos.getX() / 200.0D, (double)pos.getZ() / 200.0D);
if (d0 < -0.8D)
{
int j = rand.nextInt(4);
switch (j)
{
case 0:
return BlockFlower.EnumFlowerType.ORANGE_TULIP;
case 1:
return BlockFlower.EnumFlowerType.RED_TULIP;
case 2:
return BlockFlower.EnumFlowerType.PINK_TULIP;
case 3:
default:
return BlockFlower.EnumFlowerType.WHITE_TULIP;
}
}
else if (rand.nextInt(3) > 0)
{
int i = rand.nextInt(3);
return i == 0 ? BlockFlower.EnumFlowerType.POPPY : (i == 1 ? BlockFlower.EnumFlowerType.HOUSTONIA : BlockFlower.EnumFlowerType.OXEYE_DAISY);
}
else
{
return BlockFlower.EnumFlowerType.DANDELION;
}
}
项目:CustomWorldGen
文件:WorldEvent.java
public PotentialSpawns(World world, EnumCreatureType type, BlockPos pos, List<SpawnListEntry> oldList)
{
super(world);
this.pos = pos;
this.type = type;
if (oldList != null)
{
this.list = new ArrayList<SpawnListEntry>(oldList);
}
else
{
this.list = new ArrayList<SpawnListEntry>();
}
}
项目:Backmemed
文件:EntityWitherSkull.java
/**
* Explosion resistance of a block relative to this entity
*/
public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn)
{
float f = super.getExplosionResistance(explosionIn, worldIn, pos, blockStateIn);
Block block = blockStateIn.getBlock();
if (this.isInvulnerable() && EntityWither.canDestroyBlock(block))
{
f = Math.min(0.8F, f);
}
return f;
}
项目:Got-Wood
文件:BlockTreeTap.java
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, ItemStack stack) {
EnumFacing enumfacing = facing.getOpposite();
if(enumfacing == EnumFacing.DOWN || enumfacing == EnumFacing.UP) {
enumfacing = placer.getHorizontalFacing().getOpposite();
}
return this.getDefaultState().withProperty(FACING, enumfacing);
}
项目:Adventurers-Toolbox
文件:MessageExtraBlockBreak.java
public MessageExtraBlockBreak(int entityID, BlockPos[] positions, int progress) {
this.entityID = entityID;
this.numBlocks = positions.length;
this.progress = progress;
this.positions = new int[numBlocks][3];
for (int i = 0; i < numBlocks; i++) {
BlockPos pos = positions[i];
this.positions[i][0] = pos.getX();
this.positions[i][1] = pos.getY();
this.positions[i][2] = pos.getZ();
}
}
项目:Backmemed
文件:BlockLever.java
private boolean checkCanSurvive(World p_181091_1_, BlockPos p_181091_2_, IBlockState p_181091_3_)
{
if (this.canPlaceBlockAt(p_181091_1_, p_181091_2_))
{
return true;
}
else
{
this.dropBlockAsItem(p_181091_1_, p_181091_2_, p_181091_3_, 0);
p_181091_1_.setBlockToAir(p_181091_2_);
return false;
}
}
项目:PurificatiMagicae
文件:BlockAbstractWallIfTablet.java
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos)
{
EnumFacing face = state.getValue(HorizontalFacingController.FACING_H);
if (!canAttachToBlock(world, pos.offset(face.getOpposite()), face))
{
dropBlockAsItem(world, pos, state, 0);
world.setBlockToAir(pos);
}
}
项目:Wurst-MC-1.12
文件:ChestEspMod.java
public void closeChest(Container chest)
{
if(openChest == null)
return;
boolean empty = true;
for(int i = 0; i < chest.inventorySlots.size() - 36; i++)
if(!WItem.isNull(chest.inventorySlots.get(i).getStack()))
{
empty = false;
break;
}
BlockPos pos = openChest.getPos();
if(empty)
{
if(!emptyChests.contains(pos))
emptyChests.add(pos);
nonEmptyChests.remove(pos);
}else
{
if(!nonEmptyChests.contains(pos))
nonEmptyChests.add(pos);
emptyChests.remove(pos);
}
openChest = null;
}
项目:Machines-and-Stuff
文件:BlockBaseGenerator.java
public static void setState(boolean active, World worldIn, BlockPos pos) {
IBlockState iblockstate = worldIn.getBlockState(pos);
TileEntity tileentity = worldIn.getTileEntity(pos);
worldIn.setBlockState(pos, iblockstate.getBlock().getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)).withProperty(isActive, active), 3);
if(tileentity != null) {
tileentity.validate();
worldIn.setTileEntity(pos, tileentity);
PacketHandler.INSTANCE.sendToAllAround(new MessageGenerator(tileentity), new NetworkRegistry.TargetPoint(worldIn.provider.getDimension(), tileentity.getPos().getX(), tileentity.getPos().getY(), tileentity.getPos().getZ(), 128d));
}
}
项目:CustomWorldGen
文件:ForgeHooksClient.java
public static void orientBedCamera(IBlockAccess world, BlockPos pos, IBlockState state, Entity entity)
{
Block block = state.getBlock();
if (block != null && block.isBed(state, world, pos, entity))
{
glRotatef((float)(block.getBedDirection(state, world, pos).getHorizontalIndex() * 90), 0.0F, 1.0F, 0.0F);
}
}