Skip to content

Commit

Permalink
Merge bug fixes for 0.10.1 version
Browse files Browse the repository at this point in the history
  • Loading branch information
FoundationGames committed Jun 13, 2024
2 parents 4c0deaa + be5dd1f commit c51e2d4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 41 deletions.
3 changes: 0 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ dependencies {

// Sodium for compatibility
modCompileOnlyApi "maven.modrinth:sodium:${project.sodium_version}"

// a bit less load time
// modLocalRuntime "maven.modrinth:lazydfu:0.1.3"
}

processResources {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ loader_version=0.15.11

fabric_version=0.100.1+1.21

mod_version = 0.10+1.21
mod_version = 0.10.1+1.21
maven_group = foundationgames
archives_base_name = enhancedblockentities

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void render(BlockEntityRenderer<BlockEntity> renderer, BlockEntity blockE
};

public BlockEntityRendererOverride() {
EBEEvents.RELOAD_MODELS.register((loader, manager, profiler) -> this.onModelsReload());
EBEEvents.RESOURCE_RELOAD.register(this::onModelsReload);
}

public abstract void render(BlockEntityRenderer<BlockEntity> renderer, BlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@
import net.minecraft.util.profiler.Profiler;

public enum EBEEvents {;
public static final Event<Reload> RELOAD_MODELS = EventFactory.createArrayBacked(Reload.class, (callbacks) -> (loader, manager, profiler) -> {
for (Reload event : callbacks) {
event.onReload(loader, manager, profiler);
public static final Event<Runnable> RESOURCE_RELOAD = EventFactory.createArrayBacked(Runnable.class, (callbacks) -> () -> {
for (var event : callbacks) {
event.run();
}
});

public interface Reload {
void onReload(ModelLoader loader, ResourceManager manager, Profiler profiler);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package foundationgames.enhancedblockentities.mixin;

import foundationgames.enhancedblockentities.event.EBEEvents;
import net.minecraft.client.MinecraftClient;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.concurrent.CompletableFuture;

@Mixin(MinecraftClient.class)
public class MinecraftClientMixin {
@Inject(method = "reloadResources()Ljava/util/concurrent/CompletableFuture;",
at = @At("RETURN"))
private void enhanced_bes$fireReloadEvent(CallbackInfoReturnable<CompletableFuture<Void>> cir) {
cir.getReturnValue().thenAccept(v -> EBEEvents.RESOURCE_RELOAD.invoker().run());
}
}
2 changes: 1 addition & 1 deletion src/main/resources/enhancedblockentities.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"compatibilityLevel": "JAVA_17",
"client": [
"AbstractBlockStateMixin",
"BakedModelManagerMixin",
"BellBlockEntityMixin",
"BlockEntityRenderDispatcherMixin",
"BuiltChunkMixin",
Expand All @@ -14,6 +13,7 @@
"DecoratedPotBlockEntityMixin",
"EnderChestBlockEntityMixin",
"LifecycledResourceManagerImplMixin",
"MinecraftClientMixin",
"ShulkerBoxBlockEntityMixin",
"SignBlockEntityRenderAccessor",
"SignEditScreenMixin",
Expand Down

0 comments on commit c51e2d4

Please sign in to comment.