mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
1.19.3 -> 1.19.4
This commit is contained in:
parent
76f366b5e3
commit
62aac0f711
106 changed files with 516 additions and 351 deletions
|
@ -3,10 +3,10 @@ org.gradle.daemon=false
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/develop
|
# check these on https://fabricmc.net/develop
|
||||||
minecraft_version=1.19.3
|
minecraft_version=1.19.4
|
||||||
yarn_mappings=1.19.3+build.2
|
yarn_mappings=1.19.4+build.1
|
||||||
loader_version=0.14.11
|
loader_version=0.14.17
|
||||||
fabric_version=0.69.1+1.19.3
|
fabric_version=0.76.0+1.19.4
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
group=com.minelittlepony
|
group=com.minelittlepony
|
||||||
|
@ -15,19 +15,19 @@ org.gradle.daemon=false
|
||||||
description=Magical Abilities for Mine Little Pony!
|
description=Magical Abilities for Mine Little Pony!
|
||||||
|
|
||||||
# Publishing
|
# Publishing
|
||||||
minecraft_version_range=>=1.19.3-pre1
|
minecraft_version_range=>=1.19.4
|
||||||
modrinth_loader_type=fabric
|
modrinth_loader_type=fabric
|
||||||
modrinth_project_id=
|
modrinth_project_id=
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabwork_version=1.1.9
|
fabwork_version=1.1.9
|
||||||
modmenu_version=5.0.0-alpha.3
|
modmenu_version=6.1.0-rc.4
|
||||||
minelp_version=4.8.7+lts.1.19.3
|
minelp_version=4.8.7
|
||||||
kirin_version=1.13.2
|
kirin_version=1.14.0
|
||||||
reach_attributes_version=2.3.1
|
reach_attributes_version=2.3.2
|
||||||
trinkets_version=3.5.0
|
trinkets_version=3.6.0
|
||||||
terraformer_api_version=5.0.0
|
terraformer_api_version=6.1.0
|
||||||
|
|
||||||
# TMI Testing
|
# TMI Testing
|
||||||
tmi_type=emi
|
tmi_type=emi
|
||||||
emi_version=1.0.0+1.19.3
|
emi_version=1.0.0+1.19.4
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.minelittlepony.unicopia.item.toxin.Toxics;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.damage.DamageType;
|
||||||
import net.minecraft.entity.effect.StatusEffect;
|
import net.minecraft.entity.effect.StatusEffect;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.registry.*;
|
import net.minecraft.registry.*;
|
||||||
|
@ -39,6 +40,8 @@ public interface UTags {
|
||||||
|
|
||||||
TagKey<StatusEffect> PINEAPPLE_EFFECTS = effect("pineapple_effects");
|
TagKey<StatusEffect> PINEAPPLE_EFFECTS = effect("pineapple_effects");
|
||||||
|
|
||||||
|
TagKey<DamageType> BREAKS_SUNGLASSES = damage("breaks_sunglasses");
|
||||||
|
|
||||||
static TagKey<Item> item(String name) {
|
static TagKey<Item> item(String name) {
|
||||||
return TagKey.of(RegistryKeys.ITEM, Unicopia.id(name));
|
return TagKey.of(RegistryKeys.ITEM, Unicopia.id(name));
|
||||||
}
|
}
|
||||||
|
@ -55,6 +58,10 @@ public interface UTags {
|
||||||
return TagKey.of(RegistryKeys.STATUS_EFFECT, Unicopia.id(name));
|
return TagKey.of(RegistryKeys.STATUS_EFFECT, Unicopia.id(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static TagKey<DamageType> damage(String name) {
|
||||||
|
return TagKey.of(RegistryKeys.DAMAGE_TYPE, Unicopia.id(name));
|
||||||
|
}
|
||||||
|
|
||||||
static void bootstrap() {
|
static void bootstrap() {
|
||||||
Toxics.bootstrap();
|
Toxics.bootstrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class AbilityDispatcher implements Tickable, NbtSerialisable {
|
||||||
return getStat(slot).getMaxPage() > 0;
|
return getStat(slot).getMaxPage() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getMaxPage() {
|
public int getMaxPage() {
|
||||||
if (maxPage < 0 || prevRace != player.getSpecies()) {
|
if (maxPage < 0 || prevRace != player.getSpecies()) {
|
||||||
prevRace = player.getSpecies();
|
prevRace = player.getSpecies();
|
||||||
maxPage = 0;
|
maxPage = 0;
|
||||||
|
@ -84,7 +84,7 @@ public class AbilityDispatcher implements Tickable, NbtSerialisable {
|
||||||
maxPage = Math.max(maxPage, getStat(slot).getMaxPage() - 1);
|
maxPage = Math.max(maxPage, getStat(slot).getMaxPage() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return maxPage;
|
return (int)maxPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,8 +9,8 @@ import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
||||||
import com.minelittlepony.unicopia.advancement.UCriteria;
|
import com.minelittlepony.unicopia.advancement.UCriteria;
|
||||||
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
||||||
import com.minelittlepony.unicopia.entity.Living;
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.VecHelper;
|
import com.minelittlepony.unicopia.util.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
@ -82,14 +82,14 @@ public class BatEeeeAbility implements Ability<Hit> {
|
||||||
Vec3d origin = player.getOriginVector();
|
Vec3d origin = player.getOriginVector();
|
||||||
|
|
||||||
if (rng.nextInt(20000) == 0) {
|
if (rng.nextInt(20000) == 0) {
|
||||||
player.asEntity().damage(MagicalDamageSource.create("eeee", player).setBreakSunglasses(), 0.1F);
|
player.asEntity().damage(player.damageOf(UDamageTypes.BAT_SCREECH, player), 0.1F);
|
||||||
UCriteria.SCREECH_SELF.trigger(player.asEntity());
|
UCriteria.SCREECH_SELF.trigger(player.asEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
int total = player.findAllEntitiesInRange(5).mapToInt(e -> {
|
int total = player.findAllEntitiesInRange(5).mapToInt(e -> {
|
||||||
if (e instanceof LivingEntity living && !SpellType.SHIELD.isOn(e)) {
|
if (e instanceof LivingEntity living && !SpellType.SHIELD.isOn(e)) {
|
||||||
boolean isEarthPony = EquinePredicates.PLAYER_EARTH.test(e);
|
boolean isEarthPony = EquinePredicates.PLAYER_EARTH.test(e);
|
||||||
e.damage(MagicalDamageSource.create("eeee", player).setBreakSunglasses(), isEarthPony ? 0.1F : 0.3F);
|
e.damage(player.damageOf(UDamageTypes.BAT_SCREECH, player), isEarthPony ? 0.1F : 0.3F);
|
||||||
|
|
||||||
Vec3d knockVec = origin.subtract(e.getPos());
|
Vec3d knockVec = origin.subtract(e.getPos());
|
||||||
living.takeKnockback(isEarthPony ? 0.3F : 0.5F, knockVec.getX(), knockVec.getZ());
|
living.takeKnockback(isEarthPony ? 0.3F : 0.5F, knockVec.getX(), knockVec.getZ());
|
||||||
|
|
|
@ -7,11 +7,11 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
import com.minelittlepony.unicopia.ability.data.Hit;
|
import com.minelittlepony.unicopia.ability.data.Hit;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.TraceHelper;
|
import com.minelittlepony.unicopia.util.TraceHelper;
|
||||||
import com.minelittlepony.unicopia.util.VecHelper;
|
import com.minelittlepony.unicopia.util.VecHelper;
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ public class ChangelingFeedAbility implements Ability<Hit> {
|
||||||
float healAmount = 0;
|
float healAmount = 0;
|
||||||
|
|
||||||
for (LivingEntity i : getTargets(iplayer)) {
|
for (LivingEntity i : getTargets(iplayer)) {
|
||||||
healAmount += drainFrom(player, i);
|
healAmount += drainFrom(iplayer, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
int foodAmount = (int)Math.floor(Math.min(healAmount / 3, maximumFoodGain));
|
int foodAmount = (int)Math.floor(Math.min(healAmount / 3, maximumFoodGain));
|
||||||
|
@ -133,9 +133,9 @@ public class ChangelingFeedAbility implements Ability<Hit> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float drainFrom(PlayerEntity changeling, LivingEntity living) {
|
public float drainFrom(Pony changeling, LivingEntity living) {
|
||||||
|
|
||||||
DamageSource d = MagicalDamageSource.create("feed", changeling);
|
DamageSource d = changeling.damageOf(UDamageTypes.LOVE_DRAINING, changeling);
|
||||||
|
|
||||||
float damage = living.getHealth()/2;
|
float damage = living.getHealth()/2;
|
||||||
|
|
||||||
|
@ -144,13 +144,13 @@ public class ChangelingFeedAbility implements Ability<Hit> {
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleUtils.spawnParticles(UParticles.CHANGELING_MAGIC, living, 7);
|
ParticleUtils.spawnParticles(UParticles.CHANGELING_MAGIC, living, 7);
|
||||||
ParticleUtils.spawnParticles(new FollowingParticleEffect(UParticles.HEALTH_DRAIN, changeling, 0.2F), living, 1);
|
ParticleUtils.spawnParticles(new FollowingParticleEffect(UParticles.HEALTH_DRAIN, changeling.asEntity(), 0.2F), living, 1);
|
||||||
|
|
||||||
if (changeling.hasStatusEffect(StatusEffects.NAUSEA)) {
|
if (changeling.asEntity().hasStatusEffect(StatusEffects.NAUSEA)) {
|
||||||
StatusEffectInstance effect = changeling.getStatusEffect(StatusEffects.NAUSEA);
|
StatusEffectInstance effect = changeling.asEntity().getStatusEffect(StatusEffects.NAUSEA);
|
||||||
changeling.removeStatusEffect(StatusEffects.NAUSEA);
|
changeling.asEntity().removeStatusEffect(StatusEffects.NAUSEA);
|
||||||
living.addStatusEffect(effect);
|
living.addStatusEffect(effect);
|
||||||
} else if (changeling.getEntityWorld().random.nextInt(2300) == 0) {
|
} else if (changeling.asWorld().random.nextInt(2300) == 0) {
|
||||||
living.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 20, 1));
|
living.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 20, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +158,8 @@ public class ChangelingFeedAbility implements Ability<Hit> {
|
||||||
damage ++;
|
damage ++;
|
||||||
damage *= 1.6F;
|
damage *= 1.6F;
|
||||||
|
|
||||||
if (!changeling.hasStatusEffect(StatusEffects.HEALTH_BOOST)) {
|
if (!changeling.asEntity().hasStatusEffect(StatusEffects.HEALTH_BOOST)) {
|
||||||
changeling.addStatusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 13000, 1));
|
changeling.asEntity().addStatusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 13000, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.minelittlepony.unicopia.ability.data.tree.TreeType;
|
||||||
import com.minelittlepony.unicopia.client.minelittlepony.MineLPDelegate;
|
import com.minelittlepony.unicopia.client.minelittlepony.MineLPDelegate;
|
||||||
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
||||||
import com.minelittlepony.unicopia.entity.Living;
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
|
@ -82,7 +83,8 @@ public class EarthPonyKickAbility implements Ability<Pos> {
|
||||||
for (var e : VecHelper.findInRange(player.asEntity(), w, kickLocation.vec(), 2, EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR)) {
|
for (var e : VecHelper.findInRange(player.asEntity(), w, kickLocation.vec(), 2, EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR)) {
|
||||||
if (e instanceof LivingEntity entity) {
|
if (e instanceof LivingEntity entity) {
|
||||||
float calculatedStrength = 0.5F * (1 + player.getLevel().getScaled(9));
|
float calculatedStrength = 0.5F * (1 + player.getLevel().getScaled(9));
|
||||||
entity.damage(MagicalDamageSource.KICK, player.asWorld().random.nextBetween(2, 10) + calculatedStrength);
|
|
||||||
|
entity.damage(player.damageOf(UDamageTypes.KICK, player), player.asWorld().random.nextBetween(2, 10) + calculatedStrength);
|
||||||
entity.takeKnockback(calculatedStrength, origin.x - entity.getX(), origin.z - entity.getZ());
|
entity.takeKnockback(calculatedStrength, origin.x - entity.getX(), origin.z - entity.getZ());
|
||||||
Living.updateVelocity(entity);
|
Living.updateVelocity(entity);
|
||||||
player.subtractEnergyCost(3);
|
player.subtractEnergyCost(3);
|
||||||
|
@ -128,7 +130,7 @@ public class EarthPonyKickAbility implements Ability<Pos> {
|
||||||
if (MineLPDelegate.getInstance().getPlayerPonyRace(player.asEntity()).isEquine()) {
|
if (MineLPDelegate.getInstance().getPlayerPonyRace(player.asEntity()).isEquine()) {
|
||||||
kickVector = kickVector.rotateY((float)Math.PI);
|
kickVector = kickVector.rotateY((float)Math.PI);
|
||||||
}
|
}
|
||||||
return new Pos(new BlockPos(player.getOriginVector().add(kickVector)));
|
return new Pos(BlockPos.ofFloored(player.getOriginVector().add(kickVector)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,13 +6,13 @@ import com.minelittlepony.unicopia.Race;
|
||||||
import com.minelittlepony.unicopia.ability.data.Hit;
|
import com.minelittlepony.unicopia.ability.data.Hit;
|
||||||
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
||||||
import com.minelittlepony.unicopia.entity.Living;
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
import com.minelittlepony.unicopia.item.enchantment.UEnchantments;
|
import com.minelittlepony.unicopia.item.enchantment.UEnchantments;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import com.minelittlepony.unicopia.server.world.BlockDestructionManager;
|
import com.minelittlepony.unicopia.server.world.BlockDestructionManager;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.PosHelper;
|
import com.minelittlepony.unicopia.util.PosHelper;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -22,10 +22,10 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.attribute.EntityAttributes;
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.math.BlockBox;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Box;
|
import net.minecraft.util.math.Box;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
@ -122,8 +122,6 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
||||||
-(player.getY() - i.getY() - liftAmount) / inertia + (dist < 1 ? dist : 0),
|
-(player.getY() - i.getY() - liftAmount) / inertia + (dist < 1 ? dist : 0),
|
||||||
-(player.getZ() - i.getZ()) / inertia);
|
-(player.getZ() - i.getZ()) / inertia);
|
||||||
|
|
||||||
DamageSource damage = MagicalDamageSource.create("smash", iplayer);
|
|
||||||
|
|
||||||
double amount = (1.5F * player.getAttributeInstance(EntityAttributes.GENERIC_ATTACK_DAMAGE).getValue() + heavyness * 0.4) / (float)(dist * 1.3F);
|
double amount = (1.5F * player.getAttributeInstance(EntityAttributes.GENERIC_ATTACK_DAMAGE).getValue() + heavyness * 0.4) / (float)(dist * 1.3F);
|
||||||
|
|
||||||
if (i instanceof PlayerEntity) {
|
if (i instanceof PlayerEntity) {
|
||||||
|
@ -141,7 +139,7 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
||||||
amount /= 1 + (EnchantmentHelper.getEquipmentLevel(UEnchantments.PADDED, (LivingEntity)i) / 6F);
|
amount /= 1 + (EnchantmentHelper.getEquipmentLevel(UEnchantments.PADDED, (LivingEntity)i) / 6F);
|
||||||
}
|
}
|
||||||
|
|
||||||
i.damage(damage, (float)amount);
|
i.damage(iplayer.damageOf(UDamageTypes.SMASH, iplayer), (float)amount);
|
||||||
Living.updateVelocity(i);
|
Living.updateVelocity(i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -157,8 +155,7 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void spawnEffectAround(Entity source, BlockPos center, double radius, double range) {
|
public static void spawnEffectAround(Entity source, BlockPos center, double radius, double range) {
|
||||||
|
BlockPos.stream(new BlockBox(center).expand(MathHelper.ceil(radius))).forEach(i -> {
|
||||||
BlockPos.iterate(center.add(-radius, -radius, -radius), center.add(radius, radius, radius)).forEach(i -> {
|
|
||||||
double dist = Math.sqrt(i.getSquaredDistance(source.getX(), source.getY(), source.getZ()));
|
double dist = Math.sqrt(i.getSquaredDistance(source.getX(), source.getY(), source.getZ()));
|
||||||
|
|
||||||
if (dist <= radius) {
|
if (dist <= radius) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import com.minelittlepony.unicopia.*;
|
import com.minelittlepony.unicopia.*;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
||||||
import com.minelittlepony.unicopia.entity.*;
|
import com.minelittlepony.unicopia.entity.*;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageSources;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleSource;
|
import com.minelittlepony.unicopia.particle.ParticleSource;
|
||||||
import com.minelittlepony.unicopia.server.world.ModificationType;
|
import com.minelittlepony.unicopia.server.world.ModificationType;
|
||||||
import com.minelittlepony.unicopia.util.SoundEmitter;
|
import com.minelittlepony.unicopia.util.SoundEmitter;
|
||||||
|
@ -30,7 +31,8 @@ public interface Caster<E extends Entity> extends
|
||||||
Affine,
|
Affine,
|
||||||
ParticleSource<E>,
|
ParticleSource<E>,
|
||||||
SoundEmitter<E>,
|
SoundEmitter<E>,
|
||||||
EntityConvertable<E> {
|
EntityConvertable<E>,
|
||||||
|
UDamageSources {
|
||||||
|
|
||||||
Physics getPhysics();
|
Physics getPhysics();
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,12 @@ package com.minelittlepony.unicopia.ability.magic.spell;
|
||||||
import com.minelittlepony.unicopia.UTags;
|
import com.minelittlepony.unicopia.UTags;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.*;
|
import com.minelittlepony.unicopia.ability.magic.spell.effect.*;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleHandle;
|
import com.minelittlepony.unicopia.particle.ParticleHandle;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleHandle.Attachment;
|
import com.minelittlepony.unicopia.particle.ParticleHandle.Attachment;
|
||||||
import com.minelittlepony.unicopia.server.world.ModificationType;
|
import com.minelittlepony.unicopia.server.world.ModificationType;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.shape.Shape;
|
import com.minelittlepony.unicopia.util.shape.Shape;
|
||||||
import com.minelittlepony.unicopia.util.shape.Sphere;
|
import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class RainboomAbilitySpell extends AbstractSpell {
|
||||||
}
|
}
|
||||||
|
|
||||||
source.findAllEntitiesInRange(RADIUS).forEach(e -> {
|
source.findAllEntitiesInRange(RADIUS).forEach(e -> {
|
||||||
e.damage(MagicalDamageSource.create("rainboom", source).setBreakSunglasses(), 6);
|
e.damage(source.damageOf(UDamageTypes.RAINBOOM, source), 6);
|
||||||
});
|
});
|
||||||
EFFECT_RANGE.translate(source.getOrigin()).getBlockPositions().forEach(pos -> {
|
EFFECT_RANGE.translate(source.getOrigin()).getBlockPositions().forEach(pos -> {
|
||||||
BlockState state = source.asWorld().getBlockState(pos);
|
BlockState state = source.asWorld().getBlockState(pos);
|
||||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.PacketByteBuf;
|
import net.minecraft.network.PacketByteBuf;
|
||||||
import net.minecraft.recipe.RecipeSerializer;
|
import net.minecraft.recipe.RecipeSerializer;
|
||||||
import net.minecraft.recipe.ShapedRecipe;
|
import net.minecraft.recipe.ShapedRecipe;
|
||||||
|
import net.minecraft.registry.DynamicRegistryManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.JsonHelper;
|
import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.collection.DefaultedList;
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
|
@ -106,8 +107,8 @@ public class SpellCraftingRecipe implements SpellbookRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack craft(SpellbookInventory inventory) {
|
public ItemStack craft(SpellbookInventory inventory, DynamicRegistryManager registries) {
|
||||||
return getOutput().copy();
|
return getOutput(registries).copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -116,7 +117,7 @@ public class SpellCraftingRecipe implements SpellbookRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getOutput() {
|
public ItemStack getOutput(DynamicRegistryManager registries) {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.minelittlepony.unicopia.util.InventoryUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.PacketByteBuf;
|
import net.minecraft.network.PacketByteBuf;
|
||||||
import net.minecraft.recipe.RecipeSerializer;
|
import net.minecraft.recipe.RecipeSerializer;
|
||||||
|
import net.minecraft.registry.DynamicRegistryManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ public class SpellDuplicatingRecipe implements SpellbookRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack craft(SpellbookInventory inventory) {
|
public ItemStack craft(SpellbookInventory inventory, DynamicRegistryManager registries) {
|
||||||
return InventoryUtil.stream(inventory)
|
return InventoryUtil.stream(inventory)
|
||||||
.filter(i -> i.isOf(UItems.GEMSTONE))
|
.filter(i -> i.isOf(UItems.GEMSTONE))
|
||||||
.filter(EnchantableItem::isEnchanted)
|
.filter(EnchantableItem::isEnchanted)
|
||||||
|
@ -71,7 +72,7 @@ public class SpellDuplicatingRecipe implements SpellbookRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getOutput() {
|
public ItemStack getOutput(DynamicRegistryManager registries) {
|
||||||
ItemStack stack = UItems.GEMSTONE.getDefaultStack();
|
ItemStack stack = UItems.GEMSTONE.getDefaultStack();
|
||||||
stack.setCount(2);
|
stack.setCount(2);
|
||||||
return stack;
|
return stack;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.minelittlepony.unicopia.item.*;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.PacketByteBuf;
|
import net.minecraft.network.PacketByteBuf;
|
||||||
import net.minecraft.recipe.RecipeSerializer;
|
import net.minecraft.recipe.RecipeSerializer;
|
||||||
|
import net.minecraft.registry.DynamicRegistryManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ public class SpellEnhancingRecipe implements SpellbookRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack craft(SpellbookInventory inventory) {
|
public ItemStack craft(SpellbookInventory inventory, DynamicRegistryManager registries) {
|
||||||
return SpellTraits.of(inventory.getItemToModify())
|
return SpellTraits.of(inventory.getItemToModify())
|
||||||
.add(inventory.getTraits())
|
.add(inventory.getTraits())
|
||||||
.applyTo(inventory.getItemToModify());
|
.applyTo(inventory.getItemToModify());
|
||||||
|
@ -57,7 +58,7 @@ public class SpellEnhancingRecipe implements SpellbookRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getOutput() {
|
public ItemStack getOutput(DynamicRegistryManager registries) {
|
||||||
return UItems.GEMSTONE.getDefaultStack();
|
return UItems.GEMSTONE.getDefaultStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,23 +10,24 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.PacketByteBuf;
|
import net.minecraft.network.PacketByteBuf;
|
||||||
import net.minecraft.recipe.RecipeSerializer;
|
import net.minecraft.recipe.RecipeSerializer;
|
||||||
import net.minecraft.recipe.ShapedRecipe;
|
import net.minecraft.recipe.ShapedRecipe;
|
||||||
|
import net.minecraft.registry.DynamicRegistryManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class SpellShapedCraftingRecipe extends ShapedRecipe {
|
public class SpellShapedCraftingRecipe extends ShapedRecipe {
|
||||||
|
|
||||||
public SpellShapedCraftingRecipe(ShapedRecipe recipe) {
|
public SpellShapedCraftingRecipe(ShapedRecipe recipe) {
|
||||||
super(recipe.getId(), recipe.getGroup(), recipe.getCategory(), recipe.getWidth(), recipe.getHeight(), recipe.getIngredients(), recipe.getOutput());
|
super(recipe.getId(), recipe.getGroup(), recipe.getCategory(), recipe.getWidth(), recipe.getHeight(), recipe.getIngredients(), recipe.getOutput(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack craft(CraftingInventory inventory) {
|
public ItemStack craft(CraftingInventory inventory, DynamicRegistryManager registries) {
|
||||||
return InventoryUtil.stream(inventory)
|
return InventoryUtil.stream(inventory)
|
||||||
.filter(stack -> stack.getItem() instanceof EnchantableItem)
|
.filter(stack -> stack.getItem() instanceof EnchantableItem)
|
||||||
.filter(EnchantableItem::isEnchanted)
|
.filter(EnchantableItem::isEnchanted)
|
||||||
.map(stack -> ((EnchantableItem)stack.getItem()).getSpellEffect(stack))
|
.map(stack -> ((EnchantableItem)stack.getItem()).getSpellEffect(stack))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.map(spell -> spell.traits().applyTo(EnchantableItem.enchant(super.craft(inventory), spell.type())))
|
.map(spell -> spell.traits().applyTo(EnchantableItem.enchant(super.craft(inventory, registries), spell.type())))
|
||||||
.orElseGet(() -> super.craft(inventory));
|
.orElseGet(() -> super.craft(inventory, registries));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class AreaProtectionSpell extends AbstractAreaEffectSpell {
|
||||||
Vec3d origin = source.getOriginVector();
|
Vec3d origin = source.getOriginVector();
|
||||||
|
|
||||||
source.spawnParticles(origin, new Sphere(true, radius), (int)(radius * 6), pos -> {
|
source.spawnParticles(origin, new Sphere(true, radius), (int)(radius * 6), pos -> {
|
||||||
if (!source.asWorld().isAir(new BlockPos(pos))) {
|
if (!source.asWorld().isAir(BlockPos.ofFloored(pos))) {
|
||||||
source.addParticle(new MagicParticleEffect(getType().getColor()), pos, Vec3d.ZERO);
|
source.addParticle(new MagicParticleEffect(getType().getColor()), pos, Vec3d.ZERO);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,12 +5,12 @@ import com.minelittlepony.unicopia.ability.magic.spell.*;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
||||||
import com.minelittlepony.unicopia.entity.EntityReference;
|
import com.minelittlepony.unicopia.entity.EntityReference;
|
||||||
import com.minelittlepony.unicopia.entity.Living;
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
||||||
import com.minelittlepony.unicopia.particle.MagicParticleEffect;
|
import com.minelittlepony.unicopia.particle.MagicParticleEffect;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
|
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
|
||||||
import com.minelittlepony.unicopia.projectile.ProjectileDelegate;
|
import com.minelittlepony.unicopia.projectile.ProjectileDelegate;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.shape.Sphere;
|
import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -93,7 +93,7 @@ public class AttractiveSpell extends ShieldSpell implements HomingSpell, TimedSp
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isGood && source.asWorld().random.nextInt(4500) == 0) {
|
if (!isGood && source.asWorld().random.nextInt(4500) == 0) {
|
||||||
source.asEntity().damage(MagicalDamageSource.create("vortex"), 4);
|
source.asEntity().damage(source.damageOf(UDamageTypes.GAVITY_WELL_RECOIL, source), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
AttractionUtils.applyForce(getOrigin(source), target, -force, 0, false);
|
AttractionUtils.applyForce(getOrigin(source), target, -force, 0, false);
|
||||||
|
|
|
@ -8,18 +8,17 @@ import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
|
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits;
|
import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleHandle.Attachment;
|
import com.minelittlepony.unicopia.particle.ParticleHandle.Attachment;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
import com.minelittlepony.unicopia.particle.SphereParticleEffect;
|
import com.minelittlepony.unicopia.particle.SphereParticleEffect;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
|
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
|
||||||
import com.minelittlepony.unicopia.projectile.ProjectileDelegate;
|
import com.minelittlepony.unicopia.projectile.ProjectileDelegate;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.shape.Sphere;
|
import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.FallingBlockEntity;
|
import net.minecraft.entity.FallingBlockEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.projectile.PersistentProjectileEntity;
|
import net.minecraft.entity.projectile.PersistentProjectileEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -220,7 +219,7 @@ public class DarkVortexSpell extends AttractiveSpell implements ProjectileDelega
|
||||||
}
|
}
|
||||||
} else if (target instanceof PersistentProjectileEntity) {
|
} else if (target instanceof PersistentProjectileEntity) {
|
||||||
if (master != null) {
|
if (master != null) {
|
||||||
master.damage(DamageSource.thrownProjectile(target, ((PersistentProjectileEntity)target).getOwner()), 4);
|
master.damage(master.getDamageSources().thrown(target, ((PersistentProjectileEntity)target).getOwner()), 4);
|
||||||
}
|
}
|
||||||
target.discard();
|
target.discard();
|
||||||
return;
|
return;
|
||||||
|
@ -230,7 +229,7 @@ public class DarkVortexSpell extends AttractiveSpell implements ProjectileDelega
|
||||||
|
|
||||||
accumulatedMass += massOfTarget;
|
accumulatedMass += massOfTarget;
|
||||||
setDirty();
|
setDirty();
|
||||||
target.damage(MagicalDamageSource.create("black_hole"), Integer.MAX_VALUE);
|
target.damage(source.damageOf(UDamageTypes.GAVITY_WELL_RECOIL, source), Integer.MAX_VALUE);
|
||||||
if (!(target instanceof PlayerEntity)) {
|
if (!(target instanceof PlayerEntity)) {
|
||||||
target.discard();
|
target.discard();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
|
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
|
||||||
import com.minelittlepony.unicopia.projectile.ProjectileDelegate;
|
import com.minelittlepony.unicopia.projectile.ProjectileDelegate;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
|
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
@ -29,7 +28,7 @@ public class DispellEvilSpell extends AbstractSpell implements ProjectileDelegat
|
||||||
}
|
}
|
||||||
|
|
||||||
source.findAllEntitiesInRange(getTraits().get(Trait.POWER) * 10, e -> e.getType() == EntityType.PHANTOM).forEach(entity -> {
|
source.findAllEntitiesInRange(getTraits().get(Trait.POWER) * 10, e -> e.getType() == EntityType.PHANTOM).forEach(entity -> {
|
||||||
entity.damage(MagicalDamageSource.MAGIC, 50);
|
entity.damage(entity.getDamageSources().magic(), 50);
|
||||||
if (entity instanceof LivingEntity l) {
|
if (entity instanceof LivingEntity l) {
|
||||||
double d = source.getOriginVector().getX() - entity.getX();
|
double d = source.getOriginVector().getX() - entity.getX();
|
||||||
double e = source.getOriginVector().getZ() - entity.getZ();
|
double e = source.getOriginVector().getZ() - entity.getZ();
|
||||||
|
|
|
@ -6,10 +6,10 @@ import com.minelittlepony.unicopia.ability.magic.spell.*;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
||||||
import com.minelittlepony.unicopia.entity.CastSpellEntity;
|
import com.minelittlepony.unicopia.entity.CastSpellEntity;
|
||||||
import com.minelittlepony.unicopia.entity.EntityReference;
|
import com.minelittlepony.unicopia.entity.EntityReference;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleHandle.Attachment;
|
import com.minelittlepony.unicopia.particle.ParticleHandle.Attachment;
|
||||||
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
|
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
|
||||||
import com.minelittlepony.unicopia.projectile.ProjectileDelegate;
|
import com.minelittlepony.unicopia.projectile.ProjectileDelegate;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
@ -62,8 +62,8 @@ public class DisplacementSpell extends AbstractSpell implements HomingSpell, Pla
|
||||||
Vec3d sourcePos = originator.getOriginVector();
|
Vec3d sourcePos = originator.getOriginVector();
|
||||||
Vec3d sourceVel = originator.asEntity().getVelocity();
|
Vec3d sourceVel = originator.asEntity().getVelocity();
|
||||||
|
|
||||||
teleport(target, sourcePos, sourceVel);
|
teleport(originator, target, sourcePos, sourceVel);
|
||||||
teleport(originator.asEntity(), destinationPos, destinationVel);
|
teleport(originator, originator.asEntity(), destinationPos, destinationVel);
|
||||||
originator.subtractEnergyCost(destinationPos.distanceTo(sourcePos) / 20F);
|
originator.subtractEnergyCost(destinationPos.distanceTo(sourcePos) / 20F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class DisplacementSpell extends AbstractSpell implements HomingSpell, Pla
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void teleport(Entity entity, Vec3d pos, Vec3d vel) {
|
private void teleport(Caster<?> source, Entity entity, Vec3d pos, Vec3d vel) {
|
||||||
entity.teleport(pos.x, pos.y, pos.z);
|
entity.teleport(pos.x, pos.y, pos.z);
|
||||||
entity.setVelocity(vel);
|
entity.setVelocity(vel);
|
||||||
entity.setGlowing(false);
|
entity.setGlowing(false);
|
||||||
|
@ -88,7 +88,7 @@ public class DisplacementSpell extends AbstractSpell implements HomingSpell, Pla
|
||||||
|
|
||||||
float damage = getTraits().get(Trait.BLOOD);
|
float damage = getTraits().get(Trait.BLOOD);
|
||||||
if (damage > 0) {
|
if (damage > 0) {
|
||||||
entity.damage(MagicalDamageSource.EXHAUSTION, damage);
|
entity.damage(source.damageOf(UDamageTypes.EXHAUSTION, source), damage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.minelittlepony.unicopia.ability.magic.spell.effect;
|
package com.minelittlepony.unicopia.ability.magic.spell.effect;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.EquinePredicates;
|
import com.minelittlepony.unicopia.EquinePredicates;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
|
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
|
||||||
|
@ -12,7 +10,6 @@ import com.minelittlepony.unicopia.block.state.StateMaps;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
|
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
|
||||||
import com.minelittlepony.unicopia.projectile.ProjectileDelegate;
|
import com.minelittlepony.unicopia.projectile.ProjectileDelegate;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.shape.Sphere;
|
import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -23,6 +20,7 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.ItemEntity;
|
import net.minecraft.entity.ItemEntity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
|
import net.minecraft.entity.damage.DamageTypes;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
@ -134,7 +132,7 @@ public class FireSpell extends AbstractAreaEffectSpell implements ProjectileDele
|
||||||
(master instanceof PlayerEntity && !EquinePredicates.PLAYER_UNICORN.test(master))) && !(e instanceof ItemEntity)
|
(master instanceof PlayerEntity && !EquinePredicates.PLAYER_UNICORN.test(master))) && !(e instanceof ItemEntity)
|
||||||
&& !(e instanceof Caster<?>)) {
|
&& !(e instanceof Caster<?>)) {
|
||||||
e.setOnFireFor(60);
|
e.setOnFireFor(60);
|
||||||
e.damage(getDamageCause(e, master), 0.1f);
|
e.damage(getDamageCause(source, e), 0.1f);
|
||||||
playEffect(source.asWorld(), e.getBlockPos());
|
playEffect(source.asWorld(), e.getBlockPos());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -142,8 +140,8 @@ public class FireSpell extends AbstractAreaEffectSpell implements ProjectileDele
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DamageSource getDamageCause(Entity target, @Nullable LivingEntity attacker) {
|
protected DamageSource getDamageCause(Caster<?> source, Entity target) {
|
||||||
return MagicalDamageSource.create("fire", attacker);
|
return source.damageOf(DamageTypes.IN_FIRE, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class HydrophobicSpell extends AbstractSpell {
|
||||||
setDead();
|
setDead();
|
||||||
}
|
}
|
||||||
source.spawnParticles(new Sphere(true, getRange(source)), 10, pos -> {
|
source.spawnParticles(new Sphere(true, getRange(source)), 10, pos -> {
|
||||||
BlockPos bp = new BlockPos(pos);
|
BlockPos bp = BlockPos.ofFloored(pos);
|
||||||
if (source.asWorld().getFluidState(bp.up()).isIn(affectedFluid)) {
|
if (source.asWorld().getFluidState(bp.up()).isIn(affectedFluid)) {
|
||||||
source.addParticle(UParticles.RAIN_DROPS, pos, Vec3d.ZERO);
|
source.addParticle(UParticles.RAIN_DROPS, pos, Vec3d.ZERO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
||||||
import com.minelittlepony.unicopia.block.state.StateMaps;
|
import com.minelittlepony.unicopia.block.state.StateMaps;
|
||||||
import com.minelittlepony.unicopia.block.state.StatePredicate;
|
import com.minelittlepony.unicopia.block.state.StatePredicate;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.PosHelper;
|
import com.minelittlepony.unicopia.util.PosHelper;
|
||||||
import com.minelittlepony.unicopia.util.VecHelper;
|
import com.minelittlepony.unicopia.util.VecHelper;
|
||||||
import com.minelittlepony.unicopia.util.shape.Shape;
|
import com.minelittlepony.unicopia.util.shape.Shape;
|
||||||
|
@ -19,6 +18,7 @@ import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.TntEntity;
|
import net.minecraft.entity.TntEntity;
|
||||||
|
import net.minecraft.entity.damage.DamageTypes;
|
||||||
import net.minecraft.entity.Entity.RemovalReason;
|
import net.minecraft.entity.Entity.RemovalReason;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.state.property.Properties;
|
import net.minecraft.state.property.Properties;
|
||||||
|
@ -91,7 +91,7 @@ public class IceSpell extends AbstractSpell {
|
||||||
} else if (e.isOnFire()) {
|
} else if (e.isOnFire()) {
|
||||||
e.extinguish();
|
e.extinguish();
|
||||||
} else {
|
} else {
|
||||||
e.damage(MagicalDamageSource.create("cold", source.getMaster()), 2);
|
e.damage(source.damageOf(DamageTypes.FREEZE, source), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,9 @@ import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
|
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
|
||||||
import com.minelittlepony.unicopia.block.state.BlockStateConverter;
|
import com.minelittlepony.unicopia.block.state.BlockStateConverter;
|
||||||
import com.minelittlepony.unicopia.block.state.StateMaps;
|
import com.minelittlepony.unicopia.block.state.StateMaps;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.shape.Shape;
|
import com.minelittlepony.unicopia.util.shape.Shape;
|
||||||
import com.minelittlepony.unicopia.util.shape.Sphere;
|
import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -41,7 +37,7 @@ public class InfernoSpell extends FireSpell {
|
||||||
BlockStateConverter converter = w.getDimension().ultrawarm() ? StateMaps.HELLFIRE_AFFECTED.getInverse() : StateMaps.HELLFIRE_AFFECTED;
|
BlockStateConverter converter = w.getDimension().ultrawarm() ? StateMaps.HELLFIRE_AFFECTED.getInverse() : StateMaps.HELLFIRE_AFFECTED;
|
||||||
|
|
||||||
for (int i = 0; i < radius; i++) {
|
for (int i = 0; i < radius; i++) {
|
||||||
BlockPos pos = new BlockPos(shape.computePoint(w.random).add(origin));
|
BlockPos pos = BlockPos.ofFloored(shape.computePoint(w.random).add(origin));
|
||||||
|
|
||||||
if (source.canModifyAt(pos) && converter.convert(w, pos)) {
|
if (source.canModifyAt(pos) && converter.convert(w, pos)) {
|
||||||
playEffect(w, pos);
|
playEffect(w, pos);
|
||||||
|
@ -53,7 +49,7 @@ public class InfernoSpell extends FireSpell {
|
||||||
if (w.random.nextInt(12) == 0) {
|
if (w.random.nextInt(12) == 0) {
|
||||||
Vec3d vec = shape.computePoint(w.random).add(origin);
|
Vec3d vec = shape.computePoint(w.random).add(origin);
|
||||||
|
|
||||||
if (!applyBlocks(w, new BlockPos(vec))) {
|
if (!applyBlocks(w, BlockPos.ofFloored(vec))) {
|
||||||
applyEntities(source, vec);
|
applyEntities(source, vec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,12 +57,4 @@ public class InfernoSpell extends FireSpell {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected DamageSource getDamageCause(Entity target, LivingEntity attacker) {
|
|
||||||
if (attacker != null && attacker.getUuid().equals(target.getUuid())) {
|
|
||||||
return MagicalDamageSource.create("fire.own");
|
|
||||||
}
|
|
||||||
return MagicalDamageSource.create("fire", attacker);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import com.minelittlepony.unicopia.entity.behaviour.Inventory;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.nbt.NbtElement;
|
import net.minecraft.nbt.NbtElement;
|
||||||
|
|
||||||
|
@ -82,14 +81,14 @@ public class MindSwapSpell extends MimicSpell {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counterpart.getId().isPresent() && counterpart.get(caster.asWorld()) == null) {
|
if (counterpart.getId().isPresent() && counterpart.get(caster.asWorld()) == null) {
|
||||||
caster.getOriginatingCaster().asEntity().damage(DamageSource.MAGIC, Float.MAX_VALUE);
|
caster.getOriginatingCaster().asEntity().damage(caster.asWorld().getDamageSources().magic(), Float.MAX_VALUE);
|
||||||
setDead();
|
setDead();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!caster.asEntity().isAlive()) {
|
if (!caster.asEntity().isAlive()) {
|
||||||
counterpart.ifPresent(caster.asWorld(), e -> {
|
counterpart.ifPresent(caster.asWorld(), e -> {
|
||||||
e.damage(DamageSource.MAGIC, Float.MAX_VALUE);
|
e.damage(e.getDamageSources().magic(), Float.MAX_VALUE);
|
||||||
});
|
});
|
||||||
onDestroyed(caster);
|
onDestroyed(caster);
|
||||||
setDead();
|
setDead();
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class NecromancySpell extends AbstractAreaEffectSpell implements Projecti
|
||||||
|
|
||||||
if (source.isClient()) {
|
if (source.isClient()) {
|
||||||
source.spawnParticles(new Sphere(true, radius * 2), rainy ? 98 : 125, pos -> {
|
source.spawnParticles(new Sphere(true, radius * 2), rainy ? 98 : 125, pos -> {
|
||||||
BlockPos bpos = new BlockPos(pos);
|
BlockPos bpos = BlockPos.ofFloored(pos);
|
||||||
|
|
||||||
if (!source.asWorld().isAir(bpos.down())) {
|
if (!source.asWorld().isAir(bpos.down())) {
|
||||||
source.addParticle(source.asWorld().hasRain(bpos) ? ParticleTypes.SMOKE : ParticleTypes.FLAME, pos, Vec3d.ZERO);
|
source.addParticle(source.asWorld().hasRain(bpos) ? ParticleTypes.SMOKE : ParticleTypes.FLAME, pos, Vec3d.ZERO);
|
||||||
|
@ -123,7 +123,7 @@ public class NecromancySpell extends AbstractAreaEffectSpell implements Projecti
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
Vec3d pos = affectRegion.computePoint(source.asWorld().random).add(source.getOriginVector());
|
Vec3d pos = affectRegion.computePoint(source.asWorld().random).add(source.getOriginVector());
|
||||||
|
|
||||||
BlockPos loc = new BlockPos(pos);
|
BlockPos loc = BlockPos.ofFloored(pos);
|
||||||
|
|
||||||
if (source.asWorld().isAir(loc.up()) && !source.asWorld().isAir(loc)) {
|
if (source.asWorld().isAir(loc.up()) && !source.asWorld().isAir(loc)) {
|
||||||
spawnPool.get().ifPresent(type -> {
|
spawnPool.get().ifPresent(type -> {
|
||||||
|
@ -209,7 +209,7 @@ public class NecromancySpell extends AbstractAreaEffectSpell implements Projecti
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
Vec3d pos = affectRegion.computePoint(source.asWorld().random).add(source.getOriginVector());
|
Vec3d pos = affectRegion.computePoint(source.asWorld().random).add(source.getOriginVector());
|
||||||
|
|
||||||
BlockPos loc = new BlockPos(pos);
|
BlockPos loc = BlockPos.ofFloored(pos);
|
||||||
|
|
||||||
if (source.asWorld().isAir(loc.up()) && !source.asWorld().isAir(loc)) {
|
if (source.asWorld().isAir(loc.up()) && !source.asWorld().isAir(loc)) {
|
||||||
spawnPool.get().ifPresent(type -> {
|
spawnPool.get().ifPresent(type -> {
|
||||||
|
|
|
@ -13,11 +13,11 @@ import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.AbstractAreaEffectSpell;
|
import com.minelittlepony.unicopia.ability.magic.spell.AbstractAreaEffectSpell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
|
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.VecHelper;
|
import com.minelittlepony.unicopia.util.VecHelper;
|
||||||
import com.minelittlepony.unicopia.util.shape.Sphere;
|
import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class SiphoningSpell extends AbstractAreaEffectSpell {
|
||||||
int direction = isFriendlyTogether(source) ? 1 : -1;
|
int direction = isFriendlyTogether(source) ? 1 : -1;
|
||||||
|
|
||||||
source.spawnParticles(new Sphere(true, radius, 1, 0, 1), 1, pos -> {
|
source.spawnParticles(new Sphere(true, radius, 1, 0, 1), 1, pos -> {
|
||||||
if (!source.asWorld().isAir(new BlockPos(pos).down())) {
|
if (!source.asWorld().isAir(BlockPos.ofFloored(pos).down())) {
|
||||||
|
|
||||||
double dist = pos.distanceTo(source.getOriginVector());
|
double dist = pos.distanceTo(source.getOriginVector());
|
||||||
Vec3d velocity = pos.subtract(source.getOriginVector()).normalize().multiply(direction * dist);
|
Vec3d velocity = pos.subtract(source.getOriginVector()).normalize().multiply(direction * dist);
|
||||||
|
@ -87,7 +87,7 @@ public class SiphoningSpell extends AbstractAreaEffectSpell {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void distributeHealth(Caster<?> source) {
|
private void distributeHealth(Caster<?> source) {
|
||||||
DamageSource damage = MagicalDamageSource.create("drain", source);
|
DamageSource damage = source.damageOf(UDamageTypes.LIFE_DRAINING, source);
|
||||||
|
|
||||||
getTargets(source).forEach(e -> {
|
getTargets(source).forEach(e -> {
|
||||||
float maxHealthGain = e.getMaxHealth() - e.getHealth();
|
float maxHealthGain = e.getMaxHealth() - e.getHealth();
|
||||||
|
@ -127,7 +127,7 @@ public class SiphoningSpell extends AbstractAreaEffectSpell {
|
||||||
|
|
||||||
float attackAmount = Math.max(maxHealthGain / targets.size(), 0.5F);
|
float attackAmount = Math.max(maxHealthGain / targets.size(), 0.5F);
|
||||||
|
|
||||||
DamageSource damage = MagicalDamageSource.create("drain", source);
|
DamageSource damage = source.damageOf(UDamageTypes.LIFE_DRAINING, source);
|
||||||
|
|
||||||
float healthGain = 0;
|
float healthGain = 0;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.block;
|
package com.minelittlepony.unicopia.block;
|
||||||
|
|
||||||
import net.minecraft.block.AbstractBlock;
|
import net.minecraft.block.AbstractBlock;
|
||||||
|
import net.minecraft.block.BlockSetType;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.ButtonBlock;
|
import net.minecraft.block.ButtonBlock;
|
||||||
import net.minecraft.block.LeavesBlock;
|
import net.minecraft.block.LeavesBlock;
|
||||||
|
@ -9,19 +10,17 @@ import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.PillarBlock;
|
import net.minecraft.block.PillarBlock;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
import net.minecraft.sound.SoundEvent;
|
|
||||||
import net.minecraft.sound.SoundEvents;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
|
|
||||||
interface BlockConstructionUtils {
|
interface BlockConstructionUtils {
|
||||||
static ButtonBlock woodenButton() {
|
static ButtonBlock woodenButton() {
|
||||||
return woodenButton(BlockSoundGroup.WOOD, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON);
|
return woodenButton(BlockSoundGroup.WOOD, BlockSetType.OAK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ButtonBlock woodenButton(BlockSoundGroup soundGroup, SoundEvent clickOffSound, SoundEvent clickOnSound) {
|
static ButtonBlock woodenButton(BlockSoundGroup soundGroup, BlockSetType setType) {
|
||||||
return new ButtonBlock(AbstractBlock.Settings.of(Material.DECORATION).noCollision().strength(0.5f).sounds(soundGroup), 30, true, clickOffSound, clickOnSound);
|
return new ButtonBlock(AbstractBlock.Settings.of(Material.DECORATION).noCollision().strength(0.5f).sounds(soundGroup), setType, 30, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean never(BlockState state, BlockView world, BlockPos pos, EntityType<?> type) {
|
static boolean never(BlockState state, BlockView world, BlockPos pos, EntityType<?> type) {
|
||||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.block.*;
|
||||||
import net.minecraft.block.AbstractBlock.Settings;
|
import net.minecraft.block.AbstractBlock.Settings;
|
||||||
import net.minecraft.item.*;
|
import net.minecraft.item.*;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
import net.minecraft.sound.SoundEvents;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.shape.VoxelShapes;
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
|
@ -57,10 +56,10 @@ public interface UBlocks {
|
||||||
Block PALM_STAIRS = register("palm_stairs", new StairsBlock(PALM_PLANKS.getDefaultState(), Settings.copy(PALM_PLANKS)), ItemGroups.BUILDING_BLOCKS);
|
Block PALM_STAIRS = register("palm_stairs", new StairsBlock(PALM_PLANKS.getDefaultState(), Settings.copy(PALM_PLANKS)), ItemGroups.BUILDING_BLOCKS);
|
||||||
Block PALM_SLAB = register("palm_slab", new SlabBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD)), ItemGroups.BUILDING_BLOCKS);
|
Block PALM_SLAB = register("palm_slab", new SlabBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD)), ItemGroups.BUILDING_BLOCKS);
|
||||||
Block PALM_FENCE = register("palm_fence", new FenceBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD)), ItemGroups.BUILDING_BLOCKS);
|
Block PALM_FENCE = register("palm_fence", new FenceBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD)), ItemGroups.BUILDING_BLOCKS);
|
||||||
Block PALM_FENCE_GATE = register("palm_fence_gate", new FenceGateBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN), ItemGroups.BUILDING_BLOCKS);
|
Block PALM_FENCE_GATE = register("palm_fence_gate", new FenceGateBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD), WoodType.OAK), ItemGroups.BUILDING_BLOCKS);
|
||||||
// Block PALM_DOOR = register("palm_door", new DoorBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(3.0f).sounds(BlockSoundGroup.WOOD).nonOpaque(), SoundEvents.BLOCK_WOODEN_DOOR_CLOSE, SoundEvents.BLOCK_WOODEN_DOOR_OPEN), ItemGroups.BUILDING_BLOCKS);
|
// Block PALM_DOOR = register("palm_door", new DoorBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(3.0f).sounds(BlockSoundGroup.WOOD).nonOpaque(), SoundEvents.BLOCK_WOODEN_DOOR_CLOSE, SoundEvents.BLOCK_WOODEN_DOOR_OPEN), ItemGroups.BUILDING_BLOCKS);
|
||||||
// Block PALM_TRAPDOOR = register("palm_trapdoor", new TrapdoorBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(3.0f).sounds(BlockSoundGroup.WOOD).nonOpaque().allowsSpawning(UBlocks::never), SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN), ItemGroups.BUILDING_BLOCKS);
|
// Block PALM_TRAPDOOR = register("palm_trapdoor", new TrapdoorBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(3.0f).sounds(BlockSoundGroup.WOOD).nonOpaque().allowsSpawning(UBlocks::never), SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN), ItemGroups.BUILDING_BLOCKS);
|
||||||
Block PALM_PRESSURE_PLATE = register("palm_pressure_plate", new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).noCollision().strength(0.5f).sounds(BlockSoundGroup.WOOD), SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON), ItemGroups.BUILDING_BLOCKS);
|
Block PALM_PRESSURE_PLATE = register("palm_pressure_plate", new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).noCollision().strength(0.5f).sounds(BlockSoundGroup.WOOD), BlockSetType.OAK), ItemGroups.BUILDING_BLOCKS);
|
||||||
Block PALM_BUTTON = register("palm_button", BlockConstructionUtils.woodenButton(), ItemGroups.BUILDING_BLOCKS);
|
Block PALM_BUTTON = register("palm_button", BlockConstructionUtils.woodenButton(), ItemGroups.BUILDING_BLOCKS);
|
||||||
// Block PALM_SIGN = register("palm_sign", new SignBlock(Settings.of(Material.WOOD).noCollision().strength(1.0f).sounds(BlockSoundGroup.WOOD), PALM_SIGN_TYPE), ItemGroups.BUILDING_BLOCKS);
|
// Block PALM_SIGN = register("palm_sign", new SignBlock(Settings.of(Material.WOOD).noCollision().strength(1.0f).sounds(BlockSoundGroup.WOOD), PALM_SIGN_TYPE), ItemGroups.BUILDING_BLOCKS);
|
||||||
//
|
//
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.minelittlepony.unicopia.server.world.WeatherConditions;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.block.entity.*;
|
import net.minecraft.block.entity.*;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.packet.Packet;
|
||||||
import net.minecraft.network.listener.ClientPlayPacketListener;
|
import net.minecraft.network.listener.ClientPlayPacketListener;
|
||||||
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.LightningEntity;
|
import net.minecraft.entity.LightningEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
@ -74,7 +73,7 @@ public class ZapBlock extends Block {
|
||||||
} else {
|
} else {
|
||||||
float damage = 3 / dist;
|
float damage = 3 / dist;
|
||||||
if (damage > 1) {
|
if (damage > 1) {
|
||||||
other.damage(DamageSource.LIGHTNING_BOLT, damage);
|
other.damage(world.getDamageSources().lightningBolt(), damage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class DiscoveryToast implements Toast {
|
||||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||||
RenderSystem.setShaderColor(1.0F, 1, 1, 1);
|
RenderSystem.setShaderColor(1.0F, 1, 1, 1);
|
||||||
manager.drawTexture(matrices, 0, 0, 0, 32, getWidth(), getHeight());
|
ToastManager.drawTexture(matrices, 0, 0, 0, 32, getWidth(), getHeight());
|
||||||
manager.getClient().textRenderer.draw(matrices, TITLE, 30, 7, -11534256);
|
manager.getClient().textRenderer.draw(matrices, TITLE, 30, 7, -11534256);
|
||||||
manager.getClient().textRenderer.draw(matrices, DESCRIPTION, 30, 18, -16777216);
|
manager.getClient().textRenderer.draw(matrices, DESCRIPTION, 30, 18, -16777216);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class DiscoveryToast implements Toast {
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
matrixStack.scale(0.6F, 0.6F, 1);
|
matrixStack.scale(0.6F, 0.6F, 1);
|
||||||
RenderSystem.applyModelViewMatrix();
|
RenderSystem.applyModelViewMatrix();
|
||||||
manager.getClient().getItemRenderer().renderInGui(UItems.SPELLBOOK.getDefaultStack(), 3, 3);
|
manager.getClient().getItemRenderer().renderInGui(matrixStack, UItems.SPELLBOOK.getDefaultStack(), 3, 3);
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
RenderSystem.applyModelViewMatrix();
|
RenderSystem.applyModelViewMatrix();
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,9 @@ public class KeyBindingsHandler {
|
||||||
}
|
}
|
||||||
Pony iplayer = Pony.of(client.player);
|
Pony iplayer = Pony.of(client.player);
|
||||||
AbilityDispatcher abilities = iplayer.getAbilities();
|
AbilityDispatcher abilities = iplayer.getAbilities();
|
||||||
long maxPage = abilities.getMaxPage();
|
int maxPage = abilities.getMaxPage();
|
||||||
|
|
||||||
long page = MathHelper.clamp(Unicopia.getConfig().hudPage.get(), 0, maxPage);
|
int page = MathHelper.clamp(Unicopia.getConfig().hudPage.get(), 0, maxPage);
|
||||||
|
|
||||||
if (page > 0 && pageDown.getState() == PressedState.PRESSED) {
|
if (page > 0 && pageDown.getState() == PressedState.PRESSED) {
|
||||||
changePage(client, maxPage, -1);
|
changePage(client, maxPage, -1);
|
||||||
|
|
|
@ -34,9 +34,10 @@ import net.minecraft.client.item.ModelPredicateProviderRegistry;
|
||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.particle.SpriteProvider;
|
import net.minecraft.client.particle.SpriteProvider;
|
||||||
import net.minecraft.client.render.*;
|
import net.minecraft.client.render.*;
|
||||||
|
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;
|
||||||
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
|
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
|
||||||
import net.minecraft.client.render.item.ItemRenderer;
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.item.*;
|
import net.minecraft.item.*;
|
||||||
|
@ -77,7 +78,7 @@ public interface URenderers {
|
||||||
EntityRendererRegistry.register(UEntities.SPELLBOOK, SpellbookEntityRenderer::new);
|
EntityRendererRegistry.register(UEntities.SPELLBOOK, SpellbookEntityRenderer::new);
|
||||||
EntityRendererRegistry.register(UEntities.AIR_BALLOON, AirBalloonEntityRenderer::new);
|
EntityRendererRegistry.register(UEntities.AIR_BALLOON, AirBalloonEntityRenderer::new);
|
||||||
|
|
||||||
BlockEntityRendererRegistry.register(UBlockEntities.WEATHER_VANE, WeatherVaneBlockEntityRenderer::new);
|
BlockEntityRendererFactories.register(UBlockEntities.WEATHER_VANE, WeatherVaneBlockEntityRenderer::new);
|
||||||
|
|
||||||
ColorProviderRegistry.ITEM.register((stack, i) -> i > 0 ? -1 : ((DyeableItem)stack.getItem()).getColor(stack), UItems.FRIENDSHIP_BRACELET);
|
ColorProviderRegistry.ITEM.register((stack, i) -> i > 0 ? -1 : ((DyeableItem)stack.getItem()).getColor(stack), UItems.FRIENDSHIP_BRACELET);
|
||||||
BuiltinItemRendererRegistry.INSTANCE.register(UItems.FILLED_JAR, (stack, mode, matrices, vertexConsumers, light, overlay) -> {
|
BuiltinItemRendererRegistry.INSTANCE.register(UItems.FILLED_JAR, (stack, mode, matrices, vertexConsumers, light, overlay) -> {
|
||||||
|
@ -89,23 +90,24 @@ public interface URenderers {
|
||||||
// Reset stuff done in the beforelands
|
// Reset stuff done in the beforelands
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
|
|
||||||
if (mode == ModelTransformation.Mode.GUI) {
|
if (mode == ModelTransformationMode.GUI) {
|
||||||
DiffuseLighting.disableGuiDepthLighting();
|
DiffuseLighting.disableGuiDepthLighting();
|
||||||
}
|
}
|
||||||
|
|
||||||
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
|
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
|
||||||
|
ClientWorld world = MinecraftClient.getInstance().world;
|
||||||
|
|
||||||
if (item.hasAppearance(stack)) {
|
if (item.hasAppearance(stack)) {
|
||||||
matrices.push();
|
matrices.push();
|
||||||
matrices.scale(0.5F, 0.5F, 0.5F);
|
matrices.scale(0.5F, 0.5F, 0.5F);
|
||||||
matrices.translate(0.0125, 0.1, 0);
|
matrices.translate(0.0125, 0.1, 0);
|
||||||
renderer.renderItem(item.getAppearanceStack(stack), mode, light, overlay, matrices, immediate, 0);
|
renderer.renderItem(item.getAppearanceStack(stack), mode, light, overlay, matrices, immediate, world, 0);
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
renderer.renderItem(item.createAppearanceStack(stack, UItems.EMPTY_JAR), mode, light, OverlayTexture.DEFAULT_UV, matrices, immediate, 0);
|
renderer.renderItem(item.createAppearanceStack(stack, UItems.EMPTY_JAR), mode, light, OverlayTexture.DEFAULT_UV, matrices, immediate, world, 0);
|
||||||
immediate.draw();
|
immediate.draw();
|
||||||
|
|
||||||
if (mode == ModelTransformation.Mode.GUI) {
|
if (mode == ModelTransformationMode.GUI) {
|
||||||
DiffuseLighting.enableGuiDepthLighting();
|
DiffuseLighting.enableGuiDepthLighting();
|
||||||
}
|
}
|
||||||
matrices.push();
|
matrices.push();
|
||||||
|
|
|
@ -213,13 +213,22 @@ public class DismissSpellScreen extends GameGui {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendNarrations(NarrationMessageBuilder var1) {
|
public void appendNarrations(NarrationMessageBuilder builder) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SelectionType getType() {
|
public SelectionType getType() {
|
||||||
return SelectionType.HOVERED;
|
return SelectionType.HOVERED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFocused(boolean focused) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFocused() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void playClickEffect() {
|
static void playClickEffect() {
|
||||||
|
|
|
@ -41,7 +41,7 @@ public interface DrawableUtil {
|
||||||
}
|
}
|
||||||
RenderSystem.applyModelViewMatrix();
|
RenderSystem.applyModelViewMatrix();
|
||||||
|
|
||||||
MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(stack, 0, 0);
|
MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(modelStack, stack, 0, 0);
|
||||||
|
|
||||||
modelStack.pop();
|
modelStack.pop();
|
||||||
RenderSystem.applyModelViewMatrix();
|
RenderSystem.applyModelViewMatrix();
|
||||||
|
@ -54,7 +54,6 @@ public interface DrawableUtil {
|
||||||
|
|
||||||
static void drawLine(MatrixStack matrices, int x1, int y1, int x2, int y2, int color) {
|
static void drawLine(MatrixStack matrices, int x1, int y1, int x2, int y2, int color) {
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.disableTexture();
|
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||||
|
|
||||||
|
@ -66,14 +65,12 @@ public interface DrawableUtil {
|
||||||
float k = (color & 255) / 255F;
|
float k = (color & 255) / 255F;
|
||||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.disableTexture();
|
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||||
bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION_COLOR);
|
bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION_COLOR);
|
||||||
bufferBuilder.vertex(matrix, x1, y1, 0).color(r, g, b, k).next();
|
bufferBuilder.vertex(matrix, x1, y1, 0).color(r, g, b, k).next();
|
||||||
bufferBuilder.vertex(matrix, x2, y2, 0).color(r, g, b, k).next();
|
bufferBuilder.vertex(matrix, x2, y2, 0).color(r, g, b, k).next();
|
||||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||||
RenderSystem.enableTexture();
|
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +98,6 @@ public interface DrawableUtil {
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.disableTexture();
|
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
|
|
||||||
Matrix4f model = matrices.peek().getPositionMatrix();
|
Matrix4f model = matrices.peek().getPositionMatrix();
|
||||||
|
@ -121,7 +117,6 @@ public interface DrawableUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||||
RenderSystem.enableTexture();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,7 +156,6 @@ public interface DrawableUtil {
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.disableTexture();
|
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
|
|
||||||
Matrix4f model = matrices.peek().getPositionMatrix();
|
Matrix4f model = matrices.peek().getPositionMatrix();
|
||||||
|
@ -187,7 +181,6 @@ public interface DrawableUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||||
RenderSystem.enableTexture();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void cylendricalVertex(BufferBuilder bufferBuilder, Matrix4f model, double radius, double angle, float r, float g, float b, float k) {
|
private static void cylendricalVertex(BufferBuilder bufferBuilder, Matrix4f model, double radius, double angle, float r, float g, float b, float k) {
|
||||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.util.math.MathHelper;
|
||||||
public interface GradientUtil {
|
public interface GradientUtil {
|
||||||
|
|
||||||
static void fillVerticalGradient(MatrixStack matrices, int startX, int startY, int stopY, int endX, int endY, int colorStart, int colorStop, int colorEnd, int z) {
|
static void fillVerticalGradient(MatrixStack matrices, int startX, int startY, int stopY, int endX, int endY, int colorStart, int colorStop, int colorEnd, int z) {
|
||||||
RenderSystem.disableTexture();
|
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||||
|
@ -20,7 +19,6 @@ public interface GradientUtil {
|
||||||
fillVerticalGradient(matrices.peek().getPositionMatrix(), bufferBuilder, startX, startY, stopY, endX, endY, z, colorStart, colorStop, colorEnd);
|
fillVerticalGradient(matrices.peek().getPositionMatrix(), bufferBuilder, startX, startY, stopY, endX, endY, z, colorStart, colorStop, colorEnd);
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
RenderSystem.enableTexture();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fillVerticalGradient(Matrix4f matrix, BufferBuilder builder, int startX, int startY, int stopY, int endX, int endY, int z, int colorStart, int colorStop, int colorEnd) {
|
private static void fillVerticalGradient(Matrix4f matrix, BufferBuilder builder, int startX, int startY, int stopY, int endX, int endY, int z, int colorStart, int colorStop, int colorEnd) {
|
||||||
|
@ -50,7 +48,6 @@ public interface GradientUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fillRadialGradient(MatrixStack matrices, int startX, int startY, int endX, int endY, int colorStart, int colorEnd, int z, float radius) {
|
static void fillRadialGradient(MatrixStack matrices, int startX, int startY, int endX, int endY, int colorStart, int colorEnd, int z, float radius) {
|
||||||
RenderSystem.disableTexture();
|
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||||
|
@ -59,7 +56,6 @@ public interface GradientUtil {
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
}
|
}
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
RenderSystem.enableTexture();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean fillRadials(Matrix4f matrix, BufferBuilder builder, int startX, int startY, int endX, int endY, int z, int colorStart, int colorEnd, float radius) {
|
private static boolean fillRadials(Matrix4f matrix, BufferBuilder builder, int startX, int startY, int endX, int endY, int z, int colorStart, int colorEnd, float radius) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.font.TextRenderer;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.font.TextRenderer.TextLayerType;
|
||||||
import net.minecraft.client.gui.DrawableHelper;
|
import net.minecraft.client.gui.DrawableHelper;
|
||||||
import net.minecraft.client.gui.tooltip.TooltipComponent;
|
import net.minecraft.client.gui.tooltip.TooltipComponent;
|
||||||
import net.minecraft.client.render.Tessellator;
|
import net.minecraft.client.render.Tessellator;
|
||||||
|
@ -53,7 +54,7 @@ public class ItemTraitsTooltipRenderer implements Text, OrderedText, TooltipComp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer, int z) {
|
public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer) {
|
||||||
int columns = getColumns();
|
int columns = getColumns();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -115,14 +116,13 @@ public class ItemTraitsTooltipRenderer implements Text, OrderedText, TooltipComp
|
||||||
|
|
||||||
public static void renderTraitIcon(Trait trait, float value, MatrixStack matrices, float xx, float yy, boolean reveal) {
|
public static void renderTraitIcon(Trait trait, float value, MatrixStack matrices, float xx, float yy, boolean reveal) {
|
||||||
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||||
ItemRenderer itemRenderer = MinecraftClient.getInstance().getItemRenderer();
|
|
||||||
|
|
||||||
int size = 12;
|
int size = 12;
|
||||||
|
|
||||||
RenderSystem.setShaderTexture(0, reveal ? trait.getSprite() : UNKNOWN);
|
RenderSystem.setShaderTexture(0, reveal ? trait.getSprite() : UNKNOWN);
|
||||||
|
|
||||||
matrices.push();
|
matrices.push();
|
||||||
matrices.translate(xx, yy, itemRenderer.zOffset + 300.0F);
|
matrices.translate(xx, yy, 300F);
|
||||||
|
|
||||||
DrawableHelper.drawTexture(matrices, 2, 1, 0, 0, 0, size, size, size, size);
|
DrawableHelper.drawTexture(matrices, 2, 1, 0, 0, 0, size, size, size, size);
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ public class ItemTraitsTooltipRenderer implements Text, OrderedText, TooltipComp
|
||||||
String count = value > 99 ? "99+" : Math.round(value) == value ? (int)value + "" : ((Math.round(value * 10) / 10F) + "");
|
String count = value > 99 ? "99+" : Math.round(value) == value ? (int)value + "" : ((Math.round(value * 10) / 10F) + "");
|
||||||
|
|
||||||
VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
|
VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
|
||||||
textRenderer.draw(count, 0, 0, 16777215, true, matrices.peek().getPositionMatrix(), immediate, false, 0, 15728880);
|
textRenderer.draw(count, 0, 0, 16777215, true, matrices.peek().getPositionMatrix(), immediate, TextLayerType.SEE_THROUGH, 0, 15728880);
|
||||||
immediate.draw();
|
immediate.draw();
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class TribeButton extends Button {
|
||||||
|
|
||||||
if (hovered && screenWidth > 0) {
|
if (hovered && screenWidth > 0) {
|
||||||
Identifier id = Race.REGISTRY.getId(race);
|
Identifier id = Race.REGISTRY.getId(race);
|
||||||
drawCenteredText(matrices, getFont(), Text.translatable("gui.unicopia.tribe_selection.describe." + id.getNamespace() + "." + id.getPath()), screenWidth / 2, getY() + height, 0xFFFFFFFF);
|
drawCenteredTextWithShadow(matrices, getFont(), Text.translatable("gui.unicopia.tribe_selection.describe." + id.getNamespace() + "." + id.getPath()), screenWidth / 2, getY() + height, 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class UHud extends DrawableHelper {
|
||||||
view.push();
|
view.push();
|
||||||
view.translate(x, y, 0);
|
view.translate(x, y, 0);
|
||||||
view.multiply(RotationAxis.POSITIVE_X.rotationDegrees(xDirection * 45));
|
view.multiply(RotationAxis.POSITIVE_X.rotationDegrees(xDirection * 45));
|
||||||
InventoryScreen.drawEntity(0, 0, scale, 0, -20, client.player);
|
InventoryScreen.drawEntity(view, 0, 0, scale, 0, -20, client.player);
|
||||||
view.pop();
|
view.pop();
|
||||||
RenderSystem.applyModelViewMatrix();
|
RenderSystem.applyModelViewMatrix();
|
||||||
});
|
});
|
||||||
|
@ -235,7 +235,7 @@ public class UHud extends DrawableHelper {
|
||||||
|
|
||||||
color |= alpha;
|
color |= alpha;
|
||||||
|
|
||||||
drawCenteredText(matrices, client.textRenderer, message, 25, -15, color);
|
drawCenteredTextWithShadow(matrices, client.textRenderer, message, 25, -15, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,13 +261,13 @@ public class UHud extends DrawableHelper {
|
||||||
GradientUtil.fillRadialGradient(matrices, 0, 0, scaledWidth, scaledHeight,
|
GradientUtil.fillRadialGradient(matrices, 0, 0, scaledWidth, scaledHeight,
|
||||||
color | (alpha1 << 24),
|
color | (alpha1 << 24),
|
||||||
color | (alpha2 << 24),
|
color | (alpha2 << 24),
|
||||||
getZOffset(), 1);
|
0, 1);
|
||||||
} else {
|
} else {
|
||||||
GradientUtil.fillVerticalGradient(matrices, 0, 0, scaledHeight / 2, scaledWidth, scaledHeight,
|
GradientUtil.fillVerticalGradient(matrices, 0, 0, scaledHeight / 2, scaledWidth, scaledHeight,
|
||||||
color | (alpha1 << 24),
|
color | (alpha1 << 24),
|
||||||
color | (alpha2 << 24),
|
color | (alpha2 << 24),
|
||||||
color | (alpha1 << 24),
|
color | (alpha1 << 24),
|
||||||
getZOffset());
|
0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ public class UHud extends DrawableHelper {
|
||||||
GradientUtil.fillRadialGradient(matrices, 0, 0, scaledWidth, scaledHeight,
|
GradientUtil.fillRadialGradient(matrices, 0, 0, scaledWidth, scaledHeight,
|
||||||
color | (int)alpha1 << 24,
|
color | (int)alpha1 << 24,
|
||||||
color | (int)alpha2 << 24,
|
color | (int)alpha2 << 24,
|
||||||
getZOffset(), Math.min(1, radius));
|
0, Math.min(1, radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessage(Text message) {
|
public void setMessage(Text message) {
|
||||||
|
|
|
@ -52,15 +52,15 @@ public class EquippedSpellSlot extends Button {
|
||||||
} else {
|
} else {
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
drawItem((int)pos.x, (int)pos.y);
|
drawItem(matrices, (int)pos.x, (int)pos.y);
|
||||||
}
|
}
|
||||||
if (isHovered()) {
|
if (isHovered()) {
|
||||||
HandledScreen.drawSlotHighlight(matrices, getX(), getY(), 0);
|
HandledScreen.drawSlotHighlight(matrices, getX(), getY(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawItem(int x, int y) {
|
protected void drawItem(MatrixStack matrices, int x, int y) {
|
||||||
itemRenderer.renderInGui(spell.getDefaultStack(), x, y);
|
itemRenderer.renderInGui(matrices, spell.getDefaultStack(), x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.item.TooltipContext;
|
import net.minecraft.client.item.TooltipContext;
|
||||||
import net.minecraft.client.render.*;
|
import net.minecraft.client.render.*;
|
||||||
import net.minecraft.client.render.item.ItemRenderer;
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
|
@ -243,11 +243,11 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
||||||
|
|
||||||
Vector4f pos = new Vector4f(x, y, 0, 1);
|
Vector4f pos = new Vector4f(x, y, 0, 1);
|
||||||
pos.mul(matrices.peek().getPositionMatrix());
|
pos.mul(matrices.peek().getPositionMatrix());
|
||||||
drawItem((int)pos.x, (int)pos.y);
|
drawItem(matrices, (int)pos.x, (int)pos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawItem(int x, int y) {
|
protected void drawItem(MatrixStack matrices, int x, int y) {
|
||||||
itemRenderer.renderInGui(stack, x, y);
|
itemRenderer.renderInGui(matrices, stack, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -276,7 +276,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawItem(int x, int y) {
|
protected void drawItem(MatrixStack matrices, int x, int y) {
|
||||||
var model = itemRenderer.getModel(stack, null, null, 0);
|
var model = itemRenderer.getModel(stack, null, null, 0);
|
||||||
|
|
||||||
MinecraftClient.getInstance().getTextureManager().getTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).setFilter(false, false);
|
MinecraftClient.getInstance().getTextureManager().getTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).setFilter(false, false);
|
||||||
|
@ -286,7 +286,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 0.2F);
|
RenderSystem.setShaderColor(1, 1, 1, 0.2F);
|
||||||
MatrixStack matrixStack = RenderSystem.getModelViewStack();
|
MatrixStack matrixStack = RenderSystem.getModelViewStack();
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
matrixStack.translate(x, y, 100 + itemRenderer.zOffset);
|
matrixStack.translate(x, y, 100);
|
||||||
matrixStack.translate(8, 8, 0);
|
matrixStack.translate(8, 8, 0);
|
||||||
matrixStack.scale(1, -1, 1);
|
matrixStack.scale(1, -1, 1);
|
||||||
matrixStack.scale(8, 8, 8);
|
matrixStack.scale(8, 8, 8);
|
||||||
|
@ -298,7 +298,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
||||||
}
|
}
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest();
|
||||||
try {
|
try {
|
||||||
itemRenderer.renderItem(stack, ModelTransformation.Mode.GUI, false, new MatrixStack(), layer -> PassThroughVertexConsumer.of(immediate.getBuffer(layer), FIXTURE), 0, OverlayTexture.DEFAULT_UV, model);
|
itemRenderer.renderItem(stack, ModelTransformationMode.GUI, false, matrices, layer -> PassThroughVertexConsumer.of(immediate.getBuffer(layer), FIXTURE), 0, OverlayTexture.DEFAULT_UV, model);
|
||||||
immediate.draw();
|
immediate.draw();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Sodium
|
// Sodium
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class SpellbookCraftingPageContent extends ScrollContainer implements Spe
|
||||||
public SpellbookCraftingPageContent(SpellbookScreen screen) {
|
public SpellbookCraftingPageContent(SpellbookScreen screen) {
|
||||||
this.screen = screen;
|
this.screen = screen;
|
||||||
backgroundColor = 0xFFf9efd3;
|
backgroundColor = 0xFFf9efd3;
|
||||||
scrollbar.layoutToEnd = true;
|
verticalScrollbar.layoutToEnd = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,7 +72,7 @@ public class SpellbookCraftingPageContent extends ScrollContainer implements Spe
|
||||||
int top = 0;
|
int top = 0;
|
||||||
for (SpellbookRecipe recipe : this.client.world.getRecipeManager().listAllOfType(URecipes.SPELLBOOK)) {
|
for (SpellbookRecipe recipe : this.client.world.getRecipeManager().listAllOfType(URecipes.SPELLBOOK)) {
|
||||||
if (client.player.getRecipeBook().contains(recipe)) {
|
if (client.player.getRecipeBook().contains(recipe)) {
|
||||||
IngredientTree tree = new IngredientTree(0, top, width - scrollbar.getBounds().width + 2);
|
IngredientTree tree = new IngredientTree(0, top, width - verticalScrollbar.getBounds().width + 2);
|
||||||
recipe.buildCraftingTree(tree);
|
recipe.buildCraftingTree(tree);
|
||||||
top += tree.build(this);
|
top += tree.build(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||||
import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
|
import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
|
||||||
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
|
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
|
||||||
import net.minecraft.client.render.GameRenderer;
|
import net.minecraft.client.render.GameRenderer;
|
||||||
import net.minecraft.client.texture.NativeImage;
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.screen.slot.Slot;
|
import net.minecraft.screen.slot.Slot;
|
||||||
|
@ -32,6 +31,7 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.ColorHelper;
|
||||||
|
|
||||||
public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> implements RecipeBookProvider {
|
public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> implements RecipeBookProvider {
|
||||||
public static final Identifier TEXTURE = Unicopia.id("textures/gui/container/book.png");
|
public static final Identifier TEXTURE = Unicopia.id("textures/gui/container/book.png");
|
||||||
|
@ -143,7 +143,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
|
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
|
||||||
renderBackground(matrices, 0);
|
renderBackground(matrices);
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
||||||
if (color == 0xFFFFFF || color == 0) {
|
if (color == 0xFFFFFF || color == 0) {
|
||||||
v += 48;
|
v += 48;
|
||||||
} else {
|
} else {
|
||||||
RenderSystem.setShaderColor(NativeImage.getRed(color) / 255F, NativeImage.getGreen(color) / 255F, NativeImage.getBlue(color) / 255F, 1);
|
RenderSystem.setShaderColor(ColorHelper.Abgr.getRed(color) / 255F, ColorHelper.Abgr.getGreen(color) / 255F, ColorHelper.Abgr.getBlue(color) / 255F, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isRight = tab.chapter().side() == TabSide.RIGHT;
|
boolean isRight = tab.chapter().side() == TabSide.RIGHT;
|
||||||
|
|
|
@ -61,8 +61,8 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel
|
||||||
rightPage.init(screen, page + 1);
|
rightPage.init(screen, page + 1);
|
||||||
screen.addPageButtons(187, 30, 350, incr -> {
|
screen.addPageButtons(187, 30, 350, incr -> {
|
||||||
state.swap(incr, (int)Math.ceil(traits.length / 2F));
|
state.swap(incr, (int)Math.ceil(traits.length / 2F));
|
||||||
leftPage.scrollbar.scrollBy(leftPage.scrollbar.getVerticalScrollAmount());
|
leftPage.verticalScrollbar.scrollBy(leftPage.verticalScrollbar.getScrubber().getPosition());
|
||||||
rightPage.scrollbar.scrollBy(rightPage.scrollbar.getVerticalScrollAmount());
|
rightPage.verticalScrollbar.scrollBy(rightPage.verticalScrollbar.getScrubber().getPosition());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,8 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel
|
||||||
page /= 2;
|
page /= 2;
|
||||||
state = screen.getState().getState(SpellbookChapterList.TRAIT_DEX_ID);
|
state = screen.getState().getState(SpellbookChapterList.TRAIT_DEX_ID);
|
||||||
state.setOffset(page);
|
state.setOffset(page);
|
||||||
leftPage.scrollbar.scrollBy(leftPage.scrollbar.getVerticalScrollAmount());
|
leftPage.verticalScrollbar.scrollBy(leftPage.verticalScrollbar.getScrubber().getPosition());
|
||||||
rightPage.scrollbar.scrollBy(rightPage.scrollbar.getVerticalScrollAmount());
|
rightPage.verticalScrollbar.scrollBy(rightPage.verticalScrollbar.getScrubber().getPosition());
|
||||||
|
|
||||||
GameGui.playSound(SoundEvents.ITEM_BOOK_PAGE_TURN);
|
GameGui.playSound(SoundEvents.ITEM_BOOK_PAGE_TURN);
|
||||||
screen.clearAndInit();
|
screen.clearAndInit();
|
||||||
|
@ -88,7 +88,7 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel
|
||||||
|
|
||||||
private final class DexPage extends ScrollContainer {
|
private final class DexPage extends ScrollContainer {
|
||||||
public DexPage() {
|
public DexPage() {
|
||||||
scrollbar.layoutToEnd = true;
|
verticalScrollbar.layoutToEnd = true;
|
||||||
backgroundColor = 0xFFf9efd3;
|
backgroundColor = 0xFFf9efd3;
|
||||||
getContentPadding().setVertical(10);
|
getContentPadding().setVertical(10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class GroundPoundParticle extends Particle {
|
||||||
Vec3d vel = new Vec3d(0, (0.5 + (Math.sin(age) * 2.5)) * 5, 0);
|
Vec3d vel = new Vec3d(0, (0.5 + (Math.sin(age) * 2.5)) * 5, 0);
|
||||||
|
|
||||||
new Sphere(true, age, 1, 0, 1).translate(getPos()).randomPoints(random).forEach(point -> {
|
new Sphere(true, age, 1, 0, 1).translate(getPos()).randomPoints(random).forEach(point -> {
|
||||||
BlockPos pos = new BlockPos(point).down();
|
BlockPos pos = BlockPos.ofFloored(point).down();
|
||||||
|
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
if (state.isAir()) {
|
if (state.isAir()) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.client.render.entity.EntityRenderer;
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.client.render.item.ItemRenderer;
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
import net.minecraft.client.render.model.BakedModel;
|
import net.minecraft.client.render.model.BakedModel;
|
||||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
|
@ -38,7 +38,7 @@ public class FloatingArtefactEntityRenderer extends EntityRenderer<FloatingArtef
|
||||||
|
|
||||||
final float variance = 0.25F;
|
final float variance = 0.25F;
|
||||||
final float verticalOffset = entity.getVerticalOffset(timeDelta);
|
final float verticalOffset = entity.getVerticalOffset(timeDelta);
|
||||||
final float modelScaleY = model.getTransformation().getTransformation(ModelTransformation.Mode.GROUND).scale.y;
|
final float modelScaleY = model.getTransformation().getTransformation(ModelTransformationMode.GROUND).scale.y;
|
||||||
|
|
||||||
float scale = 1.6F;
|
float scale = 1.6F;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class FloatingArtefactEntityRenderer extends EntityRenderer<FloatingArtef
|
||||||
transforms.translate(0, verticalOffset + variance * modelScaleY, 0);
|
transforms.translate(0, verticalOffset + variance * modelScaleY, 0);
|
||||||
transforms.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(entity.getRotation(timeDelta)));
|
transforms.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(entity.getRotation(timeDelta)));
|
||||||
|
|
||||||
itemRenderer.renderItem(stack, ModelTransformation.Mode.GROUND, false, transforms, renderContext, lightUv, OverlayTexture.DEFAULT_UV, model);
|
itemRenderer.renderItem(stack, ModelTransformationMode.GROUND, false, transforms, renderContext, lightUv, OverlayTexture.DEFAULT_UV, model);
|
||||||
|
|
||||||
transforms.pop();
|
transforms.pop();
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.entity.model.TridentEntityModel;
|
import net.minecraft.client.render.entity.model.TridentEntityModel;
|
||||||
import net.minecraft.client.render.item.ItemRenderer;
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
import net.minecraft.client.render.model.BakedModel;
|
import net.minecraft.client.render.model.BakedModel;
|
||||||
import net.minecraft.client.render.model.json.ModelTransformation.Mode;
|
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||||
import net.minecraft.client.util.ModelIdentifier;
|
import net.minecraft.client.util.ModelIdentifier;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
@ -51,9 +51,9 @@ public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredica
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(ItemStack stack, Mode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
public void render(ItemStack stack, ModelTransformationMode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||||
|
|
||||||
if (mode == Mode.GUI || mode == Mode.GROUND || mode == Mode.FIXED) {
|
if (mode == ModelTransformationMode.GUI || mode == ModelTransformationMode.GROUND || mode == ModelTransformationMode.FIXED) {
|
||||||
// render as normal sprite
|
// render as normal sprite
|
||||||
ItemRenderer renderer = MinecraftClient.getInstance().getItemRenderer();
|
ItemRenderer renderer = MinecraftClient.getInstance().getItemRenderer();
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ public class ViewportShader implements SynchronousResourceReloader, Identifiable
|
||||||
if (shader != null && client.player != null) {
|
if (shader != null && client.player != null) {
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest();
|
||||||
RenderSystem.enableTexture();
|
|
||||||
RenderSystem.resetTextureMatrix();
|
RenderSystem.resetTextureMatrix();
|
||||||
|
|
||||||
Pony pony = Pony.of(client.player);
|
Pony pony = Pony.of(client.player);
|
||||||
|
|
|
@ -24,6 +24,8 @@ import dev.emi.emi.api.stack.Comparison;
|
||||||
import dev.emi.emi.api.stack.EmiStack;
|
import dev.emi.emi.api.stack.EmiStack;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.recipe.RecipeType;
|
import net.minecraft.recipe.RecipeType;
|
||||||
|
import net.minecraft.registry.DynamicRegistryManager;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class Main implements EmiPlugin {
|
public class Main implements EmiPlugin {
|
||||||
|
@ -72,10 +74,11 @@ public class Main implements EmiPlugin {
|
||||||
registry.setDefaultComparison(item, comparison -> Comparison.compareNbt());
|
registry.setDefaultComparison(item, comparison -> Comparison.compareNbt());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DynamicRegistryManager registries = DynamicRegistryManager.of(Registries.REGISTRIES);
|
||||||
registry.getRecipeManager().listAllOfType(RecipeType.CRAFTING).stream()
|
registry.getRecipeManager().listAllOfType(RecipeType.CRAFTING).stream()
|
||||||
.filter(recipe -> recipe instanceof SpellShapedCraftingRecipe)
|
.filter(recipe -> recipe instanceof SpellShapedCraftingRecipe)
|
||||||
.map(SpellShapedCraftingRecipe.class::cast).forEach(recipe -> {
|
.map(SpellShapedCraftingRecipe.class::cast).forEach(recipe -> {
|
||||||
ItemStack output = recipe.getOutput();
|
ItemStack output = recipe.getOutput(registries);
|
||||||
if (output.getItem() instanceof MultiItem multiItem && output.getItem() instanceof EnchantableItem enchantable) {
|
if (output.getItem() instanceof MultiItem multiItem && output.getItem() instanceof EnchantableItem enchantable) {
|
||||||
multiItem.getDefaultStacks().forEach(outputVariation -> {
|
multiItem.getDefaultStacks().forEach(outputVariation -> {
|
||||||
var spellEffect = enchantable.getSpellEffect(outputVariation);
|
var spellEffect = enchantable.getSpellEffect(outputVariation);
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class SpellbookScreenHandler extends ScreenHandler {
|
||||||
.stream().sorted(Comparator.comparing(SpellbookRecipe::getPriority))
|
.stream().sorted(Comparator.comparing(SpellbookRecipe::getPriority))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.filter(recipe -> result.shouldCraftRecipe(world, (ServerPlayerEntity)this.inventory.player, recipe))
|
.filter(recipe -> result.shouldCraftRecipe(world, (ServerPlayerEntity)this.inventory.player, recipe))
|
||||||
.map(recipe -> recipe.craft(input))
|
.map(recipe -> recipe.craft(input, world.getRegistryManager()))
|
||||||
.orElseGet(this::getFallbackStack) : ItemStack.EMPTY;
|
.orElseGet(this::getFallbackStack) : ItemStack.EMPTY;
|
||||||
outputSlot.setStack(resultStack);
|
outputSlot.setStack(resultStack);
|
||||||
|
|
||||||
|
@ -298,10 +298,10 @@ public class SpellbookScreenHandler extends ScreenHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close(PlayerEntity playerEntity) {
|
public void onClosed(PlayerEntity player) {
|
||||||
super.close(playerEntity);
|
super.onClosed(player);
|
||||||
context.run((world, pos) -> {
|
context.run((world, pos) -> {
|
||||||
dropInventory(playerEntity, input);
|
dropInventory(player, input);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,8 +170,8 @@ public class AirBalloonEntity extends FlyingEntity implements EntityCollisions.C
|
||||||
e.distanceTraveled = 0;
|
e.distanceTraveled = 0;
|
||||||
e.horizontalSpeed = 0;
|
e.horizontalSpeed = 0;
|
||||||
if (e instanceof LivingEntity l) {
|
if (e instanceof LivingEntity l) {
|
||||||
l.limbAngle = 0;
|
l.limbAnimator.setSpeed(0);
|
||||||
l.limbDistance = 0;
|
l.limbAnimator.updateLimbs(0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class ButterflyEntity extends AmbientEntity {
|
||||||
breedingCooldown--;
|
breedingCooldown--;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos below = new BlockPos(getPos().add(0, -0.5, 0));
|
BlockPos below = BlockPos.ofFloored(getPos().add(0, -0.5, 0));
|
||||||
|
|
||||||
visited.entrySet().removeIf(e -> e.getValue() < age - 500);
|
visited.entrySet().removeIf(e -> e.getValue() < age - 500);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.entity.data.DataTracker;
|
||||||
import net.minecraft.entity.data.TrackedData;
|
import net.minecraft.entity.data.TrackedData;
|
||||||
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.packet.Packet;
|
||||||
import net.minecraft.network.listener.ClientPlayPacketListener;
|
import net.minecraft.network.listener.ClientPlayPacketListener;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import net.minecraft.entity.SpawnGroup;
|
||||||
import net.minecraft.entity.ai.goal.*;
|
import net.minecraft.entity.ai.goal.*;
|
||||||
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
||||||
import net.minecraft.entity.attribute.EntityAttributes;
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.entity.data.DataTracker;
|
import net.minecraft.entity.data.DataTracker;
|
||||||
import net.minecraft.entity.data.TrackedData;
|
import net.minecraft.entity.data.TrackedData;
|
||||||
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||||
|
@ -256,7 +255,7 @@ public class Creature extends Living<LivingEntity> implements WeaklyOwned.Mutabl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean subtractEnergyCost(double amount) {
|
public boolean subtractEnergyCost(double amount) {
|
||||||
getMaster().damage(DamageSource.MAGIC, (int)amount/2);
|
getMaster().damage(asEntity().getDamageSources().magic(), (int)amount/2);
|
||||||
return getMaster().getHealth() > 0;
|
return getMaster().getHealth() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.FenceGateBlock;
|
import net.minecraft.block.FenceGateBlock;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.entity.data.TrackedData;
|
import net.minecraft.entity.data.TrackedData;
|
||||||
import net.minecraft.entity.mob.MobEntity;
|
import net.minecraft.entity.mob.MobEntity;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
@ -44,7 +43,7 @@ public class EntityPhysics<T extends Entity> implements Physics, Copyable<Entity
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (isGravityNegative()) {
|
if (isGravityNegative()) {
|
||||||
if (entity.getY() > entity.world.getHeight() + 64) {
|
if (entity.getY() > entity.world.getHeight() + 64) {
|
||||||
entity.damage(DamageSource.OUT_OF_WORLD, 4.0F);
|
entity.damage(entity.getDamageSources().outOfWorld(), 4.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.setOnGround(entity.verticalCollision && entity.getVelocity().getY() > 0);
|
entity.setOnGround(entity.verticalCollision && entity.getVelocity().getY() > 0);
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class FairyEntity extends PathAwareEntity implements DynamicLightSource,
|
||||||
move(MovementType.SELF, getVelocity());
|
move(MovementType.SELF, getVelocity());
|
||||||
setVelocity(getVelocity().multiply(f));
|
setVelocity(getVelocity().multiply(f));
|
||||||
}
|
}
|
||||||
updateLimbs(this, false);
|
updateLimbs(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
package com.minelittlepony.unicopia.entity;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.USounds;
|
import com.minelittlepony.unicopia.USounds;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageSources;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
import com.minelittlepony.unicopia.network.Channel;
|
import com.minelittlepony.unicopia.network.Channel;
|
||||||
import com.minelittlepony.unicopia.network.MsgSpawnProjectile;
|
import com.minelittlepony.unicopia.network.MsgSpawnProjectile;
|
||||||
|
@ -13,14 +14,14 @@ import net.minecraft.entity.data.TrackedData;
|
||||||
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.packet.Packet;
|
||||||
import net.minecraft.network.listener.ClientPlayPacketListener;
|
import net.minecraft.network.listener.ClientPlayPacketListener;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class FloatingArtefactEntity extends Entity {
|
public class FloatingArtefactEntity extends Entity implements UDamageSources {
|
||||||
|
|
||||||
private static final TrackedData<ItemStack> ITEM = DataTracker.registerData(FloatingArtefactEntity.class, TrackedDataHandlerRegistry.ITEM_STACK);
|
private static final TrackedData<ItemStack> ITEM = DataTracker.registerData(FloatingArtefactEntity.class, TrackedDataHandlerRegistry.ITEM_STACK);
|
||||||
private static final TrackedData<Byte> STATE = DataTracker.registerData(FloatingArtefactEntity.class, TrackedDataHandlerRegistry.BYTE);
|
private static final TrackedData<Byte> STATE = DataTracker.registerData(FloatingArtefactEntity.class, TrackedDataHandlerRegistry.BYTE);
|
||||||
|
@ -190,6 +191,11 @@ public class FloatingArtefactEntity extends Entity {
|
||||||
return Channel.SERVER_SPAWN_PROJECTILE.toPacket(new MsgSpawnProjectile(this));
|
return Channel.SERVER_SPAWN_PROJECTILE.toPacket(new MsgSpawnProjectile(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public World asWorld() {
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
|
||||||
public enum State {
|
public enum State {
|
||||||
INITIALISING,
|
INITIALISING,
|
||||||
RUNNING,
|
RUNNING,
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.minelittlepony.unicopia.USounds;
|
import com.minelittlepony.unicopia.USounds;
|
||||||
|
import com.minelittlepony.unicopia.UTags;
|
||||||
import com.minelittlepony.unicopia.Unicopia;
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.ability.Abilities;
|
import com.minelittlepony.unicopia.ability.Abilities;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
|
@ -40,6 +41,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.network.packet.s2c.play.EntityPassengersSetS2CPacket;
|
import net.minecraft.network.packet.s2c.play.EntityPassengersSetS2CPacket;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
import net.minecraft.registry.tag.DamageTypeTags;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
|
@ -225,13 +227,13 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
||||||
|
|
||||||
Vec3d targetPos = entity.getRotationVector().multiply(2).add(entity.getEyePos());
|
Vec3d targetPos = entity.getRotationVector().multiply(2).add(entity.getEyePos());
|
||||||
|
|
||||||
if (entity.getWorld().isAir(new BlockPos(targetPos))) {
|
if (entity.getWorld().isAir(BlockPos.ofFloored(targetPos))) {
|
||||||
DragonBreathStore store = DragonBreathStore.get(entity.world);
|
DragonBreathStore store = DragonBreathStore.get(entity.world);
|
||||||
String name = entity.getDisplayName().getString();
|
String name = entity.getDisplayName().getString();
|
||||||
store.popEntries(name).forEach(stack -> {
|
store.popEntries(name).forEach(stack -> {
|
||||||
Vec3d randomPos = targetPos.add(VecHelper.supply(() -> entity.getRandom().nextTriangular(0.1, 0.5)));
|
Vec3d randomPos = targetPos.add(VecHelper.supply(() -> entity.getRandom().nextTriangular(0.1, 0.5)));
|
||||||
|
|
||||||
if (!entity.getWorld().isAir(new BlockPos(randomPos))) {
|
if (!entity.getWorld().isAir(BlockPos.ofFloored(randomPos))) {
|
||||||
store.put(name, stack.payload());
|
store.put(name, stack.payload());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +274,7 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
||||||
|
|
||||||
public Optional<Boolean> onDamage(DamageSource source, float amount) {
|
public Optional<Boolean> onDamage(DamageSource source, float amount) {
|
||||||
|
|
||||||
if (source == DamageSource.LIGHTNING_BOLT && (invinsibilityTicks > 0 || tryCaptureLightning())) {
|
if (source.isIn(DamageTypeTags.IS_LIGHTNING) && (invinsibilityTicks > 0 || tryCaptureLightning())) {
|
||||||
return Optional.of(false);
|
return Optional.of(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +284,7 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
||||||
this.attacker = attacker;
|
this.attacker = attacker;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (magical.breaksSunglasses()) {
|
if (magical.isIn(UTags.BREAKS_SUNGLASSES)) {
|
||||||
ItemStack glasses = GlassesItem.getForEntity(entity);
|
ItemStack glasses = GlassesItem.getForEntity(entity);
|
||||||
if (glasses.getItem() == UItems.SUNGLASSES) {
|
if (glasses.getItem() == UItems.SUNGLASSES) {
|
||||||
ItemStack broken = UItems.BROKEN_SUNGLASSES.getDefaultStack();
|
ItemStack broken = UItems.BROKEN_SUNGLASSES.getDefaultStack();
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class SpellbookEntity extends MobEntity {
|
||||||
if (player instanceof ServerPlayerEntity recipient
|
if (player instanceof ServerPlayerEntity recipient
|
||||||
&& player.currentScreenHandler instanceof SpellbookScreenHandler book
|
&& player.currentScreenHandler instanceof SpellbookScreenHandler book
|
||||||
&& getUuid().equals(book.entityId)) {
|
&& getUuid().equals(book.entityId)) {
|
||||||
Channel.SERVER_SPELLBOOK_UPDATE.sendToPlayer(new MsgSpellbookStateChanged<>(player.currentScreenHandler.syncId, state), recipient);
|
Channel.SERVER_SPELLBOOK_UPDATE.sendToPlayer(new MsgSpellbookStateChanged<PlayerEntity>(book.syncId, state), recipient);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,7 +19,6 @@ import net.minecraft.entity.decoration.painting.PaintingVariant;
|
||||||
import net.minecraft.entity.mob.FlyingEntity;
|
import net.minecraft.entity.mob.FlyingEntity;
|
||||||
import net.minecraft.registry.*;
|
import net.minecraft.registry.*;
|
||||||
import net.minecraft.registry.tag.BiomeTags;
|
import net.minecraft.registry.tag.BiomeTags;
|
||||||
import net.minecraft.world.biome.Biome;
|
|
||||||
|
|
||||||
public interface UEntities {
|
public interface UEntities {
|
||||||
EntityType<ButterflyEntity> BUTTERFLY = register("butterfly", FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT, ButterflyEntity::new)
|
EntityType<ButterflyEntity> BUTTERFLY = register("butterfly", FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT, ButterflyEntity::new)
|
||||||
|
@ -65,7 +64,7 @@ public interface UEntities {
|
||||||
|
|
||||||
if (!Unicopia.getConfig().disableButterflySpawning.get()) {
|
if (!Unicopia.getConfig().disableButterflySpawning.get()) {
|
||||||
final Predicate<BiomeSelectionContext> butterflySpawnable = BiomeSelectors.foundInOverworld()
|
final Predicate<BiomeSelectionContext> butterflySpawnable = BiomeSelectors.foundInOverworld()
|
||||||
.and(ctx -> ctx.getBiome().getPrecipitation() == Biome.Precipitation.RAIN);
|
.and(ctx -> ctx.getBiome().hasPrecipitation() && ctx.getBiome().getTemperature() > 0.15F);
|
||||||
|
|
||||||
BiomeModifications.addSpawn(butterflySpawnable.and(
|
BiomeModifications.addSpawn(butterflySpawnable.and(
|
||||||
BiomeSelectors.tag(BiomeTags.IS_RIVER)
|
BiomeSelectors.tag(BiomeTags.IS_RIVER)
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.minelittlepony.unicopia.entity.duck.LivingEntityDuck;
|
||||||
import com.minelittlepony.unicopia.entity.Living;
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
import com.minelittlepony.unicopia.entity.duck.EntityDuck;
|
import com.minelittlepony.unicopia.entity.duck.EntityDuck;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
|
import com.minelittlepony.unicopia.util.LimbAnimationUtil;
|
||||||
import com.minelittlepony.unicopia.util.RegistryUtils;
|
import com.minelittlepony.unicopia.util.RegistryUtils;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -131,7 +132,7 @@ public class EntityBehaviour<T extends Entity> {
|
||||||
double y = positionOffset.y + Math.floor(from.getY());
|
double y = positionOffset.y + Math.floor(from.getY());
|
||||||
double z = positionOffset.z + Math.floor(from.getZ()) + 0.5;
|
double z = positionOffset.z + Math.floor(from.getZ()) + 0.5;
|
||||||
|
|
||||||
BlockPos pos = new BlockPos(x, y, z);
|
BlockPos pos = BlockPos.ofFloored(x, y, z);
|
||||||
|
|
||||||
if (!from.world.isAir(pos) && !from.world.isWater(pos)) {
|
if (!from.world.isAir(pos) && !from.world.isWater(pos)) {
|
||||||
y++;
|
y++;
|
||||||
|
@ -182,9 +183,7 @@ public class EntityBehaviour<T extends Entity> {
|
||||||
l.bodyYaw = from.bodyYaw;
|
l.bodyYaw = from.bodyYaw;
|
||||||
l.prevBodyYaw = from.prevBodyYaw;
|
l.prevBodyYaw = from.prevBodyYaw;
|
||||||
|
|
||||||
l.limbDistance = from.limbDistance;
|
LimbAnimationUtil.copy(from.limbAnimator, l.limbAnimator);
|
||||||
l.limbAngle = from.limbAngle;
|
|
||||||
l.lastLimbDistance = from.lastLimbDistance;
|
|
||||||
|
|
||||||
l.handSwingProgress = from.handSwingProgress;
|
l.handSwingProgress = from.handSwingProgress;
|
||||||
l.lastHandSwingProgress = from.lastHandSwingProgress;
|
l.lastHandSwingProgress = from.lastHandSwingProgress;
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.minelittlepony.unicopia.entity.behaviour;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.entity.Living;
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.entity.mob.WaterCreatureEntity;
|
import net.minecraft.entity.mob.WaterCreatureEntity;
|
||||||
|
|
||||||
public class WaterCreatureBehaviour extends EntityBehaviour<WaterCreatureEntity> {
|
public class WaterCreatureBehaviour extends EntityBehaviour<WaterCreatureEntity> {
|
||||||
|
@ -13,7 +12,7 @@ public class WaterCreatureBehaviour extends EntityBehaviour<WaterCreatureEntity>
|
||||||
source.asEntity().setAir(source.asEntity().getAir() - 1);
|
source.asEntity().setAir(source.asEntity().getAir() - 1);
|
||||||
if (source.asEntity().getAir() == -20) {
|
if (source.asEntity().getAir() == -20) {
|
||||||
source.asEntity().setAir(0);
|
source.asEntity().setAir(0);
|
||||||
source.asEntity().damage(DamageSource.DRYOUT, 2);
|
source.asEntity().damage(source.asEntity().getDamageSources().dryOut(), 2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
source.asEntity().setAir(300);
|
source.asEntity().setAir(300);
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.minelittlepony.unicopia.entity.damage;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.WorldConvertable;
|
||||||
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
|
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
||||||
|
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.damage.DamageType;
|
||||||
|
import net.minecraft.registry.RegistryKey;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public interface UDamageSources extends WorldConvertable {
|
||||||
|
|
||||||
|
static UDamageSources of(World world) {
|
||||||
|
return () -> world;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static RegistryEntry<DamageType> entryOf(WorldConvertable world, RegistryKey<DamageType> type) {
|
||||||
|
return world.asWorld().getRegistryManager().get(RegistryKeys.DAMAGE_TYPE).entryOf(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
default MagicalDamageSource damageOf(RegistryKey<DamageType> type) {
|
||||||
|
return new MagicalDamageSource(entryOf(this, type), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
default MagicalDamageSource damageOf(RegistryKey<DamageType> type, @Nullable LivingEntity source) {
|
||||||
|
return new MagicalDamageSource(entryOf(this, type), source, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
default MagicalDamageSource damageOf(RegistryKey<DamageType> type, @NotNull Caster<?> caster) {
|
||||||
|
return new MagicalDamageSource(entryOf(this, type), caster.asEntity(), caster.getMaster(), caster);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.minelittlepony.unicopia.entity.damage;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
|
|
||||||
|
import net.minecraft.entity.damage.DamageType;
|
||||||
|
import net.minecraft.registry.RegistryKey;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
|
||||||
|
public interface UDamageTypes {
|
||||||
|
RegistryKey<DamageType> EXHAUSTION = register("magical_exhaustion");
|
||||||
|
RegistryKey<DamageType> ALICORN_AMULET = register("alicorn_amulet");
|
||||||
|
RegistryKey<DamageType> FOOD_POISONING = register("food_poisoning");
|
||||||
|
RegistryKey<DamageType> TRIBE_SWAP = register("tribe_swap");
|
||||||
|
RegistryKey<DamageType> ZAP_APPLE = register("zap");
|
||||||
|
RegistryKey<DamageType> KICK = register("kick");
|
||||||
|
RegistryKey<DamageType> SMASH = register("smash");
|
||||||
|
RegistryKey<DamageType> BAT_SCREECH = register("bat_screech");
|
||||||
|
RegistryKey<DamageType> LOVE_DRAINING = register("love_draining");
|
||||||
|
RegistryKey<DamageType> LIFE_DRAINING = register("life_draining");
|
||||||
|
RegistryKey<DamageType> RAINBOOM = register("rainboom");
|
||||||
|
RegistryKey<DamageType> STEAMROLLER = register("steamroller");
|
||||||
|
RegistryKey<DamageType> GAVITY_WELL_RECOIL = register("gravity_well_recoil");
|
||||||
|
RegistryKey<DamageType> SUN = register("sun");
|
||||||
|
RegistryKey<DamageType> SUNLIGHT = register("sunlight");
|
||||||
|
RegistryKey<DamageType> PETRIFIED = register("petrified");
|
||||||
|
|
||||||
|
private static RegistryKey<DamageType> register(String name) {
|
||||||
|
return RegistryKey.of(RegistryKeys.DAMAGE_TYPE, Unicopia.id(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bootstrap() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,8 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.Owned;
|
import com.minelittlepony.unicopia.Owned;
|
||||||
import com.minelittlepony.unicopia.entity.Equine;
|
import com.minelittlepony.unicopia.entity.Equine;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
@ -69,7 +70,7 @@ public class CorruptInfluenceStatusEffect extends StatusEffect {
|
||||||
mob.world.syncWorldEvent((PlayerEntity)null, WorldEvents.ZOMBIE_INFECTS_VILLAGER, mob.getBlockPos(), 0);
|
mob.world.syncWorldEvent((PlayerEntity)null, WorldEvents.ZOMBIE_INFECTS_VILLAGER, mob.getBlockPos(), 0);
|
||||||
}
|
}
|
||||||
} else if (entity.age % 2000 == 0) {
|
} else if (entity.age % 2000 == 0) {
|
||||||
entity.damage(MagicalDamageSource.ALICORN_AMULET, 2);
|
entity.damage(Living.living(entity).damageOf(UDamageTypes.ALICORN_AMULET), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@ package com.minelittlepony.unicopia.entity.effect;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
@ -34,7 +35,7 @@ public class FoodPoisoningStatusEffect extends StatusEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.getHealth() > amplifier) {
|
if (entity.getHealth() > amplifier) {
|
||||||
entity.damage(MagicalDamageSource.FOOD_POISONING, amplifier);
|
entity.damage(Living.living(entity).damageOf(UDamageTypes.FOOD_POISONING), amplifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,11 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.entity.Equine;
|
import com.minelittlepony.unicopia.entity.Equine;
|
||||||
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.player.MagicReserves;
|
import com.minelittlepony.unicopia.entity.player.MagicReserves;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
@ -120,7 +121,7 @@ public class RaceChangeStatusEffect extends StatusEffect {
|
||||||
magic.getExertion().set(0);
|
magic.getExertion().set(0);
|
||||||
|
|
||||||
if (!pony.asEntity().isCreative()) {
|
if (!pony.asEntity().isCreative()) {
|
||||||
entity.damage(MagicalDamageSource.TRIBE_SWAP, Float.MAX_VALUE);
|
entity.damage(Living.living(entity).damageOf(UDamageTypes.TRIBE_SWAP), Float.MAX_VALUE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
eq.setSpecies(race);
|
eq.setSpecies(race);
|
||||||
|
|
|
@ -4,9 +4,10 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.EquinePredicates;
|
import com.minelittlepony.unicopia.EquinePredicates;
|
||||||
import com.minelittlepony.unicopia.UTags;
|
import com.minelittlepony.unicopia.UTags;
|
||||||
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.trinkets.TrinketsDelegate;
|
import com.minelittlepony.unicopia.trinkets.TrinketsDelegate;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EquipmentSlot;
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
|
@ -38,7 +39,7 @@ public class SunBlindnessStatusEffect extends StatusEffect {
|
||||||
if (!hasSunExposure(entity)) {
|
if (!hasSunExposure(entity)) {
|
||||||
entity.setStatusEffect(new StatusEffectInstance(this, (int)(state.getDuration() * 0.8F), Math.max(1, amplifier - 1), true, false), entity);
|
entity.setStatusEffect(new StatusEffectInstance(this, (int)(state.getDuration() * 0.8F), Math.max(1, amplifier - 1), true, false), entity);
|
||||||
} else {
|
} else {
|
||||||
entity.damage(amplifier == 2 ? MagicalDamageSource.SUN : MagicalDamageSource.SUNLIGHT, amplifier / 5F);
|
entity.damage(Living.living(entity).damageOf(amplifier == 2 ? UDamageTypes.SUN : UDamageTypes.SUNLIGHT), amplifier / 5F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.entity.player;
|
package com.minelittlepony.unicopia.entity.player;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
import com.minelittlepony.unicopia.entity.damage.UDamageSources;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
|
|
||||||
import net.minecraft.entity.player.HungerManager;
|
import net.minecraft.entity.player.HungerManager;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -62,7 +63,7 @@ public interface ManaConsumptionUtil {
|
||||||
foodSubtract = addExhaustion(hunger, foodSubtract);
|
foodSubtract = addExhaustion(hunger, foodSubtract);
|
||||||
foodSubtract -= (consumedHearts / HEARTS_PER_FOOD);
|
foodSubtract -= (consumedHearts / HEARTS_PER_FOOD);
|
||||||
if (consumedHearts > 0) {
|
if (consumedHearts > 0) {
|
||||||
entity.damage(MagicalDamageSource.EXHAUSTION, consumedHearts);
|
entity.damage(UDamageSources.of(entity.getWorld()).damageOf(UDamageTypes.EXHAUSTION), consumedHearts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.minelittlepony.unicopia.advancement.UCriteria;
|
||||||
import com.minelittlepony.unicopia.client.minelittlepony.MineLPDelegate;
|
import com.minelittlepony.unicopia.client.minelittlepony.MineLPDelegate;
|
||||||
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
||||||
import com.minelittlepony.unicopia.entity.*;
|
import com.minelittlepony.unicopia.entity.*;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.duck.LivingEntityDuck;
|
import com.minelittlepony.unicopia.entity.duck.LivingEntityDuck;
|
||||||
import com.minelittlepony.unicopia.entity.player.MagicReserves.Bar;
|
import com.minelittlepony.unicopia.entity.player.MagicReserves.Bar;
|
||||||
import com.minelittlepony.unicopia.input.Heuristic;
|
import com.minelittlepony.unicopia.input.Heuristic;
|
||||||
|
@ -28,8 +29,8 @@ import net.minecraft.entity.EntityPose;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.EquipmentSlot;
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
import net.minecraft.entity.LightningEntity;
|
import net.minecraft.entity.LightningEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
@ -326,8 +327,9 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.limbAngle = 20 + (float)Math.cos(entity.age / 7F) - 0.5F;
|
// TODO: Probably wrong. Need to redo this
|
||||||
entity.limbDistance = thrustScale;
|
entity.limbAnimator.setSpeed(20 + (float)Math.cos(entity.age / 7F) - 0.5F);
|
||||||
|
entity.limbAnimator.updateLimbs(thrustScale, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +482,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos pos = new BlockPos(entity.getCameraPosVec(1).add(entity.getRotationVec(1).normalize().multiply(2)));
|
BlockPos pos = BlockPos.ofFloored(entity.getCameraPosVec(1).add(entity.getRotationVec(1).normalize().multiply(2)));
|
||||||
|
|
||||||
BlockState state = entity.world.getBlockState(pos);
|
BlockState state = entity.world.getBlockState(pos);
|
||||||
|
|
||||||
|
@ -502,7 +504,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
} else {
|
} else {
|
||||||
entity.playSound(distance > 4 ? SoundEvents.ENTITY_PLAYER_BIG_FALL : SoundEvents.ENTITY_PLAYER_SMALL_FALL, 1, 1);
|
entity.playSound(distance > 4 ? SoundEvents.ENTITY_PLAYER_BIG_FALL : SoundEvents.ENTITY_PLAYER_SMALL_FALL, 1, 1);
|
||||||
}
|
}
|
||||||
entity.damage(DamageSource.FLY_INTO_WALL, distance);
|
entity.damage(entity.getDamageSources().flyIntoWall(), distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,14 +652,15 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
|
|
||||||
if (damage > 0) {
|
if (damage > 0) {
|
||||||
pony.subtractEnergyCost(damage / 5F);
|
pony.subtractEnergyCost(damage / 5F);
|
||||||
entity.damage(DamageSource.FLY_INTO_WALL, Math.min(damage, entity.getHealth() - 1));
|
entity.damage(entity.getDamageSources().flyIntoWall(), Math.min(damage, entity.getHealth() - 1));
|
||||||
if (!isEarthPonySmash) {
|
if (!isEarthPonySmash) {
|
||||||
UCriteria.BREAK_WINDOW.trigger(entity);
|
UCriteria.BREAK_WINDOW.trigger(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEarthPonySmash) {
|
if (isEarthPonySmash) {
|
||||||
pony.findAllEntitiesInRange(speed + 4, EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR).forEach(e -> e.damage(MagicalDamageSource.STEAMROLLER, 50));
|
DamageSource damageSource = pony.damageOf(UDamageTypes.STEAMROLLER);
|
||||||
|
pony.findAllEntitiesInRange(speed + 4, EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR).forEach(e -> e.damage(damageSource, 50));
|
||||||
}
|
}
|
||||||
|
|
||||||
pony.updateVelocity();
|
pony.updateVelocity();
|
||||||
|
|
|
@ -37,7 +37,7 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.entity.*;
|
import net.minecraft.entity.*;
|
||||||
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.entity.damage.EntityDamageSource;
|
import net.minecraft.entity.damage.DamageTypes;
|
||||||
import net.minecraft.entity.data.DataTracker;
|
import net.minecraft.entity.data.DataTracker;
|
||||||
import net.minecraft.entity.data.TrackedData;
|
import net.minecraft.entity.data.TrackedData;
|
||||||
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||||
|
@ -47,6 +47,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
import net.minecraft.registry.tag.DamageTypeTags;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
@ -517,12 +518,15 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
||||||
|
|
||||||
public Optional<Float> modifyDamage(DamageSource cause, float amount) {
|
public Optional<Float> modifyDamage(DamageSource cause, float amount) {
|
||||||
|
|
||||||
if (!cause.isUnblockable() && !cause.isMagic() && !cause.isFire() && !cause.isOutOfWorld()
|
if (!cause.isIn(DamageTypeTags.BYPASSES_SHIELD)
|
||||||
&& !(cause instanceof EntityDamageSource && ((EntityDamageSource)cause).isThorns())
|
&& !cause.isOf(DamageTypes.MAGIC)
|
||||||
&& cause != DamageSource.FREEZE) {
|
&& !cause.isIn(DamageTypeTags.IS_FIRE)
|
||||||
|
&& !cause.isIn(DamageTypeTags.BYPASSES_INVULNERABILITY)
|
||||||
|
&& !cause.isOf(DamageTypes.THORNS)
|
||||||
|
&& !cause.isOf(DamageTypes.FREEZE)) {
|
||||||
|
|
||||||
if (getSpecies().canUseEarth() && entity.isSneaking()) {
|
if (getSpecies().canUseEarth() && entity.isSneaking()) {
|
||||||
amount /= (cause.isProjectile() ? 3 : 2) * (entity.getHealth() < 5 ? 3 : 1);
|
amount /= (cause.isOf(DamageTypes.MOB_PROJECTILE) ? 3 : 2) * (entity.getHealth() < 5 ? 3 : 1);
|
||||||
|
|
||||||
return Optional.of(amount);
|
return Optional.of(amount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||||
import net.minecraft.client.network.PlayerListEntry;
|
import net.minecraft.client.network.PlayerListEntry;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.GameMode;
|
import net.minecraft.world.GameMode;
|
||||||
|
@ -53,7 +54,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void playEquipSound(ItemStack stack) {
|
public void onEquipStack(EquipmentSlot slot, ItemStack oldStack, ItemStack newStack) {
|
||||||
/*noop*/
|
/*noop*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.minelittlepony.unicopia.Owned;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -21,7 +22,7 @@ public class DummyPlayerEntity extends PlayerEntity implements Owned<PlayerEntit
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void playEquipSound(ItemStack stack) {
|
public void onEquipStack(EquipmentSlot slot, ItemStack oldStack, ItemStack newStack) {
|
||||||
/*noop*/
|
/*noop*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,13 @@ import com.google.common.collect.ImmutableMultimap;
|
||||||
import com.minelittlepony.unicopia.InteractionManager;
|
import com.minelittlepony.unicopia.InteractionManager;
|
||||||
import com.minelittlepony.unicopia.USounds;
|
import com.minelittlepony.unicopia.USounds;
|
||||||
import com.minelittlepony.unicopia.entity.*;
|
import com.minelittlepony.unicopia.entity.*;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.effect.UEffects;
|
import com.minelittlepony.unicopia.entity.effect.UEffects;
|
||||||
import com.minelittlepony.unicopia.entity.player.*;
|
import com.minelittlepony.unicopia.entity.player.*;
|
||||||
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import com.minelittlepony.unicopia.trinkets.TrinketsDelegate;
|
import com.minelittlepony.unicopia.trinkets.TrinketsDelegate;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.VecHelper;
|
import com.minelittlepony.unicopia.util.VecHelper;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
|
@ -36,6 +36,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.particle.ParticleEffect;
|
import net.minecraft.particle.ParticleEffect;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.predicate.entity.EntityPredicates;
|
import net.minecraft.predicate.entity.EntityPredicates;
|
||||||
|
import net.minecraft.registry.tag.DamageTypeTags;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
|
@ -84,7 +85,7 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean damage(DamageSource source) {
|
public boolean damage(DamageSource source) {
|
||||||
return source.isOutOfWorld();
|
return source.isIn(DamageTypeTags.BYPASSES_INVULNERABILITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -146,7 +147,7 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
||||||
if (entity instanceof PlayerEntity player) {
|
if (entity instanceof PlayerEntity player) {
|
||||||
player.getHungerManager().setFoodLevel(1);
|
player.getHungerManager().setFoodLevel(1);
|
||||||
}
|
}
|
||||||
entity.damage(MagicalDamageSource.ALICORN_AMULET, amount);
|
entity.damage(wearer.damageOf(UDamageTypes.ALICORN_AMULET), amount);
|
||||||
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 200, 1));
|
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 200, 1));
|
||||||
if (timeWorn > ItemTracker.HOURS) {
|
if (timeWorn > ItemTracker.HOURS) {
|
||||||
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.WEAKNESS, 200, 3));
|
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.WEAKNESS, 200, 3));
|
||||||
|
@ -256,7 +257,7 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
||||||
if (attachedTicks % 100 == 0) {
|
if (attachedTicks % 100 == 0) {
|
||||||
player.getHungerManager().addExhaustion(90F);
|
player.getHungerManager().addExhaustion(90F);
|
||||||
float healthDrop = MathHelper.clamp(player.getMaxHealth() - player.getHealth(), 2, 5);
|
float healthDrop = MathHelper.clamp(player.getMaxHealth() - player.getHealth(), 2, 5);
|
||||||
player.damage(MagicalDamageSource.ALICORN_AMULET, healthDrop);
|
player.damage(pony.damageOf(UDamageTypes.ALICORN_AMULET), healthDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class AmuletItem extends WearableItem implements ChargeableItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EquipmentSlot getPreferredSlot(ItemStack stack) {
|
public EquipmentSlot getSlotType(ItemStack stack) {
|
||||||
return EquipmentSlot.CHEST;
|
return EquipmentSlot.CHEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
import com.minelittlepony.unicopia.entity.Creature;
|
import com.minelittlepony.unicopia.entity.Creature;
|
||||||
import com.minelittlepony.unicopia.entity.Living;
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
||||||
import com.minelittlepony.unicopia.particle.MagicParticleEffect;
|
import com.minelittlepony.unicopia.particle.MagicParticleEffect;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.VecHelper;
|
import com.minelittlepony.unicopia.util.VecHelper;
|
||||||
import com.minelittlepony.unicopia.util.shape.Sphere;
|
import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public class BellItem extends Item implements ChargeableItem {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float damageAmount = Math.min(Math.max(1, living.asEntity().getMaxHealth() / 25F), living.asEntity().getHealth() - 1);
|
float damageAmount = Math.min(Math.max(1, living.asEntity().getMaxHealth() / 25F), living.asEntity().getHealth() - 1);
|
||||||
living.asEntity().damage(MagicalDamageSource.EXHAUSTION, damageAmount);
|
living.asEntity().damage(user.damageOf(UDamageTypes.EXHAUSTION, user), damageAmount);
|
||||||
living.asEntity().setAttacker(user.asEntity());
|
living.asEntity().setAttacker(user.asEntity());
|
||||||
if (living.asEntity() instanceof MobEntity mob) {
|
if (living.asEntity() instanceof MobEntity mob) {
|
||||||
mob.setTarget(null);
|
mob.setTarget(null);
|
||||||
|
|
|
@ -8,10 +8,10 @@ import com.google.common.base.Suppliers;
|
||||||
import com.minelittlepony.unicopia.*;
|
import com.minelittlepony.unicopia.*;
|
||||||
import com.minelittlepony.unicopia.entity.*;
|
import com.minelittlepony.unicopia.entity.*;
|
||||||
import com.minelittlepony.unicopia.entity.FloatingArtefactEntity.State;
|
import com.minelittlepony.unicopia.entity.FloatingArtefactEntity.State;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.VecHelper;
|
import com.minelittlepony.unicopia.util.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -156,7 +156,7 @@ public class CrystalHeartItem extends Item implements FloatingArtefactEntity.Art
|
||||||
}
|
}
|
||||||
|
|
||||||
inputs.forEach(input -> {
|
inputs.forEach(input -> {
|
||||||
input.damage(MagicalDamageSource.create("feed"), takes);
|
input.damage(entity.damageOf(UDamageTypes.LIFE_DRAINING), takes);
|
||||||
ParticleUtils.spawnParticles(new FollowingParticleEffect(UParticles.HEALTH_DRAIN, entity, 0.2F), input, 1);
|
ParticleUtils.spawnParticles(new FollowingParticleEffect(UParticles.HEALTH_DRAIN, entity, 0.2F), input, 1);
|
||||||
});
|
});
|
||||||
outputs.forEach(output -> {
|
outputs.forEach(output -> {
|
||||||
|
|
|
@ -21,7 +21,6 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.EquipmentSlot;
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
@ -178,7 +177,7 @@ public class EnchantedStaffItem extends StaffItem implements EnchantableItem, Ch
|
||||||
|
|
||||||
if (i > 200) {
|
if (i > 200) {
|
||||||
living.clearActiveItem();
|
living.clearActiveItem();
|
||||||
living.damage(DamageSource.MAGIC, 1);
|
living.damage(entity.getDamageSources().magic(), 1);
|
||||||
if (EnchantableItem.isEnchanted(stack) && hasCharge(stack)) {
|
if (EnchantableItem.isEnchanted(stack) && hasCharge(stack)) {
|
||||||
Caster.of(entity).ifPresent(c -> getSpellEffect(stack).create().apply(c));
|
Caster.of(entity).ifPresent(c -> getSpellEffect(stack).create().apply(c));
|
||||||
ChargeableItem.consumeEnergy(stack, 1);
|
ChargeableItem.consumeEnergy(stack, 1);
|
||||||
|
|
|
@ -15,7 +15,6 @@ import net.minecraft.entity.FlyingItemEntity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.attribute.EntityAttributeInstance;
|
import net.minecraft.entity.attribute.EntityAttributeInstance;
|
||||||
import net.minecraft.entity.attribute.EntityAttributes;
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
@ -87,7 +86,7 @@ public class FilledJarItem extends JarItem implements ChameleonItem {
|
||||||
|
|
||||||
damage += instance.getValue();
|
damage += instance.getValue();
|
||||||
|
|
||||||
if (entity.damage(DamageSource.thrownProjectile(projectile, projectile.getOwner()), damage)) {
|
if (entity.damage(entity.getDamageSources().thrown(projectile, projectile.getOwner()), damage)) {
|
||||||
|
|
||||||
int knockback = EnchantmentHelper.getLevel(Enchantments.KNOCKBACK, stack);
|
int knockback = EnchantmentHelper.getLevel(Enchantments.KNOCKBACK, stack);
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,8 @@ public class FriendshipBraceletItem extends WearableItem implements DyeableItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EquipmentSlot getPreferredSlot(ItemStack stack) {
|
public EquipmentSlot getSlotType(ItemStack stack) {
|
||||||
return isSigned(stack) ? EquipmentSlot.CHEST : super.getPreferredSlot(stack);
|
return isSigned(stack) ? EquipmentSlot.CHEST : super.getSlotType();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkSignature(ItemStack stack, PlayerEntity player) {
|
private boolean checkSignature(ItemStack stack, PlayerEntity player) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class GlassesItem extends WearableItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EquipmentSlot getPreferredSlot(ItemStack stack) {
|
public EquipmentSlot getSlotType(ItemStack stack) {
|
||||||
return EquipmentSlot.HEAD;
|
return EquipmentSlot.HEAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.recipe.RecipeSerializer;
|
import net.minecraft.recipe.RecipeSerializer;
|
||||||
import net.minecraft.recipe.book.CraftingRecipeCategory;
|
import net.minecraft.recipe.book.CraftingRecipeCategory;
|
||||||
|
import net.minecraft.registry.DynamicRegistryManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.Pair;
|
import net.minecraft.util.Pair;
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ public class GlowingRecipe extends ItemCombinationRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final ItemStack craft(CraftingInventory inventory) {
|
public final ItemStack craft(CraftingInventory inventory, DynamicRegistryManager registries) {
|
||||||
Pair<ItemStack, ItemStack> pair = runMatch(inventory);
|
Pair<ItemStack, ItemStack> pair = runMatch(inventory);
|
||||||
|
|
||||||
ItemStack result = pair.getLeft().copy();
|
ItemStack result = pair.getLeft().copy();
|
||||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.inventory.CraftingInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.recipe.RecipeSerializer;
|
import net.minecraft.recipe.RecipeSerializer;
|
||||||
import net.minecraft.recipe.book.CraftingRecipeCategory;
|
import net.minecraft.recipe.book.CraftingRecipeCategory;
|
||||||
|
import net.minecraft.registry.DynamicRegistryManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.Pair;
|
import net.minecraft.util.Pair;
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ public class JarInsertRecipe extends ItemCombinationRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final ItemStack craft(CraftingInventory inventory) {
|
public final ItemStack craft(CraftingInventory inventory, DynamicRegistryManager registries) {
|
||||||
Pair<ItemStack, ItemStack> pair = runMatch(inventory);
|
Pair<ItemStack, ItemStack> pair = runMatch(inventory);
|
||||||
|
|
||||||
return UItems.FILLED_JAR.setAppearance(UItems.FILLED_JAR.getDefaultStack(), pair.getRight());
|
return UItems.FILLED_JAR.setAppearance(UItems.FILLED_JAR.getDefaultStack(), pair.getRight());
|
||||||
|
|
|
@ -9,9 +9,9 @@ import net.minecraft.block.dispenser.ItemDispenserBehavior;
|
||||||
import net.minecraft.entity.*;
|
import net.minecraft.entity.*;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ArmorMaterials;
|
import net.minecraft.item.ArmorMaterials;
|
||||||
|
import net.minecraft.item.Equipment;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Wearable;
|
|
||||||
import net.minecraft.predicate.entity.EntityPredicates;
|
import net.minecraft.predicate.entity.EntityPredicates;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
|
@ -19,7 +19,7 @@ import net.minecraft.util.TypedActionResult;
|
||||||
import net.minecraft.util.math.*;
|
import net.minecraft.util.math.*;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class WearableItem extends Item implements Wearable {
|
public abstract class WearableItem extends Item implements Equipment {
|
||||||
|
|
||||||
public WearableItem(FabricItemSettings settings) {
|
public WearableItem(FabricItemSettings settings) {
|
||||||
super(configureEquipmentSlotSupplier(settings));
|
super(configureEquipmentSlotSupplier(settings));
|
||||||
|
@ -31,7 +31,7 @@ public abstract class WearableItem extends Item implements Wearable {
|
||||||
if (TrinketsDelegate.hasTrinkets()) {
|
if (TrinketsDelegate.hasTrinkets()) {
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
return settings.equipmentSlot(s -> ((WearableItem)s.getItem()).getPreferredSlot(s));
|
return settings.equipmentSlot(s -> ((WearableItem)s.getItem()).getSlotType(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,10 +49,15 @@ public abstract class WearableItem extends Item implements Wearable {
|
||||||
return ArmorMaterials.LEATHER.getEquipSound();
|
return ArmorMaterials.LEATHER.getEquipSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EquipmentSlot getPreferredSlot(ItemStack stack) {
|
@Override
|
||||||
|
public final EquipmentSlot getSlotType() {
|
||||||
return EquipmentSlot.OFFHAND;
|
return EquipmentSlot.OFFHAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EquipmentSlot getSlotType(ItemStack stack) {
|
||||||
|
return getSlotType();
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean dispenseArmor(BlockPointer pointer, ItemStack armor) {
|
public static boolean dispenseArmor(BlockPointer pointer, ItemStack armor) {
|
||||||
return pointer.getWorld().getEntitiesByClass(
|
return pointer.getWorld().getEntitiesByClass(
|
||||||
LivingEntity.class,
|
LivingEntity.class,
|
||||||
|
|
|
@ -5,12 +5,13 @@ import java.util.List;
|
||||||
import com.minelittlepony.unicopia.UTags;
|
import com.minelittlepony.unicopia.UTags;
|
||||||
import com.minelittlepony.unicopia.Unicopia;
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.advancement.UCriteria;
|
import com.minelittlepony.unicopia.advancement.UCriteria;
|
||||||
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.item.group.MultiItem;
|
import com.minelittlepony.unicopia.item.group.MultiItem;
|
||||||
import com.minelittlepony.unicopia.item.toxin.*;
|
import com.minelittlepony.unicopia.item.toxin.*;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
|
||||||
import com.minelittlepony.unicopia.util.TraceHelper;
|
import com.minelittlepony.unicopia.util.TraceHelper;
|
||||||
import com.minelittlepony.unicopia.util.RegistryUtils;
|
import com.minelittlepony.unicopia.util.RegistryUtils;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ public class ZapAppleItem extends Item implements ChameleonItem, ToxicHolder, Mu
|
||||||
public ItemStack finishUsing(ItemStack stack, World w, LivingEntity player) {
|
public ItemStack finishUsing(ItemStack stack, World w, LivingEntity player) {
|
||||||
stack = super.finishUsing(stack, w, player);
|
stack = super.finishUsing(stack, w, player);
|
||||||
|
|
||||||
player.damage(MagicalDamageSource.ZAP_APPLE, 120);
|
player.damage(Living.living(player).damageOf(UDamageTypes.ZAP_APPLE), 120);
|
||||||
|
|
||||||
if (w instanceof ServerWorld) {
|
if (w instanceof ServerWorld) {
|
||||||
LightningEntity lightning = EntityType.LIGHTNING_BOLT.create(w);
|
LightningEntity lightning = EntityType.LIGHTNING_BOLT.create(w);
|
||||||
|
@ -61,7 +62,7 @@ public class ZapAppleItem extends Item implements ChameleonItem, ToxicHolder, Mu
|
||||||
player.onStruckByLightning((ServerWorld)w, lightning);
|
player.onStruckByLightning((ServerWorld)w, lightning);
|
||||||
|
|
||||||
if (player instanceof PlayerEntity) {
|
if (player instanceof PlayerEntity) {
|
||||||
UCriteria.EAT_TRICK_APPLE.trigger((PlayerEntity)player);
|
UCriteria.EAT_TRICK_APPLE.trigger(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@ public interface ItemGroupRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
static ItemGroup createDynamic(String name, Supplier<ItemStack> icon, Supplier<Stream<Item>> items) {
|
static ItemGroup createDynamic(String name, Supplier<ItemStack> icon, Supplier<Stream<Item>> items) {
|
||||||
return FabricItemGroup.builder(Unicopia.id(name)).entries((features, list, k) -> {
|
return FabricItemGroup.builder(Unicopia.id(name)).entries((context, entries) -> {
|
||||||
items.get().forEach(item -> {
|
items.get().forEach(item -> {
|
||||||
list.addAll(ItemGroupRegistry.getVariations(item));
|
entries.addAll(ItemGroupRegistry.getVariations(item));
|
||||||
});
|
});
|
||||||
}).icon(icon).build();
|
}).icon(icon).build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,6 @@ abstract class MixinDamageSource {
|
||||||
private void onGetDeathMessage(LivingEntity entity, CallbackInfoReturnable<Text> info) {
|
private void onGetDeathMessage(LivingEntity entity, CallbackInfoReturnable<Text> info) {
|
||||||
final DamageSource self = (DamageSource)(Object)this;
|
final DamageSource self = (DamageSource)(Object)this;
|
||||||
|
|
||||||
if (self.isFromFalling()) {
|
|
||||||
info.setReturnValue(new DamageSource(self.name + ".pegasus").getDeathMessage(entity));
|
|
||||||
} else {
|
|
||||||
Living.getOrEmpty(entity).map(Living::getAttacker).ifPresent(attacker -> {
|
Living.getOrEmpty(entity).map(Living::getAttacker).ifPresent(attacker -> {
|
||||||
Entity prime = entity.getPrimeAdversary();
|
Entity prime = entity.getPrimeAdversary();
|
||||||
if (prime != null && !attacker.isOwnedBy(prime)) {
|
if (prime != null && !attacker.isOwnedBy(prime)) {
|
||||||
|
@ -42,7 +39,6 @@ abstract class MixinDamageSource {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Mixin(DamageTracker.class)
|
@Mixin(DamageTracker.class)
|
||||||
abstract class MixinDamageTracker {
|
abstract class MixinDamageTracker {
|
||||||
|
|
|
@ -27,7 +27,7 @@ abstract class MixinServerWorld extends World implements StructureWorldAccess, N
|
||||||
|
|
||||||
private NocturnalSleepManager nocturnalSleepManager;
|
private NocturnalSleepManager nocturnalSleepManager;
|
||||||
|
|
||||||
MixinServerWorld() { super(null, null, null, null, false, false, 0, 0); }
|
MixinServerWorld() { super(null, null, null, null, null, false, false, 0, 0); }
|
||||||
|
|
||||||
@Inject(method = "onBlockChanged", at = @At("HEAD"))
|
@Inject(method = "onBlockChanged", at = @At("HEAD"))
|
||||||
private void onOnBlockChanged(BlockPos pos, BlockState oldState, BlockState newState, CallbackInfo info) {
|
private void onOnBlockChanged(BlockPos pos, BlockState oldState, BlockState newState, CallbackInfo info) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer;
|
||||||
import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
||||||
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
|
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
|
||||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||||
|
import net.minecraft.client.render.model.BakedModelManager;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ abstract class MixinArmorFeatureRenderer<
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
@Inject(method = "<init>", at = @At("RETURN"))
|
||||||
private void onInit(FeatureRendererContext<T, M> context, A inner, A outer, CallbackInfo info) {
|
private void onInit(FeatureRendererContext<T, M> context, A inner, A outer, BakedModelManager bakery, CallbackInfo info) {
|
||||||
accessories = new AccessoryFeatureRenderer<>(context);
|
accessories = new AccessoryFeatureRenderer<>(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@ abstract class MixinTranslationStorage {
|
||||||
private @Final Map<String, String> translations;
|
private @Final Map<String, String> translations;
|
||||||
|
|
||||||
@Inject(method = "get", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "get", at = @At("HEAD"), cancellable = true)
|
||||||
public void onGet(String key, CallbackInfoReturnable<String> info) {
|
public void onGet(String key, String fallback, CallbackInfoReturnable<String> info) {
|
||||||
if (key != null && key.contains(".pegasus") && !translations.containsKey(key)) {
|
if (key != null && key.contains(".pegasus") && !translations.containsKey(key)) {
|
||||||
info.setReturnValue(translations.getOrDefault(key.replace(".pegasus", ""), key));
|
info.setReturnValue(translations.getOrDefault(key.replace(".pegasus", ""), fallback));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ import com.minelittlepony.unicopia.network.datasync.EffectSync;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
|
||||||
import net.minecraft.entity.data.DataTracker;
|
import net.minecraft.entity.data.DataTracker;
|
||||||
import net.minecraft.entity.data.TrackedData;
|
import net.minecraft.entity.data.TrackedData;
|
||||||
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||||
|
@ -37,7 +36,7 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.packet.Packet;
|
||||||
import net.minecraft.network.listener.ClientPlayPacketListener;
|
import net.minecraft.network.listener.ClientPlayPacketListener;
|
||||||
import net.minecraft.particle.ItemStackParticleEffect;
|
import net.minecraft.particle.ItemStackParticleEffect;
|
||||||
import net.minecraft.particle.ParticleEffect;
|
import net.minecraft.particle.ParticleEffect;
|
||||||
|
@ -290,7 +289,7 @@ public class MagicProjectileEntity extends ThrownItemEntity implements Caster<Ma
|
||||||
float damage = getThrowDamage();
|
float damage = getThrowDamage();
|
||||||
|
|
||||||
if (damage > 0) {
|
if (damage > 0) {
|
||||||
entity.damage(DamageSource.thrownProjectile(this, getOwner()), getThrowDamage());
|
entity.damage(getDamageSources().thrown(this, getOwner()), getThrowDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
forEachDelegates(effect -> effect.onImpact(this, hit), ProjectileDelegate.EntityHitListener.PREDICATE);
|
forEachDelegates(effect -> effect.onImpact(this, hit), ProjectileDelegate.EntityHitListener.PREDICATE);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.minelittlepony.unicopia.server.world;
|
package com.minelittlepony.unicopia.server.world;
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.Unicopia;
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.block.UBlocks;
|
import com.minelittlepony.unicopia.block.UBlocks;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
|
@ -32,7 +30,7 @@ public class FernFoliagePlacer extends FoliagePlacer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generate(TestableWorld world, BiConsumer<BlockPos, BlockState> placer, Random random,
|
protected void generate(TestableWorld world, BlockPlacer placer, Random random,
|
||||||
TreeFeatureConfig config, int trunkHeight, TreeNode node, int foliageHeight, int radius, int offset) {
|
TreeFeatureConfig config, int trunkHeight, TreeNode node, int foliageHeight, int radius, int offset) {
|
||||||
|
|
||||||
BlockPos center = node.getCenter();
|
BlockPos center = node.getCenter();
|
||||||
|
@ -70,16 +68,16 @@ public class FernFoliagePlacer extends FoliagePlacer {
|
||||||
if (outset == 1) {
|
if (outset == 1) {
|
||||||
BlockState fruitState = UBlocks.BANANAS.getDefaultState();
|
BlockState fruitState = UBlocks.BANANAS.getDefaultState();
|
||||||
if (random.nextInt(5) == 0) {
|
if (random.nextInt(5) == 0) {
|
||||||
placer.accept(pos.set(center, outset, fanY - 1, 0), fruitState);
|
placer.placeBlock(pos.set(center, outset, fanY - 1, 0), fruitState);
|
||||||
}
|
}
|
||||||
if (random.nextInt(5) == 0) {
|
if (random.nextInt(5) == 0) {
|
||||||
placer.accept(pos.set(center, -outset, fanY - 1, 0), fruitState);
|
placer.placeBlock(pos.set(center, -outset, fanY - 1, 0), fruitState);
|
||||||
}
|
}
|
||||||
if (random.nextInt(5) == 0) {
|
if (random.nextInt(5) == 0) {
|
||||||
placer.accept(pos.set(center, 0, fanY - 1, outset), fruitState);
|
placer.placeBlock(pos.set(center, 0, fanY - 1, outset), fruitState);
|
||||||
}
|
}
|
||||||
if (random.nextInt(5) == 0) {
|
if (random.nextInt(5) == 0) {
|
||||||
placer.accept(pos.set(center, 0, fanY - 1, -outset), fruitState);
|
placer.placeBlock(pos.set(center, 0, fanY - 1, -outset), fruitState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public record Tree (
|
||||||
var reg = registries.asDynamicRegistryManager().createRegistryLookup().getOrThrow(RegistryKeys.CONFIGURED_FEATURE);
|
var reg = registries.asDynamicRegistryManager().createRegistryLookup().getOrThrow(RegistryKeys.CONFIGURED_FEATURE);
|
||||||
REGISTRY.stream().filter(tree -> tree.placedFeatureId().isPresent()).forEach(tree -> {
|
REGISTRY.stream().filter(tree -> tree.placedFeatureId().isPresent()).forEach(tree -> {
|
||||||
var placedFeature = new PlacedFeature(reg.getOrThrow(tree.configuredFeatureId()),
|
var placedFeature = new PlacedFeature(reg.getOrThrow(tree.configuredFeatureId()),
|
||||||
VegetationPlacedFeatures.modifiersWithWouldSurvive(tree.placement().orElseThrow(), tree.sapling().orElse(Blocks.OAK_SAPLING))
|
VegetationPlacedFeatures.treeModifiersWithWouldSurvive(tree.placement().orElseThrow(), tree.sapling().orElse(Blocks.OAK_SAPLING))
|
||||||
);
|
);
|
||||||
|
|
||||||
Registry.register(registry, tree.id, placedFeature);
|
Registry.register(registry, tree.id, placedFeature);
|
||||||
|
|
|
@ -14,6 +14,7 @@ import dev.emi.trinkets.api.event.TrinketDropCallback;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.Equipment;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.screen.slot.Slot;
|
import net.minecraft.screen.slot.Slot;
|
||||||
|
@ -40,7 +41,7 @@ public class TrinketsDelegateImpl implements TrinketsDelegate {
|
||||||
return getInventory(entity, slot).map(inventory -> {
|
return getInventory(entity, slot).map(inventory -> {
|
||||||
for (int position = 0; position < inventory.size(); position++) {
|
for (int position = 0; position < inventory.size(); position++) {
|
||||||
if (inventory.getStack(position).isEmpty() && TrinketSlot.canInsert(stack, new SlotReference(inventory, position), entity)) {
|
if (inventory.getStack(position).isEmpty() && TrinketSlot.canInsert(stack, new SlotReference(inventory, position), entity)) {
|
||||||
SoundEvent soundEvent = stack.getEquipSound();
|
SoundEvent soundEvent = stack.getItem() instanceof Equipment q ? q.getEquipSound() : null;
|
||||||
inventory.setStack(position, stack.split(1));
|
inventory.setStack(position, stack.split(1));
|
||||||
if (soundEvent != null) {
|
if (soundEvent != null) {
|
||||||
entity.emitGameEvent(GameEvent.EQUIP);
|
entity.emitGameEvent(GameEvent.EQUIP);
|
||||||
|
@ -56,7 +57,7 @@ public class TrinketsDelegateImpl implements TrinketsDelegate {
|
||||||
@Override
|
@Override
|
||||||
public void setEquippedStack(LivingEntity entity, Identifier slot, ItemStack stack) {
|
public void setEquippedStack(LivingEntity entity, Identifier slot, ItemStack stack) {
|
||||||
getInventory(entity, slot).ifPresent(inventory -> {
|
getInventory(entity, slot).ifPresent(inventory -> {
|
||||||
SoundEvent soundEvent = stack.getEquipSound();
|
SoundEvent soundEvent = stack.getItem() instanceof Equipment q ? q.getEquipSound() : null;
|
||||||
inventory.clear();
|
inventory.clear();
|
||||||
inventory.setStack(0, stack);
|
inventory.setStack(0, stack);
|
||||||
if (soundEvent != null) {
|
if (soundEvent != null) {
|
||||||
|
@ -138,7 +139,7 @@ public class TrinketsDelegateImpl implements TrinketsDelegate {
|
||||||
|
|
||||||
Trinket trinket = TrinketsApi.getTrinket(stack.getItem());
|
Trinket trinket = TrinketsApi.getTrinket(stack.getItem());
|
||||||
|
|
||||||
SoundEvent soundEvent = stack.getEquipSound();
|
SoundEvent soundEvent = stack.getItem() instanceof Equipment q ? q.getEquipSound() : null;
|
||||||
inv.setStack(i, stack.split(trinket instanceof UnicopiaTrinket ut ? ut.getMaxCount(stack, ref) : stack.getMaxCount()));
|
inv.setStack(i, stack.split(trinket instanceof UnicopiaTrinket ut ? ut.getMaxCount(stack, ref) : stack.getMaxCount()));
|
||||||
if (!stack.isEmpty() && soundEvent != null) {
|
if (!stack.isEmpty() && soundEvent != null) {
|
||||||
user.emitGameEvent(GameEvent.EQUIP);
|
user.emitGameEvent(GameEvent.EQUIP);
|
||||||
|
|
|
@ -11,10 +11,10 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.attribute.EntityAttribute;
|
import net.minecraft.entity.attribute.EntityAttribute;
|
||||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||||
|
import net.minecraft.item.Equipment;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.predicate.entity.EntityPredicates;
|
import net.minecraft.predicate.entity.EntityPredicates;
|
||||||
import net.minecraft.sound.SoundEvent;
|
|
||||||
|
|
||||||
public class UnicopiaTrinket implements Trinket {
|
public class UnicopiaTrinket implements Trinket {
|
||||||
|
|
||||||
|
@ -30,9 +30,8 @@ public class UnicopiaTrinket implements Trinket {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundEvent soundEvent = stack.getEquipSound();
|
if (stack.getItem() instanceof Equipment q) {
|
||||||
if (soundEvent != null) {
|
entity.playSound( q.getEquipSound(), 1, 1);
|
||||||
entity.playSound(soundEvent, 1, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +64,7 @@ public class UnicopiaTrinket implements Trinket {
|
||||||
public Multimap<EntityAttribute, EntityAttributeModifier> getModifiers(ItemStack stack, SlotReference slot, LivingEntity entity, UUID uuid) {
|
public Multimap<EntityAttribute, EntityAttributeModifier> getModifiers(ItemStack stack, SlotReference slot, LivingEntity entity, UUID uuid) {
|
||||||
Multimap<EntityAttribute, EntityAttributeModifier> modifiers = Trinket.super.getModifiers(stack, slot, entity, uuid);
|
Multimap<EntityAttribute, EntityAttributeModifier> modifiers = Trinket.super.getModifiers(stack, slot, entity, uuid);
|
||||||
if (item instanceof WearableItem wearable) {
|
if (item instanceof WearableItem wearable) {
|
||||||
item.getAttributeModifiers(wearable.getPreferredSlot(stack));
|
item.getAttributeModifiers(wearable.getSlotType(stack));
|
||||||
}
|
}
|
||||||
return modifiers;
|
return modifiers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.minelittlepony.unicopia.util;
|
||||||
|
|
||||||
|
import net.minecraft.entity.LimbAnimator;
|
||||||
|
|
||||||
|
public interface LimbAnimationUtil {
|
||||||
|
|
||||||
|
static void resetToZero(LimbAnimator animator) {
|
||||||
|
animator.setSpeed(0);
|
||||||
|
animator.updateLimbs(-animator.getPos(), 1);
|
||||||
|
animator.setSpeed(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void copy(LimbAnimator from, LimbAnimator to) {
|
||||||
|
float prevSpeed = from.getSpeed(0);
|
||||||
|
float speed = from.getSpeed();
|
||||||
|
float pos = from.getPos();
|
||||||
|
|
||||||
|
resetToZero(to);
|
||||||
|
to.setSpeed(prevSpeed);
|
||||||
|
to.updateLimbs(pos, 1);
|
||||||
|
to.setSpeed(speed);
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,62 +10,34 @@ import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.entity.damage.EntityDamageSource;
|
import net.minecraft.entity.damage.DamageType;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
public class MagicalDamageSource extends EntityDamageSource {
|
public class MagicalDamageSource extends DamageSource {
|
||||||
public static final DamageSource EXHAUSTION = new MagicalDamageSource("magical_exhaustion", null, true, true);
|
|
||||||
public static final DamageSource ALICORN_AMULET = new MagicalDamageSource("alicorn_amulet", null, true, true);
|
|
||||||
public static final DamageSource FOOD_POISONING = new DamageSource("food_poisoning");
|
|
||||||
public static final DamageSource TRIBE_SWAP = new DamageSource("tribe_swap").setOutOfWorld().setUnblockable();
|
|
||||||
public static final DamageSource ZAP_APPLE = create("zap");
|
|
||||||
public static final DamageSource KICK = create("kick");
|
|
||||||
public static final DamageSource STEAMROLLER = create("steamroller");
|
|
||||||
public static final DamageSource SUN = new DamageSource("sun").setBypassesArmor().setFire();
|
|
||||||
public static final DamageSource SUNLIGHT = new DamageSource("sunlight").setBypassesArmor().setFire();
|
|
||||||
public static final DamageSource PETRIFIED = new DamageSource("petrified").setBypassesArmor().setFire();
|
|
||||||
|
|
||||||
public static MagicalDamageSource create(String type) {
|
|
||||||
return new MagicalDamageSource(type, null, null, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MagicalDamageSource create(String type, @Nullable LivingEntity source) {
|
|
||||||
return new MagicalDamageSource(type, source, null, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MagicalDamageSource create(String type, Caster<?> caster) {
|
|
||||||
return new MagicalDamageSource(type, caster.getMaster(), caster, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private Caster<?> spell;
|
private final Caster<?> spell;
|
||||||
|
|
||||||
private boolean breakSunglasses;
|
public MagicalDamageSource(RegistryEntry<DamageType> type, @Nullable Entity source, @Nullable Entity attacker, @Nullable Caster<?> caster) {
|
||||||
|
super(type, source, attacker);
|
||||||
protected MagicalDamageSource(String type, @Nullable Caster<?> spell, boolean direct, boolean unblockable) {
|
spell = caster;
|
||||||
this(type, null, spell, direct, unblockable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MagicalDamageSource(String type, @Nullable Entity source, @Nullable Caster<?> spell, boolean direct, boolean unblockable) {
|
public MagicalDamageSource(RegistryEntry<DamageType> type, Vec3d position, @Nullable Caster<?> caster) {
|
||||||
super(type, source);
|
super(type, position);
|
||||||
this.spell = spell;
|
spell = caster;
|
||||||
setUsesMagic();
|
|
||||||
if (direct) {
|
|
||||||
setBypassesArmor();
|
|
||||||
}
|
|
||||||
if (unblockable) {
|
|
||||||
setUnblockable();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MagicalDamageSource setBreakSunglasses() {
|
public MagicalDamageSource(RegistryEntry<DamageType> type, @Nullable Entity attacker, @Nullable Caster<?> caster) {
|
||||||
breakSunglasses = true;
|
super(type, attacker);
|
||||||
return this;
|
spell = caster;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean breaksSunglasses() {
|
public MagicalDamageSource(RegistryEntry<DamageType> type, @Nullable Caster<?> caster) {
|
||||||
return breakSunglasses;
|
super(type);
|
||||||
|
spell = caster;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -76,13 +48,13 @@ public class MagicalDamageSource extends EntityDamageSource {
|
||||||
@Override
|
@Override
|
||||||
public Text getDeathMessage(LivingEntity target) {
|
public Text getDeathMessage(LivingEntity target) {
|
||||||
|
|
||||||
String basic = "death.attack." + name;
|
String basic = "death.attack." + getName();
|
||||||
|
|
||||||
List<Text> params = new ArrayList<>();
|
List<Text> params = new ArrayList<>();
|
||||||
params.add(target.getDisplayName());
|
params.add(target.getDisplayName());
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
Entity attacker = source != null ? source : target.getPrimeAdversary();
|
Entity attacker = getSource() != null ? getSource() : target.getPrimeAdversary();
|
||||||
ItemStack item = attacker instanceof LivingEntity ? ((LivingEntity)attacker).getMainHandStack() : ItemStack.EMPTY;
|
ItemStack item = attacker instanceof LivingEntity ? ((LivingEntity)attacker).getMainHandStack() : ItemStack.EMPTY;
|
||||||
|
|
||||||
if (attacker == target) {
|
if (attacker == target) {
|
||||||
|
|
|
@ -37,8 +37,8 @@ public interface Shape extends PointGenerator {
|
||||||
*/
|
*/
|
||||||
default Stream<BlockPos> getBlockPositions() {
|
default Stream<BlockPos> getBlockPositions() {
|
||||||
return BlockPos.stream(
|
return BlockPos.stream(
|
||||||
new BlockPos(getLowerBound()),
|
BlockPos.ofFloored(getLowerBound()),
|
||||||
new BlockPos(getUpperBound())
|
BlockPos.ofFloored(getUpperBound())
|
||||||
).filter(pos -> isPointInside(Vec3d.ofCenter(pos)));
|
).filter(pos -> isPointInside(Vec3d.ofCenter(pos)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -649,18 +649,19 @@
|
||||||
"death.attack.alicorn_amulet": "%1$s was driven insane",
|
"death.attack.alicorn_amulet": "%1$s was driven insane",
|
||||||
"death.attack.alicorn_amulet.player": "%1$s went insane whilst fighting %2$s",
|
"death.attack.alicorn_amulet.player": "%1$s went insane whilst fighting %2$s",
|
||||||
"death.attack.darkness": "%1$s went missing",
|
"death.attack.darkness": "%1$s went missing",
|
||||||
"death.attack.feed": "%1$s was drained of all life",
|
"death.attack.love_draining": "%1$s was drained of all life",
|
||||||
"death.attack.feed.player": "%1$s died to feed %2$s",
|
"death.attack.love_draining.player": "%1$s died to feed %2$s",
|
||||||
"death.attack.drain": "%1$s was drained of all life",
|
"death.attack.life_draining": "%1$s was drained of all life",
|
||||||
"death.attack.drain.self": "%1$s was killed by their own spell",
|
"death.attack.life_draining.self": "%1$s was killed by their own spell",
|
||||||
"death.attack.drain.player": "%1$s was killed by a spell cast by %2$s",
|
"death.attack.life_draining.player": "%1$s was killed by a spell cast by %2$s",
|
||||||
"death.attack.eeee": "%1$s was frightened to death",
|
"death.attack.bat_screech": "%1$s was frightened to death",
|
||||||
"death.attack.eeee.player": "%2$s scared %1$s",
|
"death.attack.bat_screech.player": "%2$s scared %1$s",
|
||||||
"death.attack.eeee.item": "%1$s was frightened to death by %2$s using %3$s",
|
"death.attack.bat_screech.item": "%1$s was frightened to death by %2$s using %3$s",
|
||||||
"death.attack.eeee.self": "%1$s scared themselves to death",
|
"death.attack.bat_screech.self": "%1$s scared themselves to death",
|
||||||
"death.attack.cold": "%1$s froze to death",
|
"death.attack.gravity_well_recoil": "%1$s turned into spaghetti",
|
||||||
"death.attack.cold.self": "%1$s froze to death",
|
"death.attack.gravity_well_recoil.player": "%1$s turned into spaghetti by a spell cast by %2$s",
|
||||||
"death.attack.cold.player": "%1$s was frozen to death by %2$s",
|
"death.attack.gravity_well_recoil.item": "%1$s turned into spaghetti by a spell cast by %2$s using %3$s",
|
||||||
|
"death.attack.gravity_well_recoil.self": "%1$s cast a spell that turned them into spaghetti",
|
||||||
"death.attack.smash": "%1$s was crushed under hoof",
|
"death.attack.smash": "%1$s was crushed under hoof",
|
||||||
"death.attack.smash.player": "%1$s was crushed by %2$s",
|
"death.attack.smash.player": "%1$s was crushed by %2$s",
|
||||||
"death.attack.zap": "%1$s bit into a Zap Apple",
|
"death.attack.zap": "%1$s bit into a Zap Apple",
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"unicopia:exhaustion",
|
||||||
|
"unicopia:alicorn_amulet",
|
||||||
|
"unicopia:zap",
|
||||||
|
"unicopia:kick",
|
||||||
|
"unicopia:smash",
|
||||||
|
"unicopia:bat_screech",
|
||||||
|
"unicopia:love_draining",
|
||||||
|
"unicopia:life_draining",
|
||||||
|
"unicopia:rainboom",
|
||||||
|
"unicopia:steamroller"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"unicopia:exhaustion",
|
||||||
|
"unicopia:alicorn_amulet",
|
||||||
|
"unicopia:zap",
|
||||||
|
"unicopia:kick",
|
||||||
|
"unicopia:smash",
|
||||||
|
"unicopia:bat_screech",
|
||||||
|
"unicopia:love_draining",
|
||||||
|
"unicopia:life_draining",
|
||||||
|
"unicopia:steamroller",
|
||||||
|
"unicopia:rainboom",
|
||||||
|
"unicopia:sun",
|
||||||
|
"unicopia:sunlight",
|
||||||
|
"unicopia:petrified"
|
||||||
|
]
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue