mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Clean up warnings
This commit is contained in:
parent
3489c47d63
commit
86faeeaa43
34 changed files with 75 additions and 61 deletions
|
@ -10,6 +10,7 @@ public enum Affinity implements StringIdentifiable {
|
|||
NEUTRAL(Formatting.LIGHT_PURPLE, 0, 0.5F),
|
||||
BAD(Formatting.RED, 1, 1);
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static final Codec<Affinity> CODEC = StringIdentifiable.createCodec(Affinity::values);
|
||||
|
||||
private final Formatting color;
|
||||
|
|
|
@ -9,6 +9,7 @@ public enum Availability implements StringIdentifiable {
|
|||
COMMANDS,
|
||||
NONE;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static final Codec<Availability> CODEC = StringIdentifiable.createCodec(Availability::values);
|
||||
|
||||
private final String name = name().toLowerCase(Locale.ROOT);
|
||||
|
|
|
@ -31,7 +31,7 @@ public interface EquineContext {
|
|||
|
||||
static EquineContext of(ShapeContext context) {
|
||||
if (context == ShapeContext.absent()) {
|
||||
return Unicopia.SIDE.getPony().map(EquineContext.class::cast).orElse(ABSENT);
|
||||
return InteractionManager.getInstance().getClientPony().map(EquineContext.class::cast).orElse(ABSENT);
|
||||
}
|
||||
EquineContext result = context instanceof Container c ? c.get() : ABSENT;
|
||||
return result == null ? ABSENT : result;
|
||||
|
|
|
@ -13,6 +13,7 @@ public enum FlightType implements StringIdentifiable {
|
|||
INSECTOID,
|
||||
ARTIFICIAL;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static final Codec<FlightType> CODEC = StringIdentifiable.createCodec(FlightType::values);
|
||||
|
||||
private final String name = name().toLowerCase(Locale.ROOT);
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package com.minelittlepony.unicopia;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import com.minelittlepony.unicopia.entity.player.dummy.DummyPlayerEntity;
|
||||
import com.minelittlepony.unicopia.particle.ParticleSpawner;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
@ -30,12 +32,16 @@ public class InteractionManager {
|
|||
|
||||
public static final int SCREEN_DISPELL_ABILITY = 0;
|
||||
|
||||
public static InteractionManager INSTANCE = new InteractionManager();
|
||||
private static InteractionManager INSTANCE = new InteractionManager();
|
||||
|
||||
public static InteractionManager instance() {
|
||||
public static InteractionManager getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public InteractionManager() {
|
||||
INSTANCE = this;
|
||||
}
|
||||
|
||||
public ParticleSpawner createBoundParticle(UUID id) {
|
||||
return ParticleSpawner.EMPTY;
|
||||
}
|
||||
|
@ -96,4 +102,12 @@ public class InteractionManager {
|
|||
public void addBlockBreakingParticles(BlockPos pos, Direction direction) {
|
||||
|
||||
}
|
||||
|
||||
public Optional<Pony> getClientPony() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public final Race getClientSpecies() {
|
||||
return getClientPony().map(Pony::getSpecies).orElse(Race.HUMAN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@ import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
|
|||
import net.minecraft.resource.ResourceType;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
@ -27,7 +25,6 @@ import com.minelittlepony.unicopia.diet.affliction.AfflictionType;
|
|||
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||
import com.minelittlepony.unicopia.entity.effect.UPotions;
|
||||
import com.minelittlepony.unicopia.entity.mob.UEntities;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import com.minelittlepony.unicopia.item.UItems;
|
||||
import com.minelittlepony.unicopia.item.enchantment.UEnchantments;
|
||||
import com.minelittlepony.unicopia.network.Channel;
|
||||
|
@ -43,8 +40,6 @@ public class Unicopia implements ModInitializer {
|
|||
public static final String DEFAULT_NAMESPACE = "unicopia";
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
public static SidedAccess SIDE = Optional::empty;
|
||||
|
||||
private static Config CONFIG;
|
||||
|
||||
public static Config getConfig() {
|
||||
|
@ -111,12 +106,4 @@ public class Unicopia implements ModInitializer {
|
|||
registry.registerReloadListener(SpellbookChapterLoader.INSTANCE);
|
||||
registry.registerReloadListener(new DietsLoader());
|
||||
}
|
||||
|
||||
public interface SidedAccess {
|
||||
Optional<Pony> getPony();
|
||||
|
||||
default Race.Composite getPlayerSpecies() {
|
||||
return getPony().map(Pony::getCompositeRace).orElse(Race.HUMAN.composite());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ public class AbilityDispatcher implements Tickable, NbtSerialisable {
|
|||
warmup = 0;
|
||||
|
||||
if (data.isPresent()) {
|
||||
InteractionManager.instance().sendPlayerLookAngles(player.asEntity());
|
||||
InteractionManager.getInstance().sendPlayerLookAngles(player.asEntity());
|
||||
Channel.CLIENT_PLAYER_ABILITY.sendToServer(new MsgPlayerAbility<>(ability, data, ActivationType.NONE));
|
||||
} else {
|
||||
player.asEntity().playSound(USounds.GUI_ABILITY_FAIL, 1, 1);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class UnicornDispellAbility implements Ability<Pos> {
|
|||
}
|
||||
|
||||
if (type == ActivationType.TAP && player.isClient()) {
|
||||
InteractionManager.instance().openScreen(InteractionManager.SCREEN_DISPELL_ABILITY);
|
||||
InteractionManager.getInstance().openScreen(InteractionManager.SCREEN_DISPELL_ABILITY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ public class PlaceableSpell extends AbstractDelegatingSpell implements OrientedS
|
|||
castEntity.set(null);
|
||||
});
|
||||
|
||||
if (source.asEntity() instanceof CastSpellEntity spellcast) {
|
||||
if (source.asEntity() instanceof CastSpellEntity) {
|
||||
Ether.get(source.asWorld()).remove(this, source);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class RageAbilitySpell extends AbstractSpell {
|
|||
|
||||
if (source instanceof Pony pony) {
|
||||
if (pony.isClientPlayer() && pony.asEntity().getAttackCooldownProgress(0) == 0) {
|
||||
InteractionManager.instance().playLoopingSound(source.asEntity(), InteractionManager.SOUND_KIRIN_RAGE, source.asWorld().random.nextLong());
|
||||
InteractionManager.getInstance().playLoopingSound(source.asEntity(), InteractionManager.SOUND_KIRIN_RAGE, source.asWorld().random.nextLong());
|
||||
}
|
||||
Bar energyBar = pony.getMagicalReserves().getEnergy();
|
||||
var energy = Math.min(1.01F, 0.5F + (age / 1000F));
|
||||
|
|
|
@ -50,7 +50,7 @@ public class RainboomAbilitySpell extends AbstractSpell {
|
|||
|
||||
if (source.isClient()) {
|
||||
if (boundParticle == null) {
|
||||
boundParticle = InteractionManager.INSTANCE.createBoundParticle(getUuid());
|
||||
boundParticle = InteractionManager.getInstance().createBoundParticle(getUuid());
|
||||
}
|
||||
boundParticle.addParticle(new TargetBoundParticleEffect(UParticles.RAINBOOM_TRAIL, source.asEntity()), source.getOriginVector(), Vec3d.ZERO);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.unicopia.client;
|
|||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
@ -168,4 +169,9 @@ public class ClientInteractionManager extends InteractionManager {
|
|||
public void addBlockBreakingParticles(BlockPos pos, Direction direction) {
|
||||
client.particleManager.addBlockBreakingParticles(pos, direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Pony> getClientPony() {
|
||||
return Optional.ofNullable(client.player).map(Pony::of);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.joml.Vector3f;
|
|||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.minelittlepony.common.event.ScreenInitCallback;
|
||||
import com.minelittlepony.common.event.ScreenInitCallback.ButtonList;
|
||||
import com.minelittlepony.unicopia.InteractionManager;
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.client.gui.LanSettingsScreen;
|
||||
|
@ -51,6 +50,11 @@ public class UnicopiaClient implements ClientModInitializer {
|
|||
return instance;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Pony getClientPony() {
|
||||
return Pony.of(MinecraftClient.getInstance().player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Float originalRainGradient;
|
||||
private final Lerp rainGradient = new Lerp(0);
|
||||
|
@ -61,18 +65,23 @@ public class UnicopiaClient implements ClientModInitializer {
|
|||
private ZapAppleStageStore.Stage zapAppleStage = ZapAppleStageStore.Stage.HIBERNATING;
|
||||
|
||||
public static Optional<PlayerCamera> getCamera() {
|
||||
return Optional.of(getNullableCamera());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PlayerCamera getNullableCamera() {
|
||||
PlayerEntity player = MinecraftClient.getInstance().player;
|
||||
|
||||
if (player != null && MinecraftClient.getInstance().cameraEntity == player) {
|
||||
return Optional.of(Pony.of(player).getCamera());
|
||||
return Pony.of(player).getCamera();
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static Vec3d getAdjustedSoundPosition(Vec3d pos) {
|
||||
PlayerCamera cam = getCamera().orElse(null);
|
||||
PlayerCamera cam = getNullableCamera();
|
||||
if (cam == null) {
|
||||
return pos;
|
||||
}
|
||||
|
@ -124,7 +133,7 @@ public class UnicopiaClient implements ClientModInitializer {
|
|||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
InteractionManager.INSTANCE = new ClientInteractionManager();
|
||||
new ClientInteractionManager();
|
||||
new ClientNetworkHandlerImpl();
|
||||
|
||||
KeyBindingsHandler.bootstrap();
|
||||
|
@ -140,8 +149,6 @@ public class UnicopiaClient implements ClientModInitializer {
|
|||
|
||||
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(ViewportShader.INSTANCE);
|
||||
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(SpellEffectsRenderDispatcher.INSTANCE);
|
||||
|
||||
Unicopia.SIDE = () -> Optional.ofNullable(MinecraftClient.getInstance().player).map(Pony::of);
|
||||
}
|
||||
|
||||
private void onTick(MinecraftClient client) {
|
||||
|
|
|
@ -104,7 +104,7 @@ public class DisguiseCommand {
|
|||
}
|
||||
|
||||
static Entity loadPlayer(ServerCommandSource source, String username) {
|
||||
return InteractionManager.instance().createPlayer(source.getWorld(), new GameProfile(null, username));
|
||||
return InteractionManager.getInstance().createPlayer(source.getWorld(), new GameProfile(null, username));
|
||||
}
|
||||
|
||||
static int reveal(ServerCommandSource source, PlayerEntity player) {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class MagicalShapedEmiRecipe extends EmiCraftingRecipe {
|
|||
ItemStack[] stacks = ingredient.getMatchingStacks();
|
||||
|
||||
for (int i = 0; i < stacks.length; i++) {
|
||||
if (stacks[i].getItem() instanceof EnchantableItem e) {
|
||||
if (stacks[i].getItem() instanceof EnchantableItem) {
|
||||
stacks = Arrays.copyOf(stacks, stacks.length);
|
||||
stacks[i] = EnchantableItem.enchant(stacks[i].copy(), spellEffect.type());
|
||||
return EmiIngredient.of(Arrays.stream(stacks).map(EmiStack::of).toList());
|
||||
|
|
|
@ -90,7 +90,7 @@ public class FleeExplosionGoal extends Goal {
|
|||
|
||||
public static void notifySurroundings(Entity explosionSource, float radius) {
|
||||
explosionSource.getWorld().getOtherEntities(explosionSource, explosionSource.getBoundingBox().expand(radius), e -> {
|
||||
return Living.getOrEmpty(e).filter(l -> l instanceof Creature c).isPresent();
|
||||
return Living.getOrEmpty(e).filter(l -> l instanceof Creature).isPresent();
|
||||
}).forEach(e -> {
|
||||
getGoals((Creature)Living.living(e)).forEach(goal -> goal.setFleeTarget(explosionSource));
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ public class BeeBehaviour extends EntityBehaviour<BeeEntity> {
|
|||
public BeeEntity onCreate(BeeEntity entity, EntityAppearance context, boolean replaceOld) {
|
||||
super.onCreate(entity, context, replaceOld);
|
||||
if (replaceOld && entity.getWorld().isClient) {
|
||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_BEE, entity.getId());
|
||||
InteractionManager.getInstance().playLoopingSound(entity, InteractionManager.SOUND_BEE, entity.getId());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ public class EntityAppearance implements NbtSerialisable, PlayerDimensions.Provi
|
|||
private synchronized void createPlayer(NbtCompound nbt, GameProfile profile, Caster<?> source) {
|
||||
remove();
|
||||
|
||||
entity = InteractionManager.instance().createPlayer(source.asEntity(), profile);
|
||||
entity = InteractionManager.getInstance().createPlayer(source.asEntity(), profile);
|
||||
entity.setCustomName(source.asEntity().getName());
|
||||
((PlayerEntity)entity).readNbt(nbt.getCompound("playerNbt"));
|
||||
if (nbt.contains("playerVisibleParts", NbtElement.BYTE_TYPE)) {
|
||||
|
|
|
@ -12,7 +12,7 @@ public class MinecartBehaviour extends EntityBehaviour<AbstractMinecartEntity> {
|
|||
public AbstractMinecartEntity onCreate(AbstractMinecartEntity entity, EntityAppearance context, boolean replaceOld) {
|
||||
super.onCreate(entity, context, replaceOld);
|
||||
if (replaceOld && entity.getWorld().isClient) {
|
||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_MINECART, entity.getId());
|
||||
InteractionManager.getInstance().playLoopingSound(entity, InteractionManager.SOUND_MINECART, entity.getId());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ public class AirBalloonEntity extends MobEntity implements EntityCollisions.Comp
|
|||
protected ActionResult interactMob(PlayerEntity player, Hand hand) {
|
||||
ItemStack stack = player.getStackInHand(hand);
|
||||
|
||||
if (stack.getItem() instanceof HotAirBalloonItem balloon && !hasBalloon()) {
|
||||
if (stack.getItem() instanceof HotAirBalloonItem && !hasBalloon()) {
|
||||
if (!player.getAbilities().creativeMode) {
|
||||
stack.decrement(1);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class CorruptionHandler implements Tickable {
|
|||
|
||||
private void recover(float percentage) {
|
||||
pony.getCorruption().set((int)(pony.getCorruption().get() * (1 - percentage)));
|
||||
InteractionManager.INSTANCE.playLoopingSound(pony.asEntity(), InteractionManager.SOUND_HEART_BEAT, 0);
|
||||
InteractionManager.getInstance().playLoopingSound(pony.asEntity(), InteractionManager.SOUND_HEART_BEAT, 0);
|
||||
MagicReserves reserves = pony.getMagicalReserves();
|
||||
reserves.getExertion().addPercent(10);
|
||||
reserves.getEnergy().add(10);
|
||||
|
|
|
@ -459,13 +459,13 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
if (type.isAvian()) {
|
||||
if (!SpellPredicate.IS_DISGUISE.isOn(pony) && pony.isClient()) {
|
||||
if (ticksInAir % GLIDING_SOUND_INTERVAL == 5) {
|
||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_GLIDING, entity.getId());
|
||||
InteractionManager.getInstance().playLoopingSound(entity, InteractionManager.SOUND_GLIDING, entity.getId());
|
||||
}
|
||||
}
|
||||
} else if (type == FlightType.INSECTOID && !SpellPredicate.IS_DISGUISE.isOn(pony)) {
|
||||
if (entity.getWorld().isClient && !soundPlaying) {
|
||||
soundPlaying = true;
|
||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_CHANGELING_BUZZ, entity.getId());
|
||||
InteractionManager.getInstance().playLoopingSound(entity, InteractionManager.SOUND_CHANGELING_BUZZ, entity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -564,7 +564,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
|||
entity.addStatusEffect(new StatusEffectInstance(UEffects.SUN_BLINDNESS, SunBlindnessStatusEffect.MAX_DURATION, 2, true, false));
|
||||
UCriteria.LOOK_INTO_SUN.trigger(entity);
|
||||
} else if (isClientPlayer()) {
|
||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_EARS_RINGING, entity.getId());
|
||||
InteractionManager.getInstance().playLoopingSound(entity, InteractionManager.SOUND_EARS_RINGING, entity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
|||
if (!isClient()) {
|
||||
entity.addStatusEffect(new StatusEffectInstance(UEffects.SUN_BLINDNESS, SunBlindnessStatusEffect.MAX_DURATION, 1, true, false));
|
||||
} else if (isClientPlayer()) {
|
||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_EARS_RINGING, entity.getId());
|
||||
InteractionManager.getInstance().playLoopingSound(entity, InteractionManager.SOUND_EARS_RINGING, entity.getId());
|
||||
}
|
||||
}
|
||||
} else if (ticksInSun > 0) {
|
||||
|
@ -966,7 +966,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
|||
}
|
||||
|
||||
public boolean isClientPlayer() {
|
||||
return InteractionManager.instance().isClientPlayer(asEntity());
|
||||
return InteractionManager.getInstance().isClientPlayer(asEntity());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -65,7 +65,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen
|
|||
|
||||
@Override
|
||||
public boolean shouldRenderName() {
|
||||
return !InteractionManager.instance().isClientPlayer(getMaster());
|
||||
return !InteractionManager.getInstance().isClientPlayer(getMaster());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,7 +53,7 @@ public class DummyPlayerEntity extends PlayerEntity implements Owned<PlayerEntit
|
|||
|
||||
@Override
|
||||
public boolean shouldRenderName() {
|
||||
return !InteractionManager.instance().isClientPlayer(getMaster());
|
||||
return !InteractionManager.getInstance().isClientPlayer(getMaster());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -271,7 +271,7 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
|||
pony.playSound(USounds.ITEM_ALICORN_AMULET_HALLUCINATION, 3, 1);
|
||||
} else if (attachedTicks < 2 || (attachedTicks % (10 * ItemTracker.SECONDS) < 9 && world.random.nextInt(90) == 0)) {
|
||||
if (attachedTicks % 5 == 0) {
|
||||
InteractionManager.INSTANCE.playLoopingSound(player, InteractionManager.SOUND_HEART_BEAT, 0);
|
||||
InteractionManager.getInstance().playLoopingSound(player, InteractionManager.SOUND_HEART_BEAT, 0);
|
||||
}
|
||||
|
||||
reserves.getExertion().addPercent(10);
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ForageableItem extends Item {
|
|||
if (state.isIn(BlockTags.LEAVES)) {
|
||||
player.swingHand(hand);
|
||||
world.playSound(player, pos, state.getSoundGroup().getHitSound(), SoundCategory.BLOCKS);
|
||||
InteractionManager.instance().addBlockBreakingParticles(pos, hitResult.getSide());
|
||||
InteractionManager.getInstance().addBlockBreakingParticles(pos, hitResult.getSide());
|
||||
|
||||
int miningLevel = (stack.getItem() instanceof HoeItem hoe ? hoe.getMaterial().getMiningLevel() : 59);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
|||
import java.util.function.Predicate;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.InteractionManager;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellType;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
||||
import com.minelittlepony.unicopia.client.TextHelper;
|
||||
|
@ -84,7 +84,7 @@ public class GemstoneItem extends Item implements MultiItem, EnchantableItem {
|
|||
|
||||
MutableText line = Text.translatable(key.getTranslationKey() + ".lore").formatted(key.getAffinity().getColor());
|
||||
|
||||
if (!Unicopia.SIDE.getPlayerSpecies().canCast()) {
|
||||
if (!InteractionManager.getInstance().getClientSpecies().canCast()) {
|
||||
line = line.formatted(Formatting.OBFUSCATED);
|
||||
}
|
||||
|
||||
|
@ -105,13 +105,13 @@ public class GemstoneItem extends Item implements MultiItem, EnchantableItem {
|
|||
|
||||
@Override
|
||||
public boolean hasGlint(ItemStack stack) {
|
||||
return super.hasGlint(stack) || (Unicopia.SIDE.getPlayerSpecies().canCast() && EnchantableItem.isEnchanted(stack));
|
||||
return super.hasGlint(stack) || (InteractionManager.getInstance().getClientSpecies().canCast() && EnchantableItem.isEnchanted(stack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text getName(ItemStack stack) {
|
||||
if (EnchantableItem.isEnchanted(stack)) {
|
||||
if (!Unicopia.SIDE.getPlayerSpecies().canCast()) {
|
||||
if (!InteractionManager.getInstance().getClientSpecies().canCast()) {
|
||||
return Text.translatable(getTranslationKey(stack) + ".obfuscated");
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.minelittlepony.unicopia.InteractionManager;
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.minelittlepony.unicopia.USounds;
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||
import com.minelittlepony.unicopia.entity.mob.UEntityAttributes;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
|
@ -53,18 +53,15 @@ public class HorseShoeItem extends HeavyProjectileItem {
|
|||
float inaccuracy = projectileInnacuracy + degradation * 30;
|
||||
tooltip.add(Text.empty());
|
||||
|
||||
Pony pony = Unicopia.SIDE.getPony().orElse(null);
|
||||
var race = InteractionManager.getInstance().getClientPony().map(Pony::getCompositeRace).orElse(null);
|
||||
float speed = baseProjectileSpeed;
|
||||
if (pony != null) {
|
||||
var race = pony.getCompositeRace();
|
||||
|
||||
if (race != null) {
|
||||
if (race.any(Race::canUseEarth)) {
|
||||
speed += 0.5F;
|
||||
}
|
||||
if (!race.includes(Race.ALICORN) && race.physical().canFly()) {
|
||||
speed /= 1.5F;
|
||||
}
|
||||
|
||||
}
|
||||
speed /= 1.5F;
|
||||
speed *= 1 - (0.6F * degradation);
|
||||
|
|
|
@ -2,8 +2,8 @@ package com.minelittlepony.unicopia.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.minelittlepony.unicopia.InteractionManager;
|
||||
import com.minelittlepony.unicopia.UConventionalTags;
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.advancement.UCriteria;
|
||||
import com.minelittlepony.unicopia.entity.Living;
|
||||
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||
|
@ -101,7 +101,7 @@ public class ZapAppleItem extends Item implements ChameleonItem, MultiItem {
|
|||
|
||||
@Override
|
||||
public List<ItemStack> getDefaultStacks() {
|
||||
return Unicopia.SIDE.getPony().map(Pony::asWorld)
|
||||
return InteractionManager.getInstance().getClientPony().map(Pony::asWorld)
|
||||
.stream()
|
||||
.flatMap(world -> RegistryUtils.valuesForTag(world, UConventionalTags.Items.APPLES))
|
||||
.filter(a -> a != this).map(item -> {
|
||||
|
|
|
@ -31,7 +31,7 @@ public class CloudBlockItem extends BlockItem {
|
|||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||
InteractionManager.instance().sendPlayerLookAngles(user);
|
||||
InteractionManager.getInstance().sendPlayerLookAngles(user);
|
||||
Vec3d targetPos = user.getEyePos().add(user.getRotationVec(1).multiply(1, 1.5, 1).normalize().multiply(2));
|
||||
ItemPlacementContext context = new ItemPlacementContext(user, hand, user.getStackInHand(hand), new BlockHitResult(
|
||||
targetPos,
|
||||
|
|
|
@ -31,7 +31,7 @@ public record MsgServerResources (
|
|||
public MsgServerResources(PacketByteBuf buffer) {
|
||||
this(
|
||||
buffer.readMap(PacketByteBuf::readIdentifier, SpellTraits::fromPacket),
|
||||
InteractionManager.instance().readChapters(buffer),
|
||||
InteractionManager.getInstance().readChapters(buffer),
|
||||
buffer.readMap(PacketByteBuf::readIdentifier, TreeTypeLoader.TreeTypeDef::new),
|
||||
new PonyDiets(buffer)
|
||||
);
|
||||
|
|
|
@ -131,7 +131,7 @@ public class MagicBeamEntity extends MagicProjectileEntity implements Caster<Mag
|
|||
@Override
|
||||
public void onSpawnPacket(EntitySpawnS2CPacket packet) {
|
||||
super.onSpawnPacket(packet);
|
||||
InteractionManager.instance().playLoopingSound(this, InteractionManager.SOUND_MAGIC_BEAM, getId());
|
||||
InteractionManager.getInstance().playLoopingSound(this, InteractionManager.SOUND_MAGIC_BEAM, getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -181,7 +181,7 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
|
|||
BlockPos belowPos = buttonPos.down();
|
||||
BlockState below = getWorld().getBlockState(belowPos);
|
||||
ItemStack stack = getStack();
|
||||
if (below.getBlock() instanceof HopperBlock hopper) {
|
||||
if (below.getBlock() instanceof HopperBlock) {
|
||||
BlockEntity e = getWorld().getBlockEntity(belowPos);
|
||||
if (e instanceof Inventory inventory) {
|
||||
for (int i = 0; i < inventory.size(); i++) {
|
||||
|
|
Loading…
Reference in a new issue