Skip to content

Commit

Permalink
Add removal recipes for transformation powder.
Browse files Browse the repository at this point in the history
  • Loading branch information
CaliforniaDemise committed Nov 8, 2024
1 parent c1639f8 commit ff09758
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,26 @@ public static void addEntityTransformation(String from, String to) {
ItemTFTransformPowder.addOneWayTransformation(new ResourceLocation(from), new ResourceLocation(to));
}

@ZenMethod
public static void removeEntityTransformation(IEntityDefinition from) {
EntityEntry in = (EntityEntry) from.getInternal();
if (!ItemTFTransformPowder.removeEntityTransformation(Objects.requireNonNull(in.getRegistryName()))) {
CraftTweakerAPI.logError("Could not find transformation for " + from);
}
}

@ZenMethod
public static void removeEntityTransformation(String from) {
if (!ItemTFTransformPowder.removeEntityTransformation(new ResourceLocation(from))) {
CraftTweakerAPI.logError("Could not find transformation for " + from);
}
}

@ZenMethod
public static void removeAll() {
ItemTFTransformPowder.removeAll();
}

@ZenMethod
public static void addBlockTransformation(IIngredient from, IItemStack to) {
ItemStack outStack = CraftTweakerMC.getItemStack(to);
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/twilightforest/item/ItemTFTransformPowder.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public static void addBlockTransformation(Block from, Predicate<IBlockState> pre
transformBlockMap.put(from, Pair.of(predicate, to));
}

public static boolean removeEntityTransformation(ResourceLocation from) {
return transformMap.remove(from) != null;
}

public static void removeAll() {
transformMap.clear();
}

public static void addBlockTransformation(Block from, int meta, IBlockState to) {
addBlockTransformation(from, state -> from.getMetaFromState(state) == meta, to);
}
Expand Down

0 comments on commit ff09758

Please sign in to comment.