mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-21 12:32:29 +00:00
Note to future self: Uncomplicate the gitignore
This commit is contained in:
1 parent
873bff3a11
commit
43f9dba1a1
4 files changed
+260
-5
No files matched your search
+5
-5
@@ -18,11 +18,11 @@
|
||||
!/MineTweaker3-MC19-Main/build.gradle
|
||||
/MineTweaker3-MC19-Main/bin
|
||||
|
||||
!/MineTweaker3-MC18-Mod-JEI
|
||||
/MineTweaker3-MC18-Mod-JEI/*
|
||||
!/MineTweaker3-MC18-Mod-JEI/src
|
||||
!/MineTweaker3-MC18-Mod-JEI/libs
|
||||
!/MineTweaker3-MC18-Mod-JEI/build.gradle
|
||||
!/MineTweaker3-MC19-Mod-JEI
|
||||
/MineTweaker3-MC19-Mod-JEI/*
|
||||
!/MineTweaker3-MC19-Mod-JEI/src
|
||||
!/MineTweaker3-MC19-Mod-JEI/libs
|
||||
!/MineTweaker3-MC19-Mod-JEI/build.gradle
|
||||
|
||||
!/MineTweaker3-MC1710-Main
|
||||
/MineTweaker3-MC1710-Main/*
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import minetweaker.tasks.RegisterZenClassesTask;
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
}
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
|
||||
version = "1.9-" + ext.mineTweakerVersion
|
||||
archivesBaseName = project.projectDir.name
|
||||
|
||||
minecraft {
|
||||
version = forgeVersion19
|
||||
runDir = "eclipse"
|
||||
mappings = "snapshot_20160312"
|
||||
useDepAts = true
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url "http://dvs1.progwml6.com/files/maven"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':ZenScript')
|
||||
compile project(':MineTweaker3-API')
|
||||
compile project(':MineTweaker3-MC19-Main')
|
||||
deobfCompile "mezz.jei:jei_1.9:3.2.10.185"
|
||||
}
|
||||
|
||||
task makeRegistry(type: RegisterZenClassesTask) {
|
||||
inputDir = file('build/classes/main')
|
||||
outputDir = file('build/classes/main')
|
||||
className = 'minetweaker.mods.jei.ClassRegistry'
|
||||
}
|
||||
|
||||
tasks.jar.dependsOn(makeRegistry)
|
||||
@@ -0,0 +1,175 @@
|
||||
package minetweaker.mods.jei;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import stanhebben.zenscript.annotations.NotNull;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
|
||||
|
||||
/**
|
||||
* MineTweaker NEI support.
|
||||
*
|
||||
* Enables hiding NEI items as well as adding new item stacks. These item stacks
|
||||
* can then show a custom message or contain NBT data. Can be used to show a
|
||||
* custom message or lore with certain items, or to provide spawnable items with
|
||||
* specific NBT tags.
|
||||
*
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.jei.JEI")
|
||||
public class JEI {
|
||||
/**
|
||||
* Hides a specific item in NEI. Will take into account metadata values, if
|
||||
* any.
|
||||
*
|
||||
* @param item
|
||||
* item to be hidden
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void hide(@NotNull IItemStack item) {
|
||||
MineTweakerAPI.apply(new JEIHideItemAction(item));
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * Adds a NEI entry. The item stack can contain damage values and NBT
|
||||
// tags.
|
||||
// *
|
||||
// * @param stack
|
||||
// * item stack to be added
|
||||
// */
|
||||
// @ZenMethod
|
||||
// public static void addEntry(@NotNull IItemStack stack) {
|
||||
// MineTweakerAPI.apply(new NEIAddEntryAction(getItemStack(stack)));
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Overrides a name in NEI. Note that this will not change the original
|
||||
// * display name, but it will change the way it is displayed in NEI.
|
||||
// *
|
||||
// * @param item
|
||||
// * item
|
||||
// * @param name
|
||||
// * item name
|
||||
// */
|
||||
// @ZenMethod
|
||||
// public static void overrideName(@NotNull IItemStack item, @NotNull String
|
||||
// name) {
|
||||
// MineTweakerAPI.apply(new NEIOverrideNameAction(getItemStack(item),
|
||||
// name));
|
||||
// }
|
||||
|
||||
// #############################
|
||||
// ### Private inner classes ###
|
||||
// #############################
|
||||
|
||||
// private static class NEIAddEntryAction implements IUndoableAction {
|
||||
// private final ItemStack item;
|
||||
//
|
||||
// public NEIAddEntryAction(ItemStack item) {
|
||||
// this.item = item;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void apply() {
|
||||
// JEIAddonPlugin.jeiHelpers.getItemBlacklist().addItemToBlacklist(item);
|
||||
// // API.addItemListEntry(item);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canUndo() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void undo() {
|
||||
// API.hideItem(item);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String describe() {
|
||||
// return "Adding " + item.getDisplayName() + " as NEI entry";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String describeUndo() {
|
||||
// return "Removing " + item.getDisplayName() + " as NEI entry";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Object getOverrideKey() {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
private static class JEIHideItemAction implements IUndoableAction {
|
||||
private final IItemStack stack;
|
||||
|
||||
public JEIHideItemAction(IItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
System.out.println(stack);
|
||||
System.out.println(getItemStack(stack));
|
||||
System.out.println(JEIAddonPlugin.jeiHelpers);
|
||||
System.out.println(JEIAddonPlugin.jeiHelpers.getItemBlacklist());
|
||||
|
||||
JEIAddonPlugin.jeiHelpers.getItemBlacklist().addItemToBlacklist(getItemStack(stack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
JEIAddonPlugin.jeiHelpers.getItemBlacklist().removeItemFromBlacklist(getItemStack(stack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Hiding " + stack + " in JEI";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Displaying " + stack + " in JEI";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// private static class NEIOverrideNameAction extends OneWayAction {
|
||||
// private final ItemStack item;
|
||||
// private final String name;
|
||||
//
|
||||
// public NEIOverrideNameAction(ItemStack item, String name) {
|
||||
// this.item = item;
|
||||
// this.name = name;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void apply() {
|
||||
// API.setOverrideName(item, name);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String describe() {
|
||||
// return "Overriding NEI item name of " + item.getUnlocalizedName() + " to
|
||||
// " + name;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Object getOverrideKey() {
|
||||
// return item;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package minetweaker.mods.jei;
|
||||
|
||||
import mezz.jei.api.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@mezz.jei.api.JEIPlugin
|
||||
public class JEIAddonPlugin implements IModPlugin{
|
||||
|
||||
public static IJeiHelpers jeiHelpers;
|
||||
public static IItemRegistry itemRegistry;
|
||||
public static IRecipeRegistry recipeRegistry;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
|
||||
this.jeiHelpers = registry.getJeiHelpers();
|
||||
this.itemRegistry = registry.getItemRegistry();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRuntimeAvailable(@Nonnull IJeiRuntime iJeiRuntime){
|
||||
this.recipeRegistry = iJeiRuntime.getRecipeRegistry();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user