Add amulet of esundor, plus fixes for frost barrier
This commit is contained in:
@@ -25,16 +25,11 @@ public class RenderIceBarrier extends Render<EntityIceBarrier> {
|
||||
GlStateManager.translate(x, y + entity.height/2, z);
|
||||
GlStateManager.rotate(180, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(yaw, 0, 1, 0);
|
||||
//GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0, 0, 1);
|
||||
GlStateManager.translate(0, -entity.height/2 - 0.3, 0);
|
||||
|
||||
// Pass in -1 for the lifetime as the boulder crumbles when the time expires
|
||||
// float s = DrawingUtils.smoothScaleFactor(-1, entity.ticksExisted, partialTicks, 10, 10);
|
||||
float s = entity.getSizeMultiplier();
|
||||
GlStateManager.scale(s, s, s);
|
||||
|
||||
// GlStateManager.translate(0, 0.875, 0); // No idea why it starts 7/8 of a block too low, but it does
|
||||
|
||||
this.bindTexture(TEXTURE);
|
||||
|
||||
model.render(entity, 0, 0, 0, 0, 0, 0.0625f);
|
||||
|
||||
@@ -49,8 +49,8 @@ public class EntityIceBarrier extends EntityScaledConstruct implements ICustomHi
|
||||
|
||||
// Bit of a cheat but it's easier than trying to sync FrostBarrier#addConstructExtras
|
||||
if(world.isRemote && firstUpdate){
|
||||
setSizeMultiplier(sizeMultiplier); // Do this first or it'll overwrite the bounding box
|
||||
setRotation(rotationYaw, rotationPitch);
|
||||
setSizeMultiplier(sizeMultiplier);
|
||||
}
|
||||
|
||||
this.prevPosX = posX;
|
||||
@@ -78,20 +78,22 @@ public class EntityIceBarrier extends EntityScaledConstruct implements ICustomHi
|
||||
|
||||
Vec3d look = this.getLookVec();
|
||||
|
||||
for(Entity entity : world.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().grow(2))){
|
||||
if(!world.isRemote){
|
||||
|
||||
if(entity instanceof EntityMagicConstruct) continue;
|
||||
for(Entity entity : world.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().grow(2))){
|
||||
|
||||
if(!entity.getEntityBoundingBox().intersects(this.getEntityBoundingBox())) continue;
|
||||
if(entity instanceof EntityMagicConstruct) continue;
|
||||
|
||||
double perpendicularDist = getSignedPerpendicularDistance(entity.getPositionVector());
|
||||
if(!entity.getEntityBoundingBox().intersects(this.getEntityBoundingBox())) continue;
|
||||
|
||||
if(Math.abs(perpendicularDist) < entity.width/2 + THICKNESS/2){
|
||||
// For some reason the player position seems to be off by 1 block in x and z, no idea how so for now
|
||||
// I've just fudged it by adding 1 to x and z
|
||||
double perpendicularDist = getSignedPerpendicularDistance(entity.getPositionVector().add(1, 0, 1));
|
||||
|
||||
double velocity = 0.25 * Math.signum(perpendicularDist);
|
||||
entity.addVelocity(velocity * look.x, 0, velocity * look.z);
|
||||
if(Math.abs(perpendicularDist) < entity.width/2 + THICKNESS/2){
|
||||
|
||||
if(!world.isRemote){
|
||||
double velocity = 0.25 * Math.signum(perpendicularDist);
|
||||
entity.addVelocity(velocity * look.x, 0, velocity * look.z);
|
||||
// Player motion is handled on that player's client so needs packets
|
||||
if(entity instanceof EntityPlayerMP){
|
||||
((EntityPlayerMP)entity).connection.sendPacket(new SPacketEntityVelocity(entity));
|
||||
@@ -159,9 +161,7 @@ public class EntityIceBarrier extends EntityScaledConstruct implements ICustomHi
|
||||
private double getSignedPerpendicularDistance(Vec3d point){
|
||||
Vec3d look = this.getLookVec();
|
||||
Vec3d delta = new Vec3d(point.x - this.posX, 0, point.z - this.posZ);
|
||||
double dist = delta.length();
|
||||
float angle = (float)(delta.dotProduct(look) / dist);
|
||||
return dist * MathHelper.sin(angle);
|
||||
return delta.dotProduct(look);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.entity.construct.EntityFireRing;
|
||||
import electroblob.wizardry.entity.construct.EntityIceBarrier;
|
||||
import electroblob.wizardry.entity.living.ISummonedCreature;
|
||||
import electroblob.wizardry.entity.projectile.EntityDart;
|
||||
import electroblob.wizardry.entity.projectile.EntityForceOrb;
|
||||
@@ -364,6 +365,19 @@ public class ItemArtefact extends Item {
|
||||
}
|
||||
});
|
||||
|
||||
}else if(artefact == WizardryItems.amulet_frost_warding){
|
||||
|
||||
if(!world.isRemote && player.ticksExisted % 40 == 0){
|
||||
|
||||
List<EntityIceBarrier> barriers = world.getEntitiesWithinAABB(EntityIceBarrier.class, player.getEntityBoundingBox().grow(1.5));
|
||||
|
||||
// Check whether any barriers near the player are facing away from them, meaning the player is behind them
|
||||
if(!barriers.isEmpty() && barriers.stream().anyMatch(b -> b.getLookVec().dotProduct(b.getPositionVector().subtract(player.getPositionVector())) > 0)){
|
||||
player.addPotionEffect(new PotionEffect(WizardryPotions.ward, 50, 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else if(artefact == WizardryItems.charm_feeding){
|
||||
// Every 5 seconds, feed the player if they are hungry enough
|
||||
if(player.ticksExisted % 100 == 0){
|
||||
|
||||
@@ -253,6 +253,7 @@ public final class WizardryItems {
|
||||
public static final Item amulet_fire_cloaking = placeholder();
|
||||
public static final Item amulet_ice_immunity = placeholder();
|
||||
public static final Item amulet_ice_protection = placeholder();
|
||||
public static final Item amulet_frost_warding = placeholder();
|
||||
public static final Item amulet_potential = placeholder();
|
||||
public static final Item amulet_channeling = placeholder();
|
||||
public static final Item amulet_lich = placeholder();
|
||||
@@ -622,6 +623,7 @@ public final class WizardryItems {
|
||||
registerItem(registry, "amulet_fire_cloaking", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.AMULET));
|
||||
registerItem(registry, "amulet_ice_immunity", new ItemArtefact(EnumRarity.EPIC, ItemArtefact.Type.AMULET));
|
||||
registerItem(registry, "amulet_ice_protection", new ItemArtefact(EnumRarity.UNCOMMON, ItemArtefact.Type.AMULET));
|
||||
registerItem(registry, "amulet_frost_warding", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.AMULET));
|
||||
registerItem(registry, "amulet_potential", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.AMULET));
|
||||
registerItem(registry, "amulet_channeling", new ItemArtefact(EnumRarity.UNCOMMON, ItemArtefact.Type.AMULET));
|
||||
registerItem(registry, "amulet_lich", new ItemArtefact(EnumRarity.UNCOMMON, ItemArtefact.Type.AMULET));
|
||||
|
||||
Reference in New Issue
Block a user