Search in sources :

Example 11 with Unique

use of org.spongepowered.asm.mixin.Unique in project fabric by Legacy-Fabric.

the class CrashReportMixin method getFabricMods.

@Unique
public String getFabricMods() {
    Map<String, String> mods = new TreeMap<>();
    for (ModContainer container : FabricLoader.getInstance().getAllMods()) {
        mods.put(container.getMetadata().getId(), container.getMetadata().getName() + " " + container.getMetadata().getVersion().getFriendlyString());
    }
    StringBuilder modString = new StringBuilder();
    for (String id : mods.keySet()) {
        modString.append("\n\t\t");
        modString.append(id);
        modString.append(": ");
        modString.append(mods.get(id));
    }
    return modString.toString();
}
Also used : ModContainer(net.fabricmc.loader.api.ModContainer) TreeMap(java.util.TreeMap) Unique(org.spongepowered.asm.mixin.Unique)

Example 12 with Unique

use of org.spongepowered.asm.mixin.Unique in project Porting-Lib by Fabricators-of-Create.

the class Matrix4fMixin method multiplyBackward.

@Unique
@Override
public void multiplyBackward(Matrix4f other) {
    Matrix4f copy = other.copy();
    copy.multiply((Matrix4f) (Object) this);
    this.load(copy);
}
Also used : Matrix4f(com.mojang.math.Matrix4f) Unique(org.spongepowered.asm.mixin.Unique)

Example 13 with Unique

use of org.spongepowered.asm.mixin.Unique in project frex by vram-guild.

the class MixinRenderChunkRegion method frx_cachedAoLevel.

@Unique
@Override
public int frx_cachedAoLevel(int packedSectionPos) {
    int result = aoLevelCache.get(packedSectionPos);
    if (result == Integer.MAX_VALUE) {
        final var pos = frx_sectionPosToSearchPos(packedSectionPos);
        final var blockView = (RenderChunkRegion) (Object) this;
        final BlockState state = blockView.getBlockState(pos);
        if (state.getLightEmission() == 0) {
            result = Math.round(255f * state.getShadeBrightness(blockView, pos));
        } else {
            result = 255;
        }
        aoLevelCache.put(packedSectionPos, result);
    }
    return result;
}
Also used : BlockState(net.minecraft.world.level.block.state.BlockState) RenderChunkRegion(net.minecraft.client.renderer.chunk.RenderChunkRegion) Unique(org.spongepowered.asm.mixin.Unique)

Example 14 with Unique

use of org.spongepowered.asm.mixin.Unique in project frex by vram-guild.

the class MixinModelBakery method frx_addModel.

@Override
@Unique
public void frx_addModel(ResourceLocation id) {
    if (id instanceof ModelResourceLocation) {
        loadTopLevel((ModelResourceLocation) id);
    } else {
        // The vanilla addModel method is arbitrarily limited to ModelIdentifiers,
        // but it's useful to tell the game to just load and bake a direct model path as well.
        // Replicate the vanilla logic of addModel here.
        final UnbakedModel unbakedModel = getModel(id);
        this.unbakedCache.put(id, unbakedModel);
        this.topLevelModels.put(id, unbakedModel);
    }
}
Also used : UnbakedModel(net.minecraft.client.resources.model.UnbakedModel) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) Unique(org.spongepowered.asm.mixin.Unique)

Example 15 with Unique

use of org.spongepowered.asm.mixin.Unique in project VisualOverhaul by TeamMidnightDust.

the class MixinJukeboxBlock method tick.

@Unique
private static void tick(World world, BlockPos pos, BlockState state, JukeboxBlockEntity blockEntity) {
    if (!world.isClient && (JukeboxPacketUpdate.invUpdate || world.getPlayers().size() == JukeboxPacketUpdate.playerUpdate)) {
        Stream<ServerPlayerEntity> watchingPlayers = PlayerLookup.tracking(blockEntity).stream();
        PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
        passedData.writeBlockPos(pos);
        passedData.writeItemStack(blockEntity.getRecord());
        watchingPlayers.forEach(player -> ServerSidePacketRegistryImpl.INSTANCE.sendToPlayer(player, VisualOverhaul.UPDATE_RECORD, passedData));
        JukeboxPacketUpdate.invUpdate = false;
    }
    JukeboxPacketUpdate.playerUpdate = world.getPlayers().size();
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) Unique(org.spongepowered.asm.mixin.Unique)

Aggregations

Unique (org.spongepowered.asm.mixin.Unique)53 File (java.io.File)7 FileWriter (java.io.FileWriter)5 CompoundTag (net.minecraft.nbt.CompoundTag)5 FileOutputStream (java.io.FileOutputStream)3 HashSet (java.util.HashSet)3 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)3 Long2ObjectLinkedOpenHashMap (it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap)2 Object2IntOpenHashMap (it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap)2 ObjectArrayList (it.unimi.dsi.fastutil.objects.ObjectArrayList)2 URL (java.net.URL)2 ReadableByteChannel (java.nio.channels.ReadableByteChannel)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 UUID (java.util.UUID)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 ModContainer (net.fabricmc.loader.api.ModContainer)2 PacketByteBuf (net.minecraft.network.PacketByteBuf)2 ChunkHolder (net.minecraft.server.level.ChunkHolder)2