Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
Caedis committed Jan 6, 2025
1 parent b037e30 commit 0c72837
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/main/java/xonin/backhand/api/core/BackhandUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,7 @@ protected static void writeNBTTagCompound(NBTTagCompound par0NBTTagCompound,
public static void attackTargetEntityWithCurrentOffItem(EntityPlayer player, Entity par1Entity) {
final ItemStack oldItem = player.getCurrentEquippedItem();
final ItemStack offhandItem = BackhandUtils.getOffhandItem(player);
if (!BackhandConfig.OffhandAttack || (offhandItem == null && !BackhandConfig.EmptyOffhand))
return;
if (!BackhandConfig.OffhandAttack || (offhandItem == null && !BackhandConfig.EmptyOffhand)) return;

BackhandUtils.setPlayerCurrentItem(player, offhandItem);
refreshAttributes(player.getAttributeMap(), oldItem, player.getCurrentEquippedItem());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ public boolean addItemStackToInventory(ItemStack itemStack) {
if (itemStack == null || itemStack.stackSize == 0 || itemStack.getItem() == null) return false;

if (!Backhand.isOffhandBlacklisted(itemStack)) {
if (BackhandConfig.OffhandPickup && this.getOffhandItem() == null && getFirstEmptyStack() == -1) {
this.setOffhandItem(ItemStack.copyItemStack(itemStack));
itemStack.stackSize = 0;
BackhandUtils.getOffhandEP(player).syncOffhand = true;
return true;
}
if (BackhandConfig.OffhandPickup && this.getOffhandItem() == null && getFirstEmptyStack() == -1) {
this.setOffhandItem(ItemStack.copyItemStack(itemStack));
itemStack.stackSize = 0;
BackhandUtils.getOffhandEP(player).syncOffhand = true;
return true;
}

if (this.getOffhandItem() != null && this.getOffhandItem()
.getItem() == itemStack.getItem()
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/xonin/backhand/client/BackhandGuiConfig.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package xonin.backhand.client;

import net.minecraft.client.gui.GuiScreen;

import com.gtnewhorizon.gtnhlib.config.ConfigException;
import com.gtnewhorizon.gtnhlib.config.SimpleGuiConfig;
import net.minecraft.client.gui.GuiScreen;

import xonin.backhand.Backhand;
import xonin.backhand.utils.BackhandConfig;
import xonin.backhand.utils.BackhandConfigClient;

public class BackhandGuiConfig extends SimpleGuiConfig {

public BackhandGuiConfig(GuiScreen parent) throws ConfigException {
super(parent, Backhand.MODID, "Backhand", true, BackhandConfig.class, BackhandConfigClient.class);
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/xonin/backhand/client/BackhandGuiFactory.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package xonin.backhand.client;

import com.gtnewhorizon.gtnhlib.config.SimpleGuiFactory;
import net.minecraft.client.gui.GuiScreen;

import com.gtnewhorizon.gtnhlib.config.SimpleGuiFactory;

public class BackhandGuiFactory implements SimpleGuiFactory {

@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return BackhandGuiConfig.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public abstract class MixinItemRenderer {

ItemStack mainhandItem = player.getCurrentEquippedItem();
ItemStack offhandItem = BackhandUtils.getOffhandItem(player);
if (!BackhandConfig.EmptyOffhand && !BackhandConfigClient.RenderEmptyOffhandAtRest
&& offhandItem == null) {
if (!BackhandConfig.EmptyOffhand && !BackhandConfigClient.RenderEmptyOffhandAtRest && offhandItem == null) {
return;
}
if (offhandItem == null && !BackhandConfigClient.RenderEmptyOffhandAtRest
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/xonin/backhand/utils/BackhandConfig.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package xonin.backhand.utils;

import com.gtnewhorizon.gtnhlib.config.Config;

import xonin.backhand.Backhand;

@Config(modid = Backhand.MODID)
@Config.Comment("Configs that will be synced with the server's config if playing in multiplayer")
public class BackhandConfig {

@Config.Comment("If set to false, an empty offhand will only be rendered when the player is punching with the offhand. False in vanilla.")
@Config.DefaultBoolean(false)
public static boolean OffhandAttack;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/xonin/backhand/utils/BackhandConfigClient.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package xonin.backhand.utils;

import com.gtnewhorizon.gtnhlib.config.Config;
import xonin.backhand.Backhand;

import xonin.backhand.Backhand;

@Config(modid = Backhand.MODID, category = "client")
@Config.Comment("Configs that only affect the client and have no change on the server")
public class BackhandConfigClient {

@Config.Comment("If set to false, an empty offhand will only be rendered when the player is punching with the offhand.")
@Config.DefaultBoolean(false)
public static boolean RenderEmptyOffhandAtRest;
Expand Down

0 comments on commit 0c72837

Please sign in to comment.