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 {
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 {

View file

@ -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

View file

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

View file

@ -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<PlayerEntity> players = storage.getPlayersWatchingChunk(new ChunkPos(pos), false).collect(Collectors.toList());
List<ServerPlayerEntity> players = storage.getPlayersWatchingChunk(new ChunkPos(pos), false);
if (!players.isEmpty()) {
Long2ObjectOpenHashMap<Integer> 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);
}
});
}

View file

@ -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<EntityType<?>> TRANSFORMABLE_ENTITIES = entity("transformable");
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) {
return TagRegistry.block(new Identifier("unicopia", name));
return TagFactory.BLOCK.create(new Identifier("unicopia", 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() {

View file

@ -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);

View file

@ -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

View file

@ -158,19 +158,19 @@ public final class SpellTraits implements Iterable<Map.Entry<Trait, Float>> {
}
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 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;
}

View file

@ -48,7 +48,7 @@ public class CustomEventCriterion extends AbstractCriterion<CustomEventCriterion
public CustomEventCriterion.Trigger createTrigger(String name) {
return player -> {
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) {
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.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;
}

View file

@ -39,7 +39,7 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback {
@Override
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)) {
@ -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));
}
}

View file

@ -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) -> {

View file

@ -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"));
}
}

View file

@ -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();
}

View file

@ -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;

View file

@ -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;
});
}

View file

@ -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;

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) {
Matrix4f model = matrices.getModel();
Matrix4f model = matrices.getPositionMatrix();
final double num_rings = 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.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<FloatingArtef
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 verticalOffset = entity.getVerticalOffset(timeDelta);
@ -56,7 +56,7 @@ public class FloatingArtefactEntityRenderer extends EntityRenderer<FloatingArtef
@Override
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.EntityRendererFactory;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.screen.PlayerScreenHandler;
import net.minecraft.util.Identifier;
public class CastSpellEntityRenderer extends EntityRenderer<CastSpellEntity> {
@ -15,6 +15,6 @@ public class CastSpellEntityRenderer extends EntityRenderer<CastSpellEntity> {
@Override
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) {
super(sound, category);
this.looping = true;
this.relative = true;
this.repeat = true;
this.volume = volume;
setTargetVolume(volume);

View file

@ -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)) {

View file

@ -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<ButterflyEntity> BUTTERFLY = register("butterfly", FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT, ButterflyEntity::new)
.dimensions(EntityDimensions.fixed(0.25F, 0.25F)));

View file

@ -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<LivingEntity> {
@Override
protected void sense(ServerWorld world, LivingEntity entity) {
entity.getBrain().getOptionalMemory(MemoryModuleType.VISIBLE_MOBS).ifPresent(targets -> {
Optional<LivingEntity> 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)));
});
}

View file

@ -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<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<>();
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;
}

View file

@ -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);
}

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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();

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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) {

View file

@ -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 <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 {
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);
}
}

View file

@ -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);
}

View file

@ -28,7 +28,7 @@ public class SpellbookItem extends BookItem implements Dispensable {
@Override
public TypedActionResult<ItemStack> 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);

View file

@ -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);
}
});

View file

@ -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);

View file

@ -39,7 +39,7 @@ abstract class MixinPlayerEntity extends LivingEntity implements PonyContainer<P
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) {
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"))
private void beforePlayerMove(PlayerMoveC2SPacket packet, CallbackInfo info) {
ServerPlayerEntity player = ((ServerPlayNetworkHandler)(Object)this).player;
NetworkThreadUtils.forceMainThread(packet, this, player.getServerWorld());
NetworkThreadUtils.forceMainThread(packet, this, player.getWorld());
flyingSurvival = Pony.of(player).getPhysics().isFlyingSurvival;
if (flyingSurvival) {

View file

@ -2,7 +2,6 @@ package com.minelittlepony.unicopia.mixin;
import java.util.List;
import java.util.Stack;
import java.util.function.Predicate;
import java.util.stream.Stream;
import org.jetbrains.annotations.Nullable;
@ -49,15 +48,15 @@ abstract class MixinWorld implements WorldAccess, BlockDestructionManager.Source
}
@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) {
List<VoxelShape> shapes = Disguise.getColissonShapes(entity, this, box, predicate);
List<VoxelShape> 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"))

View file

@ -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")

View file

@ -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"
}
}

View file

@ -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",