Compiles in entity

This commit is contained in:
Vincent Lee committed 2017-01-05 00:49:56 -06:00
1 parent d27cdbebed
commit d4db9902e3
12 files changed
+73 -49

No files matched your search

@@ -144,7 +144,7 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
if(living.hurtTime == 0) {
if(player != null)
living.attackEntityFrom(DamageSource.causePlayerDamage(player), 20);
else living.attackEntityFrom(DamageSource.generic, 20);
else living.attackEntityFrom(DamageSource.GENERIC, 20);
onImpact(new RayTraceResult(living));
return;
}
@@ -50,7 +50,7 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
private static final DataParameter<Integer> NETWORK = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.VARINT);
public static final DataParameter<Integer> INVISIBILITY = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.VARINT);
private static final DataParameter<Integer> ITEM_DISPLAY_TICKS = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.VARINT);
private static final DataParameter<Optional<ItemStack>> DISPLAY_STACK = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.OPTIONAL_ITEM_STACK);
private static final DataParameter<ItemStack> DISPLAY_STACK = EntityDataManager.createKey(EntityCorporeaSpark.class, DataSerializers.OPTIONAL_ITEM_STACK);
private ICorporeaSpark master;
private List<ICorporeaSpark> connections = new ArrayList<>();
@@ -69,7 +69,7 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
dataManager.register(MASTER, false);
dataManager.register(NETWORK, 0);
dataManager.register(ITEM_DISPLAY_TICKS, 0);
dataManager.register(DISPLAY_STACK, Optional.absent());
dataManager.register(DISPLAY_STACK, ItemStack.EMPTY);
}
@Nonnull
@@ -258,17 +258,18 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
dataManager.set(ITEM_DISPLAY_TICKS, ticks);
}
public Optional<ItemStack> getDisplayedItem() {
public ItemStack getDisplayedItem() {
return dataManager.get(DISPLAY_STACK);
}
public void setDisplayedItem(ItemStack stack) {
dataManager.set(DISPLAY_STACK, Optional.fromNullable(stack));
dataManager.set(DISPLAY_STACK, stack);
}
@Override
public boolean processInitialInteract(EntityPlayer player, ItemStack stack, EnumHand hand) {
if(stack != null) {
public boolean processInitialInteract(EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty()) {
if(stack.getItem() == ModItems.twigWand) {
if(player.isSneaking()) {
if(!player.world.isRemote) {
@@ -293,7 +294,7 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
restartNetwork();
else findNetwork();
stack.stackSize--;
stack.shrink(1);
} else player.swingArm(hand);
}
}
@@ -20,6 +20,7 @@ import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import net.minecraft.entity.monster.EntityWitherSkeleton;
import org.lwjgl.opengl.ARBShaderObjects;
import com.google.common.base.Optional;
@@ -39,7 +40,6 @@ import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.SkeletonType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
@@ -209,7 +209,7 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss {
if(world.isRemote)
return true;
stack.stackSize--;
stack.shrink(1);
EntityDoppleganger e = new EntityDoppleganger(world);
e.setPosition(pos.getX() + 0.5, pos.getY() + 3, pos.getZ() + 0.5);
@@ -683,7 +683,7 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss {
entity = new EntitySkeleton(world);
entity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.BOW));
if(world.rand.nextInt(8) == 0) {
((EntitySkeleton) entity).setSkeletonType(SkeletonType.WITHER);
entity = new EntityWitherSkeleton(world);
entity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(hard ? ModItems.elementiumSword : Items.STONE_SWORD));
}
break;
@@ -75,7 +75,7 @@ public class EntityFallingStar extends EntityThrowableCopy {
if(pos.entityHit != null && thrower != null && pos.entityHit != thrower && !pos.entityHit.isDead) {
if(thrower instanceof EntityPlayer)
pos.entityHit.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) thrower), Math.random() < 0.25 ? 10 : 5);
else pos.entityHit.attackEntityFrom(DamageSource.generic, Math.random() < 0.25 ? 10 : 5);
else pos.entityHit.attackEntityFrom(DamageSource.GENERIC, Math.random() < 0.25 ? 10 : 5);
}
if (pos.getBlockPos() != null) {
@@ -138,7 +138,7 @@ public class EntityMagicMissile extends EntityThrowable {
if(thrower != null) {
EntityPlayer player = thrower instanceof EntityPlayer ? (EntityPlayer) thrower : null;
target.attackEntityFrom(player == null ? DamageSource.causeMobDamage(thrower) : DamageSource.causePlayerDamage(player), evil ? 12 : 7);
} else target.attackEntityFrom(DamageSource.generic, evil ? 12 : 7);
} else target.attackEntityFrom(DamageSource.GENERIC, evil ? 12 : 7);
setDead();
}
@@ -90,7 +90,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
private static final DataParameter<Float> MANA_LOSS_PER_TICK = EntityDataManager.createKey(EntityManaBurst.class, DataSerializers.FLOAT);
private static final DataParameter<Float> GRAVITY = EntityDataManager.createKey(EntityManaBurst.class, DataSerializers.FLOAT);
private static final DataParameter<BlockPos> SOURCE_COORDS = EntityDataManager.createKey(EntityManaBurst.class, DataSerializers.BLOCK_POS);
private static final DataParameter<Optional<ItemStack>> SOURCE_LENS = EntityDataManager.createKey(EntityManaBurst.class, DataSerializers.OPTIONAL_ITEM_STACK);
private static final DataParameter<ItemStack> SOURCE_LENS = EntityDataManager.createKey(EntityManaBurst.class, DataSerializers.OPTIONAL_ITEM_STACK);
float accumulatedManaLoss = 0;
boolean fake = false;
@@ -116,7 +116,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
dataManager.register(MANA_LOSS_PER_TICK, 0F);
dataManager.register(GRAVITY, 0F);
dataManager.register(SOURCE_COORDS, BlockPos.ORIGIN);
dataManager.register(SOURCE_LENS, Optional.absent());
dataManager.register(SOURCE_LENS, ItemStack.EMPTY);
}
public EntityManaBurst(IManaSpreader spreader, boolean fake) {
@@ -417,7 +417,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
setGravity(par1nbtTagCompound.getFloat(TAG_GRAVITY));
NBTTagCompound lensCmp = par1nbtTagCompound.getCompoundTag(TAG_LENS_STACK);
ItemStack stack = ItemStack.loadItemStackFromNBT(lensCmp);
ItemStack stack = new ItemStack(lensCmp);
if(stack != null)
setSourceLens(stack);
else setSourceLens(new ItemStack(Blocks.STONE, 0, 0));
@@ -715,15 +715,12 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
@Override
public ItemStack getSourceLens() {
Optional<ItemStack> stack = dataManager.get(SOURCE_LENS);
if(!stack.isPresent())
return new ItemStack(Blocks.STONE, 0, 0);
else return stack.get();
return dataManager.get(SOURCE_LENS);
}
@Override
public void setSourceLens(ItemStack lens) {
dataManager.set(SOURCE_LENS, lens == null ? Optional.absent() : Optional.of(lens));
dataManager.set(SOURCE_LENS, lens);
}
@Override
@@ -55,7 +55,7 @@ public class EntityPinkWither extends EntityWither {
}
@Override
protected boolean processInteract(EntityPlayer player, EnumHand hand, ItemStack stack) {
protected boolean processInteract(EntityPlayer player, EnumHand hand) {
if(!player.isSneaking()) {
player.startRiding(this);
return true;
@@ -109,8 +109,8 @@ public class EntitySpark extends Entity implements ISparkEntity {
ItemStack input = new ItemStack(ModItems.spark);
for(EntityPlayer player : players) {
List<ItemStack> stacks = new ArrayList<>();
stacks.addAll(Arrays.asList(player.inventory.mainInventory));
stacks.addAll(Arrays.asList(player.inventory.armorInventory));
stacks.addAll(player.inventory.mainInventory);
stacks.addAll(player.inventory.armorInventory);
IInventory baubles = BaublesApi.getBaubles(player);
ItemStack[] baubleStacks = new ItemStack[baubles.getSizeInventory()];
@@ -243,8 +243,9 @@ public class EntitySpark extends Entity implements ISparkEntity {
}
@Override
public boolean processInitialInteract(EntityPlayer player, ItemStack stack, EnumHand hand) {
if(stack != null) {
public boolean processInitialInteract(EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty()) {
if(world.isRemote)
return stack.getItem() == ModItems.twigWand || stack.getItem() == ModItems.sparkUpgrade
|| stack.getItem() == ModItems.phantomInk;
@@ -270,7 +271,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
} else if(stack.getItem() == ModItems.sparkUpgrade && upgrade == SparkUpgradeType.NONE) {
int newUpgrade = stack.getItemDamage() + 1;
setUpgrade(SparkUpgradeType.values()[newUpgrade]);
stack.stackSize--;
stack.shrink(1);
player.swingArm(hand);
return true;
} else if (stack.getItem() == ModItems.phantomInk) {
@@ -154,7 +154,7 @@ public class EntityThornChakram extends EntityThrowable {
case ENTITY: {
if(!world.isRemote && pos.entityHit != null && pos.entityHit instanceof EntityLivingBase && pos.entityHit != getThrower()) {
EntityLivingBase thrower = getThrower();
pos.entityHit.attackEntityFrom(thrower != null ? thrower instanceof EntityPlayer ? DamageSource.causeThrownDamage(this, thrower) : DamageSource.causeMobDamage(thrower) : DamageSource.generic, 12);
pos.entityHit.attackEntityFrom(thrower != null ? thrower instanceof EntityPlayer ? DamageSource.causeThrownDamage(this, thrower) : DamageSource.causeMobDamage(thrower) : DamageSource.GENERIC, 12);
if(isFire())
pos.entityHit.setFire(5);
else if(world.rand.nextInt(3) == 0)
@@ -213,7 +213,7 @@ public class EntityThornChakram extends EntityThrowable {
public void readEntityFromNBT(NBTTagCompound compound) {
super.readEntityFromNBT(compound);
if(compound.hasKey("fly_stack")) {
stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("fly_stack"));
stack = new ItemStack(compound.getCompoundTag("fly_stack"));
}
setFire(compound.getBoolean("flare"));
}
@@ -106,7 +106,7 @@ public class EntityThrownItem extends EntityItem {
else
{
if (RayTraceResult.entityHit != null) {
RayTraceResult.entityHit.attackEntityFrom(DamageSource.magic, 2.0F);
RayTraceResult.entityHit.attackEntityFrom(DamageSource.MAGIC, 2.0F);
if (!world.isRemote) {
Entity item = getEntityItem().getItem().createEntity(world, this, getEntityItem());
if (item == null) {
@@ -20,25 +20,25 @@ public final class ModEntities {
public static void init() {
int id = 0;
EntityRegistry.registerModEntity(EntityManaBurst.class, LibEntityNames.MANA_BURST, id++, Botania.instance, 64, 10, true);
EntityRegistry.registerModEntity(EntitySignalFlare.class, LibEntityNames.SIGNAL_FLARE, id++, Botania.instance, 2048, 10, false);
EntityRegistry.registerModEntity(EntityPixie.class, LibEntityNames.PIXIE, id++, Botania.instance, 16, 3, true);
EntityRegistry.registerModEntity(EntityFlameRing.class, LibEntityNames.FLAME_RING, id++, Botania.instance, 32, 40, false);
EntityRegistry.registerModEntity(EntityVineBall.class, LibEntityNames.VINE_BALL, id++, Botania.instance, 64, 10, true);
EntityRegistry.registerModEntity(EntityDoppleganger.class, LibEntityNames.DOPPLEGANGER, id++, Botania.instance, 128, 3, true);
EntityRegistry.registerModEntity(EntityMagicLandmine.class, LibEntityNames.MAGIC_LANDMINE, id++, Botania.instance, 128, 40, false);
EntityRegistry.registerModEntity(EntitySpark.class, LibEntityNames.SPARK, id++, Botania.instance, 64, 10, false);
EntityRegistry.registerModEntity(EntityThrownItem.class, LibEntityNames.THROWN_ITEM, id++, Botania.instance, 64, 20, true);
EntityRegistry.registerModEntity(EntityMagicMissile.class, LibEntityNames.MAGIC_MISSILE, id++, Botania.instance, 64, 2, true);
EntityRegistry.registerModEntity(EntityThornChakram.class, LibEntityNames.THORN_CHAKRAM, id++, Botania.instance, 64, 10, true);
EntityRegistry.registerModEntity(EntityCorporeaSpark.class, LibEntityNames.CORPOREA_SPARK, id++, Botania.instance, 64, 10, false);
EntityRegistry.registerModEntity(EntityEnderAirBottle.class, LibEntityNames.ENDER_AIR_BOTTLE, id++, Botania.instance, 64, 10, true);
EntityRegistry.registerModEntity(EntityPoolMinecart.class, LibEntityNames.POOL_MINECART, id++, Botania.instance, 80, 3, true);
EntityRegistry.registerModEntity(EntityPinkWither.class, LibEntityNames.PINK_WITHER, id++, Botania.instance, 80, 3, false);
EntityRegistry.registerModEntity(EntityPlayerMover.class, LibEntityNames.PLAYER_MOVER, id++, Botania.instance, 40, 3, true);
EntityRegistry.registerModEntity(EntityManaStorm.class, LibEntityNames.MANA_STORM, id++, Botania.instance, 64, 10, false);
EntityRegistry.registerModEntity(EntityBabylonWeapon.class, LibEntityNames.BABYLON_WEAPON, id++, Botania.instance, 64, 10, true);
EntityRegistry.registerModEntity(EntityFallingStar.class, LibEntityNames.FALLING_STAR, id++, Botania.instance, 64, 10, true);
EntityRegistry.registerModEntity(LibEntityNames.MANA_BURST_REGISTRY, EntityManaBurst.class, LibEntityNames.MANA_BURST, id++, Botania.instance, 64, 10, true);
EntityRegistry.registerModEntity(LibEntityNames.SIGNAL_FLARE_REGISTRY, EntitySignalFlare.class, LibEntityNames.SIGNAL_FLARE, id++, Botania.instance, 2048, 10, false);
EntityRegistry.registerModEntity(LibEntityNames.PIXIE_REGISTRY, EntityPixie.class, LibEntityNames.PIXIE, id++, Botania.instance, 16, 3, true);
EntityRegistry.registerModEntity(LibEntityNames.FLAME_RING_REGISTRY, EntityFlameRing.class, LibEntityNames.FLAME_RING, id++, Botania.instance, 32, 40, false);
EntityRegistry.registerModEntity(LibEntityNames.VINE_BALL_REGISTRY, EntityVineBall.class, LibEntityNames.VINE_BALL, id++, Botania.instance, 64, 10, true);
EntityRegistry.registerModEntity(LibEntityNames.DOPPLEGANGER_REGISTRY, EntityDoppleganger.class, LibEntityNames.DOPPLEGANGER, id++, Botania.instance, 128, 3, true);
EntityRegistry.registerModEntity(LibEntityNames.MAGIC_LANDMINE_REGISTRY, EntityMagicLandmine.class, LibEntityNames.MAGIC_LANDMINE, id++, Botania.instance, 128, 40, false);
EntityRegistry.registerModEntity(LibEntityNames.SPARK_REGISTRY, EntitySpark.class, LibEntityNames.SPARK, id++, Botania.instance, 64, 10, false);
EntityRegistry.registerModEntity(LibEntityNames.THROWN_ITEM_REGISTRY, EntityThrownItem.class, LibEntityNames.THROWN_ITEM, id++, Botania.instance, 64, 20, true);
EntityRegistry.registerModEntity(LibEntityNames.MAGIC_MISSILE_REGISTRY, EntityMagicMissile.class, LibEntityNames.MAGIC_MISSILE, id++, Botania.instance, 64, 2, true);
EntityRegistry.registerModEntity(LibEntityNames.THORN_CHAKRAM_REGISTRY, EntityThornChakram.class, LibEntityNames.THORN_CHAKRAM, id++, Botania.instance, 64, 10, true);
EntityRegistry.registerModEntity(LibEntityNames.CORPOREA_SPARK_REGISTRY, EntityCorporeaSpark.class, LibEntityNames.CORPOREA_SPARK, id++, Botania.instance, 64, 10, false);
EntityRegistry.registerModEntity(LibEntityNames.ENDER_AIR_BOTTLE_REGISTRY, EntityEnderAirBottle.class, LibEntityNames.ENDER_AIR_BOTTLE, id++, Botania.instance, 64, 10, true);
EntityRegistry.registerModEntity(LibEntityNames.POOL_MINECART_REGISTRY, EntityPoolMinecart.class, LibEntityNames.POOL_MINECART, id++, Botania.instance, 80, 3, true);
EntityRegistry.registerModEntity(LibEntityNames.PINK_WITHER_REGISTRY, EntityPinkWither.class, LibEntityNames.PINK_WITHER, id++, Botania.instance, 80, 3, false);
EntityRegistry.registerModEntity(LibEntityNames.PLAYER_MOVER_REGISTRY, EntityPlayerMover.class, LibEntityNames.PLAYER_MOVER, id++, Botania.instance, 40, 3, true);
EntityRegistry.registerModEntity(LibEntityNames.MANA_STORM_REGISTRY, EntityManaStorm.class, LibEntityNames.MANA_STORM, id++, Botania.instance, 64, 10, false);
EntityRegistry.registerModEntity(LibEntityNames.BABYLON_WEAPON_REGISTRY, EntityBabylonWeapon.class, LibEntityNames.BABYLON_WEAPON, id++, Botania.instance, 64, 10, true);
EntityRegistry.registerModEntity(LibEntityNames.FALLING_STAR_REGISTRY, EntityFallingStar.class, LibEntityNames.FALLING_STAR, id++, Botania.instance, 64, 10, true);
}
}
@@ -10,6 +10,7 @@
*/
package vazkii.botania.common.lib;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.lib.LibResources;
public final class LibEntityNames {
@@ -34,4 +35,28 @@ public final class LibEntityNames {
public static final String BABYLON_WEAPON = LibResources.PREFIX_MOD + "babylonWeapon";
public static final String FALLING_STAR = LibResources.PREFIX_MOD + "fallingStar";
public static final ResourceLocation MANA_BURST_REGISTRY = makeName("mana_burst");
public static final ResourceLocation SIGNAL_FLARE_REGISTRY = makeName("signal_flare");
public static final ResourceLocation PIXIE_REGISTRY = makeName("pixie");
public static final ResourceLocation FLAME_RING_REGISTRY = makeName("flame_ring");
public static final ResourceLocation VINE_BALL_REGISTRY = makeName("vine_ball");
public static final ResourceLocation DOPPLEGANGER_REGISTRY = makeName("doppleganger");
public static final ResourceLocation MAGIC_LANDMINE_REGISTRY = makeName("magic_landmine");
public static final ResourceLocation SPARK_REGISTRY = makeName("spark");
public static final ResourceLocation THROWN_ITEM_REGISTRY = makeName("thrown_item");
public static final ResourceLocation MAGIC_MISSILE_REGISTRY = makeName("magic_missile");
public static final ResourceLocation THORN_CHAKRAM_REGISTRY = makeName("thorn_chakram");
public static final ResourceLocation CORPOREA_SPARK_REGISTRY = makeName("corporea_spark");
public static final ResourceLocation ENDER_AIR_BOTTLE_REGISTRY = makeName("ender_air_bottle");
public static final ResourceLocation POOL_MINECART_REGISTRY = makeName("pool_minecart");
public static final ResourceLocation PINK_WITHER_REGISTRY = makeName("pink_wither");
public static final ResourceLocation PLAYER_MOVER_REGISTRY = makeName("player_mover");
public static final ResourceLocation MANA_STORM_REGISTRY = makeName("mana_storm");
public static final ResourceLocation BABYLON_WEAPON_REGISTRY = makeName("babylon_weapon");
public static final ResourceLocation FALLING_STAR_REGISTRY = makeName("falling_star");
private static ResourceLocation makeName(String s) {
return new ResourceLocation(LibMisc.MOD_ID, s);
}
}