Fix most of entities

This commit is contained in:
Vincent Lee committed 2019-06-27 22:36:46 -07:00
1 parent 207a66b121
commit 828d952a86
21 files changed
+333 -193

No files matched your search

@@ -258,13 +258,13 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
private static final DataParameter<BlockPos> EXIT_POS = EntityDataManager.createKey(EntityPlayerMover.class, DataSerializers.BLOCK_POS);
public EntityPlayerMover(World world) {
super(TYPE, world);
public EntityPlayerMover(EntityType<EntityPlayerMover> type, World world) {
super(type, world);
noClip = true;
}
public EntityPlayerMover(World world, BlockPos pos, BlockPos exitPos) {
this(world);
this(TYPE, world);
setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
setExit(exitPos);
}
@@ -21,8 +21,12 @@ import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.util.DamageSource;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.Botania;
@@ -57,8 +61,8 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
private static final DataParameter<Integer> DELAY = EntityDataManager.createKey(EntityBabylonWeapon.class, DataSerializers.VARINT);
private static final DataParameter<Float> ROTATION = EntityDataManager.createKey(EntityBabylonWeapon.class, DataSerializers.FLOAT);
public EntityBabylonWeapon(World world) {
super(TYPE, world);
public EntityBabylonWeapon(EntityType<EntityBabylonWeapon> type, World world) {
super(type, world);
}
public EntityBabylonWeapon(LivingEntity thrower, World world) {
@@ -98,9 +102,7 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
}
}
double x = motionX;
double y = motionY;
double z = motionZ;
Vec3d mot = getMotion();
int liveTime = getLiveTicks();
int delay = getDelay();
@@ -119,17 +121,18 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
setMotion(Vec3d.ZERO);
} else if (liveTime == delay && player != null) {
Vector3 playerLook;
RayTraceResult lookat = ToolCommons.raytraceFromEntity(world, player, true, 64);
if(lookat == null)
RayTraceResult lookat = ToolCommons.raytraceFromEntity(world, player, RayTraceContext.FluidMode.SOURCE_ONLY, 64);
if(lookat.getType() != RayTraceResult.Type.BLOCK)
playerLook = new Vector3(player.getLookVec()).multiply(64).add(Vector3.fromEntity(player));
else playerLook = new Vector3(lookat.getBlockPos().getX() + 0.5, lookat.getBlockPos().getY() + 0.5, lookat.getBlockPos().getZ() + 0.5);
else {
BlockRayTraceResult rtr = (BlockRayTraceResult) lookat;
playerLook = new Vector3(rtr.getPos().getX() + 0.5, rtr.getPos().getY() + 0.5, rtr.getPos().getZ() + 0.5);
}
Vector3 thisVec = Vector3.fromEntityCenter(this);
Vector3 motionVec = playerLook.subtract(thisVec).normalize().multiply(2);
x = motionVec.x;
y = motionVec.y;
z = motionVec.z;
mot = motionVec.toVec3D();
world.playSound(null, posX, posY, posZ, ModSounds.babylonAttack, SoundCategory.PLAYERS, 2F, 0.1F + world.rand.nextFloat() * 3F);
}
setLiveTicks(liveTime + 1);
@@ -145,7 +148,7 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
if(player != null)
living.attackEntityFrom(DamageSource.causePlayerDamage(player), 20);
else living.attackEntityFrom(DamageSource.GENERIC, 20);
onImpact(new RayTraceResult(living));
onImpact(new EntityRayTraceResult(living));
return;
}
}
@@ -154,9 +157,7 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
super.tick();
motionX = x;
motionY = y;
motionZ = z;
setMotion(mot);
if(liveTime > delay)
Botania.proxy.wispFX(posX, posY, posZ, 1F, 1F, 0F, 0.3F, 0F);
@@ -168,8 +169,8 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
@Override
protected void onImpact(RayTraceResult pos) {
LivingEntity thrower = getThrower();
if(pos.entity == null || pos.entity != thrower) {
world.createExplosion(this, posX, posY, posZ, 3F, false);
if(pos.getType() != RayTraceResult.Type.ENTITY || ((EntityRayTraceResult) pos).getEntity() != thrower) {
world.createExplosion(this, posX, posY, posZ, 3F, Explosion.Mode.NONE);
remove();
}
}
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
@@ -27,6 +28,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.InvWithLocation;
@@ -41,7 +43,7 @@ import java.util.List;
public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
@ObjectHolder(LibMisc.MOD_ID + ":corporea_spark")
public static EntityType<?> TYPE;
public static EntityType<EntityCorporeaSpark> TYPE;
private static final int SCAN_RANGE = 8;
@@ -52,21 +54,23 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
private static final DataParameter<Boolean> MASTER = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.BOOLEAN);
private static final DataParameter<Integer> NETWORK = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.VARINT);
private static final DataParameter<Integer> ITEM_DISPLAY_TICKS = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.VARINT);
private static final DataParameter<ItemStack> DISPLAY_STACK = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.ITEM_STACK);
private static final DataParameter<ItemStack> DISPLAY_STACK = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.ITEMSTACK);
private ICorporeaSpark master;
private List<ICorporeaSpark> connections = new ArrayList<>();
private List<ICorporeaSpark> relatives = new ArrayList<>();
private boolean firstTick = true;
public EntityCorporeaSpark(EntityType<EntityCorporeaSpark> type, World world) {
super(type, world);
}
public EntityCorporeaSpark(World world) {
super(TYPE, world);
isImmuneToFire = true;
this(TYPE, world);
}
@Override
protected void registerData() {
setSize(0.1F, 0.5F);
dataManager.register(MASTER, false);
dataManager.register(NETWORK, 0);
dataManager.register(ITEM_DISPLAY_TICKS, 0);
@@ -303,6 +307,12 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
return false;
}
@Nonnull
@Override
public IPacket<?> createSpawnPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}
@Override
protected void readAdditional(@Nonnull CompoundNBT cmp) {
setMaster(cmp.getBoolean(TAG_MASTER));
@@ -96,7 +96,7 @@ import java.util.stream.Collectors;
public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEntityAdditionalSpawnData {
@ObjectHolder(LibMisc.MOD_ID + ":doppleganger")
public static EntityType<?> TYPE;
public static EntityType<EntityDoppleganger> TYPE;
public static final float ARENA_RANGE = 12F;
public static final int ARENA_HEIGHT = 5;
@@ -149,9 +149,8 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
private UUID bossInfoUUID = bossInfo.getUniqueId();
public PlayerEntity trueKiller = null;
public EntityDoppleganger(World world) {
super(TYPE, world);
setSize(0.6F, 1.8F);
public EntityDoppleganger(EntityType<EntityDoppleganger> type, World world) {
this(type, world);
isImmuneToFire = true;
experienceValue = 825;
if(world.isRemote) {
@@ -159,6 +158,10 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
}
}
public EntityDoppleganger(World world) {
this(TYPE, world);
}
public static MultiblockSet makeMultiblockSet() {
Multiblock mb = new Multiblock();
@@ -18,6 +18,8 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
@@ -31,10 +33,10 @@ import java.util.stream.Collectors;
public class EntityEnderAirBottle extends ThrowableEntity {
@ObjectHolder(LibMisc.MOD_ID + ":ender_air_bottle")
public static EntityType<?> TYPE;
public static EntityType<EntityEnderAirBottle> TYPE;
public EntityEnderAirBottle(World world) {
super(TYPE, world);
public EntityEnderAirBottle(EntityType<EntityEnderAirBottle> type, World world) {
super(type, world);
}
public EntityEnderAirBottle(LivingEntity entity, World world) {
@@ -43,8 +45,8 @@ public class EntityEnderAirBottle extends ThrowableEntity {
@Override
protected void onImpact(@Nonnull RayTraceResult pos) {
if(pos.type == RayTraceResult.Type.BLOCK && !world.isRemote) {
List<BlockPos> coordsList = getCoordsToPut(pos.getBlockPos());
if(pos.getType() == RayTraceResult.Type.BLOCK && !world.isRemote) {
List<BlockPos> coordsList = getCoordsToPut(((BlockRayTraceResult) pos).getPos());
world.playEvent(2002, new BlockPos(this), 8);
for(BlockPos coords : coordsList) {
@@ -61,11 +63,12 @@ public class EntityEnderAirBottle extends ThrowableEntity {
int range = 4;
int rangeY = 4;
for (BlockPos bPos : BlockPos.getAllInBox(pos.add(-range, -rangeY, -range), pos.add(range, rangeY, range))) {
for (BlockPos bPos : BlockPos.getAllInBoxMutable(pos.add(-range, -rangeY, -range),
pos.add(range, rangeY, range))) {
BlockState state = world.getBlockState(bPos);
Block block = state.getBlock();
if(block.isReplaceableOreGen(state, world, bPos, BlockStateMatcher.forBlock(Blocks.STONE)))
possibleCoords.add(bPos);
possibleCoords.add(bPos.toImmutable());
}
Collections.shuffle(possibleCoords, rand);
@@ -73,4 +76,6 @@ public class EntityEnderAirBottle extends ThrowableEntity {
return possibleCoords.stream().limit(64).collect(Collectors.toList());
}
@Override
protected void registerData() {}
}
@@ -12,11 +12,15 @@ package vazkii.botania.common.entity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
@@ -29,18 +33,19 @@ import vazkii.botania.common.lib.LibMisc;
public class EntityFallingStar extends EntityThrowableCopy {
@ObjectHolder(LibMisc.MOD_ID + ":falling_star")
public static EntityType<?> TYPE;
public static EntityType<EntityFallingStar> TYPE;
public EntityFallingStar(World world) {
super(TYPE, world);
setSize(0F, 0F);
public EntityFallingStar(EntityType<EntityFallingStar> type, World world) {
super(type, world);
}
public EntityFallingStar(LivingEntity e, World world) {
super(TYPE, e, world);
setSize(0F, 0F);
}
@Override
protected void registerData() {}
@Override
public void tick() {
super.tick();
@@ -62,7 +67,7 @@ public class EntityFallingStar extends EntityThrowableCopy {
continue;
if(living.hurtTime == 0) {
onImpact(new RayTraceResult(living));
onImpact(new EntityRayTraceResult(living));
return;
}
}
@@ -78,16 +83,20 @@ public class EntityFallingStar extends EntityThrowableCopy {
return;
LivingEntity thrower = getThrower();
if(pos.entity != null && thrower != null && pos.entity != thrower && !pos.entity.removed) {
if(thrower instanceof PlayerEntity)
pos.entity.attackEntityFrom(DamageSource.causePlayerDamage((PlayerEntity) thrower), Math.random() < 0.25 ? 10 : 5);
else pos.entity.attackEntityFrom(DamageSource.GENERIC, Math.random() < 0.25 ? 10 : 5);
if(pos.getType() == RayTraceResult.Type.ENTITY && thrower != null ) {
Entity e = ((EntityRayTraceResult) pos).getEntity();
if(e != thrower && e.isAlive()) {
if(thrower instanceof PlayerEntity)
e.attackEntityFrom(DamageSource.causePlayerDamage((PlayerEntity) thrower), Math.random() < 0.25 ? 10 : 5);
else e.attackEntityFrom(DamageSource.GENERIC, Math.random() < 0.25 ? 10 : 5);
}
}
if (pos.getBlockPos() != null) {
BlockState state = world.getBlockState(pos.getBlockPos());
if(ConfigHandler.COMMON.blockBreakParticles.get() && !state.getBlock().isAir(state, world, pos.getBlockPos()))
world.playEvent(2001, pos.getBlockPos(), Block.getStateId(state));
if (pos.getType() == RayTraceResult.Type.BLOCK) {
BlockPos bpos = ((BlockRayTraceResult) pos).getPos();
BlockState state = world.getBlockState(bpos);
if(ConfigHandler.COMMON.blockBreakParticles.get() && !state.isAir(world, bpos))
world.playEvent(2001, bpos, Block.getStateId(state));
}
remove();
@@ -34,11 +34,14 @@ import java.util.List;
public class EntityFlameRing extends Entity {
@ObjectHolder(LibMisc.MOD_ID + ":flame_ring")
public static EntityType<?> TYPE;
public static EntityType<EntityFlameRing> TYPE;
public EntityFlameRing(EntityType<EntityFlameRing> type, World world) {
super(type, world);
}
public EntityFlameRing(World world) {
super(TYPE, world);
setSize(0F, 0F);
this(TYPE, world);
}
@Override
@@ -21,6 +21,7 @@ import net.minecraft.potion.EffectInstance;
import net.minecraft.util.DamageSource;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.Botania;
@@ -34,20 +35,21 @@ import java.util.List;
public class EntityMagicLandmine extends Entity {
@ObjectHolder(LibMisc.MOD_ID + ":magic_landmine")
public static EntityType<?> TYPE;
public static EntityType<EntityMagicLandmine> TYPE;
public EntityDoppleganger summoner;
public EntityMagicLandmine(EntityType<EntityMagicLandmine> type, World world) {
super(type, world);
}
public EntityMagicLandmine(World world) {
super(TYPE, world);
setSize(0F, 0F);
this(TYPE, world);
}
@Override
public void tick() {
motionX = 0;
motionY = 0;
motionZ = 0;
setMotion(Vec3d.ZERO);
super.tick();
float range = 2.5F;
@@ -26,6 +26,8 @@ import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
@@ -38,7 +40,7 @@ import java.util.List;
public class EntityMagicMissile extends ThrowableEntity {
@ObjectHolder(LibMisc.MOD_ID + ":magic_missile")
public static EntityType<?> TYPE;
public static EntityType<EntityMagicMissile> TYPE;
private static final String TAG_TIME = "time";
private static final DataParameter<Boolean> EVIL = EntityDataManager.createKey(EntityMagicMissile.class, DataSerializers.BOOLEAN);
@@ -47,14 +49,16 @@ public class EntityMagicMissile extends ThrowableEntity {
double lockX, lockY = -1, lockZ;
int time = 0;
public EntityMagicMissile(EntityType<EntityMagicMissile> type, World world) {
super(type, world);
}
public EntityMagicMissile(World world) {
super(TYPE, world);
setSize(0F, 0F);
this(TYPE, world);
}
public EntityMagicMissile(LivingEntity thrower, boolean evil) {
super(TYPE, thrower, thrower.world);
setSize(0F, 0F);
setEvil(evil);
}
@@ -127,11 +131,9 @@ public class EntityMagicMissile extends ThrowableEntity {
Vector3 targetVec = evil ? new Vector3(lockX, lockY, lockZ) : Vector3.fromEntityCenter(target);
Vector3 diffVec = targetVec.subtract(thisVec);
Vector3 motionVec = diffVec.normalize().multiply(evil ? 0.5 : 0.6);
motionX = motionVec.x;
motionY = motionVec.y;
setMotion(motionVec.toVec3D());
if(time < 10)
motionY = Math.abs(motionY);
motionZ = motionVec.z;
setMotion(getMotion().getX(), Math.abs(getMotion().getY()), getMotion().getZ());
List<LivingEntity> targetList = world.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5));
if(targetList.contains(target)) {
@@ -166,7 +168,7 @@ public class EntityMagicMissile extends ThrowableEntity {
public boolean findTarget() {
LivingEntity target = getTargetEntity();
if(target != null && target.getHealth() > 0 && !target.removed && world.loadedEntityList.contains(target))
if(target != null && target.isAlive())
return true;
if(target != null)
setTarget(null);
@@ -181,7 +183,7 @@ public class EntityMagicMissile extends ThrowableEntity {
}
while(entities.size() > 0) {
Entity e = (Entity) entities.get(world.rand.nextInt(entities.size()));
if(!(e instanceof LivingEntity) || e.removed) { // Just in case...
if(!(e instanceof LivingEntity) || !e.isAlive()) { // Just in case...
entities.remove(e);
continue;
}
@@ -196,15 +198,15 @@ public class EntityMagicMissile extends ThrowableEntity {
@Override
protected void onImpact(@Nonnull RayTraceResult pos) {
switch (pos.type) {
switch (pos.getType()) {
case BLOCK: {
Block block = world.getBlockState(pos.getBlockPos()).getBlock();
Block block = world.getBlockState(((BlockRayTraceResult) pos).getPos()).getBlock();
if(!(block instanceof BushBlock) && !(block instanceof LeavesBlock))
remove();
break;
}
case ENTITY: {
if (pos.entity == getTargetEntity())
if (((EntityRayTraceResult) pos).getEntity() == getTargetEntity())
remove();
break;
}
@@ -105,20 +105,22 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
public final List<PositionProperties> propsList = new ArrayList<>();
public EntityManaBurst(World world) {
super(TYPE, world);
setSize(0F, 0F);
this(TYPE, world);
}
public EntityManaBurst(EntityType<EntityManaBurst> type, World world) {
super(type, world);
}
@Override
protected void registerData() {
super.registerData();
dataManager.register(COLOR, 0);
dataManager.register(MANA, 0);
dataManager.register(START_MANA, 0);
dataManager.register(MIN_MANA_LOSS, 0);
dataManager.register(MANA_LOSS_PER_TICK, 0F);
dataManager.register(GRAVITY, 0F);
dataManager.register(SOURCE_COORDS, BlockPos.ORIGIN);
dataManager.register(SOURCE_COORDS, BlockPos.ZERO);
dataManager.register(SOURCE_LENS, ItemStack.EMPTY);
}
@@ -14,7 +14,10 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.ModItems;
@@ -24,7 +27,7 @@ import javax.annotation.Nonnull;
public class EntityManaStorm extends Entity {
@ObjectHolder(LibMisc.MOD_ID + ":mana_storm")
public static EntityType<?> TYPE;
public static EntityType<EntityManaStorm> TYPE;
private static final String TAG_TIME = "time";
private static final String TAG_BURSTS_FIRED = "burstsFired";
@@ -37,8 +40,12 @@ public class EntityManaStorm extends Entity {
public int burstsFired;
public int deathTime;
public EntityManaStorm(EntityType<EntityManaStorm> type, World world) {
super(type, world);
}
public EntityManaStorm(World world) {
super(TYPE, world);
this(TYPE, world);
}
@Override
@@ -60,7 +67,7 @@ public class EntityManaStorm extends Entity {
deathTime++;
if(deathTime >= DEATH_TIME) {
remove();
world.newExplosion(this, posX, posY, posZ, 8F, true, true);
world.createExplosion(this, posX, posY, posZ, 8F, true, Explosion.Mode.DESTROY);
}
}
}
@@ -98,4 +105,10 @@ public class EntityManaStorm extends Entity {
cmp.putInt(TAG_DEATH_TIME, deathTime);
}
@Nonnull
@Override
public IPacket<?> createSpawnPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}
}
@@ -32,10 +32,14 @@ import javax.annotation.Nonnull;
public class EntityPinkWither extends WitherEntity {
@ObjectHolder(LibMisc.MOD_ID + ":pink_wither")
public static EntityType<?> TYPE;
public static EntityType<EntityPinkWither> TYPE;
public EntityPinkWither(EntityType<EntityPinkWither> type, World world) {
super(type, world);
}
public EntityPinkWither(World world) {
super(world);
super(TYPE, world);
tasks.taskEntries.removeIf(entry -> entry.action instanceof RangedAttackGoal); // Remove firing wither skulls
@@ -43,12 +47,6 @@ public class EntityPinkWither extends WitherEntity {
|| entry.action instanceof NearestAttackableTargetGoal); // Remove revenge and aggro
}
@Nonnull
@Override
public EntityType<?> getType() {
return TYPE;
}
@Override
public void livingTick() {
super.livingTick();
@@ -77,9 +75,6 @@ public class EntityPinkWither extends WitherEntity {
return false;
}
@Override
protected void dropFewItems(boolean wasRecentlyHit, int lootingModifier) {}
@Override
public void addTrackingPlayer(@Nonnull ServerPlayerEntity player) {}
@@ -33,16 +33,19 @@ import vazkii.botania.common.lib.LibMisc;
public class EntityPixie extends FlyingEntity {
@ObjectHolder(LibMisc.MOD_ID + ":pixie")
public static EntityType<?> TYPE;
public static EntityType<EntityPixie> TYPE;
private static final DataParameter<Integer> PIXIE_TYPE = EntityDataManager.createKey(EntityPixie.class, DataSerializers.VARINT);
private LivingEntity summoner = null;
private float damage = 0;
private EffectInstance effect = null;
public EntityPixie(EntityType<EntityPixie> type, World world) {
super(type, world);
}
public EntityPixie(World world) {
super(TYPE, world);
setSize(1.0F, 1.0F);
this(TYPE, world);
}
@Override
@@ -42,13 +42,13 @@ import java.awt.Color;
public class EntityPoolMinecart extends AbstractMinecartEntity {
@ObjectHolder(LibMisc.MOD_ID + ":pool_minecart")
public static EntityType<?> TYPE;
public static EntityType<EntityPoolMinecart> TYPE;
private static final int TRANSFER_RATE = 10000;
private static final String TAG_MANA = "mana";
private static final DataParameter<Integer> MANA = EntityDataManager.createKey(EntityPoolMinecart.class, DataSerializers.VARINT);
public EntityPoolMinecart(World world) {
super(TYPE, world);
public EntityPoolMinecart(EntityType<EntityPoolMinecart> type, World world) {
super(type, world);
}
public EntityPoolMinecart(World world, double x, double y, double z) {
@@ -87,10 +87,7 @@ public class EntityPoolMinecart extends AbstractMinecartEntity {
@Override
protected void applyDrag() {
float f = 0.98F;
this.motionX *= (double)f;
this.motionY *= 0.0D;
this.motionZ *= (double)f;
this.setMotion(getMotion().mul(f, 0, f));
}
@@ -29,15 +29,18 @@ import javax.annotation.Nonnull;
public class EntitySignalFlare extends Entity {
@ObjectHolder(LibMisc.MOD_ID + ":signal_flare")
public static EntityType<?> TYPE;
public static EntityType<EntitySignalFlare> TYPE;
private static final String COLOR_TAG = "color";
private static final String FIRED_Y_TAG = "firedY";
private static final DataParameter<Integer> COLOR = EntityDataManager.createKey(EntitySignalFlare.class, DataSerializers.VARINT);
private static final DataParameter<Integer> FIRED_Y = EntityDataManager.createKey(EntitySignalFlare.class, DataSerializers.VARINT);
public EntitySignalFlare(EntityType<EntitySignalFlare> type, World world) {
super(type, world);
}
public EntitySignalFlare(World world) {
super(TYPE, world);
setSize(0F, 0F);
this(TYPE, world);
}
@Override
@@ -16,6 +16,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
@@ -25,6 +26,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.BotaniaAPI;
@@ -53,7 +55,7 @@ import javax.annotation.Nonnull;
public class EntitySpark extends Entity implements ISparkEntity {
@ObjectHolder(LibMisc.MOD_ID + ":spark")
public static EntityType<?> TYPE;
public static EntityType<EntitySpark> TYPE;
private static final int TRANSFER_RATE = 1000;
private static final String TAG_UPGRADE = "upgrade";
private static final String TAG_INVIS = "invis";
@@ -63,10 +65,12 @@ public class EntitySpark extends Entity implements ISparkEntity {
private int removeTransferants = 2;
public EntitySpark(EntityType<EntitySpark> type, World world) {
super(type, world);
}
public EntitySpark(World world) {
super(TYPE, world);
isImmuneToFire = true;
setSize(0.1F, 0.5F);
this(TYPE, world);
}
@Override
@@ -96,13 +100,13 @@ public class EntitySpark extends Entity implements ISparkEntity {
SparkUpgradeType upgrade = getUpgrade();
List<ISparkEntity> allSparks = null;
if(upgrade == SparkUpgradeType.DOMINANT || upgrade == SparkUpgradeType.RECESSIVE)
allSparks = SparkHelper.getSparksAround(world, posX, posY + (height / 2.0), posZ);
allSparks = SparkHelper.getSparksAround(world, posX, posY + (getHeight() / 2.0), posZ);
Collection<ISparkEntity> transfers = getTransfers();
switch(upgrade) {
case DISPERSIVE : {
List<PlayerEntity> players = SparkHelper.getEntitiesAround(PlayerEntity.class, world, posX, posY + (height / 2.0), posZ);
List<PlayerEntity> players = SparkHelper.getEntitiesAround(PlayerEntity.class, world, posX, posY + (getHeight() / 2.0), posZ);
Map<PlayerEntity, Map<ItemStack, Integer>> receivingPlayers = new HashMap<>();
@@ -264,7 +268,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
} else dropAndKill();
return true;
} else {
for(ISparkEntity spark : SparkHelper.getSparksAround(world, posX, posY + (height / 2.0), posZ))
for(ISparkEntity spark : SparkHelper.getSparksAround(world, posX, posY + (getHeight() / 2.0), posZ))
particleBeam(player, this, (Entity) spark);
return true;
}
@@ -281,6 +285,12 @@ public class EntitySpark extends Entity implements ISparkEntity {
return false;
}
@Nonnull
@Override
public IPacket<?> createSpawnPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}
@Override
protected void readAdditional(@Nonnull CompoundNBT cmp) {
setUpgrade(SparkUpgradeType.values()[cmp.getInt(TAG_UPGRADE)]);
@@ -29,7 +29,10 @@ import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.core.helper.Vector3;
@@ -40,7 +43,7 @@ import javax.annotation.Nonnull;
public class EntityThornChakram extends ThrowableEntity {
@ObjectHolder(LibMisc.MOD_ID + ":thorn_chakram")
public static EntityType<?> TYPE;
public static EntityType<EntityThornChakram> TYPE;
private static final DataParameter<Integer> BOUNCES = EntityDataManager.createKey(EntityThornChakram.class, DataSerializers.VARINT);
private static final DataParameter<Boolean> FLARE = EntityDataManager.createKey(EntityThornChakram.class, DataSerializers.BOOLEAN);
@@ -49,8 +52,8 @@ public class EntityThornChakram extends ThrowableEntity {
private boolean bounced = false;
private ItemStack stack = ItemStack.EMPTY;
public EntityThornChakram(World world) {
super(TYPE, world);
public EntityThornChakram(EntityType<EntityThornChakram> type, World world) {
super(type, world);
}
public EntityThornChakram(LivingEntity e, World world, ItemStack stack) {
@@ -60,7 +63,6 @@ public class EntityThornChakram extends ThrowableEntity {
@Override
protected void registerData() {
super.registerData();
dataManager.register(BOUNCES, 0);
dataManager.register(FLARE, false);
dataManager.register(RETURN_TO, -1);
@@ -74,17 +76,13 @@ public class EntityThornChakram extends ThrowableEntity {
@Override
public void tick() {
// Standard motion
double mx = motionX;
double my = motionY;
double mz = motionZ;
Vec3d old = getMotion();
super.tick();
if(!bounced) {
// Reset the drag applied by super
motionX = mx;
motionY = my;
motionZ = mz;
setMotion(old);
}
bounced = false;
@@ -94,9 +92,7 @@ public class EntityThornChakram extends ThrowableEntity {
Entity thrower = getThrower();
if(thrower != null) {
Vector3 motion = Vector3.fromEntityCenter(thrower).subtract(Vector3.fromEntityCenter(this)).normalize();
motionX = motion.x;
motionY = motion.y;
motionZ = motion.z;
setMotion(motion.toVec3D());
}
}
@@ -139,22 +135,21 @@ public class EntityThornChakram extends ThrowableEntity {
if(isReturning())
return;
switch (pos.type) {
switch (pos.getType()) {
case BLOCK: {
Block block = world.getBlockState(pos.getBlockPos()).getBlock();
BlockRayTraceResult rtr = (BlockRayTraceResult) pos;
Block block = world.getBlockState(rtr.getPos()).getBlock();
if(block instanceof BushBlock || block instanceof LeavesBlock)
return;
int bounces = getTimesBounced();
if(bounces < MAX_BOUNCES) {
Vector3 currentMovementVec = new Vector3(motionX, motionY, motionZ);
Direction dir = pos.sideHit;
Vector3 currentMovementVec = new Vector3(getMotion());
Direction dir = rtr.getFace();
Vector3 normalVector = new Vector3(dir.getXOffset(), dir.getYOffset(), dir.getZOffset()).normalize();
Vector3 movementVec = normalVector.multiply(-2 * currentMovementVec.dotProduct(normalVector)).add(currentMovementVec);
motionX = movementVec.x;
motionY = movementVec.y;
motionZ = movementVec.z;
setMotion(movementVec.toVec3D());
bounced = true;
if(!world.isRemote)
@@ -164,13 +159,18 @@ public class EntityThornChakram extends ThrowableEntity {
break;
}
case ENTITY: {
if(!world.isRemote && pos.entity != null && pos.entity instanceof LivingEntity && pos.entity != getThrower()) {
EntityRayTraceResult rtr = (EntityRayTraceResult) pos;
if(!world.isRemote && rtr.getEntity() instanceof LivingEntity && rtr.getEntity() != getThrower()) {
LivingEntity thrower = getThrower();
pos.entity.attackEntityFrom(thrower != null ? thrower instanceof PlayerEntity ? DamageSource.causeThrownDamage(this, thrower) : DamageSource.causeMobDamage(thrower) : DamageSource.GENERIC, 12);
rtr.getEntity().attackEntityFrom(thrower != null
? thrower instanceof PlayerEntity
? DamageSource.causeThrownDamage(this, thrower)
: DamageSource.causeMobDamage(thrower)
: DamageSource.GENERIC, 12);
if(isFire())
pos.entity.setFire(5);
rtr.getEntity().setFire(5);
else if(world.rand.nextInt(3) == 0)
((LivingEntity) pos.entity).addPotionEffect(new EffectInstance(Effects.POISON, 60, 0));
((LivingEntity) rtr.getEntity()).addPotionEffect(new EffectInstance(Effects.POISON, 60, 0));
}
break;
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.block.Blocks;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@@ -26,13 +27,18 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Optional;
public class EntityThrownItem extends ItemEntity {
@ObjectHolder(LibMisc.MOD_ID + ":thrown_item")
public static EntityType<?> TYPE;
public static EntityType<EntityThrownItem> TYPE;
public EntityThrownItem(EntityType<EntityThrownItem> type, World world) {
super(type, world);
}
public EntityThrownItem(World world) {
super(world);
this(TYPE, world);
setInvulnerable(true);
}
@@ -40,9 +46,7 @@ public class EntityThrownItem extends ItemEntity {
double y, double z, ItemEntity item) {
super(world, x, y, z, item.getItem());
setPickupDelay(item.pickupDelay);
motionX = item.motionX;
motionY = item.motionY;
motionZ = item.motionZ;
setMotion(item.getMotion());
setInvulnerable(true);
}
@@ -56,25 +60,25 @@ public class EntityThrownItem extends ItemEntity {
public void tick() {
super.tick();
Vec3d vec3 = new Vec3d(posX, posY, posZ);
Vec3d vec31 = new Vec3d(posX + motionX, posY + motionY, posZ + motionZ);
Vec3d vec31 = getPositionVec().add(getMotion());
RayTraceResult RayTraceResult = world.rayTraceBlocks(vec3, vec31);
RayTraceResult ray = world.rayTraceBlocks(vec3, vec31);
if (!world.isRemote)
{
Entity entity = null;
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(this, getBoundingBox().offset(motionX*2, motionY*2, motionZ*2).grow(2));
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(this, getBoundingBox().offset(getMotion().scale(2)).grow(2));
double d0 = 0.0D;
for (Entity entity1 : list) {
if (entity1.canBeCollidedWith() && (!(entity1 instanceof PlayerEntity) || pickupDelay == 0)) {
float f = 1.0F;
AxisAlignedBB axisalignedbb = entity1.getBoundingBox().grow(f);
RayTraceResult RayTraceResult1 = axisalignedbb.calculateIntercept(vec3, vec31);
Optional<Vec3d> ray1 = axisalignedbb.rayTrace(vec3, vec31);
if (RayTraceResult1 != null) {
double d1 = vec3.distanceTo(RayTraceResult1.hitVec);
if (ray1.isPresent()) {
double d1 = vec3.distanceTo(ray1.get());
if (d1 < d0 || d0 == 0.0D) {
entity = entity1;
@@ -86,20 +90,20 @@ public class EntityThrownItem extends ItemEntity {
if (entity != null)
{
RayTraceResult = new RayTraceResult(entity);
ray = new EntityRayTraceResult(entity);
}
}
if (RayTraceResult != null)
if (ray != null)
{
if (RayTraceResult.type == net.minecraft.util.math.RayTraceResult.Type.BLOCK && world.getBlockState(RayTraceResult.getBlockPos()).getBlock() == Blocks.NETHER_PORTAL)
if (ray.getType() == net.minecraft.util.math.RayTraceResult.Type.BLOCK && world.getBlockState(ray.getBlockPos()).getBlock() == Blocks.NETHER_PORTAL)
{
setPortal(RayTraceResult.getBlockPos());
setPortal(ray.getBlockPos());
}
else
{
if (RayTraceResult.type != null) {
RayTraceResult.entity.attackEntityFrom(DamageSource.MAGIC, 2.0F);
if (ray.type != null) {
ray.entity.attackEntityFrom(DamageSource.MAGIC, 2.0F);
if (!world.isRemote) {
Entity item = getItem().getItem().createEntity(world, this, getItem());
if (item == null) {
@@ -40,14 +40,18 @@ import java.util.Map;
public class EntityVineBall extends ThrowableEntity {
@ObjectHolder(LibMisc.MOD_ID + ":vine_ball")
public static EntityType<?> TYPE;
public static EntityType<EntityVineBall> TYPE;
private static final DataParameter<Float> GRAVITY = EntityDataManager.createKey(EntityVineBall.class, DataSerializers.FLOAT);
private static final Map<Direction, BooleanProperty> propMap = ImmutableMap.of(Direction.NORTH, VineBlock.NORTH, Direction.SOUTH, VineBlock.SOUTH,
Direction.WEST, VineBlock.WEST, Direction.EAST, VineBlock.EAST);
public EntityVineBall(World world) {
super(TYPE, world);
this(TYPE, world);
}
public EntityVineBall(EntityType<EntityVineBall> type, World world) {
super(type, world);
}
public EntityVineBall(LivingEntity thrower, boolean gravity) {
@@ -57,7 +61,6 @@ public class EntityVineBall extends ThrowableEntity {
@Override
protected void registerData() {
super.registerData();
dataManager.register(GRAVITY, 0F);
}
@@ -10,6 +10,7 @@
*/
package vazkii.botania.common.entity;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@@ -22,64 +23,139 @@ import vazkii.botania.common.lib.LibMisc;
public final class ModEntities {
@SubscribeEvent
public static void registerEntities(RegistryEvent.Register<EntityType<?>> evt) {
evt.getRegistry().register(EntityType.Builder.create(EntityManaBurst.class, EntityManaBurst::new)
.tracker(64, 10, true).build("")
evt.getRegistry().register(EntityType.Builder.<EntityManaBurst>create(
EntityManaBurst::new, EntityClassification.MISC)
.size(0, 0)
.setUpdateInterval(10)
.setTrackingRange(64)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.MANA_BURST));
evt.getRegistry().register(EntityType.Builder.create(EntitySignalFlare.class, EntitySignalFlare::new)
.tracker(2048, 10, false).build("")
evt.getRegistry().register(EntityType.Builder.<EntitySignalFlare>create(
EntitySignalFlare::new, EntityClassification.MISC)
.size(0, 0)
.setUpdateInterval(10)
.setTrackingRange(2048)
.setShouldReceiveVelocityUpdates(false)
.build("")
.setRegistryName(LibEntityNames.SIGNAL_FLARE));
evt.getRegistry().register(EntityType.Builder.create(EntityPixie.class, EntityPixie::new)
.tracker(16, 3, true).build("")
evt.getRegistry().register(EntityType.Builder.<EntityPixie>create(EntityPixie::new, EntityClassification.MISC)
.size(1, 1)
.setUpdateInterval(3)
.setTrackingRange(16)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.PIXIE));
evt.getRegistry().register(EntityType.Builder.create(EntityFlameRing.class, EntityFlameRing::new)
.tracker(32, 40, false).build("")
evt.getRegistry().register(EntityType.Builder.<EntityFlameRing>create(EntityFlameRing::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(32)
.setUpdateInterval(40)
.setShouldReceiveVelocityUpdates(false)
.build("")
.setRegistryName(LibEntityNames.FLAME_RING));
evt.getRegistry().register(EntityType.Builder.create(EntityVineBall.class, EntityVineBall::new)
.tracker(64, 10, true).build("")
evt.getRegistry().register(EntityType.Builder.<EntityVineBall>create(EntityVineBall::new, EntityClassification.MISC)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.VINE_BALL));
evt.getRegistry().register(EntityType.Builder.create(EntityDoppleganger.class, EntityDoppleganger::new)
.tracker(128, 10, true).build("")
evt.getRegistry().register(EntityType.Builder.<EntityDoppleganger>create(EntityDoppleganger::new, EntityClassification.MONSTER)
.size(0.6F, 1.8F)
.setTrackingRange(128)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.DOPPLEGANGER));
evt.getRegistry().register(EntityType.Builder.create(EntityMagicLandmine.class, EntityMagicLandmine::new)
.tracker(128, 40, false).build("")
evt.getRegistry().register(EntityType.Builder.<EntityMagicLandmine>create(EntityMagicLandmine::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(128)
.setUpdateInterval(40)
.setShouldReceiveVelocityUpdates(false)
.build("")
.setRegistryName(LibEntityNames.MAGIC_LANDMINE));
evt.getRegistry().register(EntityType.Builder.create(EntitySpark.class, EntitySpark::new)
.tracker(64, 10, false).build("")
evt.getRegistry().register(EntityType.Builder.<EntitySpark>create(EntitySpark::new, EntityClassification.MISC)
.size(0.1F, 0.5F)
.immuneToFire()
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(false)
.build("")
.setRegistryName(LibEntityNames.SPARK));
evt.getRegistry().register(EntityType.Builder.create(EntityThrownItem.class, EntityThrownItem::new)
.tracker(64, 20, true).build("")
evt.getRegistry().register(EntityType.Builder.<EntityThrownItem>create(EntityThrownItem::new, EntityClassification.MISC)
.size(0.25F, 0.25F)
.setTrackingRange(64)
.setUpdateInterval(20)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.THROWN_ITEM));
evt.getRegistry().register(EntityType.Builder.create(EntityMagicMissile.class, EntityMagicMissile::new)
.tracker(64, 2, true).build("")
evt.getRegistry().register(EntityType.Builder.<EntityMagicMissile>create(EntityMagicMissile::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(64)
.setUpdateInterval(2)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.MAGIC_MISSILE));
evt.getRegistry().register(EntityType.Builder.create(EntityThornChakram.class, EntityThornChakram::new)
.tracker(64, 10, true).build("")
evt.getRegistry().register(EntityType.Builder.<EntityThornChakram>create(EntityThornChakram::new, EntityClassification.MISC)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.THORN_CHAKRAM));
evt.getRegistry().register(EntityType.Builder.create(EntityCorporeaSpark.class, EntityCorporeaSpark::new)
.tracker(64, 10, false).build("")
evt.getRegistry().register(EntityType.Builder.<EntityCorporeaSpark>create(EntityCorporeaSpark::new, EntityClassification.MISC)
.size(0.1F, 0.5F)
.immuneToFire()
.setTrackingRange(64)
.setUpdateInterval(40)
.setShouldReceiveVelocityUpdates(false)
.build("")
.setRegistryName(LibEntityNames.CORPOREA_SPARK));
evt.getRegistry().register(EntityType.Builder.create(EntityEnderAirBottle.class, EntityEnderAirBottle::new)
.tracker(64, 10, true).build("")
evt.getRegistry().register(EntityType.Builder.<EntityEnderAirBottle>create(EntityEnderAirBottle::new, EntityClassification.MISC)
.size(0.25F, 0.25F)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.ENDER_AIR_BOTTLE));
evt.getRegistry().register(EntityType.Builder.create(EntityPoolMinecart.class, EntityPoolMinecart::new)
.tracker(80, 3, true).build("")
evt.getRegistry().register(EntityType.Builder.<EntityPoolMinecart>create(EntityPoolMinecart::new, EntityClassification.MISC)
.size(0.98F, 0.7F)
.setTrackingRange(80)
.setUpdateInterval(3)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.POOL_MINECART));
evt.getRegistry().register(EntityType.Builder.create(EntityPinkWither.class, EntityPinkWither::new)
.tracker(80, 3, false).build("")
evt.getRegistry().register(EntityType.Builder.<EntityPinkWither>create(EntityPinkWither::new, EntityClassification.MISC)
.size(0.9F, 3.5F)
.setTrackingRange(80)
.setUpdateInterval(3)
.setShouldReceiveVelocityUpdates(false)
.build("")
.setRegistryName(LibEntityNames.PINK_WITHER));
evt.getRegistry().register(EntityType.Builder.create(EntityPlayerMover.class, EntityPlayerMover::new)
evt.getRegistry().register(EntityType.Builder.<EntityPlayerMover>create(EntityPlayerMover::new, EntityClassification.MISC)
.size(0, 0)
.tracker(40, 3, true).build("")
.setTrackingRange(40)
.setUpdateInterval(3)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.PLAYER_MOVER));
evt.getRegistry().register(EntityType.Builder.create(EntityManaStorm.class, EntityManaStorm::new)
.tracker(64, 10, false).build("")
evt.getRegistry().register(EntityType.Builder.<EntityManaStorm>create(EntityManaStorm::new, EntityClassification.MISC)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(false)
.build("")
.setRegistryName(LibEntityNames.MANA_STORM));
evt.getRegistry().register(EntityType.Builder.create(EntityBabylonWeapon.class, EntityBabylonWeapon::new)
evt.getRegistry().register(EntityType.Builder.<EntityBabylonWeapon>create(EntityBabylonWeapon::new, EntityClassification.MISC)
.size(0, 0)
.tracker(64, 10, true).build("")
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.BABYLON_WEAPON));
evt.getRegistry().register(EntityType.Builder.create(EntityFallingStar.class, EntityFallingStar::new)
.tracker(64, 10, true).build("")
evt.getRegistry().register(EntityType.Builder.<EntityFallingStar>create(EntityFallingStar::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.FALLING_STAR));
}
@@ -27,7 +27,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceFluidMode;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;