mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 07:17:58 +01:00
1.18 -> 1.19
This commit is contained in:
parent
9e1b9161b8
commit
ded553bd31
90 changed files with 320 additions and 319 deletions
|
@ -1,6 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
id 'fabric-loom' version '0.10-SNAPSHOT'
|
id 'fabric-loom' version '0.12-SNAPSHOT'
|
||||||
id 'org.ajoberstar.reckon' version '0.13.0'
|
id 'org.ajoberstar.reckon' version '0.13.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(17)
|
languageVersion = JavaLanguageVersion.of(17)
|
||||||
}
|
}
|
||||||
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
group = project.group
|
group = project.group
|
||||||
|
@ -65,8 +66,3 @@ processResources {
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
||||||
classifier = "sources"
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
|
|
|
@ -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.18.2
|
minecraft_version=1.19
|
||||||
yarn_mappings=1.18.2+build.1
|
yarn_mappings=1.19+build.1
|
||||||
loader_version=0.13.3
|
loader_version=0.14.7
|
||||||
fabric_version=0.47.8+1.18.2
|
fabric_version=0.55.3+1.19
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
group=com.minelittlepony
|
group=com.minelittlepony
|
||||||
|
@ -15,6 +15,6 @@ org.gradle.daemon=false
|
||||||
description=Magical Abilities for Mine Little Pony!
|
description=Magical Abilities for Mine Little Pony!
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
modmenu_version=3.1.0
|
modmenu_version=4.0.0
|
||||||
minelp_version=4.4.4
|
minelp_version=4.5.1
|
||||||
kirin_version=1.10.0
|
kirin_version=1.11.0
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class InteractionManager {
|
||||||
/**
|
/**
|
||||||
* Plays a custom sound instance
|
* Plays a custom sound instance
|
||||||
*/
|
*/
|
||||||
public void playLoopingSound(Entity source, int type) {
|
public void playLoopingSound(Entity source, int type, long seed) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import com.minelittlepony.unicopia.ability.magic.Affine;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public enum Race implements Affine {
|
public enum Race implements Affine {
|
||||||
|
@ -86,11 +85,11 @@ public enum Race implements Affine {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Text getDisplayName() {
|
public Text getDisplayName() {
|
||||||
return new TranslatableText(getTranslationKey());
|
return Text.translatable(getTranslationKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Text getAltDisplayName() {
|
public Text getAltDisplayName() {
|
||||||
return new TranslatableText(getTranslationKey() + ".alt");
|
return Text.translatable(getTranslationKey() + ".alt");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTranslationKey() {
|
public String getTranslationKey() {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.registry.RegistryEntry;
|
import net.minecraft.util.registry.RegistryEntry;
|
||||||
import net.minecraft.world.PersistentState;
|
import net.minecraft.world.PersistentState;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.world.dimension.DimensionType;
|
||||||
|
import net.minecraft.world.dimension.DimensionTypes;
|
||||||
|
|
||||||
public class WorldTribeManager extends PersistentState {
|
public class WorldTribeManager extends PersistentState {
|
||||||
|
|
||||||
|
@ -31,13 +32,13 @@ public class WorldTribeManager extends PersistentState {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String nameFor(RegistryEntry<DimensionType> dimension) {
|
public static String nameFor(RegistryEntry<DimensionType> dimension) {
|
||||||
if (dimension.matchesKey(DimensionType.THE_END_REGISTRY_KEY)) {
|
if (dimension.matchesKey(DimensionTypes.THE_END)) {
|
||||||
return "unicopia:tribes_end";
|
return "unicopia:tribes_end";
|
||||||
}
|
}
|
||||||
return "unicopia:tribes";
|
return "unicopia:tribes";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WorldTribeManager forWorld(ServerWorld world) {
|
public static WorldTribeManager forWorld(ServerWorld world) {
|
||||||
return world.getPersistentStateManager().getOrCreate(WorldTribeManager::new, WorldTribeManager::new, nameFor(world.method_40134()));
|
return world.getPersistentStateManager().getOrCreate(WorldTribeManager::new, WorldTribeManager::new, nameFor(world.getDimensionEntry()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.minelittlepony.unicopia.ability.data.Hit;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -79,7 +78,7 @@ public interface Ability<T extends Hit> {
|
||||||
*/
|
*/
|
||||||
default Text getName() {
|
default Text getName() {
|
||||||
Identifier id = Abilities.REGISTRY.getId(this);
|
Identifier id = Abilities.REGISTRY.getId(this);
|
||||||
return new TranslatableText("ability." + id.getNamespace() + "." + id.getPath().replace('/', '.'));
|
return Text.translatable("ability." + id.getNamespace() + "." + id.getPath().replace('/', '.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.minelittlepony.unicopia.ability;
|
package com.minelittlepony.unicopia.ability;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.AwaitTickQueue;
|
import com.minelittlepony.unicopia.AwaitTickQueue;
|
||||||
import com.minelittlepony.unicopia.EquinePredicates;
|
import com.minelittlepony.unicopia.EquinePredicates;
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
|
@ -15,6 +13,7 @@ import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A magic casting ability for unicorns.
|
* A magic casting ability for unicorns.
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
||||||
ItemStack stack = UItems.PEBBLES.getDefaultStack();
|
ItemStack stack = UItems.PEBBLES.getDefaultStack();
|
||||||
stack.setCount(1 + w.getRandom().nextInt(2));
|
stack.setCount(1 + w.getRandom().nextInt(2));
|
||||||
Block.dropStack(w, pos, stack);
|
Block.dropStack(w, pos, stack);
|
||||||
state.onStacksDropped((ServerWorld)w, pos, stack);
|
state.onStacksDropped((ServerWorld)w, pos, stack, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.minelittlepony.unicopia.particle.MagicParticleEffect;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket;
|
import net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.level.ServerWorldProperties;
|
import net.minecraft.world.level.ServerWorldProperties;
|
||||||
|
@ -109,7 +109,7 @@ public class PegasusCaptureStormAbility implements Ability<Hit> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tell(Pony player, String translation) {
|
private void tell(Pony player, String translation) {
|
||||||
player.getMaster().sendMessage(new TranslatableText(translation), true);
|
player.getMaster().sendMessage(Text.translatable(translation), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.minelittlepony.unicopia.ability;
|
package com.minelittlepony.unicopia.ability;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
|
@ -25,6 +23,7 @@ import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.TypedActionResult;
|
import net.minecraft.util.TypedActionResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Casts magic onto the user directly, or uses the item in the main hand slot.
|
* Casts magic onto the user directly, or uses the item in the main hand slot.
|
||||||
|
|
|
@ -13,7 +13,7 @@ import com.minelittlepony.unicopia.particle.MagicParticleEffect;
|
||||||
import com.minelittlepony.unicopia.util.RayTraceHelper;
|
import com.minelittlepony.unicopia.util.RayTraceHelper;
|
||||||
import com.minelittlepony.unicopia.util.VecHelper;
|
import com.minelittlepony.unicopia.util.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispells an active spell
|
* Dispells an active spell
|
||||||
|
@ -46,9 +46,9 @@ public class UnicornDispellAbility implements Ability<Pos> {
|
||||||
if (type.getTapCount() > 1) {
|
if (type.getTapCount() > 1) {
|
||||||
player.setAnimation(Animation.WOLOLO, 10);
|
player.setAnimation(Animation.WOLOLO, 10);
|
||||||
if (player.getSpellSlot().clear()) {
|
if (player.getSpellSlot().clear()) {
|
||||||
player.getMaster().sendMessage(new TranslatableText("gui.unicopia.action.spells_cleared"), true);
|
player.getMaster().sendMessage(Text.translatable("gui.unicopia.action.spells_cleared"), true);
|
||||||
} else {
|
} else {
|
||||||
player.getMaster().sendMessage(new TranslatableText("gui.unicopia.action.no_spells_cleared"), true);
|
player.getMaster().sendMessage(Text.translatable("gui.unicopia.action.no_spells_cleared"), true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class InfernoSpell extends FireSpell {
|
||||||
|
|
||||||
Vec3d origin = source.getOriginVector();
|
Vec3d origin = source.getOriginVector();
|
||||||
|
|
||||||
BlockStateConverter converter = w.getDimension().isUltrawarm() ? 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 = new BlockPos(shape.computePoint(w.random).add(origin));
|
||||||
|
|
|
@ -26,7 +26,6 @@ import com.minelittlepony.unicopia.util.Registries;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
@ -124,7 +123,7 @@ public final class SpellType<T extends Spell> implements Affine, SpellPredicate<
|
||||||
}
|
}
|
||||||
|
|
||||||
public Text getName() {
|
public Text getName() {
|
||||||
return new TranslatableText(getTranslationKey());
|
return Text.translatable(getTranslationKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomisedSpellType<T> withTraits() {
|
public CustomisedSpellType<T> withTraits() {
|
||||||
|
|
|
@ -13,8 +13,7 @@ import com.minelittlepony.common.client.gui.Tooltip;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtElement;
|
import net.minecraft.nbt.NbtElement;
|
||||||
import net.minecraft.nbt.NbtList;
|
import net.minecraft.nbt.NbtList;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.*;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
@ -91,14 +90,14 @@ public enum Trait {
|
||||||
: Formatting.WHITE;
|
: Formatting.WHITE;
|
||||||
|
|
||||||
return Tooltip.of(
|
return Tooltip.of(
|
||||||
new TranslatableText("gui.unicopia.trait.label",
|
Text.translatable("gui.unicopia.trait.label",
|
||||||
new TranslatableText("trait." + getId().getNamespace() + "." + getId().getPath() + ".name")
|
Text.translatable("trait." + getId().getNamespace() + "." + getId().getPath() + ".name")
|
||||||
).formatted(Formatting.YELLOW)
|
).formatted(Formatting.YELLOW)
|
||||||
.append(new TranslatableText("gui.unicopia.trait.group", getGroup().name().toLowerCase()).formatted(Formatting.ITALIC, Formatting.GRAY))
|
.append(Text.translatable("gui.unicopia.trait.group", getGroup().name().toLowerCase()).formatted(Formatting.ITALIC, Formatting.GRAY))
|
||||||
.append(new LiteralText("\n\n").formatted(Formatting.WHITE)
|
.append(Text.literal("\n\n").formatted(Formatting.WHITE)
|
||||||
.append(new TranslatableText("trait." + getId().getNamespace() + "." + getId().getPath() + ".description").formatted(Formatting.GRAY))
|
.append(Text.translatable("trait." + getId().getNamespace() + "." + getId().getPath() + ".description").formatted(Formatting.GRAY))
|
||||||
.append("\n")
|
.append("\n")
|
||||||
.append(new TranslatableText("gui.unicopia.trait.corruption", ItemStack.MODIFIER_FORMAT.format(getGroup().getCorruption())).formatted(Formatting.ITALIC, corruptionColor))), 200);
|
.append(Text.translatable("gui.unicopia.trait.corruption", ItemStack.MODIFIER_FORMAT.format(getGroup().getCorruption())).formatted(Formatting.ITALIC, corruptionColor))), 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<Trait> all() {
|
public static Collection<Trait> all() {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -53,7 +52,7 @@ public class TraitLoader extends SinglePreparationResourceReloader<Multimap<Iden
|
||||||
|
|
||||||
Multimap<Identifier, TraitStream> prepared = HashMultimap.create();
|
Multimap<Identifier, TraitStream> prepared = HashMultimap.create();
|
||||||
|
|
||||||
for (Identifier path : new HashSet<>(manager.findResources("traits", p -> p.endsWith(".json")))) {
|
for (var path : manager.findResources("traits", p -> p.getPath().endsWith(".json")).keySet()) {
|
||||||
profiler.push(path.toString());
|
profiler.push(path.toString());
|
||||||
try {
|
try {
|
||||||
for (Resource resource : manager.getAllResources(path)) {
|
for (Resource resource : manager.getAllResources(path)) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class FrostedObsidianBlock extends FrostedIceBlock {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void melt(BlockState state, World world, BlockPos pos) {
|
protected void melt(BlockState state, World world, BlockPos pos) {
|
||||||
if (world.getDimension().isUltrawarm()) {
|
if (world.getDimension().ultrawarm()) {
|
||||||
world.removeBlock(pos, false);
|
world.removeBlock(pos, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.minelittlepony.unicopia.block;
|
package com.minelittlepony.unicopia.block;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.EquinePredicates;
|
import com.minelittlepony.unicopia.EquinePredicates;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
|
|
||||||
|
@ -11,6 +9,7 @@ import net.minecraft.block.ShapeContext;
|
||||||
import net.minecraft.item.ItemConvertible;
|
import net.minecraft.item.ItemConvertible;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
import net.minecraft.util.shape.VoxelShapes;
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.entity.passive.BeeEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.vehicle.AbstractMinecartEntity;
|
import net.minecraft.entity.vehicle.AbstractMinecartEntity;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ClientInteractionManager extends InteractionManager {
|
public class ClientInteractionManager extends InteractionManager {
|
||||||
|
@ -50,12 +51,12 @@ public class ClientInteractionManager extends InteractionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playLoopingSound(Entity source, int type) {
|
public void playLoopingSound(Entity source, int type, long seed) {
|
||||||
client.execute(() -> {
|
client.execute(() -> {
|
||||||
SoundManager soundManager = client.getSoundManager();
|
SoundManager soundManager = client.getSoundManager();
|
||||||
|
|
||||||
if (type == SOUND_EARS_RINGING && source instanceof LivingEntity) {
|
if (type == SOUND_EARS_RINGING && source instanceof LivingEntity) {
|
||||||
soundManager.play(new LoopingSoundInstance<>((LivingEntity)source, e -> e.hasStatusEffect(UEffects.SUN_BLINDNESS), USounds.ENTITY_PLAYER_EARS_RINGING, 1, 1));
|
soundManager.play(new LoopingSoundInstance<>((LivingEntity)source, e -> e.hasStatusEffect(UEffects.SUN_BLINDNESS), USounds.ENTITY_PLAYER_EARS_RINGING, 1, 1, Random.create(seed)));
|
||||||
} else if (type == SOUND_BEE && source instanceof BeeEntity) {
|
} else if (type == SOUND_BEE && source instanceof BeeEntity) {
|
||||||
soundManager.playNextTick(
|
soundManager.playNextTick(
|
||||||
((BeeEntity)source).hasAngerTime()
|
((BeeEntity)source).hasAngerTime()
|
||||||
|
@ -68,11 +69,11 @@ public class ClientInteractionManager extends InteractionManager {
|
||||||
soundManager.play(new LoopingSoundInstance<>((PlayerEntity)source, e -> {
|
soundManager.play(new LoopingSoundInstance<>((PlayerEntity)source, e -> {
|
||||||
PlayerPhysics physics = Pony.of(e).getPhysics();
|
PlayerPhysics physics = Pony.of(e).getPhysics();
|
||||||
return physics.isFlying() && physics.getFlightType() == FlightType.INSECTOID;
|
return physics.isFlying() && physics.getFlightType() == FlightType.INSECTOID;
|
||||||
}, USounds.ENTITY_PLAYER_CHANGELING_BUZZ, 1F, 1F));
|
}, USounds.ENTITY_PLAYER_CHANGELING_BUZZ, 1F, 1F, Random.create(seed)));
|
||||||
} else if (type == SOUND_GLIDING && source instanceof PlayerEntity) {
|
} else if (type == SOUND_GLIDING && source instanceof PlayerEntity) {
|
||||||
soundManager.play(new MotionBasedSoundInstance(SoundEvents.ITEM_ELYTRA_FLYING, (PlayerEntity)source));
|
soundManager.play(new MotionBasedSoundInstance(SoundEvents.ITEM_ELYTRA_FLYING, (PlayerEntity)source, Random.create(seed)));
|
||||||
} else if (type == SOUND_MAGIC_BEAM) {
|
} else if (type == SOUND_MAGIC_BEAM) {
|
||||||
soundManager.play(new LoopedEntityTrackingSoundInstance(USounds.SPELL_CAST_SHOOT, 0.3F, 1F, source));
|
soundManager.play(new LoopedEntityTrackingSoundInstance(USounds.SPELL_CAST_SHOOT, 0.3F, 1F, source, seed));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,12 @@ import net.minecraft.client.toast.Toast;
|
||||||
import net.minecraft.client.toast.ToastManager;
|
import net.minecraft.client.toast.ToastManager;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class DiscoveryToast implements Toast {
|
public class DiscoveryToast implements Toast {
|
||||||
private static final long MAX_AGE = 5000L;
|
private static final long MAX_AGE = 5000L;
|
||||||
private static final Text TITLE = new TranslatableText("unicopia.toast.discoveries.title");
|
private static final Text TITLE = Text.translatable("unicopia.toast.discoveries.title");
|
||||||
private static final Text DESCRIPTION = new TranslatableText("unicopia.toast.discoveries.description");
|
private static final Text DESCRIPTION = Text.translatable("unicopia.toast.discoveries.description");
|
||||||
|
|
||||||
private final List<Identifier> discoveries = new ArrayList<>();
|
private final List<Identifier> discoveries = new ArrayList<>();
|
||||||
private long startTime;
|
private long startTime;
|
||||||
|
|
|
@ -4,16 +4,14 @@ import java.util.Optional;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.*;
|
||||||
import net.minecraft.text.Style;
|
|
||||||
import net.minecraft.text.Text;
|
|
||||||
|
|
||||||
public interface FlowingText {
|
public interface FlowingText {
|
||||||
static Stream<Text> wrap(Text text, int maxWidth) {
|
static Stream<Text> wrap(Text text, int maxWidth) {
|
||||||
return MinecraftClient.getInstance().textRenderer.getTextHandler().wrapLines(text, maxWidth, Style.EMPTY).stream().map(line -> {
|
return MinecraftClient.getInstance().textRenderer.getTextHandler().wrapLines(text, maxWidth, Style.EMPTY).stream().map(line -> {
|
||||||
LiteralText compiled = new LiteralText("");
|
MutableText compiled = Text.literal("");
|
||||||
line.visit((s, t) -> {
|
line.visit((s, t) -> {
|
||||||
compiled.append(new LiteralText(t).setStyle(s));
|
compiled.append(Text.literal(t).setStyle(s));
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}, text.getStyle());
|
}, text.getStyle());
|
||||||
return compiled;
|
return compiled;
|
||||||
|
|
|
@ -20,7 +20,6 @@ import net.minecraft.client.option.KeyBinding;
|
||||||
import net.minecraft.client.sound.PositionedSoundInstance;
|
import net.minecraft.client.sound.PositionedSoundInstance;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public class KeyBindingsHandler {
|
public class KeyBindingsHandler {
|
||||||
|
@ -106,7 +105,7 @@ public class KeyBindingsHandler {
|
||||||
private void changePage(MinecraftClient client, long max, int sigma) {
|
private void changePage(MinecraftClient client, long max, int sigma) {
|
||||||
page += sigma;
|
page += sigma;
|
||||||
client.getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.75F + (0.25F * sigma)));
|
client.getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.75F + (0.25F * sigma)));
|
||||||
UHud.INSTANCE.setMessage(new TranslatableText("gui.unicopia.page_num", page + 1, max + 1));
|
UHud.INSTANCE.setMessage(Text.translatable("gui.unicopia.page_num", page + 1, max + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Binding {
|
public class Binding {
|
||||||
|
|
|
@ -26,9 +26,8 @@ import net.minecraft.entity.attribute.EntityAttributeModifier.Operation;
|
||||||
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.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.screen.ScreenTexts;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.Pair;
|
import net.minecraft.util.Pair;
|
||||||
|
@ -60,10 +59,10 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback {
|
||||||
.forEach(entry -> describeModifiers(entry.getKey(), entry.getValue(), null, newLines));
|
.forEach(entry -> describeModifiers(entry.getKey(), entry.getValue(), null, newLines));
|
||||||
|
|
||||||
if (!newLines.isEmpty()) {
|
if (!newLines.isEmpty()) {
|
||||||
Text find = new TranslatableText("item.modifiers." + slot.getName()).formatted(Formatting.GRAY);
|
Text find = Text.translatable("item.modifiers." + slot.getName()).formatted(Formatting.GRAY);
|
||||||
int insertPosition = getInsertPosition(stack, find, flags, lines, context.isAdvanced());
|
int insertPosition = getInsertPosition(stack, find, flags, lines, context.isAdvanced());
|
||||||
if (insertPosition == -1) {
|
if (insertPosition == -1) {
|
||||||
lines.add(LiteralText.EMPTY);
|
lines.add(ScreenTexts.EMPTY);
|
||||||
lines.add(find);
|
lines.add(find);
|
||||||
lines.addAll(newLines);
|
lines.addAll(newLines);
|
||||||
} else {
|
} else {
|
||||||
|
@ -87,23 +86,23 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback {
|
||||||
|
|
||||||
if (insertPosition == -1 && stack.hasNbt()) {
|
if (insertPosition == -1 && stack.hasNbt()) {
|
||||||
if (isShowing(flags, ItemStack.TooltipSection.MODIFIERS) && stack.getNbt().getBoolean("Unbreakable")) {
|
if (isShowing(flags, ItemStack.TooltipSection.MODIFIERS) && stack.getNbt().getBoolean("Unbreakable")) {
|
||||||
insertPosition = checkFor(lines, new TranslatableText("item.unbreakable").formatted(Formatting.BLUE));
|
insertPosition = checkFor(lines, Text.translatable("item.unbreakable").formatted(Formatting.BLUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (insertPosition == -1 && isShowing(flags, ItemStack.TooltipSection.CAN_DESTROY) && stack.getNbt().contains("CanDestroy", 9)) {
|
if (insertPosition == -1 && isShowing(flags, ItemStack.TooltipSection.CAN_DESTROY) && stack.getNbt().contains("CanDestroy", 9)) {
|
||||||
insertPosition = checkFor(lines, new TranslatableText("item.canBreak").formatted(Formatting.GRAY));
|
insertPosition = checkFor(lines, Text.translatable("item.canBreak").formatted(Formatting.GRAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (insertPosition == -1 && isShowing(flags, ItemStack.TooltipSection.CAN_PLACE) && stack.getNbt().contains("CanPlaceOn", 9)) {
|
if (insertPosition == -1 && isShowing(flags, ItemStack.TooltipSection.CAN_PLACE) && stack.getNbt().contains("CanPlaceOn", 9)) {
|
||||||
insertPosition = checkFor(lines, new TranslatableText("item.canPlace").formatted(Formatting.GRAY));
|
insertPosition = checkFor(lines, Text.translatable("item.canPlace").formatted(Formatting.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (insertPosition == -1 && advanced) {
|
if (insertPosition == -1 && advanced) {
|
||||||
if (stack.isDamaged()) {
|
if (stack.isDamaged()) {
|
||||||
insertPosition = checkFor(lines, new TranslatableText("item.durability", stack.getMaxDamage() - stack.getDamage(), stack.getMaxDamage()));
|
insertPosition = checkFor(lines, Text.translatable("item.durability", stack.getMaxDamage() - stack.getDamage(), stack.getMaxDamage()));
|
||||||
} else {
|
} else {
|
||||||
insertPosition = checkFor(lines, new LiteralText(Registry.ITEM.getId(stack.getItem()).toString()).formatted(Formatting.DARK_GRAY));
|
insertPosition = checkFor(lines, Text.literal(Registry.ITEM.getId(stack.getItem()).toString()).formatted(Formatting.DARK_GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +131,7 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (baseAdjusted) {
|
if (baseAdjusted) {
|
||||||
lines.add(new LiteralText(" ").append(getModifierLineBase("equals", displayValue, op, attribute, Formatting.DARK_GREEN)));
|
lines.add(Text.literal(" ").append(getModifierLineBase("equals", displayValue, op, attribute, Formatting.DARK_GREEN)));
|
||||||
} else if (value > 0) {
|
} else if (value > 0) {
|
||||||
lines.add(getModifierLineBase("plus", displayValue, op, attribute, attribute == PlayerAttributes.ENTITY_GRAVTY_MODIFIER ? Formatting.RED : Formatting.BLUE));
|
lines.add(getModifierLineBase("plus", displayValue, op, attribute, attribute == PlayerAttributes.ENTITY_GRAVTY_MODIFIER ? Formatting.RED : Formatting.BLUE));
|
||||||
} else if (value < 0) {
|
} else if (value < 0) {
|
||||||
|
@ -141,9 +140,9 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Text getModifierLineBase(String root, double displayValue, Operation op, EntityAttribute attribute, Formatting color) {
|
private Text getModifierLineBase(String root, double displayValue, Operation op, EntityAttribute attribute, Formatting color) {
|
||||||
return new TranslatableText("attribute.modifier." + root + "." + op.getId(),
|
return Text.translatable("attribute.modifier." + root + "." + op.getId(),
|
||||||
ItemStack.MODIFIER_FORMAT.format(displayValue),
|
ItemStack.MODIFIER_FORMAT.format(displayValue),
|
||||||
new TranslatableText(attribute.getTranslationKey())
|
Text.translatable(attribute.getTranslationKey())
|
||||||
).formatted(color);
|
).formatted(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,8 @@ import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry.Pendin
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
|
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry;
|
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
|
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
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.DiffuseLighting;
|
import net.minecraft.client.render.DiffuseLighting;
|
||||||
|
@ -111,7 +111,7 @@ public interface URenderers {
|
||||||
matrices.push();
|
matrices.push();
|
||||||
|
|
||||||
});
|
});
|
||||||
FabricModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> {
|
ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> {
|
||||||
return GemstoneItem.isEnchanted(stack) ? 1 + GemstoneItem.getSpellKey(stack).getAffinity().ordinal() : 0;
|
return GemstoneItem.isEnchanted(stack) ? 1 + GemstoneItem.getSpellKey(stack).getAffinity().ordinal() : 0;
|
||||||
});
|
});
|
||||||
ColorProviderRegistry.ITEM.register((stack, i) -> {
|
ColorProviderRegistry.ITEM.register((stack, i) -> {
|
||||||
|
|
|
@ -18,13 +18,13 @@ import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
|
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
|
||||||
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.screen.OpenToLanScreen;
|
import net.minecraft.client.gui.screen.OpenToLanScreen;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.HandledScreens;
|
||||||
import net.minecraft.client.gui.screen.world.CreateWorldScreen;
|
import net.minecraft.client.gui.screen.world.CreateWorldScreen;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
public class UnicopiaClient implements ClientModInitializer {
|
public class UnicopiaClient implements ClientModInitializer {
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public class UnicopiaClient implements ClientModInitializer {
|
||||||
KeyBindingsHandler.bootstrap();
|
KeyBindingsHandler.bootstrap();
|
||||||
URenderers.bootstrap();
|
URenderers.bootstrap();
|
||||||
|
|
||||||
ScreenRegistry.register(UScreenHandlers.SPELL_BOOK, SpellbookScreen::new);
|
HandledScreens.register(UScreenHandlers.SPELL_BOOK, SpellbookScreen::new);
|
||||||
|
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(this::onTick);
|
ClientTickEvents.END_CLIENT_TICK.register(this::onTick);
|
||||||
ScreenInitCallback.EVENT.register(this::onScreenInit);
|
ScreenInitCallback.EVENT.register(this::onScreenInit);
|
||||||
|
@ -83,7 +83,7 @@ public class UnicopiaClient implements ClientModInitializer {
|
||||||
if (screen instanceof OpenToLanScreen) {
|
if (screen instanceof OpenToLanScreen) {
|
||||||
buttons.addButton(new Button(screen.width / 2 - 155, 130, 150, 20))
|
buttons.addButton(new Button(screen.width / 2 - 155, 130, 150, 20))
|
||||||
.onClick(b -> MinecraftClient.getInstance().setScreen(new LanSettingsScreen(screen)))
|
.onClick(b -> MinecraftClient.getInstance().setScreen(new LanSettingsScreen(screen)))
|
||||||
.getStyle().setText(new TranslatableText("unicopia.options.title"));
|
.getStyle().setText(Text.translatable("unicopia.options.title"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,10 @@ import net.minecraft.client.gui.Selectable;
|
||||||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
||||||
import net.minecraft.client.sound.PositionedSoundInstance;
|
import net.minecraft.client.sound.PositionedSoundInstance;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.screen.ScreenTexts;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
import net.minecraft.text.LiteralText;
|
|
||||||
import net.minecraft.text.MutableText;
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.math.Vector4f;
|
import net.minecraft.util.math.Vector4f;
|
||||||
|
|
||||||
public class DismissSpellScreen extends GameGui {
|
public class DismissSpellScreen extends GameGui {
|
||||||
|
@ -33,7 +32,7 @@ public class DismissSpellScreen extends GameGui {
|
||||||
private int relativeMouseY;
|
private int relativeMouseY;
|
||||||
|
|
||||||
public DismissSpellScreen() {
|
public DismissSpellScreen() {
|
||||||
super(new TranslatableText("gui.unicopia.dismiss_spell"));
|
super(Text.translatable("gui.unicopia.dismiss_spell"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,7 +71,7 @@ public class DismissSpellScreen extends GameGui {
|
||||||
|
|
||||||
matrices.push();
|
matrices.push();
|
||||||
matrices.translate(0, 0, 300);
|
matrices.translate(0, 0, 300);
|
||||||
Text cancel = new LiteralText("Press ESC to cancel");
|
Text cancel = Text.literal("Press ESC to cancel");
|
||||||
getFont().drawWithShadow(matrices, cancel, (width - getFont().getWidth(cancel)) / 2, height - 30, 0xFFFFFFFF);
|
getFont().drawWithShadow(matrices, cancel, (width - getFont().getWidth(cancel)) / 2, height - 30, 0xFFFFFFFF);
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
|
@ -105,18 +104,18 @@ public class DismissSpellScreen extends GameGui {
|
||||||
SphereModel.convertToCartesianCoord(this, radius, azimuth, azimuth);
|
SphereModel.convertToCartesianCoord(this, radius, azimuth, azimuth);
|
||||||
add(0, -(float)radius / 2F, 0, 0);
|
add(0, -(float)radius / 2F, 0, 0);
|
||||||
|
|
||||||
MutableText name = actualSpell.getType().getName().shallowCopy();
|
MutableText name = actualSpell.getType().getName().copy();
|
||||||
int color = actualSpell.getType().getColor();
|
int color = actualSpell.getType().getColor();
|
||||||
name.setStyle(name.getStyle().withColor(color == 0 ? 0xFFAAAAAA : color));
|
name.setStyle(name.getStyle().withColor(color == 0 ? 0xFFAAAAAA : color));
|
||||||
|
|
||||||
tooltip.add(new TranslatableText("Spell Type: %s", name));
|
tooltip.add(Text.translatable("Spell Type: %s", name));
|
||||||
actualSpell.getType().getTraits().appendTooltip(tooltip);
|
actualSpell.getType().getTraits().appendTooltip(tooltip);
|
||||||
tooltip.add(LiteralText.EMPTY);
|
tooltip.add(ScreenTexts.EMPTY);
|
||||||
tooltip.add(new TranslatableText("Affinity: %s", actualSpell.getAffinity().name()).formatted(actualSpell.getAffinity().getColor()));
|
tooltip.add(Text.translatable("Affinity: %s", actualSpell.getAffinity().name()).formatted(actualSpell.getAffinity().getColor()));
|
||||||
tooltip.add(LiteralText.EMPTY);
|
tooltip.add(ScreenTexts.EMPTY);
|
||||||
tooltip.addAll(FlowingText.wrap(new TranslatableText(actualSpell.getType().getTranslationKey() + ".lore").formatted(actualSpell.getAffinity().getColor()), 180).toList());
|
tooltip.addAll(FlowingText.wrap(Text.translatable(actualSpell.getType().getTranslationKey() + ".lore").formatted(actualSpell.getAffinity().getColor()), 180).toList());
|
||||||
tooltip.add(LiteralText.EMPTY);
|
tooltip.add(ScreenTexts.EMPTY);
|
||||||
tooltip.add(new TranslatableText("[Click to Discard]"));
|
tooltip.add(Text.translatable("[Click to Discard]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Spell getActualSpell() {
|
private Spell getActualSpell() {
|
||||||
|
|
|
@ -56,8 +56,7 @@ public class DrawableUtil {
|
||||||
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();
|
||||||
bufferBuilder.end();
|
BufferRenderer.drawWithoutShader(bufferBuilder.end());
|
||||||
BufferRenderer.draw(bufferBuilder);
|
|
||||||
RenderSystem.enableTexture();
|
RenderSystem.enableTexture();
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
}
|
}
|
||||||
|
@ -105,8 +104,7 @@ public class DrawableUtil {
|
||||||
cylendricalVertex(bufferBuilder, model, innerRadius, angle + INCREMENT, r, g, b, k);
|
cylendricalVertex(bufferBuilder, model, innerRadius, angle + INCREMENT, r, g, b, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
bufferBuilder.end();
|
BufferRenderer.drawWithShader(bufferBuilder.end());
|
||||||
BufferRenderer.draw(bufferBuilder);
|
|
||||||
RenderSystem.enableTexture();
|
RenderSystem.enableTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,8 +170,7 @@ public class DrawableUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bufferBuilder.end();
|
BufferRenderer.drawWithShader(bufferBuilder.end());
|
||||||
BufferRenderer.draw(bufferBuilder);
|
|
||||||
RenderSystem.enableTexture();
|
RenderSystem.enableTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.client.gui;
|
package com.minelittlepony.unicopia.client.gui;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
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.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
@ -12,11 +14,9 @@ import net.minecraft.client.render.Tessellator;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.item.ItemRenderer;
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.BaseText;
|
import net.minecraft.text.*;
|
||||||
import net.minecraft.text.CharacterVisitor;
|
|
||||||
import net.minecraft.text.OrderedText;
|
|
||||||
|
|
||||||
public class ItemTraitsTooltipRenderer extends BaseText implements OrderedText, TooltipComponent {
|
public class ItemTraitsTooltipRenderer implements Text, OrderedText, TooltipComponent {
|
||||||
|
|
||||||
private final SpellTraits traits;
|
private final SpellTraits traits;
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ public class ItemTraitsTooltipRenderer extends BaseText implements OrderedText,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseText copy() {
|
public MutableText copy() {
|
||||||
return new ItemTraitsTooltipRenderer(traits);
|
return Text.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderTraitIcon(Trait trait, float value, MatrixStack matrices, int xx, int yy) {
|
public static void renderTraitIcon(Trait trait, float value, MatrixStack matrices, int xx, int yy) {
|
||||||
|
@ -88,4 +88,22 @@ public class ItemTraitsTooltipRenderer extends BaseText implements OrderedText,
|
||||||
immediate.draw();
|
immediate.draw();
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Style getStyle() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextContent getContent() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Text> getSiblings() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.server.integrated.IntegratedServer;
|
import net.minecraft.server.integrated.IntegratedServer;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class LanSettingsScreen extends GameGui {
|
||||||
private boolean forceHideWhitelist;
|
private boolean forceHideWhitelist;
|
||||||
|
|
||||||
public LanSettingsScreen(Screen parent) {
|
public LanSettingsScreen(Screen parent) {
|
||||||
super(new TranslatableText("unicopia.options.title"), parent);
|
super(Text.translatable("unicopia.options.title"), parent);
|
||||||
|
|
||||||
content.margin.setVertical(30);
|
content.margin.setVertical(30);
|
||||||
content.getContentPadding().setHorizontal(10);
|
content.getContentPadding().setHorizontal(10);
|
||||||
|
@ -101,7 +101,7 @@ public class LanSettingsScreen extends GameGui {
|
||||||
|
|
||||||
if (whitelistEnabled) {
|
if (whitelistEnabled) {
|
||||||
|
|
||||||
content.addButton(new Label(LEFT, row += 20)).getStyle().setText(new TranslatableText("unicopia.options.whitelist.details").formatted(Formatting.DARK_GREEN));
|
content.addButton(new Label(LEFT, row += 20)).getStyle().setText(Text.translatable("unicopia.options.whitelist.details").formatted(Formatting.DARK_GREEN));
|
||||||
|
|
||||||
row += 20;
|
row += 20;
|
||||||
WHITELIST_GRID_PACKER.start();
|
WHITELIST_GRID_PACKER.start();
|
||||||
|
|
|
@ -21,7 +21,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.server.integrated.IntegratedServer;
|
import net.minecraft.server.integrated.IntegratedServer;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
|
|
||||||
public class SettingsScreen extends GameGui {
|
public class SettingsScreen extends GameGui {
|
||||||
|
@ -33,7 +32,7 @@ public class SettingsScreen extends GameGui {
|
||||||
private Style mineLpStatus;
|
private Style mineLpStatus;
|
||||||
|
|
||||||
public SettingsScreen(Screen parent) {
|
public SettingsScreen(Screen parent) {
|
||||||
super(new TranslatableText("unicopia.options.title"), parent);
|
super(Text.translatable("unicopia.options.title"), parent);
|
||||||
|
|
||||||
content.margin.setVertical(30);
|
content.margin.setVertical(30);
|
||||||
content.getContentPadding().setHorizontal(10);
|
content.getContentPadding().setHorizontal(10);
|
||||||
|
@ -76,7 +75,7 @@ public class SettingsScreen extends GameGui {
|
||||||
|
|
||||||
content.addButton(new EnumSlider<>(LEFT, row += 25, config.preferredRace.get()))
|
content.addButton(new EnumSlider<>(LEFT, row += 25, config.preferredRace.get()))
|
||||||
.onChange(config.preferredRace::set)
|
.onChange(config.preferredRace::set)
|
||||||
.setTextFormat(v -> new TranslatableText("unicopia.options.preferred_race", v.getValue().getDisplayName()));
|
.setTextFormat(v -> Text.translatable("unicopia.options.preferred_race", v.getValue().getDisplayName()));
|
||||||
|
|
||||||
IntegratedServer server = client.getServer();
|
IntegratedServer server = client.getServer();
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
|
@ -87,7 +86,7 @@ public class SettingsScreen extends GameGui {
|
||||||
|
|
||||||
content.addButton(new EnumSlider<>(LEFT, row += 20, tribes.getDefaultRace()))
|
content.addButton(new EnumSlider<>(LEFT, row += 20, tribes.getDefaultRace()))
|
||||||
.onChange(tribes::setDefaultRace)
|
.onChange(tribes::setDefaultRace)
|
||||||
.setTextFormat(v -> new TranslatableText("unicopia.options.world.default_race", v.getValue().getDisplayName()))
|
.setTextFormat(v -> Text.translatable("unicopia.options.world.default_race", v.getValue().getDisplayName()))
|
||||||
.setEnabled(client.isInSingleplayer());
|
.setEnabled(client.isInSingleplayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,13 +96,13 @@ public class SettingsScreen extends GameGui {
|
||||||
|
|
||||||
if (hasMineLP) {
|
if (hasMineLP) {
|
||||||
if (config.ignoreMineLP.get()) {
|
if (config.ignoreMineLP.get()) {
|
||||||
return new TranslatableText("unicopia.options.ignore_mine_lp.undetected").formatted(Formatting.DARK_GREEN);
|
return Text.translatable("unicopia.options.ignore_mine_lp.undetected").formatted(Formatting.DARK_GREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TranslatableText("unicopia.options.ignore_mine_lp.detected", MineLPConnector.getPlayerPonyRace().getDisplayName()).formatted(Formatting.GREEN);
|
return Text.translatable("unicopia.options.ignore_mine_lp.detected", MineLPConnector.getPlayerPonyRace().getDisplayName()).formatted(Formatting.GREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TranslatableText("unicopia.options.ignore_mine_lp.missing").formatted(Formatting.RED);
|
return Text.translatable("unicopia.options.ignore_mine_lp.missing").formatted(Formatting.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.render.GameRenderer;
|
import net.minecraft.client.render.GameRenderer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public class TribeButton extends Button {
|
public class TribeButton extends Button {
|
||||||
|
@ -54,7 +54,7 @@ public class TribeButton extends Button {
|
||||||
drawTexture(matrices, x - 4, y - 14, 76, 0, 78, 71);
|
drawTexture(matrices, x - 4, y - 14, 76, 0, 78, 71);
|
||||||
|
|
||||||
if (hovered && screenWidth > 0) {
|
if (hovered && screenWidth > 0) {
|
||||||
drawCenteredText(matrices, getFont(), new TranslatableText("gui.unicopia.tribe_selection.describe." + race.name().toLowerCase()), screenWidth / 2, y + height, 0xFFFFFFFF);
|
drawCenteredText(matrices, getFont(), Text.translatable("gui.unicopia.tribe_selection.describe." + race.name().toLowerCase()), screenWidth / 2, y + height, 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import it.unimi.dsi.fastutil.booleans.BooleanConsumer;
|
||||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Language;
|
import net.minecraft.util.Language;
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ public class TribeConfirmationScreen extends GameGui implements HidesHud {
|
||||||
private final BooleanConsumer callback;
|
private final BooleanConsumer callback;
|
||||||
|
|
||||||
public TribeConfirmationScreen(BooleanConsumer callback, Race selection) {
|
public TribeConfirmationScreen(BooleanConsumer callback, Race selection) {
|
||||||
super(new TranslatableText("gui.unicopia.tribe_selection"));
|
super(Text.translatable("gui.unicopia.tribe_selection"));
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.selection = selection;
|
this.selection = selection;
|
||||||
}
|
}
|
||||||
|
@ -35,10 +34,10 @@ public class TribeConfirmationScreen extends GameGui implements HidesHud {
|
||||||
|
|
||||||
int top = (height - columnHeight) / 2;
|
int top = (height - columnHeight) / 2;
|
||||||
|
|
||||||
addDrawableChild(new ButtonWidget(width / 2 + 5, top + columnHeight + padding, 100, 20, new TranslatableText("Join Tribe"), b -> callback.accept(true)));
|
addDrawableChild(new ButtonWidget(width / 2 + 5, top + columnHeight + padding, 100, 20, Text.translatable("Join Tribe"), b -> callback.accept(true)));
|
||||||
addDrawableChild(new ButtonWidget(width / 2 - 105, top + columnHeight + padding, 100, 20, new TranslatableText("Go Back"), b -> callback.accept(false)));
|
addDrawableChild(new ButtonWidget(width / 2 - 105, top + columnHeight + padding, 100, 20, Text.translatable("Go Back"), b -> callback.accept(false)));
|
||||||
|
|
||||||
addDrawable(new Label(width / 2, top - 30).setCentered()).getStyle().setText(new TranslatableText("gui.unicopia.tribe_selection.confirm", selection.getDisplayName().shallowCopy().formatted(Formatting.YELLOW)));
|
addDrawable(new Label(width / 2, top - 30).setCentered()).getStyle().setText(Text.translatable("gui.unicopia.tribe_selection.confirm", selection.getDisplayName().copy().formatted(Formatting.YELLOW)));
|
||||||
|
|
||||||
addDrawable(new TribeButton((width - 70) / 2, top, 0, selection));
|
addDrawable(new TribeButton((width - 70) / 2, top, 0, selection));
|
||||||
|
|
||||||
|
@ -46,9 +45,9 @@ public class TribeConfirmationScreen extends GameGui implements HidesHud {
|
||||||
|
|
||||||
int left = (width - columnWidth) / 2 + padding;
|
int left = (width - columnWidth) / 2 + padding;
|
||||||
|
|
||||||
Text race = selection.getAltDisplayName().shallowCopy().formatted(Formatting.YELLOW);
|
Text race = selection.getAltDisplayName().copy().formatted(Formatting.YELLOW);
|
||||||
|
|
||||||
addDrawable(new Label(left - 3, top += 10)).getStyle().setText(new TranslatableText("gui.unicopia.tribe_selection.confirm.goods", race).formatted(Formatting.YELLOW));
|
addDrawable(new Label(left - 3, top += 10)).getStyle().setText(Text.translatable("gui.unicopia.tribe_selection.confirm.goods", race).formatted(Formatting.YELLOW));
|
||||||
|
|
||||||
top += 15;
|
top += 15;
|
||||||
|
|
||||||
|
@ -58,12 +57,12 @@ public class TribeConfirmationScreen extends GameGui implements HidesHud {
|
||||||
String key = String.format("gui.unicopia.tribe_selection.confirm.goods.%d.%s", i, selection.name().toLowerCase());
|
String key = String.format("gui.unicopia.tribe_selection.confirm.goods.%d.%s", i, selection.name().toLowerCase());
|
||||||
if (Language.getInstance().hasTranslation(key)) {
|
if (Language.getInstance().hasTranslation(key)) {
|
||||||
TextBlock block = addDrawable(new TextBlock(left, top, maxWidth));
|
TextBlock block = addDrawable(new TextBlock(left, top, maxWidth));
|
||||||
block.getStyle().setText(new TranslatableText(key));
|
block.getStyle().setText(Text.translatable(key));
|
||||||
top += block.getBounds().height;
|
top += block.getBounds().height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addDrawable(new Label(left - 3, top += 5)).getStyle().setText(new TranslatableText("gui.unicopia.tribe_selection.confirm.bads", race).formatted(Formatting.YELLOW));
|
addDrawable(new Label(left - 3, top += 5)).getStyle().setText(Text.translatable("gui.unicopia.tribe_selection.confirm.bads", race).formatted(Formatting.YELLOW));
|
||||||
|
|
||||||
top += 15;
|
top += 15;
|
||||||
|
|
||||||
|
@ -71,7 +70,7 @@ public class TribeConfirmationScreen extends GameGui implements HidesHud {
|
||||||
String key = String.format("gui.unicopia.tribe_selection.confirm.bads.%d.%s", i, selection.name().toLowerCase());
|
String key = String.format("gui.unicopia.tribe_selection.confirm.bads.%d.%s", i, selection.name().toLowerCase());
|
||||||
if (Language.getInstance().hasTranslation(key)) {
|
if (Language.getInstance().hasTranslation(key)) {
|
||||||
TextBlock block = addDrawable(new TextBlock(left, top, maxWidth));
|
TextBlock block = addDrawable(new TextBlock(left, top, maxWidth));
|
||||||
block.getStyle().setText(new TranslatableText(key));
|
block.getStyle().setText(Text.translatable(key));
|
||||||
top += block.getBounds().height;
|
top += block.getBounds().height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.minelittlepony.unicopia.network.Channel;
|
||||||
import com.minelittlepony.unicopia.network.MsgRequestSpeciesChange;
|
import com.minelittlepony.unicopia.network.MsgRequestSpeciesChange;
|
||||||
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public class TribeSelectionScreen extends GameGui implements HidesHud {
|
||||||
private boolean finished;
|
private boolean finished;
|
||||||
|
|
||||||
public TribeSelectionScreen(Set<Race> allowedRaces) {
|
public TribeSelectionScreen(Set<Race> allowedRaces) {
|
||||||
super(new TranslatableText("gui.unicopia.tribe_selection"));
|
super(Text.translatable("gui.unicopia.tribe_selection"));
|
||||||
this.allowedRaces = allowedRaces;
|
this.allowedRaces = allowedRaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,16 +35,16 @@ public class TribeSelectionScreen extends GameGui implements HidesHud {
|
||||||
|
|
||||||
int top = 0;
|
int top = 0;
|
||||||
|
|
||||||
addDrawable(new Label(width / 2, top += 20).setCentered()).getStyle().setText(getTitle().shallowCopy().formatted(Formatting.YELLOW));
|
addDrawable(new Label(width / 2, top += 20).setCentered()).getStyle().setText(getTitle().copy().formatted(Formatting.YELLOW));
|
||||||
|
|
||||||
top += height / 8;
|
top += height / 8;
|
||||||
|
|
||||||
TextBlock block = addDrawable(new TextBlock(left, top += 10, pageWidth));
|
TextBlock block = addDrawable(new TextBlock(left, top += 10, pageWidth));
|
||||||
block.getStyle().setText(new TranslatableText("gui.unicopia.tribe_selection.welcome.journey"));
|
block.getStyle().setText(Text.translatable("gui.unicopia.tribe_selection.welcome.journey"));
|
||||||
top += block.getBounds().height;
|
top += block.getBounds().height;
|
||||||
|
|
||||||
block = addDrawable(new TextBlock(left, top += 7, pageWidth));
|
block = addDrawable(new TextBlock(left, top += 7, pageWidth));
|
||||||
block.getStyle().setText(new TranslatableText("gui.unicopia.tribe_selection.welcome.choice"));
|
block.getStyle().setText(Text.translatable("gui.unicopia.tribe_selection.welcome.choice"));
|
||||||
top += block.getBounds().height;
|
top += block.getBounds().height;
|
||||||
|
|
||||||
Race preference = UnicopiaClient.getPreferredRace();
|
Race preference = UnicopiaClient.getPreferredRace();
|
||||||
|
@ -67,7 +67,7 @@ public class TribeSelectionScreen extends GameGui implements HidesHud {
|
||||||
top = height - 20;
|
top = height - 20;
|
||||||
|
|
||||||
if (!preference.isDefault()) {
|
if (!preference.isDefault()) {
|
||||||
addDrawable(new Label(width / 2, top).setCentered()).getStyle().setText(new TranslatableText("gui.unicopia.tribe_selection.preference", preference.getDisplayName().shallowCopy().formatted(Formatting.YELLOW)));
|
addDrawable(new Label(width / 2, top).setCentered()).getStyle().setText(Text.translatable("gui.unicopia.tribe_selection.preference", preference.getDisplayName().copy().formatted(Formatting.YELLOW)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.unicopia.client.gui;
|
package com.minelittlepony.unicopia.client.gui;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
@ -35,6 +34,7 @@ import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Quaternion;
|
import net.minecraft.util.math.Quaternion;
|
||||||
import net.minecraft.util.math.Vec3f;
|
import net.minecraft.util.math.Vec3f;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
public class UHud extends DrawableHelper {
|
public class UHud extends DrawableHelper {
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ public class UHud extends DrawableHelper {
|
||||||
client.getSoundManager().play(
|
client.getSoundManager().play(
|
||||||
heartbeatSound = new LoopingSoundInstance<>(client.player, player -> {
|
heartbeatSound = new LoopingSoundInstance<>(client.player, player -> {
|
||||||
return Pony.of(player).getMagicalReserves().getExhaustion().getPercentFill() > 0.5F;
|
return Pony.of(player).getMagicalReserves().getExhaustion().getPercentFill() > 0.5F;
|
||||||
}, USounds.ENTITY_PLAYER_HEARTBEAT, 1, 1)
|
}, USounds.ENTITY_PLAYER_HEARTBEAT, 1, 1, client.world.random)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,9 @@ public class LightningBoltParticle extends AbstractGeometryBasedParticle {
|
||||||
|
|
||||||
while (nodes.size() < intendedLength) {
|
while (nodes.size() < intendedLength) {
|
||||||
startPos = startPos.add(
|
startPos = startPos.add(
|
||||||
0.1 + world.random.nextDouble(6) - 3,
|
world.random.nextTriangular(0.1, 3),
|
||||||
0.1 + world.random.nextDouble(6) - 3,
|
world.random.nextTriangular(0.1, 3),
|
||||||
0.1 + world.random.nextDouble(6) - 3
|
world.random.nextTriangular(0.1, 3)
|
||||||
);
|
);
|
||||||
|
|
||||||
nodes.add(startPos);
|
nodes.add(startPos);
|
||||||
|
|
|
@ -15,6 +15,8 @@ import net.minecraft.util.math.Vector4f;
|
||||||
public class SphereModel {
|
public class SphereModel {
|
||||||
public static final SphereModel SPHERE = new SphereModel(40, 40, DrawableUtil.TAU);
|
public static final SphereModel SPHERE = new SphereModel(40, 40, DrawableUtil.TAU);
|
||||||
public static final SphereModel DISK = new SphereModel(40, 2, DrawableUtil.PI);
|
public static final SphereModel DISK = new SphereModel(40, 2, DrawableUtil.PI);
|
||||||
|
public static final SphereModel HEXAGON = new SphereModel(3, 2, DrawableUtil.TAU);
|
||||||
|
public static final SphereModel PRISM = new SphereModel(6, 6, DrawableUtil.TAU);
|
||||||
|
|
||||||
private final List<Vector4f> vertices = new ArrayList<>();
|
private final List<Vector4f> vertices = new ArrayList<>();
|
||||||
private final Vector4f drawVert = new Vector4f();
|
private final Vector4f drawVert = new Vector4f();
|
||||||
|
@ -40,8 +42,8 @@ public class SphereModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void compileVertices(double azimuthRange, double zenithIncrement, double azimuthIncrement, Consumer<Vector4f> collector) {
|
private static void compileVertices(double azimuthRange, double zenithIncrement, double azimuthIncrement, Consumer<Vector4f> collector) {
|
||||||
for (double zenith = -DrawableUtil.PI; zenith < DrawableUtil.PI; zenith += zenithIncrement) {
|
for (double zenith = 0; zenith < DrawableUtil.PI; zenith += zenithIncrement) {
|
||||||
for (double azimuth = -azimuthRange; azimuth < azimuthRange; azimuth += azimuthIncrement) {
|
for (double azimuth = 0; azimuth < azimuthRange; azimuth += azimuthIncrement) {
|
||||||
collector.accept(convertToCartesianCoord(new Vector4f(), 1, zenith, azimuth));
|
collector.accept(convertToCartesianCoord(new Vector4f(), 1, zenith, azimuth));
|
||||||
collector.accept(convertToCartesianCoord(new Vector4f(), 1, zenith + zenithIncrement, azimuth));
|
collector.accept(convertToCartesianCoord(new Vector4f(), 1, zenith + zenithIncrement, azimuth));
|
||||||
collector.accept(convertToCartesianCoord(new Vector4f(), 1, zenith + zenithIncrement, azimuth + azimuthIncrement));
|
collector.accept(convertToCartesianCoord(new Vector4f(), 1, zenith + zenithIncrement, azimuth + azimuthIncrement));
|
||||||
|
|
|
@ -22,6 +22,6 @@ public class IcarusWingsFeatureRenderer<E extends LivingEntity> extends WingsFea
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Identifier getTexture(E entity) {
|
protected Identifier getTexture(E entity) {
|
||||||
return entity.world.getDimension().isUltrawarm() ? ICARUS_WINGS_CORRUPTED : ICARUS_WINGS;
|
return entity.world.getDimension().ultrawarm() ? ICARUS_WINGS_CORRUPTED : ICARUS_WINGS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.client.sound.MovingSoundInstance;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
public abstract class FadeOutSoundInstance extends MovingSoundInstance {
|
public abstract class FadeOutSoundInstance extends MovingSoundInstance {
|
||||||
|
|
||||||
|
@ -19,8 +20,8 @@ public abstract class FadeOutSoundInstance extends MovingSoundInstance {
|
||||||
|
|
||||||
private boolean fadingOut;
|
private boolean fadingOut;
|
||||||
|
|
||||||
public FadeOutSoundInstance(SoundEvent sound, SoundCategory category, float volume) {
|
public FadeOutSoundInstance(SoundEvent sound, SoundCategory category, float volume, Random random) {
|
||||||
super(sound, category);
|
super(sound, category, random);
|
||||||
this.relative = true;
|
this.relative = true;
|
||||||
this.repeat = true;
|
this.repeat = true;
|
||||||
this.volume = volume;
|
this.volume = volume;
|
||||||
|
@ -71,6 +72,6 @@ public abstract class FadeOutSoundInstance extends MovingSoundInstance {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final float getVolume() {
|
public final float getVolume() {
|
||||||
return getLerpedVolume() * sound.getVolume();
|
return getLerpedVolume() * sound.getVolume().get(field_38800);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
|
|
||||||
public class LoopedEntityTrackingSoundInstance extends EntityTrackingSoundInstance {
|
public class LoopedEntityTrackingSoundInstance extends EntityTrackingSoundInstance {
|
||||||
public LoopedEntityTrackingSoundInstance(SoundEvent soundEvent, float volume, float pitch, Entity entity) {
|
public LoopedEntityTrackingSoundInstance(SoundEvent soundEvent, float volume, float pitch, Entity entity, long seed) {
|
||||||
super(soundEvent, entity.getSoundCategory(), volume, pitch, entity);
|
super(soundEvent, entity.getSoundCategory(), volume, pitch, entity, seed);
|
||||||
this.repeat = true;
|
this.repeat = true;
|
||||||
this.repeatDelay = 0;
|
this.repeatDelay = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.function.Predicate;
|
||||||
import net.minecraft.client.sound.SoundInstance;
|
import net.minecraft.client.sound.SoundInstance;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
public class LoopingSoundInstance<T extends Entity> extends FadeOutSoundInstance {
|
public class LoopingSoundInstance<T extends Entity> extends FadeOutSoundInstance {
|
||||||
|
|
||||||
|
@ -12,8 +13,8 @@ public class LoopingSoundInstance<T extends Entity> extends FadeOutSoundInstance
|
||||||
|
|
||||||
private final Predicate<T> shouldPlay;
|
private final Predicate<T> shouldPlay;
|
||||||
|
|
||||||
public LoopingSoundInstance(T source, Predicate<T> shouldPlay, SoundEvent soundEvent, float volume, float pitch) {
|
public LoopingSoundInstance(T source, Predicate<T> shouldPlay, SoundEvent soundEvent, float volume, float pitch, Random random) {
|
||||||
super(soundEvent, source.getSoundCategory(), volume);
|
super(soundEvent, source.getSoundCategory(), volume, random);
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.shouldPlay = shouldPlay;
|
this.shouldPlay = shouldPlay;
|
||||||
this.pitch = pitch;
|
this.pitch = pitch;
|
||||||
|
|
|
@ -9,13 +9,14 @@ import com.minelittlepony.unicopia.item.enchantment.UEnchantments;
|
||||||
|
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
public class MagicAuraSoundInstance extends FadeOutSoundInstance {
|
public class MagicAuraSoundInstance extends FadeOutSoundInstance {
|
||||||
|
|
||||||
private final Living<?> living;
|
private final Living<?> living;
|
||||||
|
|
||||||
public MagicAuraSoundInstance(SoundCategory category, Living<?> living) {
|
public MagicAuraSoundInstance(SoundCategory category, Living<?> living, Random random) {
|
||||||
super(USounds.ITEM_MAGIC_AURA, category, 1);
|
super(USounds.ITEM_MAGIC_AURA, category, 1, random);
|
||||||
this.living = living;
|
this.living = living;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
public class MotionBasedSoundInstance extends FadeOutSoundInstance {
|
public class MotionBasedSoundInstance extends FadeOutSoundInstance {
|
||||||
|
|
||||||
|
@ -12,8 +13,8 @@ public class MotionBasedSoundInstance extends FadeOutSoundInstance {
|
||||||
|
|
||||||
private int tickCount;
|
private int tickCount;
|
||||||
|
|
||||||
public MotionBasedSoundInstance(SoundEvent sound, PlayerEntity player) {
|
public MotionBasedSoundInstance(SoundEvent sound, PlayerEntity player, Random random) {
|
||||||
super(sound, player.getSoundCategory(), 0.1F);
|
super(sound, player.getSoundCategory(), 0.1F, random);
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
package com.minelittlepony.unicopia.command;
|
package com.minelittlepony.unicopia.command;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||||
|
import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.command.argument.ArgumentTypes;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class Commands {
|
public class Commands {
|
||||||
@SuppressWarnings({ "deprecation", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "deprecation", "unchecked", "rawtypes" })
|
||||||
public static void bootstrap() {
|
public static void bootstrap() {
|
||||||
ArgumentTypes.register("unicopia:enumeration", EnumArgumentType.class, new EnumArgumentType.Serializer());
|
ArgumentTypeRegistry.registerArgumentType(new Identifier("unicopia", "enumeration"), EnumArgumentType.class, new EnumArgumentType.Serializer());
|
||||||
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
|
CommandRegistrationCallback.EVENT.register((dispatcher, access, environment) -> {
|
||||||
SpeciesCommand.register(dispatcher);
|
SpeciesCommand.register(dispatcher);
|
||||||
RacelistCommand.register(dispatcher);
|
RacelistCommand.register(dispatcher);
|
||||||
GravityCommand.register(dispatcher);
|
GravityCommand.register(dispatcher);
|
||||||
|
|
|
@ -26,13 +26,12 @@ import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.Util;
|
|
||||||
import net.minecraft.world.GameRules;
|
import net.minecraft.world.GameRules;
|
||||||
|
|
||||||
public class DisguiseCommand {
|
public class DisguiseCommand {
|
||||||
private static final SimpleCommandExceptionType FAILED_EXCEPTION = new SimpleCommandExceptionType(new TranslatableText("commands.disguise.notfound"));
|
private static final SimpleCommandExceptionType FAILED_EXCEPTION = new SimpleCommandExceptionType(Text.translatable("commands.disguise.notfound"));
|
||||||
|
|
||||||
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
|
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
|
||||||
dispatcher.register(CommandManager
|
dispatcher.register(CommandManager
|
||||||
|
@ -88,13 +87,13 @@ public class DisguiseCommand {
|
||||||
.setDisguise(entity);
|
.setDisguise(entity);
|
||||||
|
|
||||||
if (source.getEntity() == player) {
|
if (source.getEntity() == player) {
|
||||||
source.sendFeedback(new TranslatableText("commands.disguise.success.self", entity.getName()), true);
|
source.sendFeedback(Text.translatable("commands.disguise.success.self", entity.getName()), true);
|
||||||
} else {
|
} else {
|
||||||
if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
||||||
player.sendSystemMessage(new TranslatableText("commands.disguise.success", entity.getName()), Util.NIL_UUID);
|
player.sendMessage(Text.translatable("commands.disguise.success", entity.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
source.sendFeedback(new TranslatableText("commands.disguise.success.other", player.getName(), entity.getName()), true);
|
source.sendFeedback(Text.translatable("commands.disguise.success.other", player.getName(), entity.getName()), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -115,13 +114,13 @@ public class DisguiseCommand {
|
||||||
iplayer.getSpellSlot().removeIf(SpellPredicate.IS_DISGUISE, true);
|
iplayer.getSpellSlot().removeIf(SpellPredicate.IS_DISGUISE, true);
|
||||||
|
|
||||||
if (source.getEntity() == player) {
|
if (source.getEntity() == player) {
|
||||||
source.sendFeedback(new TranslatableText("commands.disguise.removed.self"), true);
|
source.sendFeedback(Text.translatable("commands.disguise.removed.self"), true);
|
||||||
} else {
|
} else {
|
||||||
if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
||||||
player.sendSystemMessage(new TranslatableText("commands.disguise.removed"), Util.NIL_UUID);
|
player.sendMessage(Text.translatable("commands.disguise.removed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
source.sendFeedback(new TranslatableText("commands.disguise.removed.other", player.getName()), true);
|
source.sendFeedback(Text.translatable("commands.disguise.removed.other", player.getName()), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -21,7 +21,9 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBufInputStream;
|
import io.netty.buffer.ByteBufInputStream;
|
||||||
import io.netty.buffer.ByteBufOutputStream;
|
import io.netty.buffer.ByteBufOutputStream;
|
||||||
|
import net.minecraft.command.CommandRegistryAccess;
|
||||||
import net.minecraft.command.argument.serialize.ArgumentSerializer;
|
import net.minecraft.command.argument.serialize.ArgumentSerializer;
|
||||||
|
import net.minecraft.command.argument.serialize.ArgumentSerializer.ArgumentTypeProperties;
|
||||||
import net.minecraft.network.PacketByteBuf;
|
import net.minecraft.network.PacketByteBuf;
|
||||||
|
|
||||||
class EnumArgumentType<T extends Enum<T>> implements ArgumentType<T>, Serializable {
|
class EnumArgumentType<T extends Enum<T>> implements ArgumentType<T>, Serializable {
|
||||||
|
@ -100,27 +102,52 @@ class EnumArgumentType<T extends Enum<T>> implements ArgumentType<T>, Serializab
|
||||||
return suggestions;
|
return suggestions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer<T extends Enum<T>> implements ArgumentSerializer<EnumArgumentType<T>> {
|
public static class Serializer<T extends Enum<T>> implements ArgumentSerializer<EnumArgumentType<T>, Serializer<T>.Properties> {
|
||||||
@Override
|
|
||||||
public void toPacket(EnumArgumentType<T> type, PacketByteBuf buf) {
|
|
||||||
try (ObjectOutputStream stream = new ObjectOutputStream(new ByteBufOutputStream(buf))) {
|
|
||||||
stream.writeObject(type);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public EnumArgumentType<T> fromPacket(PacketByteBuf buf) {
|
public Properties fromPacket(PacketByteBuf buf) {
|
||||||
try (ObjectInputStream stream = new ObjectInputStream(new ByteBufInputStream(buf))) {
|
try (ObjectInputStream stream = new ObjectInputStream(new ByteBufInputStream(buf))) {
|
||||||
return (EnumArgumentType<T>)stream.readObject();
|
return getArgumentTypeProperties((EnumArgumentType<T>)stream.readObject());
|
||||||
} catch (IOException | ClassNotFoundException e) {
|
} catch (IOException | ClassNotFoundException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toJson(EnumArgumentType<T> type, JsonObject json) { }
|
public void writePacket(Properties properties, PacketByteBuf buf) {
|
||||||
|
try (ObjectOutputStream stream = new ObjectOutputStream(new ByteBufOutputStream(buf))) {
|
||||||
|
stream.writeObject(properties.type);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeJson(Properties properties, JsonObject json) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Properties getArgumentTypeProperties(EnumArgumentType<T> type) {
|
||||||
|
return new Properties(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class Properties implements ArgumentTypeProperties<EnumArgumentType<T>> {
|
||||||
|
|
||||||
|
private final EnumArgumentType<T> type;
|
||||||
|
|
||||||
|
public Properties(EnumArgumentType<T> type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumArgumentType<T> createType(CommandRegistryAccess var1) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArgumentSerializer<EnumArgumentType<T>, ?> getSerializer() {
|
||||||
|
return Serializer.this;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,8 +10,7 @@ import net.minecraft.command.argument.EntityArgumentType;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Util;
|
|
||||||
import net.minecraft.world.GameRules;
|
import net.minecraft.world.GameRules;
|
||||||
|
|
||||||
class GravityCommand {
|
class GravityCommand {
|
||||||
|
@ -44,9 +43,9 @@ class GravityCommand {
|
||||||
float gravity = iplayer.getPhysics().getGravityModifier();
|
float gravity = iplayer.getPhysics().getGravityModifier();
|
||||||
|
|
||||||
if (source.getPlayer() == player) {
|
if (source.getPlayer() == player) {
|
||||||
player.sendMessage(new TranslatableText(translationKey, gravity), false);
|
player.sendMessage(Text.translatable(translationKey, gravity), false);
|
||||||
} else {
|
} else {
|
||||||
source.sendFeedback(new TranslatableText(translationKey + ".other", player.getName(), gravity), true);
|
source.sendFeedback(Text.translatable(translationKey + ".other", player.getName(), gravity), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -61,13 +60,13 @@ class GravityCommand {
|
||||||
iplayer.setDirty();
|
iplayer.setDirty();
|
||||||
|
|
||||||
if (source.getEntity() == player) {
|
if (source.getEntity() == player) {
|
||||||
source.sendFeedback(new TranslatableText("commands.gamemode.success.self", gravity), true);
|
source.sendFeedback(Text.translatable("commands.gamemode.success.self", gravity), true);
|
||||||
} else {
|
} else {
|
||||||
if (source.getWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
if (source.getWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
||||||
player.sendSystemMessage(new TranslatableText(translationKey, gravity), Util.NIL_UUID);
|
player.sendMessage(Text.translatable(translationKey, gravity));
|
||||||
}
|
}
|
||||||
|
|
||||||
source.sendFeedback(new TranslatableText(translationKey + ".other", player.getName(), gravity), true);
|
source.sendFeedback(Text.translatable(translationKey + ".other", player.getName(), gravity), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
|
|
||||||
class RacelistCommand {
|
class RacelistCommand {
|
||||||
|
@ -52,9 +51,9 @@ class RacelistCommand {
|
||||||
translationKey += ".failed";
|
translationKey += ".failed";
|
||||||
}
|
}
|
||||||
|
|
||||||
Text formattedName = new TranslatableText(race.name().toLowerCase()).formatted(Formatting.GOLD);
|
Text formattedName = Text.translatable(race.name().toLowerCase()).formatted(Formatting.GOLD);
|
||||||
|
|
||||||
source.sendFeedback(new TranslatableText(translationKey, formattedName).formatted(Formatting.GREEN), false);
|
source.sendFeedback(Text.translatable(translationKey, formattedName).formatted(Formatting.GREEN), false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,8 @@ import net.minecraft.command.argument.EntityArgumentType;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.text.LiteralText;
|
|
||||||
import net.minecraft.text.MutableText;
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.world.GameRules;
|
import net.minecraft.world.GameRules;
|
||||||
|
|
||||||
|
@ -54,18 +52,18 @@ class SpeciesCommand {
|
||||||
pony.setSpecies(race);
|
pony.setSpecies(race);
|
||||||
pony.setDirty();
|
pony.setDirty();
|
||||||
|
|
||||||
Text formattedName = new TranslatableText(race.name().toLowerCase());
|
Text formattedName = Text.translatable(race.name().toLowerCase());
|
||||||
|
|
||||||
if (!isSelf) {
|
if (!isSelf) {
|
||||||
source.sendFeedback(new TranslatableText("commands.race.success.other", player.getName(), formattedName), true);
|
source.sendFeedback(Text.translatable("commands.race.success.other", player.getName(), formattedName), true);
|
||||||
} else {
|
} else {
|
||||||
if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
||||||
player.sendMessage(new TranslatableText("commands.race.success.self"), false);
|
player.sendMessage(Text.translatable("commands.race.success.self"), false);
|
||||||
}
|
}
|
||||||
source.sendFeedback(new TranslatableText("commands.race.success.otherself", player.getName(), formattedName), true);
|
source.sendFeedback(Text.translatable("commands.race.success.otherself", player.getName(), formattedName), true);
|
||||||
}
|
}
|
||||||
} else if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
} else if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
||||||
player.sendMessage(new TranslatableText("commands.race.permission"), false);
|
player.sendMessage(Text.translatable("commands.race.permission"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -77,22 +75,22 @@ class SpeciesCommand {
|
||||||
String name = "commands.race.tell.";
|
String name = "commands.race.tell.";
|
||||||
name += isSelf ? "self" : "other";
|
name += isSelf ? "self" : "other";
|
||||||
|
|
||||||
player.sendMessage(new TranslatableText(name)
|
player.sendMessage(Text.translatable(name)
|
||||||
.append(new TranslatableText(spec.getTranslationKey())
|
.append(Text.translatable(spec.getTranslationKey())
|
||||||
.styled(s -> s.withColor(Formatting.GOLD))), false);
|
.styled(s -> s.withColor(Formatting.GOLD))), false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int list(PlayerEntity player) {
|
static int list(PlayerEntity player) {
|
||||||
player.sendMessage(new TranslatableText("commands.race.list"), false);
|
player.sendMessage(Text.translatable("commands.race.list"), false);
|
||||||
|
|
||||||
MutableText message = new LiteralText("");
|
MutableText message = Text.literal("");
|
||||||
|
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (Race i : Race.values()) {
|
for (Race i : Race.values()) {
|
||||||
if (!i.isDefault() && i.isPermitted(player)) {
|
if (!i.isDefault() && i.isPermitted(player)) {
|
||||||
message.append(new TranslatableText((!first ? "\n" : "") + " - " + i.name().toLowerCase()));
|
message.append(Text.translatable((!first ? "\n" : "") + " - " + i.name().toLowerCase()));
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,9 +103,9 @@ class SpeciesCommand {
|
||||||
static int describe(PlayerEntity player, Race species) {
|
static int describe(PlayerEntity player, Race species) {
|
||||||
String name = species.name().toLowerCase();
|
String name = species.name().toLowerCase();
|
||||||
|
|
||||||
player.sendMessage(new TranslatableText(String.format("commands.race.describe.%s.1", name)).styled(s -> s.withColor(Formatting.YELLOW)), false);
|
player.sendMessage(Text.translatable(String.format("commands.race.describe.%s.1", name)).styled(s -> s.withColor(Formatting.YELLOW)), false);
|
||||||
player.sendMessage(new TranslatableText(String.format("commands.race.describe.%s.2", name)), false);
|
player.sendMessage(Text.translatable(String.format("commands.race.describe.%s.2", name)), false);
|
||||||
player.sendMessage(new TranslatableText(String.format("commands.race.describe.%s.3", name)).styled(s -> s.withColor(Formatting.RED)), false);
|
player.sendMessage(Text.translatable(String.format("commands.race.describe.%s.3", name)).styled(s -> s.withColor(Formatting.RED)), false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.*;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
|
|
||||||
class TraitCommand {
|
class TraitCommand {
|
||||||
|
@ -44,13 +43,13 @@ class TraitCommand {
|
||||||
|
|
||||||
static int add(ServerCommandSource source, PlayerEntity player, Trait trait, float amount) throws CommandSyntaxException {
|
static int add(ServerCommandSource source, PlayerEntity player, Trait trait, float amount) throws CommandSyntaxException {
|
||||||
if (trait == null) {
|
if (trait == null) {
|
||||||
source.sendError(new LiteralText("Invalid trait"));
|
source.sendError(Text.literal("Invalid trait"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandStack();
|
ItemStack stack = player.getMainHandStack();
|
||||||
if (stack.isEmpty()) {
|
if (stack.isEmpty()) {
|
||||||
source.sendError(new LiteralText("That trait cannot be added to the current item"));
|
source.sendError(Text.literal("That trait cannot be added to the current item"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ class TraitCommand {
|
||||||
|
|
||||||
static int remove(ServerCommandSource source, PlayerEntity player, Trait trait) throws CommandSyntaxException {
|
static int remove(ServerCommandSource source, PlayerEntity player, Trait trait) throws CommandSyntaxException {
|
||||||
if (trait == null) {
|
if (trait == null) {
|
||||||
source.sendError(new LiteralText("Invalid trait"));
|
source.sendError(Text.literal("Invalid trait"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,9 +84,9 @@ class TraitCommand {
|
||||||
float gravity = iplayer.getPhysics().getGravityModifier();
|
float gravity = iplayer.getPhysics().getGravityModifier();
|
||||||
|
|
||||||
if (source.getPlayer() == player) {
|
if (source.getPlayer() == player) {
|
||||||
player.sendMessage(new TranslatableText(translationKey, gravity), false);
|
player.sendMessage(Text.translatable(translationKey, gravity), false);
|
||||||
} else {
|
} else {
|
||||||
source.sendFeedback(new TranslatableText(translationKey + ".other", player.getName(), gravity), true);
|
source.sendFeedback(Text.translatable(translationKey + ".other", player.getName(), gravity), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.unicopia.container;
|
package com.minelittlepony.unicopia.container;
|
||||||
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public enum SpellbookPage {
|
public enum SpellbookPage {
|
||||||
|
@ -12,7 +11,7 @@ public enum SpellbookPage {
|
||||||
public static final SpellbookPage[] VALUES = values();
|
public static final SpellbookPage[] VALUES = values();
|
||||||
private static int current;
|
private static int current;
|
||||||
|
|
||||||
private final Text label = new TranslatableText("gui.unicopia.spellbook.page." + name().toLowerCase());
|
private final Text label = Text.translatable("gui.unicopia.spellbook.page." + name().toLowerCase());
|
||||||
|
|
||||||
public Text getLabel() {
|
public Text getLabel() {
|
||||||
return label;
|
return label;
|
||||||
|
|
|
@ -23,7 +23,6 @@ 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;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> implements RecipeBookProvider {
|
public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> implements RecipeBookProvider {
|
||||||
|
@ -156,7 +155,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
||||||
textRenderer.draw(matrices, title, titleX, titleY, 4210752);
|
textRenderer.draw(matrices, title, titleX, titleY, 4210752);
|
||||||
textRenderer.draw(matrices, SpellbookPage.getCurrent().getLabel(), 220, this.titleY, 4210752);
|
textRenderer.draw(matrices, SpellbookPage.getCurrent().getLabel(), 220, this.titleY, 4210752);
|
||||||
|
|
||||||
Text pageText = new TranslatableText("%s/%s", SpellbookPage.getCurrent().ordinal() + 1, SpellbookPage.VALUES.length);
|
Text pageText = Text.translatable("%s/%s", SpellbookPage.getCurrent().ordinal() + 1, SpellbookPage.VALUES.length);
|
||||||
textRenderer.draw(matrices, pageText,
|
textRenderer.draw(matrices, pageText,
|
||||||
x + 325 - textRenderer.getWidth(pageText) / 2F, y + 188 - textRenderer.fontHeight, 4210752);
|
x + 325 - textRenderer.getWidth(pageText) / 2F, y + 188 - textRenderer.fontHeight, 4210752);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
package com.minelittlepony.unicopia.container;
|
package com.minelittlepony.unicopia.container;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
|
|
||||||
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry.SimpleClientHandlerFactory;
|
|
||||||
import net.minecraft.screen.ScreenHandler;
|
import net.minecraft.screen.ScreenHandler;
|
||||||
import net.minecraft.screen.ScreenHandlerType;
|
import net.minecraft.screen.ScreenHandlerType;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
public interface UScreenHandlers {
|
public interface UScreenHandlers {
|
||||||
ScreenHandlerType<SpellbookScreenHandler> SPELL_BOOK = register("spell_book", SpellbookScreenHandler::new);
|
ScreenHandlerType<SpellbookScreenHandler> SPELL_BOOK = register("spell_book", SpellbookScreenHandler::new);
|
||||||
|
|
||||||
static <T extends ScreenHandler> ScreenHandlerType<T> register(String name, SimpleClientHandlerFactory<T> factory) {
|
static <T extends ScreenHandler> ScreenHandlerType<T> register(String name, ScreenHandlerType.Factory<T> factory) {
|
||||||
return ScreenHandlerRegistry.registerSimple(new Identifier("unicopia", name), factory);
|
return Registry.register(Registry.SCREEN_HANDLER, new Identifier("unicopia", name), new ScreenHandlerType<>(factory));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bootstrap() { }
|
static void bootstrap() { }
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.minelittlepony.unicopia.entity;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
@ -31,6 +30,7 @@ import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
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.util.math.random.Random;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldAccess;
|
import net.minecraft.world.WorldAccess;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ 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;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class CastSpellEntity extends LightEmittingEntity implements Caster<LivingEntity>, WeaklyOwned<LivingEntity> {
|
public class CastSpellEntity extends LightEmittingEntity implements Caster<LivingEntity>, WeaklyOwned<LivingEntity> {
|
||||||
|
@ -54,7 +53,7 @@ public class CastSpellEntity extends LightEmittingEntity implements Caster<Livin
|
||||||
public Text getName() {
|
public Text getName() {
|
||||||
Entity master = getMaster();
|
Entity master = getMaster();
|
||||||
if (master != null) {
|
if (master != null) {
|
||||||
return new TranslatableText("entity.unicopia.cast_spell.by", master.getName());
|
return Text.translatable("entity.unicopia.cast_spell.by", master.getName());
|
||||||
}
|
}
|
||||||
return super.getName();
|
return super.getName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
package com.minelittlepony.unicopia.entity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@ -26,6 +25,7 @@ import net.minecraft.particle.ParticleEffect;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
public class ItemImpl implements Equine<ItemEntity>, Owned<ItemEntity> {
|
public class ItemImpl implements Equine<ItemEntity>, Owned<ItemEntity> {
|
||||||
private static final TrackedData<Integer> ITEM_RACE = DataTracker.registerData(ItemEntity.class, TrackedDataHandlerRegistry.INTEGER);
|
private static final TrackedData<Integer> ITEM_RACE = DataTracker.registerData(ItemEntity.class, TrackedDataHandlerRegistry.INTEGER);
|
||||||
|
|
|
@ -13,10 +13,10 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityDimensions;
|
import net.minecraft.entity.EntityDimensions;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.SpawnGroup;
|
import net.minecraft.entity.SpawnGroup;
|
||||||
|
import net.minecraft.tag.BiomeTags;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.biome.Biome.Category;
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -59,8 +59,15 @@ public interface UEntities {
|
||||||
final Predicate<BiomeSelectionContext> butterflySpawnable = BiomeSelectors.foundInOverworld()
|
final Predicate<BiomeSelectionContext> butterflySpawnable = BiomeSelectors.foundInOverworld()
|
||||||
.and(ctx -> ctx.getBiome().getPrecipitation() == Biome.Precipitation.RAIN);
|
.and(ctx -> ctx.getBiome().getPrecipitation() == Biome.Precipitation.RAIN);
|
||||||
|
|
||||||
BiomeModifications.addSpawn(butterflySpawnable.and(BiomeSelectors.categories(Category.RIVER, Category.FOREST, Category.EXTREME_HILLS)), SpawnGroup.AMBIENT, BUTTERFLY, 3, 3, 12);
|
BiomeModifications.addSpawn(butterflySpawnable.and(
|
||||||
BiomeModifications.addSpawn(butterflySpawnable.and(BiomeSelectors.categories(Category.PLAINS, Category.JUNGLE)), SpawnGroup.AMBIENT, BUTTERFLY, 7, 5, 19);
|
BiomeSelectors.tag(BiomeTags.IS_RIVER)
|
||||||
|
.or(BiomeSelectors.tag(BiomeTags.IS_FOREST))
|
||||||
|
.or(BiomeSelectors.tag(BiomeTags.IS_HILL))
|
||||||
|
), SpawnGroup.AMBIENT, BUTTERFLY, 3, 3, 12);
|
||||||
|
BiomeModifications.addSpawn(butterflySpawnable.and(
|
||||||
|
BiomeSelectors.tag(BiomeTags.IS_JUNGLE)
|
||||||
|
.or(BiomeSelectors.tag(BiomeTags.IS_MOUNTAIN))
|
||||||
|
), SpawnGroup.AMBIENT, BUTTERFLY, 7, 5, 19);
|
||||||
|
|
||||||
UTradeOffers.bootstrap();
|
UTradeOffers.bootstrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
package com.minelittlepony.unicopia.entity;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.UTags;
|
import com.minelittlepony.unicopia.UTags;
|
||||||
|
@ -18,6 +16,7 @@ import net.minecraft.item.Items;
|
||||||
import net.minecraft.tag.ItemTags;
|
import net.minecraft.tag.ItemTags;
|
||||||
import net.minecraft.tag.TagKey;
|
import net.minecraft.tag.TagKey;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
import net.minecraft.village.TradeOffer;
|
import net.minecraft.village.TradeOffer;
|
||||||
import net.minecraft.village.TradeOffers;
|
import net.minecraft.village.TradeOffers;
|
||||||
import net.minecraft.village.VillagerProfession;
|
import net.minecraft.village.VillagerProfession;
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class BeeBehaviour extends EntityBehaviour<BeeEntity> {
|
||||||
public BeeEntity onCreate(BeeEntity entity, EntityAppearance context, boolean replaceOld) {
|
public BeeEntity onCreate(BeeEntity entity, EntityAppearance context, boolean replaceOld) {
|
||||||
super.onCreate(entity, context, replaceOld);
|
super.onCreate(entity, context, replaceOld);
|
||||||
if (replaceOld && entity.world.isClient) {
|
if (replaceOld && entity.world.isClient) {
|
||||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_BEE);
|
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_BEE, entity.getId());
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ public interface Disguise extends FlightType.Provider, PlayerDimensions.Provider
|
||||||
}
|
}
|
||||||
|
|
||||||
static abstract class PlayerAccess extends PlayerEntity {
|
static abstract class PlayerAccess extends PlayerEntity {
|
||||||
public PlayerAccess() { super(null, null, 0, null); }
|
public PlayerAccess() { super(null, null, 0, null, null); }
|
||||||
static TrackedData<Byte> getModelBitFlag() {
|
static TrackedData<Byte> getModelBitFlag() {
|
||||||
return PLAYER_MODEL_PARTS;
|
return PLAYER_MODEL_PARTS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class MinecartBehaviour extends EntityBehaviour<AbstractMinecartEntity> {
|
||||||
public AbstractMinecartEntity onCreate(AbstractMinecartEntity entity, EntityAppearance context, boolean replaceOld) {
|
public AbstractMinecartEntity onCreate(AbstractMinecartEntity entity, EntityAppearance context, boolean replaceOld) {
|
||||||
super.onCreate(entity, context, replaceOld);
|
super.onCreate(entity, context, replaceOld);
|
||||||
if (replaceOld && entity.world.isClient) {
|
if (replaceOld && entity.world.isClient) {
|
||||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_MINECART);
|
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_MINECART, entity.getId());
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.minelittlepony.unicopia.entity.behaviour;
|
package com.minelittlepony.unicopia.entity.behaviour;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.mixin.MixinSheepEntity;
|
import com.minelittlepony.unicopia.mixin.MixinSheepEntity;
|
||||||
|
|
||||||
|
@ -14,6 +12,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
import net.minecraft.world.WorldEvents;
|
import net.minecraft.world.WorldEvents;
|
||||||
|
|
||||||
public class SheepBehaviour extends EntityBehaviour<SheepEntity> {
|
public class SheepBehaviour extends EntityBehaviour<SheepEntity> {
|
||||||
|
|
|
@ -2,17 +2,12 @@ package com.minelittlepony.unicopia.entity.behaviour;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
|
|
||||||
import net.minecraft.entity.JumpingMount;
|
import net.minecraft.entity.passive.*;
|
||||||
import net.minecraft.entity.LivingEntity;
|
|
||||||
import net.minecraft.entity.passive.HorseBaseEntity;
|
|
||||||
|
|
||||||
public class SteedBehaviour<T extends LivingEntity & JumpingMount> extends EntityBehaviour<T> {
|
public class SteedBehaviour<T extends AbstractHorseEntity> extends EntityBehaviour<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Pony player, T entity, Disguise spell) {
|
public void update(Pony player, T horse, Disguise spell) {
|
||||||
|
|
||||||
HorseBaseEntity horse = ((HorseBaseEntity)entity);
|
|
||||||
|
|
||||||
boolean angry = !player.getEntity().isOnGround() && player.getMaster().isSprinting();
|
boolean angry = !player.getEntity().isOnGround() && player.getMaster().isSprinting();
|
||||||
boolean sneaking = isSneakingOnGround(player);
|
boolean sneaking = isSneakingOnGround(player);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import net.minecraft.entity.effect.StatusEffectCategory;
|
||||||
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.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
|
@ -142,7 +141,7 @@ public class RaceChangeStatusEffect extends StatusEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Text getMessage(Race race) {
|
public Text getMessage(Race race) {
|
||||||
return new TranslatableText(getTranslationKey(), race.getDisplayName());
|
return Text.translatable(getTranslationKey(), race.getDisplayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
if (typeChanged) {
|
if (typeChanged) {
|
||||||
pony.spawnParticles(ParticleTypes.CLOUD, 10);
|
pony.spawnParticles(ParticleTypes.CLOUD, 10);
|
||||||
|
|
||||||
entity.playSound(entity.world.getDimension().isUltrawarm() ? USounds.ITEM_ICARUS_WINGS_CORRUPT : USounds.ITEM_ICARUS_WINGS_PURIFY, 0.1125F, 1.5F);
|
entity.playSound(entity.world.getDimension().ultrawarm() ? USounds.ITEM_ICARUS_WINGS_CORRUPT : USounds.ITEM_ICARUS_WINGS_PURIFY, 0.1125F, 1.5F);
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.getAbilities().allowFlying = type.canFlyCreative(entity);
|
entity.getAbilities().allowFlying = type.canFlyCreative(entity);
|
||||||
|
@ -345,7 +345,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
|
|
||||||
if (!SpellPredicate.IS_DISGUISE.isOn(pony)) {
|
if (!SpellPredicate.IS_DISGUISE.isOn(pony)) {
|
||||||
if (ticksInAir % GLIDING_SOUND_INTERVAL == 1 && pony.isClient()) {
|
if (ticksInAir % GLIDING_SOUND_INTERVAL == 1 && pony.isClient()) {
|
||||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_GLIDING);
|
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_GLIDING, entity.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
} else if (type == FlightType.INSECTOID && !SpellPredicate.IS_DISGUISE.isOn(pony)) {
|
} else if (type == FlightType.INSECTOID && !SpellPredicate.IS_DISGUISE.isOn(pony)) {
|
||||||
if (entity.world.isClient && !soundPlaying) {
|
if (entity.world.isClient && !soundPlaying) {
|
||||||
soundPlaying = true;
|
soundPlaying = true;
|
||||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_CHANGELING_BUZZ);
|
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_CHANGELING_BUZZ, entity.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
if (entity.world.hasRain(entity.getBlockPos())) {
|
if (entity.world.hasRain(entity.getBlockPos())) {
|
||||||
energyConsumed *= 3;
|
energyConsumed *= 3;
|
||||||
}
|
}
|
||||||
if (entity.world.getDimension().isUltrawarm()) {
|
if (entity.world.getDimension().ultrawarm()) {
|
||||||
energyConsumed *= 4;
|
energyConsumed *= 4;
|
||||||
damageInterval /= 2;
|
damageInterval /= 2;
|
||||||
minDamage *= 3;
|
minDamage *= 3;
|
||||||
|
|
|
@ -63,7 +63,6 @@ import net.minecraft.network.packet.s2c.play.EntityPassengersSetS2CPacket;
|
||||||
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.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
|
@ -356,7 +355,6 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
|
||||||
|
|
||||||
if (getSpecies() == Race.BAT) {
|
if (getSpecies() == Race.BAT) {
|
||||||
if (SunBlindnessStatusEffect.hasSunExposure(entity)) {
|
if (SunBlindnessStatusEffect.hasSunExposure(entity)) {
|
||||||
System.out.println("Sun exposure " + entity);
|
|
||||||
if (ticksInSun < 200) {
|
if (ticksInSun < 200) {
|
||||||
ticksInSun++;
|
ticksInSun++;
|
||||||
}
|
}
|
||||||
|
@ -366,7 +364,7 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
|
||||||
entity.addStatusEffect(new StatusEffectInstance(UEffects.SUN_BLINDNESS, SunBlindnessStatusEffect.MAX_DURATION * 10, 1, true, false));
|
entity.addStatusEffect(new StatusEffectInstance(UEffects.SUN_BLINDNESS, SunBlindnessStatusEffect.MAX_DURATION * 10, 1, true, false));
|
||||||
UCriteria.LOOK_INTO_SUN.trigger(entity);
|
UCriteria.LOOK_INTO_SUN.trigger(entity);
|
||||||
} else if (isClientPlayer()) {
|
} else if (isClientPlayer()) {
|
||||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_EARS_RINGING);
|
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_EARS_RINGING, getEntity().getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ticksInSun > 0) {
|
} else if (ticksInSun > 0) {
|
||||||
|
@ -434,6 +432,7 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
protected void handleFall(float distance, float damageMultiplier, DamageSource cause) {
|
protected void handleFall(float distance, float damageMultiplier, DamageSource cause) {
|
||||||
super.handleFall(distance, damageMultiplier, cause);
|
super.handleFall(distance, damageMultiplier, cause);
|
||||||
|
@ -500,13 +499,13 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
|
||||||
public Optional<Text> trySleep(BlockPos pos) {
|
public Optional<Text> trySleep(BlockPos pos) {
|
||||||
|
|
||||||
if (UItems.ALICORN_AMULET.isApplicable(entity)) {
|
if (UItems.ALICORN_AMULET.isApplicable(entity)) {
|
||||||
return Optional.of(new TranslatableText("block.unicopia.bed.not_tired"));
|
return Optional.of(Text.translatable("block.unicopia.bed.not_tired"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return findAllSpellsInRange(10)
|
return findAllSpellsInRange(10)
|
||||||
.filter(p -> p instanceof Pony && ((Pony)p).isEnemy(this))
|
.filter(p -> p instanceof Pony && ((Pony)p).isEnemy(this))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.map(p -> new TranslatableText("block.unicopia.bed.not_safe"));
|
.map(p -> Text.translatable("block.unicopia.bed.not_safe"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.client.world.ClientWorld;
|
||||||
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.network.packet.s2c.play.PlayerListS2CPacket;
|
import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.world.GameMode;
|
import net.minecraft.world.GameMode;
|
||||||
|
|
||||||
public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implements Owned<PlayerEntity> {
|
public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implements Owned<PlayerEntity> {
|
||||||
|
@ -27,7 +27,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen
|
||||||
private PlayerEntity owner;
|
private PlayerEntity owner;
|
||||||
|
|
||||||
public DummyClientPlayerEntity(ClientWorld world, GameProfile profile) {
|
public DummyClientPlayerEntity(ClientWorld world, GameProfile profile) {
|
||||||
super(world, profile);
|
super(world, profile, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,7 +49,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen
|
||||||
playerInfo = connection.getPlayerListEntry(getGameProfile().getId());
|
playerInfo = connection.getPlayerListEntry(getGameProfile().getId());
|
||||||
|
|
||||||
if (playerInfo == null) {
|
if (playerInfo == null) {
|
||||||
playerInfo = new PlayerListEntry(new Packet().entry());
|
playerInfo = new PlayerListEntry(new Packet().entry(), MinecraftClient.getInstance().getServicesSignatureVerifier());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEquipStack(ItemStack stack) {
|
protected void playEquipSound(ItemStack stack) {
|
||||||
/*noop*/
|
/*noop*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen
|
||||||
getGameProfile(),
|
getGameProfile(),
|
||||||
0,
|
0,
|
||||||
GameMode.DEFAULT,
|
GameMode.DEFAULT,
|
||||||
new LiteralText(getGameProfile().getName()));
|
Text.literal(getGameProfile().getName()), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,11 @@ public class DummyPlayerEntity extends PlayerEntity implements Owned<PlayerEntit
|
||||||
private PlayerEntity owner;
|
private PlayerEntity owner;
|
||||||
|
|
||||||
public DummyPlayerEntity(World world, GameProfile profile) {
|
public DummyPlayerEntity(World world, GameProfile profile) {
|
||||||
super(world, BlockPos.ORIGIN, 0, profile);
|
super(world, BlockPos.ORIGIN, 0, profile, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEquipStack(ItemStack stack) {
|
protected void playEquipSound(ItemStack stack) {
|
||||||
/*noop*/
|
/*noop*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,11 @@ public class DummyServerPlayerEntity extends ServerPlayerEntity implements Owned
|
||||||
private PlayerEntity owner;
|
private PlayerEntity owner;
|
||||||
|
|
||||||
public DummyServerPlayerEntity(ServerWorld world, GameProfile profile) {
|
public DummyServerPlayerEntity(ServerWorld world, GameProfile profile) {
|
||||||
super(world.getServer(), world, profile);
|
super(world.getServer(), world, profile, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEquipStack(ItemStack stack) {
|
protected void playEquipSound(ItemStack stack) {
|
||||||
/*noop*/
|
/*noop*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ import net.minecraft.particle.ParticleEffect;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.StringHelper;
|
import net.minecraft.util.StringHelper;
|
||||||
|
@ -71,7 +70,7 @@ public class AlicornAmuletItem extends AmuletItem implements PlayerCharmTracker.
|
||||||
if (iplayer != null) {
|
if (iplayer != null) {
|
||||||
int attachedTime = iplayer.getCharms().getArmour().getTicks(this);
|
int attachedTime = iplayer.getCharms().getArmour().getTicks(this);
|
||||||
if (attachedTime > 0) {
|
if (attachedTime > 0) {
|
||||||
tooltip.add(new TranslatableText(getTranslationKey() + ".lore", StringHelper.formatTicks(attachedTime)));
|
tooltip.add(Text.translatable(getTranslationKey() + ".lore", StringHelper.formatTicks(attachedTime)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,10 @@ import net.minecraft.item.ArmorMaterials;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
import net.minecraft.text.LiteralText;
|
|
||||||
import net.minecraft.text.MutableText;
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.text.StringVisitable;
|
import net.minecraft.text.StringVisitable;
|
||||||
import net.minecraft.text.Style;
|
import net.minecraft.text.Style;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -54,7 +52,7 @@ public class AmuletItem extends WearableItem {
|
||||||
&& entity instanceof LivingEntity
|
&& entity instanceof LivingEntity
|
||||||
&& ((LivingEntity) entity).getEquippedStack(EquipmentSlot.CHEST) == stack
|
&& ((LivingEntity) entity).getEquippedStack(EquipmentSlot.CHEST) == stack
|
||||||
&& isApplicable((LivingEntity)entity)) {
|
&& isApplicable((LivingEntity)entity)) {
|
||||||
ParticleUtils.spawnParticles(entity.world.getDimension().isUltrawarm() ? ParticleTypes.SOUL_FIRE_FLAME : ParticleTypes.COMPOSTER, entity, 1);
|
ParticleUtils.spawnParticles(entity.world.getDimension().ultrawarm() ? ParticleTypes.SOUL_FIRE_FLAME : ParticleTypes.COMPOSTER, entity, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +60,8 @@ public class AmuletItem extends WearableItem {
|
||||||
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> list, TooltipContext tooltipContext) {
|
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> list, TooltipContext tooltipContext) {
|
||||||
|
|
||||||
for (StringVisitable line : MinecraftClient.getInstance().textRenderer.getTextHandler().wrapLines(
|
for (StringVisitable line : MinecraftClient.getInstance().textRenderer.getTextHandler().wrapLines(
|
||||||
new TranslatableText(getTranslationKey(stack) + ".lore"), 150, Style.EMPTY)) {
|
Text.translatable(getTranslationKey(stack) + ".lore"), 150, Style.EMPTY)) {
|
||||||
MutableText compiled = new LiteralText("").formatted(Formatting.ITALIC, Formatting.GRAY);
|
MutableText compiled = Text.literal("").formatted(Formatting.ITALIC, Formatting.GRAY);
|
||||||
line.visit(s -> {
|
line.visit(s -> {
|
||||||
compiled.append(s);
|
compiled.append(s);
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
@ -72,7 +70,7 @@ public class AmuletItem extends WearableItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChargable()) {
|
if (isChargable()) {
|
||||||
list.add(new TranslatableText("item.unicopia.amulet.energy", (int)Math.floor(getEnergy(stack)), maxEnergy));
|
list.add(Text.translatable("item.unicopia.amulet.energy", (int)Math.floor(getEnergy(stack)), maxEnergy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ 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;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
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.world.WorldEvents;
|
import net.minecraft.world.WorldEvents;
|
||||||
|
@ -32,7 +31,7 @@ public class FilledJarItem extends JarItem implements ChameleonItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Text getName(ItemStack stack) {
|
public Text getName(ItemStack stack) {
|
||||||
return hasAppearance(stack) ? new TranslatableText(getTranslationKey(stack), getAppearanceStack(stack).getName()) : UItems.EMPTY_JAR.getName(UItems.EMPTY_JAR.getDefaultStack());
|
return hasAppearance(stack) ? Text.translatable(getTranslationKey(stack), getAppearanceStack(stack).getName()) : UItems.EMPTY_JAR.getName(UItems.EMPTY_JAR.getDefaultStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,7 +20,6 @@ import net.minecraft.item.DyeableItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.stat.Stats;
|
import net.minecraft.stat.Stats;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.TypedActionResult;
|
import net.minecraft.util.TypedActionResult;
|
||||||
|
@ -41,7 +40,7 @@ public class FriendshipBraceletItem extends WearableItem implements DyeableItem,
|
||||||
|
|
||||||
ItemStack result = stack.copy();
|
ItemStack result = stack.copy();
|
||||||
result.setCount(1);
|
result.setCount(1);
|
||||||
result.getOrCreateNbt().putString("issuer", player.getName().asString());
|
result.getOrCreateNbt().putString("issuer", player.getName().getString());
|
||||||
result.getOrCreateNbt().putUuid("issuer_id", player.getUuid());
|
result.getOrCreateNbt().putUuid("issuer_id", player.getUuid());
|
||||||
|
|
||||||
if (!player.getAbilities().creativeMode) {
|
if (!player.getAbilities().creativeMode) {
|
||||||
|
@ -67,10 +66,10 @@ public class FriendshipBraceletItem extends WearableItem implements DyeableItem,
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> list, TooltipContext tooltipContext) {
|
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> list, TooltipContext tooltipContext) {
|
||||||
if (isSigned(stack)) {
|
if (isSigned(stack)) {
|
||||||
list.add(new TranslatableText("item.unicopia.friendship_bracelet.issuer", getSignatorName(stack)));
|
list.add(Text.translatable("item.unicopia.friendship_bracelet.issuer", getSignatorName(stack)));
|
||||||
}
|
}
|
||||||
if (isGlowing(stack)) {
|
if (isGlowing(stack)) {
|
||||||
list.add(new TranslatableText("item.unicopia.friendship_bracelet.glowing").formatted(Formatting.ITALIC, Formatting.GRAY));
|
list.add(Text.translatable("item.unicopia.friendship_bracelet.glowing").formatted(Formatting.ITALIC, Formatting.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.text.MutableText;
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
@ -61,7 +60,7 @@ public class GemstoneItem extends Item {
|
||||||
if (isEnchanted(stack)) {
|
if (isEnchanted(stack)) {
|
||||||
SpellType<?> key = getSpellKey(stack);
|
SpellType<?> key = getSpellKey(stack);
|
||||||
|
|
||||||
MutableText line = new TranslatableText(key.getTranslationKey() + ".lore").formatted(key.getAffinity().getColor());
|
MutableText line = Text.translatable(key.getTranslationKey() + ".lore").formatted(key.getAffinity().getColor());
|
||||||
|
|
||||||
if (!Unicopia.SIDE.getPlayerSpecies().canCast()) {
|
if (!Unicopia.SIDE.getPlayerSpecies().canCast()) {
|
||||||
line = line.formatted(Formatting.OBFUSCATED);
|
line = line.formatted(Formatting.OBFUSCATED);
|
||||||
|
@ -94,10 +93,10 @@ public class GemstoneItem extends Item {
|
||||||
public Text getName(ItemStack stack) {
|
public Text getName(ItemStack stack) {
|
||||||
if (isEnchanted(stack)) {
|
if (isEnchanted(stack)) {
|
||||||
if (!Unicopia.SIDE.getPlayerSpecies().canCast()) {
|
if (!Unicopia.SIDE.getPlayerSpecies().canCast()) {
|
||||||
return new TranslatableText(getTranslationKey(stack) + ".obfuscated");
|
return Text.translatable(getTranslationKey(stack) + ".obfuscated");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TranslatableText(getTranslationKey(stack) + ".enchanted", getSpellKey(stack).getName());
|
return Text.translatable(getTranslationKey(stack) + ".enchanted", getSpellKey(stack).getName());
|
||||||
}
|
}
|
||||||
return super.getName();
|
return super.getName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package com.minelittlepony.unicopia.item;
|
package com.minelittlepony.unicopia.item;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellbookRecipe;
|
import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellbookRecipe;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.crafting.TraitRequirementRecipe;
|
import com.minelittlepony.unicopia.ability.magic.spell.crafting.TraitRequirementRecipe;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.loot.v1.FabricLootSupplier;
|
import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
|
||||||
import net.fabricmc.fabric.api.loot.v1.event.LootTableLoadingCallback;
|
|
||||||
import net.minecraft.loot.LootTable;
|
import net.minecraft.loot.LootTable;
|
||||||
import net.minecraft.recipe.Ingredient;
|
import net.minecraft.recipe.Ingredient;
|
||||||
import net.minecraft.recipe.RecipeSerializer;
|
import net.minecraft.recipe.RecipeSerializer;
|
||||||
|
@ -37,7 +38,7 @@ public interface URecipes {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bootstrap() {
|
static void bootstrap() {
|
||||||
LootTableLoadingCallback.EVENT.register((res, manager, id, supplier, setter) -> {
|
LootTableEvents.MODIFY.register((res, manager, id, supplier, setter) -> {
|
||||||
if (!"minecraft".contentEquals(id.getNamespace())) {
|
if (!"minecraft".contentEquals(id.getNamespace())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +46,7 @@ public interface URecipes {
|
||||||
Identifier modId = new Identifier("unicopiamc", id.getPath());
|
Identifier modId = new Identifier("unicopiamc", id.getPath());
|
||||||
LootTable table = manager.getTable(modId);
|
LootTable table = manager.getTable(modId);
|
||||||
if (table != LootTable.EMPTY) {
|
if (table != LootTable.EMPTY) {
|
||||||
supplier.withPools(((FabricLootSupplier)table).getPools());
|
supplier.pools(List.of(table.pools));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class GemFindingEnchantment extends SimpleEnchantment {
|
||||||
@Override
|
@Override
|
||||||
public void onEquipped(Living<?> user) {
|
public void onEquipped(Living<?> user) {
|
||||||
if (user.isClient()) {
|
if (user.isClient()) {
|
||||||
MinecraftClient.getInstance().getSoundManager().play(new MagicAuraSoundInstance(user.getEntity().getSoundCategory(), user));
|
MinecraftClient.getInstance().getSoundManager().play(new MagicAuraSoundInstance(user.getEntity().getSoundCategory(), user, user.getReferenceWorld().getRandom()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.minelittlepony.unicopia.item.enchantment;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -21,6 +20,7 @@ import net.minecraft.resource.ResourceManager;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
import net.minecraft.util.profiler.Profiler;
|
import net.minecraft.util.profiler.Profiler;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
|
|
||||||
public enum Toxicity {
|
public enum Toxicity {
|
||||||
|
@ -29,7 +28,7 @@ public enum Toxicity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Text getTooltip() {
|
public Text getTooltip() {
|
||||||
return new TranslatableText(getTranslationKey()).formatted(color);
|
return Text.translatable(getTranslationKey()).formatted(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Toxicity byName(String name) {
|
public static Toxicity byName(String name) {
|
||||||
|
|
|
@ -12,7 +12,6 @@ import net.minecraft.item.FoodComponent;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.text.MutableText;
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.StringHelper;
|
import net.minecraft.util.StringHelper;
|
||||||
import net.minecraft.world.Difficulty;
|
import net.minecraft.world.Difficulty;
|
||||||
|
|
||||||
|
@ -68,7 +67,7 @@ public interface Toxin extends Affliction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Text getName() {
|
public Text getName() {
|
||||||
return self.getName().shallowCopy().append(" + ").append(other.getName());
|
return self.getName().copy().append(" + ").append(other.getName());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -90,13 +89,13 @@ public interface Toxin extends Affliction {
|
||||||
static Toxin of(StatusEffect effect, int seconds, int amplifier) {
|
static Toxin of(StatusEffect effect, int seconds, int amplifier) {
|
||||||
int ticks = seconds * 20;
|
int ticks = seconds * 20;
|
||||||
|
|
||||||
MutableText text = effect.getName().shallowCopy();
|
MutableText text = effect.getName().copy();
|
||||||
|
|
||||||
if (amplifier > 0) {
|
if (amplifier > 0) {
|
||||||
text = new TranslatableText("potion.withAmplifier", text, new TranslatableText("potion.potency." + amplifier));
|
text = Text.translatable("potion.withAmplifier", text, Text.translatable("potion.potency." + amplifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
text = new TranslatableText("potion.withDuration", text, StringHelper.formatTicks(ticks));
|
text = Text.translatable("potion.withDuration", text, StringHelper.formatTicks(ticks));
|
||||||
|
|
||||||
return of(text, (player, stack) -> {
|
return of(text, (player, stack) -> {
|
||||||
StatusEffectInstance current = player.getStatusEffect(effect);
|
StatusEffectInstance current = player.getStatusEffect(effect);
|
||||||
|
@ -138,7 +137,7 @@ public interface Toxin extends Affliction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Text getName() {
|
public Text getName() {
|
||||||
return Predicate.this.getName().shallowCopy().append(toxin.getName());
|
return Predicate.this.getName().copy().append(toxin.getName());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ 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.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
|
|
||||||
@Mixin(DamageSource.class)
|
@Mixin(DamageSource.class)
|
||||||
abstract class MixinDamageSource {
|
abstract class MixinDamageSource {
|
||||||
|
@ -23,11 +22,11 @@ abstract class MixinDamageSource {
|
||||||
|
|
||||||
Entity prime = entity.getPrimeAdversary();
|
Entity prime = entity.getPrimeAdversary();
|
||||||
if (prime != null && !(attacker instanceof Owned<?> && ((Owned<Entity>)attacker).isOwnedBy(prime))) {
|
if (prime != null && !(attacker instanceof Owned<?> && ((Owned<Entity>)attacker).isOwnedBy(prime))) {
|
||||||
info.setReturnValue(new TranslatableText("death.attack.generic.and_also", info.getReturnValue(), attacker.getDisplayName()));
|
info.setReturnValue(Text.translatable("death.attack.generic.and_also", info.getReturnValue(), attacker.getDisplayName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info.setReturnValue(new TranslatableText("death.attack." + self.getName() + ".player", entity.getDisplayName(), attacker.getDisplayName()));
|
info.setReturnValue(Text.translatable("death.attack." + self.getName() + ".player", entity.getDisplayName(), attacker.getDisplayName()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
|
||||||
@Mixin(ServerPlayerEntity.class)
|
@Mixin(ServerPlayerEntity.class)
|
||||||
abstract class MixinServerPlayerEntity extends PlayerEntity implements ScreenHandlerListener, PonyContainer<Pony>, MotionChecker {
|
abstract class MixinServerPlayerEntity extends PlayerEntity implements ScreenHandlerListener, PonyContainer<Pony>, MotionChecker {
|
||||||
MixinServerPlayerEntity() {super(null, null, 0, null);}
|
MixinServerPlayerEntity() {super(null, null, 0, null, null);}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Accessor("inTeleportationState")
|
@Accessor("inTeleportationState")
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
@Mixin(ServerWorld.class)
|
@Mixin(ServerWorld.class)
|
||||||
abstract class MixinServerWorld extends World implements StructureWorldAccess {
|
abstract class MixinServerWorld extends World implements StructureWorldAccess {
|
||||||
private MixinServerWorld() {super(null, null, null, null, false, false, 0);}
|
MixinServerWorld() { super(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) {
|
||||||
|
|
|
@ -13,8 +13,8 @@ import net.minecraft.client.input.KeyboardInput;
|
||||||
|
|
||||||
@Mixin(KeyboardInput.class)
|
@Mixin(KeyboardInput.class)
|
||||||
abstract class MixinKeyboardInput extends Input {
|
abstract class MixinKeyboardInput extends Input {
|
||||||
@Inject(method = "tick(Z)V", at = @At("RETURN"))
|
@Inject(method = "tick(ZF)V", at = @At("RETURN"))
|
||||||
private void onTick(boolean strafe, CallbackInfo info) {
|
private void onTick(boolean a, float b, CallbackInfo info) {
|
||||||
Pony player = Pony.of(MinecraftClient.getInstance().player);
|
Pony player = Pony.of(MinecraftClient.getInstance().player);
|
||||||
|
|
||||||
if (player != null && player.getPhysics().isGravityNegative()) {
|
if (player != null && player.getPhysics().isGravityNegative()) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class ClientNetworkHandlerImpl implements ClientNetworkHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.getType() == UEntities.MAGIC_BEAM) {
|
if (entity.getType() == UEntities.MAGIC_BEAM) {
|
||||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_MAGIC_BEAM);
|
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_MAGIC_BEAM, entity.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
world.addEntity(packet.getId(), entity);
|
world.addEntity(packet.getId(), entity);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.unicopia.particle;
|
package com.minelittlepony.unicopia.particle;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.minelittlepony.common.util.Color;
|
import com.minelittlepony.common.util.Color;
|
||||||
import com.mojang.brigadier.StringReader;
|
import com.mojang.brigadier.StringReader;
|
||||||
|
@ -12,6 +11,7 @@ import net.minecraft.particle.ParticleEffect;
|
||||||
import net.minecraft.particle.ParticleType;
|
import net.minecraft.particle.ParticleType;
|
||||||
import net.minecraft.network.PacketByteBuf;
|
import net.minecraft.network.PacketByteBuf;
|
||||||
import net.minecraft.util.math.Vec3f;
|
import net.minecraft.util.math.Vec3f;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
public class MagicParticleEffect implements ParticleEffect {
|
public class MagicParticleEffect implements ParticleEffect {
|
||||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.entity.damage.EntityDamageSource;
|
import net.minecraft.entity.damage.EntityDamageSource;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
|
|
||||||
public class MagicalDamageSource extends EntityDamageSource {
|
public class MagicalDamageSource extends EntityDamageSource {
|
||||||
|
|
||||||
|
@ -89,6 +88,6 @@ public class MagicalDamageSource extends EntityDamageSource {
|
||||||
params.add(item.toHoverableText());
|
params.add(item.toHoverableText());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TranslatableText(basic, params.toArray());
|
return Text.translatable(basic, params.toArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,15 +22,12 @@ public interface Resources {
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
static Stream<Resource> getResources(ResourceManager manager, Identifier id) {
|
static Stream<Resource> getResources(ResourceManager manager, Identifier id) {
|
||||||
try {
|
return manager.getAllResources(id).stream();
|
||||||
return manager.getAllResources(id).stream();
|
|
||||||
} catch (IOException ignored) { }
|
|
||||||
return Stream.empty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Stream<Identifier> loadFile(Resource res, Type type, String msg) throws JsonParseException {
|
static Stream<Identifier> loadFile(Resource res, Type type, String msg) throws JsonParseException {
|
||||||
try (Resource resource = res) {
|
try (InputStreamReader reader = new InputStreamReader(res.getInputStream())) {
|
||||||
return (GSON.<List<Identifier>>fromJson(new InputStreamReader(resource.getInputStream()), type)).stream();
|
return (GSON.<List<Identifier>>fromJson(reader, type)).stream();
|
||||||
} catch (JsonParseException e) {
|
} catch (JsonParseException e) {
|
||||||
Unicopia.LOGGER.warn(msg + res.getResourcePackName(), e);
|
Unicopia.LOGGER.warn(msg + res.getResourcePackName(), e);
|
||||||
} catch (IOException ignored) {}
|
} catch (IOException ignored) {}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package com.minelittlepony.unicopia.util.shape;
|
package com.minelittlepony.unicopia.util.shape;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
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.util.math.random.Random;
|
||||||
|
|
||||||
public class Cylinder implements Shape {
|
public class Cylinder implements Shape {
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package com.minelittlepony.unicopia.util.shape;
|
package com.minelittlepony.unicopia.util.shape;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
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.util.math.random.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A lonely Line. The simplest form of shape.
|
* A lonely Line. The simplest form of shape.
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.minelittlepony.unicopia.util.shape;
|
package com.minelittlepony.unicopia.util.shape;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Spliterator;
|
import java.util.Spliterator;
|
||||||
import java.util.Spliterators.AbstractSpliterator;
|
import java.util.Spliterators.AbstractSpliterator;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
@ -11,6 +10,7 @@ import java.util.stream.StreamSupport;
|
||||||
import com.google.common.collect.Streams;
|
import com.google.common.collect.Streams;
|
||||||
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,8 +2,7 @@ package com.minelittlepony.unicopia.util.shape;
|
||||||
|
|
||||||
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.util.math.random.Random;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sphere, or 2d circle of you so desire.
|
* A sphere, or 2d circle of you so desire.
|
||||||
|
|
|
@ -34,13 +34,10 @@
|
||||||
"fabricloader": ">=0.12.0",
|
"fabricloader": ">=0.12.0",
|
||||||
"java": ">=17",
|
"java": ">=17",
|
||||||
"fabric-api-base": ">=0.1.0",
|
"fabric-api-base": ">=0.1.0",
|
||||||
"fabric-events-lifecycle-v0": ">=0.1.0",
|
|
||||||
"kirin": "*"
|
"kirin": "*"
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
"minelp": "*",
|
"minelp": "*",
|
||||||
"modmenu": "*",
|
"modmenu": "*"
|
||||||
"fabric-keybindings-v0": ">=0.1.0",
|
|
||||||
"fabric-rendering-v1": ">=0.1.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue