From fa32d55b056ccdc9152ff2fdb6ed7fc4f82c6001 Mon Sep 17 00:00:00 2001 From: Shinare Date: Fri, 11 Apr 2025 11:14:46 +0300 Subject: [PATCH] Cleaning up debug statements --- .../cinder_loe/ShapelessDurabilityRecipe.java | 8 ---- .../cinder_loe/command/CommandWarband.java | 4 -- .../cinder_loe/droptables/DropTable.java | 2 - .../zivilon/cinder_loe/entity/Renegade.java | 10 ---- .../cinder_loe/mixins/MixinEntityPlayer.java | 2 - ...REntityAINearestAttackableTargetBasic.java | 47 +++++++------------ .../cinder_loe/mixins/MixinLOTREntityNPC.java | 5 -- .../cinder_loe/mixins/MixinLOTRGuiMap.java | 8 ---- .../cinder_loe/potion/PotionHerbPoison.java | 2 - .../cinder_loe/util/PickpocketUtils.java | 5 -- .../zivilon/cinder_loe/util/Utilities.java | 1 - 11 files changed, 17 insertions(+), 77 deletions(-) diff --git a/src/main/java/com/zivilon/cinder_loe/ShapelessDurabilityRecipe.java b/src/main/java/com/zivilon/cinder_loe/ShapelessDurabilityRecipe.java index 4e8bb1c..0fe77ba 100644 --- a/src/main/java/com/zivilon/cinder_loe/ShapelessDurabilityRecipe.java +++ b/src/main/java/com/zivilon/cinder_loe/ShapelessDurabilityRecipe.java @@ -28,7 +28,6 @@ public class ShapelessDurabilityRecipe implements IRecipe { @Override public boolean matches(InventoryCrafting inv, World worldIn) { - System.out.println("[CinderLoE] Checking matches for ShapelessDurabilityRecipe"); boolean hasTool = false; List ingredientsCopy = new ArrayList<>(this.recipeItems); @@ -48,7 +47,6 @@ public class ShapelessDurabilityRecipe implements IRecipe { } } if (!matched) { - System.out.println("[CinderLoE] Ingredient did not match: " + stack); return false; } } @@ -56,13 +54,11 @@ public class ShapelessDurabilityRecipe implements IRecipe { } boolean matches = hasTool && ingredientsCopy.isEmpty(); - System.out.println("[CinderLoE] ShapelessDurabilityRecipe match result: " + matches + ", has tool: " + hasTool); return matches; } @Override public ItemStack getCraftingResult(InventoryCrafting inv) { - System.out.println("[CinderLoE] Getting crafting result for ShapelessDurabilityRecipe"); return this.recipeOutput.copy(); } @@ -77,7 +73,6 @@ public class ShapelessDurabilityRecipe implements IRecipe { } public ItemStack[] getRemainingItems(InventoryCrafting inv) { - System.out.println("[CinderLoE] Getting remaining items for ShapelessDurabilityRecipe"); ItemStack[] remainingItems = new ItemStack[inv.getSizeInventory()]; for (int i = 0; i < remainingItems.length; ++i) { @@ -86,16 +81,13 @@ public class ShapelessDurabilityRecipe implements IRecipe { if (itemstack != null && itemstack.getItem() == toolItem) { ItemStack tool = itemstack.copy(); tool.setItemDamage(tool.getItemDamage() + 1); - System.out.println("[CinderLoE] Damaging tool: " + tool.getUnlocalizedName() + " | New Damage: " + tool.getItemDamage()); if (tool.getItemDamage() >= tool.getMaxDamage()) { - System.out.println("[CinderLoE] Tool is out of durability, breaking: " + tool.getUnlocalizedName()); tool = null; } remainingItems[i] = tool; } else if (itemstack != null && itemstack.getItem().hasContainerItem(itemstack)) { - System.out.println("[CinderLoE] Consuming non-tool item " + itemstack.getUnlocalizedName()); remainingItems[i] = itemstack.getItem().getContainerItem(itemstack); } else { remainingItems[i] = itemstack; diff --git a/src/main/java/com/zivilon/cinder_loe/command/CommandWarband.java b/src/main/java/com/zivilon/cinder_loe/command/CommandWarband.java index 2b4dc85..19b8d20 100644 --- a/src/main/java/com/zivilon/cinder_loe/command/CommandWarband.java +++ b/src/main/java/com/zivilon/cinder_loe/command/CommandWarband.java @@ -117,19 +117,15 @@ public class CommandWarband extends CommandBase { } public static boolean validate_args(String[] args) { - System.out.println("Validating..."); if (args.length < 1) return false; String action = ""; - System.out.println("Checking arg \"" + args[0] + "\""); if (args[0].equals("summon") || args[0].equals("reset") || args[0].equals("list")) { action = args[0]; } else { - System.out.println("Failed test 1"); return false; } if (action.equals("summon")) { if (args.length < 2) { - System.out.println("Failed test 2"); return false; } WarbandFaction faction = WarbandFaction.get_warband_by_name(args[1]); diff --git a/src/main/java/com/zivilon/cinder_loe/droptables/DropTable.java b/src/main/java/com/zivilon/cinder_loe/droptables/DropTable.java index c980bc3..e6d6350 100644 --- a/src/main/java/com/zivilon/cinder_loe/droptables/DropTable.java +++ b/src/main/java/com/zivilon/cinder_loe/droptables/DropTable.java @@ -116,8 +116,6 @@ public class DropTable { if (drop instanceof SingleItemDrop) { SingleItemDrop single = (SingleItemDrop)drop; Item drop_item = single.item; - if (CinderLoE.DEBUG && drop_item == null) System.out.println("[DropTable_serializer] Item is null"); - if (CinderLoE.DEBUG && drop_item != null) System.out.println("[DropTable_serializer] item " + single.item.getUnlocalizedName()); drop_tag.setBoolean("looting_affects_quantity", single.looting_affects_quantity); drop_tag.setInteger("id", ((FMLControlledNamespacedRegistry)Item.itemRegistry).getId(drop_item)); if (single.nbt != null) diff --git a/src/main/java/com/zivilon/cinder_loe/entity/Renegade.java b/src/main/java/com/zivilon/cinder_loe/entity/Renegade.java index 2f02a1d..e58ed9d 100644 --- a/src/main/java/com/zivilon/cinder_loe/entity/Renegade.java +++ b/src/main/java/com/zivilon/cinder_loe/entity/Renegade.java @@ -129,43 +129,33 @@ public class Renegade extends LOTREntityMan { }, /* * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getDunlendingName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getDorwinionName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getDalishName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getRhunicName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getUmbarName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getHarnennorName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getSouthronCoastName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getNomadName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getGulfHaradName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getMoredainName(this.rand, this.familyInfo.isMale())), * } */ diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityPlayer.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityPlayer.java index cc9347b..8599d7e 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityPlayer.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityPlayer.java @@ -189,7 +189,6 @@ public abstract class MixinEntityPlayer extends EntityLivingBase implements IMix if (f > 0.0F || f1 > 0.0F) { boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInWater() && !this.isPotionActive(Potion.blindness) && this.ridingEntity == null && p_71059_1_ instanceof EntityLivingBase; - System.out.println("Hello"); if (PotionHerbPoison.should_cancel_crit((EntityPlayer)(Object)this)) { flag = false; } @@ -307,7 +306,6 @@ public abstract class MixinEntityPlayer extends EntityLivingBase implements IMix if (effect != null && effect.getAmplifier() >= 2) { int slot = player.inventory.currentItem; if (slot >= 3 && slot <= 8) { - if (CinderLoE.DEBUG) System.out.println("ATTACK DENIED"); return false; } } diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAINearestAttackableTargetBasic.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAINearestAttackableTargetBasic.java index 7101456..7802fe5 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAINearestAttackableTargetBasic.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAINearestAttackableTargetBasic.java @@ -115,39 +115,26 @@ public abstract class MixinLOTREntityAINearestAttackableTargetBasic extends Enti } @Inject(method = "isPlayerSuitableTarget", at = @At("HEAD"), cancellable = true, remap = false) -private void cinderloe$applyStealthModifier(EntityPlayer player, CallbackInfoReturnable cir) { - int stealthPieces = 0; - System.out.println("Test 1"); -((EntityPlayer)player).addChatMessage(new ChatComponentText("Tested detection")); // Only if there is a player or target instance to refer to. - -for (ItemStack armor : player.inventory.armorInventory) { - System.out.println("Checking armor piece"); - if (armor != null && armor.getItem() instanceof LOTRItemArmor && armor.stackTagCompound != null) { - System.out.println("Found armor piece, testing if it has stealth modifier"); - if (LOTREnchantmentHelper.hasEnchant(armor, LOTREnchantment.getEnchantmentByName("stealth"))) { - System.out.println("Found modifier on armor piece"); - stealthPieces++; + private void cinderloe$applyStealthModifier(EntityPlayer player, CallbackInfoReturnable cir) { + int stealthPieces = 0; + + for (ItemStack armor : player.inventory.armorInventory) { + if (armor != null && armor.getItem() instanceof LOTRItemArmor && armor.stackTagCompound != null) { + if (LOTREnchantmentHelper.hasEnchant(armor, LOTREnchantment.getEnchantmentByName("stealth"))) { + stealthPieces++; + } + } } - } -} - - System.out.println("Test 2"); - ((EntityPlayer)player).addChatMessage(new ChatComponentText("Tested detection1")); // Only if there is a player or target instance to refer to. - if (stealthPieces > 0 && taskOwner != null) { - double baseDetectionRange = taskOwner.getEntityAttribute(net.minecraft.entity.SharedMonsterAttributes.followRange).getAttributeValue(); - double multiplier = 1.0 - (0.15 * stealthPieces); - double effectiveRangeSq = (baseDetectionRange * multiplier) * (baseDetectionRange * multiplier); - double distanceSq = taskOwner.getDistanceSqToEntity(player); + if (stealthPieces > 0 && taskOwner != null) { + double baseDetectionRange = taskOwner.getEntityAttribute(net.minecraft.entity.SharedMonsterAttributes.followRange).getAttributeValue(); + double multiplier = 1.0 - (0.15 * stealthPieces); + double effectiveRangeSq = (baseDetectionRange * multiplier) * (baseDetectionRange * multiplier); + double distanceSq = taskOwner.getDistanceSqToEntity(player); - System.out.println("Test 3"); -((EntityPlayer)player).addChatMessage(new ChatComponentText("Tested detection3")); // Only if there is a player or target instance to refer to. - - if (distanceSq > effectiveRangeSq) { - cir.setReturnValue(false); + if (distanceSq > effectiveRangeSq) { + cir.setReturnValue(false); + } } } - System.out.println("Test 4"); -((EntityPlayer)player).addChatMessage(new ChatComponentText("Tested detection4")); // Only if there is a player or target instance to refer to. -} } diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java index 47171fe..6008768 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java @@ -50,21 +50,16 @@ public abstract class MixinLOTREntityNPC extends EntityCreature implements ILoot if (success) { List drops = DropTable.generate_drops((LOTREntityNPC)(Object)this, new DropContext[]{DropContext.PICKPOCKET}, 0); ItemStack item = drops.get(DropTable.random.nextInt(drops.size())); - if (CinderLoE.DEBUG) System.out.println("[MixinLOTREntityNPC] Giving pickpocket reward " + item.getItem().getUnlocalizedName()); if (entityplayer.inventory.addItemStackToInventory(item)) { - if (CinderLoE.DEBUG) System.out.println("[MixinLOTREntityNPC] Item successfully granted"); last_pickpocket = (int)(System.currentTimeMillis() / 1000L); } else { - if (CinderLoE.DEBUG) System.out.println("[MixinLOTREntityNPC] Item grant failed"); } } else { last_pickpocket = (int)(System.currentTimeMillis() / 1000L); ((LOTREntityNPC)(Object)this).setRevengeTarget(entityplayer); - if (CinderLoE.DEBUG) System.out.println("[MixinLOTREntityNPC] Pickpocket failed."); } return true; } - if (CinderLoE.DEBUG) System.out.println("[MixinLOTREntityNPC] Pickpocket didn't happen."); if (!this.worldObj.isRemote && canNPCTalk()) { if (this.questInfo.interact(entityplayer)) return true; diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRGuiMap.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRGuiMap.java index 3a89dea..29c8e42 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRGuiMap.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRGuiMap.java @@ -46,26 +46,19 @@ public abstract class MixinLOTRGuiMap extends LOTRGuiMenuBase { @Shadow(remap = false) public float[] transformCoords(float x, float z) { return null;} - @Inject(method = "func_73863_a", at = @At("HEAD"), remap = false) - public void inject_head(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - System.out.println("[MixinLOTRGuiMap] Inject at HEAD"); - } @Inject(method = "func_73863_a", at = @At( value = "INVOKE", target = "renderPlayers(II)V", shift = At.Shift.AFTER), remap = false) public void inject_render_warbands(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - System.out.println("[MixinLOTRGuiMap] Running wrapper"); render_warbands(mouseX, mouseY); } @Dynamic private void render_warbands(int cursor_x, int cursor_y) { - System.out.println("[MixinLOTRGuiMap] Rendering warband icon"); String mouse_over_warband_name = null; double mouse_over_warband_x = 0.0D; double mouse_over_warband_y = 0.0D; double shortest_distance_to_cursor = Double.MAX_VALUE; int icon_width_half = 4; for (Map.Entry entry : warband_locations.entrySet()) { - System.out.println("[MixinLOTRGuiMap] Iterated"); WarbandLocationInfo info = entry.getValue(); Warband warband = info.warband; String warband_name = warband.faction.warband_name; @@ -129,7 +122,6 @@ public abstract class MixinLOTRGuiMap extends LOTRGuiMenuBase { @Dynamic private void load_warband_icon(boolean ally, int x, int y) { - System.out.println("[MixinLOTRGuiMap] Loading warband icon: " + (ally ? "ally" : "enemy")); mc.getTextureManager().bindTexture(LOTRClientProxy.alignmentTexture); GL11.glColor4f(1F, 1F, 1F, 1F); int variant = ally ? 16 : 0; diff --git a/src/main/java/com/zivilon/cinder_loe/potion/PotionHerbPoison.java b/src/main/java/com/zivilon/cinder_loe/potion/PotionHerbPoison.java index 4562111..cb5defd 100644 --- a/src/main/java/com/zivilon/cinder_loe/potion/PotionHerbPoison.java +++ b/src/main/java/com/zivilon/cinder_loe/potion/PotionHerbPoison.java @@ -33,10 +33,8 @@ public class PotionHerbPoison extends Potion { public static boolean should_cancel_crit(EntityPlayer player) { PotionEffect poison = player.getActivePotionEffect(LoEPotions.overdose); if (poison != null && poison.getAmplifier() >= 1) { - if (CinderLoE.DEBUG) System.out.println("Should cancel crit"); return true; } - if (CinderLoE.DEBUG) System.out.println("Should not cancel crit"); return false; } @Override diff --git a/src/main/java/com/zivilon/cinder_loe/util/PickpocketUtils.java b/src/main/java/com/zivilon/cinder_loe/util/PickpocketUtils.java index 4f1d224..9cf5f2d 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/PickpocketUtils.java +++ b/src/main/java/com/zivilon/cinder_loe/util/PickpocketUtils.java @@ -31,7 +31,6 @@ public class PickpocketUtils { public static Random random = new Random(); public static boolean can_pickpocket(EntityPlayer player, LOTREntityNPC target) { - if (CinderLoE.DEBUG) System.out.println("[PickpocketUtils] Checking if can pickpocket..."); if (!player.isSneaking()) return false; DropTable table = ((ILootableEntity)(Object)target).get_drop_table(); @@ -58,11 +57,9 @@ public class PickpocketUtils { return false; } - if (CinderLoE.DEBUG) System.out.println("[PickpocketUtils] Yes can pickpocket"); return true; } public static boolean pickpocket(EntityPlayer player, LOTREntityNPC target) { - if (CinderLoE.DEBUG) System.out.println("[PickpocketUtils] Pickpocketing..."); ILootableEntity npc = (ILootableEntity)(Object)target; float penalty = 1.0F; if (!is_behind(player, (EntityLivingBase)target)) penalty -= 0.4F; @@ -70,7 +67,6 @@ public class PickpocketUtils { if (is_invisible(player)) penalty += 0.4F; if (is_cloaked(player)) penalty += 0.2F; boolean success = random.nextFloat() < npc.get_pickpocket_chance() * penalty; - if (CinderLoE.DEBUG) System.out.println("[PickpocketUtils] Pickpocketing " + success); return success; } @@ -79,7 +75,6 @@ public class PickpocketUtils { float playerYaw = player.rotationYaw % 360; float angleDiff = MathHelper.wrapAngleTo180_float(npcYaw - playerYaw); boolean is_behind = Math.abs(angleDiff) < 30F; - if (CinderLoE.DEBUG) System.out.println("[PickpocketUtils] Is behind? " + is_behind); return is_behind; } diff --git a/src/main/java/com/zivilon/cinder_loe/util/Utilities.java b/src/main/java/com/zivilon/cinder_loe/util/Utilities.java index d38ee6b..07620b8 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/Utilities.java +++ b/src/main/java/com/zivilon/cinder_loe/util/Utilities.java @@ -191,7 +191,6 @@ public class Utilities { EntityPlayer player = getPlayerByName(player_name); if (player == null) { - System.out.println("[CinderLoE] Warning! Player not found: " + player_name); return false; }