mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 00:16:27 +01:00
fixes now for 1.16.3
This commit is contained in:
commit
299663295c
5 changed files with 52 additions and 14 deletions
|
@ -63,14 +63,14 @@ public class AirCurrent {
|
|||
public void tick() {
|
||||
if (direction == null)
|
||||
rebuild();
|
||||
World world = source.getWorld();
|
||||
World world = source.getAirCurrentWorld();
|
||||
Direction facing = direction;
|
||||
if (world != null && world.isRemote) {
|
||||
float offset = pushing ? 0.5f : maxDistance + .5f;
|
||||
Vector3d pos = VecHelper.getCenterOf(source.getPos())
|
||||
Vector3d pos = VecHelper.getCenterOf(source.getAirCurrentPos())
|
||||
.add(Vector3d.of(facing.getDirectionVec()).scale(offset));
|
||||
if (world.rand.nextFloat() < AllConfigs.CLIENT.fanParticleDensity.get())
|
||||
world.addParticle(new AirFlowParticleData(source.getPos()), pos.x, pos.y, pos.z, 0, 0, 0);
|
||||
world.addParticle(new AirFlowParticleData(source.getAirCurrentPos()), pos.x, pos.y, pos.z, 0, 0, 0);
|
||||
}
|
||||
|
||||
for (Iterator<Entity> iterator = caughtEntities.iterator(); iterator.hasNext();) {
|
||||
|
@ -81,7 +81,7 @@ public class AirCurrent {
|
|||
continue;
|
||||
}
|
||||
|
||||
Vector3d center = VecHelper.getCenterOf(source.getPos());
|
||||
Vector3d center = VecHelper.getCenterOf(source.getAirCurrentPos());
|
||||
Vector3i flow = (pushing ? facing : facing.getOpposite()).getDirectionVec();
|
||||
|
||||
float sneakModifier = entity.isSneaking() ? 4096f : 512f;
|
||||
|
@ -165,8 +165,8 @@ public class AirCurrent {
|
|||
pushing = source.getAirFlowDirection() == direction;
|
||||
maxDistance = source.getMaxDistance();
|
||||
|
||||
World world = source.getWorld();
|
||||
BlockPos start = source.getPos();
|
||||
World world = source.getAirCurrentWorld();
|
||||
BlockPos start = source.getAirCurrentPos();
|
||||
float max = this.maxDistance;
|
||||
Direction facing = direction;
|
||||
Vector3d directionVec = Vector3d.of(facing.getDirectionVec());
|
||||
|
@ -269,13 +269,13 @@ public class AirCurrent {
|
|||
|
||||
public void findEntities() {
|
||||
caughtEntities.clear();
|
||||
caughtEntities = source.getWorld()
|
||||
caughtEntities = source.getAirCurrentWorld()
|
||||
.getEntitiesWithinAABBExcludingEntity(null, bounds);
|
||||
}
|
||||
|
||||
public void findAffectedHandlers() {
|
||||
World world = source.getWorld();
|
||||
BlockPos start = source.getPos();
|
||||
World world = source.getAirCurrentWorld();
|
||||
BlockPos start = source.getAirCurrentPos();
|
||||
affectedItemHandlers.clear();
|
||||
for (int i = 0; i < maxDistance + 1; i++) {
|
||||
Type type = getSegmentAt(i);
|
||||
|
|
|
@ -14,6 +14,11 @@ import net.minecraft.state.properties.BlockStateProperties;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
@MethodsReturnNonnullByDefault
|
||||
public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements IAirCurrentSource {
|
||||
|
@ -94,6 +99,17 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
|
|||
return airCurrent;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public World getAirCurrentWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getAirCurrentPos() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Direction getAirflowOriginSide() {
|
||||
return this.getBlockState()
|
||||
|
@ -110,6 +126,11 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
|
|||
return speed > 0 ? facing : facing.getOpposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSourceRemoved() {
|
||||
return removed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeedChanged(float prevSpeed) {
|
||||
super.onSpeedChanged(prevSpeed);
|
||||
|
|
|
@ -16,9 +16,9 @@ public interface IAirCurrentSource {
|
|||
AirCurrent getAirCurrent();
|
||||
|
||||
@Nullable
|
||||
World getWorld();
|
||||
World getAirCurrentWorld();
|
||||
|
||||
BlockPos getPos();
|
||||
BlockPos getAirCurrentPos();
|
||||
|
||||
float getSpeed();
|
||||
|
||||
|
@ -36,5 +36,5 @@ public interface IAirCurrentSource {
|
|||
return this.getSpeed() > 0 ? pushDistance : pullDistance;
|
||||
}
|
||||
|
||||
boolean isRemoved();
|
||||
boolean isSourceRemoved();
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (source == null || source.isRemoved()) {
|
||||
if (source == null || source.isSourceRemoved()) {
|
||||
dissipate();
|
||||
return;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
|
|||
if (!source.getAirCurrent().pushing)
|
||||
motion = motion.scale(-1);
|
||||
|
||||
double distance = new Vector3d(posX, posY, posZ).subtract(VecHelper.getCenterOf(source.getPos()))
|
||||
double distance = new Vector3d(posX, posY, posZ).subtract(VecHelper.getCenterOf(source.getAirCurrentPos()))
|
||||
.mul(directionVec).length() - .5f;
|
||||
if (distance > source.getAirCurrent().maxDistance + 1 || distance < -.25f) {
|
||||
dissipate();
|
||||
|
|
|
@ -42,6 +42,7 @@ import net.minecraft.util.math.vector.Vector3d;
|
|||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
|
@ -689,6 +690,17 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
return airCurrent;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public World getAirCurrentWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getAirCurrentPos() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeed() {
|
||||
if (getBlockState().get(ChuteBlock.SHAPE) == Shape.NORMAL && getBlockState().get(ChuteBlock.FACING) != Direction.DOWN)
|
||||
|
@ -705,6 +717,11 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
return speed > 0 ? Direction.UP : Direction.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSourceRemoved() {
|
||||
return removed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Direction getAirflowOriginSide() {
|
||||
return world != null && !(world.getTileEntity(pos.down()) instanceof IAirCurrentSource)
|
||||
|
|
Loading…
Reference in a new issue