diff --git a/build.gradle b/build.gradle index 78c61c3a..7d7b12fa 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,12 @@ plugins { id 'java-library' - id 'fabric-loom' version '0.8-SNAPSHOT' + id 'fabric-loom' version '0.10-SNAPSHOT' id 'org.ajoberstar.reckon' version '0.13.0' } java { toolchain { - languageVersion = JavaLanguageVersion.of(16) + languageVersion = JavaLanguageVersion.of(17) } } @@ -14,9 +14,9 @@ group = project.group description = project.displayname archivesBaseName = project.name -minecraft { - refmapName = 'unicopia.mixin.refmap.json' - accessWidener 'src/main/resources/unicopia.aw' +loom { + mixin.defaultRefmapName = 'unicopia.mixin.refmap.json' + accessWidenerPath = file('src/main/resources/unicopia.aw') } reckon { diff --git a/gradle.properties b/gradle.properties index 309c9424..7c77e927 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.daemon=false # Fabric Properties # check these on https://modmuss50.me/fabric.html - minecraft_version=1.17 - yarn_mappings=1.17+build.5 - loader_version=0.12.0 - fabric_version=0.34.9+1.17 + minecraft_version=1.18-pre8 + yarn_mappings=1.18-pre8+build.2 + loader_version=0.12.5 + fabric_version=0.43.0+1.18 # Mod Properties group=com.minelittlepony @@ -16,5 +16,5 @@ org.gradle.daemon=false # Dependencies modmenu_version=2.0.0-beta.7 - minelp_version=4.3.6 + minelp_version=4.4.1 kirin_version=1.10.0 diff --git a/settings.gradle b/settings.gradle index a5a8746d..cb906a3e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ pluginManagement { repositories { - jcenter() + mavenCentral() maven { name = 'Fabric' url = 'https://maven.fabricmc.net/' diff --git a/src/main/java/com/minelittlepony/unicopia/BlockDestructionManager.java b/src/main/java/com/minelittlepony/unicopia/BlockDestructionManager.java index 189a429c..6cc676ff 100644 --- a/src/main/java/com/minelittlepony/unicopia/BlockDestructionManager.java +++ b/src/main/java/com/minelittlepony/unicopia/BlockDestructionManager.java @@ -2,7 +2,6 @@ package com.minelittlepony.unicopia; import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; import com.minelittlepony.unicopia.network.Channel; import com.minelittlepony.unicopia.network.MsgBlockDestruction; @@ -10,7 +9,6 @@ import com.minelittlepony.unicopia.network.MsgBlockDestruction; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ThreadedAnvilChunkStorage; @@ -107,7 +105,7 @@ public class BlockDestructionManager { ThreadedAnvilChunkStorage storage = world.getChunkManager().threadedAnvilChunkStorage; - List players = storage.getPlayersWatchingChunk(new ChunkPos(pos), false).collect(Collectors.toList()); + List players = storage.getPlayersWatchingChunk(new ChunkPos(pos), false); if (!players.isEmpty()) { Long2ObjectOpenHashMap values = new Long2ObjectOpenHashMap<>(); @@ -129,7 +127,7 @@ public class BlockDestructionManager { players.forEach(player -> { if (player instanceof ServerPlayerEntity) { - Channel.SERVER_BLOCK_DESTRUCTION.send((ServerPlayerEntity)player, msg); + Channel.SERVER_BLOCK_DESTRUCTION.send(player, msg); } }); } diff --git a/src/main/java/com/minelittlepony/unicopia/UTags.java b/src/main/java/com/minelittlepony/unicopia/UTags.java index 83aaf938..ce9a929c 100644 --- a/src/main/java/com/minelittlepony/unicopia/UTags.java +++ b/src/main/java/com/minelittlepony/unicopia/UTags.java @@ -2,7 +2,7 @@ package com.minelittlepony.unicopia; import com.minelittlepony.unicopia.item.toxin.Toxics; -import net.fabricmc.fabric.api.tag.TagRegistry; +import net.fabricmc.fabric.api.tag.TagFactory; import net.minecraft.block.Block; import net.minecraft.entity.EntityType; import net.minecraft.item.Item; @@ -28,15 +28,15 @@ public interface UTags { Tag> TRANSFORMABLE_ENTITIES = entity("transformable"); static Tag item(String name) { - return TagRegistry.item(new Identifier("unicopia", name)); + return TagFactory.ITEM.create(new Identifier("unicopia", name)); } static Tag block(String name) { - return TagRegistry.block(new Identifier("unicopia", name)); + return TagFactory.BLOCK.create(new Identifier("unicopia", name)); } static Tag> entity(String name) { - return TagRegistry.entityType(new Identifier("unicopia", name)); + return TagFactory.ENTITY_TYPE.create(new Identifier("unicopia", name)); } static void bootstrap() { diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/ThrowableSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/ThrowableSpell.java index 43e98834..3d682ae6 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/ThrowableSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/ThrowableSpell.java @@ -51,7 +51,7 @@ public final class ThrowableSpell extends AbstractDelegatingSpell { projectile.setItem(GemstoneItem.enchanted(UItems.GEMSTONE.getDefaultStack(), spell.getType())); projectile.getSpellSlot().put(this); - projectile.setProperties(entity, entity.getPitch(), entity.getYaw(), 0, 1.5F, 1); + projectile.setVelocity(entity, entity.getPitch(), entity.getYaw(), 0, 1.5F, 1); projectile.setHydrophobic(); configureProjectile(projectile, caster); world.spawnEntity(projectile); 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 4cb20719..d5757e96 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 @@ -44,7 +44,7 @@ public class AwkwardSpell extends AbstractSpell { } protected boolean shouldSpawnParticle(ParticleType type) { - return type != ParticleTypes.BARRIER + return type != ParticleTypes.BLOCK_MARKER && type != ParticleTypes.SMOKE && type != ParticleTypes.EXPLOSION && type != ParticleTypes.EXPLOSION_EMITTER 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 edc2bc2a..57097387 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 @@ -158,19 +158,19 @@ public final class SpellTraits implements Iterable> { } public static Optional getEmbeddedTraits(ItemStack stack) { - if (!(stack.hasTag() && stack.getTag().contains("spell_traits", NbtElement.COMPOUND_TYPE))) { + if (!stack.hasNbt() || !stack.getNbt().contains("spell_traits", NbtElement.COMPOUND_TYPE)) { return Optional.empty(); } - return fromNbt(stack.getTag().getCompound("spell_traits")); + return fromNbt(stack.getNbt().getCompound("spell_traits")); } public ItemStack applyTo(ItemStack stack) { stack = stack.copy(); if (isEmpty()) { - stack.removeSubTag("spell_traits"); + stack.removeSubNbt("spell_traits"); return stack; } - stack.getOrCreateTag().put("spell_traits", toNbt()); + stack.getOrCreateNbt().put("spell_traits", toNbt()); return stack; } diff --git a/src/main/java/com/minelittlepony/unicopia/advancement/CustomEventCriterion.java b/src/main/java/com/minelittlepony/unicopia/advancement/CustomEventCriterion.java index 0333adfd..6f1f555c 100644 --- a/src/main/java/com/minelittlepony/unicopia/advancement/CustomEventCriterion.java +++ b/src/main/java/com/minelittlepony/unicopia/advancement/CustomEventCriterion.java @@ -48,7 +48,7 @@ public class CustomEventCriterion extends AbstractCriterion { if (player instanceof ServerPlayerEntity) { - test((ServerPlayerEntity)player, c -> c.test(name, (ServerPlayerEntity)player)); + trigger((ServerPlayerEntity)player, c -> c.test(name, (ServerPlayerEntity)player)); } }; } diff --git a/src/main/java/com/minelittlepony/unicopia/advancement/RaceChangeCriterion.java b/src/main/java/com/minelittlepony/unicopia/advancement/RaceChangeCriterion.java index 811f11da..2e862452 100644 --- a/src/main/java/com/minelittlepony/unicopia/advancement/RaceChangeCriterion.java +++ b/src/main/java/com/minelittlepony/unicopia/advancement/RaceChangeCriterion.java @@ -30,7 +30,7 @@ public class RaceChangeCriterion extends AbstractCriterion c.test((ServerPlayerEntity)player)); + trigger((ServerPlayerEntity)player, c -> c.test((ServerPlayerEntity)player)); } } diff --git a/src/main/java/com/minelittlepony/unicopia/client/DiscoveryToast.java b/src/main/java/com/minelittlepony/unicopia/client/DiscoveryToast.java index 07c48e1b..2aa9b0d9 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/DiscoveryToast.java +++ b/src/main/java/com/minelittlepony/unicopia/client/DiscoveryToast.java @@ -41,8 +41,8 @@ public class DiscoveryToast implements Toast { RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderColor(1.0F, 1, 1, 1); manager.drawTexture(matrices, 0, 0, 0, 32, getWidth(), getHeight()); - manager.getGame().textRenderer.draw(matrices, TITLE, 30, 7, -11534256); - manager.getGame().textRenderer.draw(matrices, DESCRIPTION, 30, 18, -16777216); + manager.getClient().textRenderer.draw(matrices, TITLE, 30, 7, -11534256); + manager.getClient().textRenderer.draw(matrices, DESCRIPTION, 30, 18, -16777216); Identifier icon = discoveries.get((int)(startTime / Math.max(1L, MAX_AGE / discoveries.size()) % discoveries.size())); @@ -50,14 +50,14 @@ public class DiscoveryToast implements Toast { matrixStack.push(); matrixStack.scale(0.6F, 0.6F, 1); RenderSystem.applyModelViewMatrix(); - manager.getGame().getItemRenderer().renderInGui(UItems.SPELLBOOK.getDefaultStack(), 3, 3); + manager.getClient().getItemRenderer().renderInGui(UItems.SPELLBOOK.getDefaultStack(), 3, 3); matrixStack.pop(); RenderSystem.applyModelViewMatrix(); RenderSystem.setShaderTexture(0, icon); DrawableHelper.drawTexture(matrices, 8, 8, 1, 0, 0, 16, 16, 16, 16); - // manager.getGame().getItemRenderer().renderInGui(recipe.getOutput(), 8, 8); + // manager.getClient().getItemRenderer().renderInGui(recipe.getOutput(), 8, 8); return startTime - this.startTime >= MAX_AGE ? Toast.Visibility.HIDE : Toast.Visibility.SHOW; } diff --git a/src/main/java/com/minelittlepony/unicopia/client/ModifierTooltipRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/ModifierTooltipRenderer.java index bd1a6522..21dad364 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/ModifierTooltipRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/ModifierTooltipRenderer.java @@ -39,7 +39,7 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback { @Override public void getTooltip(ItemStack stack, TooltipContext context, List lines) { - int flags = stack.hasTag() && stack.getTag().contains("HideFlags", 99) ? stack.getTag().getInt("HideFlags") : 0; + int flags = stack.hasNbt() && stack.getNbt().contains("HideFlags", 99) ? stack.getNbt().getInt("HideFlags") : 0; if (isShowing(flags, ItemStack.TooltipSection.MODIFIERS)) { @@ -85,16 +85,16 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback { return insertPosition + 1; } - if (insertPosition == -1 && stack.hasTag()) { - if (isShowing(flags, ItemStack.TooltipSection.MODIFIERS) && stack.getTag().getBoolean("Unbreakable")) { + if (insertPosition == -1 && stack.hasNbt()) { + if (isShowing(flags, ItemStack.TooltipSection.MODIFIERS) && stack.getNbt().getBoolean("Unbreakable")) { insertPosition = checkFor(lines, new TranslatableText("item.unbreakable").formatted(Formatting.BLUE)); } - if (insertPosition == -1 && isShowing(flags, ItemStack.TooltipSection.CAN_DESTROY) && stack.getTag().contains("CanDestroy", 9)) { + if (insertPosition == -1 && isShowing(flags, ItemStack.TooltipSection.CAN_DESTROY) && stack.getNbt().contains("CanDestroy", 9)) { insertPosition = checkFor(lines, new TranslatableText("item.canBreak").formatted(Formatting.GRAY)); } - if (insertPosition == -1 && isShowing(flags, ItemStack.TooltipSection.CAN_PLACE) && stack.getTag().contains("CanPlaceOn", 9)) { + if (insertPosition == -1 && isShowing(flags, ItemStack.TooltipSection.CAN_PLACE) && stack.getNbt().contains("CanPlaceOn", 9)) { insertPosition = checkFor(lines, new TranslatableText("item.canPlace").formatted(Formatting.GRAY)); } } diff --git a/src/main/java/com/minelittlepony/unicopia/client/URenderers.java b/src/main/java/com/minelittlepony/unicopia/client/URenderers.java index 9b503add..0f972901 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/URenderers.java +++ b/src/main/java/com/minelittlepony/unicopia/client/URenderers.java @@ -28,7 +28,7 @@ import com.minelittlepony.unicopia.item.UItems; import com.minelittlepony.unicopia.particle.UParticles; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry.PendingParticleFactory; -import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry; +import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry; @@ -66,11 +66,11 @@ public interface URenderers { AccessoryFeatureRenderer.register(IcarusWingsFeatureRenderer::new); AccessoryFeatureRenderer.register(BatWingsFeatureRenderer::new); - EntityRendererRegistry.INSTANCE.register(UEntities.THROWN_ITEM, FlyingItemEntityRenderer::new); - EntityRendererRegistry.INSTANCE.register(UEntities.BUTTERFLY, ButterflyEntityRenderer::new); - EntityRendererRegistry.INSTANCE.register(UEntities.FLOATING_ARTEFACT, FloatingArtefactEntityRenderer::new); - EntityRendererRegistry.INSTANCE.register(UEntities.CAST_SPELL, CastSpellEntityRenderer::new); - EntityRendererRegistry.INSTANCE.register(UEntities.SPELLBOOK, SpellbookEntityRenderer::new); + EntityRendererRegistry.register(UEntities.THROWN_ITEM, FlyingItemEntityRenderer::new); + EntityRendererRegistry.register(UEntities.BUTTERFLY, ButterflyEntityRenderer::new); + EntityRendererRegistry.register(UEntities.FLOATING_ARTEFACT, FloatingArtefactEntityRenderer::new); + EntityRendererRegistry.register(UEntities.CAST_SPELL, CastSpellEntityRenderer::new); + EntityRendererRegistry.register(UEntities.SPELLBOOK, SpellbookEntityRenderer::new); ColorProviderRegistry.ITEM.register((stack, i) -> i > 0 ? -1 : ((DyeableItem)stack.getItem()).getColor(stack), UItems.FRIENDSHIP_BRACELET); BuiltinItemRendererRegistry.INSTANCE.register(UItems.FILLED_JAR, (stack, mode, matrices, vertexConsumers, light, overlay) -> { diff --git a/src/main/java/com/minelittlepony/unicopia/client/UnicopiaClient.java b/src/main/java/com/minelittlepony/unicopia/client/UnicopiaClient.java index f1e29bce..931f81b1 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/UnicopiaClient.java +++ b/src/main/java/com/minelittlepony/unicopia/client/UnicopiaClient.java @@ -82,7 +82,7 @@ public class UnicopiaClient implements ClientModInitializer { } if (screen instanceof OpenToLanScreen) { buttons.addButton(new Button(screen.width / 2 - 155, 130, 150, 20)) - .onClick(b -> MinecraftClient.getInstance().openScreen(new LanSettingsScreen(screen))) + .onClick(b -> MinecraftClient.getInstance().setScreen(new LanSettingsScreen(screen))) .getStyle().setText(new TranslatableText("unicopia.options.title")); } } diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/ItemTraitsTooltipRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/gui/ItemTraitsTooltipRenderer.java index 395c77b3..e7c30fa9 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/ItemTraitsTooltipRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/ItemTraitsTooltipRenderer.java @@ -12,7 +12,6 @@ import net.minecraft.client.gui.tooltip.TooltipComponent; import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.texture.TextureManager; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.BaseText; import net.minecraft.text.CharacterVisitor; @@ -45,7 +44,7 @@ public class ItemTraitsTooltipRenderer extends BaseText implements OrderedText, } @Override - public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer, int z, TextureManager textureManager) { + public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer, int z) { int columns = getColumns(); @@ -65,7 +64,7 @@ public class ItemTraitsTooltipRenderer extends BaseText implements OrderedText, matrices.translate(xx + 9, yy + 3, itemRenderer.zOffset + 200.0F); matrices.scale(0.5F, 0.5F, 1); VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer()); - textRenderer.draw(string, 0, 0, 16777215, true, matrices.peek().getModel(), immediate, false, 0, 15728880); + textRenderer.draw(string, 0, 0, 16777215, true, matrices.peek().getPositionMatrix(), immediate, false, 0, 15728880); immediate.draw(); matrices.pop(); } diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/ManaRingSlot.java b/src/main/java/com/minelittlepony/unicopia/client/gui/ManaRingSlot.java index 623a6046..5e446571 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/ManaRingSlot.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/ManaRingSlot.java @@ -113,7 +113,7 @@ class ManaRingSlot extends Slot { bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR); - Matrix4f model = matrices.peek().getModel(); + Matrix4f model = matrices.peek().getPositionMatrix(); if (!mirrorHorizontally) { startAngle = -startAngle; diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/TribeSelectionScreen.java b/src/main/java/com/minelittlepony/unicopia/client/gui/TribeSelectionScreen.java index b57c0ca0..1899e673 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/TribeSelectionScreen.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/TribeSelectionScreen.java @@ -74,14 +74,14 @@ public class TribeSelectionScreen extends GameGui implements HidesHud { private void addOption(Race race, int x, int top) { addDrawableChild(new TribeButton(x, top, width, race)).onClick(b -> { finished = true; - client.openScreen(new TribeConfirmationScreen(result -> { + client.setScreen(new TribeConfirmationScreen(result -> { finished = false; if (result) { Channel.CLIENT_REQUEST_SPECIES_CHANGE.send(new MsgRequestSpeciesChange(race, true)); finish(); } else { - client.openScreen(this); + client.setScreen(this); } }, race)); }).setEnabled(allowedRaces.contains(race)); @@ -109,7 +109,7 @@ public class TribeSelectionScreen extends GameGui implements HidesHud { if (!finished && client != null) { client.execute(() -> { finished = true; - client.openScreen(this); + client.setScreen(this); finished = false; }); } diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/DiskModel.java b/src/main/java/com/minelittlepony/unicopia/client/particle/DiskModel.java index d7c0e240..047c08b3 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/DiskModel.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/DiskModel.java @@ -7,7 +7,7 @@ import net.minecraft.util.math.Matrix4f; public class DiskModel extends SphereModel { @Override public void render(MatrixStack.Entry matrices, VertexConsumer vertexWriter, int light, int overlay, float r, float g, float b, float a) { - Matrix4f model = matrices.getModel(); + Matrix4f model = matrices.getPositionMatrix(); final double num_rings = 30; final double zenithIncrement = Math.PI / num_rings; 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 60ee0cb4..5a80f9c6 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/SphereModel.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/SphereModel.java @@ -12,7 +12,7 @@ public class SphereModel { public void render(MatrixStack.Entry matrices, VertexConsumer vertexWriter, int light, int overlay, float r, float g, float b, float a) { - Matrix4f model = matrices.getModel(); + Matrix4f model = matrices.getPositionMatrix(); final double num_rings = 40; final double num_sectors = 40; 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 d122ae57..f233c3fa 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/FloatingArtefactEntityRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/FloatingArtefactEntityRenderer.java @@ -10,9 +10,9 @@ import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.json.ModelTransformation; -import net.minecraft.client.texture.SpriteAtlasTexture; 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; @@ -34,7 +34,7 @@ public class FloatingArtefactEntityRenderer extends EntityRenderer { @@ -15,6 +15,6 @@ public class CastSpellEntityRenderer extends EntityRenderer { @Override public Identifier getTexture(CastSpellEntity entity) { - return SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE; + return PlayerScreenHandler.BLOCK_ATLAS_TEXTURE; } } 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 3802ad66..4ba59a06 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/sound/FadeOutSoundInstance.java +++ b/src/main/java/com/minelittlepony/unicopia/client/sound/FadeOutSoundInstance.java @@ -21,7 +21,7 @@ public abstract class FadeOutSoundInstance extends MovingSoundInstance { public FadeOutSoundInstance(SoundEvent sound, SoundCategory category, float volume) { super(sound, category); - this.looping = true; + this.relative = true; this.repeat = true; this.volume = volume; setTargetVolume(volume); diff --git a/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreenHandler.java b/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreenHandler.java index 4a6dcc4a..777aa4d3 100644 --- a/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreenHandler.java +++ b/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreenHandler.java @@ -145,7 +145,7 @@ public class SpellbookScreenHandler extends ScreenHandler { .map(recipe -> recipe.craft(input)) .ifPresentOrElse(gemSlot::setCrafted, gemSlot::setUncrafted); - ((ServerPlayerEntity)this.inventory.player).networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(syncId, GEM_SLOT_INDEX, gemSlot.getStack())); + ((ServerPlayerEntity)this.inventory.player).networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(syncId, nextRevision(), GEM_SLOT_INDEX, gemSlot.getStack())); } }); } @@ -452,7 +452,7 @@ public class SpellbookScreenHandler extends ScreenHandler { if (!itemStack2.isEmpty()) { if (itemStack.isEmpty()) { input.setStack(i, itemStack2); - } else if (ItemStack.areItemsEqualIgnoreDamage(itemStack, itemStack2) && ItemStack.areTagsEqual(itemStack, itemStack2)) { + } else if (ItemStack.areItemsEqualIgnoreDamage(itemStack, itemStack2) && ItemStack.areNbtEqual(itemStack, itemStack2)) { itemStack2.increment(itemStack.getCount()); input.setStack(i, itemStack2); } else if (!player.getInventory().insertStack(itemStack2)) { diff --git a/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java b/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java index b7730dc7..bff77d0c 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java @@ -18,7 +18,6 @@ import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome.Category; -@SuppressWarnings("deprecation") public interface UEntities { EntityType BUTTERFLY = register("butterfly", FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT, ButterflyEntity::new) .dimensions(EntityDimensions.fixed(0.25F, 0.25F))); diff --git a/src/main/java/com/minelittlepony/unicopia/entity/ai/WantItNeedItSensor.java b/src/main/java/com/minelittlepony/unicopia/entity/ai/WantItNeedItSensor.java index 01139651..b693e220 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/ai/WantItNeedItSensor.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/ai/WantItNeedItSensor.java @@ -1,6 +1,5 @@ package com.minelittlepony.unicopia.entity.ai; -import java.util.Optional; import java.util.Set; import com.google.common.collect.ImmutableSet; @@ -22,12 +21,8 @@ public class WantItNeedItSensor extends Sensor { @Override protected void sense(ServerWorld world, LivingEntity entity) { entity.getBrain().getOptionalMemory(MemoryModuleType.VISIBLE_MOBS).ifPresent(targets -> { - - Optional target = targets.stream() - .filter(e -> (EnchantmentHelper.getEquipmentLevel(UEnchantments.WANT_IT_NEED_IT, e) * 10) >= entity.distanceTo(e)) - .findFirst(); - - entity.getBrain().remember(MemoryModuleType.ATTACK_TARGET, target); + entity.getBrain().remember(MemoryModuleType.ATTACK_TARGET, targets + .findFirst(e -> (EnchantmentHelper.getEquipmentLevel(UEnchantments.WANT_IT_NEED_IT, e) * 10) >= entity.distanceTo(e))); }); } 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 421f0c02..5808c5ab 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/Disguise.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/Disguise.java @@ -6,7 +6,6 @@ import java.util.Objects; import java.util.Optional; import java.util.UUID; import java.util.function.Consumer; -import java.util.function.Predicate; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -379,12 +378,12 @@ public class Disguise implements NbtSerialisable, PlayerDimensions.Provider, Fli } } - public static List getColissonShapes(@Nullable Entity entity, WorldAccess world, Box box, Predicate predicate) { + public static List getColissonShapes(@Nullable Entity entity, WorldAccess world, Box box) { List shapes = new ArrayList<>(); ShapeContext ctx = entity == null ? ShapeContext.absent() : ShapeContext.of(entity); VoxelShape entityShape = VoxelShapes.cuboid(box.expand(1.0E-6D)); - world.getOtherEntities(entity, box.expand(0.5), predicate.and(e -> { + world.getOtherEntities(entity, box.expand(0.5), e -> { Caster.of(e).flatMap(c -> c.getSpellSlot().get(SpellType.DISGUISE, false)).ifPresent(p -> { p.getDisguise().getCollissionShapes(ctx, shape -> { if (!shape.isEmpty() && VoxelShapes.matchesAnywhere(shape, entityShape, BooleanBiFunction.AND)) { @@ -393,7 +392,7 @@ public class Disguise implements NbtSerialisable, PlayerDimensions.Provider, Fli }); }); return false; - })); + }); return shapes; } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/effect/CorruptInfluenceStatusEffect.java b/src/main/java/com/minelittlepony/unicopia/entity/effect/CorruptInfluenceStatusEffect.java index e425ee0f..530686f7 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/effect/CorruptInfluenceStatusEffect.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/effect/CorruptInfluenceStatusEffect.java @@ -11,14 +11,14 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.attribute.EntityAttributeModifier; import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.entity.effect.StatusEffectType; +import net.minecraft.entity.effect.StatusEffectCategory; import net.minecraft.entity.mob.HostileEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.WorldEvents; public class CorruptInfluenceStatusEffect extends StatusEffect { CorruptInfluenceStatusEffect(int color) { - super(StatusEffectType.NEUTRAL, color); + super(StatusEffectCategory.NEUTRAL, color); addAttributeModifier(EntityAttributes.GENERIC_ATTACK_DAMAGE, "6D706448-6A60-4F59-BE8A-C23A6DD2C7A9", 15, EntityAttributeModifier.Operation.ADDITION); addAttributeModifier(EntityAttributes.GENERIC_ATTACK_SPEED, "6D706448-6A60-4F59-BE8A-C23A6DD2C7A9", 10, EntityAttributeModifier.Operation.ADDITION); } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/effect/FoodPoisoningStatusEffect.java b/src/main/java/com/minelittlepony/unicopia/entity/effect/FoodPoisoningStatusEffect.java index 11c2ae9c..49fa8bcd 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/effect/FoodPoisoningStatusEffect.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/effect/FoodPoisoningStatusEffect.java @@ -8,13 +8,13 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffectType; +import net.minecraft.entity.effect.StatusEffectCategory; import net.minecraft.entity.effect.StatusEffects; public class FoodPoisoningStatusEffect extends StatusEffect { FoodPoisoningStatusEffect(int color) { - super(StatusEffectType.HARMFUL, color); + super(StatusEffectCategory.HARMFUL, color); } @Override 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 be354d3e..a0961cfe 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/effect/RaceChangeStatusEffect.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/effect/RaceChangeStatusEffect.java @@ -14,7 +14,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffectType; +import net.minecraft.entity.effect.StatusEffectCategory; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.particle.ParticleTypes; import net.minecraft.text.Text; @@ -35,7 +35,7 @@ public class RaceChangeStatusEffect extends StatusEffect { private final Race species; protected RaceChangeStatusEffect(int color, Race species) { - super(StatusEffectType.NEUTRAL, color); + super(StatusEffectCategory.NEUTRAL, color); this.species = species; Registry.register(Registry.STATUS_EFFECT, new Identifier("unicopia", "change_race_" + species.name().toLowerCase()), this); diff --git a/src/main/java/com/minelittlepony/unicopia/entity/effect/SunBlindnessStatusEffect.java b/src/main/java/com/minelittlepony/unicopia/entity/effect/SunBlindnessStatusEffect.java index 7722af17..915a5704 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/effect/SunBlindnessStatusEffect.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/effect/SunBlindnessStatusEffect.java @@ -11,7 +11,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffectType; +import net.minecraft.entity.effect.StatusEffectCategory; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.world.LightType; @@ -19,7 +19,7 @@ public class SunBlindnessStatusEffect extends StatusEffect { public static final int MAX_DURATION = 50; SunBlindnessStatusEffect(int color) { - super(StatusEffectType.NEUTRAL, color); + super(StatusEffectCategory.NEUTRAL, color); } @Override diff --git a/src/main/java/com/minelittlepony/unicopia/item/AlicornAmuletItem.java b/src/main/java/com/minelittlepony/unicopia/item/AlicornAmuletItem.java index 9e059611..ba5c7f01 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/AlicornAmuletItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/AlicornAmuletItem.java @@ -39,8 +39,8 @@ import net.minecraft.sound.SoundEvents; import net.minecraft.text.Text; import net.minecraft.text.TranslatableText; import net.minecraft.util.ActionResult; -import net.minecraft.util.ChatUtil; import net.minecraft.util.Hand; +import net.minecraft.util.StringHelper; import net.minecraft.util.TypedActionResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.LocalDifficulty; @@ -72,7 +72,7 @@ public class AlicornAmuletItem extends AmuletItem implements PlayerCharmTracker. if (iplayer != null) { int attachedTime = iplayer.getCharms().getArmour().getTicks(this); if (attachedTime > 0) { - tooltip.add(new TranslatableText(getTranslationKey() + ".lore", ChatUtil.ticksToString(attachedTime))); + tooltip.add(new TranslatableText(getTranslationKey() + ".lore", StringHelper.formatTicks(attachedTime))); } } } @@ -230,7 +230,7 @@ public class AlicornAmuletItem extends AmuletItem implements PlayerCharmTracker. }); public static final Trick POKE = new Trick(13000, 300, player -> player.damage(MagicalDamageSource.ALICORN_AMULET, 1F)); public static final Trick SPIN = new Trick(6000, 300, player -> player.setYaw(player.getYaw() + 180)); - public static final Trick BUTTER_FINGERS = new Trick(1000, 300, player -> player.dropSelectedItem(false)); + public static final Trick BUTTER_FINGERS = new Trick(1000, 300, player -> player.getInventory().dropSelectedItem(false)); public static final Trick MOVE = new Trick(3000, 300, player -> { float amount = player.world.random.nextFloat() - 0.5F; boolean sideways = player.world.random.nextBoolean(); diff --git a/src/main/java/com/minelittlepony/unicopia/item/AmuletItem.java b/src/main/java/com/minelittlepony/unicopia/item/AmuletItem.java index f48ceeb5..d9bbe209 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/AmuletItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/AmuletItem.java @@ -114,14 +114,14 @@ public class AmuletItem extends WearableItem { } public static float getEnergy(ItemStack stack) { - return stack.hasTag() && stack.getTag().contains("energy") ? stack.getTag().getFloat("energy") : 0; + return stack.hasNbt() && stack.getNbt().contains("energy") ? stack.getNbt().getFloat("energy") : 0; } public static void setEnergy(ItemStack stack, float energy) { if (energy <= 0) { - stack.removeSubTag("energy"); + stack.removeSubNbt("energy"); } else { - stack.getOrCreateTag().putFloat("energy", energy); + stack.getOrCreateNbt().putFloat("energy", energy); } } diff --git a/src/main/java/com/minelittlepony/unicopia/item/ChameleonItem.java b/src/main/java/com/minelittlepony/unicopia/item/ChameleonItem.java index 742e4eb4..80073e0c 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/ChameleonItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/ChameleonItem.java @@ -22,11 +22,11 @@ public interface ChameleonItem { default ItemStack createAppearanceStack(ItemStack stack, Item appearance) { ItemStack newAppearance = appearance.getDefaultStack(); - if (stack.hasTag()) { - newAppearance.setTag(stack.getTag().copy()); + if (stack.hasNbt()) { + newAppearance.setNbt(stack.getNbt().copy()); } newAppearance.setCount(stack.getCount()); - newAppearance.removeSubTag("appearance"); + newAppearance.removeSubNbt("appearance"); return newAppearance; } @@ -35,8 +35,8 @@ public interface ChameleonItem { } default Item getAppearance(ItemStack stack) { - if (stack.hasTag() && stack.getTag().contains("appearance")) { - return Registry.ITEM.get(new Identifier(stack.getTag().getString("appearance"))); + if (stack.hasNbt() && stack.getNbt().contains("appearance")) { + return Registry.ITEM.get(new Identifier(stack.getNbt().getString("appearance"))); } return Items.AIR; @@ -45,13 +45,13 @@ public interface ChameleonItem { default ItemStack setAppearance(ItemStack stack, ItemStack appearance) { ItemStack result = stack.copy(); - if (appearance.hasTag()) { - result.setTag(appearance.getTag().copy()); + if (appearance.hasNbt()) { + result.setNbt(appearance.getNbt().copy()); result.removeCustomName(); result.setDamage(stack.getDamage()); result.setCount(stack.getCount()); } - result.getOrCreateTag().putString("appearance", Registry.ITEM.getId(appearance.getItem()).toString()); + result.getOrCreateNbt().putString("appearance", Registry.ITEM.getId(appearance.getItem()).toString()); return result; } diff --git a/src/main/java/com/minelittlepony/unicopia/item/CrystalHeartItem.java b/src/main/java/com/minelittlepony/unicopia/item/CrystalHeartItem.java index d8675274..85412c48 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/CrystalHeartItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/CrystalHeartItem.java @@ -15,7 +15,6 @@ import com.minelittlepony.unicopia.util.VecHelper; import net.minecraft.block.BlockState; import net.minecraft.block.EndRodBlock; -import net.minecraft.entity.ItemEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.Saddleable; import net.minecraft.entity.SpawnGroup; @@ -52,14 +51,13 @@ public class CrystalHeartItem extends Item implements FloatingArtefactEntity.Art Box placementArea = UEntities.FLOATING_ARTEFACT.getDimensions().getBoxAt(Vec3d.ofBottomCenter(blockPos)); - if (!world.isSpaceEmpty(null, placementArea, (entity) -> !(entity instanceof ItemEntity)) - || !world.getOtherEntities(null, placementArea).stream().noneMatch(e -> !(e instanceof ItemEntity))) { + if (!world.isSpaceEmpty(null, placementArea)) { return ActionResult.FAIL; } if (world instanceof ServerWorld) { - FloatingArtefactEntity entity = UEntities.FLOATING_ARTEFACT.create((ServerWorld)world, context.getStack().getTag(), null, context.getPlayer(), blockPos, SpawnReason.SPAWN_EGG, false, true); + FloatingArtefactEntity entity = UEntities.FLOATING_ARTEFACT.create((ServerWorld)world, context.getStack().getNbt(), null, context.getPlayer(), blockPos, SpawnReason.SPAWN_EGG, false, true); if (entity == null) { return ActionResult.FAIL; diff --git a/src/main/java/com/minelittlepony/unicopia/item/FriendshipBraceletItem.java b/src/main/java/com/minelittlepony/unicopia/item/FriendshipBraceletItem.java index ef2accf9..dc85e00f 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/FriendshipBraceletItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/FriendshipBraceletItem.java @@ -40,7 +40,7 @@ public class FriendshipBraceletItem extends WearableItem implements DyeableItem, ItemStack result = stack.copy(); result.setCount(1); - result.getOrCreateTag().putString("issuer", player.getName().asString()); + result.getOrCreateNbt().putString("issuer", player.getName().asString()); if (!player.getAbilities().creativeMode) { stack.decrement(1); @@ -83,11 +83,11 @@ public class FriendshipBraceletItem extends WearableItem implements DyeableItem, @Nullable public static String getSignature(ItemStack stack) { - return isSigned(stack) ? stack.getTag().getString("issuer") : null; + return isSigned(stack) ? stack.getNbt().getString("issuer") : null; } public static boolean isSigned(ItemStack stack) { - return stack.hasTag() && stack.getTag().contains("issuer"); + return stack.hasNbt() && stack.getNbt().contains("issuer"); } public static boolean isSignedBy(ItemStack stack, PlayerEntity player) { diff --git a/src/main/java/com/minelittlepony/unicopia/item/GemstoneItem.java b/src/main/java/com/minelittlepony/unicopia/item/GemstoneItem.java index 7b69cc05..34298cb4 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/GemstoneItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/GemstoneItem.java @@ -113,7 +113,7 @@ public class GemstoneItem extends Item { } public static boolean isEnchanted(ItemStack stack) { - return !stack.isEmpty() && stack.hasTag() && stack.getTag().contains("spell"); + return !stack.isEmpty() && stack.hasNbt() && stack.getNbt().contains("spell"); } public static ItemStack enchanted(ItemStack stack, SpellType type) { @@ -121,16 +121,16 @@ public class GemstoneItem extends Item { } public static ItemStack enchanted(ItemStack stack, SpellType type, Affinity affinity) { - stack.getOrCreateTag().putString("spell", type.getId().toString()); + stack.getOrCreateNbt().putString("spell", type.getId().toString()); return type.getTraits().applyTo(stack); } public static ItemStack unenchanted(ItemStack stack) { - stack.removeSubTag("spell"); + stack.removeSubNbt("spell"); return stack; } public static SpellType getSpellKey(ItemStack stack) { - return SpellType.getKey(isEnchanted(stack) ? new Identifier(stack.getTag().getString("spell")) : SpellType.EMPTY_ID); + return SpellType.getKey(isEnchanted(stack) ? new Identifier(stack.getNbt().getString("spell")) : SpellType.EMPTY_ID); } } diff --git a/src/main/java/com/minelittlepony/unicopia/item/GlowableItem.java b/src/main/java/com/minelittlepony/unicopia/item/GlowableItem.java index f50d9155..2e3c8f94 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/GlowableItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/GlowableItem.java @@ -5,11 +5,11 @@ import net.minecraft.nbt.NbtCompound; public interface GlowableItem { default boolean isGlowing(ItemStack stack) { - NbtCompound tag = stack.getSubTag("display"); + NbtCompound tag = stack.getSubNbt("display"); return tag != null && tag.getBoolean("glowing"); } default void setGlowing(ItemStack stack, boolean glowing) { - stack.getOrCreateSubTag("display").putBoolean("glowing", glowing); + stack.getOrCreateSubNbt("display").putBoolean("glowing", glowing); } } diff --git a/src/main/java/com/minelittlepony/unicopia/item/JarItem.java b/src/main/java/com/minelittlepony/unicopia/item/JarItem.java index 3227dd8c..cfdbd135 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/JarItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/JarItem.java @@ -55,7 +55,7 @@ public class JarItem extends Item implements ProjectileDelegate, ItemImpl.Tickab MagicProjectileEntity projectile = new MagicProjectileEntity(world, player); projectile.setItem(stack); projectile.setThrowDamage(getProjectileDamage(stack)); - projectile.setProperties(player, player.getPitch(), player.getYaw(), 0, 1.5F, 1); + projectile.setVelocity(player, player.getPitch(), player.getYaw(), 0, 1.5F, 1); world.spawnEntity(projectile); } diff --git a/src/main/java/com/minelittlepony/unicopia/item/SpellbookItem.java b/src/main/java/com/minelittlepony/unicopia/item/SpellbookItem.java index 13c33771..98d256cb 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/SpellbookItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/SpellbookItem.java @@ -28,7 +28,7 @@ public class SpellbookItem extends BookItem implements Dispensable { @Override public TypedActionResult dispenseStack(BlockPointer source, ItemStack stack) { Direction facing = source.getBlockState().get(DispenserBlock.FACING); - BlockPos pos = source.getBlockPos().offset(facing); + BlockPos pos = source.getPos().offset(facing); float yaw = facing.getOpposite().asRotation(); placeBook(source.getWorld(), pos.getX(), pos.getY(), pos.getZ(), yaw); diff --git a/src/main/java/com/minelittlepony/unicopia/item/ZapAppleItem.java b/src/main/java/com/minelittlepony/unicopia/item/ZapAppleItem.java index c28c92ba..9c501ad8 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/ZapAppleItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/ZapAppleItem.java @@ -103,7 +103,7 @@ public class ZapAppleItem extends AppleItem implements ChameleonItem { UTags.APPLES.values().forEach(item -> { if (item != this) { ItemStack stack = new ItemStack(this); - stack.getOrCreateTag().putString("appearance", Registry.ITEM.getId(item).toString()); + stack.getOrCreateNbt().putString("appearance", Registry.ITEM.getId(item).toString()); items.add(stack); } }); diff --git a/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxin.java b/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxin.java index eb9ac6d4..22989f4d 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxin.java +++ b/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxin.java @@ -13,7 +13,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.text.TranslatableText; -import net.minecraft.util.ChatUtil; +import net.minecraft.util.StringHelper; import net.minecraft.world.Difficulty; public interface Toxin extends Affliction { @@ -96,7 +96,7 @@ public interface Toxin extends Affliction { text = new TranslatableText("potion.withAmplifier", text, new TranslatableText("potion.potency." + amplifier)); } - text = new TranslatableText("potion.withDuration", text, ChatUtil.ticksToString(ticks)); + text = new TranslatableText("potion.withDuration", text, StringHelper.formatTicks(ticks)); return of(text, (player, stack) -> { StatusEffectInstance current = player.getStatusEffect(effect); diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/MixinPlayerEntity.java b/src/main/java/com/minelittlepony/unicopia/mixin/MixinPlayerEntity.java index 4e78028f..ea57c459 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/MixinPlayerEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/MixinPlayerEntity.java @@ -39,7 +39,7 @@ abstract class MixinPlayerEntity extends LivingEntity implements PonyContainer

getEntityCollisions(@Nullable Entity entity, Box box, Predicate predicate) { + public List getEntityCollisions(@Nullable Entity entity, Box box) { if (box.getAverageSideLength() >= 1.0E-7D) { - List shapes = Disguise.getColissonShapes(entity, this, box, predicate); + List shapes = Disguise.getColissonShapes(entity, this, box); if (!shapes.isEmpty()) { - return Stream.concat(shapes.stream(), WorldAccess.super.getEntityCollisions(entity, box, predicate)); + return Stream.concat(shapes.stream(), WorldAccess.super.getEntityCollisions(entity, box).stream()).toList(); } } - return WorldAccess.super.getEntityCollisions(entity, box, predicate); + return WorldAccess.super.getEntityCollisions(entity, box); } @ModifyVariable(method = "setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;II)Z", at = @At("HEAD")) 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 7c73abef..89775c6f 100644 --- a/src/main/java/com/minelittlepony/unicopia/network/handler/ClientNetworkHandlerImpl.java +++ b/src/main/java/com/minelittlepony/unicopia/network/handler/ClientNetworkHandlerImpl.java @@ -23,7 +23,7 @@ public class ClientNetworkHandlerImpl implements ClientNetworkHandler { @Override public void handleTribeScreen(MsgTribeSelect packet) { - client.openScreen(new TribeSelectionScreen(packet.getRaces())); + client.setScreen(new TribeSelectionScreen(packet.getRaces())); } @SuppressWarnings("unchecked") diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f389f598..e369155f 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -32,15 +32,15 @@ }, "depends": { "fabricloader": ">=0.12.0", - "java": ">=16", + "java": ">=17", "fabric-api-base": ">=0.1.0", "fabric-events-lifecycle-v0": ">=0.1.0", - "fabric-keybindings-v0": ">=0.1.0", - "fabric-rendering-v1": ">=0.1.0", "kirin": "*" }, "suggests": { "minelp": "*", - "modmenu": "*" + "modmenu": "*", + "fabric-keybindings-v0": ">=0.1.0", + "fabric-rendering-v1": ">=0.1.0" } } diff --git a/src/main/resources/unicopia.mixin.json b/src/main/resources/unicopia.mixin.json index db39ca19..6bf15099 100644 --- a/src/main/resources/unicopia.mixin.json +++ b/src/main/resources/unicopia.mixin.json @@ -3,7 +3,7 @@ "minVersion": "0.7", "package": "com.minelittlepony.unicopia.mixin", "refmap": "unicopia.mixin.refmap.json", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "mixins": [ "MixinBlazeEntity", "MixinBlockEntity",