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