Skip to content

Commit

Permalink
Sync NotFine
Browse files Browse the repository at this point in the history
Could scale and render distance NYI
  • Loading branch information
jss2a98aj authored and mitchej123 committed Apr 19, 2024
1 parent eb8a826 commit e59e41b
Show file tree
Hide file tree
Showing 107 changed files with 1,369 additions and 863 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ public class AngelicaConfig {
@Config.RequiresMcRestart
public static boolean enableSodium;

@Config.Comment("Enable NotFine Options")
@Config.DefaultBoolean(false)
public static boolean enableNotFineOptions;

@Config.Comment("Enable Reese's Sodium Options")
@Config.DefaultBoolean(true)
public static boolean enableReesesSodiumOptions;
Expand Down Expand Up @@ -40,11 +44,6 @@ public class AngelicaConfig {
@Config.Ignore()
public static boolean enableMCPatcherForgeFeatures;

@Config.Comment("Enable NotFine optimizations")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean enableNotFineOptimizations;

@Config.Comment("Replace some vanilla render paths with more optimized versions. Disable if you encounter mixin conflicts.")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import com.gtnewhorizons.angelica.mixins.Mixins;
import com.gtnewhorizons.angelica.mixins.TargetedMod;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import mist475.mcpatcherforge.asm.AsmTransformers;
import mist475.mcpatcherforge.asm.mappings.Namer;
import jss.notfine.asm.AsmTransformers;
import jss.notfine.asm.mappings.Namer;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
369 changes: 199 additions & 170 deletions src/main/java/com/gtnewhorizons/angelica/mixins/Mixins.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package com.gtnewhorizons.angelica.mixins.early.angelica;

import com.gtnewhorizons.angelica.rendering.RenderingState;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import jss.notfine.core.Settings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.WorldProvider;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -27,8 +23,4 @@ public abstract class MixinEntityRenderer {
);
}

@WrapOperation(method = "setupFog", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/WorldProvider;getWorldHasVoidParticles()Z"))
private boolean angelica$wrapVoidFog(WorldProvider provider, Operation<Boolean> original){
return ((boolean)Settings.VOID_FOG.option.getStore()) ? original.call(provider) : false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

import com.gtnewhorizons.angelica.mixins.interfaces.AbstractTextureExpansion;
import jss.notfine.util.AbstractTextureExpansion;

@Mixin(AbstractTexture.class)
public abstract class MixinAbstractTexture implements AbstractTextureExpansion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.prupe.mcpatcher.mal.tile.TileLoader;
import com.prupe.mcpatcher.mob.MobRandomizer;

import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
import jss.notfine.config.MCPatcherForgeConfig;

@Mixin(Minecraft.class)
public abstract class MixinMinecraft {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import com.gtnewhorizons.angelica.mixins.interfaces.MapColorExpansion;
import jss.notfine.util.MapColorExpansion;

@Mixin(MapColor.class)
public abstract class MixinMapColor implements MapColorExpansion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.prupe.mcpatcher.cc.ColorizeEntity;
import com.prupe.mcpatcher.cc.Colorizer;

import com.gtnewhorizons.angelica.mixins.interfaces.EntityAuraFXExpansion;
import jss.notfine.util.EntityAuraFXExpansion;

@Mixin(EntityAuraFX.class)
public abstract class MixinEntityAuraFX extends EntityFX implements EntityAuraFXExpansion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected MixinEntityDropParticleFX(World world, double x, double y, double z) {
at = @At("RETURN"))
private void modifyConstructor(World worldIn, double x, double y, double z, Material material, CallbackInfo ci) {
if (material == Material.water) {
if (ColorizeBlock.computeWaterColor(true, (int) this.posX, (int) this.posY, (int) this.posZ)) {
if (ColorizeBlock.computeWaterColor(false, (int) this.posX, (int) this.posY, (int) this.posZ)) {
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
this.particleBlue = Colorizer.setColor[2];
Expand All @@ -45,10 +45,6 @@ private void modifyConstructor(World worldIn, double x, double y, double z, Mate
this.particleGreen = 0.3f;
this.particleBlue = 1.0f;
}
} else {
this.particleRed = 1.0F;
this.particleGreen = 0.0F;
this.particleBlue = 0.0F;
}
}

Expand All @@ -63,8 +59,8 @@ public void onUpdate() {
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;

// Patch start
if (this.materialType != Material.water) {
// Patch start
if (ColorizeEntity.computeLavaDropColor(40 - this.bobTimer)) {
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
Expand All @@ -74,12 +70,8 @@ public void onUpdate() {
this.particleGreen = 16.0f / (40 - this.bobTimer + 16);
this.particleBlue = 4.0f / (40 - this.bobTimer + 8);
}
// Patch end
} else {
this.particleRed = 1.0F;
this.particleGreen = 16.0F / (float) (40 - this.bobTimer + 16);
this.particleBlue = 4.0F / (float) (40 - this.bobTimer + 8);
}
// Patch end

this.motionY -= this.particleGravity;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ private void modifyConstructor(World world, double x, double y, double z, double
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
this.particleBlue = Colorizer.setColor[2];
} else {
this.particleRed = 0.2f;
this.particleGreen = 0.3f;
this.particleBlue = 1.0f;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import com.prupe.mcpatcher.cc.ColorizeItem;

import com.gtnewhorizons.angelica.mixins.interfaces.PotionExpansion;
import jss.notfine.util.PotionExpansion;

@Mixin(Potion.class)
public abstract class MixinPotion implements PotionExpansion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ private float modifyGetSkyColorBody4(float input, @Share("computeSkyColor") Loca
}
return input;
}

@SuppressWarnings("InvalidInjectorMethodSignature")
@ModifyVariable(
method = "getSkyColorBody(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/util/Vec3;",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer;

import com.prupe.mcpatcher.cit.CITUtils;
import jss.notfine.util.itembreakparticles.IRenderGlobalSpawnItemBreakParticle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.particle.EntityBreakingFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(value = RenderGlobal.class)
public abstract class MixinRenderGlobal implements IRenderGlobalSpawnItemBreakParticle {

public EntityFX spawnItemBreakParticle(ItemStack itemStack, final double x, final double y, final double z, double velocityX, double velocityY, double velocityZ) {
int i = mc.gameSettings.particleSetting;

if (i == 1 && theWorld.rand.nextInt(3) == 0) {
i = 2;
}
if (i > 1) {
return null;
}

double relX = this.mc.renderViewEntity.posX - x;
double relY = this.mc.renderViewEntity.posY - y;
double relZ = this.mc.renderViewEntity.posZ - z;

double distance = 16.0D;

if (relX * relX + relY * relY + relZ * relZ > distance * distance) {
return null;
}

Item item = itemStack.getItem();
int meta = itemStack.getItemDamage();
EntityFX entityfx = new EntityBreakingFX(theWorld, x, y, z, velocityX, velocityY, velocityZ, item, meta);
entityfx.particleIcon = CITUtils.getIcon(item.getIconFromDamage(meta), itemStack, 0);
mc.effectRenderer.addEffect(entityfx);
return entityfx;
}

@Shadow
private Minecraft mc;
@Shadow
private WorldClient theWorld;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.entity;

import jss.notfine.NotFine;
import jss.notfine.util.itembreakparticles.IWorldSpawnItemBreakParticle;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

@Mixin(value = EntityLivingBase.class)
public abstract class MixinEntityLivingBase extends Entity {

/**
* @author jss2a98aj
* @reason Fix item break particles
*/
@Overwrite
public void renderBrokenItemStack(ItemStack itemStack) {
playSound("random.break", 0.8F, 0.8F + this.worldObj.rand.nextFloat() * 0.4F);

for(int i = 0; i < 5; ++i) {
Vec3 vec3 = Vec3.createVectorHelper(((double)rand.nextFloat() - 0.5) * 0.1, Math.random() * 0.1 + 0.1, 0.0);
vec3.rotateAroundX(-rotationPitch * 3.1415927F / 180.0F);
vec3.rotateAroundY(-rotationYaw * 3.1415927F / 180.0F);
Vec3 vec31 = Vec3.createVectorHelper(((double)rand.nextFloat() - 0.5) * 0.3, (double)(-rand.nextFloat()) * 0.6 - 0.3, 0.6);
vec31.rotateAroundX(-rotationPitch * 3.1415927F / 180.0F);
vec31.rotateAroundY(-rotationYaw * 3.1415927F / 180.0F);
vec31 = vec31.addVector(posX, posY + (double)getEyeHeight(), posZ);
NotFine.logger.info("Item broken, calling IWorldSpawnItemBreakParticle spawnItemBreakParticle");
((IWorldSpawnItemBreakParticle)worldObj).spawnItemBreakParticle(itemStack,
"iconcrack_" + Item.getIdFromItem(itemStack.getItem()),
vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05, vec3.zCoord);
}

}

private MixinEntityLivingBase(World world) { super(world); }

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

import com.gtnewhorizons.angelica.mixins.interfaces.NBTTagCompoundExpansion;
import jss.notfine.util.NBTTagCompoundExpansion;

@Mixin(NBTTagCompound.class)
public abstract class MixinNBTTagCompound implements NBTTagCompoundExpansion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

import com.gtnewhorizons.angelica.mixins.interfaces.NBTTagListExpansion;
import jss.notfine.util.NBTTagListExpansion;

@Mixin(NBTTagList.class)
public class MixinNBTTagList implements NBTTagListExpansion {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.world;

import jss.notfine.util.itembreakparticles.IRenderGlobalSpawnItemBreakParticle;
import jss.notfine.util.itembreakparticles.IWorldSpawnItemBreakParticle;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IWorldAccess;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

import java.util.List;

@Mixin(value = World.class)
public abstract class MixinWorld implements IWorldSpawnItemBreakParticle {

public void spawnItemBreakParticle(ItemStack itemStack, String particleName, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
for (int i = 0; i < worldAccesses.size(); ++i) {
IWorldAccess access = (IWorldAccess)worldAccesses.get(i);
if (access instanceof IRenderGlobalSpawnItemBreakParticle) {
((IRenderGlobalSpawnItemBreakParticle)access).spawnItemBreakParticle(itemStack, x, y, z, velocityX, velocityY, velocityZ);
} else {
access.spawnParticle(particleName, x, y, z, velocityX, velocityY, velocityZ);
}
}
}

@Shadow
protected List worldAccesses;

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ private IIcon modifyRenderBlockMinecartTrack(RenderBlocks instance, Block block,
}

@Redirect(
method = { "renderBlockVine(Lnet/minecraft/block/Block;III)Z",
"renderBlockLilyPad(Lnet/minecraft/block/Block;III)Z", "renderBlockLadder(Lnet/minecraft/block/Block;III)Z",
method = {
"renderBlockVine(Lnet/minecraft/block/Block;III)Z",
"renderBlockLilyPad(Lnet/minecraft/block/Block;III)Z",
"renderBlockLadder(Lnet/minecraft/block/Block;III)Z",
"renderBlockTripWireSource(Lnet/minecraft/block/Block;III)Z",
"renderBlockLever(Lnet/minecraft/block/Block;III)Z",
"renderBlockTripWire(Lnet/minecraft/block/Block;III)Z", },
"renderBlockTripWire(Lnet/minecraft/block/Block;III)Z"
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;getBlockIconFromSide(Lnet/minecraft/block/Block;I)Lnet/minecraft/util/IIcon;"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

Expand All @@ -33,18 +32,6 @@ public abstract class MixinRenderBlocks {
@Shadow
public abstract IIcon getBlockIconFromSideAndMetadata(Block block, int side, int meta);

@Unique
private int mcpatcherforge$neededSideRenderBlockLiquid;

@Unique
private float mcpatcherforge$neededFloat1;

@Unique
private float mcpatcherforge$neededFloat2;

@Unique
private float mcpatcherforge$neededFloat3;

// Redirect calls to this.getBlockIcon when possible

@Redirect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

@Mixin(RenderBlocks.class)
public abstract class MixinRenderBlocksNoCC {

@Shadow
public IBlockAccess blockAccess;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.prupe.mcpatcher.cc.ColorizeWorld;
import com.prupe.mcpatcher.hd.FontUtils;

import com.gtnewhorizons.angelica.mixins.interfaces.FontRendererExpansion;
import jss.notfine.util.FontRendererExpansion;

@Mixin(FontRenderer.class)
public abstract class MixinFontRenderer implements FontRendererExpansion {
Expand Down
Loading

0 comments on commit e59e41b

Please sign in to comment.