Unverified Commit f691c9c5 authored by layue13's avatar layue13
Browse files

限制最后的太刀匠人技能负载

parent cae23fa8
Loading
Loading
Loading
Loading
+1
Changes for .gitignore: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
build/
+4 −5
Changes for compile-decompiled.sh: 4 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -8,13 +8,12 @@ CP="${CP:-}"
if [ -z "$CP" ]; then
  CP_ENTRIES=()
  for jar in \
    "$TDLM_ROOT/modsource/IndustrialCraft2/build/rfg/srg_patched_minecraft-classes.jar" \
    "$TDLM_ROOT/Uranium/eclipse/cauldron/build/libs/cauldron.jar" \
    "$TDLM_ROOT/Uranium/build/tmp/deobfuscateJar/deobfed.jar" \
    "$TDLM_ROOT/modsource/CodeChickenCore/build/rfg/srg_merged_minecraft.jar"; do
    "$TDLM_ROOT/modsource/CodeChickenCore/build/rfg/srg_merged_minecraft.jar" \
    "$TDLM_ROOT/modsource/CodeChickenCore/build/rfg/recompiled_minecraft-1.7.10.jar" \
    "$TDLM_ROOT/modsource/IndustrialCraft2/build/rfg/srg_patched_minecraft-classes.jar"; do
    [ -f "$jar" ] && CP_ENTRIES+=("$jar")
  done
  for dir in "$TDLM_ROOT/Uranium/build/bundle/libraries" "$TDLM_ROOT/Uranium-server-run/mods" "$TDLM_ROOT/client/mods" "$TDLM_ROOT/_downloaded-deps" "$TDLM_ROOT/modsource/ImmersiveEngineering/externalLibs" "$TDLM_ROOT/modsource/CodeChickenCore/run/client/mods" "$TDLM_ROOT/modsource/CodeChickenCore/run/mods" "$TDLM_ROOT/modsource/Mekanism-Community-Edition/libs" "$TDLM_ROOT/modsource/ExtraBotany/libs"; do
  for dir in "$TDLM_ROOT/Uranium/build/bundle/libraries" "$TDLM_ROOT/Uranium-server-run/libraries" "$TDLM_ROOT/Uranium-server-run/mods" "$TDLM_ROOT/client/mods" "$TDLM_ROOT/_downloaded-deps" "$TDLM_ROOT/modsource/ImmersiveEngineering/externalLibs" "$TDLM_ROOT/modsource/CodeChickenCore/run/client/mods" "$TDLM_ROOT/modsource/CodeChickenCore/run/mods" "$TDLM_ROOT/modsource/Mekanism-Community-Edition/libs" "$TDLM_ROOT/modsource/ExtraBotany/libs"; do
    if [ -d "$dir" ]; then
      while IFS= read -r jar; do
        case "$jar" in
+1 −2
Changes for src/main/java/net/langball/last_smith/CreativeTabsSmith.java: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -14,11 +14,10 @@ import net.minecraft.item.Item;
public class CreativeTabsSmith
extends CreativeTabs {
    public CreativeTabsSmith() {
        super("lastsmith");
        super(180, "lastsmith");
    }

    public Item func_78016_d() {
        return BladeLoader.blade;
    }
}
+25
Changes for src/main/java/net/langball/last_smith/LastSmithLimits.java: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
package net.langball.last_smith;

import mods.flammpfeil.slashblade.ItemSlashBlade;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

public final class LastSmithLimits {
    private LastSmithLimits() {
    }

    public static boolean isOnCooldown(EntityPlayer player, ItemStack stack, String key, int cooldownTicks) {
        if (player == null || stack == null || cooldownTicks <= 0) {
            return false;
        }
        long now = player.field_70170_p.func_72820_D();
        NBTTagCompound tag = ItemSlashBlade.getItemTagCompound((ItemStack)stack);
        long nextAllowed = tag.func_74763_f(key);
        if (now < nextAllowed) {
            return true;
        }
        tag.func_74772_a(key, now + (long)cooldownTicks);
        return false;
    }
}
+36 −4
Changes for src/main/java/net/langball/last_smith/RecipeBx.java: 36 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package net.langball.last_smith;

import java.util.Iterator;
import java.util.Map;
import java.lang.reflect.Method;
import mods.flammpfeil.slashblade.ItemSlashBlade;
import mods.flammpfeil.slashblade.ItemSlashBladeNamed;
import mods.flammpfeil.slashblade.SlashBlade;
@@ -34,9 +35,11 @@ public class RecipeBx
extends ShapedOreRecipe {
    ItemStack requiredBladeMain;
    ItemStack requiredBladeSub;
    private final ShapedOreRecipe delegate;

    public RecipeBx(ItemStack result, ItemStack requiredBladeMain, ItemStack requiredBladeSub, Object ... recipe) {
        super(result, recipe);
        this.delegate = new ShapedOreRecipe(result, recipe);
        this.requiredBladeMain = requiredBladeMain;
        this.requiredBladeSub = requiredBladeSub;
    }
@@ -45,8 +48,8 @@ extends ShapedOreRecipe {
        return access.get(reqTag).compareTo(access.get(srcTag));
    }

    public boolean func_77569_a(InventoryCrafting inv, World world) {
        boolean result = super.func_77569_a(inv, world);
    public boolean matches(InventoryCrafting inv, World world) {
        boolean result = this.baseMatches(inv, world);
        if (result && this.requiredBladeMain != null && this.requiredBladeSub != null) {
            ItemStack curIs = inv.func_70463_b(0, 1);
            if (curIs != null && curIs.func_77973_b() instanceof ItemSlashBlade && curIs.func_77942_o()) {
@@ -67,10 +70,10 @@ extends ShapedOreRecipe {
        return false;
    }

    public ItemStack func_77572_b(InventoryCrafting var1) {
    public ItemStack getCraftingResult(InventoryCrafting var1) {
        String key;
        ItemStack tmp;
        ItemStack result = super.func_77572_b(var1);
        ItemStack result = this.baseCraftingResult(var1);
        ItemStack curIs = var1.func_70463_b(1, 1);
        NBTTagCompound oldTag = curIs.func_77978_p();
        oldTag = (NBTTagCompound)oldTag.func_74737_b();
@@ -116,5 +119,34 @@ extends ShapedOreRecipe {
        EnchantmentHelper.func_82782_a((Map)newItemEnchants, (ItemStack)result);
        return result;
    }

    public boolean func_77569_a(InventoryCrafting inv, World world) {
        return this.matches(inv, world);
    }

    public ItemStack func_77572_b(InventoryCrafting var1) {
        return this.getCraftingResult(var1);
    }

    private boolean baseMatches(InventoryCrafting inv, World world) {
        Object result = this.invokeDelegate(new String[]{"func_77569_a", "matches"}, new Class[]{InventoryCrafting.class, World.class}, new Object[]{inv, world});
        return Boolean.TRUE.equals(result);
    }

    private ItemStack baseCraftingResult(InventoryCrafting inv) {
        Object result = this.invokeDelegate(new String[]{"func_77572_b", "getCraftingResult"}, new Class[]{InventoryCrafting.class}, new Object[]{inv});
        return result instanceof ItemStack ? (ItemStack)result : null;
    }

    private Object invokeDelegate(String[] methodNames, Class[] parameterTypes, Object[] args) {
        for (String methodName : methodNames) {
            try {
                Method method = ShapedOreRecipe.class.getMethod(methodName, parameterTypes);
                return method.invoke(this.delegate, args);
            }
            catch (Throwable ignored) {
            }
        }
        return null;
    }
}
Loading