Utils ported
This commit is contained in:
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.IPacket;
|
||||
import net.minecraft.util.math.Box;
|
||||
@@ -39,14 +39,14 @@ public abstract class AEBaseItemEntity extends ItemEntity {
|
||||
final double y, final double z, final ItemStack stack) {
|
||||
this(entityType, world);
|
||||
this.setPosition(x, y, z);
|
||||
this.rotationYaw = this.rand.nextFloat() * 360.0F;
|
||||
this.yaw = this.rand.nextFloat() * 360.0F;
|
||||
this.setMotion(this.rand.nextDouble() * 0.2D - 0.1D, 0.2D, this.rand.nextDouble() * 0.2D - 0.1D);
|
||||
this.setItem(stack);
|
||||
this.lifespan = stack.getEntityLifespan(world);
|
||||
}
|
||||
|
||||
protected List<Entity> getCheckedEntitiesWithinAABBExcludingEntity(final Box region) {
|
||||
return this.world.getEntitiesWithinAABBExcludingEntity(this, region);
|
||||
return this.world.getEntities(this, region);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.math.Box;
|
||||
@@ -64,7 +64,7 @@ public final class ChargedQuartzEntity extends AEBaseItemEntity {
|
||||
}
|
||||
|
||||
if (world.isClient && this.delay > 30 && AEConfig.instance().isEnableEffects()) {
|
||||
AppEng.proxy.spawnEffect(EffectType.Lightning, this.world, this.getPosX(), this.getPosY(), this.getPosZ(),
|
||||
AppEng.proxy.spawnEffect(EffectType.Lightning, this.world, this.getX(), this.getY(), this.getZ(),
|
||||
null);
|
||||
this.delay = 0;
|
||||
}
|
||||
@@ -95,8 +95,8 @@ public final class ChargedQuartzEntity extends AEBaseItemEntity {
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
|
||||
if (materials.certusQuartzCrystalCharged().isSameAs(item)) {
|
||||
final Box region = new Box(this.getPosX() - 1, this.getPosY() - 1, this.getPosZ() - 1,
|
||||
this.getPosX() + 1, this.getPosY() + 1, this.getPosZ() + 1);
|
||||
final Box region = new Box(this.getX() - 1, this.getY() - 1, this.getZ() - 1,
|
||||
this.getX() + 1, this.getY() + 1, this.getZ() + 1);
|
||||
final List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity(region);
|
||||
|
||||
ItemEntity redstone = null;
|
||||
@@ -135,10 +135,10 @@ public final class ChargedQuartzEntity extends AEBaseItemEntity {
|
||||
}
|
||||
|
||||
materials.fluixCrystal().maybeStack(2).ifPresent(is -> {
|
||||
final ItemEntity entity = new ItemEntity(this.world, this.getPosX(), this.getPosY(), this.getPosZ(),
|
||||
final ItemEntity entity = new ItemEntity(this.world, this.getX(), this.getY(), this.getZ(),
|
||||
is);
|
||||
|
||||
this.world.addEntity(entity);
|
||||
this.world.spawnEntity(entity);
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
@@ -117,8 +117,8 @@ public final class GrowingCrystalEntity extends AEBaseItemEntity {
|
||||
|
||||
if (this.progress_1000 >= len) {
|
||||
this.progress_1000 = 0;
|
||||
AppEng.proxy.spawnEffect(EffectType.Vibrant, this.world, this.getPosX(), this.getPosY() + 0.2,
|
||||
this.getPosZ(), null);
|
||||
AppEng.proxy.spawnEffect(EffectType.Vibrant, this.world, this.getX(), this.getY() + 0.2,
|
||||
this.getZ(), null);
|
||||
}
|
||||
} else {
|
||||
if (this.progress_1000 > 1000) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -74,8 +74,8 @@ public final class SingularityEntity extends AEBaseItemEntity {
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
|
||||
if (materials.singularity().isSameAs(item)) {
|
||||
final Box region = new Box(this.getPosX() - 4, this.getPosY() - 4, this.getPosZ() - 4,
|
||||
this.getPosX() + 4, this.getPosY() + 4, this.getPosZ() + 4);
|
||||
final Box region = new Box(this.getX() - 4, this.getY() - 4, this.getZ() - 4,
|
||||
this.getX() + 4, this.getY() + 4, this.getZ() + 4);
|
||||
final List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity(region);
|
||||
|
||||
for (final Entity e : l) {
|
||||
@@ -86,7 +86,7 @@ public final class SingularityEntity extends AEBaseItemEntity {
|
||||
|
||||
if (matches) {
|
||||
while (item.getCount() > 0 && other.getCount() > 0) {
|
||||
other.grow(-1);
|
||||
other.increment(-1);
|
||||
;
|
||||
if (other.getCount() == 0) {
|
||||
e.remove();
|
||||
@@ -96,11 +96,11 @@ public final class SingularityEntity extends AEBaseItemEntity {
|
||||
final CompoundTag cmp = singularityStack.getOrCreateTag();
|
||||
cmp.putLong("freq", (new Date()).getTime() * 100 + (randTickSeed) % 100);
|
||||
randTickSeed++;
|
||||
item.grow(-1);
|
||||
item.increment(-1);
|
||||
|
||||
final SingularityEntity entity = new SingularityEntity(this.world, this.getPosX(),
|
||||
this.getPosY(), this.getPosZ(), singularityStack);
|
||||
this.world.addEntity(entity);
|
||||
final SingularityEntity entity = new SingularityEntity(this.world, this.getX(),
|
||||
this.getY(), this.getZ(), singularityStack);
|
||||
this.world.spawnEntity(entity);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.entity.item.TNTEntity;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
@@ -69,9 +69,9 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
public void tick() {
|
||||
this.handleWaterMovement();
|
||||
|
||||
this.prevPosX = this.getPosX();
|
||||
this.prevPosY = this.getPosY();
|
||||
this.prevPosZ = this.getPosZ();
|
||||
this.prevX = this.getX();
|
||||
this.prevY = this.getY();
|
||||
this.prevZ = this.getZ();
|
||||
this.setMotion(this.getMotion().subtract(0, 0.03999999910593033D, 0));
|
||||
this.move(MoverType.SELF, this.getMotion());
|
||||
this.setMotion(this.getMotion().mul(0.9800000190734863D, 0.9800000190734863D, 0.9800000190734863D));
|
||||
@@ -83,15 +83,15 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
if (this.isInWater() && Platform.isServer()) // put out the fuse.
|
||||
{
|
||||
AEApi.instance().definitions().blocks().tinyTNT().maybeStack(1).ifPresent(tntStack -> {
|
||||
final ItemEntity item = new ItemEntity(this.world, this.getPosX(), this.getPosY(), this.getPosZ(),
|
||||
final ItemEntity item = new ItemEntity(this.world, this.getX(), this.getY(), this.getZ(),
|
||||
tntStack);
|
||||
|
||||
item.setMotion(this.getMotion());
|
||||
item.prevPosX = this.prevPosX;
|
||||
item.prevPosY = this.prevPosY;
|
||||
item.prevPosZ = this.prevPosZ;
|
||||
item.prevX = this.prevX;
|
||||
item.prevY = this.prevY;
|
||||
item.prevZ = this.prevZ;
|
||||
|
||||
this.world.addEntity(item);
|
||||
this.world.spawnEntity(item);
|
||||
this.remove();
|
||||
});
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
this.explode();
|
||||
}
|
||||
} else {
|
||||
this.world.addParticle(ParticleTypes.SMOKE, this.getPosX(), this.getPosY(), this.getPosZ(), 0.0D, 0.0D,
|
||||
this.world.addParticle(ParticleTypes.SMOKE, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D,
|
||||
0.0D);
|
||||
}
|
||||
this.setFuse(this.getFuse() - 1);
|
||||
@@ -112,7 +112,7 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
// override :P
|
||||
@Override
|
||||
protected void explode() {
|
||||
this.world.playSound(null, this.getPosX(), this.getPosY(), this.getPosZ(), SoundEvents.ENTITY_GENERIC_EXPLODE,
|
||||
this.world.playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE,
|
||||
SoundCategory.BLOCKS, 4.0F,
|
||||
(1.0F + (this.world.rand.nextFloat() - this.world.rand.nextFloat()) * 0.2F) * 32.9F);
|
||||
|
||||
@@ -120,11 +120,11 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
return;
|
||||
}
|
||||
|
||||
final Explosion ex = new Explosion(this.world, this, this.getPosX(), this.getPosY(), this.getPosZ(), 0.2f,
|
||||
final Explosion ex = new Explosion(this.world, this, this.getX(), this.getY(), this.getZ(), 0.2f,
|
||||
false, Mode.BREAK);
|
||||
final Box area = new Box(this.getPosX() - 1.5, this.getPosY() - 1.5f, this.getPosZ() - 1.5,
|
||||
this.getPosX() + 1.5, this.getPosY() + 1.5, this.getPosZ() + 1.5);
|
||||
final List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, area);
|
||||
final Box area = new Box(this.getX() - 1.5, this.getY() - 1.5f, this.getZ() - 1.5,
|
||||
this.getX() + 1.5, this.getY() + 1.5, this.getZ() + 1.5);
|
||||
final List<Entity> list = this.world.getEntities(this, area);
|
||||
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.world, ex, list, 0.2f * 2d);
|
||||
|
||||
@@ -133,11 +133,11 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
}
|
||||
|
||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.TINY_TNT_BLOCK_DAMAGE)) {
|
||||
this.setPosition(this.getPosX(), this.getPosY() - 0.25, this.getPosZ());
|
||||
this.setPosition(this.getX(), this.getY() - 0.25, this.getPosZ());
|
||||
|
||||
for (int x = (int) (this.getPosX() - 2); x <= this.getPosX() + 2; x++) {
|
||||
for (int y = (int) (this.getPosY() - 2); y <= this.getPosY() + 2; y++) {
|
||||
for (int z = (int) (this.getPosZ() - 2); z <= this.getPosZ() + 2; z++) {
|
||||
for (int x = (int) (this.getX() - 2); x <= this.getX() + 2; x++) {
|
||||
for (int y = (int) (this.getY() - 2); y <= this.getY() + 2; y++) {
|
||||
for (int z = (int) (this.getZ() - 2); z <= this.getZ() + 2; z++) {
|
||||
final BlockPos point = new BlockPos(x, y, z);
|
||||
final BlockState state = this.world.getBlockState(point);
|
||||
final Block block = state.getBlock();
|
||||
@@ -166,8 +166,8 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
}
|
||||
}
|
||||
|
||||
AppEng.proxy.sendToAllNearExcept(null, this.getPosX(), this.getPosY(), this.getPosZ(), 64, this.world,
|
||||
new MockExplosionPacket(this.getPosX(), this.getPosY(), this.getPosZ()));
|
||||
AppEng.proxy.sendToAllNearExcept(null, this.getX(), this.getY(), this.getZ(), 64, this.world,
|
||||
new MockExplosionPacket(this.getX(), this.getY(), this.getPosZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user