mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
ignore dipole coil penalties unless redirecting particle
This commit is contained in:
parent
2b37164ed6
commit
e1dd8c80b4
@ -66,12 +66,15 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
|||||||
@Override
|
@Override
|
||||||
public void onEnter(Particle particle, ForgeDirection dir) {
|
public void onEnter(Particle particle, ForgeDirection dir) {
|
||||||
EnumCoilType type = null;
|
EnumCoilType type = null;
|
||||||
|
boolean isInline = dir.equals(getExitDir(particle));
|
||||||
|
|
||||||
int mult = 1;
|
int mult = 1;
|
||||||
if(slots[1] != null && slots[1].getItem() == ModItems.pa_coil) {
|
if(slots[1] != null && slots[1].getItem() == ModItems.pa_coil) {
|
||||||
type = EnumUtil.grabEnumSafely(EnumCoilType.class, slots[1].getItemDamage());
|
type = EnumUtil.grabEnumSafely(EnumCoilType.class, slots[1].getItemDamage());
|
||||||
|
|
||||||
if(type.diMin > particle.momentum) mult *= 10;
|
if(type.diMin > particle.momentum) mult *= 10;
|
||||||
if(type.diDistMin > particle.distanceTraveled) mult *= 10;
|
if(type.diDistMin > particle.distanceTraveled) mult *= 10;
|
||||||
|
if(isInline) mult = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isCool()) particle.crash(PAState.CRASH_NOCOOL);
|
if(!isCool()) particle.crash(PAState.CRASH_NOCOOL);
|
||||||
@ -81,20 +84,26 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
|||||||
|
|
||||||
if(particle.invalid) return;
|
if(particle.invalid) return;
|
||||||
|
|
||||||
particle.resetDistance();
|
if (isInline) {
|
||||||
|
particle.addDistance(3);
|
||||||
|
} else {
|
||||||
|
particle.resetDistance();
|
||||||
|
}
|
||||||
|
|
||||||
this.power -= this.usage * mult;
|
this.power -= this.usage * mult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPos getExitPos(Particle particle) {
|
public BlockPos getExitPos(Particle particle) {
|
||||||
if(particle.momentum >= this.threshold) {
|
particle.dir = getExitDir(particle);
|
||||||
ForgeDirection dir = this.ditToForgeDir(checkRedstone() ? dirRedstone : dirUpper);
|
return new BlockPos(xCoord, yCoord, zCoord).offset(particle.dir, 2);
|
||||||
particle.dir = dir;
|
}
|
||||||
return new BlockPos(xCoord, yCoord, zCoord).offset(dir, 2);
|
|
||||||
}
|
public ForgeDirection getExitDir(Particle particle) {
|
||||||
ForgeDirection dir = this.ditToForgeDir(dirLower);
|
int dit = particle.momentum < this.threshold
|
||||||
particle.dir = dir;
|
? dirLower : checkRedstone()
|
||||||
return new BlockPos(xCoord, yCoord, zCoord).offset(dir, 2);
|
? dirRedstone : dirUpper;
|
||||||
|
return ditToForgeDir(dit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkRedstone() {
|
public boolean checkRedstone() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user