本文整理汇总了Java中erogenousbeef.core.common.CoordTriplet类的典型用法代码示例。如果您正苦于以下问题:Java CoordTriplet类的具体用法?Java CoordTriplet怎么用?Java CoordTriplet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CoordTriplet类属于erogenousbeef.core.common包,在下文中一共展示了CoordTriplet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: markReferenceCoordDirty
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
protected void markReferenceCoordDirty() {
if (worldObj == null || worldObj.isRemote) {
return;
}
CoordTriplet referenceCoord = getReferenceCoord();
if (referenceCoord == null) {
return;
}
rpmUpdateTracker.onExternalUpdate();
TileEntity saveTe = worldObj.getTileEntity(referenceCoord.x, referenceCoord.y, referenceCoord.z);
worldObj.markTileEntityChunkModified(referenceCoord.x, referenceCoord.y, referenceCoord.z, saveTe);
worldObj.markBlockForUpdate(referenceCoord.x, referenceCoord.y, referenceCoord.z);
}
示例2: onPartAdded
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
/**
* Called when a multiblock part is added to the world, either via chunk-load or user action.
* If its chunk is loaded, it will be processed during the next tick.
* If the chunk is not loaded, it will be added to a list of objects waiting for a chunkload.
* @param part The part which is being added to this world.
*/
public void onPartAdded(IMultiblockPart part) {
CoordTriplet worldLocation = part.getWorldLocation();
if(!worldObj.getChunkProvider().chunkExists(worldLocation.getChunkX(), worldLocation.getChunkZ())) {
// Part goes into the waiting-for-chunk-load list
Set<IMultiblockPart> partSet;
long chunkHash = worldLocation.getChunkXZHash();
synchronized(partsAwaitingChunkLoadMutex) {
if(!partsAwaitingChunkLoad.containsKey(chunkHash)) {
partSet = new HashSet<IMultiblockPart>();
partsAwaitingChunkLoad.put(chunkHash, partSet);
}
else {
partSet = partsAwaitingChunkLoad.get(chunkHash);
}
partSet.add(part);
}
}
else {
// Part goes into the orphan queue, to be checked this tick
addOrphanedPartThreadsafe(part);
}
}
示例3: assimilate
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
/**
* Assimilate another controller into this controller.
* Acquire all of the other controller's blocks and attach them
* to this one.
*
* @param other The controller to merge into this one.
*/
public void assimilate(MultiblockControllerBase other) {
CoordTriplet otherReferenceCoord = other.getReferenceCoord();
if(otherReferenceCoord != null && getReferenceCoord().compareTo(otherReferenceCoord) >= 0) {
throw new IllegalArgumentException("The controller with the lowest minimum-coord value must consume the one with the higher coords");
}
TileEntity te;
Set<IMultiblockPart> partsToAcquire = new HashSet<IMultiblockPart>(other.connectedParts);
// releases all blocks and references gently so they can be incorporated into another multiblock
other._onAssimilated(this);
for(IMultiblockPart acquiredPart : partsToAcquire) {
// By definition, none of these can be the minimum block.
if(acquiredPart.isInvalid()) { continue; }
connectedParts.add(acquiredPart);
acquiredPart.onAssimilated(this);
this.onBlockAdded(acquiredPart);
}
this.onAssimilate(other);
other.onAssimilated(this);
}
示例4: getControlRodLocations
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
public CoordTriplet[] getControlRodLocations() {
CoordTriplet[] coords = new CoordTriplet[this.attachedControlRods.size()];
int i = 0;
for (TileEntityReactorControlRod cr : attachedControlRods) {
coords[i++] = cr.getWorldLocation();
}
return coords;
}
示例5: calculateReactorVolume
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
protected void calculateReactorVolume() {
CoordTriplet minInteriorCoord = minCoord.copy();
minInteriorCoord.x += 1;
minInteriorCoord.y += 1;
minInteriorCoord.z += 1;
CoordTriplet maxInteriorCoord = maxCoord.copy();
maxInteriorCoord.x -= 1;
maxInteriorCoord.y -= 1;
maxInteriorCoord.z -= 1;
reactorVolume = StaticUtils.ExtraMath.Volume(minInteriorCoord, maxInteriorCoord);
}
示例6: MultiblockTurbineSimulator
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
public MultiblockTurbineSimulator(World world) {
super(world);
updatePlayers = new HashSet<EntityPlayer>();
ticksSinceLastUpdate = 0;
tanks = new FluidTank[NUM_TANKS];
for (int i = 0; i < NUM_TANKS; i++) {
tanks[i] = new FluidTank(TANK_SIZE);
}
attachedControllers = new HashSet<IMultiblockPart>();
attachedRotorBearings = new HashSet<TileEntityTurbineRotorBearing>();
attachedPowerTaps = new HashSet<TileEntityTurbinePowerTap>();
attachedTickables = new HashSet<ITickableMultiblockPart>();
attachedRotorShafts = new HashSet<TileEntityTurbineRotorPart>();
attachedRotorBlades = new HashSet<TileEntityTurbineRotorPart>();
attachedGlass = new HashSet<TileEntityTurbinePartGlass>();
energyStored = 0f;
active = false;
inductorEngaged = true;
ventStatus = VentStatus.VentOverflow;
rotorEnergy = 0f;
maxIntakeRate = MAX_PERMITTED_FLOW;
bladeSurfaceArea = 0;
rotorMass = 0;
coilSize = 0;
energyGeneratedLastTick = 0f;
fluidConsumedLastTick = 0;
rotorEfficiencyLastTick = 1f;
foundCoils = new HashSet<CoordTriplet>();
rpmUpdateTracker = new FloatUpdateTracker(100, 5, 10f, 100f); // Minimum 10RPM difference for slow updates, if change > 100 RPM, update every 5 ticks
}
示例7: onMachineAssembled
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
@Override
public void onMachineAssembled(MultiblockControllerBase controller) {
CoordTriplet maxCoord = controller.getMaximumCoord();
CoordTriplet minCoord = controller.getMinimumCoord();
// Discover where I am on the reactor
recalculateOutwardsDirection(minCoord, maxCoord);
}
示例8: recalculateOutwardsDirection
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
public void recalculateOutwardsDirection(CoordTriplet minCoord, CoordTriplet maxCoord) {
outwards = ForgeDirection.UNKNOWN;
position = PartPosition.Unknown;
int facesMatching = 0;
if(maxCoord.x == this.xCoord || minCoord.x == this.xCoord) { facesMatching++; }
if(maxCoord.y == this.yCoord || minCoord.y == this.yCoord) { facesMatching++; }
if(maxCoord.z == this.zCoord || minCoord.z == this.zCoord) { facesMatching++; }
if(facesMatching <= 0) { position = PartPosition.Interior; }
else if(facesMatching >= 3) { position = PartPosition.FrameCorner; }
else if(facesMatching == 2) { position = PartPosition.Frame; }
else {
// 1 face matches
if(maxCoord.x == this.xCoord) {
position = PartPosition.EastFace;
outwards = ForgeDirection.EAST;
}
else if(minCoord.x == this.xCoord) {
position = PartPosition.WestFace;
outwards = ForgeDirection.WEST;
}
else if(maxCoord.z == this.zCoord) {
position = PartPosition.SouthFace;
outwards = ForgeDirection.SOUTH;
}
else if(minCoord.z == this.zCoord) {
position = PartPosition.NorthFace;
outwards = ForgeDirection.NORTH;
}
else if(maxCoord.y == this.yCoord) {
position = PartPosition.TopFace;
outwards = ForgeDirection.UP;
}
else {
position = PartPosition.BottomFace;
outwards = ForgeDirection.DOWN;
}
}
}
示例9: onPartRemovedFromWorld
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
/**
* Called when a part is removed from the world, via user action or via chunk unloads.
* This part is removed from any lists in which it may be, and its machine is marked for recalculation.
* @param part The part which is being removed.
*/
public void onPartRemovedFromWorld(IMultiblockPart part) {
CoordTriplet coord = part.getWorldLocation();
if(coord != null) {
long hash = coord.getChunkXZHash();
if(partsAwaitingChunkLoad.containsKey(hash)) {
synchronized(partsAwaitingChunkLoadMutex) {
if(partsAwaitingChunkLoad.containsKey(hash)) {
partsAwaitingChunkLoad.get(hash).remove(part);
if(partsAwaitingChunkLoad.get(hash).size() <= 0) {
partsAwaitingChunkLoad.remove(hash);
}
}
}
}
}
detachedParts.remove(part);
if(orphanedParts.contains(part)) {
synchronized(orphanedPartsMutex) {
orphanedParts.remove(part);
}
}
part.assertDetached();
}
示例10: recalculateMinMaxCoords
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
/**
* Force this multiblock to recalculate its minimum and maximum coordinates
* from the list of connected parts.
*/
public void recalculateMinMaxCoords() {
minimumCoord = new CoordTriplet(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
maximumCoord = new CoordTriplet(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
for(IMultiblockPart part : connectedParts) {
if(part.xCoord < minimumCoord.x) { minimumCoord.x = part.xCoord; }
if(part.xCoord > maximumCoord.x) { maximumCoord.x = part.xCoord; }
if(part.yCoord < minimumCoord.y) { minimumCoord.y = part.yCoord; }
if(part.yCoord > maximumCoord.y) { maximumCoord.y = part.yCoord; }
if(part.zCoord < minimumCoord.z) { minimumCoord.z = part.zCoord; }
if(part.zCoord > maximumCoord.z) { maximumCoord.z = part.zCoord; }
}
}
示例11: _shouldConsume
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
private int _shouldConsume(MultiblockControllerBase otherController) {
CoordTriplet myCoord = getReferenceCoord();
CoordTriplet theirCoord = otherController.getReferenceCoord();
// Always consume other controllers if their reference coordinate is null - this means they're empty and can be assimilated on the cheap
if(theirCoord == null) { return -1; }
else { return myCoord.compareTo(theirCoord); }
}
示例12: getNeighboringParts
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
@Override
public IMultiblockPart[] getNeighboringParts() {
CoordTriplet[] neighbors = new CoordTriplet[] {
new CoordTriplet(this.xCoord-1, this.yCoord, this.zCoord),
new CoordTriplet(this.xCoord, this.yCoord-1, this.zCoord),
new CoordTriplet(this.xCoord, this.yCoord, this.zCoord-1),
new CoordTriplet(this.xCoord, this.yCoord, this.zCoord+1),
new CoordTriplet(this.xCoord, this.yCoord+1, this.zCoord),
new CoordTriplet(this.xCoord+1, this.yCoord, this.zCoord)
};
TileEntity te;
List<IMultiblockPart> neighborParts = new ArrayList<IMultiblockPart>();
IChunkProvider chunkProvider = worldObj.getChunkProvider();
for(CoordTriplet neighbor : neighbors) {
if(!chunkProvider.chunkExists(neighbor.getChunkX(), neighbor.getChunkZ())) {
// Chunk not loaded, skip it.
continue;
}
te = this.worldObj.getTileEntity(neighbor.x, neighbor.y, neighbor.z);
if(te instanceof IMultiblockPart) {
neighborParts.add((IMultiblockPart)te);
}
}
IMultiblockPart[] tmp = new IMultiblockPart[neighborParts.size()];
return neighborParts.toArray(tmp);
}
示例13: radiate
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
public RadiationData radiate(IFakeReactorWorld world, FuelContainer fuelContainer, TileEntityReactorFuelRodSimulator source, TileEntityReactorControlRod controlRod, float fuelHeat, float environmentHeat, int numControlRods, MultiblockReactorSimulator simulator) {
// No fuel? No radiation!
if (fuelContainer.getFuelAmount() <= 0) {
return null;
}
// Determine radiation amount & intensity, heat amount, determine fuel usage
RadiationData data = new RadiationData();
data.fuelAbsorbedRadiation = 0f;
// Base value for radiation production penalties. 0-1, caps at about 3000C;
double radiationPenaltyBase = Math.exp(-15 * Math.exp(-0.0025 * fuelHeat));
// Raw amount - what's actually in the tanks
// Effective amount - how
int baseFuelAmount = fuelContainer.getFuelAmount() + (fuelContainer.getWasteAmount() / 100);
float fuelReactivity = fuelContainer.getFuelReactivity();
// Intensity = how strong the radiation is, hardness = how energetic the radiation is (penetration)
float rawRadIntensity = (float)baseFuelAmount * fissionEventsPerFuelUnit;
// Scale up the "effective" intensity of radiation, to provide an incentive for bigger reactors in general.
float scaledRadIntensity = (float)Math.pow((rawRadIntensity), fuelReactivity);
// Scale up a second time based on scaled amount in each fuel rod. Provides an incentive for making reactors that aren't just pancakes.
scaledRadIntensity = (float)Math.pow((scaledRadIntensity / numControlRods), fuelReactivity) * numControlRods;
// Apply control rod moderation of radiation to the quantity of produced radiation. 100% insertion = 100% reduction.
float controlRodModifier = (float)(100 - controlRod.getControlRodInsertion()) / 100f;
scaledRadIntensity = scaledRadIntensity * controlRodModifier;
rawRadIntensity = rawRadIntensity * controlRodModifier;
// Now nerf actual radiation production based on heat.
float effectiveRadIntensity = scaledRadIntensity * (1f + (float)(-0.95f * Math.exp(-10f * Math.exp(-0.0012f * fuelHeat))));
// Radiation hardness starts at 20% and asymptotically approaches 100% as heat rises.
// This will make radiation harder and harder to capture.
float radHardness = 0.2f + (float)(0.8 * radiationPenaltyBase);
// Calculate based on propagation-to-self
float rawFuelUsage = (fuelPerRadiationUnit * rawRadIntensity / getFertilityModifier()) * BigReactors.fuelUsageMultiplier; // Not a typo. Fuel usage is thus penalized at high heats.
data.fuelRfChange = rfPerRadiationUnit * effectiveRadIntensity;
data.environmentRfChange = 0f;
// Propagate radiation to others
CoordTriplet originCoord = source.getWorldLocation();
CoordTriplet currentCoord = new CoordTriplet(0, 0, 0);
effectiveRadIntensity *= 0.25f; // We're going to do this four times, no need to repeat
RadiationPacket radPacket = new RadiationPacket();
for (ForgeDirection dir : StaticUtils.CardinalDirections) {
radPacket.hardness = radHardness;
radPacket.intensity = effectiveRadIntensity;
int ttl = 4;
currentCoord.copy(originCoord);
while (ttl > 0 && radPacket.intensity > 0.0001f) {
ttl--;
currentCoord.translate(dir);
performIrradiation(world, simulator,data, radPacket, currentCoord.x, currentCoord.y, currentCoord.z);
}
}
// Apply changes
fertility += data.fuelAbsorbedRadiation;
data.fuelAbsorbedRadiation = 0f;
// Inform fuelContainer
fuelContainer.onRadiationUsesFuel(rawFuelUsage);
data.fuelUsage = rawFuelUsage;
return data;
}
示例14: FakeReactorWorld
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
public FakeReactorWorld(int x, int y, int z, short controlRodInsertion) {
this.controlRodInsertion = controlRodInsertion;
this.maxDims = new CoordTriplet(x - 1, z - 1, y - 1);
}
示例15: getMaxCoord
import erogenousbeef.core.common.CoordTriplet; //导入依赖的package包/类
@Override
public CoordTriplet getMaxCoord() {
return maxDims;
}