Access widen MultiPhase and stuff

This commit is contained in:
SD 2021-03-23 08:14:08 +05:30
parent 7913f45d1d
commit 42ca5867bc
8 changed files with 33 additions and 19 deletions

View file

@ -95,6 +95,10 @@ sourceSets {
datagen
}
minecraft {
accessWidener = file('src/main/resources/dimdoors.accesswidener')
}
dependencies {
minecraft "com.mojang:minecraft:21w11a"
mappings "net.fabricmc:yarn:21w11a+build.4:v2"

View file

@ -43,8 +43,6 @@ public interface Condition {
T fromJson(JsonObject json);
JsonObject toJson(T t, JsonObject json);
default String getId() {
return String.valueOf(REGISTRY.getId(this));
}
@ -53,17 +51,7 @@ public interface Condition {
}
static <T extends Condition> ConditionType<T> register(String name, Function<JsonObject, T> fromJson) {
return Registry.register(REGISTRY, new Identifier("dimdoors", name), new ConditionType<T>() {
@Override
public T fromJson(JsonObject json) {
return fromJson.apply(json);
}
@Override
public JsonObject toJson(T t, JsonObject json) {
return t.toJson(json);
}
});
return Registry.register(REGISTRY, new Identifier("dimdoors", name), json -> fromJson.apply(json));
}
}
}

View file

@ -4,6 +4,7 @@ import java.util.Collections;
import java.util.Random;
import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity;
import org.dimdev.dimdoors.mixin.client.accessor.RenderLayerAccessor;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.RenderLayer;
@ -48,7 +49,7 @@ public class EntranceRiftBlockEntityRenderer implements BlockEntityRenderer<Entr
static {
WARP_PATH = new Identifier("dimdoors:textures/other/warp.png");
DIMENSIONAL_PORTAL_SHADER = new RenderPhase.class_5942(ModShaders::getDimensionalPortal);
RENDER_LAYER = RenderLayer.of(
RENDER_LAYER = RenderLayerAccessor.callOf(
"dimensional_portal",
VertexFormats.POSITION,
VertexFormat.DrawMode.QUADS,

View file

@ -9,11 +9,11 @@ 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.class_5912;
import net.minecraft.class_5944;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.resource.ResourceFactory;
import net.minecraft.resource.ResourceManager;
import net.fabricmc.api.EnvType;
@ -23,7 +23,7 @@ import net.fabricmc.api.Environment;
@Mixin(GameRenderer.class)
public abstract class GameRendererMixin {
@Shadow
protected abstract class_5944 method_34522(class_5912 arg, String string, VertexFormat vertexFormat) throws IOException;
protected abstract class_5944 method_34522(ResourceFactory arg, String string, VertexFormat vertexFormat) throws IOException;
@Inject(method = "method_34538", at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraft/client/render/GameRenderer;method_34522(Lnet/minecraft/class_5912;Ljava/lang/String;Lnet/minecraft/client/render/VertexFormat;)Lnet/minecraft/class_5944;"))
public void onReload(ResourceManager resourceManager, CallbackInfo ci) throws IOException {

View file

@ -0,0 +1,15 @@
package org.dimdev.dimdoors.mixin.client.accessor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexFormat;
@Mixin(RenderLayer.class)
public interface RenderLayerAccessor {
@Invoker
static RenderLayer.MultiPhase callOf(String name, VertexFormat vertexFormat, VertexFormat.DrawMode drawMode, int expectedBufferSize, boolean hasCrumbling, boolean translucent, RenderLayer.MultiPhaseParameters phases) {
throw new UnsupportedOperationException();
}
}

View file

@ -0,0 +1,4 @@
accessWidener v1 named
# Because its package private
accessible class net/minecraft/client/render/RenderLayer$MultiPhase

View file

@ -7,9 +7,7 @@
"ExtendedServerPlayNetworkhandlerMixin",
"ItemMixin",
"ItemMixin$SettingsMixin",
"accessor.ListTagAccessor",
"PlayerEntityMixin",
"accessor.RecipesProviderAccessor",
"RegistryKeyMixin",
"ServerPlayerEntityMixin",
"ServerPlayerInteractionManagerMixin",
@ -19,6 +17,8 @@
"accessor.DirectionAccessor",
"accessor.EntityAccessor",
"accessor.GenerationSettingsAccessor",
"accessor.ListTagAccessor",
"accessor.RecipesProviderAccessor",
"accessor.RedstoneWireBlockAccessor",
"accessor.StatsAccessor"
],
@ -26,8 +26,9 @@
"client.ClientPlayerInteractionManagerMixin",
"client.ClientPlayNetworkHandlerMixin",
"client.ExtendedClientPlayNetworkHandlerMixin",
"client.GameRendererMixin",
"client.InGameHudMixin",
"client.GameRendererMixin"
"client.accessor.RenderLayerAccessor"
],
"injectors": {
"defaultRequire": 1

View file

@ -42,6 +42,7 @@
"fabricloader": ">=0.4.0",
"fabric": "*"
},
"accessWidener": "dimdoors.accesswidener",
"custom": {
"cardinal-components": [
"dimdoors:dimensional_registry",