Skip to content

Commit

Permalink
Migrate most mixins to biny
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed May 10, 2024
1 parent 2bfb5ec commit f63b7fc
Show file tree
Hide file tree
Showing 43 changed files with 191 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public abstract class BlockRendererMixin {
@Shadow
public int textureOverride;
@Shadow
public boolean field_81;
public boolean inventoryColorEnabled;
@Shadow
public boolean mirrorTexture;
public boolean flipTextureHorizontally;
@Shadow
public boolean renderAllSides;
public boolean skipFaceCulling;
@Shadow
public int eastFaceRotation;
@Shadow
Expand All @@ -47,7 +47,7 @@ public abstract class BlockRendererMixin {
@Shadow
public int bottomFaceRotation;
@Shadow
public int field_55;
public int useSurroundingBrightness;

private float f;
private float[] af;
Expand Down Expand Up @@ -77,23 +77,23 @@ private void ctrSetDefaultValues(BlockView blockView, CallbackInfo ci) {
*/
private void forgeCtr() {
this.textureOverride = -1;
this.mirrorTexture = false;
this.renderAllSides = false;
this.field_81 = true;
this.flipTextureHorizontally = false;
this.skipFaceCulling = false;
this.inventoryColorEnabled = true;
this.eastFaceRotation = 0;
this.westFaceRotation = 0;
this.southFaceRotation = 0;
this.northFaceRotation = 0;
this.topFaceRotation = 0;
this.bottomFaceRotation = 0;
this.field_55 = 1;
this.useSurroundingBrightness = 1;
}

/**
* @author Eloraam
* @reason implement Forge hooks
*/
@Inject(method = "render", cancellable = true, at = @At("RETURN"))
@Inject(method = "render(Lnet/minecraft/block/Block;III)Z", cancellable = true, at = @At("RETURN"))
private void forge$render(Block block, int i, int j, int k, CallbackInfoReturnable<Boolean> cir) {
int l = block.getRenderType();

Expand Down Expand Up @@ -148,7 +148,7 @@ public void renderRedstoneDust(Args args) {
* @author Eloraam
* @reason implement Forge hooks
*/
@Redirect(method = "method_50", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/block/BlockRenderer;field_67:Z"))
@Redirect(method = "renderSmooth", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/block/BlockRenderManager;fancyGraphics:Z"))
public boolean method_50() {
return ((ForgeTessellator) Tessellator.INSTANCE).defaultTexture() && ForgeClientReflection.BlockRenderer$cfgGrassFix;
}
Expand All @@ -157,7 +157,7 @@ public boolean method_50() {
* @author Eloraam
* @reason implement Forge hooks
*/
@Redirect(method = "method_58", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/block/BlockRenderer;field_67:Z"))
@Redirect(method = "renderFlat", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/block/BlockRenderManager;fancyGraphics:Z"))
public boolean method_58() {
return ((ForgeTessellator) Tessellator.INSTANCE).defaultTexture() && ForgeClientReflection.BlockRenderer$cfgGrassFix;
}
Expand All @@ -166,7 +166,7 @@ public boolean method_58() {
* @author Eloraam
* @reason implement Forge hooks
*/
@Inject(method = "method_48", at = @At("RETURN"))
@Inject(method = "render(Lnet/minecraft/block/Block;IF)V", at = @At("RETURN"))
private void forge$method_48(Block block, int i, float f, CallbackInfo ci) {
int k = block.getRenderType();

Expand All @@ -189,7 +189,7 @@ public boolean method_58() {
* @author Eloraam
* @reason implement Forge hooks
*/
@Inject(method = "method_42", at = @At("RETURN"), cancellable = true)
@Inject(method = "isSideLit", at = @At("RETURN"), cancellable = true)
private static void forge$method_42(int i, CallbackInfoReturnable<Boolean> cir) {
switch (i) {
case 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ClientInteractionManagerMixin {
* @author Eloraam
* @reason implement Forge hooks
*/
@Inject(method = "useItemOnBlock", at = @At("HEAD"), cancellable = true)
@Inject(method = "method_1713", at = @At("HEAD"), cancellable = true)
private void forge$IUseItemFirst(PlayerEntity player, World world, ItemStack stack, int x, int y, int z, int side, CallbackInfoReturnable<Boolean> cir) {
if (stack != null && stack.getItem() instanceof IUseItemFirst) {
IUseItemFirst iuif = (IUseItemFirst) stack.getItem();
Expand All @@ -49,7 +49,7 @@ public class ClientInteractionManagerMixin {
* @author Eloraam
* @reason implement Forge hooks
*/
@WrapOperation(method = "useItemOnBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;useOnBlock(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;IIII)Z"))
@WrapOperation(method = "method_1713", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;useOnBlock(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;IIII)Z"))
private boolean forge$onDestroyCurrentItem(ItemStack instance, PlayerEntity arg2, World world, int j, int k, int l, int i, Operation<Boolean> operation) {
if (!operation.call(instance, arg2, world, j, k, l, i)) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
@Environment(EnvType.CLIENT)
@Mixin(class_555.class)
public abstract class GameRendererMixin {
@WrapOperation(method = "method_1841", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldEventRenderer;method_1547(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/hit/HitResult;ILnet/minecraft/item/ItemStack;F)V"))
@WrapOperation(method = "method_1841", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;method_1547(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/hit/HitResult;ILnet/minecraft/item/ItemStack;F)V"))
private void forge$method_1547(WorldRenderer instance, PlayerEntity arg2, HitResult i, int arg3, ItemStack f, float v, Operation<Void> operation) {
if (!ForgeHooksClient.onBlockHighlight(instance, arg2, i, arg3, f, v)) {
operation.call(instance, arg2, i, arg3, f, v);
}
}

@WrapOperation(method = "method_1841", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldEventRenderer;method_1554(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/hit/HitResult;ILnet/minecraft/item/ItemStack;F)V"))
@WrapOperation(method = "method_1841", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;method_1554(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/hit/HitResult;ILnet/minecraft/item/ItemStack;F)V"))
private void forge$method_1554(WorldRenderer instance, PlayerEntity arg2, HitResult i, int arg3, ItemStack f, float v, Operation<Void> operation) {
if (!ForgeHooksClient.onBlockHighlight(instance, arg2, i, arg3, f, v)) {
operation.call(instance, arg2, i, arg3, f, v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
@Mixin(class_75.class)
public abstract class ParticleManagerMixin implements ForgeParticleManager {
@Shadow
private TextureManager textureManager;
private TextureManager field_271;
@Shadow
protected World world;
protected World field_269;

@Shadow
public abstract void addParticle(Particle particle);
public abstract void method_325(Particle particle);

// Forge Fields
@Unique
Expand Down Expand Up @@ -73,7 +73,7 @@ public abstract class ParticleManagerMixin implements ForgeParticleManager {
* @author Eloraam
* @reason implement Forge hooks
*/
@WrapOperation(method = "method_324", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/particle/ParticleEntity;method_2002(Lnet/minecraft/client/render/Tessellator;FFFFFF)V", ordinal = 0))
@WrapOperation(method = "method_324", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/Particle;method_2002(Lnet/minecraft/client/render/Tessellator;FFFFFF)V", ordinal = 0))
private void forge$method_2002(Particle entityfx, Tessellator tessellator, float f, float f1, float f5, float f2, float f3, float f4, Operation<Void> operation) {
if (!(entityfx instanceof BlockParticle)) {
operation.call(entityfx, tessellator, f, f1, f5, f2, f3, f4);
Expand All @@ -95,7 +95,7 @@ public abstract class ParticleManagerMixin implements ForgeParticleManager {
Tessellator tessellator = Tessellator.INSTANCE;

for (BlockTextureParticles entry : this.effectList) {
GL11.glBindTexture(3553, this.textureManager.getTextureId(entry.texture));
GL11.glBindTexture(3553, this.field_271.getTextureId(entry.texture));
tessellator.startQuads();

for (int y = 0; y < entry.effects.size(); ++y) {
Expand Down Expand Up @@ -124,7 +124,7 @@ public abstract class ParticleManagerMixin implements ForgeParticleManager {
* @author Eloraam
* @reason implement Forge hooks
*/
@Redirect(method = "addBlockBreakParticles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleManager;addParticle(Lnet/minecraft/client/entity/particle/ParticleEntity;)V"))
@Redirect(method = "method_322", at = @At(value = "INVOKE", target = "Lnet/minecraft/class_75;method_325(Lnet/minecraft/client/particle/Particle;)V"))
private void forge$addBlockBreakParticles(class_75 instance, Particle particleEntity, @Local(ordinal = 0) Block block) {
((ForgeParticleManager) instance).addDigParticleEffect((BlockParticle) particleEntity, block);
}
Expand All @@ -133,7 +133,7 @@ public abstract class ParticleManagerMixin implements ForgeParticleManager {
* @author Eloraam
* @reason implement Forge hooks
*/
@Redirect(method = "addBlockClickParticle", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleManager;addParticle(Lnet/minecraft/client/entity/particle/ParticleEntity;)V"))
@Redirect(method = "method_321", at = @At(value = "INVOKE", target = "Lnet/minecraft/class_75;method_325(Lnet/minecraft/client/particle/Particle;)V"))
private void forge$addBlockClickParticle(class_75 instance, Particle particleEntity, @Local(ordinal = 0) Block block) {
((ForgeParticleManager) instance).addDigParticleEffect((BlockParticle) particleEntity, block);
}
Expand Down Expand Up @@ -163,6 +163,6 @@ public void addDigParticleEffect(BlockParticle dig_effect, Block block) {
this.effectList.add(entry);
}

this.addParticle(dig_effect);
this.method_325(dig_effect);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public abstract class PistonRendererMixin extends BlockEntityRenderer {
* @author Eloraam
* @reason implement Forge hooks
*/
@Inject(method = "render(Lnet/minecraft/entity/block/PistonBlockEntity;DDDF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Tessellator;start()V"))
@Inject(method = "render(Lnet/minecraft/class_283;DDDF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Tessellator;startQuads()V"))
private void forge$beforeBlockRender(class_283 tileentitypiston, double d, double d1, double d2, float f, CallbackInfo ci) {
Block block = Block.BLOCKS[tileentitypiston.method_1518()];

Expand All @@ -38,7 +38,7 @@ public abstract class PistonRendererMixin extends BlockEntityRenderer {
* @author Eloraam
* @reason implement Forge hooks
*/
@Inject(method = "render(Lnet/minecraft/entity/block/PistonBlockEntity;DDDF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderHelper;enableLighting()V"))
@Inject(method = "render(Lnet/minecraft/class_283;DDDF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/class_583;method_1930()V"))
private void forge$afterBlockRender(class_283 tileentitypiston, double d, double d1, double d2, float f, CallbackInfo ci) {
Block block = Block.BLOCKS[tileentitypiston.method_1518()];
ForgeHooksClient.afterBlockRender(block, this.field_1131);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private PlayerRendererMixin(EntityModel entityModel, float f) {
* @author Eloraam
* @reason implement Forge hooks
*/
@WrapOperation(method = "render(Lnet/minecraft/entity/player/PlayerEntity;IF)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/PlayerRenderer;bindTexture(Ljava/lang/String;)V"))
@WrapOperation(method = "method_825(Lnet/minecraft/entity/player/PlayerEntity;IF)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/PlayerEntityRenderer;bindTexture(Ljava/lang/String;)V"))
private void forge$bindTexture(PlayerEntityRenderer instance, String s, Operation<Void> operation, @Local(ordinal = 0)ArmorItem item) {
if (item instanceof IArmorTextureProvider) {
operation.call(instance, ((IArmorTextureProvider) item).getArmorTextureFile());
Expand Down
Loading

0 comments on commit f63b7fc

Please sign in to comment.