Skip to content

Commit

Permalink
Release 2.12 (xia-mc#853)
Browse files Browse the repository at this point in the history
Co-authored-by: Kefpull <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 28, 2024
1 parent 5272ca3 commit a07bfac
Show file tree
Hide file tree
Showing 237 changed files with 2,216 additions and 2,194 deletions.
2 changes: 1 addition & 1 deletion .run/Raven-XD [build].run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="scriptParameters" value="--stacktrace" />
<option name="taskDescriptions">
<list />
</option>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ configurations {
}

dependencies {
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.14.0'
embed('org.spongepowered:mixin:0.6-SNAPSHOT') {
exclude module: 'gson'
exclude module: 'guava'
Expand Down
Binary file added logo/logo_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/main/java/keystrokesmod/event/BlockAABBEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public class BlockAABBEvent extends Event {
private final World world;
private final Block block;
private final BlockPos blockPos;
private AxisAlignedBB boundingBox;
private final AxisAlignedBB maskBoundingBox;
private AxisAlignedBB boundingBox;

public BlockAABBEvent(World world, Block block, BlockPos blockPos, AxisAlignedBB boundingBox, AxisAlignedBB maskBoundingBox) {
this.world = world;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/keystrokesmod/event/BlockWebEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.util.BlockPos;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/keystrokesmod/event/PreMotionEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@

@Cancelable
public class PreMotionEvent extends Event {
private static boolean setRenderYaw;
@Setter
@Getter
private double posX;
public double posY;
@Setter
@Getter
public double posY;
private double posX;
@Setter
@Getter
private double posZ;
Expand All @@ -26,7 +27,6 @@ public class PreMotionEvent extends Event {
@Setter
@Getter
private boolean onGround;
private static boolean setRenderYaw;
private boolean isSprinting;
private boolean isSneaking;

Expand All @@ -41,18 +41,19 @@ public PreMotionEvent(double posX, double posY, double posZ, float yaw, float pi
this.isSneaking = isSneaking;
}

public static boolean setRenderYaw() {
return setRenderYaw;
}

public void setYaw(float yaw) {
this.yaw = yaw;
setRenderYaw = true;
}

public static boolean setRenderYaw() {
return setRenderYaw;
}

public void setRenderYaw(boolean setRenderYaw) {
PreMotionEvent.setRenderYaw = setRenderYaw;
}

public boolean isSprinting() {
return isSprinting;
}
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/keystrokesmod/event/PreOrientCameraEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package keystrokesmod.event;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.minecraftforge.fml.common.eventhandler.Event;

@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@Data
public class PreOrientCameraEvent extends Event {
private float smooth;
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private void onCrashed(CrashReport crashReport, CallbackInfo ci) {

@Inject(method = "createDisplay", at = @At(value = "RETURN"))
private void onSetTitle(@NotNull CallbackInfo ci) {
Display.setTitle("Opai " + Watermark.VERSION);
Display.setTitle("Raven XD " + Watermark.VERSION);
}

@Inject(method = "<init>", at = @At("RETURN"))
Expand Down
69 changes: 36 additions & 33 deletions src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import keystrokesmod.module.ModuleManager;
import keystrokesmod.utility.font.FontManager;
import keystrokesmod.utility.font.IFont;
import keystrokesmod.utility.render.*;
import keystrokesmod.utility.render.ColorUtils;
import keystrokesmod.utility.render.RRectUtils;
import keystrokesmod.utility.render.RenderUtils;
import keystrokesmod.utility.render.blur.GaussianBlur;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
Expand All @@ -21,36 +23,44 @@

import java.awt.*;

import static keystrokesmod.Raven.mc;


@Mixin(GuiButton.class)
public abstract class MixinGuiButton extends Gui {

@Shadow public boolean visible;

@Shadow @Final protected static ResourceLocation buttonTextures;

@Shadow protected boolean hovered;

@Shadow public int xPosition;

@Shadow public int yPosition;

@Shadow public int width;

@Shadow public int height;

@Shadow protected abstract int getHoverState(boolean p_getHoverState_1_);

@Shadow protected abstract void mouseDragged(Minecraft p_mouseDragged_1_, int p_mouseDragged_2_, int p_mouseDragged_3_);
@Shadow
@Final
protected static ResourceLocation buttonTextures;
@Shadow
public boolean visible;
@Shadow
public int xPosition;
@Shadow
public int yPosition;
@Shadow
public int width;
@Shadow
public int height;
@Shadow
public boolean enabled;
@Shadow
public String displayString;
@Shadow
protected boolean hovered;
@Unique
private int ravenXD$hoverValue;

@Shadow public boolean enabled;
@Unique
@Contract("_, _, _ -> new")
private static @NotNull Color raven_XD$interpolateColorC(final @NotNull Color color1, final @NotNull Color color2, float amount) {
amount = Math.min(1.0f, Math.max(0.0f, amount));
return new Color(ColorUtils.interpolateInt(color1.getRed(), color2.getRed(), amount), ColorUtils.interpolateInt(color1.getGreen(), color2.getGreen(), amount), ColorUtils.interpolateInt(color1.getBlue(), color2.getBlue(), amount), ColorUtils.interpolateInt(color1.getAlpha(), color2.getAlpha(), amount));
}

@Shadow public String displayString;
@Shadow
protected abstract int getHoverState(boolean p_getHoverState_1_);

@Unique
private int ravenXD$hoverValue;
@Shadow
protected abstract void mouseDragged(Minecraft p_mouseDragged_1_, int p_mouseDragged_2_, int p_mouseDragged_3_);

@Inject(method = "drawButton", at = @At("HEAD"), cancellable = true)
public void onDrawButton(Minecraft minecraft, int x, int y, CallbackInfo ci) {
Expand All @@ -72,8 +82,8 @@ public void onDrawButton(Minecraft minecraft, int x, int y, CallbackInfo ci) {
RRectUtils.drawRoundOutline(xPosition, this.yPosition, width, height, 3.5F, 0.0015f, rectColor, new Color(30, 30, 30, 100));
if (ModuleManager.clientTheme.buttonBlur.isToggled())
GaussianBlur.startBlur();
RRectUtils.drawRoundOutline(xPosition, this.yPosition, width, height, 3.5F, 0.0015f, new Color(0, 0, 0, 5) , new Color(0, 0, 0, 5));
RRectUtils.drawRoundOutline(xPosition, yPosition, width, height, 3.5F, 0.0015f, new Color(0, 0, 0, 50) , new Color(200, 200, 200, 60));
RRectUtils.drawRoundOutline(xPosition, this.yPosition, width, height, 3.5F, 0.0015f, new Color(0, 0, 0, 5), new Color(0, 0, 0, 5));
RRectUtils.drawRoundOutline(xPosition, yPosition, width, height, 3.5F, 0.0015f, new Color(0, 0, 0, 50), new Color(200, 200, 200, 60));
if (ModuleManager.clientTheme.buttonBlur.isToggled())
GaussianBlur.endBlur(20, 5);

Expand All @@ -84,11 +94,4 @@ public void onDrawButton(Minecraft minecraft, int x, int y, CallbackInfo ci) {

ci.cancel();
}

@Unique
@Contract("_, _, _ -> new")
private static @NotNull Color raven_XD$interpolateColorC(final @NotNull Color color1, final @NotNull Color color2, float amount) {
amount = Math.min(1.0f, Math.max(0.0f, amount));
return new Color(ColorUtils.interpolateInt(color1.getRed(), color2.getRed(), amount), ColorUtils.interpolateInt(color1.getGreen(), color2.getGreen(), amount), ColorUtils.interpolateInt(color1.getBlue(), color2.getBlue(), amount), ColorUtils.interpolateInt(color1.getAlpha(), color2.getAlpha(), amount));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@

@Mixin(GuiConnecting.class)
public abstract class MixinGuiConnecting extends GuiScreen {
@Shadow
private NetworkManager networkManager;

@Unique
public PreConnectEvent raven_bS$preConnectEvent = null;
@Shadow
private NetworkManager networkManager;

@Inject(method = "connect", at = @At("HEAD"), cancellable = true)
public void onConnect(String p_connect_1_, int p_connect_2_, CallbackInfo ci) {
raven_bS$preConnectEvent = new PreConnectEvent((GuiConnecting)(Object) this, p_connect_1_, p_connect_2_);
raven_bS$preConnectEvent = new PreConnectEvent((GuiConnecting) (Object) this, p_connect_1_, p_connect_2_);
MinecraftForge.EVENT_BUS.post(raven_bS$preConnectEvent);
if (raven_bS$preConnectEvent.isCanceled()) {
ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.awt.*;
import java.util.Calendar;
import java.util.Date;
import java.util.List;


Expand All @@ -29,11 +27,13 @@ public abstract class MixinGuiMainMenu extends GuiScreen {
@Unique
private static final int LOGO_COLOR = new Color(255, 255, 255, 200).getRGB();

@Shadow private int field_92022_t;
@Shadow
private int field_92022_t;
@Shadow
private GuiScreen field_183503_M;

@Shadow protected abstract boolean func_183501_a();

@Shadow private GuiScreen field_183503_M;
@Shadow
protected abstract boolean func_183501_a();

@Inject(method = "drawScreen", at = @At("HEAD"), cancellable = true)
public void onDrawScreen(int p_drawScreen_1_, int p_drawScreen_2_, float p_drawScreen_3_, CallbackInfo ci) {
Expand All @@ -46,7 +46,7 @@ public void onDrawScreen(int p_drawScreen_1_, int p_drawScreen_2_, float p_drawS

List<String> branding = Lists.reverse(FMLCommonHandler.instance().getBrandings(true));

for(int breadline = 0; breadline < branding.size(); ++breadline) {
for (int breadline = 0; breadline < branding.size(); ++breadline) {
String brd = branding.get(breadline);
if (!Strings.isNullOrEmpty(brd)) {
this.drawString(this.fontRendererObj, brd, 2, this.height - (10 + breadline * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package keystrokesmod.mixins.impl.gui;

import keystrokesmod.module.ModuleManager;
import keystrokesmod.module.impl.render.NoBackground;
import keystrokesmod.module.impl.player.ChestStealer;
import keystrokesmod.module.impl.render.NoBackground;
import keystrokesmod.utility.Utils;
import keystrokesmod.utility.render.BackgroundUtils;
import net.minecraft.client.gui.GuiScreen;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package keystrokesmod.mixins.impl.render;

import keystrokesmod.event.PreOrientCameraEvent;
import keystrokesmod.module.ModuleManager;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
Expand All @@ -10,6 +11,7 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraftforge.client.ForgeHooksClient;
Expand All @@ -20,6 +22,8 @@
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.ModifyArg;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(EntityRenderer.class)
Expand Down Expand Up @@ -61,6 +65,12 @@ private void hurtCameraEffect(float p_hurtCameraEffect_1_) {
}
}

@ModifyVariable(method = "orientCamera", at = @At("HEAD"), ordinal = 0, argsOnly = true)
public float modifySmooth(float smooth) {
PreOrientCameraEvent event = new PreOrientCameraEvent(smooth);
MinecraftForge.EVENT_BUS.post(event);
return event.getSmooth();
}

@Inject(method = "orientCamera", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Vec3;distanceTo(Lnet/minecraft/util/Vec3;)D"), cancellable = true)
public void orientCamera(float partialTicks, CallbackInfo ci) {
Expand All @@ -74,7 +84,7 @@ public void orientCamera(float partialTicks, CallbackInfo ci) {
GlStateManager.translate(0.0F, 0.3F, 0.0F);
if (!this.mc.gameSettings.debugCamEnable) {
BlockPos blockpos = new BlockPos(entity);
IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos);
IBlockState iblockstate = Blocks.air.getDefaultState(); // for no clip when in the block
ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity);
GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F);
GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F);
Expand Down
Loading

0 comments on commit a07bfac

Please sign in to comment.