Skip to content

Commit

Permalink
Support OptiFine_1.15.2_HD_U_G1_pre20.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZekerZhayard committed Jun 5, 2020
1 parent 4e560c5 commit fecffd2
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# OptiForge ([CurseForge](https://www.curseforge.com/minecraft/mc-mods/optiforge))

*Compatibility: (2020-05-17)*
 *OptiForge-0.1.19*
*Compatibility: (2020-06-05)*
 *OptiForge-0.1.20*
 *Forge-1.15.2-31.1.95 or newer version*
 *OptiFine-1.15.2-G1-pre15 or newer version*
 *OptiFine-1.15.2-G1-pre20 or newer version*

## How to Use

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.1.19
# G1_pre15
optifine_version=7.1.15
mod_version=0.1.20
# G1_pre20
optifine_version=7.1.20
minecraft_version=1.15.2
forge_version=31.1.95
forge_gradle_version=3.0.170
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,24 @@
import net.minecraft.client.renderer.model.IBakedModel;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.Slice;

@Mixin(ItemRenderer.class)
@SuppressWarnings("deprecation")
public abstract class MixinItemRenderer {
@ModifyVariable(
method = "Lnet/minecraft/client/renderer/entity/ItemRenderer;render(Lnet/minecraft/entity/item/ItemEntity;FFLcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;I)V",
at = @At("STORE"),
ordinal = 3,
require = 1,
allow = 1
)
private float modifyVariable$render$0(float f1) {
return this.shouldBob() ? f1 : 0;
}

@Redirect(
method = "Lnet/minecraft/client/renderer/entity/ItemRenderer;render(Lnet/minecraft/entity/item/ItemEntity;FFLcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;I)V",
slice = @Slice(
Expand Down Expand Up @@ -108,12 +120,48 @@ public abstract class MixinItemRenderer {
at = @At(
value = "INVOKE",
target = "Lcom/mojang/blaze3d/matrix/MatrixStack;translate(DDD)V",
ordinal = 4
ordinal = 2
),
require = 1,
allow = 1
)
private void redirect$render$6(MatrixStack matrixStackIn, double x, double y, double z) {
matrixStackIn.translate(this.shouldSpreadItems() ? x : 0, this.shouldSpreadItems() ? y : 0, this.shouldSpreadItems() ? z : 0);
}

@Redirect(
method = "Lnet/minecraft/client/renderer/entity/ItemRenderer;render(Lnet/minecraft/entity/item/ItemEntity;FFLcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;I)V",
at = @At(
value = "INVOKE",
target = "Lcom/mojang/blaze3d/matrix/MatrixStack;translate(DDD)V",
ordinal = 3
),
require = 1,
allow = 1
)
private void redirect$render$7(MatrixStack matrixStackIn, double x, double y, double z) {
matrixStackIn.translate(this.shouldSpreadItems() ? x : 0, this.shouldSpreadItems() ? y : 0, z);
}

@Redirect(
method = "Lnet/minecraft/client/renderer/entity/ItemRenderer;render(Lnet/minecraft/entity/item/ItemEntity;FFLcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;I)V",
at = @At(
value = "INVOKE",
target = "Lcom/mojang/blaze3d/matrix/MatrixStack;translate(DDD)V",
ordinal = 4
),
require = 1,
allow = 1
)
private void redirect$render$8(MatrixStack matrixStackIn, double x, double y, double z) {
matrixStackIn.translate(0.0, 0.0, 0.09375F);
}

public boolean shouldSpreadItems() {
return true;
}

public boolean shouldBob() {
return true;
}
}

0 comments on commit fecffd2

Please sign in to comment.