mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Change cast spells to be easier to reach and change the center to be the center of the entity not its base position
This commit is contained in:
parent
1a17ff7dd0
commit
4c821a521c
5 changed files with 21 additions and 8 deletions
|
@ -25,7 +25,7 @@ public interface EntityConvertable<E extends Entity> extends WorldConvertable {
|
|||
* Gets the center position where this caster is located.
|
||||
*/
|
||||
default Vec3d getOriginVector() {
|
||||
return asEntity().getPos();
|
||||
return asEntity().getPos().add(0, asEntity().getHeight() * 0.5F, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -216,7 +216,7 @@ public class PortalSpell extends AbstractSpell implements PlaceableSpell.Placeme
|
|||
LivingEntity caster = source.getMaster();
|
||||
Vec3d targetPos = caster.getRotationVector().multiply(3).add(caster.getEyePos());
|
||||
parent.setOrientation(pitch, yaw);
|
||||
entity.setPos(targetPos.x, caster.getEyePos().y, targetPos.z);
|
||||
entity.setPos(targetPos.x, caster.getEyePos().y - (entity.getHeight() * 0.5F), targetPos.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,8 +27,6 @@ public class PlacedSpellRenderer extends SpellRenderer<PlaceableSpell> {
|
|||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, VertexConsumerProvider vertices, PlaceableSpell spell, Caster<?> caster, int light, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
|
||||
|
||||
|
||||
if (!(caster.asEntity() instanceof CastSpellEntity castSpell)) {
|
||||
return;
|
||||
}
|
||||
|
@ -36,13 +34,16 @@ public class PlacedSpellRenderer extends SpellRenderer<PlaceableSpell> {
|
|||
matrices.push();
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-castSpell.getYaw()));
|
||||
|
||||
|
||||
for (Spell delegate : spell.getDelegates()) {
|
||||
renderAmbientEffects(matrices, vertices, spell, delegate, caster, light, animationProgress, tickDelta);
|
||||
|
||||
matrices.push();
|
||||
float height = caster.asEntity().getHeight();
|
||||
matrices.translate(0, (-spell.pitch / 90F) * height * 0.5F, 0);
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-spell.pitch));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180 - spell.yaw));
|
||||
SpellEffectsRenderDispatcher.INSTANCE.render(matrices, vertices, delegate, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch);
|
||||
SpellEffectsRenderDispatcher.INSTANCE.render(matrices, vertices, delegate, caster, light, spell.getScale(tickDelta), limbDistance, tickDelta, animationProgress, headYaw, headPitch);
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
|
@ -53,6 +54,9 @@ public class PlacedSpellRenderer extends SpellRenderer<PlaceableSpell> {
|
|||
matrices.push();
|
||||
matrices.translate(0, 0.001, 0);
|
||||
|
||||
float height = caster.asEntity().getHeight();
|
||||
matrices.translate(0, (-spell.pitch / 90F) * height * 0.5F, 0);
|
||||
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-spell.pitch));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180 - spell.yaw));
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90));
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.minelittlepony.unicopia.ability.magic.Levelled;
|
|||
import com.minelittlepony.unicopia.ability.magic.SpellContainer;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.Spell;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
||||
import com.minelittlepony.unicopia.entity.EntityPhysics;
|
||||
import com.minelittlepony.unicopia.entity.EntityReference;
|
||||
import com.minelittlepony.unicopia.entity.MagicImmune;
|
||||
|
@ -13,6 +14,8 @@ import com.minelittlepony.unicopia.entity.Physics;
|
|||
import com.minelittlepony.unicopia.network.datasync.EffectSync;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityDimensions;
|
||||
import net.minecraft.entity.EntityPose;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.data.DataTracker;
|
||||
|
@ -72,8 +75,9 @@ public class CastSpellEntity extends LightEmittingEntity implements Caster<CastS
|
|||
}
|
||||
}
|
||||
|
||||
protected void updatePostDeath() {
|
||||
|
||||
@Override
|
||||
public EntityDimensions getDimensions(EntityPose pose) {
|
||||
return super.getDimensions(pose).scaled(getSpellSlot().get(SpellType.IS_PLACED, false).map(spell -> spell.getScale(1)).orElse(1F));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -117,6 +121,11 @@ public class CastSpellEntity extends LightEmittingEntity implements Caster<CastS
|
|||
return effectDelegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHit() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean subtractEnergyCost(double amount) {
|
||||
if (getMaster() == null) {
|
||||
|
|
|
@ -41,7 +41,7 @@ public interface UEntities {
|
|||
.dimensions(EntityDimensions.fixed(1, 1)));
|
||||
EntityType<CastSpellEntity> CAST_SPELL = register("cast_spell", FabricEntityTypeBuilder.create(SpawnGroup.MISC, CastSpellEntity::new)
|
||||
.trackRangeBlocks(200)
|
||||
.dimensions(EntityDimensions.fixed(1, 1)));
|
||||
.dimensions(EntityDimensions.changing(4, 4)));
|
||||
EntityType<FairyEntity> TWITTERMITE = register("twittermite", FabricEntityTypeBuilder.create(SpawnGroup.MISC, FairyEntity::new)
|
||||
.trackRangeBlocks(200)
|
||||
.dimensions(EntityDimensions.fixed(0.1F, 0.1F)));
|
||||
|
|
Loading…
Reference in a new issue