-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3760fad
commit f4fa467
Showing
3 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/turniplabs/halplibe/mixin/mixins/models/EntityRenderDispatcherMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package turniplabs.halplibe.mixin.mixins.models; | ||
|
||
import net.minecraft.client.render.EntityRenderDispatcher; | ||
import net.minecraft.client.render.entity.EntityRenderer; | ||
import net.minecraft.core.entity.Entity; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
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 turniplabs.halplibe.helper.BlockBuilder; | ||
import turniplabs.halplibe.helper.EntityHelper; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.function.Supplier; | ||
|
||
@Mixin(value = EntityRenderDispatcher.class, remap = false) | ||
public abstract class EntityRenderDispatcherMixin { | ||
@Shadow @Final private Map<Class<?>, EntityRenderer<?>> renderers; | ||
|
||
@Inject(method = "<init>()V", at = @At("TAIL")) | ||
private void addQueuedModels(CallbackInfo ci){ | ||
try { | ||
Set<Map.Entry<Class<? extends Entity> , Supplier<EntityRenderer<?>>>> entries = ((Map<Class<? extends Entity> , Supplier<EntityRenderer<?>>>) EntityHelper.class.getField("queueEntityRenderer").get(null)).entrySet(); | ||
for (Map.Entry<Class<? extends Entity> , Supplier<EntityRenderer<?>>> entry : entries){ | ||
renderers.put(entry.getKey(), entry.getValue().get()); | ||
} | ||
BlockBuilder.class.getField("entityRendererDispatcherInitialized").set(null, true); | ||
} catch (NoSuchFieldException | IllegalAccessException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters