From c9c463d6c9c3ce51d269f4282f1a2fb26e13a55a Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 18 Dec 2022 21:07:24 +0000 Subject: [PATCH] 1.19.2 -> 1.19.3 (1.20) [part 1] --- build.gradle | 38 +++++++++++- gradle.properties | 22 ++++--- settings.gradle | 4 ++ .../com/minelittlepony/unicopia/Race.java | 4 +- .../minelittlepony/unicopia/UGameEvents.java | 5 +- .../com/minelittlepony/unicopia/USounds.java | 5 +- .../com/minelittlepony/unicopia/UTags.java | 10 ++-- .../unicopia/WorldTribeManager.java | 2 +- .../unicopia/ability/Abilities.java | 2 +- .../ability/data/tree/TreeTypeImpl.java | 4 +- .../ability/data/tree/TreeTypeLoader.java | 4 +- .../unicopia/ability/data/tree/TreeTypes.java | 2 +- .../ability/magic/spell/PlaceableSpell.java | 5 +- .../magic/spell/effect/AwkwardSpell.java | 6 +- .../magic/spell/effect/DarkVortexSpell.java | 4 +- .../ability/magic/spell/effect/FireSpell.java | 8 +-- .../magic/spell/effect/HydrophobicSpell.java | 2 +- .../ability/magic/spell/effect/IceSpell.java | 4 +- .../ability/magic/spell/effect/SpellType.java | 4 +- .../magic/spell/trait/SpellTraits.java | 6 +- .../magic/spell/trait/TraitDiscovery.java | 10 ++-- .../magic/spell/trait/TraitLoader.java | 4 +- .../unicopia/block/PieBlock.java | 2 +- .../unicopia/block/RockCropBlock.java | 6 +- .../unicopia/block/SegmentedCropBlock.java | 2 +- .../minelittlepony/unicopia/block/Tree.java | 5 +- .../unicopia/block/UBlockEntities.java | 5 +- .../unicopia/block/UBlocks.java | 3 +- .../unicopia/block/UTreeGen.java | 6 +- .../unicopia/block/ZapAppleLeavesBlock.java | 4 +- .../block/data/WeatherConditions.java | 2 +- .../unicopia/block/state/StateChange.java | 4 +- .../unicopia/block/state/StatePredicate.java | 23 ++++---- .../unicopia/client/DiscoveryToast.java | 2 +- .../client/ModifierTooltipRenderer.java | 6 +- .../client/gui/DismissSpellScreen.java | 18 +++--- .../unicopia/client/gui/DrawableUtil.java | 17 +++--- .../unicopia/client/gui/TextBlock.java | 4 +- .../unicopia/client/gui/TribeButton.java | 10 ++-- .../client/gui/TribeConfirmationScreen.java | 10 +++- .../unicopia/client/gui/UHud.java | 12 ++-- .../gui/spellbook/EquippedSpellSlot.java | 17 +++--- .../client/gui/spellbook/IngredientTree.java | 9 +-- .../client/gui/spellbook/SpellbookScreen.java | 4 +- .../SpellbookTraitDexPageContent.java | 8 +-- .../client/minelittlepony/AmuletGear.java | 4 +- .../client/minelittlepony/GlassesGear.java | 4 +- .../unicopia/client/minelittlepony/Main.java | 2 +- .../AbstractGeometryBasedParticle.java | 19 +++--- .../particle/ChangelingMagicParticle.java | 7 ++- .../client/particle/DiskParticle.java | 9 ++- .../particle/LightningBoltParticle.java | 59 ++++++++++--------- .../client/particle/MagicParticle.java | 11 ++-- .../particle/OrientedBillboardParticle.java | 27 +++++---- .../client/particle/RainbowTrailParticle.java | 42 ++++++------- .../client/particle/RunesParticle.java | 36 +++++------ .../unicopia/client/particle/SphereModel.java | 11 ++-- .../client/particle/SphereParticle.java | 8 +-- .../client/render/AmuletFeatureRenderer.java | 4 +- .../FloatingArtefactEntityRenderer.java | 6 +- .../client/render/GlassesFeatureRenderer.java | 4 +- .../unicopia/client/render/PlayerPoser.java | 5 +- .../client/render/PolearmRenderer.java | 12 ++-- .../unicopia/client/render/RenderLayers.java | 4 +- .../client/render/WorldRenderDelegate.java | 17 +++--- .../entity/SpellbookEntityRenderer.java | 10 ++-- .../client/render/shader/ViewportShader.java | 8 +-- .../client/sound/FadeOutSoundInstance.java | 2 +- .../unicopia/command/Commands.java | 2 +- .../unicopia/command/DisguiseCommand.java | 26 ++++---- .../container/SpellbookScreenHandler.java | 2 +- .../unicopia/container/UScreenHandlers.java | 5 +- .../unicopia/entity/ButterflyEntity.java | 2 +- .../unicopia/entity/CastSpellEntity.java | 3 +- .../unicopia/entity/Creature.java | 2 +- .../unicopia/entity/Enchantments.java | 6 +- .../unicopia/entity/EntityPhysics.java | 2 +- .../entity/FloatingArtefactEntity.java | 3 +- .../unicopia/entity/ItemTracker.java | 6 +- .../entity/PhysicsBodyProjectileEntity.java | 2 +- .../unicopia/entity/UEntities.java | 9 ++- .../unicopia/entity/UEntityAttributes.java | 5 +- .../unicopia/entity/UTradeOffers.java | 4 +- .../entity/behaviour/AxolotlBehaviour.java | 9 +-- .../unicopia/entity/behaviour/Disguise.java | 2 +- .../entity/behaviour/EntityBehaviour.java | 2 +- .../behaviour/FallingBlockBehaviour.java | 2 +- .../entity/effect/RaceChangeStatusEffect.java | 5 +- .../unicopia/entity/effect/UEffects.java | 5 +- .../unicopia/entity/effect/UPotions.java | 5 +- .../entity/player/PlayerCharmTracker.java | 2 +- .../player/dummy/DummyClientPlayerEntity.java | 22 +------ .../player/dummy/DummyPlayerEntity.java | 2 +- .../unicopia/item/ChameleonItem.java | 6 +- .../unicopia/item/CrystalHeartItem.java | 2 +- .../unicopia/item/GlowingRecipe.java | 5 +- .../unicopia/item/ItemCombinationRecipe.java | 5 +- .../unicopia/item/JarInsertRecipe.java | 5 +- .../minelittlepony/unicopia/item/UItems.java | 3 +- .../unicopia/item/ZapAppleItem.java | 6 +- .../unicopia/item/ZapAppleRecipe.java | 14 +++-- .../enchantment/PoisonedJokeEnchantment.java | 4 +- .../item/enchantment/UEnchantments.java | 5 +- .../item/toxin/ToxicRegistryEntry.java | 2 +- .../unicopia/item/toxin/Toxics.java | 2 +- .../unicopia/mixin/MixinBoatEntity.java | 4 +- .../mixin/MixinServerPlayerEntity.java | 2 +- .../mixin/client/MixinGameRenderer.java | 4 +- .../handler/ClientNetworkHandlerImpl.java | 2 +- .../particle/FollowingParticleEffect.java | 10 ++-- .../particle/MagicParticleEffect.java | 27 +++++---- .../OrientedBillboardParticleEffect.java | 4 +- .../particle/ParticleFactoryHelper.java | 3 +- .../particle/SphereParticleEffect.java | 25 ++++---- .../unicopia/particle/UParticles.java | 5 +- .../projectile/MagicProjectileEntity.java | 3 +- .../unicopia/util/Registries.java | 10 ++-- .../unicopia/util/RegistryIndexer.java | 2 +- .../unicopia/util/network/S2CPacketType.java | 3 +- 119 files changed, 507 insertions(+), 436 deletions(-) diff --git a/build.gradle b/build.gradle index 50a0b24c..2eccb3d7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,15 @@ +buildscript { + dependencies { + classpath 'com.github.dexman545:Outlet:1.3.10' + } +} plugins { id 'java-library' id 'fabric-loom' version '0.12-SNAPSHOT' + id 'com.modrinth.minotaur' version '2.+' id 'org.ajoberstar.reckon' version '0.13.0' } +apply plugin: 'dex.plugins.outlet' java { toolchain { @@ -11,6 +18,9 @@ java { withSourcesJar() } +outlet.allowSnapshotsForProject = false +outlet.mcVersionRange = project.minecraft_version_range + group = project.group description = project.displayname archivesBaseName = project.name @@ -45,11 +55,14 @@ dependencies { modApi "com.minelittlepony:kirin:${project.kirin_version}" include "com.minelittlepony:kirin:${project.kirin_version}" + // For reach-entity-attributes have not updated to 1.19.3. + // Until then, clone from https://github.com/Sollace/reach-entity-attributes and run: + // > gradlew build publishToMavenLocal modApi "com.jamieswhiteshirt:reach-entity-attributes:${project.reach_attributes_version}" include "com.jamieswhiteshirt:reach-entity-attributes:${project.reach_attributes_version}" modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}" - modCompileOnly "dev.emi:trinkets:3.4.0" + modCompileOnly "dev.emi:trinkets:${project.trinkets_version}" } processResources { @@ -63,3 +76,26 @@ processResources { tasks.withType(JavaCompile) { options.encoding = "UTF-8" } + +tasks.modrinth { + onlyIf { + def stage = version.version.stage.value + stage == null || stage.name != 'beta' + } +} + +modrinth { + token = System.env.MODRINTH_KEY + projectId = project.modrinth_project_id + //featured = true + versionNumber = version.toString() + versionName = archivesBaseName + '-' + version + changelog = "[Changelog](https://github.com/Sollace/Unicopia/releases/tag/${version.toString()})" + uploadFile = remapJar + outlet.mcVersions().each{ver -> + gameVersions.add ver + } + dependencies { + required.project 'P7dR8mSH' + } +} diff --git a/gradle.properties b/gradle.properties index a19b8597..d2b96b9c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.daemon=false # Fabric Properties # check these on https://fabricmc.net/develop - minecraft_version=1.19.2 - yarn_mappings=1.19.2+build.3 - loader_version=0.14.9 - fabric_version=0.59.0+1.19.2 + minecraft_version=1.19.3 + yarn_mappings=1.19.3+build.2 + loader_version=0.14.11 + fabric_version=0.68.1+1.19.3 # Mod Properties group=com.minelittlepony @@ -14,8 +14,14 @@ org.gradle.daemon=false authors=Sollace description=Magical Abilities for Mine Little Pony! +# Publishing + minecraft_version_range=>=1.19.3-pre1 + modrinth_loader_type=fabric + modrinth_project_id= + # Dependencies - modmenu_version=4.0.6 - minelp_version=4.6.2-beta.1 - kirin_version=1.12.0-beta.4 - reach_attributes_version=2.3.0 \ No newline at end of file + modmenu_version=5.0.0-alpha.3 + minelp_version=4.7.2 + kirin_version=1.13.2 + reach_attributes_version=2.3.1 + trinkets_version=3.5.0 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index cb906a3e..3f3ff87b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,6 +5,10 @@ pluginManagement { name = 'Fabric' url = 'https://maven.fabricmc.net/' } + maven { + name = 'Jitpack' + url = 'https://jitpack.io' + } gradlePluginPortal() } } diff --git a/src/main/java/com/minelittlepony/unicopia/Race.java b/src/main/java/com/minelittlepony/unicopia/Race.java index 34d5e6af..0786da63 100644 --- a/src/main/java/com/minelittlepony/unicopia/Race.java +++ b/src/main/java/com/minelittlepony/unicopia/Race.java @@ -19,8 +19,8 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.text.Text; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; public final class Race implements Affine { public static final String DEFAULT_ID = "unicopia:human"; diff --git a/src/main/java/com/minelittlepony/unicopia/UGameEvents.java b/src/main/java/com/minelittlepony/unicopia/UGameEvents.java index ad09cae2..63273b4e 100644 --- a/src/main/java/com/minelittlepony/unicopia/UGameEvents.java +++ b/src/main/java/com/minelittlepony/unicopia/UGameEvents.java @@ -1,7 +1,8 @@ package com.minelittlepony.unicopia; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.world.event.GameEvent; public interface UGameEvents { @@ -10,7 +11,7 @@ public interface UGameEvents { static GameEvent register(String name, int range) { Identifier id = Unicopia.id(name); - return Registry.register(Registry.GAME_EVENT, id, new GameEvent(id.toString(), range)); + return Registry.register(Registries.GAME_EVENT, id, new GameEvent(id.toString(), range)); } static void bootstrap() { diff --git a/src/main/java/com/minelittlepony/unicopia/USounds.java b/src/main/java/com/minelittlepony/unicopia/USounds.java index 8c6b1504..be98d90e 100644 --- a/src/main/java/com/minelittlepony/unicopia/USounds.java +++ b/src/main/java/com/minelittlepony/unicopia/USounds.java @@ -3,7 +3,8 @@ package com.minelittlepony.unicopia; import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvents; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; public interface USounds { SoundEvent AMBIENT_WIND_GUST = register("ambient.wind.gust"); @@ -88,7 +89,7 @@ public interface USounds { static SoundEvent register(String name) { Identifier id = Unicopia.id(name); - return Registry.register(Registry.SOUND_EVENT, id, new SoundEvent(id)); + return Registry.register(Registries.SOUND_EVENT, id, SoundEvent.of(id)); } static void bootstrap() {} diff --git a/src/main/java/com/minelittlepony/unicopia/UTags.java b/src/main/java/com/minelittlepony/unicopia/UTags.java index a115375d..cee89cf2 100644 --- a/src/main/java/com/minelittlepony/unicopia/UTags.java +++ b/src/main/java/com/minelittlepony/unicopia/UTags.java @@ -5,8 +5,8 @@ import com.minelittlepony.unicopia.item.toxin.Toxics; import net.minecraft.block.Block; import net.minecraft.entity.EntityType; import net.minecraft.item.Item; -import net.minecraft.tag.TagKey; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.*; +import net.minecraft.registry.tag.TagKey; public interface UTags { TagKey APPLES = item("apples"); @@ -35,15 +35,15 @@ public interface UTags { TagKey> TRANSFORMABLE_ENTITIES = entity("transformable"); static TagKey item(String name) { - return TagKey.of(Registry.ITEM_KEY, Unicopia.id(name)); + return TagKey.of(RegistryKeys.ITEM, Unicopia.id(name)); } static TagKey block(String name) { - return TagKey.of(Registry.BLOCK_KEY, Unicopia.id(name)); + return TagKey.of(RegistryKeys.BLOCK, Unicopia.id(name)); } static TagKey> entity(String name) { - return TagKey.of(Registry.ENTITY_TYPE_KEY, Unicopia.id(name)); + return TagKey.of(RegistryKeys.ENTITY_TYPE, Unicopia.id(name)); } static void bootstrap() { diff --git a/src/main/java/com/minelittlepony/unicopia/WorldTribeManager.java b/src/main/java/com/minelittlepony/unicopia/WorldTribeManager.java index afd1f492..57f5f477 100644 --- a/src/main/java/com/minelittlepony/unicopia/WorldTribeManager.java +++ b/src/main/java/com/minelittlepony/unicopia/WorldTribeManager.java @@ -2,7 +2,7 @@ package com.minelittlepony.unicopia; import net.minecraft.nbt.NbtCompound; import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.registry.RegistryEntry; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.world.PersistentState; import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.DimensionTypes; diff --git a/src/main/java/com/minelittlepony/unicopia/ability/Abilities.java b/src/main/java/com/minelittlepony/unicopia/ability/Abilities.java index 10c2f57a..91679d56 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/Abilities.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/Abilities.java @@ -12,7 +12,7 @@ import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.util.Registries; import net.minecraft.util.*; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; public interface Abilities { Registry> REGISTRY = Registries.createSimple(Unicopia.id("abilities")); diff --git a/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypeImpl.java b/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypeImpl.java index 56c4f1d2..487ec2d0 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypeImpl.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypeImpl.java @@ -9,7 +9,7 @@ import net.minecraft.block.LeavesBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; import net.minecraft.util.math.random.Random; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public record TreeTypeImpl ( Identifier name, @@ -43,7 +43,7 @@ public record TreeTypeImpl ( } private static boolean findMatch(Set ids, BlockState state) { - return ids.contains(Registry.BLOCK.getId(state.getBlock())); + return ids.contains(Registries.BLOCK.getId(state.getBlock())); } static boolean isNonPersistent(BlockState state) { diff --git a/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypeLoader.java b/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypeLoader.java index a31a440e..d7937e76 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypeLoader.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypeLoader.java @@ -17,7 +17,7 @@ import net.minecraft.resource.JsonDataLoader; import net.minecraft.resource.ResourceManager; import net.minecraft.util.Identifier; import net.minecraft.util.profiler.Profiler; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class TreeTypeLoader extends JsonDataLoader implements IdentifiableResourceReloadListener { private static final Identifier ID = Unicopia.id("data/tree_type"); @@ -96,7 +96,7 @@ public class TreeTypeLoader extends JsonDataLoader implements IdentifiableResour } void appendDrop(Weighted.Builder> weighted) { - Registry.ITEM.getOrEmpty(item).ifPresent(item -> { + Registries.ITEM.getOrEmpty(item).ifPresent(item -> { weighted.put(weight, item::getDefaultStack); }); } diff --git a/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypes.java b/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypes.java index e8930283..d3311fa3 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypes.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/data/tree/TreeTypes.java @@ -9,7 +9,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.LeavesBlock; import net.minecraft.item.ItemStack; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.random.Random; diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/PlaceableSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/PlaceableSpell.java index 09f88b0b..efe47a8e 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/PlaceableSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/PlaceableSpell.java @@ -16,10 +16,9 @@ import com.minelittlepony.unicopia.particle.UParticles; import com.minelittlepony.unicopia.particle.ParticleHandle.Attachment; import net.minecraft.nbt.*; +import net.minecraft.registry.*; import net.minecraft.util.Identifier; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.World; /** @@ -204,7 +203,7 @@ public class PlaceableSpell extends AbstractDelegatingSpell implements OrientedS if (compound.contains("dimension", NbtElement.STRING_TYPE)) { Identifier id = Identifier.tryParse(compound.getString("dimension")); if (id != null) { - dimension = RegistryKey.of(Registry.WORLD_KEY, id); + dimension = RegistryKey.of(RegistryKeys.WORLD, id); } } if (compound.contains("castEntity")) { diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AwkwardSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AwkwardSpell.java index 97f3d63f..884980dd 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AwkwardSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AwkwardSpell.java @@ -15,7 +15,7 @@ import net.minecraft.particle.ParticleTypes; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class AwkwardSpell extends AbstractSpell implements TimedSpell { @@ -47,12 +47,12 @@ public class AwkwardSpell extends AbstractSpell implements TimedSpell { if (source.isClient()) { source.spawnParticles(new Sphere(false, (1 + source.getLevel().getScaled(8)) * 8), 10, pos -> { - List names = new ArrayList<>(Registry.PARTICLE_TYPE.getIds()); + List names = new ArrayList<>(Registries.PARTICLE_TYPE.getIds()); int index = (int)MathHelper.nextDouble(source.getReferenceWorld().random, 0, names.size()); Identifier id = names.get(index); - ParticleType type = Registry.PARTICLE_TYPE.get(id); + ParticleType type = Registries.PARTICLE_TYPE.get(id); if (type instanceof ParticleEffect && shouldSpawnParticle(type)) { source.addParticle((ParticleEffect)type, pos, Vec3d.ZERO); diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/DarkVortexSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/DarkVortexSpell.java index d48db25a..ba46a4bd 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/DarkVortexSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/DarkVortexSpell.java @@ -31,7 +31,7 @@ import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.explosion.Explosion.DestructionType; +import net.minecraft.world.World.ExplosionSourceType; /** * More powerful version of the vortex spell which creates a black hole. @@ -61,7 +61,7 @@ public class DarkVortexSpell extends AttractiveSpell implements ProjectileDelega public void onImpact(MagicProjectileEntity projectile, BlockHitResult hit) { if (!projectile.isClient()) { BlockPos pos = hit.getBlockPos(); - projectile.world.createExplosion(projectile, pos.getX(), pos.getY(), pos.getZ(), 3, DestructionType.NONE); + projectile.world.createExplosion(projectile, pos.getX(), pos.getY(), pos.getZ(), 3, ExplosionSourceType.NONE); toPlaceable().tick(projectile, Situation.BODY); } } diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/FireSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/FireSpell.java index 83913843..3dbeb0c1 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/FireSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/FireSpell.java @@ -28,13 +28,13 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.particle.ParticleTypes; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; -import net.minecraft.world.explosion.Explosion.DestructionType; +import net.minecraft.world.World.ExplosionSourceType; /** * Simple fire spell that triggers an effect when used on a block. @@ -52,7 +52,7 @@ public class FireSpell extends AbstractAreaEffectSpell implements ProjectileDele public void onImpact(MagicProjectileEntity projectile, BlockHitResult hit) { if (!projectile.isClient()) { Vec3d pos = hit.getPos(); - projectile.getReferenceWorld().createExplosion(projectile.getOwner(), pos.getX(), pos.getY(), pos.getZ(), 2, DestructionType.DESTROY); + projectile.getReferenceWorld().createExplosion(projectile.getOwner(), pos.getX(), pos.getY(), pos.getZ(), 2, ExplosionSourceType.MOB); } } @@ -60,7 +60,7 @@ public class FireSpell extends AbstractAreaEffectSpell implements ProjectileDele public void onImpact(MagicProjectileEntity projectile, EntityHitResult hit) { if (!projectile.isClient()) { Entity entity = hit.getEntity(); - projectile.getReferenceWorld().createExplosion(projectile.getOwner(), entity.getX(), entity.getY(), entity.getZ(), 2, DestructionType.DESTROY); + projectile.getReferenceWorld().createExplosion(projectile.getOwner(), entity.getX(), entity.getY(), entity.getZ(), 2, ExplosionSourceType.MOB); } } diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/HydrophobicSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/HydrophobicSpell.java index 64ce2943..2d7891f5 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/HydrophobicSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/HydrophobicSpell.java @@ -18,7 +18,7 @@ import net.minecraft.block.*; import net.minecraft.fluid.*; import net.minecraft.nbt.*; import net.minecraft.state.property.Properties; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/IceSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/IceSpell.java index 4e013f85..09bad564 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/IceSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/IceSpell.java @@ -20,8 +20,8 @@ import net.minecraft.entity.TntEntity; import net.minecraft.entity.Entity.RemovalReason; import net.minecraft.particle.ParticleTypes; import net.minecraft.state.property.Properties; -import net.minecraft.tag.BlockTags; -import net.minecraft.tag.FluidTags; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/SpellType.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/SpellType.java index 42846909..a6ac55cf 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/SpellType.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/SpellType.java @@ -23,11 +23,11 @@ import com.minelittlepony.unicopia.util.Registries; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; -import net.minecraft.tag.FluidTags; import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.util.Util; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.tag.FluidTags; public final class SpellType implements Affine, SpellPredicate { public static final Identifier EMPTY_ID = Unicopia.id("none"); diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java index 304a5e05..aca7e161 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java @@ -33,7 +33,7 @@ import net.minecraft.network.PacketByteBuf; import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public final class SpellTraits implements Iterable> { public static final SpellTraits EMPTY = new SpellTraits(Map.of()); @@ -199,7 +199,7 @@ public final class SpellTraits implements Iterable> { } public static SpellTraits of(Item item) { - return REGISTRY.getOrDefault(Registry.ITEM.getId(item), EMPTY); + return REGISTRY.getOrDefault(Registries.ITEM.getId(item), EMPTY); } public static SpellTraits of(Block block) { @@ -210,7 +210,7 @@ public final class SpellTraits implements Iterable> { return REGISTRY.entrySet().stream() .filter(e -> e.getValue().get(trait) > 0) .map(Map.Entry::getKey) - .flatMap(id -> Registry.ITEM.getOrEmpty(id).stream()); + .flatMap(id -> Registries.ITEM.getOrEmpty(id).stream()); } public static Optional getEmbeddedTraits(ItemStack stack) { diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitDiscovery.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitDiscovery.java index 6c7ab527..7f8720e6 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitDiscovery.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitDiscovery.java @@ -28,7 +28,7 @@ import net.minecraft.nbt.NbtString; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.Text; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.world.World; public class TraitDiscovery implements NbtSerialisable { @@ -66,7 +66,7 @@ public class TraitDiscovery implements NbtSerialisable { return; } SpellTraits traits = SpellTraits.of(item); - items.put(Registry.ITEM.getId(item), traits); + items.put(Registries.ITEM.getId(item), traits); Set newTraits = new HashSet<>(); traits.entries().forEach(e -> { if (this.traits.add(e.getKey())) { @@ -81,13 +81,13 @@ public class TraitDiscovery implements NbtSerialisable { } public SpellTraits getKnownTraits(Item item) { - return items.getOrDefault(Registry.ITEM.getId(item), SpellTraits.EMPTY); + return items.getOrDefault(Registries.ITEM.getId(item), SpellTraits.EMPTY); } public Stream getKnownItems(Trait trait) { return items.entrySet().stream() .filter(entry -> entry.getValue().get(trait) > 0) - .flatMap(entry -> Registry.ITEM.getOrEmpty(entry.getKey()).stream()); + .flatMap(entry -> Registries.ITEM.getOrEmpty(entry.getKey()).stream()); } public boolean isUnread() { @@ -143,7 +143,7 @@ public class TraitDiscovery implements NbtSerialisable { private Optional loadTraits(Identifier itemId, NbtCompound nbt) { if (!pony.isClient()) { - return Registry.ITEM.getOrEmpty(itemId) + return Registries.ITEM.getOrEmpty(itemId) .flatMap(item -> Optional.of(SpellTraits.of(item))) .filter(SpellTraits::isPresent) .or(() -> SpellTraits.fromNbt(nbt)); diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitLoader.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitLoader.java index 7a626fcc..44e8560b 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitLoader.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/TraitLoader.java @@ -26,7 +26,7 @@ import net.minecraft.resource.SinglePreparationResourceReloader; import net.minecraft.util.Identifier; import net.minecraft.util.JsonHelper; import net.minecraft.util.profiler.Profiler; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class TraitLoader extends SinglePreparationResourceReloader> implements IdentifiableResourceReloadListener { private static final Identifier ID = Unicopia.id("data/traits"); @@ -108,7 +108,7 @@ public class TraitLoader extends SinglePreparationResourceReloader { - if (item == null || !Registry.ITEM.containsId(item)) { + if (item == null || !Registries.ITEM.containsId(item)) { Unicopia.LOGGER.warn("Skipping unknown item {} in {}:{}", item, pack, id); return false; } diff --git a/src/main/java/com/minelittlepony/unicopia/block/PieBlock.java b/src/main/java/com/minelittlepony/unicopia/block/PieBlock.java index 2db7b089..05ca6b52 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/PieBlock.java +++ b/src/main/java/com/minelittlepony/unicopia/block/PieBlock.java @@ -163,7 +163,7 @@ public class PieBlock extends Block implements Waterloggable { return Blocks.AIR.getDefaultState(); } if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); } diff --git a/src/main/java/com/minelittlepony/unicopia/block/RockCropBlock.java b/src/main/java/com/minelittlepony/unicopia/block/RockCropBlock.java index 3b1860c4..0a9995e5 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/RockCropBlock.java +++ b/src/main/java/com/minelittlepony/unicopia/block/RockCropBlock.java @@ -12,9 +12,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.random.Random; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldEvents; +import net.minecraft.world.*; public class RockCropBlock extends CropBlock { private static final VoxelShape[] AGE_TO_SHAPE = new VoxelShape[] { @@ -93,7 +91,7 @@ public class RockCropBlock extends CropBlock { } @Override - public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) { + public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) { if (world instanceof World && !canGrow((World)world, ((World)world).random, pos, state)) { return false; } diff --git a/src/main/java/com/minelittlepony/unicopia/block/SegmentedCropBlock.java b/src/main/java/com/minelittlepony/unicopia/block/SegmentedCropBlock.java index ebd7f502..97e0225e 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/SegmentedCropBlock.java +++ b/src/main/java/com/minelittlepony/unicopia/block/SegmentedCropBlock.java @@ -165,7 +165,7 @@ public class SegmentedCropBlock extends CropBlock implements SegmentedBlock { } @Override - public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) { + public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) { return super.isFertilizable(world, pos, state, isClient) || (nextSegmentSupplier != null && isNext(world.getBlockState(pos.up()))); } diff --git a/src/main/java/com/minelittlepony/unicopia/block/Tree.java b/src/main/java/com/minelittlepony/unicopia/block/Tree.java index 087d5785..d9c7831b 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/Tree.java +++ b/src/main/java/com/minelittlepony/unicopia/block/Tree.java @@ -9,10 +9,11 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; import net.minecraft.block.sapling.SaplingGenerator; import net.minecraft.item.*; -import net.minecraft.tag.BiomeTags; import net.minecraft.util.Identifier; import net.minecraft.util.math.random.Random; -import net.minecraft.util.registry.*; +import net.minecraft.registry.*; +import net.minecraft.registry.tag.BiomeTags; +import net.minecraft.registry.entry.*; import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.feature.*; import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize; diff --git a/src/main/java/com/minelittlepony/unicopia/block/UBlockEntities.java b/src/main/java/com/minelittlepony/unicopia/block/UBlockEntities.java index dad1d265..02133446 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/UBlockEntities.java +++ b/src/main/java/com/minelittlepony/unicopia/block/UBlockEntities.java @@ -3,13 +3,14 @@ package com.minelittlepony.unicopia.block; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType.Builder; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; public interface UBlockEntities { BlockEntityType WEATHER_VANE = create("weather_vane", BlockEntityType.Builder.create(WeatherVaneBlock.WeatherVane::new, UBlocks.WEATHER_VANE)); static BlockEntityType create(String id, Builder builder) { - return Registry.register(Registry.BLOCK_ENTITY_TYPE, id, builder.build(null)); + return Registry.register(Registries.BLOCK_ENTITY_TYPE, id, builder.build(null)); } static void bootstrap() {} diff --git a/src/main/java/com/minelittlepony/unicopia/block/UBlocks.java b/src/main/java/com/minelittlepony/unicopia/block/UBlocks.java index 8b568b5a..06aa3de0 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/UBlocks.java +++ b/src/main/java/com/minelittlepony/unicopia/block/UBlocks.java @@ -16,7 +16,8 @@ import net.minecraft.sound.BlockSoundGroup; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.world.BlockView; public interface UBlocks { diff --git a/src/main/java/com/minelittlepony/unicopia/block/UTreeGen.java b/src/main/java/com/minelittlepony/unicopia/block/UTreeGen.java index 3c4067ea..8ea0fd3c 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/UTreeGen.java +++ b/src/main/java/com/minelittlepony/unicopia/block/UTreeGen.java @@ -3,10 +3,10 @@ package com.minelittlepony.unicopia.block; import com.minelittlepony.unicopia.Unicopia; import net.minecraft.block.*; -import net.minecraft.tag.BlockTags; import net.minecraft.util.math.intprovider.ConstantIntProvider; import net.minecraft.util.math.intprovider.UniformIntProvider; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.world.gen.foliage.BlobFoliagePlacer; import net.minecraft.world.gen.foliage.JungleFoliagePlacer; import net.minecraft.world.gen.trunk.StraightTrunkPlacer; @@ -18,7 +18,7 @@ public interface UTreeGen { UniformIntProvider.create(3, 6), 0.3f, UniformIntProvider.create(1, 3), - Registry.BLOCK.getOrCreateEntryList(BlockTags.MANGROVE_LOGS_CAN_GROW_THROUGH) + Registries.BLOCK.getOrCreateEntryList(BlockTags.MANGROVE_LOGS_CAN_GROW_THROUGH) ), new JungleFoliagePlacer( ConstantIntProvider.create(3), ConstantIntProvider.create(2), diff --git a/src/main/java/com/minelittlepony/unicopia/block/ZapAppleLeavesBlock.java b/src/main/java/com/minelittlepony/unicopia/block/ZapAppleLeavesBlock.java index a716baa7..aa4a0732 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/ZapAppleLeavesBlock.java +++ b/src/main/java/com/minelittlepony/unicopia/block/ZapAppleLeavesBlock.java @@ -68,7 +68,7 @@ public class ZapAppleLeavesBlock extends LeavesBlock implements TintedBlock { onStageChanged(store, newStage, world, state, pos, random); } - world.createAndScheduleBlockTick(pos, this, 1); + world.scheduleBlockTick(pos, this, 1); } @Override @@ -79,7 +79,7 @@ public class ZapAppleLeavesBlock extends LeavesBlock implements TintedBlock { @Override public BlockState getPlacementState(ItemPlacementContext ctx) { if (!ctx.getWorld().isClient) { - ctx.getWorld().createAndScheduleBlockTick(ctx.getBlockPos(), this, 1); + ctx.getWorld().scheduleBlockTick(ctx.getBlockPos(), this, 1); return super.getPlacementState(ctx).with(STAGE, ZapAppleStageStore.get(ctx.getWorld()).getStage()); } return super.getPlacementState(ctx); diff --git a/src/main/java/com/minelittlepony/unicopia/block/data/WeatherConditions.java b/src/main/java/com/minelittlepony/unicopia/block/data/WeatherConditions.java index c3b15ad3..0ff2a6fa 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/data/WeatherConditions.java +++ b/src/main/java/com/minelittlepony/unicopia/block/data/WeatherConditions.java @@ -6,7 +6,7 @@ import com.minelittlepony.unicopia.util.Tickable; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.nbt.NbtCompound; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.Identifier; import net.minecraft.util.math.*; import net.minecraft.world.Heightmap.Type; diff --git a/src/main/java/com/minelittlepony/unicopia/block/state/StateChange.java b/src/main/java/com/minelittlepony/unicopia/block/state/StateChange.java index 28807c20..72e7b9e4 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/state/StateChange.java +++ b/src/main/java/com/minelittlepony/unicopia/block/state/StateChange.java @@ -14,7 +14,7 @@ import net.minecraft.block.BlockState; import net.minecraft.state.property.Property; import net.minecraft.util.Identifier; import net.minecraft.util.JsonHelper; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.world.World; public abstract class StateChange { @@ -49,7 +49,7 @@ public abstract class StateChange { if (chance > 0 && world.random.nextFloat() > chance) { return state; } - return Registry.BLOCK.getOrEmpty(id).map(Block::getDefaultState) + return Registries.BLOCK.getOrEmpty(id).map(Block::getDefaultState) .map(newState -> merge(newState, state)) .orElse(state); } diff --git a/src/main/java/com/minelittlepony/unicopia/block/state/StatePredicate.java b/src/main/java/com/minelittlepony/unicopia/block/state/StatePredicate.java index 8e3c4ce7..c0cb3977 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/state/StatePredicate.java +++ b/src/main/java/com/minelittlepony/unicopia/block/state/StatePredicate.java @@ -14,11 +14,13 @@ import com.google.gson.JsonObject; import net.minecraft.block.*; import net.minecraft.state.property.Property; -import net.minecraft.tag.TagKey; import net.minecraft.util.Identifier; import net.minecraft.util.JsonHelper; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryEntry; +import net.minecraft.registry.Registries; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.registry.tag.FluidTags; +import net.minecraft.registry.tag.TagKey; import net.minecraft.world.World; public abstract class StatePredicate implements Predicate { @@ -52,7 +54,7 @@ public abstract class StatePredicate implements Predicate { predicates.add(ofState(JsonHelper.getString(o, "state"))); } if (o.has("tag")) { - Optional.of(JsonHelper.getString(o, "tag")).map(s -> TagKey.of(Registry.BLOCK_KEY, new Identifier(s))).ifPresent(tag -> { + Optional.of(JsonHelper.getString(o, "tag")).map(s -> TagKey.of(RegistryKeys.BLOCK, new Identifier(s))).ifPresent(tag -> { predicates.add(new StatePredicate() { @Override public StateChange getInverse() { @@ -65,7 +67,7 @@ public abstract class StatePredicate implements Predicate { @Override public @NotNull BlockState getConverted(World world, @NotNull BlockState state) { - return Registry.BLOCK.getOrCreateEntryList(tag) + return Registries.BLOCK.getOrCreateEntryList(tag) .getRandom(world.random) .map(RegistryEntry::value) .map(Block::getDefaultState) @@ -117,7 +119,8 @@ public abstract class StatePredicate implements Predicate { } static boolean isOre(BlockState s) { - return s.getBlock() instanceof OreBlock; + // TODO: Use ConventionalBlockTags.ORES + return s.getBlock() instanceof ExperienceDroppingBlock && !(s.getBlock() instanceof SculkBlock); } static boolean isWater(BlockState s) { @@ -152,14 +155,14 @@ public abstract class StatePredicate implements Predicate { @Override public @NotNull BlockState getConverted(World world, @NotNull BlockState state) { - return Registry.BLOCK.getOrEmpty(id).map(Block::getDefaultState).orElse(state); + return Registries.BLOCK.getOrEmpty(id).map(Block::getDefaultState).orElse(state); } }; } @Override public boolean test(BlockState state) { - return Registry.BLOCK.getOrEmpty(id).filter(state::isOf).isPresent(); + return Registries.BLOCK.getOrEmpty(id).filter(state::isOf).isPresent(); } }; } @@ -176,7 +179,7 @@ public abstract class StatePredicate implements Predicate { @Override public @NotNull BlockState getConverted(World world, @NotNull BlockState state) { - return Registry.BLOCK.getOrEmpty(id).map(Block::getDefaultState).map(newState -> { + return Registries.BLOCK.getOrEmpty(id).map(Block::getDefaultState).map(newState -> { for (PropertyOp prop : properties) { newState = prop.applyTo(world, newState); } @@ -188,7 +191,7 @@ public abstract class StatePredicate implements Predicate { @Override public boolean test(BlockState state) { - return Registry.BLOCK.getOrEmpty(id).filter(state::isOf).isPresent() && properties.stream().allMatch(p -> p.test(state)); + return Registries.BLOCK.getOrEmpty(id).filter(state::isOf).isPresent() && properties.stream().allMatch(p -> p.test(state)); } }; } diff --git a/src/main/java/com/minelittlepony/unicopia/client/DiscoveryToast.java b/src/main/java/com/minelittlepony/unicopia/client/DiscoveryToast.java index b66fd55a..60224fec 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/DiscoveryToast.java +++ b/src/main/java/com/minelittlepony/unicopia/client/DiscoveryToast.java @@ -36,7 +36,7 @@ public class DiscoveryToast implements Toast { return Toast.Visibility.HIDE; } - RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderColor(1.0F, 1, 1, 1); manager.drawTexture(matrices, 0, 0, 0, 32, getWidth(), getHeight()); diff --git a/src/main/java/com/minelittlepony/unicopia/client/ModifierTooltipRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/ModifierTooltipRenderer.java index c444ef81..2f32520e 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/ModifierTooltipRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/ModifierTooltipRenderer.java @@ -31,7 +31,7 @@ import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.util.Pair; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class ModifierTooltipRenderer implements ItemTooltipCallback { @@ -102,7 +102,7 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback { if (stack.isDamaged()) { insertPosition = checkFor(lines, Text.translatable("item.durability", stack.getMaxDamage() - stack.getDamage(), stack.getMaxDamage())); } else { - insertPosition = checkFor(lines, Text.literal(Registry.ITEM.getId(stack.getItem()).toString()).formatted(Formatting.DARK_GRAY)); + insertPosition = checkFor(lines, Text.literal(Registries.ITEM.getId(stack.getItem()).toString()).formatted(Formatting.DARK_GRAY)); } } @@ -156,7 +156,7 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback { return stack.getEnchantments() .stream() .map(t -> (NbtCompound)t) - .map(tag -> Registry.ENCHANTMENT.getOrEmpty(Identifier.tryParse(tag.getString("id"))) + .map(tag -> Registries.ENCHANTMENT.getOrEmpty(Identifier.tryParse(tag.getString("id"))) .map(ench -> new Pair<>(tag.getInt("lvl"), ench))) .filter(Optional::isPresent) .map(Optional::get); diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/DismissSpellScreen.java b/src/main/java/com/minelittlepony/unicopia/client/gui/DismissSpellScreen.java index abb4478a..5cb7f874 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/DismissSpellScreen.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/DismissSpellScreen.java @@ -3,6 +3,8 @@ package com.minelittlepony.unicopia.client.gui; import java.util.ArrayList; import java.util.List; +import org.joml.Vector4f; + import com.minelittlepony.common.client.gui.GameGui; import com.minelittlepony.unicopia.ability.magic.spell.*; import com.minelittlepony.unicopia.client.FlowingText; @@ -153,27 +155,27 @@ public class DismissSpellScreen extends GameGui { @Override public boolean isMouseOver(double mouseX, double mouseY) { - return squareDistance(mouseX, mouseY, getX(), getY()) < 75; + return squareDistance(mouseX, mouseY, x, y) < 75; } @Override public void render(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) { - copy.set(getX(), getY(), getZ(), getW()); - copy.transform(matrices.peek().getPositionMatrix()); + copy.set(x, y, z, w); + copy.mul(matrices.peek().getPositionMatrix()); var type = actualSpell.getType().withTraits(actualSpell.getTraits()); - DrawableUtil.drawLine(matrices, 0, 0, (int)getX(), (int)getY(), 0xFFAAFF99); + DrawableUtil.drawLine(matrices, 0, 0, (int)x, (int)y, 0xFFAAFF99); DrawableUtil.renderItemIcon(actualSpell.isDead() ? UItems.BOTCHED_GEM.getDefaultStack() : type.getDefaultStack(), - copy.getX() - 8 + copy.getZ() / 20F, - copy.getY() - 8 + copy.getZ() / 20F, + copy.x - 8 + copy.z / 20F, + copy.y - 8 + copy.z / 20F, 1 ); int color = actualSpell.getType().getColor() << 2; matrices.push(); - matrices.translate(getX(), getY(), 0); + matrices.translate(x, y, 0); DrawableUtil.drawArc(matrices, 7, 8, 0, DrawableUtil.TAU, color | 0x00000088, false); @@ -221,7 +223,7 @@ public class DismissSpellScreen extends GameGui { } static void playClickEffect() { - MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 6, 0.3F)); + MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK.value(), 6, 0.3F)); } static double squareDistance(double x1, double y1, double x2, double y2) { diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/DrawableUtil.java b/src/main/java/com/minelittlepony/unicopia/client/gui/DrawableUtil.java index edb7b19f..7c4b1b3d 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/DrawableUtil.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/DrawableUtil.java @@ -1,5 +1,7 @@ package com.minelittlepony.unicopia.client.gui; +import org.joml.Matrix4f; + import com.minelittlepony.unicopia.Race; import com.mojang.blaze3d.systems.RenderSystem; @@ -15,7 +17,6 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Matrix4f; public interface DrawableUtil { double PI = Math.PI; @@ -55,7 +56,7 @@ public interface DrawableUtil { RenderSystem.enableBlend(); RenderSystem.disableTexture(); RenderSystem.defaultBlendFunc(); - RenderSystem.setShader(GameRenderer::getPositionColorShader); + RenderSystem.setShader(GameRenderer::getPositionColorProgram); Matrix4f matrix = matrices.peek().getPositionMatrix(); @@ -67,11 +68,11 @@ public interface DrawableUtil { RenderSystem.enableBlend(); RenderSystem.disableTexture(); RenderSystem.defaultBlendFunc(); - RenderSystem.setShader(GameRenderer::getPositionColorShader); + RenderSystem.setShader(GameRenderer::getPositionColorProgram); bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION_COLOR); bufferBuilder.vertex(matrix, x1, y1, 0).color(r, g, b, k).next(); bufferBuilder.vertex(matrix, x2, y2, 0).color(r, g, b, k).next(); - BufferRenderer.drawWithShader(bufferBuilder.end()); + BufferRenderer.drawWithGlobalProgram(bufferBuilder.end()); RenderSystem.enableTexture(); RenderSystem.disableBlend(); } @@ -98,7 +99,7 @@ public interface DrawableUtil { } RenderSystem.setShaderColor(1, 1, 1, 1); - RenderSystem.setShader(GameRenderer::getPositionColorShader); + RenderSystem.setShader(GameRenderer::getPositionColorProgram); RenderSystem.enableBlend(); RenderSystem.disableTexture(); RenderSystem.defaultBlendFunc(); @@ -119,7 +120,7 @@ public interface DrawableUtil { cylendricalVertex(bufferBuilder, model, innerRadius, angle + INCREMENT, r, g, b, k); } - BufferRenderer.drawWithShader(bufferBuilder.end()); + BufferRenderer.drawWithGlobalProgram(bufferBuilder.end()); RenderSystem.enableTexture(); } @@ -158,7 +159,7 @@ public interface DrawableUtil { } RenderSystem.setShaderColor(1, 1, 1, 1); - RenderSystem.setShader(GameRenderer::getPositionColorShader); + RenderSystem.setShader(GameRenderer::getPositionColorProgram); RenderSystem.enableBlend(); RenderSystem.disableTexture(); RenderSystem.defaultBlendFunc(); @@ -185,7 +186,7 @@ public interface DrawableUtil { } } - BufferRenderer.drawWithShader(bufferBuilder.end()); + BufferRenderer.drawWithGlobalProgram(bufferBuilder.end()); RenderSystem.enableTexture(); } diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/TextBlock.java b/src/main/java/com/minelittlepony/unicopia/client/gui/TextBlock.java index ae312a98..a47fff2e 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/TextBlock.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/TextBlock.java @@ -25,10 +25,10 @@ public class TextBlock extends Label { @Override public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { - int textY = (int)(y + MinecraftClient.getInstance().textRenderer.fontHeight/1.5F); + int textY = (int)(getY() + MinecraftClient.getInstance().textRenderer.fontHeight/1.5F); for (OrderedText line : getFont().wrapLines(getStyle().getText(), maxWidth)) { - getFont().drawWithShadow(matrices, line, x, textY, getStyle().getColor()); + getFont().drawWithShadow(matrices, line, getX(), textY, getStyle().getColor()); textY += getFont().fontHeight; } } diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/TribeButton.java b/src/main/java/com/minelittlepony/unicopia/client/gui/TribeButton.java index 7fe3a956..1f1416f6 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/TribeButton.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/TribeButton.java @@ -29,7 +29,7 @@ public class TribeButton extends Button { @Override public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { - RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderTexture(0, TribeSelectionScreen.TEXTURE); RenderSystem.setShaderColor(1, 1, 1, alpha); RenderSystem.enableBlend(); @@ -41,18 +41,18 @@ public class TribeButton extends Button { MinecraftClient mc = MinecraftClient.getInstance(); - drawTexture(matrices, x - 3, y - 13, 0, 0, 76, 69); + drawTexture(matrices, getX() - 3, getY() - 13, 0, 0, 76, 69); if (isHovered()) { - drawTexture(matrices, x - 4, y - 14, 76, 0, 78, 71); + drawTexture(matrices, getX() - 4, getY() - 14, 76, 0, 78, 71); if (hovered && screenWidth > 0) { Identifier id = Race.REGISTRY.getId(race); - drawCenteredText(matrices, getFont(), Text.translatable("gui.unicopia.tribe_selection.describe." + id.getNamespace() + "." + id.getPath()), screenWidth / 2, y + height, 0xFFFFFFFF); + drawCenteredText(matrices, getFont(), Text.translatable("gui.unicopia.tribe_selection.describe." + id.getNamespace() + "." + id.getPath()), screenWidth / 2, getY() + height, 0xFFFFFFFF); } } if (getStyle().hasIcon()) { - getStyle().getIcon().render(matrices, x, y, mouseX, mouseY, partialTicks); + getStyle().getIcon().render(matrices, getX(), getY(), mouseX, mouseY, partialTicks); } int foreColor = getStyle().getColor(); diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/TribeConfirmationScreen.java b/src/main/java/com/minelittlepony/unicopia/client/gui/TribeConfirmationScreen.java index 9697afe9..75cd0629 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/TribeConfirmationScreen.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/TribeConfirmationScreen.java @@ -3,12 +3,12 @@ package com.minelittlepony.unicopia.client.gui; import org.lwjgl.glfw.GLFW; import com.minelittlepony.common.client.gui.GameGui; +import com.minelittlepony.common.client.gui.element.Button; import com.minelittlepony.common.client.gui.element.Label; import com.minelittlepony.unicopia.Race; import com.mojang.blaze3d.systems.RenderSystem; import it.unimi.dsi.fastutil.booleans.BooleanConsumer; -import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.minecraft.util.*; @@ -33,8 +33,12 @@ public class TribeConfirmationScreen extends GameGui implements HidesHud { int top = (height - columnHeight) / 2; - 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, Text.translatable("Go Back"), b -> callback.accept(false))); + addDrawableChild(new Button(width / 2 + 5, top + columnHeight + padding, 100, 20)) + .onClick(b -> callback.accept(true)) + .getStyle().setText("Join Tribe"); + addDrawableChild(new Button(width / 2 - 105, top + columnHeight + padding, 100, 20)) + .onClick(b -> callback.accept(false)) + .getStyle().setText("Go Back"); addDrawable(new Label(width / 2, top - 30).setCentered()).getStyle().setText(Text.translatable("gui.unicopia.tribe_selection.confirm", selection.getDisplayName().copy().formatted(Formatting.YELLOW))); diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/UHud.java b/src/main/java/com/minelittlepony/unicopia/client/gui/UHud.java index 34adb9e3..ef55fa69 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/UHud.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/UHud.java @@ -36,9 +36,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.sound.SoundEvents; import net.minecraft.text.Text; import net.minecraft.util.*; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Quaternion; -import net.minecraft.util.math.Vec3f; +import net.minecraft.util.math.*; import net.minecraft.util.math.random.Random; public class UHud extends DrawableHelper { @@ -153,7 +151,7 @@ public class UHud extends DrawableHelper { view.push(); view.translate(x, y, 0); - view.multiply(new Quaternion(-9, xDirection * 45, 0, true)); + view.multiply(RotationAxis.POSITIVE_X.rotationDegrees(xDirection * 45)); InventoryScreen.drawEntity(0, 0, scale, 0, -20, client.player); view.pop(); RenderSystem.applyModelViewMatrix(); @@ -235,7 +233,7 @@ public class UHud extends DrawableHelper { if (hasEffect) { matrices.push(); matrices.translate(scaledWidth, 0, 0); - matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(90)); + matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(90)); fillGradient(matrices, 0, 0, scaledHeight, scaledWidth / 2, 0xFFFFFF | 0, 0xFFFFFF | alpha2); fillGradient(matrices, 0, scaledWidth / 2, scaledHeight, scaledWidth, 0xFFFFFF | alpha2, 0xFFFFFF | 0); @@ -302,7 +300,7 @@ public class UHud extends DrawableHelper { matrices.push(); matrices.translate(scaledWidth, 0, 0); - matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(90)); + matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(90)); fillGradient(matrices, 0, 0, scaledHeight, halfWidth, color | alpha1, color | alpha2); fillGradient(matrices, 0, scaledWidth - halfWidth, scaledHeight, scaledWidth, color | alpha2, color | alpha1); @@ -328,7 +326,7 @@ public class UHud extends DrawableHelper { matrices.push(); matrices.translate(scaledWidth, 0, 0); - matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(90)); + matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(90)); fillGradient(matrices, 0, 0, scaledHeight, halfWidth, color | alpha1, color | alpha2); fillGradient(matrices, 0, scaledWidth - halfWidth, scaledHeight, scaledWidth, color | alpha2, color | alpha1); diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/EquippedSpellSlot.java b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/EquippedSpellSlot.java index 8ff5f8d5..c947ef03 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/EquippedSpellSlot.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/EquippedSpellSlot.java @@ -2,6 +2,8 @@ package com.minelittlepony.unicopia.client.gui.spellbook; import java.util.List; +import org.joml.Vector4f; + import com.minelittlepony.common.client.gui.element.Button; import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellType; import com.mojang.blaze3d.systems.RenderSystem; @@ -12,7 +14,6 @@ import net.minecraft.client.item.TooltipContext; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.sound.SoundManager; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Vector4f; public class EquippedSpellSlot extends Button { @@ -27,7 +28,7 @@ public class EquippedSpellSlot extends Button { if (spell.isEmpty()) { return List.of(); } - return spell.getDefaultStack().getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.NORMAL); + return spell.getDefaultStack().getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.BASIC); }); } @@ -37,24 +38,24 @@ public class EquippedSpellSlot extends Button { RenderSystem.setShaderTexture(0, SpellbookScreen.SLOT); RenderSystem.enableBlend(); - drawTexture(matrices, x - 8, y - 8, 0, 0, 32, 32, 32, 32); + drawTexture(matrices, getX() - 8, getY() - 8, 0, 0, 32, 32, 32, 32); - Vector4f pos = new Vector4f(x, y, 0, 1); - pos.transform(matrices.peek().getPositionMatrix()); + Vector4f pos = new Vector4f(getX(), getY(), 0, 1); + pos.mul(matrices.peek().getPositionMatrix()); if (spell.isEmpty()) { RenderSystem.setShaderColor(1, 1, 1, 0.3F); RenderSystem.setShaderTexture(0, SpellbookScreen.GEM); - drawTexture(matrices, x, y, 0, 0, 16, 16, 16, 16); + drawTexture(matrices, getX(), getY(), 0, 0, 16, 16, 16, 16); RenderSystem.disableBlend(); RenderSystem.setShaderColor(1, 1, 1, 1); } else { RenderSystem.disableBlend(); RenderSystem.setShaderColor(1, 1, 1, 1); - drawItem((int)pos.getX(), (int)pos.getY()); + drawItem((int)pos.x, (int)pos.y); } if (isHovered()) { - HandledScreen.drawSlotHighlight(matrices, x, y, 0); + HandledScreen.drawSlotHighlight(matrices, getX(), getY(), 0); this.onPress(); } } diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java index 5da3bd93..60fc9cc1 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; +import org.joml.Vector4f; + import com.minelittlepony.common.client.gui.*; import com.minelittlepony.common.client.gui.element.Button; import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellbookRecipe; @@ -22,7 +24,6 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.text.Text; -import net.minecraft.util.math.Vector4f; class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder { private final List entries = new ArrayList<>(); @@ -187,8 +188,8 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder { } Vector4f pos = new Vector4f(x, y, 0, 1); - pos.transform(matrices.peek().getPositionMatrix()); - drawItem((int)pos.getX(), (int)pos.getY()); + pos.mul(matrices.peek().getPositionMatrix()); + drawItem((int)pos.x, (int)pos.y); } protected void drawItem(int x, int y) { @@ -201,7 +202,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder { if (stacks[index].isEmpty()) { return List.of(); } - return stacks[index].getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.NORMAL); + return stacks[index].getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.BASIC); }; } diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookScreen.java b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookScreen.java index c3225d89..3889d8b0 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookScreen.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookScreen.java @@ -292,7 +292,7 @@ public class SpellbookScreen extends HandledScreen imple @Override public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) { - RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderColor(1, 1, 1, alpha); RenderSystem.defaultBlendFunc(); @@ -301,7 +301,7 @@ public class SpellbookScreen extends HandledScreen imple GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA); if (getStyle().hasIcon()) { - getStyle().getIcon().render(matrices, x, y, mouseX, mouseY, tickDelta); + getStyle().getIcon().render(matrices, getX(), getY(), mouseX, mouseY, tickDelta); } RenderSystem.setShaderColor(1, 1, 1, 1); diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookTraitDexPageContent.java b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookTraitDexPageContent.java index 7144a07a..e8f088e3 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookTraitDexPageContent.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookTraitDexPageContent.java @@ -128,7 +128,7 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel .sorted(Comparator.comparing(u -> knownItems.contains(u) ? 0 : 1)) .forEach(i -> { DefaultedList stacks = DefaultedList.of(); - i.appendStacks(ItemGroup.SEARCH, stacks); + i.appendStacks(ItemGroups.SEARCH, stacks); if (knownItems.contains(i)) { tree.input(stacks); } else { @@ -205,14 +205,14 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel RenderSystem.setShaderColor(1, 1, 1, 1); RenderSystem.setShaderTexture(0, SpellbookScreen.TEXTURE); RenderSystem.enableBlend(); - drawTexture(matrices, x - 2, y - 8, 204, 219, 22, 32, 512, 256); + drawTexture(matrices, getX() - 2, getY() - 8, 204, 219, 22, 32, 512, 256); if (!active) { - drawTexture(matrices, x - 2, y - 1, 74, 223, 18, 18, 512, 256); + drawTexture(matrices, getX() - 2, getY() - 1, 74, 223, 18, 18, 512, 256); } if (discoveries.isUnread(trait)) { - drawTexture(matrices, x - 8, y - 8, 225, 219, 35, 32, 512, 256); + drawTexture(matrices, getX() - 8, getY() - 8, 225, 219, 35, 32, 512, 256); } super.renderButton(matrices, mouseX, mouseY, tickDelta); diff --git a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/AmuletGear.java b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/AmuletGear.java index 43c803f6..c18def58 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/AmuletGear.java +++ b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/AmuletGear.java @@ -17,7 +17,7 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; class AmuletGear extends AmuletModel implements IGear { @@ -41,7 +41,7 @@ class AmuletGear extends AmuletModel implements IGear { @Override public Identifier getTexture(T entity, Context context) { - return textures.computeIfAbsent(Registry.ITEM.getId(AmuletItem.getForEntity((LivingEntity)entity).getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png")); + return textures.computeIfAbsent(Registries.ITEM.getId(AmuletItem.getForEntity((LivingEntity)entity).getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png")); } @Override diff --git a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/GlassesGear.java b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/GlassesGear.java index 5fa2e2d0..ab06f473 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/GlassesGear.java +++ b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/GlassesGear.java @@ -16,7 +16,7 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; class GlassesGear extends GlassesModel implements IGear { @@ -38,7 +38,7 @@ class GlassesGear extends GlassesModel implements IGear { @Override public Identifier getTexture(T entity, Context context) { - return textures.computeIfAbsent(Registry.ITEM.getId(GlassesItem.getForEntity((LivingEntity)entity).getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png")); + return textures.computeIfAbsent(Registries.ITEM.getId(GlassesItem.getForEntity((LivingEntity)entity).getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png")); } @Override diff --git a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java index 31c3c040..c69ccdc9 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java +++ b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java @@ -69,7 +69,7 @@ public class Main extends MineLPDelegate implements ClientModInitializer { @Override public Race getPlayerPonyRace(PlayerEntity player) { - switch (MineLittlePony.getInstance().getManager().getPony(player).getRace()) { + switch (MineLittlePony.getInstance().getManager().getPony(player).race()) { case ALICORN: return Race.ALICORN; case CHANGELING: diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/AbstractGeometryBasedParticle.java b/src/main/java/com/minelittlepony/unicopia/client/particle/AbstractGeometryBasedParticle.java index dd1bff14..fffcade8 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/AbstractGeometryBasedParticle.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/AbstractGeometryBasedParticle.java @@ -1,5 +1,7 @@ package com.minelittlepony.unicopia.client.particle; +import org.joml.Vector3f; + import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.ParticleTextureSheet; import net.minecraft.client.render.BufferBuilder; @@ -7,7 +9,6 @@ import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; -import net.minecraft.util.math.Vec3f; import net.minecraft.client.world.ClientWorld; public abstract class AbstractGeometryBasedParticle extends Particle { @@ -23,23 +24,23 @@ public abstract class AbstractGeometryBasedParticle extends Particle { return ParticleTextureSheet.CUSTOM; } - protected final void renderQuad(Tessellator te, BufferBuilder buffer, Vec3f[] corners, float alpha, float tickDelta) { + protected final void renderQuad(Tessellator te, BufferBuilder buffer, Vector3f[] corners, float alpha, float tickDelta) { int light = getBrightness(tickDelta); buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR_LIGHT); - buffer.vertex(corners[0].getX(), corners[0].getY(), corners[0].getZ()).texture(0, 0).color(red, green, blue, alpha).light(light).next(); - buffer.vertex(corners[1].getX(), corners[1].getY(), corners[1].getZ()).texture(1, 0).color(red, green, blue, alpha).light(light).next(); - buffer.vertex(corners[2].getX(), corners[2].getY(), corners[2].getZ()).texture(1, 1).color(red, green, blue, alpha).light(light).next(); - buffer.vertex(corners[3].getX(), corners[3].getY(), corners[3].getZ()).texture(0, 1).color(red, green, blue, alpha).light(light).next(); + buffer.vertex(corners[0].x, corners[0].y, corners[0].z).texture(0, 0).color(red, green, blue, alpha).light(light).next(); + buffer.vertex(corners[1].x, corners[1].y, corners[1].z).texture(1, 0).color(red, green, blue, alpha).light(light).next(); + buffer.vertex(corners[2].x, corners[2].y, corners[2].z).texture(1, 1).color(red, green, blue, alpha).light(light).next(); + buffer.vertex(corners[3].x, corners[3].y, corners[3].z).texture(0, 1).color(red, green, blue, alpha).light(light).next(); te.draw(); } - protected final void renderQuad(VertexConsumer buffer, Vec3f[] corners, float alpha, float tickDelta) { + protected final void renderQuad(VertexConsumer buffer, Vector3f[] corners, float alpha, float tickDelta) { int light = getBrightness(tickDelta); - for (Vec3f corner : corners) { - buffer.vertex(corner.getX(), corner.getY(), corner.getZ()).color(red, green, blue, alpha).light(light).next(); + for (Vector3f corner : corners) { + buffer.vertex(corner.x, corner.y, corner.z).color(red, green, blue, alpha).light(light).next(); } } diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/ChangelingMagicParticle.java b/src/main/java/com/minelittlepony/unicopia/client/particle/ChangelingMagicParticle.java index 988dea78..57a7dc65 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/ChangelingMagicParticle.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/ChangelingMagicParticle.java @@ -1,9 +1,10 @@ package com.minelittlepony.unicopia.client.particle; +import org.joml.Vector3f; + import net.minecraft.client.particle.SpriteProvider; import net.minecraft.client.world.ClientWorld; import net.minecraft.particle.ParticleEffect; -import net.minecraft.util.math.Vec3f; public class ChangelingMagicParticle extends MagicParticle { @@ -14,8 +15,8 @@ public class ChangelingMagicParticle extends MagicParticle { this.provider = provider; } - static Vec3f nextColor(float intensity) { - return new Vec3f(intensity * 0.5F, intensity, intensity * 0.4F); + static Vector3f nextColor(float intensity) { + return new Vector3f(intensity * 0.5F, intensity, intensity * 0.4F); } @Override diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/DiskParticle.java b/src/main/java/com/minelittlepony/unicopia/client/particle/DiskParticle.java index 4f2d98a4..77ea8ba7 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/DiskParticle.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/DiskParticle.java @@ -1,5 +1,7 @@ package com.minelittlepony.unicopia.client.particle; +import org.joml.Quaternionf; + import com.minelittlepony.unicopia.particle.SphereParticleEffect; import net.minecraft.client.render.VertexConsumer; @@ -9,13 +11,14 @@ import net.minecraft.util.math.*; public class DiskParticle extends SphereParticle { - private final Quaternion rotation = new Quaternion(0, 0, 0, 1); + private final Quaternionf rotation = new Quaternionf(0, 0, 0, 1); public DiskParticle(SphereParticleEffect effect, ClientWorld w, double x, double y, double z, double rX, double rY, double rZ) { super(effect, w, x, y, z, 0, 0, 0); - rotation.hamiltonProduct(Vec3f.POSITIVE_Y.getDegreesQuaternion((float)effect.getOffset().y)); - rotation.hamiltonProduct(Vec3f.POSITIVE_X.getDegreesQuaternion(90 - (float)effect.getOffset().x)); + // TODO: was hamiltonianProduct (check this!!!) + rotation.mul(RotationAxis.POSITIVE_Y.rotationDegrees((float)effect.getOffset().y)); + rotation.mul(RotationAxis.POSITIVE_X.rotationDegrees(90 - (float)effect.getOffset().x)); effect.setOffset(new Vec3d(0, 0.25, 0)); } diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/LightningBoltParticle.java b/src/main/java/com/minelittlepony/unicopia/client/particle/LightningBoltParticle.java index a2194589..89762279 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/LightningBoltParticle.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/LightningBoltParticle.java @@ -3,6 +3,8 @@ package com.minelittlepony.unicopia.client.particle; import java.util.ArrayList; import java.util.List; +import org.joml.Vector3f; + import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; @@ -16,11 +18,10 @@ import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3f; public class LightningBoltParticle extends AbstractGeometryBasedParticle { - private final List> branches = new ArrayList<>(); + private final List> branches = new ArrayList<>(); public LightningBoltParticle(DefaultParticleType type, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { super(world, x, y, z, velocityX, velocityY, velocityZ); @@ -49,18 +50,18 @@ public class LightningBoltParticle extends AbstractGeometryBasedParticle { world.setLightningTicksLeft(2); } - private List generateBranch() { - Vec3d startPos = new Vec3d(0, 0, 0); + private List generateBranch() { + Vector3f startPos = new Vector3f(0, 0, 0); int intendedLength = 2 + world.random.nextInt(6); - List nodes = new ArrayList<>(); + List nodes = new ArrayList<>(); while (nodes.size() < intendedLength) { startPos = startPos.add( - world.random.nextTriangular(0.1, 3), - world.random.nextTriangular(0.1, 3), - world.random.nextTriangular(0.1, 3) + (float)world.random.nextTriangular(0.1F, 3), + (float)world.random.nextTriangular(0.1F, 3), + (float)world.random.nextTriangular(0.1F, 3) ); nodes.add(startPos); @@ -82,11 +83,11 @@ public class LightningBoltParticle extends AbstractGeometryBasedParticle { float y = (float)(MathHelper.lerp(tickDelta, prevPosY, this.y) - cam.getY()); float z = (float)(MathHelper.lerp(tickDelta, prevPosZ, this.z) - cam.getZ()); - Vec3f origin = new Vec3f(x, y, z); + Vector3f origin = new Vector3f(x, y, z); - for (List branch : branches) { + for (List branch : branches) { for (int i = 0; i < branch.size(); i++) { - renderBranch(buffer, i == 0 ? origin : new Vec3f(branch.get(i - 1).add(x, y, z)), new Vec3f(branch.get(i).add(x, y, z))); + renderBranch(buffer, i == 0 ? origin : new Vector3f(branch.get(i - 1).add(x, y, z)), new Vector3f(branch.get(i).add(x, y, z))); } } @@ -95,29 +96,29 @@ public class LightningBoltParticle extends AbstractGeometryBasedParticle { RenderSystem.enableCull(); } - private void renderBranch(VertexConsumer buffer, Vec3f from, Vec3f to) { + private void renderBranch(VertexConsumer buffer, Vector3f from, Vector3f to) { float thickness = world.random.nextFloat() / 30 + 0.01F; - renderQuad(buffer, new Vec3f[]{ - new Vec3f(from.getX() - thickness, from.getY(), from.getZ()), - new Vec3f(to.getX() - thickness, to.getY(), to.getZ()), - new Vec3f(to.getX() + thickness, to.getY(), to.getZ()), - new Vec3f(from.getX() + thickness, from.getY(), from.getZ()), + renderQuad(buffer, new Vector3f[]{ + new Vector3f(from.x - thickness, from.y, from.z), + new Vector3f(to.x - thickness, to.y, to.z), + new Vector3f(to.x + thickness, to.y, to.z), + new Vector3f(from.x + thickness, from.y, from.z), - new Vec3f(from.getX() - thickness, from.getY() - thickness * 2, from.getZ()), - new Vec3f(to.getX() - thickness, to.getY() - thickness * 2, to.getZ()), - new Vec3f(to.getX() + thickness, to.getY() - thickness * 2, to.getZ()), - new Vec3f(from.getX() + thickness, from.getY() - thickness * 2, from.getZ()), + new Vector3f(from.x - thickness, from.y - thickness * 2, from.z), + new Vector3f(to.x - thickness, to.y - thickness * 2, to.z), + new Vector3f(to.x + thickness, to.y - thickness * 2, to.z), + new Vector3f(from.x + thickness, from.y - thickness * 2, from.z), - new Vec3f(from.getX(), from.getY() - thickness, from.getZ() + thickness), - new Vec3f(to.getX(), to.getY() - thickness, to.getZ() + thickness), - new Vec3f(to.getX(), to.getY() + thickness, to.getZ() + thickness), - new Vec3f(from.getX(), from.getY() + thickness, from.getZ() + thickness), + new Vector3f(from.x, from.y - thickness, from.z + thickness), + new Vector3f(to.x, to.y - thickness, to.z + thickness), + new Vector3f(to.x, to.y + thickness, to.z + thickness), + new Vector3f(from.x, from.y + thickness, from.z + thickness), - new Vec3f(from.getX() - thickness * 2, from.getY() - thickness, from.getZ() + thickness), - new Vec3f(to.getX() - thickness * 2, to.getY() - thickness, to.getZ() + thickness), - new Vec3f(to.getX() - thickness * 2, to.getY() + thickness, to.getZ() + thickness), - new Vec3f(from.getX() - thickness * 2, from.getY() + thickness, from.getZ() + thickness) + new Vector3f(from.x - thickness * 2, from.y - thickness, from.z + thickness), + new Vector3f(to.x - thickness * 2, to.y - thickness, to.z + thickness), + new Vector3f(to.x - thickness * 2, to.y + thickness, to.z + thickness), + new Vector3f(from.x - thickness * 2, from.y + thickness, from.z + thickness) }, 0.3F, 1); } } diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/MagicParticle.java b/src/main/java/com/minelittlepony/unicopia/client/particle/MagicParticle.java index d0c268e0..700963a6 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/MagicParticle.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/MagicParticle.java @@ -1,5 +1,7 @@ package com.minelittlepony.unicopia.client.particle; +import org.joml.Vector3f; + import com.minelittlepony.unicopia.particle.MagicParticleEffect; import net.minecraft.client.particle.ParticleTextureSheet; @@ -7,14 +9,13 @@ import net.minecraft.client.particle.SpriteBillboardParticle; import net.minecraft.client.particle.SpriteProvider; import net.minecraft.client.world.ClientWorld; import net.minecraft.particle.ParticleEffect; -import net.minecraft.util.math.Vec3f; public class MagicParticle extends SpriteBillboardParticle { private final double startX; private final double startY; private final double startZ; - MagicParticle(ParticleEffect effect, SpriteProvider provider, ClientWorld w, double x, double y, double z, double vX, double vY, double vZ, Vec3f color, float alpha) { + MagicParticle(ParticleEffect effect, SpriteProvider provider, ClientWorld w, double x, double y, double z, double vX, double vY, double vZ, Vector3f color, float alpha) { super(w, x, y, z); setSprite(provider); @@ -27,9 +28,9 @@ public class MagicParticle extends SpriteBillboardParticle { scale = random.nextFloat() * 0.12F; maxAge = (int)(Math.random() * 10) + 20; - red = color.getX(); - green = color.getY(); - blue = color.getZ(); + red = color.x; + green = color.y; + blue = color.z; this.alpha = alpha; } diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/OrientedBillboardParticle.java b/src/main/java/com/minelittlepony/unicopia/client/particle/OrientedBillboardParticle.java index 3d083896..d73d5edd 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/OrientedBillboardParticle.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/OrientedBillboardParticle.java @@ -1,27 +1,30 @@ package com.minelittlepony.unicopia.client.particle; +import org.joml.Quaternionf; +import org.joml.Vector3f; + import com.minelittlepony.unicopia.particle.OrientedBillboardParticleEffect; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.Camera; import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexConsumer; -import net.minecraft.util.math.Vec3f; import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.math.Quaternion; +import net.minecraft.util.math.*; public abstract class OrientedBillboardParticle extends AbstractBillboardParticle { protected boolean fixed; - protected Quaternion rotation = new Quaternion(0, 0, 0, 1); + protected Quaternionf rotation = new Quaternionf(0, 0, 0, 1); public OrientedBillboardParticle(OrientedBillboardParticleEffect effect, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { super(world, x, y, z, velocityX, velocityY, velocityZ); fixed = effect.isAngleFixed(); if (fixed) { - rotation.hamiltonProduct(Vec3f.POSITIVE_Y.getDegreesQuaternion(effect.getPitch())); - rotation.hamiltonProduct(Vec3f.POSITIVE_X.getDegreesQuaternion(180 - effect.getYaw())); + // Was hamiltonianProduct (CHECK THIS!!) + rotation.mul(RotationAxis.POSITIVE_Y.rotationDegrees(effect.getPitch())); + rotation.mul(RotationAxis.POSITIVE_X.rotationDegrees(180 - effect.getYaw())); } } @@ -35,18 +38,18 @@ public abstract class OrientedBillboardParticle extends AbstractBillboardParticl @Override protected void renderQuads(Tessellator te, BufferBuilder buffer, float x, float y, float z, float tickDelta) { - Vec3f[] corners = new Vec3f[]{ - new Vec3f(-1, -1, 0), - new Vec3f(-1, 1, 0), - new Vec3f( 1, 1, 0), - new Vec3f( 1, -1, 0) + Vector3f[] corners = new Vector3f[]{ + new Vector3f(-1, -1, 0), + new Vector3f(-1, 1, 0), + new Vector3f( 1, 1, 0), + new Vector3f( 1, -1, 0) }; float scale = getScale(tickDelta); for(int k = 0; k < 4; ++k) { - Vec3f corner = corners[k]; + Vector3f corner = corners[k]; corner.rotate(rotation); - corner.scale(scale); + corner.mul(scale); corner.add(x, y, z); } diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/RainbowTrailParticle.java b/src/main/java/com/minelittlepony/unicopia/client/particle/RainbowTrailParticle.java index ea3c37af..d8f6f32a 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/RainbowTrailParticle.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/RainbowTrailParticle.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; +import org.joml.Vector3f; + import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.ability.magic.Caster; import com.minelittlepony.unicopia.entity.player.Pony; @@ -13,7 +15,6 @@ import com.minelittlepony.unicopia.particle.ParticleHandle.Link; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.Tessellator; -import net.minecraft.util.math.Vec3f; import net.minecraft.client.world.ClientWorld; import net.minecraft.particle.DefaultParticleType; import net.minecraft.util.Identifier; @@ -62,12 +63,12 @@ public class RainbowTrailParticle extends AbstractBillboardParticle implements A float alpha = 1 - (float)age / maxAge; for (int i = 0; i < segments.size() - 1; i++) { - Vec3f[] corners = segments.get(i).getPlane(segments.get(i + 1)); + Vector3f[] corners = segments.get(i).getPlane(segments.get(i + 1)); float scale = getScale(tickDelta); for (int k = 0; k < 4; ++k) { - Vec3f corner = corners[k]; - corner.scale(scale); + Vector3f corner = corners[k]; + corner.mul(scale); corner.add(x, y, z); } @@ -109,14 +110,14 @@ public class RainbowTrailParticle extends AbstractBillboardParticle implements A private final class Segment { Vec3d position; - Vec3f offset; + Vector3f offset; int age; int maxAge; Segment(Vec3d position) { this.position = position; - this.offset = new Vec3f((float)(position.getX() - x), (float)(position.getY() - y), (float)(position.getZ() - z)); + this.offset = new Vector3f((float)(position.getX() - x), (float)(position.getY() - y), (float)(position.getZ() - z)); this.maxAge = 90; } @@ -128,24 +129,23 @@ public class RainbowTrailParticle extends AbstractBillboardParticle implements A return segments.indexOf(this) < segments.size() - 1 && age++ >= maxAge; } - Vec3f[] getPlane(Segment to) { - float fromX = offset.getX(); - float toX = to.offset.getX(); + Vector3f[] getPlane(Segment to) { + float fromX = offset.x; + float toX = to.offset.x; - float fromZ = offset.getZ(); - float toZ = to.offset.getZ(); + float fromZ = offset.z; + float toZ = to.offset.z; + float fromTopY = offset.y + 1; + float fromBottomY = offset.y; - float fromTopY = offset.getY() + 1; - float fromBottomY = offset.getY(); + float toTopY = to.offset.y + 1; + float toBottomY = to.offset.y; - float toTopY = to.offset.getY() + 1; - float toBottomY = to.offset.getY(); - - return new Vec3f[]{ - new Vec3f(fromX, fromBottomY, fromZ), // bottom left - new Vec3f(fromX, fromTopY, fromZ), // top left - new Vec3f(toX, toTopY, toZ), // top right - new Vec3f(toX, toBottomY, toZ) // bottom right + return new Vector3f[]{ + new Vector3f(fromX, fromBottomY, fromZ), // bottom left + new Vector3f(fromX, fromTopY, fromZ), // top left + new Vector3f(toX, toTopY, toZ), // top right + new Vector3f(toX, toBottomY, toZ) // bottom right }; } } diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/RunesParticle.java b/src/main/java/com/minelittlepony/unicopia/client/particle/RunesParticle.java index 0df431ae..b40679cf 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/RunesParticle.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/RunesParticle.java @@ -2,6 +2,9 @@ package com.minelittlepony.unicopia.client.particle; import java.util.Optional; +import org.joml.Quaternionf; +import org.joml.Vector3f; + import com.minelittlepony.common.util.Color; import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.ability.magic.Caster; @@ -12,12 +15,9 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.Tessellator; -import net.minecraft.util.math.Vec3f; import net.minecraft.client.world.ClientWorld; import net.minecraft.util.Identifier; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Quaternion; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.*; public class RunesParticle extends OrientedBillboardParticle implements Attachment { @@ -89,11 +89,13 @@ public class RunesParticle extends OrientedBillboardParticle implements Attachme targetSize = value.floatValue(); } if (key == ATTR_PITCH) { - rotation = new Quaternion(0, 0, 0, 1); - rotation.hamiltonProduct(Vec3f.POSITIVE_Y.getDegreesQuaternion(value.floatValue())); + rotation = new Quaternionf(0, 0, 0, 1); + // TODO: Was hamiltonianProduct (CHECK!!!) + rotation.mul(RotationAxis.POSITIVE_Y.rotationDegrees(value.floatValue())); } if (key == ATTR_YAW) { - rotation.hamiltonProduct(Vec3f.POSITIVE_X.getDegreesQuaternion(180 - value.floatValue())); + // TODO: Was hamiltonianProduct (CHECK!!!) + rotation.mul(RotationAxis.POSITIVE_X.rotationDegrees(180 - value.floatValue())); } } @@ -129,27 +131,27 @@ public class RunesParticle extends OrientedBillboardParticle implements Attachme RenderSystem.setShaderTexture(0, TEXTURES[i]); RenderSystem.setShaderColor(red, green, blue, alpha / ((float)(dim * 3) + 1)); - Vec3f[] corners = new Vec3f[]{ - new Vec3f(-1, -1, 0), - new Vec3f(-1, 1, 0), - new Vec3f( 1, 1, 0), - new Vec3f( 1, -1, 0) + Vector3f[] corners = new Vector3f[]{ + new Vector3f(-1, -1, 0), + new Vector3f(-1, 1, 0), + new Vector3f( 1, 1, 0), + new Vector3f( 1, -1, 0) }; float scale = getScale(tickDelta); float ringSpeed = (i % 2 == 0 ? i : -1) * i; - Quaternion ringAngle = Vec3f.POSITIVE_Z.getDegreesQuaternion(angle * ringSpeed); - Quaternion ringFlip = Vec3f.POSITIVE_Y.getDegreesQuaternion(angle * ringSpeed * dim); - Quaternion ringRoll = Vec3f.POSITIVE_X.getDegreesQuaternion(angle * ringSpeed * dim); + Quaternionf ringAngle = RotationAxis.POSITIVE_Z.rotationDegrees(angle * ringSpeed); + Quaternionf ringFlip = RotationAxis.POSITIVE_Y.rotationDegrees(angle * ringSpeed * dim); + Quaternionf ringRoll = RotationAxis.POSITIVE_X.rotationDegrees(angle * ringSpeed * dim); for(int k = 0; k < 4; ++k) { - Vec3f corner = corners[k]; + Vector3f corner = corners[k]; corner.rotate(ringAngle); corner.rotate(ringFlip); corner.rotate(ringRoll); corner.rotate(rotation); - corner.scale(scale); + corner.mul(scale); corner.add(x, y + 0.001F, z); } diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/SphereModel.java b/src/main/java/com/minelittlepony/unicopia/client/particle/SphereModel.java index 80c1ff67..588ed1bb 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/SphereModel.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/SphereModel.java @@ -4,13 +4,14 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; +import org.joml.Matrix4f; +import org.joml.Vector4f; + import com.minelittlepony.unicopia.client.gui.DrawableUtil; import net.minecraft.client.render.VertexConsumer; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Matrix4f; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Vector4f; public class SphereModel { public static final SphereModel SPHERE = new SphereModel(40, 40, DrawableUtil.TAU); @@ -35,9 +36,9 @@ public class SphereModel { Matrix4f model = matrices.peek().getPositionMatrix(); for (Vector4f vertex : vertices) { - drawVert.set(vertex.getX() * radius, vertex.getY() * radius, vertex.getZ() * radius, vertex.getW()); - drawVert.transform(model); - vertexWriter.vertex(drawVert.getX(), drawVert.getY(), drawVert.getZ(), r, g, b, a, 0, 0, overlay, light, 0, 0, 0); + drawVert.set(vertex.x * radius, vertex.y * radius, vertex.z * radius, vertex.w); + drawVert.mul(model); + vertexWriter.vertex(drawVert.x, drawVert.y, drawVert.z, r, g, b, a, 0, 0, overlay, light, 0, 0, 0); } } diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/SphereParticle.java b/src/main/java/com/minelittlepony/unicopia/client/particle/SphereParticle.java index 23d46d39..74c36019 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/SphereParticle.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/SphereParticle.java @@ -49,9 +49,9 @@ public class SphereParticle extends Particle implements Attachment { super(w, x, y, z); this.parameters = parameters; this.radius = parameters.getRadius(); - this.red = parameters.getColor().getX() / 255F; - this.green = parameters.getColor().getY() / 255F; - this.blue = parameters.getColor().getZ() / 255F; + this.red = parameters.getColor().x / 255F; + this.green = parameters.getColor().y / 255F; + this.blue = parameters.getColor().z / 255F; this.alpha = parameters.getAlpha(); setMaxAge(10); @@ -157,7 +157,7 @@ public class SphereParticle extends Particle implements Attachment { RenderSystem.enableCull(); RenderSystem.depthMask(true); RenderSystem.setShaderColor(1, 1, 1, 1); - RenderSystem.setShader(GameRenderer::getParticleShader); + RenderSystem.setShader(GameRenderer::getParticleProgram); } protected void renderModel(MatrixStack matrices, VertexConsumer buffer, float lerpedRad, float tickDelta, int light) { diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/AmuletFeatureRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/render/AmuletFeatureRenderer.java index b504b087..f2a2c54f 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/AmuletFeatureRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/AmuletFeatureRenderer.java @@ -24,7 +24,7 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class AmuletFeatureRenderer implements AccessoryFeatureRenderer.Feature { @@ -45,7 +45,7 @@ public class AmuletFeatureRenderer implements AccessoryF ItemStack stack = AmuletItem.getForEntity(entity); if (!stack.isEmpty()) { - Identifier texture = textures.computeIfAbsent(Registry.ITEM.getId(stack.getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png")); + Identifier texture = textures.computeIfAbsent(Registries.ITEM.getId(stack.getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png")); VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(texture), false, false); diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/FloatingArtefactEntityRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/render/FloatingArtefactEntityRenderer.java index f233c3fa..ca0144e8 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/FloatingArtefactEntityRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/FloatingArtefactEntityRenderer.java @@ -14,7 +14,7 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.util.Identifier; -import net.minecraft.util.math.Vec3f; +import net.minecraft.util.math.RotationAxis; public class FloatingArtefactEntityRenderer extends EntityRenderer { @@ -38,14 +38,14 @@ public class FloatingArtefactEntityRenderer extends EntityRenderer implements AccessoryFeatureRenderer.Feature { @@ -39,7 +39,7 @@ public class GlassesFeatureRenderer implements Accessory ItemStack stack = GlassesItem.getForEntity(entity); if (!stack.isEmpty()) { - Identifier texture = textures.computeIfAbsent(Registry.ITEM.getId(stack.getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png")); + Identifier texture = textures.computeIfAbsent(Registries.ITEM.getId(stack.getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png")); VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(texture), false, false); diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/PlayerPoser.java b/src/main/java/com/minelittlepony/unicopia/client/render/PlayerPoser.java index cbec914f..71ef5708 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/PlayerPoser.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/PlayerPoser.java @@ -17,8 +17,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.sound.SoundEvent; import net.minecraft.util.Arm; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3f; +import net.minecraft.util.math.*; public class PlayerPoser { public static final PlayerPoser INSTANCE = new PlayerPoser(); @@ -200,7 +199,7 @@ public class PlayerPoser { private void rearUp(MatrixStack matrices, BipedEntityModel model, float progress) { matrices.translate(0, 0, 0.5); - matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-45 * progress)); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-45 * progress)); matrices.translate(0, 0, -0.5); float roll = progress / 2F; diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/PolearmRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/render/PolearmRenderer.java index e50e3e2d..ece97b2a 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/PolearmRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/PolearmRenderer.java @@ -6,8 +6,8 @@ import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry.DynamicItemRenderer; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.item.ClampedModelPredicateProvider; import net.minecraft.client.item.ModelPredicateProviderRegistry; -import net.minecraft.client.item.UnclampedModelPredicateProvider; import net.minecraft.client.model.*; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.model.TridentEntityModel; @@ -20,9 +20,9 @@ import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.LivingEntity; import net.minecraft.item.*; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; -public class PolearmRenderer implements DynamicItemRenderer, UnclampedModelPredicateProvider { +public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredicateProvider { private static final PolearmRenderer INSTANCE = new PolearmRenderer(); private static final Identifier THROWING = new Identifier("throwing"); @@ -36,8 +36,8 @@ public class PolearmRenderer implements DynamicItemRenderer, UnclampedModelPredi } static ModelIdentifier getModelId(ItemConvertible item) { - Identifier id = Registry.ITEM.getId(item.asItem()); - return new ModelIdentifier(id.toString() + "_in_inventory#inventory"); + Identifier id = Registries.ITEM.getId(item.asItem()); + return new ModelIdentifier(new Identifier(id.getNamespace(), id.getPath() + "_in_inventory"), "inventory"); } public static TexturedModelData getTexturedModelData() { @@ -68,7 +68,7 @@ public class PolearmRenderer implements DynamicItemRenderer, UnclampedModelPredi } else { matrices.push(); matrices.scale(1, -1, -1); - Identifier id = Registry.ITEM.getId(stack.getItem()); + Identifier id = Registries.ITEM.getId(stack.getItem()); Identifier texture = new Identifier(id.getNamespace(), "textures/entity/polearm/" + id.getPath() + ".png"); model.render(matrices, MineLPDelegate.getInstance().getItemBuffer(vertexConsumers, texture).orElseGet(() -> { return ItemRenderer.getDirectItemGlintConsumer(vertexConsumers, model.getLayer(texture), false, stack.hasGlint()); diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/RenderLayers.java b/src/main/java/com/minelittlepony/unicopia/client/render/RenderLayers.java index b73c6191..1d9addd8 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/RenderLayers.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/RenderLayers.java @@ -17,7 +17,7 @@ public final class RenderLayers extends RenderLayer { private static final RenderLayer MAGIC_NO_COLOR = of("magic_no_color", VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, VertexFormat.DrawMode.QUADS, 256, true, true, MultiPhaseParameters.builder() - .shader(COLOR_SHADER) + .program(COLOR_PROGRAM) .transparency(TRANSLUCENT_TRANSPARENCY) .target(TRANSLUCENT_TARGET) .build(false)); @@ -27,7 +27,7 @@ public final class RenderLayers extends RenderLayer { VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, VertexFormat.DrawMode.QUADS, 256, true, true, MultiPhaseParameters.builder() - .shader(COLOR_SHADER) + .program(COLOR_PROGRAM) .transparency(TRANSLUCENT_TRANSPARENCY) // .target(TRANSLUCENT_TARGET) .texturing(solid(Color.r(color), Color.g(color), Color.b(color), 0.6F)) diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java b/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java index 0fc17037..c928509c 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java @@ -25,15 +25,12 @@ import net.minecraft.client.render.entity.EntityRenderer; import net.minecraft.client.render.entity.LivingEntityRenderer; import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Vec3f; import net.minecraft.entity.*; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.vehicle.BoatEntity; import net.minecraft.state.property.Properties; import net.minecraft.util.Identifier; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.*; public class WorldRenderDelegate { public static final WorldRenderDelegate INSTANCE = new WorldRenderDelegate(); @@ -119,8 +116,8 @@ public class WorldRenderDelegate { matrices.translate(x, y + owner.getHeight() / 2, z); - matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(roll)); - matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(roll)); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(roll)); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(roll)); if (pony instanceof Pony) { roll = ((Pony)pony).getCamera().calculateRoll(); @@ -128,9 +125,9 @@ public class WorldRenderDelegate { roll -= 180; } - matrices.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion(yaw)); - matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(roll)); - matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw)); + matrices.multiply(RotationAxis.NEGATIVE_Y.rotationDegrees(yaw)); + matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(roll)); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yaw)); } matrices.translate(-x, -y - owner.getHeight() / 2, -z); @@ -205,7 +202,7 @@ public class WorldRenderDelegate { matrices.translate(x, y, z); matrices.multiply(direction.getRotationQuaternion()); - matrices.multiply(Vec3f.NEGATIVE_X.getDegreesQuaternion(90)); + matrices.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(90)); matrices.translate(-0.5, 0, -0.5); diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/entity/SpellbookEntityRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/render/entity/SpellbookEntityRenderer.java index f4e555f5..cb2f955b 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/entity/SpellbookEntityRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/entity/SpellbookEntityRenderer.java @@ -1,8 +1,5 @@ package com.minelittlepony.unicopia.client.render.entity; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3f; - import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.entity.SpellbookEntity; @@ -10,6 +7,7 @@ import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.LivingEntityRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; +import net.minecraft.util.math.*; public class SpellbookEntityRenderer extends LivingEntityRenderer { private static final Identifier TEXTURE = Unicopia.id("textures/entity/spellbook/normal.png"); @@ -38,11 +36,11 @@ public class SpellbookEntityRenderer extends LivingEntityRenderer uniformValues = new Object2FloatOpenHashMap<>(); - private Multimap programs; + private Multimap programs; private final Identifier id; @@ -111,8 +111,8 @@ public class ViewportShader implements SynchronousResourceReloader, Identifiable } @Override - public PostProcessShader addPass(String programName, Framebuffer source, Framebuffer dest) throws IOException { - PostProcessShader pass = super.addPass(programName, source, dest); + public PostEffectPass addPass(String programName, Framebuffer source, Framebuffer dest) throws IOException { + PostEffectPass pass = super.addPass(programName, source, dest); if (programs == null) { programs = LinkedListMultimap.create(); } diff --git a/src/main/java/com/minelittlepony/unicopia/client/sound/FadeOutSoundInstance.java b/src/main/java/com/minelittlepony/unicopia/client/sound/FadeOutSoundInstance.java index 78f81264..8eec167b 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/sound/FadeOutSoundInstance.java +++ b/src/main/java/com/minelittlepony/unicopia/client/sound/FadeOutSoundInstance.java @@ -98,6 +98,6 @@ public abstract class FadeOutSoundInstance extends MovingSoundInstance { if (muted) { return 0.001F; } - return getLerpedVolume() * sound.getVolume().get(field_38800); + return getLerpedVolume() * sound.getVolume().get(random); } } diff --git a/src/main/java/com/minelittlepony/unicopia/command/Commands.java b/src/main/java/com/minelittlepony/unicopia/command/Commands.java index 5650c0a1..c182bb62 100644 --- a/src/main/java/com/minelittlepony/unicopia/command/Commands.java +++ b/src/main/java/com/minelittlepony/unicopia/command/Commands.java @@ -23,7 +23,7 @@ public class Commands { if (Unicopia.getConfig().enableCheats.get()) { SpeciesCommand.register(dispatcher); GravityCommand.register(dispatcher); - DisguiseCommand.register(dispatcher); + DisguiseCommand.register(dispatcher, access); if (Debug.DEBUG_COMMANDS) { TraitCommand.register(dispatcher); ManaCommand.register(dispatcher); diff --git a/src/main/java/com/minelittlepony/unicopia/command/DisguiseCommand.java b/src/main/java/com/minelittlepony/unicopia/command/DisguiseCommand.java index 701b4864..0eb9a4ff 100644 --- a/src/main/java/com/minelittlepony/unicopia/command/DisguiseCommand.java +++ b/src/main/java/com/minelittlepony/unicopia/command/DisguiseCommand.java @@ -15,47 +15,47 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.command.argument.EntitySummonArgumentType; -import net.minecraft.command.argument.NbtCompoundArgumentType; +import net.minecraft.command.CommandRegistryAccess; +import net.minecraft.command.argument.*; import net.minecraft.command.suggestion.SuggestionProviders; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.server.command.CommandManager; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.Text; -import net.minecraft.util.Identifier; import net.minecraft.world.GameRules; public class DisguiseCommand { private static final SimpleCommandExceptionType FAILED_EXCEPTION = new SimpleCommandExceptionType(Text.translatable("commands.disguise.notfound")); - public static void register(CommandDispatcher dispatcher) { + public static void register(CommandDispatcher dispatcher, CommandRegistryAccess registries) { dispatcher.register(CommandManager .literal("disguise") .requires(s -> s.hasPermissionLevel(2)) .executes(context -> reveal(context.getSource(), context.getSource().getPlayer())) .then( CommandManager.argument("target", EntityArgumentType.players()) - .then(buildEntityDisguise(context -> EntityArgumentType.getPlayer(context, "target"))) + .then(buildEntityDisguise(context -> EntityArgumentType.getPlayer(context, "target"), registries)) .then(buildPlayerDisguise(context -> EntityArgumentType.getPlayer(context, "target"))) ) - .then(buildEntityDisguise(context -> context.getSource().getPlayer())) + .then(buildEntityDisguise(context -> context.getSource().getPlayer(), registries)) .then(buildPlayerDisguise(context -> context.getSource().getPlayer())) ); } - private static ArgumentBuilder buildEntityDisguise(Arg targetOp) { - return CommandManager.argument("entity", EntitySummonArgumentType.entitySummon()) + private static ArgumentBuilder buildEntityDisguise(Arg targetOp, CommandRegistryAccess registries) { + return CommandManager.argument("entity", RegistryEntryArgumentType.registryEntry(registries, RegistryKeys.ENTITY_TYPE)) .suggests(SuggestionProviders.SUMMONABLE_ENTITIES) .executes(context -> disguise( context.getSource(), targetOp.apply(context), loadEntity(context.getSource(), - EntitySummonArgumentType.getEntitySummon(context, "entity"), + RegistryEntryArgumentType.getSummonableEntityType(context, "entity"), new NbtCompound()))) .then( CommandManager.argument("nbt", NbtCompoundArgumentType.nbtCompound()) @@ -63,7 +63,7 @@ public class DisguiseCommand { context.getSource(), targetOp.apply(context), loadEntity(context.getSource(), - EntitySummonArgumentType.getEntitySummon(context, "entity"), + RegistryEntryArgumentType.getSummonableEntityType(context, "entity"), NbtCompoundArgumentType.getNbtCompound(context, "nbt")))) ); } @@ -99,9 +99,9 @@ public class DisguiseCommand { return 0; } - static Entity loadEntity(ServerCommandSource source, Identifier id, NbtCompound nbt) { + static Entity loadEntity(ServerCommandSource source, RegistryEntry.Reference> entityType, NbtCompound nbt) { nbt = nbt.copy(); - nbt.putString("id", id.toString()); + nbt.putString("id", entityType.registryKey().getValue().toString()); return EntityType.loadEntityWithPassengers(nbt, source.getWorld(), Function.identity()); } diff --git a/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreenHandler.java b/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreenHandler.java index 2521d2ab..2a61fa0c 100644 --- a/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreenHandler.java +++ b/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreenHandler.java @@ -185,7 +185,7 @@ public class SpellbookScreenHandler extends ScreenHandler { } @Override - public ItemStack transferSlot(PlayerEntity player, int index) { + public ItemStack quickMove(PlayerEntity player, int index) { Slot sourceSlot = slots.get(index); if (sourceSlot == null || !sourceSlot.hasStack()) { diff --git a/src/main/java/com/minelittlepony/unicopia/container/UScreenHandlers.java b/src/main/java/com/minelittlepony/unicopia/container/UScreenHandlers.java index 07f99b2b..f2fba259 100644 --- a/src/main/java/com/minelittlepony/unicopia/container/UScreenHandlers.java +++ b/src/main/java/com/minelittlepony/unicopia/container/UScreenHandlers.java @@ -5,13 +5,14 @@ import com.minelittlepony.unicopia.Unicopia; import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; public interface UScreenHandlers { ScreenHandlerType SPELL_BOOK = register("spell_book", new ExtendedScreenHandlerType<>(SpellbookScreenHandler::new)); static ScreenHandlerType register(String name, ScreenHandlerType type) { - return Registry.register(Registry.SCREEN_HANDLER, Unicopia.id(name), type); + return Registry.register(Registries.SCREEN_HANDLER, Unicopia.id(name), type); } static void bootstrap() { } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/ButterflyEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/ButterflyEntity.java index 4cd679fd..06fdfae3 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/ButterflyEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/ButterflyEntity.java @@ -26,7 +26,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.nbt.NbtCompound; import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.sound.SoundEvent; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; diff --git a/src/main/java/com/minelittlepony/unicopia/entity/CastSpellEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/CastSpellEntity.java index 7ed61a94..35f96bec 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/CastSpellEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/CastSpellEntity.java @@ -19,6 +19,7 @@ import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.data.TrackedDataHandlerRegistry; import net.minecraft.nbt.NbtCompound; import net.minecraft.network.Packet; +import net.minecraft.network.listener.ClientPlayPacketListener; import net.minecraft.text.Text; import net.minecraft.world.World; @@ -146,7 +147,7 @@ public class CastSpellEntity extends LightEmittingEntity implements Caster createSpawnPacket() { + public Packet createSpawnPacket() { return Channel.SERVER_SPAWN_PROJECTILE.toPacket(new MsgSpawnProjectile(this)); } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/Creature.java b/src/main/java/com/minelittlepony/unicopia/entity/Creature.java index f3b8d607..95ff0cfe 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/Creature.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/Creature.java @@ -142,7 +142,7 @@ public class Creature extends Living implements WeaklyOwned true); targets.add(2, new ActiveTargetGoal<>((MobEntity)entity, PlayerEntity.class, true, filter)); targets.add(2, new ActiveTargetGoal<>((MobEntity)entity, HostileEntity.class, true, filter)); targets.add(2, new ActiveTargetGoal<>((MobEntity)entity, SlimeEntity.class, true, filter)); diff --git a/src/main/java/com/minelittlepony/unicopia/entity/Enchantments.java b/src/main/java/com/minelittlepony/unicopia/entity/Enchantments.java index d0457df4..1bad3bdd 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/Enchantments.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/Enchantments.java @@ -20,7 +20,7 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtList; import net.minecraft.nbt.NbtString; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class Enchantments implements NbtSerialisable, Tickable { @@ -77,7 +77,7 @@ public class Enchantments implements NbtSerialisable, Tickable { public void toNBT(NbtCompound compound) { NbtList list = new NbtList(); equippedEnchantments.forEach(enchant -> { - Identifier id = Registry.ENCHANTMENT.getId(enchant); + Identifier id = Registries.ENCHANTMENT.getId(enchant); if (id != null) { list.add(NbtString.of(id.toString())); } @@ -90,7 +90,7 @@ public class Enchantments implements NbtSerialisable, Tickable { equippedEnchantments.clear(); if (compound.contains("enchants")) { compound.getList("enchants", 8).forEach(tag -> { - Registry.ENCHANTMENT.getOrEmpty(new Identifier(tag.asString())).ifPresent(equippedEnchantments::add); + Registries.ENCHANTMENT.getOrEmpty(new Identifier(tag.asString())).ifPresent(equippedEnchantments::add); }); } } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/EntityPhysics.java b/src/main/java/com/minelittlepony/unicopia/entity/EntityPhysics.java index d7bbfdca..ade7dbfb 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/EntityPhysics.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/EntityPhysics.java @@ -14,7 +14,7 @@ import net.minecraft.entity.mob.MobEntity; import net.minecraft.nbt.NbtCompound; import net.minecraft.particle.BlockStateParticleEffect; import net.minecraft.particle.ParticleTypes; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; diff --git a/src/main/java/com/minelittlepony/unicopia/entity/FloatingArtefactEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/FloatingArtefactEntity.java index ee448544..a3f785c0 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/FloatingArtefactEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/FloatingArtefactEntity.java @@ -14,6 +14,7 @@ import net.minecraft.entity.data.TrackedDataHandlerRegistry; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.network.Packet; +import net.minecraft.network.listener.ClientPlayPacketListener; import net.minecraft.util.ActionResult; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; @@ -185,7 +186,7 @@ public class FloatingArtefactEntity extends Entity { } @Override - public Packet createSpawnPacket() { + public Packet createSpawnPacket() { return Channel.SERVER_SPAWN_PROJECTILE.toPacket(new MsgSpawnProjectile(this)); } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/ItemTracker.java b/src/main/java/com/minelittlepony/unicopia/entity/ItemTracker.java index ba9ec151..5c8474d6 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/ItemTracker.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/ItemTracker.java @@ -13,7 +13,7 @@ import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class ItemTracker implements NbtSerialisable, Copyable { public static final long TICKS = 1; @@ -92,7 +92,7 @@ public class ItemTracker implements NbtSerialisable, Copyable { @Override public void toNBT(NbtCompound compound) { items.forEach((charm, count) -> { - compound.putLong(Registry.ITEM.getId(charm.asItem()).toString(), count); + compound.putLong(Registries.ITEM.getId(charm.asItem()).toString(), count); }); } @@ -101,7 +101,7 @@ public class ItemTracker implements NbtSerialisable, Copyable { items.clear(); compound.getKeys().stream().map(Identifier::tryParse) .filter(Objects::nonNull) - .map(id -> Map.entry(Registry.ITEM.get(id), compound.getLong(id.toString()))) + .map(id -> Map.entry(Registries.ITEM.get(id), compound.getLong(id.toString()))) .filter(i -> i.getKey() instanceof Trackable && i.getValue() > 0) .forEach(item -> items.put((Trackable)item.getKey(), item.getValue())); } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/PhysicsBodyProjectileEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/PhysicsBodyProjectileEntity.java index 3f0e5f3e..2187faff 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/PhysicsBodyProjectileEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/PhysicsBodyProjectileEntity.java @@ -175,7 +175,7 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl @Override protected SoundEvent getHitSound() { - return isBouncy() ? SoundEvents.BLOCK_NOTE_BLOCK_BANJO : SoundEvents.BLOCK_STONE_HIT; + return isBouncy() ? SoundEvents.BLOCK_NOTE_BLOCK_BANJO.value() : SoundEvents.BLOCK_STONE_HIT; } @Override diff --git a/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java b/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java index e0dac9e9..db0697f1 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java @@ -17,9 +17,8 @@ import net.minecraft.entity.EntityType; import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.decoration.painting.PaintingVariant; import net.minecraft.entity.mob.FlyingEntity; -import net.minecraft.tag.BiomeTags; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; +import net.minecraft.registry.*; +import net.minecraft.registry.tag.BiomeTags; import net.minecraft.world.biome.Biome; public interface UEntities { @@ -55,7 +54,7 @@ public interface UEntities { static EntityType register(String name, FabricEntityTypeBuilder builder) { EntityType type = builder.build(); - return Registry.register(Registry.ENTITY_TYPE, Unicopia.id(name), type); + return Registry.register(Registries.ENTITY_TYPE, Unicopia.id(name), type); } static void bootstrap() { @@ -87,7 +86,7 @@ public interface UEntities { interface Paintings { private static void register(String id, int width, int height) { - Registry.register(Registry.PAINTING_VARIANT, RegistryKey.of(Registry.PAINTING_VARIANT_KEY, Unicopia.id(id)), new PaintingVariant(16 * width, 16 * height)); + Registry.register(Registries.PAINTING_VARIANT, RegistryKey.of(RegistryKeys.PAINTING_VARIANT, Unicopia.id(id)), new PaintingVariant(16 * width, 16 * height)); } static void bootstrap() { diff --git a/src/main/java/com/minelittlepony/unicopia/entity/UEntityAttributes.java b/src/main/java/com/minelittlepony/unicopia/entity/UEntityAttributes.java index dad58c6c..fdc51b3d 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/UEntityAttributes.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/UEntityAttributes.java @@ -8,7 +8,8 @@ import com.minelittlepony.unicopia.Unicopia; import net.minecraft.entity.attribute.ClampedEntityAttribute; import net.minecraft.entity.attribute.EntityAttribute; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; public interface UEntityAttributes { List REGISTRY = new ArrayList<>(); @@ -20,7 +21,7 @@ public interface UEntityAttributes { private static EntityAttribute register(String name, EntityAttribute attribute) { REGISTRY.add(attribute); - return Registry.register(Registry.ATTRIBUTE, Unicopia.id(name), attribute); + return Registry.register(Registries.ATTRIBUTE, Unicopia.id(name), attribute); } static void bootstrap() {} diff --git a/src/main/java/com/minelittlepony/unicopia/entity/UTradeOffers.java b/src/main/java/com/minelittlepony/unicopia/entity/UTradeOffers.java index 59b4eaf7..ab9f2783 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/UTradeOffers.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/UTradeOffers.java @@ -13,8 +13,8 @@ import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.tag.ItemTags; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Util; import net.minecraft.util.math.random.Random; import net.minecraft.village.TradeOffer; diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/AxolotlBehaviour.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/AxolotlBehaviour.java index 2abe50a6..8fb0b43f 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/AxolotlBehaviour.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/AxolotlBehaviour.java @@ -1,9 +1,10 @@ package com.minelittlepony.unicopia.entity.behaviour; +import org.joml.Vector3f; + import com.minelittlepony.unicopia.ability.magic.Caster; import net.minecraft.entity.passive.AxolotlEntity; -import net.minecraft.util.math.Vec3f; public class AxolotlBehaviour extends EntityBehaviour { private static final float toRad = 0.017453292F; @@ -12,11 +13,11 @@ public class AxolotlBehaviour extends EntityBehaviour { if (entity.getModelAngles().isEmpty()) { return; } - Vec3f current = entity.getModelAngles().get("body"); - entity.getModelAngles().put("body", new Vec3f( + Vector3f current = entity.getModelAngles().get("body"); + entity.getModelAngles().put("body", new Vector3f( source.getEntity().isSubmergedInWater() ? source.getEntity().getPitch() * toRad : 0, 0, - current == null ? 0 : current.getZ() + current == null ? 0 : current.z )); } } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/Disguise.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/Disguise.java index f315f994..08f5e53c 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/Disguise.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/Disguise.java @@ -118,7 +118,7 @@ public interface Disguise extends FlightType.Provider, PlayerDimensions.Provider } public static abstract class PlayerAccess extends PlayerEntity { - public PlayerAccess() { super(null, null, 0, null, null); } + public PlayerAccess() { super(null, null, 0, null); } public static TrackedData getModelBitFlag() { return PLAYER_MODEL_PARTS; } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java index c5c9acb2..a3c16c10 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java @@ -33,7 +33,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.sound.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; public class EntityBehaviour { diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/FallingBlockBehaviour.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/FallingBlockBehaviour.java index 6444daa3..6ec22c28 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/FallingBlockBehaviour.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/FallingBlockBehaviour.java @@ -23,7 +23,7 @@ import net.minecraft.entity.EntityDimensions; import net.minecraft.entity.FallingBlockEntity; import net.minecraft.entity.damage.DamageSource; import net.minecraft.state.property.Properties; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; diff --git a/src/main/java/com/minelittlepony/unicopia/entity/effect/RaceChangeStatusEffect.java b/src/main/java/com/minelittlepony/unicopia/entity/effect/RaceChangeStatusEffect.java index 02c57f2e..b1fdae5d 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/effect/RaceChangeStatusEffect.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/effect/RaceChangeStatusEffect.java @@ -17,7 +17,8 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.particle.ParticleTypes; import net.minecraft.text.Text; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; public class RaceChangeStatusEffect extends StatusEffect { public static final int STAGE_DURATION = 200; @@ -33,7 +34,7 @@ public class RaceChangeStatusEffect extends StatusEffect { public static StatusEffect register(int color, Race race) { Identifier id = Race.REGISTRY.getId(race); - return Registry.register(Registry.STATUS_EFFECT, + return Registry.register(Registries.STATUS_EFFECT, new Identifier(id.getNamespace(), "change_race_" + id.getPath().toLowerCase()), new RaceChangeStatusEffect(color, race) ); diff --git a/src/main/java/com/minelittlepony/unicopia/entity/effect/UEffects.java b/src/main/java/com/minelittlepony/unicopia/entity/effect/UEffects.java index fa191be7..a01fbb5f 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/effect/UEffects.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/effect/UEffects.java @@ -4,7 +4,8 @@ import com.minelittlepony.unicopia.Unicopia; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectCategory; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; public interface UEffects { StatusEffect FOOD_POISONING = register("food_poisoning", new FoodPoisoningStatusEffect(3484199)); @@ -13,7 +14,7 @@ public interface UEffects { StatusEffect PARALYSIS = register("paralysis", new StatusEffect(StatusEffectCategory.HARMFUL, 0) {}); private static StatusEffect register(String name, StatusEffect effect) { - return Registry.register(Registry.STATUS_EFFECT, Unicopia.id(name), effect); + return Registry.register(Registries.STATUS_EFFECT, Unicopia.id(name), effect); } static void bootstrap() {} diff --git a/src/main/java/com/minelittlepony/unicopia/entity/effect/UPotions.java b/src/main/java/com/minelittlepony/unicopia/entity/effect/UPotions.java index 900aad1c..7f287e4f 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/effect/UPotions.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/effect/UPotions.java @@ -4,7 +4,8 @@ import com.minelittlepony.unicopia.Unicopia; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.potion.Potion; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; public interface UPotions { Potion TRIBE_SWAP_EARTH_PONY = register("tribe_swap_earth", new Potion("unicopia.tribe_swap_earth", new StatusEffectInstance(RaceChangeStatusEffect.CHANGE_RACE_EARTH, RaceChangeStatusEffect.MAX_DURATION))); @@ -14,7 +15,7 @@ public interface UPotions { Potion TRIBE_SWAP_CHANGELING = register("tribe_swap_changeling", new Potion("unicopia.tribe_swap_changeling", new StatusEffectInstance(RaceChangeStatusEffect.CHANGE_RACE_CHANGELING, RaceChangeStatusEffect.MAX_DURATION))); static Potion register(String name, Potion potion) { - return Registry.register(Registry.POTION, Unicopia.id(name), potion); + return Registry.register(Registries.POTION, Unicopia.id(name), potion); } static void bootstrap() { diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerCharmTracker.java b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerCharmTracker.java index 53afef2d..a77a6f88 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerCharmTracker.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerCharmTracker.java @@ -44,7 +44,7 @@ public class PlayerCharmTracker implements NbtSerialisable { public void equipSpell(Hand hand, CustomisedSpellType spell) { handSpells[hand.ordinal()] = spell; - pony.getMaster().playSound(SoundEvents.UI_BUTTON_CLICK, 0.25F, 1.75F); + pony.getMaster().playSound(SoundEvents.UI_BUTTON_CLICK.value(), 0.25F, 1.75F); pony.setDirty(); } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyClientPlayerEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyClientPlayerEntity.java index 582bf617..879993e8 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyClientPlayerEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyClientPlayerEntity.java @@ -1,7 +1,5 @@ package com.minelittlepony.unicopia.entity.player.dummy; -import java.util.List; - import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -16,8 +14,6 @@ import net.minecraft.client.network.PlayerListEntry; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket; -import net.minecraft.text.Text; import net.minecraft.world.GameMode; public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implements Owned { @@ -27,7 +23,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen private PlayerEntity owner; public DummyClientPlayerEntity(ClientWorld world, GameProfile profile) { - super(world, profile, null); + super(world, profile); } @Override @@ -49,7 +45,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen playerInfo = connection.getPlayerListEntry(getGameProfile().getId()); if (playerInfo == null) { - playerInfo = new PlayerListEntry(new Packet().entry(), MinecraftClient.getInstance().getServicesSignatureVerifier(), false); + playerInfo = new PlayerListEntry(getGameProfile(), false); } } @@ -76,18 +72,4 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen public void setMaster(PlayerEntity owner) { this.owner = owner; } - - private final class Packet extends PlayerListS2CPacket { - public Packet() { - super(PlayerListS2CPacket.Action.ADD_PLAYER, List.of()); - } - - PlayerListS2CPacket.Entry entry() { - return new PlayerListS2CPacket.Entry( - getGameProfile(), - 0, - GameMode.DEFAULT, - Text.literal(getGameProfile().getName()), null); - } - } } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyPlayerEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyPlayerEntity.java index 2ee53e5b..2e7fd144 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyPlayerEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/dummy/DummyPlayerEntity.java @@ -17,7 +17,7 @@ public class DummyPlayerEntity extends PlayerEntity implements Owned items) { super.appendStacks(tab, items); - if (isIn(tab)) { + if (tab.contains(getDefaultStack())) { Unicopia.SIDE.getPony().map(Pony::getReferenceWorld) .stream() .flatMap(world -> Registries.valuesForTag(world, UTags.APPLES)) .filter(a -> a != this).forEach(item -> { ItemStack stack = new ItemStack(this); - stack.getOrCreateNbt().putString("appearance", Registry.ITEM.getId(item).toString()); + stack.getOrCreateNbt().putString("appearance", Registries.ITEM.getId(item).toString()); items.add(stack); }); } diff --git a/src/main/java/com/minelittlepony/unicopia/item/ZapAppleRecipe.java b/src/main/java/com/minelittlepony/unicopia/item/ZapAppleRecipe.java index 13e887c2..82c1d162 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/ZapAppleRecipe.java +++ b/src/main/java/com/minelittlepony/unicopia/item/ZapAppleRecipe.java @@ -8,21 +8,24 @@ import net.minecraft.item.ItemStack; import net.minecraft.network.PacketByteBuf; import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.ShapelessRecipe; +import net.minecraft.recipe.book.CraftingRecipeCategory; import net.minecraft.util.Identifier; import net.minecraft.util.JsonHelper; import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class ZapAppleRecipe extends ShapelessRecipe { - public ZapAppleRecipe(Identifier id, String group, ItemStack output, DefaultedList input) { - super(id, group, output, input); + public ZapAppleRecipe(Identifier id, String group, CraftingRecipeCategory category, ItemStack output, DefaultedList input) { + super(id, group, category, output, input); } public static class Serializer extends ShapelessRecipe.Serializer { @Override public ShapelessRecipe read(Identifier identifier, JsonObject json) { String group = JsonHelper.getString(json, "group", ""); + @SuppressWarnings("deprecation") + CraftingRecipeCategory category = CraftingRecipeCategory.CODEC.byId(JsonHelper.getString(json, "category", null), CraftingRecipeCategory.MISC); DefaultedList ingredients = URecipes.getIngredients(JsonHelper.getArray(json, "ingredients")); if (ingredients.isEmpty()) { @@ -33,7 +36,7 @@ public class ZapAppleRecipe extends ShapelessRecipe { Identifier id = new Identifier(JsonHelper.getString(json, "appearance")); - return new ZapAppleRecipe(identifier, group, UItems.ZAP_APPLE.setAppearance(UItems.ZAP_APPLE.getDefaultStack(), Registry.ITEM.getOrEmpty(id).orElseThrow(() -> { + return new ZapAppleRecipe(identifier, group, category, UItems.ZAP_APPLE.setAppearance(UItems.ZAP_APPLE.getDefaultStack(), Registries.ITEM.getOrEmpty(id).orElseThrow(() -> { return new JsonSyntaxException("Unknown item '" + id + "'"); }).getDefaultStack()), ingredients); } @@ -41,6 +44,7 @@ public class ZapAppleRecipe extends ShapelessRecipe { @Override public ShapelessRecipe read(Identifier identifier, PacketByteBuf input) { String group = input.readString(32767); + CraftingRecipeCategory category = input.readEnumConstant(CraftingRecipeCategory.class); DefaultedList ingredients = DefaultedList.ofSize(input.readVarInt(), Ingredient.EMPTY); @@ -48,7 +52,7 @@ public class ZapAppleRecipe extends ShapelessRecipe { ingredients.set(j, Ingredient.fromPacket(input)); } - return new ZapAppleRecipe(identifier, group, input.readItemStack(), ingredients); + return new ZapAppleRecipe(identifier, group, category, input.readItemStack(), ingredients); } } } diff --git a/src/main/java/com/minelittlepony/unicopia/item/enchantment/PoisonedJokeEnchantment.java b/src/main/java/com/minelittlepony/unicopia/item/enchantment/PoisonedJokeEnchantment.java index 7fc0cde5..cd83b2fc 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/enchantment/PoisonedJokeEnchantment.java +++ b/src/main/java/com/minelittlepony/unicopia/item/enchantment/PoisonedJokeEnchantment.java @@ -22,7 +22,7 @@ import net.minecraft.sound.SoundEvent; import net.minecraft.util.Identifier; import net.minecraft.util.math.random.Random; import net.minecraft.util.profiler.Profiler; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class PoisonedJokeEnchantment extends SimpleEnchantment implements IdentifiableResourceReloadListener { private static final Identifier ID = Unicopia.id("data/poisoned_joke_sounds"); @@ -84,7 +84,7 @@ public class PoisonedJokeEnchantment extends SimpleEnchantment implements Identi } private Stream findSound(Identifier id) { - return Registry.SOUND_EVENT.getOrEmpty(id).map(Stream::of).orElseGet(() -> { + return Registries.SOUND_EVENT.getOrEmpty(id).map(Stream::of).orElseGet(() -> { Unicopia.LOGGER.warn("Could not find sound with id {}", id); return Stream.empty(); }); diff --git a/src/main/java/com/minelittlepony/unicopia/item/enchantment/UEnchantments.java b/src/main/java/com/minelittlepony/unicopia/item/enchantment/UEnchantments.java index f3f1d54d..c58531d8 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/enchantment/UEnchantments.java +++ b/src/main/java/com/minelittlepony/unicopia/item/enchantment/UEnchantments.java @@ -14,7 +14,8 @@ import net.minecraft.entity.attribute.EntityAttributeModifier; import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.attribute.EntityAttributeModifier.Operation; import net.minecraft.enchantment.EnchantmentTarget; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; public interface UEnchantments { @@ -81,6 +82,6 @@ public interface UEnchantments { static T register(String name, T enchantment) { REGISTRY.add(enchantment); - return Registry.register(Registry.ENCHANTMENT, Unicopia.id(name), enchantment); + return Registry.register(Registries.ENCHANTMENT, Unicopia.id(name), enchantment); } } diff --git a/src/main/java/com/minelittlepony/unicopia/item/toxin/ToxicRegistryEntry.java b/src/main/java/com/minelittlepony/unicopia/item/toxin/ToxicRegistryEntry.java index e8c50150..2db1d93f 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/toxin/ToxicRegistryEntry.java +++ b/src/main/java/com/minelittlepony/unicopia/item/toxin/ToxicRegistryEntry.java @@ -1,7 +1,7 @@ package com.minelittlepony.unicopia.item.toxin; import net.minecraft.item.Item; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.tag.TagKey; public record ToxicRegistryEntry ( Toxic value, diff --git a/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxics.java b/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxics.java index ede64970..8dbe1f4a 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxics.java +++ b/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxics.java @@ -3,7 +3,7 @@ package com.minelittlepony.unicopia.item.toxin; import com.minelittlepony.unicopia.*; import com.minelittlepony.unicopia.util.Registries; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; import static com.minelittlepony.unicopia.item.toxin.Toxicity.*; import static com.minelittlepony.unicopia.item.toxin.Ailment.*; diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/MixinBoatEntity.java b/src/main/java/com/minelittlepony/unicopia/mixin/MixinBoatEntity.java index 3f049d53..fdc0fff1 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/MixinBoatEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/MixinBoatEntity.java @@ -14,8 +14,8 @@ import net.minecraft.entity.vehicle.BoatEntity; import net.minecraft.fluid.Fluid; import net.minecraft.nbt.NbtCompound; import net.minecraft.particle.ParticleTypes; -import net.minecraft.tag.FluidTags; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.tag.FluidTags; +import net.minecraft.registry.tag.TagKey; @Mixin(BoatEntity.class) abstract class MixinBoatEntity extends Entity implements LavaAffine { diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayerEntity.java b/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayerEntity.java index 40bec613..081f5da7 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayerEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayerEntity.java @@ -15,7 +15,7 @@ import net.minecraft.server.network.ServerPlayerEntity; @Mixin(ServerPlayerEntity.class) abstract class MixinServerPlayerEntity extends PlayerEntity implements ScreenHandlerListener, PonyContainer, ServerPlayerEntityDuck { - MixinServerPlayerEntity() {super(null, null, 0, null, null);} + MixinServerPlayerEntity() {super(null, null, 0, null);} @Override @Accessor("inTeleportationState") diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinGameRenderer.java b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinGameRenderer.java index 1dd59d85..d71373fb 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinGameRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinGameRenderer.java @@ -15,7 +15,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.Camera; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Vec3f; +import net.minecraft.util.math.RotationAxis; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.resource.SynchronousResourceReloader; @@ -36,7 +36,7 @@ abstract class MixinGameRenderer implements AutoCloseable, SynchronousResourceRe @Inject(method = "renderWorld(FJLnet/minecraft/client/util/math/MatrixStack;)V", at = @At("HEAD")) private void beforeRenderWorld(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo info) { - UnicopiaClient.getCamera().ifPresent(c -> matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(c.calculateRoll()))); + UnicopiaClient.getCamera().ifPresent(c -> matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(c.calculateRoll()))); BatEyesApplicator.INSTANCE.enable(); } diff --git a/src/main/java/com/minelittlepony/unicopia/network/handler/ClientNetworkHandlerImpl.java b/src/main/java/com/minelittlepony/unicopia/network/handler/ClientNetworkHandlerImpl.java index 57c90515..886db361 100644 --- a/src/main/java/com/minelittlepony/unicopia/network/handler/ClientNetworkHandlerImpl.java +++ b/src/main/java/com/minelittlepony/unicopia/network/handler/ClientNetworkHandlerImpl.java @@ -36,7 +36,7 @@ public class ClientNetworkHandlerImpl implements ClientNetworkHandler { @Override public void handleSpawnProjectile(MsgSpawnProjectile packet) { ClientWorld world = client.world; - Entity entity = packet.getEntityTypeId().create(world); + Entity entity = packet.getEntityType().create(world); entity.updateTrackedPosition(packet.getX(), packet.getY(), packet.getZ()); entity.refreshPositionAfterTeleport(packet.getX(), packet.getY(), packet.getZ()); diff --git a/src/main/java/com/minelittlepony/unicopia/particle/FollowingParticleEffect.java b/src/main/java/com/minelittlepony/unicopia/particle/FollowingParticleEffect.java index eb463eee..3ad756c2 100644 --- a/src/main/java/com/minelittlepony/unicopia/particle/FollowingParticleEffect.java +++ b/src/main/java/com/minelittlepony/unicopia/particle/FollowingParticleEffect.java @@ -11,7 +11,7 @@ import net.minecraft.particle.ParticleType; import net.minecraft.entity.Entity; import net.minecraft.network.PacketByteBuf; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.world.World; public class FollowingParticleEffect implements ParticleEffect { @@ -41,7 +41,7 @@ public class FollowingParticleEffect implements ParticleEffect { this(type, buf.readInt(), new Vec3d(buf.readDouble(), buf.readDouble(), buf.readDouble()), buf.readFloat()); if (buf.readBoolean()) { - childEffect = ParticleFactoryHelper.read(Registry.PARTICLE_TYPE.get(buf.readInt()), buf); + childEffect = ParticleFactoryHelper.read(Registries.PARTICLE_TYPE.get(buf.readInt()), buf); } } @@ -109,7 +109,7 @@ public class FollowingParticleEffect implements ParticleEffect { buf.writeFloat(followSpeed); getChildEffect().ifPresentOrElse(child -> { buf.writeBoolean(true); - buf.writeInt(Registry.PARTICLE_TYPE.getRawId(child.getType())); + buf.writeInt(Registries.PARTICLE_TYPE.getRawId(child.getType())); child.write(buf); }, () -> buf.writeBoolean(false)); } @@ -118,12 +118,12 @@ public class FollowingParticleEffect implements ParticleEffect { public String asString() { return getChildEffect().map(child -> { return String.format(Locale.ROOT, "%s %.2f %.2f %.2f %.2f %s", - Registry.PARTICLE_TYPE.getId(getType()), + Registries.PARTICLE_TYPE.getId(getType()), fixedTarget.x, fixedTarget.y, fixedTarget.z, followSpeed, child.asString()); }).orElseGet(() -> { return String.format(Locale.ROOT, "%s %.2f %.2f %.2f %.2f", - Registry.PARTICLE_TYPE.getId(getType()), + Registries.PARTICLE_TYPE.getId(getType()), fixedTarget.x, fixedTarget.y, fixedTarget.z, followSpeed); }); diff --git a/src/main/java/com/minelittlepony/unicopia/particle/MagicParticleEffect.java b/src/main/java/com/minelittlepony/unicopia/particle/MagicParticleEffect.java index d1161dd1..a8bc1d90 100644 --- a/src/main/java/com/minelittlepony/unicopia/particle/MagicParticleEffect.java +++ b/src/main/java/com/minelittlepony/unicopia/particle/MagicParticleEffect.java @@ -2,6 +2,8 @@ package com.minelittlepony.unicopia.particle; import java.util.Locale; +import org.joml.Vector3f; + import com.minelittlepony.common.util.Color; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; @@ -10,17 +12,16 @@ import net.minecraft.particle.AbstractDustParticleEffect; import net.minecraft.particle.ParticleEffect; import net.minecraft.particle.ParticleType; import net.minecraft.network.PacketByteBuf; -import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.random.Random; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class MagicParticleEffect implements ParticleEffect { - public static final MagicParticleEffect UNICORN = new MagicParticleEffect(false, Vec3f.ZERO); + public static final MagicParticleEffect UNICORN = new MagicParticleEffect(false, new Vector3f()); @SuppressWarnings("deprecation") public static final ParticleEffect.Factory FACTORY = ParticleFactoryHelper.of(MagicParticleEffect::new, MagicParticleEffect::new); private final boolean tinted; - private final Vec3f color; + private final Vector3f color; protected MagicParticleEffect(ParticleType particleType, StringReader reader) throws CommandSyntaxException { this(ParticleFactoryHelper.readBoolean(reader), AbstractDustParticleEffect.readColor(reader)); @@ -31,14 +32,14 @@ public class MagicParticleEffect implements ParticleEffect { } public MagicParticleEffect(int tint) { - this(true, new Vec3f(Color.r(tint), Color.g(tint), Color.b(tint))); + this(true, new Vector3f(Color.r(tint), Color.g(tint), Color.b(tint))); } - public MagicParticleEffect(Vec3f color) { + public MagicParticleEffect(Vector3f color) { this(true, color); } - protected MagicParticleEffect(boolean tint, Vec3f color) { + protected MagicParticleEffect(boolean tint, Vector3f color) { tinted = tint; this.color = color; } @@ -47,7 +48,7 @@ public class MagicParticleEffect implements ParticleEffect { return tinted; } - public Vec3f getColor(Random random) { + public Vector3f getColor(Random random) { if (hasTint()) { return color; } @@ -62,7 +63,7 @@ public class MagicParticleEffect implements ParticleEffect { r *= 3.9F; } - return new Vec3f(r, g, b); + return new Vector3f(r, g, b); } @Override @@ -73,14 +74,14 @@ public class MagicParticleEffect implements ParticleEffect { @Override public void write(PacketByteBuf buf) { buf.writeBoolean(tinted); - buf.writeFloat(color.getX()); - buf.writeFloat(color.getY()); - buf.writeFloat(color.getZ()); + buf.writeFloat(color.x); + buf.writeFloat(color.y); + buf.writeFloat(color.z); } @Override public String asString() { - return String.format(Locale.ROOT, "%s %.2f %.2f %.2f", Registry.PARTICLE_TYPE.getId(getType()), color.getX(), color.getY(), color.getZ()); + return String.format(Locale.ROOT, "%s %.2f %.2f %.2f", Registries.PARTICLE_TYPE.getId(getType()), color.x, color.y, color.z); } } diff --git a/src/main/java/com/minelittlepony/unicopia/particle/OrientedBillboardParticleEffect.java b/src/main/java/com/minelittlepony/unicopia/particle/OrientedBillboardParticleEffect.java index cb7173c4..26384776 100644 --- a/src/main/java/com/minelittlepony/unicopia/particle/OrientedBillboardParticleEffect.java +++ b/src/main/java/com/minelittlepony/unicopia/particle/OrientedBillboardParticleEffect.java @@ -9,7 +9,7 @@ import net.minecraft.particle.ParticleEffect; import net.minecraft.particle.ParticleType; import net.minecraft.network.PacketByteBuf; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class OrientedBillboardParticleEffect implements ParticleEffect { @SuppressWarnings("deprecation") @@ -70,7 +70,7 @@ public class OrientedBillboardParticleEffect implements ParticleEffect { @Override public String asString() { - return String.format(Locale.ROOT, "%s %b %.2f %.2f", Registry.PARTICLE_TYPE.getId(getType()), fixed, yaw, pitch); + return String.format(Locale.ROOT, "%s %b %.2f %.2f", Registries.PARTICLE_TYPE.getId(getType()), fixed, yaw, pitch); } } diff --git a/src/main/java/com/minelittlepony/unicopia/particle/ParticleFactoryHelper.java b/src/main/java/com/minelittlepony/unicopia/particle/ParticleFactoryHelper.java index 075a3719..f30883e8 100644 --- a/src/main/java/com/minelittlepony/unicopia/particle/ParticleFactoryHelper.java +++ b/src/main/java/com/minelittlepony/unicopia/particle/ParticleFactoryHelper.java @@ -9,13 +9,14 @@ import net.minecraft.command.argument.ParticleEffectArgumentType; import net.minecraft.network.PacketByteBuf; import net.minecraft.particle.ParticleEffect; import net.minecraft.particle.ParticleType; +import net.minecraft.registry.Registries; import net.minecraft.util.math.Vec3d; public interface ParticleFactoryHelper { @SuppressWarnings("unchecked") static Optional read(StringReader reader) throws CommandSyntaxException { - return Optional.ofNullable((T)ParticleEffectArgumentType.readParameters(reader)); + return Optional.ofNullable((T)ParticleEffectArgumentType.readParameters(reader, Registries.PARTICLE_TYPE.getReadOnlyWrapper())); } @SuppressWarnings("deprecation") diff --git a/src/main/java/com/minelittlepony/unicopia/particle/SphereParticleEffect.java b/src/main/java/com/minelittlepony/unicopia/particle/SphereParticleEffect.java index 93b11c3f..212e84cd 100644 --- a/src/main/java/com/minelittlepony/unicopia/particle/SphereParticleEffect.java +++ b/src/main/java/com/minelittlepony/unicopia/particle/SphereParticleEffect.java @@ -2,6 +2,8 @@ package com.minelittlepony.unicopia.particle; import java.util.Locale; +import org.joml.Vector3f; + import com.minelittlepony.common.util.Color; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; @@ -11,8 +13,7 @@ import net.minecraft.particle.ParticleEffect; import net.minecraft.particle.ParticleType; import net.minecraft.network.PacketByteBuf; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3f; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class SphereParticleEffect implements ParticleEffect { @SuppressWarnings("deprecation") @@ -20,7 +21,7 @@ public class SphereParticleEffect implements ParticleEffect { private static final Vec3d DEFAULT_OFFSET = new Vec3d(0, 0.5, 0); - private final Vec3f color; + private final Vector3f color; private final float alpha; private final float radius; @@ -40,15 +41,15 @@ public class SphereParticleEffect implements ParticleEffect { this(type, tint, alpha, rad, DEFAULT_OFFSET); } - public SphereParticleEffect(ParticleType type, Vec3f color, float alpha, float rad) { + public SphereParticleEffect(ParticleType type, Vector3f color, float alpha, float rad) { this(type, color, alpha, rad, DEFAULT_OFFSET); } public SphereParticleEffect(ParticleType type, int tint, float alpha, float rad, Vec3d offset) { - this(type, new Vec3f(Color.r(tint) * 255, Color.g(tint) * 255, Color.b(tint) * 255), alpha, rad, offset); + this(type, new Vector3f(Color.r(tint) * 255, Color.g(tint) * 255, Color.b(tint) * 255), alpha, rad, offset); } - public SphereParticleEffect(ParticleType type, Vec3f color, float alpha, float rad, Vec3d offset) { + public SphereParticleEffect(ParticleType type, Vector3f color, float alpha, float rad, Vec3d offset) { this.type = type; this.color = color; this.offset = offset; @@ -64,7 +65,7 @@ public class SphereParticleEffect implements ParticleEffect { this.offset = offset; } - public Vec3f getColor() { + public Vector3f getColor() { return color; } @@ -83,9 +84,9 @@ public class SphereParticleEffect implements ParticleEffect { @Override public void write(PacketByteBuf buf) { - buf.writeFloat(color.getX()); - buf.writeFloat(color.getY()); - buf.writeFloat(color.getZ()); + buf.writeFloat(color.x); + buf.writeFloat(color.y); + buf.writeFloat(color.z); buf.writeFloat(alpha); buf.writeFloat(radius); buf.writeDouble(offset.getX()); @@ -96,8 +97,8 @@ public class SphereParticleEffect implements ParticleEffect { @Override public String asString() { return String.format(Locale.ROOT, "%s %.2f %.2f %.2f %.2f %.2f %.2f %.2f", - Registry.PARTICLE_TYPE.getId(getType()), - color.getX(), color.getY(), color.getZ(), + Registries.PARTICLE_TYPE.getId(getType()), + color.x, color.y, color.z, alpha, radius, offset.getX(), offset.getY(), offset.getZ() diff --git a/src/main/java/com/minelittlepony/unicopia/particle/UParticles.java b/src/main/java/com/minelittlepony/unicopia/particle/UParticles.java index 1331600b..ea5ce42f 100644 --- a/src/main/java/com/minelittlepony/unicopia/particle/UParticles.java +++ b/src/main/java/com/minelittlepony/unicopia/particle/UParticles.java @@ -5,7 +5,8 @@ import com.minelittlepony.unicopia.Unicopia; import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes; import net.minecraft.particle.DefaultParticleType; import net.minecraft.particle.ParticleType; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; public interface UParticles { @@ -30,7 +31,7 @@ public interface UParticles { DefaultParticleType LIGHTNING_BOLT = register("lightning_bolt", FabricParticleTypes.simple(true)); static > T register(String name, T type) { - return Registry.register(Registry.PARTICLE_TYPE, Unicopia.id(name), type); + return Registry.register(Registries.PARTICLE_TYPE, Unicopia.id(name), type); } static void bootstrap() {} diff --git a/src/main/java/com/minelittlepony/unicopia/projectile/MagicProjectileEntity.java b/src/main/java/com/minelittlepony/unicopia/projectile/MagicProjectileEntity.java index 0c6b075c..6eb44c25 100644 --- a/src/main/java/com/minelittlepony/unicopia/projectile/MagicProjectileEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/projectile/MagicProjectileEntity.java @@ -37,6 +37,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.NbtCompound; import net.minecraft.network.Packet; +import net.minecraft.network.listener.ClientPlayPacketListener; import net.minecraft.particle.ItemStackParticleEffect; import net.minecraft.particle.ParticleEffect; import net.minecraft.particle.ParticleTypes; @@ -305,7 +306,7 @@ public class MagicProjectileEntity extends ThrownItemEntity implements Caster
  • createSpawnPacket() { + public Packet createSpawnPacket() { return Channel.SERVER_SPAWN_PROJECTILE.toPacket(new MsgSpawnProjectile(this)); } } diff --git a/src/main/java/com/minelittlepony/unicopia/util/Registries.java b/src/main/java/com/minelittlepony/unicopia/util/Registries.java index 223205a0..73dc07e0 100644 --- a/src/main/java/com/minelittlepony/unicopia/util/Registries.java +++ b/src/main/java/com/minelittlepony/unicopia/util/Registries.java @@ -5,18 +5,20 @@ import java.util.stream.Stream; import com.mojang.serialization.Lifecycle; import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.*; +import net.minecraft.registry.*; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.registry.entry.RegistryEntryList; import net.minecraft.world.World; public interface Registries { static Registry createSimple(Identifier id) { - return FabricRegistryBuilder.from(new SimpleRegistry(RegistryKey.ofRegistry(id), Lifecycle.stable(), null)).buildAndRegister(); + return FabricRegistryBuilder.from(new SimpleRegistry(RegistryKey.ofRegistry(id), Lifecycle.stable())).buildAndRegister(); } static Registry createDefaulted(Identifier id, String def) { - return FabricRegistryBuilder.from(new DefaultedRegistry(def, RegistryKey.ofRegistry(id), Lifecycle.stable(), null)).buildAndRegister(); + return FabricRegistryBuilder.from(new SimpleDefaultedRegistry(def, RegistryKey.ofRegistry(id), Lifecycle.stable(), true)).buildAndRegister(); } static RegistryEntryList entriesForTag(World world, TagKey key) { diff --git a/src/main/java/com/minelittlepony/unicopia/util/RegistryIndexer.java b/src/main/java/com/minelittlepony/unicopia/util/RegistryIndexer.java index 6745b4ea..cec58e86 100644 --- a/src/main/java/com/minelittlepony/unicopia/util/RegistryIndexer.java +++ b/src/main/java/com/minelittlepony/unicopia/util/RegistryIndexer.java @@ -2,7 +2,7 @@ package com.minelittlepony.unicopia.util; import com.minelittlepony.common.client.gui.IField; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registry; public class RegistryIndexer { diff --git a/src/main/java/com/minelittlepony/unicopia/util/network/S2CPacketType.java b/src/main/java/com/minelittlepony/unicopia/util/network/S2CPacketType.java index fe8abfd8..bf4ef076 100644 --- a/src/main/java/com/minelittlepony/unicopia/util/network/S2CPacketType.java +++ b/src/main/java/com/minelittlepony/unicopia/util/network/S2CPacketType.java @@ -2,6 +2,7 @@ package com.minelittlepony.unicopia.util.network; import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.network.listener.ClientPlayPacketListener; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.Identifier; @@ -15,7 +16,7 @@ public interface S2CPacketType> { ServerPlayNetworking.send(recipient, getId(), packet.toBuffer()); } - default net.minecraft.network.Packet toPacket(T packet) { + default net.minecraft.network.Packet toPacket(T packet) { return ServerPlayNetworking.createS2CPacket(getId(), packet.toBuffer()); } } \ No newline at end of file