Skip to content

Commit

Permalink
24w37a
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 committed Sep 11, 2024
1 parent a6aa5fa commit 9ed063b
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.minecraft.class_10209;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import net.minecraft.text.Texts;
Expand Down Expand Up @@ -76,7 +77,7 @@ public static boolean executeCommand(String command) {
// noinspection ConstantConditions
FabricClientCommandSource commandSource = (FabricClientCommandSource) client.getNetworkHandler().getCommandSource();

client.getProfiler().push(command);
class_10209.method_64146().push(command);

try {
// TODO: Check for server commands before executing.
Expand All @@ -100,7 +101,7 @@ public static boolean executeCommand(String command) {
commandSource.sendError(Text.of(e.getMessage()));
return true;
} finally {
client.getProfiler().pop();
class_10209.method_64146().pop();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.mixin.content.registry;

import java.util.HashMap;
import java.util.Map;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.entity.ai.brain.task.GiveGiftsToHeroTask;
import net.minecraft.loot.LootTable;
import net.minecraft.registry.RegistryKey;
import net.minecraft.village.VillagerProfession;

@Mixin(GiveGiftsToHeroTask.class)
public class GiveGiftsToHeroTaskMixin {
@Shadow
@Final
@Mutable
private static Map<VillagerProfession, RegistryKey<LootTable>> GIFTS;

@Inject(method = "<clinit>", at = @At("TAIL"))
private static void makeMutable(CallbackInfo ci) {
GIFTS = new HashMap<>(GIFTS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"PathContextMixin",
"FarmerWorkTaskAccessor",
"GiveGiftsToHeroTaskAccessor",
"GiveGiftsToHeroTaskMixin",
"HoeItemAccessor",
"HoneycombItemMixin",
"LandPathNodeMakerMixin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

@Mixin(MobEntity.class)
public class MobEntityMixin {
@ModifyArg(method = "convertTo", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;spawnEntityAndPassengers(Lnet/minecraft/entity/Entity;)V"))
@ModifyArg(method = "convertTo(Lnet/minecraft/entity/EntityType;Lnet/minecraft/entity/conversion/EntityConversionContext;Lnet/minecraft/entity/SpawnReason;Lnet/minecraft/entity/conversion/EntityConversionContext$Finalizer;)Lnet/minecraft/entity/mob/MobEntity;", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;spawnEntity(Lnet/minecraft/entity/Entity;)Z"))
private Entity afterEntityConverted(Entity converted, @Local(argsOnly = true) EntityConversionContext conversionContext) {
ServerLivingEntityEvents.MOB_CONVERSION.invoker().onConversion((MobEntity) (Object) this, (MobEntity) converted, conversionContext);
return converted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.equipment.EquipmentModels;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.server.command.CommandManager;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
Expand All @@ -63,7 +61,7 @@ public final class EntityEventTests implements ModInitializer {
);
public static final Block TEST_BED = new TestBedBlock(AbstractBlock.Settings.create().strength(1, 1).registryKey(TEST_BED_KEY));
public static final RegistryKey<Item> DIAMOND_ELYTRA_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of("fabric-entity-events-v1-testmod", "diamond_elytra"));
public static final Item DIAMOND_ELYTRA = new Item(new Item.Settings().component(DataComponentTypes.GLIDER, Unit.INSTANCE).equippable(EquipmentSlot.CHEST, SoundEvents.ITEM_ARMOR_EQUIP_ELYTRA, EquipmentModels.ELYTRA).registryKey(DIAMOND_ELYTRA_KEY));
public static final Item DIAMOND_ELYTRA = new Item(new Item.Settings().component(DataComponentTypes.GLIDER, Unit.INSTANCE).equippable(EquipmentSlot.CHEST).registryKey(DIAMOND_ELYTRA_KEY));

@Override
public void onInitialize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;

import net.minecraft.util.profiler.Profiler;
import net.minecraft.world.World;
import net.minecraft.world.chunk.WorldChunk;

Expand All @@ -34,9 +33,6 @@ public abstract class WorldMixin implements LoadedChunksCache {
@Shadow
public abstract boolean isClient();

@Shadow
public abstract Profiler getProfiler();

@Unique
private final Set<WorldChunk> loadedChunks = new HashSet<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import net.minecraft.resource.ResourceReloader;
import net.minecraft.util.Identifier;
import net.minecraft.util.Pair;
import net.minecraft.util.profiler.Profiler;

import net.fabricmc.fabric.api.client.model.loading.v1.FabricBakedModelManager;
import net.fabricmc.fabric.impl.client.model.loading.ModelLoadingConstants;
Expand All @@ -66,7 +65,7 @@ public BakedModel getModel(Identifier id) {
}

@Inject(method = "reload", at = @At("HEAD"))
private void onHeadReload(ResourceReloader.Synchronizer synchronizer, ResourceManager manager, Profiler prepareProfiler, Profiler applyProfiler, Executor prepareExecutor, Executor applyExecutor, CallbackInfoReturnable<CompletableFuture<Void>> cir) {
private void onHeadReload(ResourceReloader.Synchronizer synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor, CallbackInfoReturnable<CompletableFuture<Void>> cir) {
eventDispatcherFuture = ModelLoadingPluginManager.preparePlugins(manager, prepareExecutor).thenApplyAsync(ModelLoadingEventDispatcher::new);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.profiler.Profiler;

/**
* Except as noted below, the properties exposed here match the parameters passed to
Expand Down Expand Up @@ -73,13 +72,6 @@ public interface WorldRenderContext {
*/
ClientWorld world();

/**
* Convenient access to game performance profiler.
*
* @return the active profiler
*/
Profiler profiler();

/**
* Test to know if "fabulous" graphics mode is enabled.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.profiler.Profiler;

import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;

Expand All @@ -48,7 +47,6 @@ public final class WorldRenderContextImpl implements WorldRenderContext.BlockOut
private Matrix4f projectionMatrix;
private Matrix4f positionMatrix;
private VertexConsumerProvider consumers;
private Profiler profiler;
private boolean advancedTranslucency;
private ClientWorld world;

Expand All @@ -71,7 +69,6 @@ public void prepare(
Matrix4f projectionMatrix,
Matrix4f positionMatrix,
VertexConsumerProvider consumers,
Profiler profiler,
boolean advancedTranslucency,
ClientWorld world
) {
Expand All @@ -85,7 +82,6 @@ public void prepare(
this.projectionMatrix = projectionMatrix;
this.positionMatrix = positionMatrix;
this.consumers = consumers;
this.profiler = profiler;
this.advancedTranslucency = advancedTranslucency;
this.world = world;
}
Expand Down Expand Up @@ -174,11 +170,6 @@ public LightmapTextureManager lightmapTextureManager() {
return lightmapTextureManager;
}

@Override
public Profiler profiler() {
return profiler;
}

@Override
public boolean advancedTranslucency() {
return advancedTranslucency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsum
}

@Inject(method = "renderArmor", at = @At("HEAD"), cancellable = true)
private void renderArmor(MatrixStack matrices, VertexConsumerProvider vertexConsumers, S state, ItemStack stack, EquipmentSlot armorSlot, int light, A armorModel, CallbackInfo ci) {
private void renderArmor(MatrixStack matrices, VertexConsumerProvider vertexConsumers, ItemStack stack, EquipmentSlot armorSlot, int light, A bipedEntityModel, CallbackInfo ci) {
ArmorRenderer renderer = ArmorRendererRegistryImpl.get(stack.getItem());

if (renderer != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@
import net.minecraft.client.render.entity.feature.CapeFeatureRenderer;
import net.minecraft.client.render.entity.state.PlayerEntityRenderState;
import net.minecraft.item.ItemStack;
import net.minecraft.item.equipment.EquipmentModel;

import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRenderEvents;

@Mixin(CapeFeatureRenderer.class)
public class CapeFeatureRendererMixin {
@WrapOperation(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/feature/CapeFeatureRenderer;method_64075(Lnet/minecraft/item/ItemStack;)Z"), method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/PlayerEntityRenderState;FF)V")
public boolean injectCapeRenderCheck(CapeFeatureRenderer instance, ItemStack itemStack, Operation<Boolean> original, @Local(argsOnly = true) PlayerEntityRenderState state) {
@WrapOperation(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/feature/CapeFeatureRenderer;method_64257(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/equipment/EquipmentModel$LayerType;)Z"), method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/PlayerEntityRenderState;FF)V")
public boolean injectCapeRenderCheck(CapeFeatureRenderer instance, ItemStack itemStack, EquipmentModel.LayerType layerType, Operation<Boolean> original, @Local(argsOnly = true) PlayerEntityRenderState state) {
if (!LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER.invoker().allowCapeRender(state)) {
return false;
}

return original.call(instance, itemStack);
return original.call(instance, itemStack, layerType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public abstract class WorldRendererMixin {

@Inject(method = "render", at = @At("HEAD"))
private void beforeRender(ObjectAllocator objectAllocator, RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, Matrix4f projectionMatrix, CallbackInfo ci) {
context.prepare((WorldRenderer) (Object) this, tickCounter, renderBlockOutline, camera, gameRenderer, lightmapTextureManager, projectionMatrix, positionMatrix, bufferBuilders.getEntityVertexConsumers(), world.getProfiler(), MinecraftClient.isFabulousGraphicsOrBetter(), world);
context.prepare((WorldRenderer) (Object) this, tickCounter, renderBlockOutline, camera, gameRenderer, lightmapTextureManager, projectionMatrix, positionMatrix, bufferBuilders.getEntityVertexConsumers(), MinecraftClient.isFabulousGraphicsOrBetter(), world);
WorldRenderEvents.START.invoker().onStart(context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ private CreateWorldScreenMixin() {
super(null);
}

@ModifyVariable(method = "create(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/gui/screen/Screen;)V",
@ModifyVariable(method = "method_64244",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/world/CreateWorldScreen;createServerConfig(Lnet/minecraft/resource/ResourcePackManager;Lnet/minecraft/resource/DataConfiguration;)Lnet/minecraft/server/SaveLoading$ServerConfig;"))
private static ResourcePackManager onCreateResManagerInit(ResourcePackManager manager) {
// Add mod data packs to the initial res pack manager so they are active even if the user doesn't use custom data packs
manager.providers.add(new ModResourcePackCreator(ResourceType.SERVER_DATA));
return manager;
}

@Redirect(method = "create(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/gui/screen/Screen;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/resource/DataConfiguration;SAFE_MODE:Lnet/minecraft/resource/DataConfiguration;", ordinal = 0))
@Redirect(method = "method_64244", at = @At(value = "FIELD", target = "Lnet/minecraft/resource/DataConfiguration;SAFE_MODE:Lnet/minecraft/resource/DataConfiguration;", ordinal = 0))
private static DataConfiguration replaceDefaultSettings() {
return ModResourcePackUtil.createDefaultDataConfiguration();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.ResourceReloader;
import net.minecraft.resource.SynchronousResourceReloader;
import net.minecraft.util.profiler.Profiler;

/**
* A simplified version of the "resource reload listener" interface, hiding the
Expand All @@ -45,9 +44,9 @@
*/
public interface SimpleResourceReloadListener<T> extends IdentifiableResourceReloadListener {
@Override
default CompletableFuture<Void> reload(ResourceReloader.Synchronizer helper, ResourceManager manager, Profiler loadProfiler, Profiler applyProfiler, Executor loadExecutor, Executor applyExecutor) {
return load(manager, loadProfiler, loadExecutor).thenCompose(helper::whenPrepared).thenCompose(
(o) -> apply(o, manager, applyProfiler, applyExecutor)
default CompletableFuture<Void> reload(ResourceReloader.Synchronizer helper, ResourceManager manager, Executor loadExecutor, Executor applyExecutor) {
return load(manager, loadExecutor).thenCompose(helper::whenPrepared).thenCompose(
(o) -> apply(o, manager, applyExecutor)
);
}

Expand All @@ -56,19 +55,17 @@ default CompletableFuture<Void> reload(ResourceReloader.Synchronizer helper, Res
* must be thread-safe and not modify game state!
*
* @param manager The resource manager used during reloading.
* @param profiler The profiler which may be used for this stage.
* @param executor The executor which should be used for this stage.
* @return A CompletableFuture representing the "data loading" stage.
*/
CompletableFuture<T> load(ResourceManager manager, Profiler profiler, Executor executor);
CompletableFuture<T> load(ResourceManager manager, Executor executor);

/**
* Synchronously apply loaded data to the game state.
*
* @param manager The resource manager used during reloading.
* @param profiler The profiler which may be used for this stage.
* @param executor The executor which should be used for this stage.
* @return A CompletableFuture representing the "data applying" stage.
*/
CompletableFuture<Void> apply(T data, ResourceManager manager, Profiler profiler, Executor executor);
CompletableFuture<Void> apply(T data, ResourceManager manager, Executor executor);
}
48 changes: 24 additions & 24 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ org.gradle.jvmargs=-Xmx2560M
org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true

version=0.104.0
minecraft_version=24w36a
yarn_version=+build.4
version=0.104.1
minecraft_version=24w37a
yarn_version=+build.1
loader_version=0.16.4
installer_version=1.0.1

Expand All @@ -13,50 +13,50 @@ curseforge_minecraft_version=1.21.2-Snapshot

# Do not manually update, use the bumpversions task:
fabric-api-base-version=0.4.45
fabric-api-lookup-api-v1-version=1.6.73
fabric-api-lookup-api-v1-version=1.6.74
fabric-biome-api-v1-version=14.0.2
fabric-block-api-v1-version=1.0.25
fabric-block-view-api-v2-version=1.0.13
fabric-blockrenderlayer-v1-version=1.1.55
fabric-command-api-v1-version=1.2.52
fabric-command-api-v2-version=2.2.31
fabric-commands-v0-version=0.2.69
fabric-content-registries-v0-version=9.0.4
fabric-command-api-v1-version=1.2.53
fabric-command-api-v2-version=2.2.32
fabric-commands-v0-version=0.2.70
fabric-content-registries-v0-version=9.0.5
fabric-crash-report-info-v1-version=0.3.0
fabric-data-attachment-api-v1-version=1.1.32
fabric-data-generation-api-v1-version=21.0.5
fabric-data-attachment-api-v1-version=1.1.33
fabric-data-generation-api-v1-version=21.0.6
fabric-dimensions-v1-version=4.0.3
fabric-entity-events-v1-version=2.0.0
fabric-entity-events-v1-version=2.0.1
fabric-events-interaction-v0-version=2.0.3
fabric-game-rule-api-v1-version=1.0.56
fabric-gametest-api-v1-version=2.0.7
fabric-gametest-api-v1-version=2.0.8
fabric-item-api-v1-version=11.0.5
fabric-item-group-api-v1-version=4.1.8
fabric-item-group-api-v1-version=4.1.9
fabric-key-binding-api-v1-version=1.0.50
fabric-keybindings-v0-version=0.2.48
fabric-lifecycle-events-v1-version=2.3.17
fabric-loot-api-v2-version=3.0.17
fabric-loot-api-v3-version=1.0.5
fabric-lifecycle-events-v1-version=2.3.18
fabric-loot-api-v2-version=3.0.18
fabric-loot-api-v3-version=1.0.6
fabric-message-api-v1-version=6.0.16
fabric-model-loading-api-v1-version=3.0.3
fabric-model-loading-api-v1-version=3.0.4
fabric-networking-api-v1-version=4.2.6
fabric-object-builder-api-v1-version=17.0.1
fabric-object-builder-api-v1-version=17.0.2
fabric-particles-v1-version=4.0.5
fabric-recipe-api-v1-version=6.0.3
fabric-registry-sync-v0-version=5.1.7
fabric-renderer-api-v1-version=3.5.2
fabric-renderer-indigo-version=1.8.2
fabric-rendering-data-attachment-v1-version=0.3.51
fabric-rendering-fluids-v1-version=3.1.9
fabric-rendering-v0-version=1.1.75
fabric-rendering-v1-version=7.0.0
fabric-rendering-v0-version=1.1.76
fabric-rendering-v1-version=8.0.0
fabric-resource-conditions-api-v1-version=5.0.2
fabric-resource-loader-v0-version=2.0.2
fabric-resource-loader-v0-version=3.0.0
fabric-screen-api-v1-version=2.0.28
fabric-screen-handler-api-v1-version=1.3.91
fabric-sound-api-v1-version=1.0.26
fabric-transfer-api-v1-version=5.2.0
fabric-transfer-api-v1-version=5.2.1
fabric-transitive-access-wideners-v1-version=6.1.4
fabric-convention-tags-v1-version=2.0.26
fabric-convention-tags-v2-version=2.7.0
fabric-convention-tags-v1-version=2.0.27
fabric-convention-tags-v2-version=2.7.1
fabric-client-tags-api-v1-version=1.1.18

0 comments on commit 9ed063b

Please sign in to comment.