mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 19:29:31 +00:00
Fix memory usage problem caused by vanilla
This commit is contained in:
1 parent
28f4321cfb
commit
b581a5544b
2 files changed
+28
-7
No files matched your search
@@ -34,12 +34,23 @@ public class PotionBloodthirst extends PotionMod {
|
||||
@SubscribeEvent
|
||||
public void onSpawn(LivingSpawnEvent.CheckSpawn event) {
|
||||
if(event.getResult() != Result.ALLOW && event.entityLiving instanceof IMob) {
|
||||
List<EntityPlayer> players = event.world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE));
|
||||
for(EntityPlayer player : players)
|
||||
if(hasEffect(player) && !hasEffect(player, ModPotions.emptiness)) {
|
||||
event.setResult(Result.ALLOW);
|
||||
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE);
|
||||
for(EntityPlayer player : event.world.playerEntities) {
|
||||
if(hasEffect(player) && !hasEffect(player, ModPotions.emptiness) && player.getEntityBoundingBox().intersectsWith(aabb)) {
|
||||
event.setResult(Result.DENY);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO 1.8 report to forge? world.getEntitiesWithinAABB is hell slow in 1.8+
|
||||
// List<EntityPlayer> players = event.world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE));
|
||||
// for(EntityPlayer player : players)
|
||||
// if(hasEffect(player) && !hasEffect(player, ModPotions.emptiness)) {
|
||||
// event.setResult(Result.ALLOW);
|
||||
// return;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,12 +33,22 @@ public class PotionEmptiness extends PotionMod {
|
||||
@SubscribeEvent
|
||||
public void onSpawn(LivingSpawnEvent.CheckSpawn event) {
|
||||
if(event.getResult() != Result.ALLOW && event.entityLiving instanceof IMob) {
|
||||
List<EntityPlayer> players = event.world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE));
|
||||
for(EntityPlayer player : players)
|
||||
if(hasEffect(player)) {
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE);
|
||||
for(EntityPlayer player : event.world.playerEntities) {
|
||||
if(hasEffect(player) && player.getEntityBoundingBox().intersectsWith(aabb)) {
|
||||
event.setResult(Result.DENY);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO 1.8 report to forge? world.getEntitiesWithinAABB is hell slow in 1.8+
|
||||
// List<EntityPlayer> players = event.world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE));
|
||||
// for(EntityPlayer player : players)
|
||||
// if(hasEffect(player)) {
|
||||
// event.setResult(Result.DENY);
|
||||
// return;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user