Fixed AABB
usage
This commit is contained in:
parent
5a2513d0a9
commit
95a1a21f04
3 changed files with 19 additions and 9 deletions
|
@ -72,7 +72,11 @@ public class BlockEntityHydrothermalVent extends BlockEntity {
|
||||||
boolean active = state.getValue(HydrothermalVentBlock.ACTIVATED);
|
boolean active = state.getValue(HydrothermalVentBlock.ACTIVATED);
|
||||||
POS.set(worldPosition).move(Direction.UP);
|
POS.set(worldPosition).move(Direction.UP);
|
||||||
int height = active ? 85 : 25;
|
int height = active ? 85 : 25;
|
||||||
AABB box = new AABB(POS.offset(-1, 0, -1), POS.offset(1, height, 1));
|
AABB box = new AABB(
|
||||||
|
new Vec3(POS.getX() - 1, POS.getY(), POS.getZ() - 1),
|
||||||
|
new Vec3(POS.getX() + 1, POS.getY() + height, POS.getZ() + 1)
|
||||||
|
);
|
||||||
|
|
||||||
List<LivingEntity> entities = level.getEntitiesOfClass(LivingEntity.class, box);
|
List<LivingEntity> entities = level.getEntitiesOfClass(LivingEntity.class, box);
|
||||||
if (entities.size() > 0) {
|
if (entities.size() > 0) {
|
||||||
while (POS.getY() < box.maxY) {
|
while (POS.getY() < box.maxY) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.world.level.block.state.pattern.BlockPattern;
|
||||||
import net.minecraft.world.level.dimension.end.DragonRespawnAnimation;
|
import net.minecraft.world.level.dimension.end.DragonRespawnAnimation;
|
||||||
import net.minecraft.world.level.dimension.end.EndDragonFight;
|
import net.minecraft.world.level.dimension.end.EndDragonFight;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -72,7 +73,10 @@ public class EndDragonFightMixin {
|
||||||
BlockPos central = BlockPos.ZERO.relative(dir, 4);
|
BlockPos central = BlockPos.ZERO.relative(dir, 4);
|
||||||
List<EndCrystal> crystalList = level.getEntitiesOfClass(
|
List<EndCrystal> crystalList = level.getEntitiesOfClass(
|
||||||
EndCrystal.class,
|
EndCrystal.class,
|
||||||
new AABB(central.below(255).south().west(), central.above(255).north().east())
|
new AABB(
|
||||||
|
new Vec3(central.getX() - 1, central.getY() - 255, central.getZ() + 1),
|
||||||
|
new Vec3(central.getX() - 1, central.getY() + 255, central.getZ() + 1)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
int count = crystalList.size();
|
int count = crystalList.size();
|
||||||
|
|
|
@ -17,10 +17,12 @@ import net.minecraft.tags.BlockTags;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.util.RandomSource;
|
import net.minecraft.util.RandomSource;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
|
@ -76,8 +78,8 @@ public class HelixTreeFeature extends DefaultFeature {
|
||||||
world,
|
world,
|
||||||
pos,
|
pos,
|
||||||
new AABB(
|
new AABB(
|
||||||
pos.offset((int) -dx, (int) dy1, (int) -dx),
|
new Vec3(pos.getX() - dx, pos.getY() + dy1, pos.getZ() - dx),
|
||||||
pos.offset((int) dx, (int) dy2, (int) dx)
|
new Vec3(pos.getX() + dx, pos.getY() + dy2, pos.getZ() + dx)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
SplineHelper.scale(spline, scale);
|
SplineHelper.scale(spline, scale);
|
||||||
|
@ -86,7 +88,7 @@ public class HelixTreeFeature extends DefaultFeature {
|
||||||
world,
|
world,
|
||||||
EndBlocks.HELIX_TREE.getBark().defaultBlockState(),
|
EndBlocks.HELIX_TREE.getBark().defaultBlockState(),
|
||||||
pos,
|
pos,
|
||||||
(state) -> state.canBeReplaced()
|
BlockBehaviour.BlockStateBase::canBeReplaced
|
||||||
);
|
);
|
||||||
SplineHelper.rotateSpline(spline, (float) Math.PI);
|
SplineHelper.rotateSpline(spline, (float) Math.PI);
|
||||||
SplineHelper.fillSplineForce(
|
SplineHelper.fillSplineForce(
|
||||||
|
@ -94,7 +96,7 @@ public class HelixTreeFeature extends DefaultFeature {
|
||||||
world,
|
world,
|
||||||
EndBlocks.HELIX_TREE.getBark().defaultBlockState(),
|
EndBlocks.HELIX_TREE.getBark().defaultBlockState(),
|
||||||
pos,
|
pos,
|
||||||
(state) -> state.canBeReplaced()
|
BlockBehaviour.BlockStateBase::canBeReplaced
|
||||||
);
|
);
|
||||||
SplineHelper.scale(spline2, scale);
|
SplineHelper.scale(spline2, scale);
|
||||||
BlockPos leafStart = pos.offset(
|
BlockPos leafStart = pos.offset(
|
||||||
|
@ -107,7 +109,7 @@ public class HelixTreeFeature extends DefaultFeature {
|
||||||
world,
|
world,
|
||||||
EndBlocks.HELIX_TREE.getLog().defaultBlockState(),
|
EndBlocks.HELIX_TREE.getLog().defaultBlockState(),
|
||||||
leafStart,
|
leafStart,
|
||||||
(state) -> state.canBeReplaced()
|
BlockBehaviour.BlockStateBase::canBeReplaced
|
||||||
);
|
);
|
||||||
|
|
||||||
spline.clear();
|
spline.clear();
|
||||||
|
@ -197,7 +199,7 @@ public class HelixTreeFeature extends DefaultFeature {
|
||||||
bPos.set(x + pos.getX(), y + pos.getY(), z + pos.getZ());
|
bPos.set(x + pos.getX(), y + pos.getY(), z + pos.getZ());
|
||||||
int color = MHelper.floor((float) i / (float) count * 7F + 0.5F) + offset;
|
int color = MHelper.floor((float) i / (float) count * 7F + 0.5F) + offset;
|
||||||
color = Mth.clamp(color, 0, 7);
|
color = Mth.clamp(color, 0, 7);
|
||||||
if (world.getBlockState(bPos).canBeReplaced()){
|
if (world.getBlockState(bPos).canBeReplaced()) {
|
||||||
BlocksHelper.setWithoutUpdate(world, bPos, state.setValue(HelixTreeLeavesBlock.COLOR, color));
|
BlocksHelper.setWithoutUpdate(world, bPos, state.setValue(HelixTreeLeavesBlock.COLOR, color));
|
||||||
}
|
}
|
||||||
x += dx;
|
x += dx;
|
||||||
|
@ -205,7 +207,7 @@ public class HelixTreeFeature extends DefaultFeature {
|
||||||
z += dz;
|
z += dz;
|
||||||
}
|
}
|
||||||
bPos.set(end.x() + pos.getX(), end.y() + pos.getY(), end.z() + pos.getZ());
|
bPos.set(end.x() + pos.getX(), end.y() + pos.getY(), end.z() + pos.getZ());
|
||||||
if (world.getBlockState(bPos).canBeReplaced()){
|
if (world.getBlockState(bPos).canBeReplaced()) {
|
||||||
BlocksHelper.setWithoutUpdate(world, bPos, state.setValue(HelixTreeLeavesBlock.COLOR, 7));
|
BlocksHelper.setWithoutUpdate(world, bPos, state.setValue(HelixTreeLeavesBlock.COLOR, 7));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue