Make explicit whether true or effective position of a special flower is used. Fixes #3071 and other issues when flowers are spoofed

This commit is contained in:
Vincent Lee committed 2019-12-27 21:44:27 -06:00
1 parent b80845859f
commit c75abe2562
40 files changed
+140 -131

No files matched your search

@@ -82,6 +82,7 @@ public class TileEntitySpecialFlower extends TileEntity implements ITickableTile
public boolean overgrowth = false;
/** true if this flower is working on Enchanted Soil and this is the second tick **/
public boolean overgrowthBoost = false;
private BlockPos positionOverride;
public static final String TAG_TICKS_EXISTED = "ticksExisted";
private static final String TAG_FLOATING_DATA = "floating";
@@ -96,13 +97,15 @@ public class TileEntitySpecialFlower extends TileEntity implements ITickableTile
if(tileBelow instanceof TileRedStringRelay) {
BlockPos coords = ((TileRedStringRelay) tileBelow).getBinding();
if(coords != null) {
BlockPos currPos = pos;
setPos(coords);
positionOverride = coords;
tickFlower();
setPos(currPos);
return;
} else {
positionOverride = null;
}
} else {
positionOverride = null;
}
boolean special = isOnSpecialSoil();
@@ -141,7 +144,15 @@ public class TileEntitySpecialFlower extends TileEntity implements ITickableTile
}
}
public void tickFlower() {
/**
* @return Where this flower's effects are centered at. This can differ from the true TE location due to
* red string spoofers.
*/
public final BlockPos getEffectivePos() {
return positionOverride != null ? positionOverride : getPos();
}
protected void tickFlower() {
ticksExisted++;
// todo 1.14 this isn't being markDirtied, but do we even want to keep this field around?
}
@@ -44,12 +44,12 @@ public class SubTileManastar extends TileEntitySpecialFlower {
float r = state == INCREASING ? 0.05F : 1F;
float b = state == INCREASING ? 1F : 0.05F;
WispParticleData data = WispParticleData.wisp((float) Math.random() / 7, r, 0.05F, b, 1);
world.addParticle(data, getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.75 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5, 0, (float) Math.random() / 50, 0);
world.addParticle(data, getEffectivePos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getEffectivePos().getY() + 0.75 + Math.random() * 0.2 - 0.1, getEffectivePos().getZ() + 0.5, 0, (float) Math.random() / 50, 0);
}
} else {
int mana = 0;
for(Direction dir : MathHelper.HORIZONTALS) {
BlockPos pos = getPos().offset(dir);
BlockPos pos = getEffectivePos().offset(dir);
if(getWorld().isBlockLoaded(pos)) {
TileEntity tile = getWorld().getTileEntity(pos);
if(tile instanceof IManaPool)
@@ -66,10 +66,10 @@ public class SubTilePureDaisy extends TileEntitySpecialFlower {
if(getWorld().isRemote) {
for (int i = 0; i < POSITIONS.length; i++) {
if ((activePositions >>> i & 1) > 0) {
BlockPos coords = getPos().add(POSITIONS[i]);
SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), 1F, 1F, 1F, 5);
world.addParticle(data, coords.getX() + Math.random(), coords.getY() + Math.random(), coords.getZ() + Math.random(), 0, 0, 0);
}
BlockPos coords = getEffectivePos().add(POSITIONS[i]);
SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), 1F, 1F, 1F, 5);
world.addParticle(data, coords.getX() + Math.random(), coords.getY() + Math.random(), coords.getZ() + Math.random(), 0, 0, 0);
}
}
return;
@@ -80,7 +80,7 @@ public class SubTilePureDaisy extends TileEntitySpecialFlower {
positionAt = 0;
BlockPos acoords = POSITIONS[positionAt];
BlockPos coords = getPos().add(acoords);
BlockPos coords = getEffectivePos().add(acoords);
World world = getWorld();
if(!world.isAirBlock(coords)) {
world.getProfiler().startSection("findRecipe");
@@ -138,7 +138,7 @@ public class SubTilePureDaisy extends TileEntitySpecialFlower {
case UPDATE_ACTIVE_EVENT: activePositions = param; return true;
case RECIPE_COMPLETE_EVENT: {
if (getWorld().isRemote) {
BlockPos coords = getPos().add(POSITIONS[param]);
BlockPos coords = getEffectivePos().add(POSITIONS[param]);
for(int i = 0; i < 25; i++) {
double x = coords.getX() + Math.random();
double y = coords.getY() + Math.random() + 0.5;
@@ -157,7 +157,7 @@ public class SubTilePureDaisy extends TileEntitySpecialFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), 1);
return new RadiusDescriptor.Square(getEffectivePos(), 1);
}
@Override
@@ -46,7 +46,7 @@ public class BergamuteEventHandler {
if (RAND.nextBoolean()) {
Color color = TilePool.PARTICLE_COLOR;
BotaniaAPI.internalHandler.sparkleFX(berg.getWorld(), berg.getPos().getX() + 0.3 + Math.random() * 0.5, berg.getPos().getY() + 0.5 + Math.random() * 0.5, berg.getPos().getZ() + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5);
BotaniaAPI.internalHandler.sparkleFX(berg.getWorld(), berg.getEffectivePos().getX() + 0.3 + Math.random() * 0.5, berg.getEffectivePos().getY() + 0.5 + Math.random() * 0.5, berg.getEffectivePos().getZ() + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5);
}
}
}
@@ -56,11 +56,11 @@ public class SubTileAgricarnation extends TileEntityFunctionalFlower {
if(ticksExisted % 6 == 0 && redstoneSignal == 0) {
int range = getRange();
int x = getPos().getX() + getWorld().rand.nextInt(range * 2 + 1) - range;
int z = getPos().getZ() + getWorld().rand.nextInt(range * 2 + 1) - range;
int x = getEffectivePos().getX() + getWorld().rand.nextInt(range * 2 + 1) - range;
int z = getEffectivePos().getZ() + getWorld().rand.nextInt(range * 2 + 1) - range;
for(int i = 4; i > -2; i--) {
int y = getPos().getY() + i;
int y = getEffectivePos().getY() + i;
BlockPos pos = new BlockPos(x, y, z);
if(getWorld().isAirBlock(pos))
continue;
@@ -112,7 +112,7 @@ public class SubTileAgricarnation extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), getRange());
return new RadiusDescriptor.Square(getEffectivePos(), getRange());
}
public static class Mini extends SubTileAgricarnation {
@@ -64,7 +64,7 @@ public class SubTileBellethorn extends TileEntityFunctionalFlower {
if(ticksExisted % 5 == 0) {
int range = getRange();
List<LivingEntity> entities = getWorld().getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(getPos().add(-range, -range, -range), getPos().add(range + 1, range + 1, range + 1)), getSelector()::test);
List<LivingEntity> entities = getWorld().getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(getEffectivePos().add(-range, -range, -range), getEffectivePos().add(range + 1, range + 1, range + 1)), getSelector());
for(LivingEntity entity : entities) {
if(entity.hurtTime == 0 && getMana() >= manaToUse) {
@@ -99,7 +99,7 @@ public class SubTileBellethorn extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), getRange());
return new RadiusDescriptor.Square(getEffectivePos(), getRange());
}
public static class Mini extends SubTileBellethorn {
@@ -36,8 +36,7 @@ public class SubTileBergamute extends TileEntityFunctionalFlower {
protected static SubTileBergamute getBergamuteNearby(float x, float y, float z) {
return existingFlowers.stream()
.filter(f -> f.redstoneSignal == 0)
.filter(f -> f.getWorld().getTileEntity(f.getPos()) == f)
.filter(f -> f.getDistanceSq(x, y, z) <= RANGE * RANGE)
.filter(f -> f.getEffectivePos().distanceSq(x, y, z, false) <= RANGE * RANGE)
.findAny().orElse(null);
}
@@ -58,7 +57,7 @@ public class SubTileBergamute extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Circle(getPos(), RANGE);
return new RadiusDescriptor.Circle(getEffectivePos(), RANGE);
}
}
@@ -60,8 +60,8 @@ public class SubTileBubbell extends TileEntityFunctionalFlower {
if(ticksExisted % 10 == 0 && range < getRange())
range++;
for(BlockPos pos : BlockPos.getAllInBoxMutable(getPos().add(-range, -range, -range), getPos().add(range, range, range))) {
if(getPos().distanceSq(pos) < range * range) {
for(BlockPos pos : BlockPos.getAllInBoxMutable(getEffectivePos().add(-range, -range, -range), getEffectivePos().add(range, range, range))) {
if(getEffectivePos().distanceSq(pos) < range * range) {
BlockState state = getWorld().getBlockState(pos);
if(state.getMaterial() == Material.WATER) {
getWorld().setBlockState(pos, ModBlocks.fakeAir.getDefaultState(), 2);
@@ -110,7 +110,7 @@ public class SubTileBubbell extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Circle(getPos(), range);
return new RadiusDescriptor.Circle(getEffectivePos(), range);
}
public static class Mini extends SubTileBubbell {
@@ -73,7 +73,7 @@ public class SubTileClayconia extends TileEntityFunctionalFlower {
for(int i = -range; i < range + 1; i++)
for(int j = -rangeY; j < rangeY + 1; j++)
for(int k = -range; k < range + 1; k++) {
BlockPos pos = getPos().add(i, j, k);
BlockPos pos = getEffectivePos().add(i, j, k);
Block block = getWorld().getBlockState(pos).getBlock();
if(block == Blocks.SAND)
possibleCoords.add(pos);
@@ -86,7 +86,7 @@ public class SubTileClayconia extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), getRange());
return new RadiusDescriptor.Square(getEffectivePos(), getRange());
}
public int getRange() {
@@ -53,9 +53,9 @@ public class SubTileDaffomill extends TileEntityFunctionalFlower {
super.tickFlower();
if(getWorld().rand.nextInt(4) == 0) {
WispParticleData data = WispParticleData.wisp(0.25F + (float) Math.random() * 0.15F, 0.05F, 0.05F, 0.05F);
world.addParticle(data, getPos().getX() + Math.random(), getPos().getY() + Math.random(), getPos().getZ() + Math.random(), orientation.getXOffset() * 0.1F, orientation.getYOffset() * 0.1F, orientation.getZOffset() * 0.1F);
}
WispParticleData data = WispParticleData.wisp(0.25F + (float) Math.random() * 0.15F, 0.05F, 0.05F, 0.05F);
world.addParticle(data, getEffectivePos().getX() + Math.random(), getEffectivePos().getY() + Math.random(), getEffectivePos().getZ() + Math.random(), orientation.getXOffset() * 0.1F, orientation.getYOffset() * 0.1F, orientation.getZOffset() * 0.1F);
}
if(windTicks == 0 && getMana() > 0) {
windTicks = 20;
@@ -84,9 +84,9 @@ public class SubTileDaffomill extends TileEntityFunctionalFlower {
}
private AxisAlignedBB aabbForOrientation() {
int x = getPos().getX();
int y = getPos().getY();
int z = getPos().getZ();
int x = getEffectivePos().getX();
int y = getEffectivePos().getY();
int z = getEffectivePos().getZ();
int w = 2;
int h = 3;
int l = 16;
@@ -139,8 +139,8 @@ public class SubTileDaffomill extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
AxisAlignedBB aabb = aabbForOrientation();
aabb = new AxisAlignedBB(aabb.minX, getPos().getY(), aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
return new RadiusDescriptor.Rectangle(getPos(), aabb);
aabb = new AxisAlignedBB(aabb.minX, getEffectivePos().getY(), aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
return new RadiusDescriptor.Rectangle(getEffectivePos(), aabb);
}
@Override
@@ -42,8 +42,8 @@ public class SubTileExoflame extends TileEntityFunctionalFlower {
boolean did = false;
for(BlockPos pos : BlockPos.getAllInBoxMutable(getPos().add(-RANGE, -RANGE_Y, -RANGE),
getPos().add(RANGE, RANGE_Y, RANGE))) {
for(BlockPos pos : BlockPos.getAllInBoxMutable(getEffectivePos().add(-RANGE, -RANGE_Y, -RANGE),
getEffectivePos().add(RANGE, RANGE_Y, RANGE))) {
TileEntity tile = getWorld().getTileEntity(pos);
if(tile != null) {
LazyOptional<IExoflameHeatable> cap = tile.getCapability(BotaniaAPI.EXOFLAME_HEATABLE_CAP);
@@ -73,7 +73,7 @@ public class SubTileExoflame extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -40,7 +40,7 @@ public class SubTileFallenKanade extends TileEntityFunctionalFlower {
if(!getWorld().isRemote && !(getWorld().getDimension() instanceof EndDimension)) {
boolean did = false;
List<PlayerEntity> players = getWorld().getEntitiesWithinAABB(PlayerEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
List<PlayerEntity> players = getWorld().getEntitiesWithinAABB(PlayerEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(PlayerEntity player : players) {
if(player.getActivePotionEffect(Effects.REGENERATION) == null && getMana() >= COST) {
player.addPotionEffect(new EffectInstance(Effects.REGENERATION, 59, 2, true, true));
@@ -55,7 +55,7 @@ public class SubTileFallenKanade extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -45,7 +45,7 @@ public class SubTileHeiseiDream extends TileEntityFunctionalFlower {
return;
@SuppressWarnings("unchecked")
List<IMob> mobs = (List) getWorld().getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)), Predicates.instanceOf(IMob.class));
List<IMob> mobs = (List) getWorld().getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)), Predicates.instanceOf(IMob.class));
if(mobs.size() > 1 && getMana() >= COST)
for(IMob mob : mobs) {
@@ -93,7 +93,7 @@ public class SubTileHeiseiDream extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -76,7 +76,7 @@ public class SubTileHopperhock extends TileEntityFunctionalFlower {
boolean pulledAny = false;
int range = getRange();
BlockPos pos = getPos();
BlockPos pos = getEffectivePos();
List<ItemEntity> items = getWorld().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(pos.add(-range, -range, -range), pos.add(range + 1, range + 1, range + 1)));
int slowdown = getSlowdownFactor();
@@ -212,7 +212,7 @@ public class SubTileHopperhock extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), getRange());
return new RadiusDescriptor.Square(getEffectivePos(), getRange());
}
public int getRange() {
@@ -42,7 +42,7 @@ public class SubTileHyacidus extends TileEntityFunctionalFlower {
if(getWorld().isRemote || redstoneSignal > 0)
return;
List<LivingEntity> entities = getWorld().getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
List<LivingEntity> entities = getWorld().getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(LivingEntity entity : entities) {
if(!(entity instanceof PlayerEntity) && entity.getActivePotionEffect(Effects.POISON) == null && getMana() >= COST && !entity.world.isRemote && entity.getCreatureAttribute() != CreatureAttribute.UNDEAD) {
entity.addPotionEffect(new EffectInstance(Effects.POISON, 60, 0));
@@ -68,7 +68,7 @@ public class SubTileHyacidus extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
}
@@ -43,9 +43,9 @@ public class SubTileJadedAmaranthus extends TileEntityFunctionalFlower {
if(ticksExisted % 30 == 0 && getMana() >= COST) {
BlockPos pos = new BlockPos(
getPos().getX() - RANGE + getWorld().rand.nextInt(RANGE * 2 + 1),
getPos().getY() + RANGE,
getPos().getZ() - RANGE + getWorld().rand.nextInt(RANGE * 2 + 1)
getEffectivePos().getX() - RANGE + getWorld().rand.nextInt(RANGE * 2 + 1),
getEffectivePos().getY() + RANGE,
getEffectivePos().getZ() - RANGE + getWorld().rand.nextInt(RANGE * 2 + 1)
);
BlockPos up = pos.up();
@@ -82,7 +82,7 @@ public class SubTileJadedAmaranthus extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -91,9 +91,9 @@ public class SubTileLoonuim extends TileEntityFunctionalFlower {
} while(stack.isEmpty() || ModTags.Items.LOONIUM_BLACKLIST.contains(stack.getItem()));
int bound = RANGE * 2 + 1;
int xp = getPos().getX() - RANGE + rand.nextInt(bound);
int yp = getPos().getY();
int zp = getPos().getZ() - RANGE + rand.nextInt(bound);
int xp = getEffectivePos().getX() - RANGE + rand.nextInt(bound);
int yp = getEffectivePos().getY();
int zp = getEffectivePos().getZ() - RANGE + rand.nextInt(bound);
BlockPos pos = new BlockPos(xp, yp - 1, zp);
do {
@@ -177,7 +177,7 @@ public class SubTileLoonuim extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -119,8 +119,8 @@ public class SubTileMarimorphosis extends TileEntityFunctionalFlower {
int rangeY = getRangeY();
BlockStateMatcher matcher = BlockStateMatcher.forBlock(Blocks.STONE);
for(BlockPos pos : BlockPos.getAllInBoxMutable(getPos().add(-range, -rangeY, -range),
getPos().add(range, rangeY, range))) {
for(BlockPos pos : BlockPos.getAllInBoxMutable(getEffectivePos().add(-range, -rangeY, -range),
getEffectivePos().add(range, rangeY, range))) {
BlockState state = getWorld().getBlockState(pos);
if(state.getBlock().isReplaceableOreGen(state, getWorld(), pos, matcher))
possibleCoords.add(pos.toImmutable());
@@ -133,7 +133,7 @@ public class SubTileMarimorphosis extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), getRange());
return new RadiusDescriptor.Square(getEffectivePos(), getRange());
}
public int getRange() {
@@ -38,7 +38,7 @@ public class SubTileMedumone extends TileEntityFunctionalFlower {
super.tickFlower();
if(!getWorld().isRemote && getMana() > 0) {
List<LivingEntity> entities = getWorld().getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
List<LivingEntity> entities = getWorld().getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(LivingEntity entity : entities)
if(!(entity instanceof PlayerEntity)) {
@@ -57,7 +57,7 @@ public class SubTileMedumone extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -106,8 +106,8 @@ public class SubTileOrechid extends TileEntityFunctionalFlower {
private BlockPos getCoordsToPut() {
List<BlockPos> possibleCoords = new ArrayList<>();
for(BlockPos pos : BlockPos.getAllInBoxMutable(getPos().add(-RANGE, -RANGE_Y, -RANGE),
getPos().add(RANGE, RANGE_Y, RANGE))) {
for(BlockPos pos : BlockPos.getAllInBoxMutable(getEffectivePos().add(-RANGE, -RANGE_Y, -RANGE),
getEffectivePos().add(RANGE, RANGE_Y, RANGE))) {
BlockState state = getWorld().getBlockState(pos);
if(state.getBlock().isReplaceableOreGen(state, getWorld(), pos, getReplaceMatcher()))
possibleCoords.add(pos.toImmutable());
@@ -140,7 +140,7 @@ public class SubTileOrechid extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -39,8 +39,8 @@ public class SubTilePollidisiac extends TileEntityFunctionalFlower {
if(!getWorld().isRemote) {
List<ItemEntity> items = getWorld().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
List<AnimalEntity> animals = getWorld().getEntitiesWithinAABB(AnimalEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
List<ItemEntity> items = getWorld().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
List<AnimalEntity> animals = getWorld().getEntitiesWithinAABB(AnimalEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
int slowdown = getSlowdownFactor();
for(AnimalEntity animal : animals) {
@@ -68,7 +68,7 @@ public class SubTilePollidisiac extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -76,7 +76,7 @@ public class SubTileRannuncarpus extends TileEntityFunctionalFlower {
return;
if(ticksExisted % 10 == 0) {
List<ItemEntity> items = getWorld().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE_Y, -RANGE), getPos().add(RANGE + 1, RANGE_Y + 1, RANGE + 1)));
List<ItemEntity> items = getWorld().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE_Y, -RANGE), getEffectivePos().add(RANGE + 1, RANGE_Y + 1, RANGE + 1)));
List<BlockPos> validPositions = getCandidatePositions();
int slowdown = getSlowdownFactor();
@@ -116,13 +116,13 @@ public class SubTileRannuncarpus extends TileEntityFunctionalFlower {
}
public BlockState getUnderlyingBlock() {
return getWorld().getBlockState(getPos().down(isFloating() ? 1 : 2));
return getWorld().getBlockState(getEffectivePos().down(isFloating() ? 1 : 2));
}
private List<BlockPos> getCandidatePositions() {
int rangePlace = getRange();
int rangePlaceY = getRangeY();
BlockPos pos = getPos();
BlockPos pos = getEffectivePos();
BlockState filter = getUnderlyingBlock();
List<BlockPos> ret = new ArrayList<>();
@@ -168,7 +168,7 @@ public class SubTileRannuncarpus extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), getRange());
return new RadiusDescriptor.Square(getEffectivePos(), getRange());
}
public int getRange() {
@@ -56,9 +56,7 @@ public class SubTileSolegnolia extends TileEntityFunctionalFlower {
return existingFlowers.stream()
.filter(f -> f.redstoneSignal == 0)
.filter(f -> f.getWorld() == e.world)
.filter(f -> f.getWorld().getTileEntity(f.getPos()) == f)
.filter(f -> f.getDistanceSq(e.posX, e.posY, e.posZ) <= f.getRange() * f.getRange())
.findAny().isPresent();
.anyMatch(f -> f.getEffectivePos().distanceSq(e.posX, e.posY, e.posZ, false) <= f.getRange() * f.getRange());
}
@Override
@@ -77,7 +75,7 @@ public class SubTileSolegnolia extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Circle(getPos(), getRange());
return new RadiusDescriptor.Circle(getEffectivePos(), getRange());
}
public static class Mini extends SubTileSolegnolia {
@@ -59,7 +59,7 @@ public class SubTileSpectranthemum extends TileEntityFunctionalFlower {
super.tickFlower();
if(!getWorld().isRemote && redstoneSignal == 0 && getWorld().isBlockLoaded(bindPos)) {
BlockPos pos = getPos();
BlockPos pos = getEffectivePos();
boolean did = false;
@@ -100,7 +100,7 @@ public class SubTileSpectranthemum extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -140,7 +140,7 @@ public class SubTileSpectranthemum extends TileEntityFunctionalFlower {
public boolean bindTo(PlayerEntity player, ItemStack wand, BlockPos pos, Direction side) {
boolean bound = super.bindTo(player, wand, pos, side);
if(!bound && !pos.equals(bindPos) && pos.distanceSq(getPos()) <= BIND_RANGE * BIND_RANGE && !pos.equals(getPos())) {
if(!bound && !pos.equals(bindPos) && pos.distanceSq(getEffectivePos()) <= BIND_RANGE * BIND_RANGE && !pos.equals(getEffectivePos())) {
bindPos = pos;
sync();
@@ -41,9 +41,9 @@ public class SubTileTangleberrie extends TileEntityFunctionalFlower {
super.tickFlower();
if(getMana() > 0) {
double x1 = getPos().getX() + 0.5;
double y1 = getPos().getY() + 0.5;
double z1 = getPos().getZ() + 0.5;
double x1 = getEffectivePos().getX() + 0.5;
double y1 = getEffectivePos().getY() + 0.5;
double z1 = getEffectivePos().getZ() + 0.5;
double maxDist = getMaxDistance();
double range = getRange();
@@ -91,7 +91,7 @@ public class SubTileTangleberrie extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Circle(getPos(), getRange());
return new RadiusDescriptor.Circle(getEffectivePos(), getRange());
}
@Override
@@ -49,7 +49,7 @@ public class SubTileTigerseye extends TileEntityFunctionalFlower {
boolean shouldAfffect = getMana() >= COST;
List<MobEntity> entities = getWorld().getEntitiesWithinAABB(MobEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE_Y, -RANGE), getPos().add(RANGE + 1, RANGE_Y + 1, RANGE + 1)));
List<MobEntity> entities = getWorld().getEntitiesWithinAABB(MobEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE_Y, -RANGE), getEffectivePos().add(RANGE + 1, RANGE_Y + 1, RANGE + 1)));
for(MobEntity entity : entities) {
List<PrioritizedGoal> entries = new ArrayList<>(entity.goalSelector.goals);
@@ -93,7 +93,7 @@ public class SubTileTigerseye extends TileEntityFunctionalFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -36,6 +36,7 @@ public class SubTileVinculotus extends TileEntityFunctionalFlower {
// Must store position since red string spoofers are only active during tick
// But our main logic runs outside, in the event handler
// TODO not needed anymore with addition of getEffectivePos?
public static final Map<SubTileVinculotus, BlockPos> existingFlowers = new WeakHashMap<>();
private static final int RANGE = 64;
@@ -49,14 +50,14 @@ public class SubTileVinculotus extends TileEntityFunctionalFlower {
if(!getWorld().isRemote) {
BlockPos pos = existingFlowers.get(this);
if (pos == null || !pos.equals(getPos()))
existingFlowers.put(this, getPos());
if (pos == null || !pos.equals(getEffectivePos()))
existingFlowers.put(this, getEffectivePos());
}
}
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Circle(getPos(), RANGE);
return new RadiusDescriptor.Circle(getEffectivePos(), RANGE);
}
@Override
@@ -84,7 +85,7 @@ public class SubTileVinculotus extends TileEntityFunctionalFlower {
SubTileVinculotus flower = e.getKey();
BlockPos activePos = e.getValue();
if(flower == null || flower.redstoneSignal > 0 || flower.getMana() <= cost || flower.getWorld() != event.getEntityLiving().world || flower.getWorld().getTileEntity(flower.getPos()) != flower)
if(flower == null || flower.redstoneSignal > 0 || flower.getMana() <= cost || flower.getWorld() != event.getEntityLiving().world || flower.getWorld().getTileEntity(flower.getEffectivePos()) != flower)
continue;
double x = activePos.getX() + 0.5;
@@ -39,7 +39,7 @@ public class SubTileArcaneRose extends TileEntityGeneratingFlower {
if(getMana() >= getMaxMana())
return;
List<PlayerEntity> players = getWorld().getEntitiesWithinAABB(PlayerEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
List<PlayerEntity> players = getWorld().getEntitiesWithinAABB(PlayerEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(PlayerEntity player : players)
if(ExperienceHelper.getPlayerXP(player) >= 1 && player.onGround) {
ExperienceHelper.drainPlayerXP(player, 1);
@@ -47,7 +47,7 @@ public class SubTileArcaneRose extends TileEntityGeneratingFlower {
return;
}
List<ExperienceOrbEntity> orbs = getWorld().getEntitiesWithinAABB(ExperienceOrbEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
List<ExperienceOrbEntity> orbs = getWorld().getEntitiesWithinAABB(ExperienceOrbEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(ExperienceOrbEntity orb : orbs) {
if (orb.isAlive()) {
addMana(orb.getXpValue() * 35);
@@ -60,7 +60,7 @@ public class SubTileArcaneRose extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -95,7 +95,7 @@ public class SubTileDandelifeon extends TileEntityGeneratingFlower {
}
}
BlockPos pos = getPos();
BlockPos pos = getEffectivePos();
for(int[] change : changes) {
BlockPos pos_ = pos.add(-RANGE + change[0], 0, -RANGE + change[1]);
@@ -113,7 +113,7 @@ public class SubTileDandelifeon extends TileEntityGeneratingFlower {
int diam = RANGE * 2 + 1;
int[][] table = new int[diam][diam];
BlockPos pos = getPos();
BlockPos pos = getEffectivePos();
for(int i = 0; i < diam; i++)
for(int j = 0; j < diam; j++) {
@@ -192,7 +192,7 @@ public class SubTileDandelifeon extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -52,8 +52,8 @@ public class SubTileEndoflame extends TileEntityGeneratingFlower {
if(getWorld().isRemote) {
if(burnTime > 0 && getWorld().rand.nextInt(10) == 0) {
Vec3d offset = getWorld().getBlockState(getPos()).getOffset(getWorld(), getPos()).add(0.4, 0.7, 0.4);
getWorld().addParticle(ParticleTypes.FLAME, getPos().getX() + offset.x + Math.random() * 0.2, getPos().getY() + offset.y, getPos().getZ() + offset.z + Math.random() * 0.2, 0.0D, 0.0D, 0.0D);
Vec3d offset = getWorld().getBlockState(getEffectivePos()).getOffset(getWorld(), getEffectivePos()).add(0.4, 0.7, 0.4);
getWorld().addParticle(ParticleTypes.FLAME, getEffectivePos().getX() + offset.x + Math.random() * 0.2, getEffectivePos().getY() + offset.y, getEffectivePos().getZ() + offset.z + Math.random() * 0.2, 0.0D, 0.0D, 0.0D);
}
return;
}
@@ -63,7 +63,7 @@ public class SubTileEndoflame extends TileEntityGeneratingFlower {
if(getMana() < getMaxMana()) {
int slowdown = getSlowdownFactor();
for(ItemEntity item : getWorld().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)))) {
for(ItemEntity item : getWorld().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)))) {
if(item.age >= 59 + slowdown && !item.removed) {
ItemStack stack = item.getItem();
if(stack.isEmpty() || stack.getItem().hasContainerItem(stack))
@@ -74,8 +74,8 @@ public class SubTileEndoflame extends TileEntityGeneratingFlower {
this.burnTime = Math.min(FUEL_CAP, burnTime) / 2;
stack.shrink(1);
getWorld().playSound(null, getPos(), ModSounds.endoflame, SoundCategory.BLOCKS, 0.2F, 1F);
getWorld().addBlockEvent(getPos(), getWorld().getBlockState(getPos()).getBlock(), START_BURN_EVENT, item.getEntityId());
getWorld().playSound(null, getEffectivePos(), ModSounds.endoflame, SoundCategory.BLOCKS, 0.2F, 1F);
getWorld().addBlockEvent(getPos(), getBlockState().getBlock(), START_BURN_EVENT, item.getEntityId());
sync();
return;
@@ -118,7 +118,7 @@ public class SubTileEndoflame extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -41,7 +41,7 @@ public class SubTileEntropinnyum extends TileEntityGeneratingFlower {
super.tickFlower();
if(!getWorld().isRemote && getMana() == 0) {
List<TNTEntity> tnts = getWorld().getEntitiesWithinAABB(TNTEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
List<TNTEntity> tnts = getWorld().getEntitiesWithinAABB(TNTEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(TNTEntity tnt : tnts) {
if(tnt.getFuse() == 1 && !tnt.removed && !getWorld().getBlockState(new BlockPos(tnt)).getMaterial().isLiquid()) {
tnt.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 0.2F, (1F + (getWorld().rand.nextFloat() - getWorld().rand.nextFloat()) * 0.2F) * 0.7F);
@@ -87,7 +87,7 @@ public class SubTileEntropinnyum extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
}
@@ -65,20 +65,20 @@ public class SubTileGourmaryllis extends TileEntityGeneratingFlower {
digestingMana = 0;
float burpPitch = 1 - (lastFoodCount - 1) * 0.05F;
getWorld().playSound(null, getPos(), SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.BLOCKS, 1, burpPitch);
getWorld().playSound(null, getEffectivePos(), SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.BLOCKS, 1, burpPitch);
sync();
} else if(cooldown % munchInterval == 0) {
getWorld().playSound(null, getPos(), SoundEvents.ENTITY_GENERIC_EAT, SoundCategory.BLOCKS, 0.5f, 1);
getWorld().playSound(null, getEffectivePos(), SoundEvents.ENTITY_GENERIC_EAT, SoundCategory.BLOCKS, 0.5f, 1);
Vec3d offset = getWorld().getBlockState(getPos()).getOffset(getWorld(), getPos()).add(0.4, 0.6, 0.4);
Vec3d offset = getWorld().getBlockState(getEffectivePos()).getOffset(getWorld(), getEffectivePos()).add(0.4, 0.6, 0.4);
((ServerWorld) getWorld()).spawnParticle(new ItemParticleData(ParticleTypes.ITEM, lastFood), getPos().getX()+offset.x, getPos().getY()+offset.y, getPos().getZ()+offset.z, 10, 0.1D, 0.1D, 0.1D, 0.03D);
((ServerWorld) getWorld()).spawnParticle(new ItemParticleData(ParticleTypes.ITEM, lastFood), getEffectivePos().getX()+offset.x, getEffectivePos().getY()+offset.y, getEffectivePos().getZ()+offset.z, 10, 0.1D, 0.1D, 0.1D, 0.03D);
}
}
int slowdown = getSlowdownFactor();
List<ItemEntity> items = getWorld().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
List<ItemEntity> items = getWorld().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(ItemEntity item : items) {
ItemStack stack = item.getItem();
@@ -127,7 +127,7 @@ public class SubTileGourmaryllis extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -64,9 +64,9 @@ public class SubTileHydroangeas extends TileEntityGeneratingFlower {
if(cooldown > 0) {
cooldown--;
for(int i = 0; i < 3; i++) {
WispParticleData data = WispParticleData.wisp((float) Math.random() / 6, 0.1F, 0.1F, 0.1F, 1);
world.addParticle(data, getPos().getX() + 0.5 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.5 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5 + Math.random() * 0.2 - 0.1, 0, (float) Math.random() / 30, 0);
}
WispParticleData data = WispParticleData.wisp((float) Math.random() / 6, 0.1F, 0.1F, 0.1F, 1);
world.addParticle(data, getEffectivePos().getX() + 0.5 + Math.random() * 0.2 - 0.1, getEffectivePos().getY() + 0.5 + Math.random() * 0.2 - 0.1, getEffectivePos().getZ() + 0.5 + Math.random() * 0.2 - 0.1, 0, (float) Math.random() / 30, 0);
}
}
if(burnTime == 0) {
@@ -75,7 +75,7 @@ public class SubTileHydroangeas extends TileEntityGeneratingFlower {
Collections.shuffle(offsets);
for(BlockPos offset : offsets) {
BlockPos pos = getPos().add(offset);
BlockPos pos = getEffectivePos().add(offset);
IFluidState fstate = getWorld().getFluidState(pos);
Tag<Fluid> search = getMaterialToSearchFor();
@@ -118,7 +118,7 @@ public class SubTileHydroangeas extends TileEntityGeneratingFlower {
public void doBurnParticles() {
WispParticleData data = WispParticleData.wisp((float) Math.random() / 6, 0.05F, 0.05F, 0.7F, 1);
world.addParticle(data, getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5, 0, (float) Math.random() / 60, 0);
world.addParticle(data, getEffectivePos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getEffectivePos().getY() + 0.55 + Math.random() * 0.2 - 0.1, getEffectivePos().getZ() + 0.5, 0, (float) Math.random() / 60, 0);
}
public Tag<Fluid> getMaterialToSearchFor() {
@@ -130,7 +130,7 @@ public class SubTileHydroangeas extends TileEntityGeneratingFlower {
}
public void playSound() {
getWorld().playSound(null, getPos(), SoundEvents.ENTITY_GENERIC_DRINK, SoundCategory.BLOCKS, 0.01F, 0.5F + (float) Math.random() * 0.5F);
getWorld().playSound(null, getEffectivePos(), SoundEvents.ENTITY_GENERIC_DRINK, SoundCategory.BLOCKS, 0.01F, 0.5F + (float) Math.random() * 0.5F);
}
public int getBurnTime() {
@@ -139,7 +139,7 @@ public class SubTileHydroangeas extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), 1);
return new RadiusDescriptor.Square(getEffectivePos(), 1);
}
@Override
@@ -174,7 +174,7 @@ public class SubTileHydroangeas extends TileEntityGeneratingFlower {
@Override
public int getDelayBetweenPassiveGeneration() {
boolean rain = getWorld().getBiome(getPos()).getPrecipitation() == Biome.RainType.RAIN && (getWorld().isRaining() || getWorld().isThundering());
boolean rain = getWorld().getBiome(getEffectivePos()).getPrecipitation() == Biome.RainType.RAIN && (getWorld().isRaining() || getWorld().isThundering());
return rain ? 2 : 3;
}
@@ -45,7 +45,7 @@ public class SubTileKekimurus extends TileEntityGeneratingFlower {
for(int i = 0; i < RANGE * 2 + 1; i++)
for(int j = 0; j < RANGE * 2 + 1; j++)
for(int k = 0; k < RANGE * 2 + 1; k++) {
BlockPos pos = getPos().add(i - RANGE, j - RANGE, k - RANGE);
BlockPos pos = getEffectivePos().add(i - RANGE, j - RANGE, k - RANGE);
BlockState state = getWorld().getBlockState(pos);
Block block = state.getBlock();
if(block instanceof CakeBlock) {
@@ -55,7 +55,7 @@ public class SubTileKekimurus extends TileEntityGeneratingFlower {
else getWorld().setBlockState(pos, state.with(CakeBlock.BITES, nextSlicesEaten), 1 | 2);
getWorld().playEvent(2001, pos, Block.getStateId(state));
getWorld().playSound(null, getPos(), SoundEvents.ENTITY_GENERIC_EAT, SoundCategory.BLOCKS, 1F, 0.5F + (float) Math.random() * 0.5F);
getWorld().playSound(null, getEffectivePos(), SoundEvents.ENTITY_GENERIC_EAT, SoundCategory.BLOCKS, 1F, 0.5F + (float) Math.random() * 0.5F);
addMana(mana);
sync();
return;
@@ -66,7 +66,7 @@ public class SubTileKekimurus extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -68,7 +68,7 @@ public class SubTileMunchdew extends TileEntityGeneratingFlower {
eatLeaves : {
if(getMaxMana() - getMana() >= manaPerLeaf && ticksExisted % 4 == 0) {
List<BlockPos> coords = new ArrayList<>();
BlockPos pos = getPos();
BlockPos pos = getEffectivePos();
nextCoord:
for(BlockPos pos_ : BlockPos.getAllInBoxMutable(pos.add(-RANGE, 0, -RANGE),
@@ -109,7 +109,7 @@ public class SubTileMunchdew extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -49,7 +49,7 @@ public class SubTileNarslimmus extends TileEntityGeneratingFlower {
super.tickFlower();
if(ticksExisted % 5 == 0) {
List<SlimeEntity> slimes = getWorld().getEntitiesWithinAABB(SlimeEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
List<SlimeEntity> slimes = getWorld().getEntitiesWithinAABB(SlimeEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(SlimeEntity slime : slimes) {
if(slime.getPersistentData().getBoolean(TAG_WORLD_SPAWNED) && slime.isAlive()) {
int size = slime.getSlimeSize();
@@ -78,7 +78,7 @@ public class SubTileNarslimmus extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -58,7 +58,7 @@ public class SubTileRafflowsia extends TileEntityGeneratingFlower {
for(int i = 0; i < RANGE * 2 + 1; i++)
for(int j = 0; j < RANGE * 2 + 1; j++)
for(int k = 0; k < RANGE * 2 + 1; k++) {
BlockPos pos = getPos().add(i - RANGE, j - RANGE, k - RANGE);
BlockPos pos = getEffectivePos().add(i - RANGE, j - RANGE, k - RANGE);
BlockState state = getWorld().getBlockState(pos);
if(state.isIn(ModTags.Blocks.SPECIAL_FLOWERS) && state.getBlock() != ModSubtiles.rafflowsia) {
@@ -101,7 +101,7 @@ public class SubTileRafflowsia extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -38,7 +38,7 @@ public class SubTileShulkMeNot extends TileEntityGeneratingFlower {
int generate = getMaxMana();
World world = getWorld();
BlockPos pos = getPos();
BlockPos pos = getEffectivePos();
Vec3d posD = new Vec3d(pos.getX(), pos.getY(), pos.getZ());
List<ShulkerEntity> shulkers = world.getEntitiesWithinAABB(ShulkerEntity.class, new AxisAlignedBB(pos).grow(RADIUS));
if(!world.isRemote)
@@ -84,7 +84,7 @@ public class SubTileShulkMeNot extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Circle(getPos(), RADIUS);
return new RadiusDescriptor.Circle(getEffectivePos(), RADIUS);
}
@Override
@@ -67,9 +67,9 @@ public class SubTileSpectrolus extends TileEntityGeneratingFlower {
return;
// sheep need to enter the actual block space
List<Entity> targets = getWorld().getEntitiesWithinAABB(SheepEntity.class, new AxisAlignedBB(getPos()), Entity::isAlive);
List<Entity> targets = getWorld().getEntitiesWithinAABB(SheepEntity.class, new AxisAlignedBB(getEffectivePos()), Entity::isAlive);
AxisAlignedBB itemAABB = new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1));
AxisAlignedBB itemAABB = new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1));
int slowdown = getSlowdownFactor();
Predicate<Entity> selector = e -> (e instanceof ItemEntity && e.isAlive() && ((ItemEntity) e).age >= slowdown);
targets.addAll(getWorld().getEntitiesWithinAABB(Entity.class, itemAABB, selector));
@@ -115,7 +115,7 @@ public class SubTileSpectrolus extends TileEntityGeneratingFlower {
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(getPos(), RANGE);
return new RadiusDescriptor.Square(getEffectivePos(), RANGE);
}
@Override
@@ -36,7 +36,7 @@ public class SubTileThermalily extends SubTileHydroangeas {
@Override
public void doBurnParticles() {
WispParticleData data = WispParticleData.wisp((float) Math.random() / 6, 0.7F, 0.05F, 0.05F, 1);
world.addParticle(data, getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.9 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5, 0, (float) Math.random() / 60, 0);
world.addParticle(data, getEffectivePos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getEffectivePos().getY() + 0.9 + Math.random() * 0.2 - 0.1, getEffectivePos().getZ() + 0.5, 0, (float) Math.random() / 60, 0);
}
@Override
@@ -46,7 +46,7 @@ public class SubTileThermalily extends SubTileHydroangeas {
@Override
public void playSound() {
getWorld().playSound(null, getPos(), ModSounds.thermalily, SoundCategory.BLOCKS, 0.2F, 1F);
getWorld().playSound(null, getEffectivePos(), ModSounds.thermalily, SoundCategory.BLOCKS, 0.2F, 1F);
}
@Override