use of net.minecraft.block.BlockAir in project pnc-repressurized by TeamPneumatic.
the class Itemss method registerItems.
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
IForgeRegistry<Item> registry = event.getRegistry();
registerItem(registry, new ItemGPSTool());
registerItem(registry, new ItemGPSAreaTool());
registerItem(registry, new ItemPneumatic("ingot_iron_compressed"));
registerItem(registry, new ItemPneumatic("pressure_gauge"));
registerItem(registry, new ItemPneumatic("stone_base"));
registerItem(registry, new ItemPneumatic("cannon_barrel"));
registerItem(registry, new ItemPneumatic("turbine_blade"));
registerItem(registry, new ItemPlastic());
registerItem(registry, new ItemPressurizable("air_canister", PneumaticValues.AIR_CANISTER_MAX_AIR, PneumaticValues.AIR_CANISTER_VOLUME));
registerItem(registry, new ItemVortexCannon());
registerItem(registry, new ItemPneumatic("pneumatic_cylinder"));
registerItem(registry, new ItemPneumaticArmor(ItemArmor.ArmorMaterial.IRON, PneumaticCraftRepressurized.proxy.getArmorRenderID(Textures.ARMOR_PNEUMATIC), EntityEquipmentSlot.HEAD, PneumaticValues.PNEUMATIC_HELMET_MAX_AIR));
registerItem(registry, new ItemManometer());
registerItem(registry, new ItemPneumatic("turbine_rotor"));
registerItem(registry, new ItemAssemblyProgram());
registerItem(registry, new ItemEmptyPCB());
registerItem(registry, new ItemNonDespawning("unassembled_pcb"));
registerItem(registry, new ItemPneumatic("pcb_blueprint"));
registerItem(registry, new ItemPneumatic("transistor"));
registerItem(registry, new ItemPneumatic("capacitor"));
registerItem(registry, new ItemPneumatic("printed_circuit_board"));
registerItem(registry, new ItemNonDespawning("failed_pcb"));
registerItem(registry, new ItemNetworkComponents());
registerItem(registry, new ItemPneumatic("stop_worm"));
registerItem(registry, new ItemPneumatic("nuke_virus"));
registerItem(registry, new ItemPneumatic("compressed_iron_gear"));
registerItem(registry, new ItemPneumaticWrench());
registerItem(registry, new ItemDrone());
registerItem(registry, new ItemProgrammingPuzzle());
registerItem(registry, new ItemPneumatic("advanced_pcb"));
registerItem(registry, new ItemRemote());
registerItem(registry, new ItemSeismicSensor());
registerItem(registry, new ItemLogisticsConfigurator());
registerItem(registry, new ItemLogisticsDrone());
registerItem(registry, new ItemGunAmmo());
registerItem(registry, new ItemAmadronTablet());
registerItem(registry, new ItemMinigun());
registerItem(registry, new ItemCamoApplicator());
registerUpgrades(registry);
for (Block b : Blockss.blocks) {
if (!(b instanceof BlockAir)) {
registerItem(registry, new ItemBlock(b).setRegistryName(b.getRegistryName()));
}
}
}
use of net.minecraft.block.BlockAir in project Galacticraft by micdoodle8.
the class EntityFXLaunchParticle method getCollidingBoundingBoxes.
/**
* Simplified for performance: no colliding boxes for entities (most/all of the entities will be other launch particles)
*/
public List<AxisAlignedBB> getCollidingBoundingBoxes(AxisAlignedBB bb) {
List<AxisAlignedBB> list = new LinkedList<>();
World w = this.world;
int xs = MathHelper.floor(bb.minX) - 1;
int xe = MathHelper.ceil(bb.maxX);
int ys = MathHelper.floor(bb.minY) - 1;
int ye = MathHelper.ceil(bb.maxY);
int zs = MathHelper.floor(bb.minZ) - 1;
int ze = MathHelper.ceil(bb.maxZ);
BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos();
IBlockState iblockstate1;
boolean xends, xzmiddle;
for (int x = xs; x <= xe; ++x) {
xends = (x == xs || x == xe);
for (int z = zs; z <= ze; ++z) {
if (xends) {
if (z == zs || z == ze)
continue;
xzmiddle = false;
} else {
xzmiddle = z > zs && z < ze;
}
if (w.isBlockLoaded(mutablePos.setPos(x, 64, z))) {
for (int y = ys; y <= ye; ++y) {
if (y != ys && y != ye || xzmiddle) {
mutablePos.setPos(x, y, z);
iblockstate1 = w.getBlockState(mutablePos);
if (!(iblockstate1.getBlock() instanceof BlockAir) && !(iblockstate1.getBlock() instanceof BlockGrating))
iblockstate1.addCollisionBoxToList(w, mutablePos, bb, list, null, false);
}
}
}
}
}
return list;
}
use of net.minecraft.block.BlockAir in project Galacticraft by micdoodle8.
the class EntityMeteor method onImpact.
protected void onImpact(RayTraceResult movingObjPos) {
if (!this.world.isRemote) {
this.world.newExplosion(this, this.posX, this.posY, this.posZ, this.size / 3 + 2, false, true);
if (movingObjPos != null) {
BlockPos pos = movingObjPos.getBlockPos();
if (pos == null) {
if (movingObjPos.entityHit != null) {
pos = this.world.getTopSolidOrLiquidBlock(movingObjPos.entityHit.getPosition());
} else {
pos = this.world.getTopSolidOrLiquidBlock(this.getPosition());
}
}
BlockPos above = pos.up();
if (this.world.getBlockState(above).getBlock() instanceof BlockAir) {
this.world.setBlockState(above, GCBlocks.fallenMeteor.getDefaultState(), 3);
}
if (movingObjPos.entityHit != null) {
movingObjPos.entityHit.attackEntityFrom(EntityMeteor.causeMeteorDamage(this, this.shootingEntity), ConfigManagerCore.hardMode ? 12F : 6F);
}
}
}
this.setDead();
}
use of net.minecraft.block.BlockAir in project Galacticraft by micdoodle8.
the class TickHandlerServer method onWorldTick.
@SubscribeEvent
public void onWorldTick(WorldTickEvent event) {
if (event.phase == Phase.START) {
final WorldServer world = (WorldServer) event.world;
CopyOnWriteArrayList<ScheduledBlockChange> changeList = TickHandlerServer.scheduledBlockChanges.get(GCCoreUtil.getDimensionID(world));
if (changeList != null && !changeList.isEmpty()) {
int blockCount = 0;
int blockCountMax = Math.max(this.MAX_BLOCKS_PER_TICK, changeList.size() / 4);
List<ScheduledBlockChange> newList = new ArrayList<ScheduledBlockChange>(Math.max(0, changeList.size() - blockCountMax));
for (ScheduledBlockChange change : changeList) {
if (++blockCount > blockCountMax) {
newList.add(change);
} else {
if (change != null) {
BlockPos changePosition = change.getChangePosition();
Block block = world.getBlockState(changePosition).getBlock();
// Only replace blocks of type BlockAir or fire - this is to prevent accidents where other mods have moved blocks
if (changePosition != null && (block instanceof BlockAir || block == Blocks.FIRE)) {
world.setBlockState(changePosition, change.getChangeState(), change.getChangeUpdateFlag());
}
}
}
}
changeList.clear();
TickHandlerServer.scheduledBlockChanges.remove(GCCoreUtil.getDimensionID(world));
if (newList.size() > 0) {
TickHandlerServer.scheduledBlockChanges.put(GCCoreUtil.getDimensionID(world), new CopyOnWriteArrayList<ScheduledBlockChange>(newList));
}
}
CopyOnWriteArrayList<BlockVec3> torchList = TickHandlerServer.scheduledTorchUpdates.get(GCCoreUtil.getDimensionID(world));
if (torchList != null && !torchList.isEmpty()) {
for (BlockVec3 torch : torchList) {
if (torch != null) {
BlockPos pos = new BlockPos(torch.x, torch.y, torch.z);
Block b = world.getBlockState(pos).getBlock();
if (b instanceof BlockUnlitTorch) {
world.scheduleUpdate(pos, b, 2 + world.rand.nextInt(30));
}
}
}
torchList.clear();
TickHandlerServer.scheduledTorchUpdates.remove(GCCoreUtil.getDimensionID(world));
}
if (world.provider instanceof IOrbitDimension) {
try {
int dim = ((IOrbitDimension) world.provider).getPlanetIdToOrbit();
if (dim == Integer.MIN_VALUE)
dim = GCCoreUtil.getDimensionID(WorldUtil.getProviderForNameServer(((IOrbitDimension) world.provider).getPlanetToOrbit()));
int minY = ((IOrbitDimension) world.provider).getYCoordToTeleportToPlanet();
final Entity[] entityList = world.loadedEntityList.toArray(new Entity[world.loadedEntityList.size()]);
for (final Entity e : entityList) {
if (e.posY <= minY && e.world == world) {
WorldUtil.transferEntityToDimension(e, dim, world, false, null);
}
}
} catch (Exception ex) {
}
}
int dimensionID = GCCoreUtil.getDimensionID(world);
if (worldsNeedingUpdate.contains(dimensionID)) {
worldsNeedingUpdate.remove(dimensionID);
for (Object obj : event.world.loadedTileEntityList) {
TileEntity tile = (TileEntity) obj;
if (tile instanceof TileEntityFluidTank) {
((TileEntityFluidTank) tile).updateClient = true;
}
}
}
} else if (event.phase == Phase.END) {
final WorldServer world = (WorldServer) event.world;
for (GalacticraftPacketHandler handler : packetHandlers) {
handler.tick(world);
}
int dimID = GCCoreUtil.getDimensionID(world);
Set<BlockPos> edgesList = TickHandlerServer.edgeChecks.get(dimID);
final HashSet<BlockPos> checkedThisTick = new HashSet<>();
if (edgesList != null && !edgesList.isEmpty()) {
List<BlockPos> edgesListCopy = new ArrayList<>();
edgesListCopy.addAll(edgesList);
for (BlockPos edgeBlock : edgesListCopy) {
if (edgeBlock != null && !checkedThisTick.contains(edgeBlock)) {
if (TickHandlerServer.scheduledForChange(dimID, edgeBlock)) {
continue;
}
ThreadFindSeal done = new ThreadFindSeal(world, edgeBlock, 0, new ArrayList<TileEntityOxygenSealer>());
checkedThisTick.addAll(done.checkedAll());
}
}
TickHandlerServer.edgeChecks.remove(GCCoreUtil.getDimensionID(world));
}
}
}
use of net.minecraft.block.BlockAir in project Galacticraft by micdoodle8.
the class TileEntityEmergencyBox method update.
@Override
public void update() {
if (!this.activated) {
this.activated = true;
this.setLightBlocks();
this.thisVec3 = new Vec3d(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
this.vec3Centre = new Vec3d(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D);
this.mobsAABB = new AxisAlignedBB(this.pos.getX() - 14, this.pos.getY() - 7, this.pos.getZ() - 14, this.pos.getX() + 14, this.pos.getY() + 7, this.pos.getZ() + 14);
}
if (this.world.isRemote) {
if (this.openN && this.angleA < 90F) {
this.lastAngleA = this.angleA;
this.angleA += SPEED;
if (this.angleA > 90F)
this.angleA = 90F;
}
if (this.openW && this.angleB < 90F) {
this.lastAngleB = this.angleB;
this.angleB += SPEED;
if (this.angleB > 90F)
this.angleB = 90F;
}
if (this.openS && this.angleC < 90F) {
this.lastAngleC = this.angleC;
this.angleC += SPEED;
if (this.angleC > 90F)
this.angleC = 90F;
}
if (this.openE && this.angleD < 90F) {
this.lastAngleD = this.angleD;
this.angleD += SPEED;
if (this.angleD > 90F)
this.angleD = 90F;
}
if (!this.openN && this.angleA > 0F) {
this.lastAngleA = this.angleA;
this.angleA -= SPEED;
if (this.angleA < 0F)
this.angleA = 0F;
}
if (!this.openW && this.angleB > 0F) {
this.lastAngleB = this.angleB;
this.angleB -= SPEED;
if (this.angleB < 0F)
this.angleB = 0F;
}
if (!this.openS && this.angleC > 0F) {
this.lastAngleC = this.angleC;
this.angleC -= SPEED;
if (this.angleC < 0F)
this.angleC = 0F;
}
if (!this.openE && this.angleD > 0F) {
this.lastAngleD = this.angleD;
this.angleD -= SPEED;
if (this.angleD < 0F)
this.angleD = 0F;
}
} else {
if (this.cooldown > 0) {
this.cooldown--;
}
boolean updateRequired = false;
if (this.openN) {
boolean clash = false;
BlockPos testPos = this.pos.north(1);
IBlockState bs = this.world.getBlockState(testPos);
if (!(bs.getBlock() instanceof BlockAir)) {
if (bs.isFullBlock()) {
clash = true;
} else {
AxisAlignedBB check = new AxisAlignedBB(0.125D, 0.125D, 11 / 16D, 0.875D, 0.875D, 1D);
AxisAlignedBB neighbour = bs.getCollisionBoundingBox(this.world, testPos);
if (neighbour != null) {
clash = check.intersects(neighbour);
}
}
}
if (clash) {
this.openN = false;
updateRequired = true;
}
}
if (this.openS) {
boolean clash = false;
BlockPos testPos = this.pos.south(1);
IBlockState bs = this.world.getBlockState(testPos);
if (!(bs.getBlock() instanceof BlockAir)) {
if (bs.isFullBlock()) {
clash = true;
} else {
AxisAlignedBB check = new AxisAlignedBB(0.125D, 0.125D, 0D, 0.875D, 0.875D, 5 / 16D);
AxisAlignedBB neighbour = bs.getCollisionBoundingBox(this.world, testPos);
if (neighbour != null) {
clash = check.intersects(neighbour);
}
}
}
if (clash) {
this.openS = false;
updateRequired = true;
}
}
if (this.openW) {
boolean clash = false;
BlockPos testPos = this.pos.west(1);
IBlockState bs = this.world.getBlockState(testPos);
if (!(bs.getBlock() instanceof BlockAir)) {
if (bs.isFullBlock()) {
clash = true;
} else {
AxisAlignedBB check = new AxisAlignedBB(11 / 16D, 0.125D, 0.125D, 1D, 0.875D, 0.875D);
AxisAlignedBB neighbour = bs.getCollisionBoundingBox(this.world, testPos);
if (neighbour != null) {
clash = check.intersects(neighbour);
}
}
}
if (clash) {
this.openW = false;
updateRequired = true;
}
}
if (this.openE) {
boolean clash = false;
BlockPos testPos = this.pos.east(1);
IBlockState bs = this.world.getBlockState(testPos);
if (!(bs.getBlock() instanceof BlockAir)) {
if (bs.isFullBlock()) {
clash = true;
} else {
AxisAlignedBB check = new AxisAlignedBB(0D, 0.125D, 0.125D, 5 / 16D, 0.875D, 0.875D);
AxisAlignedBB neighbour = bs.getCollisionBoundingBox(this.world, testPos);
if (neighbour != null) {
clash = check.intersects(neighbour);
}
}
}
if (clash) {
this.openE = false;
updateRequired = true;
}
}
if (updateRequired) {
this.updateClients();
}
if (this.world.rand.nextInt(15) == 0) {
this.scareMobs();
}
}
}
Aggregations