mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 11:36:43 +01:00
Fix more low-hanging stuff
This commit is contained in:
parent
c8fd6fa4ea
commit
f3f5a1c006
29 changed files with 122 additions and 103 deletions
|
@ -49,8 +49,8 @@ public class DisguisedArmsFeatureRenderer<E extends LivingEntity> implements Acc
|
|||
private final MinecraftClient client = MinecraftClient.getInstance();
|
||||
|
||||
private static final Map<EntityType<?>, Identifier> OVERLAY_TEXTURES = Map.of(
|
||||
EntityType.DROWNED, new Identifier("textures/entity/zombie/drowned_outer_layer.png"),
|
||||
EntityType.STRAY, new Identifier("textures/entity/skeleton/stray_overlay.png")
|
||||
EntityType.DROWNED, Identifier.ofVanilla("textures/entity/zombie/drowned_outer_layer.png"),
|
||||
EntityType.STRAY, Identifier.ofVanilla("textures/entity/skeleton/stray_overlay.png")
|
||||
);
|
||||
|
||||
private final Function<EntityType<?>, Set<Pair<ModelPart, ModelPart>>> overlayModelCache = Util.memoize(type -> {
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.client.render.item.ItemRenderer;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Colors;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
|
@ -39,12 +40,12 @@ public class GlassesFeatureRenderer<E extends LivingEntity> implements Accessory
|
|||
ItemStack stack = GlassesItem.getForEntity(entity).stack();
|
||||
|
||||
if (!stack.isEmpty()) {
|
||||
Identifier texture = textures.computeIfAbsent(Registries.ITEM.getId(stack.getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
Identifier texture = textures.computeIfAbsent(Registries.ITEM.getId(stack.getItem()), id -> id.withPath(p -> "textures/models/armor/" + p + ".png"));
|
||||
|
||||
VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(texture), false, false);
|
||||
VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(texture), false);
|
||||
|
||||
model.setAngles(entity, context.getModel());
|
||||
model.render(matrices, consumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
model.render(matrices, consumer, lightUv, OverlayTexture.DEFAULT_UV, Colors.WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,8 +74,8 @@ public class GlassesFeatureRenderer<E extends LivingEntity> implements Accessory
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int i, int j, float f, float g, float h, float k) {
|
||||
root.render(matrices, vertexConsumer, i, j, f, g, h, k);
|
||||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
|
||||
root.render(matrices, vertices, light, overlay, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class HornFeatureRenderer<E extends LivingEntity> implements AccessoryFea
|
|||
if (canRender(entity)) {
|
||||
model.setAngles(context.getModel());
|
||||
model.setState(false);
|
||||
model.render(stack, ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(TEXTURE), false, false), lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
model.render(stack, ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(TEXTURE), false), lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
|
||||
Pony.of(entity).flatMap(pony -> {
|
||||
return pony.getAbilities().getActiveStat()
|
||||
|
@ -60,7 +60,7 @@ public class HornFeatureRenderer<E extends LivingEntity> implements AccessoryFea
|
|||
.map(spell -> spell.getTypeAndTraits().type().getColor()));
|
||||
}).ifPresent(color -> {
|
||||
model.setState(true);
|
||||
model.render(stack, ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayers.getMagicColored((0x99 << 24) | color), false, false), lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
model.render(stack, ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayers.getMagicColored((0x99 << 24) | color), false), lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ public class HornFeatureRenderer<E extends LivingEntity> implements AccessoryFea
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrixStack, VertexConsumer vertexConsumer, int i, int j, float f, float g, float h, float k) {
|
||||
part.render(matrixStack, vertexConsumer, i, j, f, g, h, k);
|
||||
public void render(MatrixStack matrixStack, VertexConsumer vertexConsumer, int light, int overlay, int color) {
|
||||
part.render(matrixStack, vertexConsumer, light, overlay, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
|||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||
import net.minecraft.client.util.ModelIdentifier;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.Colors;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
@ -24,7 +24,7 @@ import net.minecraft.registry.Registries;
|
|||
public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredicateProvider {
|
||||
|
||||
private static final PolearmRenderer INSTANCE = new PolearmRenderer();
|
||||
private static final Identifier THROWING = new Identifier("throwing");
|
||||
private static final Identifier THROWING = Identifier.ofVanilla("throwing");
|
||||
|
||||
private final ModelPart model = getTexturedModelData().createModel();
|
||||
|
||||
|
@ -40,9 +40,9 @@ public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredica
|
|||
});
|
||||
}
|
||||
|
||||
static ModelIdentifier getModelId(ItemConvertible item) {
|
||||
static Identifier getModelId(ItemConvertible item) {
|
||||
Identifier id = Registries.ITEM.getId(item.asItem());
|
||||
return new ModelIdentifier(new Identifier(id.getNamespace(), id.getPath() + "_in_inventory"), "inventory");
|
||||
return id.withPath(p -> p + "_in_inventory");
|
||||
}
|
||||
|
||||
public static TexturedModelData getTexturedModelData() {
|
||||
|
@ -88,8 +88,8 @@ public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredica
|
|||
matrices.scale(1, -1, -1);
|
||||
}
|
||||
Identifier id = Registries.ITEM.getId(stack.getItem());
|
||||
Identifier texture = new Identifier(id.getNamespace(), "textures/entity/polearm/" + id.getPath() + ".png");
|
||||
model.render(matrices, ItemRenderer.getDirectItemGlintConsumer(vertexConsumers, RenderLayer.getEntitySolid(texture), false, stack.hasGlint()), light, overlay, 1, 1, 1, 1);
|
||||
Identifier texture = id.withPath(p -> "textures/entity/polearm/" + p + ".png");
|
||||
model.render(matrices, ItemRenderer.getDirectItemGlintConsumer(vertexConsumers, RenderLayer.getEntitySolid(texture), false, stack.hasGlint()), light, overlay, Colors.WHITE);
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class WingsFeatureRenderer<E extends LivingEntity> implements AccessoryFe
|
|||
public void render(MatrixStack matrices, VertexConsumerProvider renderContext, int lightUv, E entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) {
|
||||
if (canRender(entity)) {
|
||||
Identifier texture = getTexture(entity);
|
||||
VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getEntityTranslucent(texture), false, false);
|
||||
VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getEntityTranslucent(texture), false);
|
||||
|
||||
model.setAngles(entity, context.getModel());
|
||||
model.render(matrices, consumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.util.math.MathHelper;
|
|||
|
||||
public class FriendlyCreeperEntityRenderer extends MobEntityRenderer<FriendlyCreeperEntity, FriendlyCreeperEntityRenderer.Model> {
|
||||
private static final Identifier FRIENDLY_TEXTURE = Unicopia.id("textures/entity/creeper/friendly.png");
|
||||
private static final Identifier UNFIRENDLY_TEXTURE = new Identifier("textures/entity/creeper/creeper.png");
|
||||
private static final Identifier UNFIRENDLY_TEXTURE = Identifier.ofVanilla("textures/entity/creeper/creeper.png");
|
||||
|
||||
public FriendlyCreeperEntityRenderer(EntityRendererFactory.Context context) {
|
||||
super(context, new Model(context.getPart(EntityModelLayers.CREEPER)), 0.5f);
|
||||
|
@ -40,10 +40,11 @@ public class FriendlyCreeperEntityRenderer extends MobEntityRenderer<FriendlyCre
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setupTransforms(FriendlyCreeperEntity entity, MatrixStack matrices, float animationProgress, float bodyYaw, float tickDelta) {
|
||||
super.setupTransforms(entity, matrices, animationProgress, bodyYaw, tickDelta);
|
||||
protected void setupTransforms(FriendlyCreeperEntity entity, MatrixStack matrices, float animationProgress, float bodyYaw, float tickDelta, float scale) {
|
||||
super.setupTransforms(entity, matrices, animationProgress, bodyYaw, tickDelta, scale);
|
||||
if (entity.isSitting()) {
|
||||
matrices.translate(0, -0.25, 0);
|
||||
// TODO: Check if creepers are offset correctly
|
||||
matrices.translate(0, -0.25 * scale, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +106,7 @@ public class FriendlyCreeperEntityRenderer extends MobEntityRenderer<FriendlyCre
|
|||
}
|
||||
|
||||
public static class ChargeFeature extends EnergySwirlOverlayFeatureRenderer<FriendlyCreeperEntity, Model> {
|
||||
private static final Identifier SKIN = new Identifier("textures/entity/creeper/creeper_armor.png");
|
||||
private static final Identifier SKIN = Identifier.ofVanilla("textures/entity/creeper/creeper_armor.png");
|
||||
private final CreeperEntityModel<FriendlyCreeperEntity> model;
|
||||
|
||||
public ChargeFeature(FeatureRendererContext<FriendlyCreeperEntity, Model> context, EntityModelLoader loader) {
|
||||
|
|
|
@ -26,7 +26,7 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.util.math.RotationAxis;
|
||||
|
||||
public class MimicEntityRenderer extends MobEntityRenderer<MimicEntity, MimicEntityRenderer.MimicModel> {
|
||||
private static final Identifier TEXTURE = new Identifier("textures/entity/chest/normal.png");
|
||||
private static final Identifier TEXTURE = Identifier.ofVanilla("textures/entity/chest/normal.png");
|
||||
|
||||
public MimicEntityRenderer(EntityRendererFactory.Context context) {
|
||||
super(context, new MimicModel(MimicModel.getTexturedModelData().createModel()), 0);
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.util.math.*;
|
|||
|
||||
public class SpellbookEntityRenderer extends LivingEntityRenderer<SpellbookEntity, SpellbookModel> {
|
||||
private static final Identifier TEXTURE = Unicopia.id("textures/entity/spellbook/normal.png");
|
||||
private static final Identifier ALTAR_BEAM_TEXTURE = new Identifier("textures/entity/end_crystal/end_crystal_beam.png");
|
||||
private static final Identifier ALTAR_BEAM_TEXTURE = Identifier.ofVanilla("textures/entity/end_crystal/end_crystal_beam.png");
|
||||
|
||||
public SpellbookEntityRenderer(EntityRendererFactory.Context context) {
|
||||
super(context, new SpellbookModel(SpellbookModel.getTexturedModelData().createModel()), 0);
|
||||
|
|
|
@ -91,13 +91,12 @@ class PortalFrameBuffer implements AutoCloseable {
|
|||
GlStateManager._enableDepthTest();
|
||||
GlStateManager._disableCull();
|
||||
Tessellator tessellator = RenderSystem.renderThreadTesselator();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
float uScale = (float)framebuffer.viewportWidth / (float)framebuffer.textureWidth;
|
||||
float vScale = (float)framebuffer.viewportHeight / (float)framebuffer.textureHeight;
|
||||
RenderSystem.setShader(UShaders.RENDER_TYPE_PORTAL_SURFACE);
|
||||
//RenderSystem.setShader(GameRenderer::getPositionTexColorProgram);
|
||||
RenderSystem._setShaderTexture(0, framebuffer.getColorAttachment());
|
||||
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
||||
BufferBuilder buffer = tessellator.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
||||
SphereModel.DISK.scaleUV(uScale, vScale);
|
||||
|
||||
RenderSystem.setTextureMatrix(SphereModel.DISK.getTextureMatrix());
|
||||
|
|
|
@ -15,12 +15,11 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.recipe.CraftingRecipe;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.RecipeEntry;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class MagicalShapedEmiRecipe extends EmiCraftingRecipe {
|
||||
public MagicalShapedEmiRecipe(RecipeEntry<? extends CraftingRecipe> recipe, CustomisedSpellType<?> spellEffect, ItemStack output) {
|
||||
super(padIngredients(recipe, spellEffect), EmiStack.of(output),
|
||||
new Identifier(recipe.id().getNamespace(), recipe.id().getPath() + "/" + spellEffect.type().getId().getPath()), false);
|
||||
recipe.id().withPath(p -> p + "/" + spellEffect.type().getId().getPath()), false);
|
||||
EmiShapedRecipe.setRemainders(input, recipe.value());
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ public class Main implements EmiPlugin {
|
|||
});
|
||||
|
||||
Stream.of(UItems.GEMSTONE, UItems.BOTCHED_GEM, UItems.MAGIC_STAFF, UItems.FILLED_JAR).forEach(item -> {
|
||||
registry.setDefaultComparison(item, comparison -> Comparison.compareNbt());
|
||||
registry.setDefaultComparison(item, comparison -> Comparison.compareComponents());
|
||||
});
|
||||
|
||||
DynamicRegistryManager registries = DynamicRegistryManager.of(Registries.REGISTRIES);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.unicopia.datagen.providers.loot;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
|
@ -20,11 +21,12 @@ import net.minecraft.loot.provider.number.UniformLootNumberProvider;
|
|||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
|
||||
public class UChestLootTableProvider extends SimpleFabricLootTableProvider {
|
||||
public UChestLootTableProvider(FabricDataOutput output) {
|
||||
super(output, LootContextTypes.CHEST);
|
||||
public UChestLootTableProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) {
|
||||
super(output, registryLookup, LootContextTypes.CHEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +51,7 @@ public class UChestLootTableProvider extends SimpleFabricLootTableProvider {
|
|||
));
|
||||
}
|
||||
|
||||
private static ItemEntry.Builder<?> createTippedArrowEntry(Potion potion, int weight) {
|
||||
private static ItemEntry.Builder<?> createTippedArrowEntry(RegistryEntry<Potion> potion, int weight) {
|
||||
return ItemEntry.builder(Items.TIPPED_ARROW)
|
||||
.weight(weight)
|
||||
.apply(SetPotionLootFunction.builder(potion))
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.unicopia.datagen.providers.loot;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import com.minelittlepony.unicopia.item.UItems;
|
||||
|
@ -12,13 +13,15 @@ import net.minecraft.loot.LootTable;
|
|||
import net.minecraft.loot.LootTable.Builder;
|
||||
import net.minecraft.loot.context.LootContextTypes;
|
||||
import net.minecraft.loot.entry.ItemEntry;
|
||||
import net.minecraft.loot.function.LootingEnchantLootFunction;
|
||||
import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class UEntityAdditionsLootTableProvider extends SimpleFabricLootTableProvider {
|
||||
public UEntityAdditionsLootTableProvider(FabricDataOutput output) {
|
||||
super(output, LootContextTypes.ENTITY);
|
||||
public UEntityAdditionsLootTableProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) {
|
||||
super(output, registryLookup, LootContextTypes.ENTITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,8 +30,8 @@ public class UEntityAdditionsLootTableProvider extends SimpleFabricLootTableProv
|
|||
}
|
||||
|
||||
@Override
|
||||
public void accept(BiConsumer<Identifier, Builder> exporter) {
|
||||
generate((type, builder) -> exporter.accept(new Identifier("unicopiamc", EntityType.getId(type).withPrefixedPath("entities/").getPath()), builder));
|
||||
public void accept(BiConsumer<RegistryKey<LootTable>, Builder> exporter) {
|
||||
generate((type, builder) -> exporter.accept(RegistryKey.of(RegistryKeys.LOOT_TABLE, Identifier.of("unicopiamc", EntityType.getId(type).withPrefixedPath("entities/").getPath())), builder));
|
||||
}
|
||||
|
||||
protected void generate(BiConsumer<EntityType<?>, Builder> exporter) {
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.loot.condition.RandomChanceLootCondition;
|
|||
import net.minecraft.loot.context.LootContextTypes;
|
||||
import net.minecraft.loot.entry.ItemEntry;
|
||||
import net.minecraft.loot.entry.TagEntry;
|
||||
import net.minecraft.loot.function.LootingEnchantLootFunction;
|
||||
import net.minecraft.loot.function.SetCountLootFunction;
|
||||
import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
|
||||
import net.minecraft.loot.provider.number.UniformLootNumberProvider;
|
||||
|
|
|
@ -49,6 +49,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.entity.projectile.ShulkerBulletEntity;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.registry.RegistryWrapper.WrapperLookup;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
|
||||
|
@ -176,7 +177,7 @@ public class EntityAppearance implements NbtSerialisable, PlayerDimensions.Provi
|
|||
nbt.getString("playerName")
|
||||
), source);
|
||||
|
||||
SkullBlockEntity.fetchProfile(nbt.getString("playerName")).thenAccept(profile -> {
|
||||
SkullBlockEntity.fetchProfileByName(nbt.getString("playerName")).thenAccept(profile -> {
|
||||
profile.ifPresent(p -> createPlayer(nbt, p, source));
|
||||
});
|
||||
} else {
|
||||
|
@ -311,7 +312,7 @@ public class EntityAppearance implements NbtSerialisable, PlayerDimensions.Provi
|
|||
}
|
||||
|
||||
@Override
|
||||
public void toNBT(NbtCompound compound) {
|
||||
public void toNBT(NbtCompound compound, WrapperLookup lookup) {
|
||||
compound.putString("entityId", entityId);
|
||||
|
||||
if (entityNbt != null) {
|
||||
|
@ -322,7 +323,7 @@ public class EntityAppearance implements NbtSerialisable, PlayerDimensions.Provi
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromNBT(NbtCompound compound) {
|
||||
public void fromNBT(NbtCompound compound, WrapperLookup lookup) {
|
||||
String newId = compound.getString("entityId");
|
||||
|
||||
String newPlayerName = null;
|
||||
|
@ -379,7 +380,7 @@ public class EntityAppearance implements NbtSerialisable, PlayerDimensions.Provi
|
|||
playerNbt.remove("unicopia_caster");
|
||||
Pony pony = Pony.of(player);
|
||||
if (pony != null) {
|
||||
NbtSerialisable.subTag("unicopia_caster", playerNbt, pony::toSyncronisedNbt);
|
||||
NbtSerialisable.subTag("unicopia_caster", playerNbt, comp -> pony.toSyncronisedNbt(comp, pony.asEntity().getRegistryManager()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -410,13 +411,13 @@ public class EntityAppearance implements NbtSerialisable, PlayerDimensions.Provi
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readTrackedNbt(NbtCompound nbt) {
|
||||
fromNBT(nbt);
|
||||
public void readTrackedNbt(NbtCompound nbt, WrapperLookup lookup) {
|
||||
fromNBT(nbt, lookup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NbtCompound writeTrackedNbt() {
|
||||
return toNBT();
|
||||
public NbtCompound writeTrackedNbt(WrapperLookup lookup) {
|
||||
return toNBT(lookup);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,8 +82,8 @@ public class EntityBehaviour<T extends Entity> {
|
|||
return Optional.empty();
|
||||
}
|
||||
|
||||
double normalHeight = PlayerEntity.STANDING_DIMENSIONS.height;
|
||||
double entityHeight = entity.getDimensions(entity.getPose()).height;
|
||||
double normalHeight = PlayerEntity.STANDING_DIMENSIONS.height();
|
||||
double entityHeight = entity.getDimensions(entity.getPose()).height();
|
||||
|
||||
return Optional.of(entityHeight / normalHeight);
|
||||
}
|
||||
|
@ -95,10 +95,10 @@ public class EntityBehaviour<T extends Entity> {
|
|||
|
||||
EntityDimensions dims = entity.getDimensions(entity.getPose());
|
||||
|
||||
float h = Math.max(0.001F, dims.height);
|
||||
float w = Math.max(0.001F, dims.width);
|
||||
float h = Math.max(0.001F, dims.height());
|
||||
float w = Math.max(0.001F, dims.width());
|
||||
|
||||
if (current.isPresent() && h == current.get().height && w == current.get().width) {
|
||||
if (current.isPresent() && h == current.get().height() && w == current.get().width()) {
|
||||
return current;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
import com.minelittlepony.unicopia.USounds;
|
||||
|
||||
import net.minecraft.component.type.FoodComponent;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
|
@ -11,7 +12,6 @@ import net.minecraft.entity.effect.StatusEffectInstance;
|
|||
import net.minecraft.entity.effect.StatusEffectCategory;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
|
|
|
@ -35,7 +35,7 @@ import com.minelittlepony.unicopia.server.world.UGameRules;
|
|||
import com.minelittlepony.unicopia.server.world.WeatherConditions;
|
||||
import com.minelittlepony.unicopia.util.*;
|
||||
|
||||
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags;
|
||||
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityType;
|
||||
|
|
|
@ -19,13 +19,13 @@ import com.minelittlepony.unicopia.entity.mob.UEntities;
|
|||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import com.minelittlepony.unicopia.item.group.MultiItem;
|
||||
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.tooltip.TooltipType;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.predicate.entity.EntityPredicates;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
|
@ -97,7 +97,7 @@ public class EnchantedStaffItem extends StaffItem implements EnchantableItem, Ch
|
|||
}
|
||||
|
||||
@Override
|
||||
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> lines, TooltipContext context) {
|
||||
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> lines, TooltipType type) {
|
||||
|
||||
if (EnchantableItem.isEnchanted(stack)) {
|
||||
SpellType<?> key = EnchantableItem.getSpellKey(stack);
|
||||
|
@ -135,13 +135,13 @@ public class EnchantedStaffItem extends StaffItem implements EnchantableItem, Ch
|
|||
|
||||
@Override
|
||||
public void onStoppedUsing(ItemStack stack, World world, LivingEntity entity, int timeLeft) {
|
||||
int i = getMaxUseTime(stack) - timeLeft;
|
||||
int i = getMaxUseTime(stack, entity) - timeLeft;
|
||||
|
||||
if (EnchantableItem.isEnchanted(stack) && hasCharge(stack)) {
|
||||
if (i > 20) {
|
||||
Pony.of(entity).ifPresent(pony -> {
|
||||
pony.subtractEnergyCost(4);
|
||||
stack.damage(1, pony.asEntity(), p -> p.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
||||
stack.damage(1, pony.asEntity(), EquipmentSlot.MAINHAND);
|
||||
getSpellEffect(stack).create().toThrowable().throwProjectile(pony);
|
||||
pony.setAnimation(Animation.ARMS_UP, Animation.Recipient.ANYONE, 10);
|
||||
});
|
||||
|
@ -149,7 +149,7 @@ public class EnchantedStaffItem extends StaffItem implements EnchantableItem, Ch
|
|||
} else if (i > 5) {
|
||||
Pony.of(entity).ifPresent(pony -> {
|
||||
pony.subtractEnergyCost(4);
|
||||
stack.damage(1, pony.asEntity(), p -> p.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
||||
stack.damage(1, pony.asEntity(), EquipmentSlot.MAINHAND);
|
||||
getSpellEffect(stack).create().toThrowable().throwProjectile(pony);
|
||||
pony.setAnimation(Animation.ARMS_UP, Animation.Recipient.ANYONE, 10);
|
||||
});
|
||||
|
@ -161,7 +161,7 @@ public class EnchantedStaffItem extends StaffItem implements EnchantableItem, Ch
|
|||
@Override
|
||||
protected boolean castContainedEffect(ItemStack stack, LivingEntity target, LivingEntity attacker) {
|
||||
if (attacker.isSneaking() && hasCharge(stack)) {
|
||||
stack.damage(50, attacker, p -> p.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
||||
stack.damage(50, attacker, EquipmentSlot.MAINHAND);
|
||||
Caster.of(attacker).ifPresent(c -> c.subtractEnergyCost(4));
|
||||
Caster.of(target).ifPresent(c -> getSpellEffect(stack).apply(c, CastingMethod.STAFF));
|
||||
ChargeableItem.consumeEnergy(stack, 1);
|
||||
|
@ -180,7 +180,7 @@ public class EnchantedStaffItem extends StaffItem implements EnchantableItem, Ch
|
|||
if (living.getActiveItem().getItem() == this) {
|
||||
Vec3d eyes = entity.getCameraPosVec(1);
|
||||
|
||||
float i = getMaxUseTime(stack) - ticksRemaining;
|
||||
float i = getMaxUseTime(stack, entity) - ticksRemaining;
|
||||
|
||||
world.addParticle(i > 150 ? ParticleTypes.LARGE_SMOKE : ParticleTypes.CLOUD, eyes.x, eyes.y, eyes.z,
|
||||
(world.random.nextGaussian() - 0.5) / 10,
|
||||
|
@ -202,7 +202,7 @@ public class EnchantedStaffItem extends StaffItem implements EnchantableItem, Ch
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMaxUseTime(ItemStack stack) {
|
||||
public int getMaxUseTime(ItemStack stack, LivingEntity user) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,22 +17,22 @@ import com.minelittlepony.unicopia.entity.player.Pony;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.DyeableItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Item.TooltipContext;
|
||||
import net.minecraft.item.tooltip.TooltipType;
|
||||
import net.minecraft.stat.Stats;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FriendshipBraceletItem extends WearableItem implements DyeableItem, GlowableItem {
|
||||
public class FriendshipBraceletItem extends WearableItem {
|
||||
|
||||
public FriendshipBraceletItem(FabricItemSettings settings) {
|
||||
public FriendshipBraceletItem(Item.Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
|
@ -73,12 +73,13 @@ public class FriendshipBraceletItem extends WearableItem implements DyeableItem,
|
|||
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> list, TooltipContext tooltipContext) {
|
||||
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> lines, TooltipType type) {
|
||||
super.appendTooltip(stack, context, lines, type);
|
||||
if (isSigned(stack)) {
|
||||
list.add(Text.translatable("item.unicopia.friendship_bracelet.issuer", getSignatorName(stack)));
|
||||
lines.add(Text.translatable("item.unicopia.friendship_bracelet.issuer", getSignatorName(stack)));
|
||||
}
|
||||
if (isGlowing(stack)) {
|
||||
list.add(Text.translatable("item.unicopia.friendship_bracelet.glowing").formatted(Formatting.ITALIC, Formatting.GRAY));
|
||||
if (GlowableItem.isGlowing(stack)) {
|
||||
lines.add(Text.translatable("item.unicopia.friendship_bracelet.glowing").formatted(Formatting.ITALIC, Formatting.GRAY));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.minelittlepony.unicopia.item;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.InteractionManager;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellType;
|
||||
|
@ -12,10 +11,10 @@ import com.minelittlepony.unicopia.entity.player.PlayerCharmTracker;
|
|||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import com.minelittlepony.unicopia.item.group.MultiItem;
|
||||
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.tooltip.TooltipType;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
|
@ -73,8 +72,8 @@ public class GemstoneItem extends Item implements MultiItem, EnchantableItem {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> lines, TooltipContext tooltipContext) {
|
||||
super.appendTooltip(stack, world, lines, tooltipContext);
|
||||
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> lines, TooltipType type) {
|
||||
super.appendTooltip(stack, context, lines, type);
|
||||
|
||||
if (EnchantableItem.isEnchanted(stack)) {
|
||||
getSpellEffect(stack).appendTooltip(lines);
|
||||
|
|
|
@ -2,21 +2,22 @@ package com.minelittlepony.unicopia.item;
|
|||
|
||||
import com.minelittlepony.unicopia.compat.trinkets.TrinketsDelegate;
|
||||
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ArmorMaterials;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
|
||||
public class GlassesItem extends WearableItem {
|
||||
public GlassesItem(FabricItemSettings settings) {
|
||||
public GlassesItem(Item.Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundEvent getEquipSound() {
|
||||
return ArmorMaterials.LEATHER.getEquipSound();
|
||||
public RegistryEntry<SoundEvent> getEquipSound() {
|
||||
return ArmorMaterials.LEATHER.value().equipSound();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.minelittlepony.unicopia.item;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.StewItem;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class OatmealItem extends StewItem {
|
||||
|
||||
public OatmealItem(Settings settings) {
|
||||
public OatmealItem(Item.Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@ import com.minelittlepony.unicopia.entity.ItemTracker;
|
|||
import com.minelittlepony.unicopia.entity.Living;
|
||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PegasusAmuletItem extends AmuletItem implements ItemTracker.Trackable {
|
||||
public PegasusAmuletItem(FabricItemSettings settings, int maxEnergy) {
|
||||
public PegasusAmuletItem(Item.Settings settings, int maxEnergy) {
|
||||
super(settings, maxEnergy);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,14 @@ import com.minelittlepony.unicopia.USounds;
|
|||
import com.minelittlepony.unicopia.UTags;
|
||||
import com.minelittlepony.unicopia.util.RegistryUtils;
|
||||
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.component.type.FoodComponent;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -19,17 +23,18 @@ public class PineappleItem extends Item {
|
|||
|
||||
@Override
|
||||
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
|
||||
if (isFood()) {
|
||||
user.eatFood(world, stack.copy());
|
||||
FoodComponent food = stack.get(DataComponentTypes.FOOD);
|
||||
if (food != null) {
|
||||
user.eatFood(world, stack.copy(), food);
|
||||
if (!world.isClient) {
|
||||
stack.damage(1, user, u -> {
|
||||
AwaitTickQueue.scheduleTask(u.getWorld(), w -> {
|
||||
w.playSoundFromEntity(null, u, USounds.Vanilla.ENTITY_PLAYER_BURP, SoundCategory.PLAYERS, 1, 0.7F);
|
||||
stack.damage(1, (ServerWorld)world, user instanceof ServerPlayerEntity p ? p : null, i -> {
|
||||
AwaitTickQueue.scheduleTask(world, w -> {
|
||||
w.playSoundFromEntity(null, user, USounds.Vanilla.ENTITY_PLAYER_BURP, SoundCategory.PLAYERS, 1, 0.7F);
|
||||
});
|
||||
});
|
||||
|
||||
if (world.random.nextInt(20) == 0) {
|
||||
RegistryUtils.pickRandom(world, UTags.StatusEffects.PINEAPPLE_EFFECTS, e -> !user.hasStatusEffect(e)).ifPresent(effect -> {
|
||||
RegistryUtils.pickRandomEntry(world, UTags.StatusEffects.PINEAPPLE_EFFECTS, e -> !user.hasStatusEffect(e)).ifPresent(effect -> {
|
||||
user.addStatusEffect(new StatusEffectInstance(effect, 10, 1));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public interface UItems {
|
|||
Item MUSIC_DISC_POPULAR = register("music_disc_popular", USounds.RECORD_POPULAR, 112);
|
||||
Item MUSIC_DISC_FUNK = register("music_disc_funk", USounds.RECORD_FUNK, 91);
|
||||
|
||||
FriendshipBraceletItem FRIENDSHIP_BRACELET = register("friendship_bracelet", new FriendshipBraceletItem(new FabricItemSettings().rarity(Rarity.UNCOMMON)), ItemGroups.TOOLS);
|
||||
FriendshipBraceletItem FRIENDSHIP_BRACELET = register("friendship_bracelet", new FriendshipBraceletItem(new Item.Settings().rarity(Rarity.UNCOMMON)), ItemGroups.TOOLS);
|
||||
|
||||
Item PLUNDER_VINE = register("plunder_vine", new BlockItem(UBlocks.PLUNDER_VINE_BUD, new Item.Settings()));
|
||||
Item EMPTY_JAR = register("empty_jar", new EmptyJarItem(UBlocks.JAR, new Item.Settings().fireproof()), ItemGroups.FUNCTIONAL);
|
||||
|
@ -206,26 +206,26 @@ public interface UItems {
|
|||
Item RAINBOW_PBG_BED_SHEETS = register(CloudBedBlock.SheetPattern.RAINBOW_PBG);
|
||||
Item RAINBOW_PWR_BED_SHEETS = register(CloudBedBlock.SheetPattern.RAINBOW_PWR);
|
||||
|
||||
AmuletItem PEGASUS_AMULET = register("pegasus_amulet", new PegasusAmuletItem(new FabricItemSettings()
|
||||
AmuletItem PEGASUS_AMULET = register("pegasus_amulet", new PegasusAmuletItem(new Item.Settings()
|
||||
.maxCount(1)
|
||||
.maxDamage(890)
|
||||
.rarity(Rarity.UNCOMMON), 900), ItemGroups.TOOLS);
|
||||
AlicornAmuletItem ALICORN_AMULET = register("alicorn_amulet", new AlicornAmuletItem(new FabricItemSettings()
|
||||
AlicornAmuletItem ALICORN_AMULET = register("alicorn_amulet", new AlicornAmuletItem(new Item.Settings()
|
||||
.maxCount(1)
|
||||
.maxDamage(1000)
|
||||
.rarity(Rarity.RARE)), ItemGroups.TOOLS);
|
||||
Item BROKEN_ALICORN_AMULET = register("broken_alicorn_amulet", new Item(new Item.Settings()), ItemGroups.TOOLS);
|
||||
AmuletItem UNICORN_AMULET = register("unicorn_amulet", new AmuletItem(new FabricItemSettings()
|
||||
AmuletItem UNICORN_AMULET = register("unicorn_amulet", new AmuletItem(new Item.Settings()
|
||||
.maxCount(1)
|
||||
.maxDamage(890)
|
||||
.rarity(Rarity.UNCOMMON), 0), ItemGroups.TOOLS);
|
||||
AmuletItem PEARL_NECKLACE = register("pearl_necklace", new AmuletItem(new FabricItemSettings()
|
||||
AmuletItem PEARL_NECKLACE = register("pearl_necklace", new AmuletItem(new Item.Settings()
|
||||
.maxCount(1)
|
||||
.maxDamage(16)
|
||||
.rarity(Rarity.UNCOMMON), 0), ItemGroups.TOOLS);
|
||||
|
||||
GlassesItem SUNGLASSES = register("sunglasses", new GlassesItem(new FabricItemSettings().maxCount(1)), ItemGroups.COMBAT);
|
||||
GlassesItem BROKEN_SUNGLASSES = register("broken_sunglasses", new GlassesItem(new FabricItemSettings().maxCount(1)), ItemGroups.COMBAT);
|
||||
GlassesItem SUNGLASSES = register("sunglasses", new GlassesItem(new Item.Settings().maxCount(1)), ItemGroups.COMBAT);
|
||||
GlassesItem BROKEN_SUNGLASSES = register("broken_sunglasses", new GlassesItem(new Item.Settings().maxCount(1)), ItemGroups.COMBAT);
|
||||
|
||||
Item CLAM_SHELL = register("clam_shell", new Item(new Item.Settings()), ItemGroups.INGREDIENTS);
|
||||
Item SCALLOP_SHELL = register("scallop_shell", new Item(new Item.Settings()), ItemGroups.INGREDIENTS);
|
||||
|
|
|
@ -11,18 +11,19 @@ import net.minecraft.entity.EquipmentSlot;
|
|||
import net.minecraft.entity.attribute.EntityAttribute;
|
||||
import net.minecraft.entity.attribute.EntityAttributeInstance;
|
||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
|
||||
// TODO: Replaced with EnchantmentEffectComponentTypes.ATTRIBUTES
|
||||
@Deprecated
|
||||
public class AttributedEnchantment extends SimpleEnchantment {
|
||||
|
||||
private final Map<EntityAttribute, ModifierFactory> modifiers = new HashMap<>();
|
||||
private final Map<RegistryEntry<EntityAttribute>, ModifierFactory> modifiers = new HashMap<>();
|
||||
|
||||
protected AttributedEnchantment(Options options) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
public AttributedEnchantment addModifier(EntityAttribute attribute, ModifierFactory modifierSupplier) {
|
||||
public AttributedEnchantment addModifier(RegistryEntry<EntityAttribute> attribute, ModifierFactory modifierSupplier) {
|
||||
modifiers.put(attribute, modifierSupplier);
|
||||
return this;
|
||||
}
|
||||
|
@ -35,7 +36,7 @@ public class AttributedEnchantment extends SimpleEnchantment {
|
|||
|
||||
EntityAttributeModifier modifier = modifierSupplier.get(user, level);
|
||||
|
||||
instance.removeModifier(modifier.getId());
|
||||
instance.removeModifier(modifier.id());
|
||||
instance.addPersistentModifier(modifier);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -50,10 +50,19 @@ public interface RegistryUtils {
|
|||
.toList(), world.random);
|
||||
}
|
||||
|
||||
static <T> Optional<RegistryEntry<T>> pickRandomEntry(World world, TagKey<T> key, Predicate<RegistryEntry<T>> filter) {
|
||||
return Util.getRandomOrEmpty(world.getRegistryManager().getOptional(key.registry())
|
||||
.flatMap(registry -> registry.getEntryList(key))
|
||||
.stream()
|
||||
.flatMap(Named::stream)
|
||||
.filter(filter)
|
||||
.toList(), world.random);
|
||||
}
|
||||
|
||||
static <T> boolean isIn(World world, T obj, RegistryKey<? extends Registry<T>> registry, TagKey<T> tag) {
|
||||
return world.getRegistryManager().get(registry).getEntry(obj).isIn(tag);
|
||||
}
|
||||
|
||||
|
||||
static <T> Identifier getId(World world, T obj, RegistryKey<? extends Registry<T>> registry) {
|
||||
return world.getRegistryManager().get(registry).getId(obj);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,4 @@ accessible field net/minecraft/entity/mob/CreeperEntity IGNITED
|
|||
accessible field net/minecraft/loot/LootTable pools Ljava/util/List;
|
||||
mutable field net/minecraft/loot/LootTable pools Ljava/util/List;
|
||||
|
||||
#accessible method net/minecraft/block/entity/SkullBlockEntity fetchProfile (Ljava/lang/String;)Ljava/util/concurrent/CompletableFuture;
|
||||
|
||||
accessible method net/minecraft/entity/LightningEntity cleanOxidation (Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)V
|
||||
|
|
Loading…
Reference in a new issue