1.17 -> 1.18

This commit is contained in:
Sollace 2021-12-22 11:15:09 +02:00
parent d0d9ad4043
commit 2cae459eb8
47 changed files with 112 additions and 125 deletions

View file

@ -1,12 +1,12 @@
plugins { plugins {
id 'java-library' 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' id 'org.ajoberstar.reckon' version '0.13.0'
} }
java { java {
toolchain { toolchain {
languageVersion = JavaLanguageVersion.of(16) languageVersion = JavaLanguageVersion.of(17)
} }
} }
@ -14,9 +14,9 @@ group = project.group
description = project.displayname description = project.displayname
archivesBaseName = project.name archivesBaseName = project.name
minecraft { loom {
refmapName = 'unicopia.mixin.refmap.json' mixin.defaultRefmapName = 'unicopia.mixin.refmap.json'
accessWidener 'src/main/resources/unicopia.aw' accessWidenerPath = file('src/main/resources/unicopia.aw')
} }
reckon { reckon {

View file

@ -3,10 +3,10 @@ org.gradle.daemon=false
# Fabric Properties # Fabric Properties
# check these on https://modmuss50.me/fabric.html # check these on https://modmuss50.me/fabric.html
minecraft_version=1.17 minecraft_version=1.18-pre8
yarn_mappings=1.17+build.5 yarn_mappings=1.18-pre8+build.2
loader_version=0.12.0 loader_version=0.12.5
fabric_version=0.34.9+1.17 fabric_version=0.43.0+1.18
# Mod Properties # Mod Properties
group=com.minelittlepony group=com.minelittlepony
@ -16,5 +16,5 @@ org.gradle.daemon=false
# Dependencies # Dependencies
modmenu_version=2.0.0-beta.7 modmenu_version=2.0.0-beta.7
minelp_version=4.3.6 minelp_version=4.4.1
kirin_version=1.10.0 kirin_version=1.10.0

View file

@ -1,6 +1,6 @@
pluginManagement { pluginManagement {
repositories { repositories {
jcenter() mavenCentral()
maven { maven {
name = 'Fabric' name = 'Fabric'
url = 'https://maven.fabricmc.net/' url = 'https://maven.fabricmc.net/'

View file

@ -2,7 +2,6 @@ package com.minelittlepony.unicopia;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import com.minelittlepony.unicopia.network.Channel; import com.minelittlepony.unicopia.network.Channel;
import com.minelittlepony.unicopia.network.MsgBlockDestruction; 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.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.server.world.ThreadedAnvilChunkStorage; import net.minecraft.server.world.ThreadedAnvilChunkStorage;
@ -107,7 +105,7 @@ public class BlockDestructionManager {
ThreadedAnvilChunkStorage storage = world.getChunkManager().threadedAnvilChunkStorage; ThreadedAnvilChunkStorage storage = world.getChunkManager().threadedAnvilChunkStorage;
List<PlayerEntity> players = storage.getPlayersWatchingChunk(new ChunkPos(pos), false).collect(Collectors.toList()); List<ServerPlayerEntity> players = storage.getPlayersWatchingChunk(new ChunkPos(pos), false);
if (!players.isEmpty()) { if (!players.isEmpty()) {
Long2ObjectOpenHashMap<Integer> values = new Long2ObjectOpenHashMap<>(); Long2ObjectOpenHashMap<Integer> values = new Long2ObjectOpenHashMap<>();
@ -129,7 +127,7 @@ public class BlockDestructionManager {
players.forEach(player -> { players.forEach(player -> {
if (player instanceof ServerPlayerEntity) { if (player instanceof ServerPlayerEntity) {
Channel.SERVER_BLOCK_DESTRUCTION.send((ServerPlayerEntity)player, msg); Channel.SERVER_BLOCK_DESTRUCTION.send(player, msg);
} }
}); });
} }

View file

@ -2,7 +2,7 @@ package com.minelittlepony.unicopia;
import com.minelittlepony.unicopia.item.toxin.Toxics; 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.block.Block;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -28,15 +28,15 @@ public interface UTags {
Tag<EntityType<?>> TRANSFORMABLE_ENTITIES = entity("transformable"); Tag<EntityType<?>> TRANSFORMABLE_ENTITIES = entity("transformable");
static Tag<Item> item(String name) { static Tag<Item> item(String name) {
return TagRegistry.item(new Identifier("unicopia", name)); return TagFactory.ITEM.create(new Identifier("unicopia", name));
} }
static Tag<Block> block(String name) { static Tag<Block> block(String name) {
return TagRegistry.block(new Identifier("unicopia", name)); return TagFactory.BLOCK.create(new Identifier("unicopia", name));
} }
static Tag<EntityType<?>> entity(String name) { static Tag<EntityType<?>> entity(String name) {
return TagRegistry.entityType(new Identifier("unicopia", name)); return TagFactory.ENTITY_TYPE.create(new Identifier("unicopia", name));
} }
static void bootstrap() { static void bootstrap() {

View file

@ -51,7 +51,7 @@ public final class ThrowableSpell extends AbstractDelegatingSpell {
projectile.setItem(GemstoneItem.enchanted(UItems.GEMSTONE.getDefaultStack(), spell.getType())); projectile.setItem(GemstoneItem.enchanted(UItems.GEMSTONE.getDefaultStack(), spell.getType()));
projectile.getSpellSlot().put(this); 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(); projectile.setHydrophobic();
configureProjectile(projectile, caster); configureProjectile(projectile, caster);
world.spawnEntity(projectile); world.spawnEntity(projectile);

View file

@ -44,7 +44,7 @@ public class AwkwardSpell extends AbstractSpell {
} }
protected boolean shouldSpawnParticle(ParticleType<?> type) { protected boolean shouldSpawnParticle(ParticleType<?> type) {
return type != ParticleTypes.BARRIER return type != ParticleTypes.BLOCK_MARKER
&& type != ParticleTypes.SMOKE && type != ParticleTypes.SMOKE
&& type != ParticleTypes.EXPLOSION && type != ParticleTypes.EXPLOSION
&& type != ParticleTypes.EXPLOSION_EMITTER && type != ParticleTypes.EXPLOSION_EMITTER

View file

@ -158,19 +158,19 @@ public final class SpellTraits implements Iterable<Map.Entry<Trait, Float>> {
} }
public static Optional<SpellTraits> getEmbeddedTraits(ItemStack stack) { public static Optional<SpellTraits> 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 Optional.empty();
} }
return fromNbt(stack.getTag().getCompound("spell_traits")); return fromNbt(stack.getNbt().getCompound("spell_traits"));
} }
public ItemStack applyTo(ItemStack stack) { public ItemStack applyTo(ItemStack stack) {
stack = stack.copy(); stack = stack.copy();
if (isEmpty()) { if (isEmpty()) {
stack.removeSubTag("spell_traits"); stack.removeSubNbt("spell_traits");
return stack; return stack;
} }
stack.getOrCreateTag().put("spell_traits", toNbt()); stack.getOrCreateNbt().put("spell_traits", toNbt());
return stack; return stack;
} }

View file

@ -48,7 +48,7 @@ public class CustomEventCriterion extends AbstractCriterion<CustomEventCriterion
public CustomEventCriterion.Trigger createTrigger(String name) { public CustomEventCriterion.Trigger createTrigger(String name) {
return player -> { return player -> {
if (player instanceof ServerPlayerEntity) { if (player instanceof ServerPlayerEntity) {
test((ServerPlayerEntity)player, c -> c.test(name, (ServerPlayerEntity)player)); trigger((ServerPlayerEntity)player, c -> c.test(name, (ServerPlayerEntity)player));
} }
}; };
} }

View file

@ -30,7 +30,7 @@ public class RaceChangeCriterion extends AbstractCriterion<RaceChangeCriterion.C
public void trigger(PlayerEntity player) { public void trigger(PlayerEntity player) {
if (player instanceof ServerPlayerEntity) { if (player instanceof ServerPlayerEntity) {
test((ServerPlayerEntity)player, c -> c.test((ServerPlayerEntity)player)); trigger((ServerPlayerEntity)player, c -> c.test((ServerPlayerEntity)player));
} }
} }

View file

@ -41,8 +41,8 @@ public class DiscoveryToast implements Toast {
RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderTexture(0, TEXTURE);
RenderSystem.setShaderColor(1.0F, 1, 1, 1); RenderSystem.setShaderColor(1.0F, 1, 1, 1);
manager.drawTexture(matrices, 0, 0, 0, 32, getWidth(), getHeight()); manager.drawTexture(matrices, 0, 0, 0, 32, getWidth(), getHeight());
manager.getGame().textRenderer.draw(matrices, TITLE, 30, 7, -11534256); manager.getClient().textRenderer.draw(matrices, TITLE, 30, 7, -11534256);
manager.getGame().textRenderer.draw(matrices, DESCRIPTION, 30, 18, -16777216); manager.getClient().textRenderer.draw(matrices, DESCRIPTION, 30, 18, -16777216);
Identifier icon = discoveries.get((int)(startTime / Math.max(1L, MAX_AGE / discoveries.size()) % discoveries.size())); 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.push();
matrixStack.scale(0.6F, 0.6F, 1); matrixStack.scale(0.6F, 0.6F, 1);
RenderSystem.applyModelViewMatrix(); RenderSystem.applyModelViewMatrix();
manager.getGame().getItemRenderer().renderInGui(UItems.SPELLBOOK.getDefaultStack(), 3, 3); manager.getClient().getItemRenderer().renderInGui(UItems.SPELLBOOK.getDefaultStack(), 3, 3);
matrixStack.pop(); matrixStack.pop();
RenderSystem.applyModelViewMatrix(); RenderSystem.applyModelViewMatrix();
RenderSystem.setShaderTexture(0, icon); RenderSystem.setShaderTexture(0, icon);
DrawableHelper.drawTexture(matrices, 8, 8, 1, 0, 0, 16, 16, 16, 16); 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; return startTime - this.startTime >= MAX_AGE ? Toast.Visibility.HIDE : Toast.Visibility.SHOW;
} }

View file

@ -39,7 +39,7 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback {
@Override @Override
public void getTooltip(ItemStack stack, TooltipContext context, List<Text> lines) { public void getTooltip(ItemStack stack, TooltipContext context, List<Text> 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)) { if (isShowing(flags, ItemStack.TooltipSection.MODIFIERS)) {
@ -85,16 +85,16 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback {
return insertPosition + 1; return insertPosition + 1;
} }
if (insertPosition == -1 && stack.hasTag()) { if (insertPosition == -1 && stack.hasNbt()) {
if (isShowing(flags, ItemStack.TooltipSection.MODIFIERS) && stack.getTag().getBoolean("Unbreakable")) { if (isShowing(flags, ItemStack.TooltipSection.MODIFIERS) && stack.getNbt().getBoolean("Unbreakable")) {
insertPosition = checkFor(lines, new TranslatableText("item.unbreakable").formatted(Formatting.BLUE)); insertPosition = checkFor(lines, 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)); 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)); insertPosition = checkFor(lines, new TranslatableText("item.canPlace").formatted(Formatting.GRAY));
} }
} }

View file

@ -28,7 +28,7 @@ import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.particle.UParticles; import com.minelittlepony.unicopia.particle.UParticles;
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; 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.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.BuiltinItemRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry; import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
@ -66,11 +66,11 @@ public interface URenderers {
AccessoryFeatureRenderer.register(IcarusWingsFeatureRenderer::new); AccessoryFeatureRenderer.register(IcarusWingsFeatureRenderer::new);
AccessoryFeatureRenderer.register(BatWingsFeatureRenderer::new); AccessoryFeatureRenderer.register(BatWingsFeatureRenderer::new);
EntityRendererRegistry.INSTANCE.register(UEntities.THROWN_ITEM, FlyingItemEntityRenderer::new); EntityRendererRegistry.register(UEntities.THROWN_ITEM, FlyingItemEntityRenderer::new);
EntityRendererRegistry.INSTANCE.register(UEntities.BUTTERFLY, ButterflyEntityRenderer::new); EntityRendererRegistry.register(UEntities.BUTTERFLY, ButterflyEntityRenderer::new);
EntityRendererRegistry.INSTANCE.register(UEntities.FLOATING_ARTEFACT, FloatingArtefactEntityRenderer::new); EntityRendererRegistry.register(UEntities.FLOATING_ARTEFACT, FloatingArtefactEntityRenderer::new);
EntityRendererRegistry.INSTANCE.register(UEntities.CAST_SPELL, CastSpellEntityRenderer::new); EntityRendererRegistry.register(UEntities.CAST_SPELL, CastSpellEntityRenderer::new);
EntityRendererRegistry.INSTANCE.register(UEntities.SPELLBOOK, SpellbookEntityRenderer::new); EntityRendererRegistry.register(UEntities.SPELLBOOK, SpellbookEntityRenderer::new);
ColorProviderRegistry.ITEM.register((stack, i) -> i > 0 ? -1 : ((DyeableItem)stack.getItem()).getColor(stack), UItems.FRIENDSHIP_BRACELET); ColorProviderRegistry.ITEM.register((stack, i) -> i > 0 ? -1 : ((DyeableItem)stack.getItem()).getColor(stack), UItems.FRIENDSHIP_BRACELET);
BuiltinItemRendererRegistry.INSTANCE.register(UItems.FILLED_JAR, (stack, mode, matrices, vertexConsumers, light, overlay) -> { BuiltinItemRendererRegistry.INSTANCE.register(UItems.FILLED_JAR, (stack, mode, matrices, vertexConsumers, light, overlay) -> {

View file

@ -82,7 +82,7 @@ public class UnicopiaClient implements ClientModInitializer {
} }
if (screen instanceof OpenToLanScreen) { if (screen instanceof OpenToLanScreen) {
buttons.addButton(new Button(screen.width / 2 - 155, 130, 150, 20)) buttons.addButton(new Button(screen.width / 2 - 155, 130, 150, 20))
.onClick(b -> MinecraftClient.getInstance().openScreen(new LanSettingsScreen(screen))) .onClick(b -> MinecraftClient.getInstance().setScreen(new LanSettingsScreen(screen)))
.getStyle().setText(new TranslatableText("unicopia.options.title")); .getStyle().setText(new TranslatableText("unicopia.options.title"));
} }
} }

View file

@ -12,7 +12,6 @@ import net.minecraft.client.gui.tooltip.TooltipComponent;
import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.texture.TextureManager;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.BaseText; import net.minecraft.text.BaseText;
import net.minecraft.text.CharacterVisitor; import net.minecraft.text.CharacterVisitor;
@ -45,7 +44,7 @@ public class ItemTraitsTooltipRenderer extends BaseText implements OrderedText,
} }
@Override @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(); 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.translate(xx + 9, yy + 3, itemRenderer.zOffset + 200.0F);
matrices.scale(0.5F, 0.5F, 1); matrices.scale(0.5F, 0.5F, 1);
VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer()); 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(); immediate.draw();
matrices.pop(); matrices.pop();
} }

View file

@ -113,7 +113,7 @@ class ManaRingSlot extends Slot {
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR); bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
Matrix4f model = matrices.peek().getModel(); Matrix4f model = matrices.peek().getPositionMatrix();
if (!mirrorHorizontally) { if (!mirrorHorizontally) {
startAngle = -startAngle; startAngle = -startAngle;

View file

@ -74,14 +74,14 @@ public class TribeSelectionScreen extends GameGui implements HidesHud {
private void addOption(Race race, int x, int top) { private void addOption(Race race, int x, int top) {
addDrawableChild(new TribeButton(x, top, width, race)).onClick(b -> { addDrawableChild(new TribeButton(x, top, width, race)).onClick(b -> {
finished = true; finished = true;
client.openScreen(new TribeConfirmationScreen(result -> { client.setScreen(new TribeConfirmationScreen(result -> {
finished = false; finished = false;
if (result) { if (result) {
Channel.CLIENT_REQUEST_SPECIES_CHANGE.send(new MsgRequestSpeciesChange(race, true)); Channel.CLIENT_REQUEST_SPECIES_CHANGE.send(new MsgRequestSpeciesChange(race, true));
finish(); finish();
} else { } else {
client.openScreen(this); client.setScreen(this);
} }
}, race)); }, race));
}).setEnabled(allowedRaces.contains(race)); }).setEnabled(allowedRaces.contains(race));
@ -109,7 +109,7 @@ public class TribeSelectionScreen extends GameGui implements HidesHud {
if (!finished && client != null) { if (!finished && client != null) {
client.execute(() -> { client.execute(() -> {
finished = true; finished = true;
client.openScreen(this); client.setScreen(this);
finished = false; finished = false;
}); });
} }

View file

@ -7,7 +7,7 @@ import net.minecraft.util.math.Matrix4f;
public class DiskModel extends SphereModel { public class DiskModel extends SphereModel {
@Override @Override
public void render(MatrixStack.Entry matrices, VertexConsumer vertexWriter, int light, int overlay, float r, float g, float b, float a) { 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 num_rings = 30;
final double zenithIncrement = Math.PI / num_rings; final double zenithIncrement = Math.PI / num_rings;

View file

@ -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) { 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_rings = 40;
final double num_sectors = 40; final double num_sectors = 40;

View file

@ -10,9 +10,9 @@ import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.screen.PlayerScreenHandler;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.Vec3f;
@ -34,7 +34,7 @@ public class FloatingArtefactEntityRenderer extends EntityRenderer<FloatingArtef
stack = UItems.EMPTY_JAR.getDefaultStack(); stack = UItems.EMPTY_JAR.getDefaultStack();
} }
final BakedModel model = this.itemRenderer.getHeldItemModel(stack, entity.world, null, 0); final BakedModel model = itemRenderer.getModel(stack, entity.world, null, 0);
final float variance = 0.25F; final float variance = 0.25F;
final float verticalOffset = entity.getVerticalOffset(timeDelta); final float verticalOffset = entity.getVerticalOffset(timeDelta);
@ -56,7 +56,7 @@ public class FloatingArtefactEntityRenderer extends EntityRenderer<FloatingArtef
@Override @Override
public Identifier getTexture(FloatingArtefactEntity entity) { public Identifier getTexture(FloatingArtefactEntity entity) {
return SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE; return PlayerScreenHandler.BLOCK_ATLAS_TEXTURE;
} }
} }

View file

@ -4,7 +4,7 @@ import com.minelittlepony.unicopia.entity.CastSpellEntity;
import net.minecraft.client.render.entity.EntityRenderer; import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.screen.PlayerScreenHandler;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class CastSpellEntityRenderer extends EntityRenderer<CastSpellEntity> { public class CastSpellEntityRenderer extends EntityRenderer<CastSpellEntity> {
@ -15,6 +15,6 @@ public class CastSpellEntityRenderer extends EntityRenderer<CastSpellEntity> {
@Override @Override
public Identifier getTexture(CastSpellEntity entity) { public Identifier getTexture(CastSpellEntity entity) {
return SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE; return PlayerScreenHandler.BLOCK_ATLAS_TEXTURE;
} }
} }

View file

@ -21,7 +21,7 @@ public abstract class FadeOutSoundInstance extends MovingSoundInstance {
public FadeOutSoundInstance(SoundEvent sound, SoundCategory category, float volume) { public FadeOutSoundInstance(SoundEvent sound, SoundCategory category, float volume) {
super(sound, category); super(sound, category);
this.looping = true; this.relative = true;
this.repeat = true; this.repeat = true;
this.volume = volume; this.volume = volume;
setTargetVolume(volume); setTargetVolume(volume);

View file

@ -145,7 +145,7 @@ public class SpellbookScreenHandler extends ScreenHandler {
.map(recipe -> recipe.craft(input)) .map(recipe -> recipe.craft(input))
.ifPresentOrElse(gemSlot::setCrafted, gemSlot::setUncrafted); .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 (!itemStack2.isEmpty()) {
if (itemStack.isEmpty()) { if (itemStack.isEmpty()) {
input.setStack(i, itemStack2); 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()); itemStack2.increment(itemStack.getCount());
input.setStack(i, itemStack2); input.setStack(i, itemStack2);
} else if (!player.getInventory().insertStack(itemStack2)) { } else if (!player.getInventory().insertStack(itemStack2)) {

View file

@ -18,7 +18,6 @@ import net.minecraft.util.registry.Registry;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biome.Category; import net.minecraft.world.biome.Biome.Category;
@SuppressWarnings("deprecation")
public interface UEntities { public interface UEntities {
EntityType<ButterflyEntity> BUTTERFLY = register("butterfly", FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT, ButterflyEntity::new) EntityType<ButterflyEntity> BUTTERFLY = register("butterfly", FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT, ButterflyEntity::new)
.dimensions(EntityDimensions.fixed(0.25F, 0.25F))); .dimensions(EntityDimensions.fixed(0.25F, 0.25F)));

View file

@ -1,6 +1,5 @@
package com.minelittlepony.unicopia.entity.ai; package com.minelittlepony.unicopia.entity.ai;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -22,12 +21,8 @@ public class WantItNeedItSensor extends Sensor<LivingEntity> {
@Override @Override
protected void sense(ServerWorld world, LivingEntity entity) { protected void sense(ServerWorld world, LivingEntity entity) {
entity.getBrain().getOptionalMemory(MemoryModuleType.VISIBLE_MOBS).ifPresent(targets -> { entity.getBrain().getOptionalMemory(MemoryModuleType.VISIBLE_MOBS).ifPresent(targets -> {
entity.getBrain().remember(MemoryModuleType.ATTACK_TARGET, targets
Optional<LivingEntity> target = targets.stream() .findFirst(e -> (EnchantmentHelper.getEquipmentLevel(UEnchantments.WANT_IT_NEED_IT, e) * 10) >= entity.distanceTo(e)));
.filter(e -> (EnchantmentHelper.getEquipmentLevel(UEnchantments.WANT_IT_NEED_IT, e) * 10) >= entity.distanceTo(e))
.findFirst();
entity.getBrain().remember(MemoryModuleType.ATTACK_TARGET, target);
}); });
} }

View file

@ -6,7 +6,6 @@ import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Predicate;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -379,12 +378,12 @@ public class Disguise implements NbtSerialisable, PlayerDimensions.Provider, Fli
} }
} }
public static List<VoxelShape> getColissonShapes(@Nullable Entity entity, WorldAccess world, Box box, Predicate<Entity> predicate) { public static List<VoxelShape> getColissonShapes(@Nullable Entity entity, WorldAccess world, Box box) {
List<VoxelShape> shapes = new ArrayList<>(); List<VoxelShape> shapes = new ArrayList<>();
ShapeContext ctx = entity == null ? ShapeContext.absent() : ShapeContext.of(entity); ShapeContext ctx = entity == null ? ShapeContext.absent() : ShapeContext.of(entity);
VoxelShape entityShape = VoxelShapes.cuboid(box.expand(1.0E-6D)); 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 -> { Caster.of(e).flatMap(c -> c.getSpellSlot().get(SpellType.DISGUISE, false)).ifPresent(p -> {
p.getDisguise().getCollissionShapes(ctx, shape -> { p.getDisguise().getCollissionShapes(ctx, shape -> {
if (!shape.isEmpty() && VoxelShapes.matchesAnywhere(shape, entityShape, BooleanBiFunction.AND)) { if (!shape.isEmpty() && VoxelShapes.matchesAnywhere(shape, entityShape, BooleanBiFunction.AND)) {
@ -393,7 +392,7 @@ public class Disguise implements NbtSerialisable, PlayerDimensions.Provider, Fli
}); });
}); });
return false; return false;
})); });
return shapes; return shapes;
} }

View file

@ -11,14 +11,14 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.attribute.EntityAttributeModifier; import net.minecraft.entity.attribute.EntityAttributeModifier;
import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.effect.StatusEffect; 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.mob.HostileEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.WorldEvents; import net.minecraft.world.WorldEvents;
public class CorruptInfluenceStatusEffect extends StatusEffect { public class CorruptInfluenceStatusEffect extends StatusEffect {
CorruptInfluenceStatusEffect(int color) { 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_DAMAGE, "6D706448-6A60-4F59-BE8A-C23A6DD2C7A9", 15, EntityAttributeModifier.Operation.ADDITION);
addAttributeModifier(EntityAttributes.GENERIC_ATTACK_SPEED, "6D706448-6A60-4F59-BE8A-C23A6DD2C7A9", 10, EntityAttributeModifier.Operation.ADDITION); addAttributeModifier(EntityAttributes.GENERIC_ATTACK_SPEED, "6D706448-6A60-4F59-BE8A-C23A6DD2C7A9", 10, EntityAttributeModifier.Operation.ADDITION);
} }

View file

@ -8,13 +8,13 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance; 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.entity.effect.StatusEffects;
public class FoodPoisoningStatusEffect extends StatusEffect { public class FoodPoisoningStatusEffect extends StatusEffect {
FoodPoisoningStatusEffect(int color) { FoodPoisoningStatusEffect(int color) {
super(StatusEffectType.HARMFUL, color); super(StatusEffectCategory.HARMFUL, color);
} }
@Override @Override

View file

@ -14,7 +14,7 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance; 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.entity.player.PlayerEntity;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.text.Text; import net.minecraft.text.Text;
@ -35,7 +35,7 @@ public class RaceChangeStatusEffect extends StatusEffect {
private final Race species; private final Race species;
protected RaceChangeStatusEffect(int color, Race species) { protected RaceChangeStatusEffect(int color, Race species) {
super(StatusEffectType.NEUTRAL, color); super(StatusEffectCategory.NEUTRAL, color);
this.species = species; this.species = species;
Registry.register(Registry.STATUS_EFFECT, new Identifier("unicopia", "change_race_" + species.name().toLowerCase()), this); Registry.register(Registry.STATUS_EFFECT, new Identifier("unicopia", "change_race_" + species.name().toLowerCase()), this);

View file

@ -11,7 +11,7 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance; 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.entity.effect.StatusEffects;
import net.minecraft.world.LightType; import net.minecraft.world.LightType;
@ -19,7 +19,7 @@ public class SunBlindnessStatusEffect extends StatusEffect {
public static final int MAX_DURATION = 50; public static final int MAX_DURATION = 50;
SunBlindnessStatusEffect(int color) { SunBlindnessStatusEffect(int color) {
super(StatusEffectType.NEUTRAL, color); super(StatusEffectCategory.NEUTRAL, color);
} }
@Override @Override

View file

@ -39,8 +39,8 @@ import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.ChatUtil;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.StringHelper;
import net.minecraft.util.TypedActionResult; import net.minecraft.util.TypedActionResult;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.LocalDifficulty; import net.minecraft.world.LocalDifficulty;
@ -72,7 +72,7 @@ public class AlicornAmuletItem extends AmuletItem implements PlayerCharmTracker.
if (iplayer != null) { if (iplayer != null) {
int attachedTime = iplayer.getCharms().getArmour().getTicks(this); int attachedTime = iplayer.getCharms().getArmour().getTicks(this);
if (attachedTime > 0) { if (attachedTime > 0) {
tooltip.add(new TranslatableText(getTranslationKey() + ".lore", 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 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 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 -> { public static final Trick MOVE = new Trick(3000, 300, player -> {
float amount = player.world.random.nextFloat() - 0.5F; float amount = player.world.random.nextFloat() - 0.5F;
boolean sideways = player.world.random.nextBoolean(); boolean sideways = player.world.random.nextBoolean();

View file

@ -114,14 +114,14 @@ public class AmuletItem extends WearableItem {
} }
public static float getEnergy(ItemStack stack) { 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) { public static void setEnergy(ItemStack stack, float energy) {
if (energy <= 0) { if (energy <= 0) {
stack.removeSubTag("energy"); stack.removeSubNbt("energy");
} else { } else {
stack.getOrCreateTag().putFloat("energy", energy); stack.getOrCreateNbt().putFloat("energy", energy);
} }
} }

View file

@ -22,11 +22,11 @@ public interface ChameleonItem {
default ItemStack createAppearanceStack(ItemStack stack, Item appearance) { default ItemStack createAppearanceStack(ItemStack stack, Item appearance) {
ItemStack newAppearance = appearance.getDefaultStack(); ItemStack newAppearance = appearance.getDefaultStack();
if (stack.hasTag()) { if (stack.hasNbt()) {
newAppearance.setTag(stack.getTag().copy()); newAppearance.setNbt(stack.getNbt().copy());
} }
newAppearance.setCount(stack.getCount()); newAppearance.setCount(stack.getCount());
newAppearance.removeSubTag("appearance"); newAppearance.removeSubNbt("appearance");
return newAppearance; return newAppearance;
} }
@ -35,8 +35,8 @@ public interface ChameleonItem {
} }
default Item getAppearance(ItemStack stack) { default Item getAppearance(ItemStack stack) {
if (stack.hasTag() && stack.getTag().contains("appearance")) { if (stack.hasNbt() && stack.getNbt().contains("appearance")) {
return Registry.ITEM.get(new Identifier(stack.getTag().getString("appearance"))); return Registry.ITEM.get(new Identifier(stack.getNbt().getString("appearance")));
} }
return Items.AIR; return Items.AIR;
@ -45,13 +45,13 @@ public interface ChameleonItem {
default ItemStack setAppearance(ItemStack stack, ItemStack appearance) { default ItemStack setAppearance(ItemStack stack, ItemStack appearance) {
ItemStack result = stack.copy(); ItemStack result = stack.copy();
if (appearance.hasTag()) { if (appearance.hasNbt()) {
result.setTag(appearance.getTag().copy()); result.setNbt(appearance.getNbt().copy());
result.removeCustomName(); result.removeCustomName();
result.setDamage(stack.getDamage()); result.setDamage(stack.getDamage());
result.setCount(stack.getCount()); 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; return result;
} }

View file

@ -15,7 +15,6 @@ import com.minelittlepony.unicopia.util.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.EndRodBlock; import net.minecraft.block.EndRodBlock;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.Saddleable; import net.minecraft.entity.Saddleable;
import net.minecraft.entity.SpawnGroup; 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)); Box placementArea = UEntities.FLOATING_ARTEFACT.getDimensions().getBoxAt(Vec3d.ofBottomCenter(blockPos));
if (!world.isSpaceEmpty(null, placementArea, (entity) -> !(entity instanceof ItemEntity)) if (!world.isSpaceEmpty(null, placementArea)) {
|| !world.getOtherEntities(null, placementArea).stream().noneMatch(e -> !(e instanceof ItemEntity))) {
return ActionResult.FAIL; return ActionResult.FAIL;
} }
if (world instanceof ServerWorld) { 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) { if (entity == null) {
return ActionResult.FAIL; return ActionResult.FAIL;

View file

@ -40,7 +40,7 @@ public class FriendshipBraceletItem extends WearableItem implements DyeableItem,
ItemStack result = stack.copy(); ItemStack result = stack.copy();
result.setCount(1); result.setCount(1);
result.getOrCreateTag().putString("issuer", player.getName().asString()); result.getOrCreateNbt().putString("issuer", player.getName().asString());
if (!player.getAbilities().creativeMode) { if (!player.getAbilities().creativeMode) {
stack.decrement(1); stack.decrement(1);
@ -83,11 +83,11 @@ public class FriendshipBraceletItem extends WearableItem implements DyeableItem,
@Nullable @Nullable
public static String getSignature(ItemStack stack) { 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) { 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) { public static boolean isSignedBy(ItemStack stack, PlayerEntity player) {

View file

@ -113,7 +113,7 @@ public class GemstoneItem extends Item {
} }
public static boolean isEnchanted(ItemStack stack) { 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) { 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) { 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); return type.getTraits().applyTo(stack);
} }
public static ItemStack unenchanted(ItemStack stack) { public static ItemStack unenchanted(ItemStack stack) {
stack.removeSubTag("spell"); stack.removeSubNbt("spell");
return stack; return stack;
} }
public static <T extends Spell> SpellType<T> getSpellKey(ItemStack stack) { public static <T extends Spell> SpellType<T> 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);
} }
} }

View file

@ -5,11 +5,11 @@ import net.minecraft.nbt.NbtCompound;
public interface GlowableItem { public interface GlowableItem {
default boolean isGlowing(ItemStack stack) { default boolean isGlowing(ItemStack stack) {
NbtCompound tag = stack.getSubTag("display"); NbtCompound tag = stack.getSubNbt("display");
return tag != null && tag.getBoolean("glowing"); return tag != null && tag.getBoolean("glowing");
} }
default void setGlowing(ItemStack stack, boolean glowing) { default void setGlowing(ItemStack stack, boolean glowing) {
stack.getOrCreateSubTag("display").putBoolean("glowing", glowing); stack.getOrCreateSubNbt("display").putBoolean("glowing", glowing);
} }
} }

View file

@ -55,7 +55,7 @@ public class JarItem extends Item implements ProjectileDelegate, ItemImpl.Tickab
MagicProjectileEntity projectile = new MagicProjectileEntity(world, player); MagicProjectileEntity projectile = new MagicProjectileEntity(world, player);
projectile.setItem(stack); projectile.setItem(stack);
projectile.setThrowDamage(getProjectileDamage(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); world.spawnEntity(projectile);
} }

View file

@ -28,7 +28,7 @@ public class SpellbookItem extends BookItem implements Dispensable {
@Override @Override
public TypedActionResult<ItemStack> dispenseStack(BlockPointer source, ItemStack stack) { public TypedActionResult<ItemStack> dispenseStack(BlockPointer source, ItemStack stack) {
Direction facing = source.getBlockState().get(DispenserBlock.FACING); Direction facing = source.getBlockState().get(DispenserBlock.FACING);
BlockPos pos = source.getBlockPos().offset(facing); BlockPos pos = source.getPos().offset(facing);
float yaw = facing.getOpposite().asRotation(); float yaw = facing.getOpposite().asRotation();
placeBook(source.getWorld(), pos.getX(), pos.getY(), pos.getZ(), yaw); placeBook(source.getWorld(), pos.getX(), pos.getY(), pos.getZ(), yaw);

View file

@ -103,7 +103,7 @@ public class ZapAppleItem extends AppleItem implements ChameleonItem {
UTags.APPLES.values().forEach(item -> { UTags.APPLES.values().forEach(item -> {
if (item != this) { if (item != this) {
ItemStack stack = new ItemStack(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); items.add(stack);
} }
}); });

View file

@ -13,7 +13,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.text.MutableText; import net.minecraft.text.MutableText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
import net.minecraft.util.ChatUtil; import net.minecraft.util.StringHelper;
import net.minecraft.world.Difficulty; import net.minecraft.world.Difficulty;
public interface Toxin extends Affliction { 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.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) -> { return of(text, (player, stack) -> {
StatusEffectInstance current = player.getStatusEffect(effect); StatusEffectInstance current = player.getStatusEffect(effect);

View file

@ -39,7 +39,7 @@ abstract class MixinPlayerEntity extends LivingEntity implements PonyContainer<P
return new Pony((PlayerEntity)(Object)this); return new Pony((PlayerEntity)(Object)this);
} }
@ModifyVariable(method = "applyDamage(Lnet/minecraft/entity/damage/DamageSource;F)Z", at = @At("HEAD"), ordinal = 0) @ModifyVariable(method = "applyDamage(Lnet/minecraft/entity/damage/DamageSource;F)V", at = @At("HEAD"), ordinal = 0)
protected float modifyDamageAmount(float amount, DamageSource source) { protected float modifyDamageAmount(float amount, DamageSource source) {
return get().modifyDamage(source, amount).orElse(amount); return get().modifyDamage(source, amount).orElse(amount);
} }

View file

@ -27,7 +27,7 @@ abstract class MixinServerPlayNetworkHandler implements EntityTrackingListener,
@Inject(method = "onPlayerMove(Lnet/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket;)V", at = @At("HEAD")) @Inject(method = "onPlayerMove(Lnet/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket;)V", at = @At("HEAD"))
private void beforePlayerMove(PlayerMoveC2SPacket packet, CallbackInfo info) { private void beforePlayerMove(PlayerMoveC2SPacket packet, CallbackInfo info) {
ServerPlayerEntity player = ((ServerPlayNetworkHandler)(Object)this).player; ServerPlayerEntity player = ((ServerPlayNetworkHandler)(Object)this).player;
NetworkThreadUtils.forceMainThread(packet, this, player.getServerWorld()); NetworkThreadUtils.forceMainThread(packet, this, player.getWorld());
flyingSurvival = Pony.of(player).getPhysics().isFlyingSurvival; flyingSurvival = Pony.of(player).getPhysics().isFlyingSurvival;
if (flyingSurvival) { if (flyingSurvival) {

View file

@ -2,7 +2,6 @@ package com.minelittlepony.unicopia.mixin;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
import java.util.function.Predicate;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -49,15 +48,15 @@ abstract class MixinWorld implements WorldAccess, BlockDestructionManager.Source
} }
@Override @Override
public Stream<VoxelShape> getEntityCollisions(@Nullable Entity entity, Box box, Predicate<Entity> predicate) { public List<VoxelShape> getEntityCollisions(@Nullable Entity entity, Box box) {
if (box.getAverageSideLength() >= 1.0E-7D) { if (box.getAverageSideLength() >= 1.0E-7D) {
List<VoxelShape> shapes = Disguise.getColissonShapes(entity, this, box, predicate); List<VoxelShape> shapes = Disguise.getColissonShapes(entity, this, box);
if (!shapes.isEmpty()) { 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")) @ModifyVariable(method = "setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;II)Z", at = @At("HEAD"))

View file

@ -23,7 +23,7 @@ public class ClientNetworkHandlerImpl implements ClientNetworkHandler {
@Override @Override
public void handleTribeScreen(MsgTribeSelect packet) { public void handleTribeScreen(MsgTribeSelect packet) {
client.openScreen(new TribeSelectionScreen(packet.getRaces())); client.setScreen(new TribeSelectionScreen(packet.getRaces()));
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View file

@ -32,15 +32,15 @@
}, },
"depends": { "depends": {
"fabricloader": ">=0.12.0", "fabricloader": ">=0.12.0",
"java": ">=16", "java": ">=17",
"fabric-api-base": ">=0.1.0", "fabric-api-base": ">=0.1.0",
"fabric-events-lifecycle-v0": ">=0.1.0", "fabric-events-lifecycle-v0": ">=0.1.0",
"fabric-keybindings-v0": ">=0.1.0",
"fabric-rendering-v1": ">=0.1.0",
"kirin": "*" "kirin": "*"
}, },
"suggests": { "suggests": {
"minelp": "*", "minelp": "*",
"modmenu": "*" "modmenu": "*",
"fabric-keybindings-v0": ">=0.1.0",
"fabric-rendering-v1": ">=0.1.0"
} }
} }

View file

@ -3,7 +3,7 @@
"minVersion": "0.7", "minVersion": "0.7",
"package": "com.minelittlepony.unicopia.mixin", "package": "com.minelittlepony.unicopia.mixin",
"refmap": "unicopia.mixin.refmap.json", "refmap": "unicopia.mixin.refmap.json",
"compatibilityLevel": "JAVA_16", "compatibilityLevel": "JAVA_17",
"mixins": [ "mixins": [
"MixinBlazeEntity", "MixinBlazeEntity",
"MixinBlockEntity", "MixinBlockEntity",