Skip to content

Commit

Permalink
more wrench harvestability
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoriusT committed Jun 19, 2023
1 parent cba1f93 commit 2df689d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Nothing (I tend to only add finished Stuff to the Changelog).


6.16.01: (Not released yet)
[IMPROVED] The GT Wrenches can now harvest some Machines from other Mods too. Specifically Applied Energistics, Forestry, Funky Locomotion and Railcraft. Buildcraft and Minefactory Reloaded were already on that List.
[FIXED] a Serverside Only Crash because the Lang File does not exist on Servers. Happened while I made Books localizable, lol. But it's fixed now.
[FIXED] Electric Wires and cables did not connect properly to other Mods Blocks, especially IC2, but only when Funky Locomotion was NOT installed.

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/gregtech/compat/Compat_Recipes_Railcraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public class Compat_Recipes_Railcraft extends CompatMods {
char tHammer = ' ', tFile = ' ', tWrench = ' ';
OreDictPrefix tIngot = OP.ingot;

if (ConfigsGT.RECIPES.get(ConfigCategories.Recipes.disabledrecipes, "railcraft-void-chests", T)) {
ItemsGT.RECIPE_REMOVED_USE_TRASH_BIN_INSTEAD.add(ST.make(MD.RC, "machine.beta", 1, 11));
CR.delate(MD.RC, "machine.beta", 11);
}

if (ConfigsGT.RECIPES.get(ConfigCategories.Recipes.harderrecipes, "railcraft_stuff_use_tools", T)) {tHammer = 'h'; tFile = 'f'; tWrench = 'w';}
if (ConfigsGT.RECIPES.get(ConfigCategories.Recipes.harderrecipes, "railcraft_stuff_use_plates", T)) {tIngot = OP.plate;}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
package gregtech.items.tools.machine;

import gregapi.block.misc.BlockBaseBars;
import gregapi.code.ArrayListNoNulls;
import gregapi.data.MD;
import gregapi.data.MT;
import gregapi.item.multiitem.MultiItemTool;
import gregapi.item.multiitem.behaviors.Behavior_Tool;
import gregapi.item.multiitem.tools.ToolStats;
import gregapi.old.Textures;
import gregapi.render.IIconContainer;
import gregapi.util.ST;
import gregapi.util.UT;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
Expand Down Expand Up @@ -63,13 +66,16 @@ public float getNormalDamageAgainstEntity(float aOriginalDamage, Entity aEntity,
@Override public boolean canCollect() {return T;}
@Override public boolean isWrench() {return T;}

public List<String> mRegistryNamePrefixes = new ArrayListNoNulls<>(F, "BuildCraft|", "Forestry:core", "Forestry:mail", "Forestry:alveary", "Forestry:factory", "Forestry:engine", "Forestry:ffarm", "Railcraft:machine", "progressiveautomation", "MineFactoryReloaded:machine", "MineFactoryReloaded:rednet", "MCFrames:", MD.FUNK.mID, MD.WARPDRIVE.mID);

@Override
public boolean isMinableBlock(Block aBlock, byte aMetaData) {
if (aBlock.getMaterial() == Material.piston || aBlock.getMaterial() == Material.redstoneLight || aBlock instanceof BlockBaseBars || aBlock == Blocks.hopper || aBlock == Blocks.dispenser || aBlock == Blocks.dropper) return T;
if (TOOL_wrench.equalsIgnoreCase(aBlock.getHarvestTool(aMetaData))) return T;
if (aBlock.getMaterial().isLiquid()) return F;
String tName = ST.regName(aBlock);
return tName != null && (tName.startsWith("BuildCraft|") || tName.startsWith("progressiveautomation") || tName.startsWith("MineFactoryReloaded:machine") || tName.startsWith("MineFactoryReloaded:rednet"));
if (UT.Code.stringValid(tName)) for (String tPrefix : mRegistryNamePrefixes) if (tName.startsWith(tPrefix)) return T;
return F;
}

@Override
Expand Down

0 comments on commit 2df689d

Please sign in to comment.