De-objectholderify entities

This commit is contained in:
Vincent Lee committed 2020-06-22 18:30:41 -05:00
1 parent f05ca91f09
commit ec91903ff9
27 files changed
+194 -255

No files matched your search

@@ -93,26 +93,26 @@ public final class ModelHandler {
ClientRegistry.bindTileEntityRenderer(TileAvatar.TYPE, RenderTileAvatar::new);
ClientRegistry.bindTileEntityRenderer(TileAnimatedTorch.TYPE, RenderTileAnimatedTorch::new);
RenderingRegistry.registerEntityRenderingHandler(EntityManaBurst.TYPE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(TileLightRelay.EntityPlayerMover.TYPE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(EntitySignalFlare.TYPE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(EntityFlameRing.TYPE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(EntityMagicLandmine.TYPE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(EntityMagicMissile.TYPE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(EntityFallingStar.TYPE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(EntityThrownItem.TYPE, m -> new ItemRenderer(m, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(EntityPixie.TYPE, RenderPixie::new);
RenderingRegistry.registerEntityRenderingHandler(EntityDoppleganger.TYPE, RenderDoppleganger::new);
RenderingRegistry.registerEntityRenderingHandler(EntitySpark.TYPE, RenderSpark::new);
RenderingRegistry.registerEntityRenderingHandler(EntityCorporeaSpark.TYPE, RenderCorporeaSpark::new);
RenderingRegistry.registerEntityRenderingHandler(EntityPoolMinecart.TYPE, RenderPoolMinecart::new);
RenderingRegistry.registerEntityRenderingHandler(EntityPinkWither.TYPE, RenderPinkWither::new);
RenderingRegistry.registerEntityRenderingHandler(EntityManaStorm.TYPE, RenderManaStorm::new);
RenderingRegistry.registerEntityRenderingHandler(EntityBabylonWeapon.TYPE, RenderBabylonWeapon::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.MANA_BURST, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.PLAYER_MOVER, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.SIGNAL_FLARE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.FLAME_RING, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.MAGIC_LANDMINE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.MAGIC_MISSILE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.FALLING_STAR, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.THROWN_ITEM, m -> new ItemRenderer(m, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.PIXIE, RenderPixie::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.DOPPLEGANGER, RenderDoppleganger::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.SPARK, RenderSpark::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.CORPOREA_SPARK, RenderCorporeaSpark::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.POOL_MINECART, RenderPoolMinecart::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.PINK_WITHER, RenderPinkWither::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.MANA_STORM, RenderManaStorm::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.BABYLON_WEAPON, RenderBabylonWeapon::new);
RenderingRegistry.registerEntityRenderingHandler(EntityThornChakram.TYPE, renderManager -> new SpriteRenderer<>(renderManager, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(EntityVineBall.TYPE, renderManager -> new SpriteRenderer<>(renderManager, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(EntityEnderAirBottle.TYPE, renderManager -> new SpriteRenderer<>(renderManager, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.THORN_CHAKRAM, renderManager -> new SpriteRenderer<>(renderManager, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.VINE_BALL, renderManager -> new SpriteRenderer<>(renderManager, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.ENDER_AIR_BOTTLE, renderManager -> new SpriteRenderer<>(renderManager, Minecraft.getInstance().getItemRenderer()));
}
private static void registerSubtiles() {
@@ -15,6 +15,7 @@ import net.minecraft.world.World;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.IManaTrigger;
import vazkii.botania.common.entity.EntityManaStorm;
import vazkii.botania.common.entity.ModEntities;
public class BlockManaBomb extends BlockMod implements IManaTrigger {
@@ -27,7 +28,7 @@ public class BlockManaBomb extends BlockMod implements IManaTrigger {
if (!burst.isFake() && !world.isRemote) {
world.playEvent(2001, pos, Block.getStateId(getDefaultState()));
world.removeBlock(pos, false);
EntityManaStorm storm = new EntityManaStorm(world);
EntityManaStorm storm = ModEntities.MANA_STORM.create(world);
storm.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
world.addEntity(storm);
}
@@ -45,6 +45,7 @@ import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.entity.ModEntities;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
@@ -255,7 +256,6 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
}
public static class EntityPlayerMover extends Entity {
@ObjectHolder(LibMisc.MOD_ID + ":player_mover") public static EntityType<EntityPlayerMover> TYPE;
private static final String TAG_EXIT_X = "exitX";
private static final String TAG_EXIT_Y = "exitY";
private static final String TAG_EXIT_Z = "exitZ";
@@ -267,7 +267,7 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
}
public EntityPlayerMover(World world, BlockPos pos, BlockPos exitPos) {
this(TYPE, world);
this(ModEntities.PLAYER_MOVER, world);
setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
setExit(exitPos);
}
@@ -39,8 +39,6 @@ import javax.annotation.Nonnull;
import java.util.List;
public class EntityBabylonWeapon extends EntityThrowableCopy {
@ObjectHolder(LibMisc.MOD_ID + ":babylon_weapon") public static EntityType<EntityBabylonWeapon> TYPE;
private static final String TAG_CHARGING = "charging";
private static final String TAG_VARIETY = "variety";
private static final String TAG_CHARGE_TICKS = "chargeTicks";
@@ -60,7 +58,7 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
}
public EntityBabylonWeapon(LivingEntity thrower, World world) {
super(TYPE, thrower, world);
super(ModEntities.BABYLON_WEAPON, thrower, world);
}
@Override
@@ -43,8 +43,6 @@ import java.util.ArrayList;
import java.util.List;
public class EntityCorporeaSpark extends EntitySparkBase implements ICorporeaSpark {
@ObjectHolder(LibMisc.MOD_ID + ":corporea_spark") public static EntityType<EntityCorporeaSpark> TYPE;
private static final int SCAN_RANGE = 8;
private static final String TAG_MASTER = "master";
@@ -62,10 +60,6 @@ public class EntityCorporeaSpark extends EntitySparkBase implements ICorporeaSpa
super(type, world);
}
public EntityCorporeaSpark(World world) {
this(TYPE, world);
}
@Override
protected void registerData() {
super.registerData();
@@ -89,8 +89,6 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
public class EntityDoppleganger extends MobEntity implements IEntityAdditionalSpawnData {
@ObjectHolder(LibMisc.MOD_ID + ":doppleganger") public static EntityType<EntityDoppleganger> TYPE;
public static final float ARENA_RANGE = 12F;
public static final int ARENA_HEIGHT = 5;
@@ -138,7 +136,7 @@ public class EntityDoppleganger extends MobEntity implements IEntityAdditionalSp
private boolean hardMode = false;
private BlockPos source = BlockPos.ZERO;
private final List<UUID> playersWhoAttacked = new ArrayList<>();
private final ServerBossInfo bossInfo = (ServerBossInfo) new ServerBossInfo(TYPE.getName(), BossInfo.Color.PINK, BossInfo.Overlay.PROGRESS).setCreateFog(true);;
private final ServerBossInfo bossInfo = (ServerBossInfo) new ServerBossInfo(ModEntities.DOPPLEGANGER.getName(), BossInfo.Color.PINK, BossInfo.Overlay.PROGRESS).setCreateFog(true);;
private UUID bossInfoUUID = bossInfo.getUniqueId();
public PlayerEntity trueKiller = null;
@@ -150,10 +148,6 @@ public class EntityDoppleganger extends MobEntity implements IEntityAdditionalSp
}
}
public EntityDoppleganger(World world) {
this(TYPE, world);
}
public static boolean spawn(PlayerEntity player, ItemStack stack, World world, BlockPos pos, boolean hard) {
//initial checks
if (!(world.getTileEntity(pos) instanceof BeaconTileEntity) ||
@@ -201,7 +195,7 @@ public class EntityDoppleganger extends MobEntity implements IEntityAdditionalSp
if (!world.isRemote) {
stack.shrink(1);
EntityDoppleganger e = new EntityDoppleganger(world);
EntityDoppleganger e = ModEntities.DOPPLEGANGER.create(world);
e.setPosition(pos.getX() + 0.5, pos.getY() + 3, pos.getZ() + 0.5);
e.setInvulTime(SPAWN_TICKS);
e.setHealth(1F);
@@ -777,7 +771,7 @@ public class EntityDoppleganger extends MobEntity implements IEntityAdditionalSp
int y = (int) players.get(rand.nextInt(players.size())).getPosY();
int z = source.getZ() - 10 + rand.nextInt(20);
EntityMagicLandmine landmine = new EntityMagicLandmine(world);
EntityMagicLandmine landmine = ModEntities.MAGIC_LANDMINE.create(world);
landmine.setPosition(x + 0.5, y, z + 0.5);
landmine.summoner = this;
world.addEntity(landmine);
@@ -42,14 +42,12 @@ import java.util.stream.Collectors;
_interface = IRendersAsItem.class
)
public class EntityEnderAirBottle extends ThrowableEntity implements IRendersAsItem {
@ObjectHolder(LibMisc.MOD_ID + ":ender_air_bottle") public static EntityType<EntityEnderAirBottle> TYPE;
public EntityEnderAirBottle(EntityType<EntityEnderAirBottle> type, World world) {
super(type, world);
}
public EntityEnderAirBottle(LivingEntity entity, World world) {
super(TYPE, entity, world);
super(ModEntities.ENDER_AIR_BOTTLE, entity, world);
}
@Override
@@ -28,14 +28,12 @@ import vazkii.botania.common.lib.LibMisc;
import java.util.List;
public class EntityFallingStar extends EntityThrowableCopy {
@ObjectHolder(LibMisc.MOD_ID + ":falling_star") public static EntityType<EntityFallingStar> TYPE;
public EntityFallingStar(EntityType<EntityFallingStar> type, World world) {
super(type, world);
}
public EntityFallingStar(LivingEntity e, World world) {
super(TYPE, e, world);
super(ModEntities.FALLING_STAR, e, world);
}
@Override
@@ -30,16 +30,10 @@ import javax.annotation.Nonnull;
import java.util.List;
public class EntityFlameRing extends Entity {
@ObjectHolder(LibMisc.MOD_ID + ":flame_ring") public static EntityType<EntityFlameRing> TYPE;
public EntityFlameRing(EntityType<EntityFlameRing> type, World world) {
super(type, world);
}
public EntityFlameRing(World world) {
this(TYPE, world);
}
@Override
protected void registerData() {}
@@ -32,18 +32,12 @@ import javax.annotation.Nonnull;
import java.util.List;
public class EntityMagicLandmine extends Entity {
@ObjectHolder(LibMisc.MOD_ID + ":magic_landmine") public static EntityType<EntityMagicLandmine> TYPE;
public EntityDoppleganger summoner;
public EntityMagicLandmine(EntityType<EntityMagicLandmine> type, World world) {
super(type, world);
}
public EntityMagicLandmine(World world) {
this(TYPE, world);
}
@Override
public void tick() {
setMotion(Vec3d.ZERO);
@@ -42,8 +42,6 @@ import javax.annotation.Nonnull;
import java.util.List;
public class EntityMagicMissile extends ThrowableEntity {
@ObjectHolder(LibMisc.MOD_ID + ":magic_missile") public static EntityType<EntityMagicMissile> TYPE;
private static final String TAG_TIME = "time";
private static final DataParameter<Boolean> EVIL = EntityDataManager.createKey(EntityMagicMissile.class, DataSerializers.BOOLEAN);
private static final DataParameter<Integer> TARGET = EntityDataManager.createKey(EntityMagicMissile.class, DataSerializers.VARINT);
@@ -55,12 +53,8 @@ public class EntityMagicMissile extends ThrowableEntity {
super(type, world);
}
public EntityMagicMissile(World world) {
this(TYPE, world);
}
public EntityMagicMissile(LivingEntity thrower, boolean evil) {
super(TYPE, thrower, thrower.world);
super(ModEntities.MAGIC_MISSILE, thrower, thrower.world);
setEvil(evil);
}
@@ -46,7 +46,6 @@ import javax.annotation.Nonnull;
import java.util.*;
public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
@ObjectHolder(LibMisc.MOD_ID + ":mana_burst") public static EntityType<EntityManaBurst> TYPE;
private static final String TAG_TICKS_EXISTED = "ticksExisted";
private static final String TAG_COLOR = "color";
private static final String TAG_MANA = "mana";
@@ -88,10 +87,6 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
public final List<PositionProperties> propsList = new ArrayList<>();
public EntityManaBurst(World world) {
this(TYPE, world);
}
public EntityManaBurst(EntityType<EntityManaBurst> type, World world) {
super(type, world);
}
@@ -109,7 +104,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
}
public EntityManaBurst(IManaSpreader spreader, boolean fake) {
this(((TileEntity) spreader).getWorld());
this(ModEntities.MANA_BURST, ((TileEntity) spreader).getWorld());
TileEntity tile = (TileEntity) spreader;
@@ -128,7 +123,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
}
public EntityManaBurst(PlayerEntity player) {
super(TYPE, player, player.world);
super(ModEntities.MANA_BURST, player, player.world);
setBurstSourceCoords(new BlockPos(0, -1, 0));
setRotation(player.rotationYaw + 180, -player.rotationPitch);
@@ -25,8 +25,6 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class EntityManaStorm extends Entity {
@ObjectHolder(LibMisc.MOD_ID + ":mana_storm") public static EntityType<EntityManaStorm> TYPE;
private static final String TAG_TIME = "time";
private static final String TAG_BURSTS_FIRED = "burstsFired";
private static final String TAG_DEATH_TIME = "deathTime";
@@ -42,10 +40,6 @@ public class EntityManaStorm extends Entity {
super(type, world);
}
public EntityManaStorm(World world) {
this(TYPE, world);
}
@Override
protected void registerData() {}
@@ -72,7 +66,7 @@ public class EntityManaStorm extends Entity {
}
private void spawnBurst() {
EntityManaBurst burst = new EntityManaBurst(world);
EntityManaBurst burst = ModEntities.MANA_BURST.create(world);
burst.setPosition(getPosX(), getPosY(), getPosZ());
float motionModifier = 0.5F;
@@ -28,12 +28,6 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class EntityPinkWither extends WitherEntity {
@ObjectHolder(LibMisc.MOD_ID + ":pink_wither") public static EntityType<EntityPinkWither> TYPE;
public EntityPinkWither(World world) {
this(TYPE, world);
}
public EntityPinkWither(EntityType<EntityPinkWither> type, World world) {
super(type, world);
@@ -29,7 +29,6 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class EntityPixie extends FlyingEntity {
@ObjectHolder(LibMisc.MOD_ID + ":pixie") public static EntityType<EntityPixie> TYPE;
private static final DataParameter<Integer> PIXIE_TYPE = EntityDataManager.createKey(EntityPixie.class, DataSerializers.VARINT);
private LivingEntity summoner = null;
@@ -41,7 +40,7 @@ public class EntityPixie extends FlyingEntity {
}
public EntityPixie(World world) {
this(TYPE, world);
this(ModEntities.PIXIE, world);
}
@Override
@@ -40,7 +40,6 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class EntityPoolMinecart extends AbstractMinecartEntity {
@ObjectHolder(LibMisc.MOD_ID + ":pool_minecart") 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);
@@ -50,7 +49,7 @@ public class EntityPoolMinecart extends AbstractMinecartEntity {
}
public EntityPoolMinecart(World world, double x, double y, double z) {
super(TYPE, world, x, y, z);
super(ModEntities.POOL_MINECART, world, x, y, z);
}
@Override
@@ -28,7 +28,6 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class EntitySignalFlare extends Entity {
@ObjectHolder(LibMisc.MOD_ID + ":signal_flare") 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);
@@ -39,7 +38,7 @@ public class EntitySignalFlare extends Entity {
}
public EntitySignalFlare(World world) {
this(TYPE, world);
this(ModEntities.SIGNAL_FLARE, world);
}
@Override
@@ -49,7 +49,6 @@ import java.util.*;
import java.util.stream.Collectors;
public class EntitySpark extends EntitySparkBase implements ISparkEntity {
@ObjectHolder(LibMisc.MOD_ID + ":spark") public static EntityType<EntitySpark> TYPE;
private static final int TRANSFER_RATE = 1000;
private static final String TAG_UPGRADE = "upgrade";
private static final DataParameter<Integer> UPGRADE = EntityDataManager.createKey(EntitySpark.class, DataSerializers.VARINT);
@@ -63,7 +62,7 @@ public class EntitySpark extends EntitySparkBase implements ISparkEntity {
}
public EntitySpark(World world) {
this(TYPE, world);
this(ModEntities.SPARK, world);
}
@Override
@@ -50,8 +50,6 @@ import javax.annotation.Nonnull;
_interface = IRendersAsItem.class
)
public class EntityThornChakram extends ThrowableEntity implements IRendersAsItem {
@ObjectHolder(LibMisc.MOD_ID + ":thorn_chakram") 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);
private static final DataParameter<Integer> RETURN_TO = EntityDataManager.createKey(EntityThornChakram.class, DataSerializers.VARINT);
@@ -64,7 +62,7 @@ public class EntityThornChakram extends ThrowableEntity implements IRendersAsIte
}
public EntityThornChakram(LivingEntity e, World world, ItemStack stack) {
super(TYPE, e, world);
super(ModEntities.THORN_CHAKRAM, e, world);
this.stack = stack.copy();
}
@@ -29,17 +29,10 @@ import java.util.List;
import java.util.Optional;
public class EntityThrownItem extends ItemEntity {
@ObjectHolder(LibMisc.MOD_ID + ":thrown_item") public static EntityType<EntityThrownItem> TYPE;
public EntityThrownItem(EntityType<EntityThrownItem> type, World world) {
super(type, world);
}
public EntityThrownItem(World world) {
this(TYPE, world);
setInvulnerable(true);
}
public EntityThrownItem(World world, double x,
double y, double z, ItemEntity item) {
super(world, x, y, z, item.getItem());
@@ -51,7 +44,7 @@ public class EntityThrownItem extends ItemEntity {
@Nonnull
@Override
public EntityType<?> getType() {
return TYPE;
return ModEntities.THROWN_ITEM;
}
@Nonnull
@@ -48,22 +48,16 @@ import java.util.Map;
_interface = IRendersAsItem.class
)
public class EntityVineBall extends ThrowableEntity implements IRendersAsItem {
@ObjectHolder(LibMisc.MOD_ID + ":vine_ball") 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) {
this(TYPE, world);
}
public EntityVineBall(EntityType<EntityVineBall> type, World world) {
super(type, world);
}
public EntityVineBall(LivingEntity thrower, boolean gravity) {
super(TYPE, thrower, thrower.world);
super(ModEntities.VINE_BALL, thrower, thrower.world);
dataManager.set(GRAVITY, gravity ? 0.03F : 0F);
}
@@ -12,149 +12,154 @@ import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.registries.IForgeRegistry;
import vazkii.botania.common.block.tile.TileLightRelay.EntityPlayerMover;
import vazkii.botania.common.lib.LibEntityNames;
import static vazkii.botania.common.block.ModBlocks.register;
public final class ModEntities {
public static final EntityType<EntityManaBurst> MANA_BURST = EntityType.Builder.<EntityManaBurst>create(
EntityManaBurst::new, EntityClassification.MISC)
.size(0, 0)
.setUpdateInterval(10)
.setTrackingRange(64)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static final EntityType<EntitySignalFlare> SIGNAL_FLARE = EntityType.Builder.<EntitySignalFlare>create(
EntitySignalFlare::new, EntityClassification.MISC)
.size(0, 0)
.setUpdateInterval(10)
.setTrackingRange(2048)
.setShouldReceiveVelocityUpdates(false)
.build("");
public static final EntityType<EntityPixie> PIXIE = EntityType.Builder.<EntityPixie>create(EntityPixie::new, EntityClassification.MISC)
.size(1, 1)
.setUpdateInterval(3)
.setTrackingRange(16)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static final EntityType<EntityFlameRing> FLAME_RING = EntityType.Builder.<EntityFlameRing>create(EntityFlameRing::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(32)
.setUpdateInterval(40)
.setShouldReceiveVelocityUpdates(false)
.build("");
public static final EntityType<EntityVineBall> VINE_BALL = EntityType.Builder.<EntityVineBall>create(EntityVineBall::new, EntityClassification.MISC)
.size(0.25F, 0.25F)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static final EntityType<EntityDoppleganger> DOPPLEGANGER = EntityType.Builder.<EntityDoppleganger>create(EntityDoppleganger::new, EntityClassification.MONSTER)
.size(0.6F, 1.8F)
.immuneToFire()
.setTrackingRange(128)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static final EntityType<EntityMagicLandmine> MAGIC_LANDMINE = EntityType.Builder.<EntityMagicLandmine>create(EntityMagicLandmine::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(128)
.setUpdateInterval(40)
.setShouldReceiveVelocityUpdates(false)
.build("");
public static final EntityType<EntitySpark> SPARK = EntityType.Builder.<EntitySpark>create(EntitySpark::new, EntityClassification.MISC)
.size(0.1F, 0.5F)
.immuneToFire()
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(false)
.build("");
public static final EntityType<EntityThrownItem> THROWN_ITEM = EntityType.Builder.<EntityThrownItem>create(EntityThrownItem::new, EntityClassification.MISC)
.size(0.25F, 0.25F)
.setTrackingRange(64)
.setUpdateInterval(20)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static final EntityType<EntityMagicMissile> MAGIC_MISSILE = EntityType.Builder.<EntityMagicMissile>create(EntityMagicMissile::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(64)
.setUpdateInterval(2)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static final EntityType<EntityThornChakram> THORN_CHAKRAM = EntityType.Builder.<EntityThornChakram>create(EntityThornChakram::new, EntityClassification.MISC)
.size(0.25F, 0.25F)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static final EntityType<EntityCorporeaSpark> CORPOREA_SPARK = EntityType.Builder.<EntityCorporeaSpark>create(EntityCorporeaSpark::new, EntityClassification.MISC)
.size(0.1F, 0.5F)
.immuneToFire()
.setTrackingRange(64)
.setUpdateInterval(40)
.setShouldReceiveVelocityUpdates(false)
.build("");
public static final EntityType<EntityEnderAirBottle> ENDER_AIR_BOTTLE = EntityType.Builder.<EntityEnderAirBottle>create(EntityEnderAirBottle::new, EntityClassification.MISC)
.size(0.25F, 0.25F)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static final EntityType<EntityPoolMinecart> POOL_MINECART = EntityType.Builder.<EntityPoolMinecart>create(EntityPoolMinecart::new, EntityClassification.MISC)
.size(0.98F, 0.7F)
.setTrackingRange(80)
.setUpdateInterval(3)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static final EntityType<EntityPinkWither> PINK_WITHER = EntityType.Builder.<EntityPinkWither>create(EntityPinkWither::new, EntityClassification.MISC)
.size(0.9F, 3.5F)
.setTrackingRange(80)
.setUpdateInterval(3)
.setShouldReceiveVelocityUpdates(false)
.build("");
public static final EntityType<EntityPlayerMover> PLAYER_MOVER = EntityType.Builder.<EntityPlayerMover>create(EntityPlayerMover::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(40)
.setUpdateInterval(3)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static final EntityType<EntityManaStorm> MANA_STORM = EntityType.Builder.<EntityManaStorm>create(EntityManaStorm::new, EntityClassification.MISC)
.size(0.98F, 0.98F)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(false)
.build("");
public static final EntityType<EntityBabylonWeapon> BABYLON_WEAPON = EntityType.Builder.<EntityBabylonWeapon>create(EntityBabylonWeapon::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static final EntityType<EntityFallingStar> FALLING_STAR = EntityType.Builder.<EntityFallingStar>create(EntityFallingStar::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("");
public static void registerEntities(RegistryEvent.Register<EntityType<?>> evt) {
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.<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.<EntityPixie>create(EntityPixie::new, EntityClassification.MISC)
.size(1, 1)
.setUpdateInterval(3)
.setTrackingRange(16)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.PIXIE));
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.<EntityVineBall>create(EntityVineBall::new, EntityClassification.MISC)
.size(0.25F, 0.25F)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.VINE_BALL));
evt.getRegistry().register(EntityType.Builder.<EntityDoppleganger>create(EntityDoppleganger::new, EntityClassification.MONSTER)
.size(0.6F, 1.8F)
.immuneToFire()
.setTrackingRange(128)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.DOPPLEGANGER));
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.<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.<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.<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.<EntityThornChakram>create(EntityThornChakram::new, EntityClassification.MISC)
.size(0.25F, 0.25F)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.THORN_CHAKRAM));
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.<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.<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.<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.<EntityPlayerMover>create(EntityPlayerMover::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(40)
.setUpdateInterval(3)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.PLAYER_MOVER));
evt.getRegistry().register(EntityType.Builder.<EntityManaStorm>create(EntityManaStorm::new, EntityClassification.MISC)
.size(0.98F, 0.98F)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(false)
.build("")
.setRegistryName(LibEntityNames.MANA_STORM));
evt.getRegistry().register(EntityType.Builder.<EntityBabylonWeapon>create(EntityBabylonWeapon::new, EntityClassification.MISC)
.size(0, 0)
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.BABYLON_WEAPON));
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));
IForgeRegistry<EntityType<?>> r = evt.getRegistry();
register(r, LibEntityNames.MANA_BURST, MANA_BURST);
register(r, LibEntityNames.SIGNAL_FLARE, SIGNAL_FLARE);
register(r, LibEntityNames.PIXIE, PIXIE);
register(r, LibEntityNames.FLAME_RING, FLAME_RING);
register(r, LibEntityNames.VINE_BALL, VINE_BALL);
register(r, LibEntityNames.DOPPLEGANGER, DOPPLEGANGER);
register(r, LibEntityNames.MAGIC_LANDMINE, MAGIC_LANDMINE);
register(r, LibEntityNames.SPARK, SPARK);
register(r, LibEntityNames.THROWN_ITEM, THROWN_ITEM);
register(r, LibEntityNames.MAGIC_MISSILE, MAGIC_MISSILE);
register(r, LibEntityNames.THORN_CHAKRAM, THORN_CHAKRAM);
register(r, LibEntityNames.CORPOREA_SPARK, CORPOREA_SPARK);
register(r, LibEntityNames.ENDER_AIR_BOTTLE, ENDER_AIR_BOTTLE);
register(r, LibEntityNames.POOL_MINECART, POOL_MINECART);
register(r, LibEntityNames.PINK_WITHER, PINK_WITHER);
register(r, LibEntityNames.PLAYER_MOVER, PLAYER_MOVER);
register(r, LibEntityNames.MANA_STORM, MANA_STORM);
register(r, LibEntityNames.BABYLON_WEAPON, BABYLON_WEAPON);
register(r, LibEntityNames.FALLING_STAR, FALLING_STAR);
}
}
@@ -19,6 +19,7 @@ import net.minecraftforge.items.CapabilityItemHandler;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.common.entity.EntityCorporeaSpark;
import vazkii.botania.common.entity.ModEntities;
import javax.annotation.Nonnull;
@@ -41,7 +42,7 @@ public class ItemCorporeaSpark extends Item {
&& !CorporeaHelper.instance().doesBlockHaveSpark(world, pos)) {
ctx.getItem().shrink(1);
if (!world.isRemote) {
EntityCorporeaSpark spark = new EntityCorporeaSpark(world);
EntityCorporeaSpark spark = ModEntities.CORPOREA_SPARK.create(world);
if (this == ModItems.corporeaSparkMaster) {
spark.setMaster(true);
}
@@ -48,6 +48,7 @@ import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.entity.ModEntities;
import javax.annotation.Nonnull;
@@ -206,7 +207,7 @@ public class ItemLaputaShard extends Item implements ILensEffect, ITinyPlanetExc
}
public EntityManaBurst getBurst(World world, BlockPos pos, ItemStack stack) {
EntityManaBurst burst = new EntityManaBurst(world);
EntityManaBurst burst = ModEntities.MANA_BURST.create(world);
burst.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
burst.setColor(0x00EAFF);
@@ -30,6 +30,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.common.advancements.UseItemSuccessTrigger;
import vazkii.botania.common.entity.EntityPinkWither;
import vazkii.botania.common.entity.ModEntities;
import javax.annotation.Nonnull;
@@ -50,7 +51,7 @@ public class ItemPinkinator extends Item {
for (WitherEntity wither : withers) {
if (!world.isRemote && wither.isAlive() && !(wither instanceof EntityPinkWither)) {
wither.remove();
EntityPinkWither pink = new EntityPinkWither(world);
EntityPinkWither pink = ModEntities.PINK_WITHER.create(world);
pink.setLocationAndAngles(wither.getPosX(), wither.getPosY(), wither.getPosZ(), wither.rotationYaw, wither.rotationPitch);
pink.setNoAI(wither.isAIDisabled());
if (wither.hasCustomName()) {
@@ -27,6 +27,7 @@ import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.entity.EntityFlameRing;
import vazkii.botania.common.entity.ModEntities;
import javax.annotation.Nonnull;
@@ -50,7 +51,7 @@ public class ItemFireRod extends Item implements IManaUsingItem, IAvatarWieldabl
BlockPos pos = ctx.getPos();
if (!world.isRemote && player != null && ManaItemHandler.instance().requestManaExactForTool(stack, player, COST, false)) {
EntityFlameRing entity = new EntityFlameRing(world);
EntityFlameRing entity = ModEntities.FLAME_RING.create(world);
entity.setPosition(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5);
world.addEntity(entity);
@@ -74,7 +75,7 @@ public class ItemFireRod extends Item implements IManaUsingItem, IAvatarWieldabl
World world = te.getWorld();
if (!world.isRemote && tile.getCurrentMana() >= COST && tile.getElapsedFunctionalTicks() % 300 == 0 && tile.isEnabled()) {
EntityFlameRing entity = new EntityFlameRing(world);
EntityFlameRing entity = ModEntities.FLAME_RING.create(world);
entity.setPosition(te.getPos().getX() + 0.5, te.getPos().getY(), te.getPos().getZ() + 0.5);
world.addEntity(entity);
tile.receiveMana(-COST);
@@ -28,6 +28,7 @@ import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.entity.EntityMagicMissile;
import vazkii.botania.common.entity.ModEntities;
import javax.annotation.Nonnull;
@@ -75,7 +76,7 @@ public class ItemMissileRod extends Item implements IManaUsingItem, IAvatarWield
if (thrower != null) {
missile = new EntityMagicMissile(thrower, false);
} else {
missile = new EntityMagicMissile(world);
missile = ModEntities.MAGIC_MISSILE.create(world);
}
missile.setPosition(x, y, z);