mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-22 21:09:56 +00:00
- Removed the Transformer classes as transformation-based class detection is too slow
- Finished the RegisterZenClassesTask and applied it to the API & Mod support projects - Started work on the events API - Added a mod.info file - Added mods detection API
This commit is contained in:
1 parent
8b00ce34b6
commit
0c535134c5
106 files changed
+2111
-444
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import minetweaker.tasks.RegisterZenClassesTask;
|
||||
|
||||
apply plugin: 'java'
|
||||
|
||||
sourceCompatibility = '1.6'
|
||||
@@ -7,6 +9,14 @@ task run << {
|
||||
println "I'm a library!"
|
||||
}
|
||||
|
||||
task makeRegistry(type: RegisterZenClassesTask) {
|
||||
inputDir = file('build/classes/main')
|
||||
outputDir = file('build/classes/main')
|
||||
className = 'minetweaker.ClassRegistry'
|
||||
}
|
||||
|
||||
tasks.jar.dependsOn(makeRegistry)
|
||||
|
||||
dependencies {
|
||||
dependencies {
|
||||
compile project(':ZenScript')
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class ClassRegistry {
|
||||
public static void getClasses(List<Class> output) {
|
||||
// method stub; contents generated by RegisterZenClassesTask
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,17 @@ package minetweaker;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import minetweaker.annotations.BracketHandler;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.api.event.IEventManager;
|
||||
import minetweaker.api.mods.ILoadedMods;
|
||||
import minetweaker.runtime.IMineTweaker;
|
||||
import minetweaker.runtime.ILogger;
|
||||
import minetweaker.runtime.Tweaker;
|
||||
@@ -35,6 +46,22 @@ import stanhebben.zenscript.type.natives.JavaMethod;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
public class MineTweakerAPI {
|
||||
static {
|
||||
List<Class> apiClasses = new ArrayList<Class>();
|
||||
ClassRegistry.getClasses(apiClasses);
|
||||
|
||||
for (Class cls : apiClasses) {
|
||||
registerClass(cls);
|
||||
}
|
||||
|
||||
registerGlobalSymbol("logger", getJavaStaticFieldSymbol(MineTweakerAPI.class, "logger"));
|
||||
registerGlobalSymbol("tweaker", getJavaStaticFieldSymbol(MineTweakerAPI.class, "tweaker"));
|
||||
registerGlobalSymbol("recipes", getJavaStaticFieldSymbol(MineTweakerAPI.class, "recipes"));
|
||||
registerGlobalSymbol("furnace", getJavaStaticFieldSymbol(MineTweakerAPI.class, "furnace"));
|
||||
registerGlobalSymbol("oreDict", getJavaStaticFieldSymbol(MineTweakerAPI.class, "oreDict"));
|
||||
registerGlobalSymbol("events", getJavaStaticFieldSymbol(MineTweakerAPI.class, "events"));
|
||||
}
|
||||
|
||||
private MineTweakerAPI() {}
|
||||
|
||||
/**
|
||||
@@ -64,6 +91,58 @@ public class MineTweakerAPI {
|
||||
*/
|
||||
public static IFurnaceManager furnace = null;
|
||||
|
||||
/**
|
||||
* Access point to the events manager.
|
||||
*/
|
||||
public static IEventManager events = null;
|
||||
|
||||
/**
|
||||
* Access point to mods list.
|
||||
*/
|
||||
public static ILoadedMods loadedMods = null;
|
||||
|
||||
public static void registerClassRegistry(Class registryClass) {
|
||||
try {
|
||||
Method method = registryClass.getMethod("getClasses", List.class);
|
||||
if ((method.getModifiers() & Modifier.STATIC) == 0) {
|
||||
System.out.println("ERROR: getClasses method in " + registryClass.getName() + " isn't static");
|
||||
} else {
|
||||
List<Class> classes = new ArrayList<Class>();
|
||||
method.invoke(null, classes);
|
||||
|
||||
outer: for (Class cls : classes) {
|
||||
for (Annotation annotation : cls.getAnnotations()) {
|
||||
if (annotation instanceof ModOnly) {
|
||||
String[] value = ((ModOnly) annotation).value();
|
||||
for (String mod : value) {
|
||||
if (!loadedMods.contains(mod)) {
|
||||
continue outer; // skip this class
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MineTweakerAPI.registerClass(cls);
|
||||
}
|
||||
}
|
||||
} catch (NoSuchMethodException ex) {
|
||||
|
||||
} catch (IllegalAccessException ex) {
|
||||
|
||||
} catch (InvocationTargetException ex) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean registerClassRegistry(String className) {
|
||||
try {
|
||||
registerClassRegistry(Class.forName(className));
|
||||
return true;
|
||||
} catch (ClassNotFoundException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an annotated class. A class is annotated with either @ZenClass
|
||||
* or @ZenExpansion. Classes not annotated with either of these will be
|
||||
@@ -72,7 +151,7 @@ public class MineTweakerAPI {
|
||||
* @param annotatedClass
|
||||
*/
|
||||
public static void registerClass(Class annotatedClass) {
|
||||
System.out.println("Registering " + annotatedClass.getName());
|
||||
//System.out.println("Registering " + annotatedClass.getName());
|
||||
|
||||
for (Annotation annotation : annotatedClass.getAnnotations()) {
|
||||
if (annotation instanceof ZenExpansion) {
|
||||
@@ -82,6 +161,17 @@ public class MineTweakerAPI {
|
||||
if (annotation instanceof ZenClass) {
|
||||
GlobalRegistry.registerNativeClass(annotatedClass);
|
||||
}
|
||||
|
||||
if ((annotation instanceof BracketHandler) && IBracketHandler.class.isAssignableFrom(annotatedClass)) {
|
||||
try {
|
||||
IBracketHandler bracketHandler = (IBracketHandler) annotatedClass.newInstance();
|
||||
registerBracketHandler(bracketHandler);
|
||||
} catch (InstantiationException ex) {
|
||||
Logger.getLogger(MineTweakerAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
Logger.getLogger(MineTweakerAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
package minetweaker.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Marks a bracket handler. Bracket handlers are automatically registered.
|
||||
* The marked class should have an empty constructor.
|
||||
*
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface BracketHandler {
|
||||
/**
|
||||
* Indicates priority. A lower value means a higher priority. Only change
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.block;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public interface IBlock {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.container;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public interface IContainer {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.damage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public interface IDamageSource {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.entity;
|
||||
|
||||
import minetweaker.api.util.Position3f;
|
||||
import minetweaker.api.world.IDimension;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenSetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.entity.IEntity")
|
||||
public interface IEntity {
|
||||
@ZenGetter("world")
|
||||
public IDimension getWorld();
|
||||
|
||||
@ZenGetter("x")
|
||||
public float getX();
|
||||
|
||||
@ZenGetter("y")
|
||||
public float getY();
|
||||
|
||||
@ZenGetter("z")
|
||||
public float getZ();
|
||||
|
||||
@ZenGetter("position")
|
||||
public Position3f getPosition();
|
||||
|
||||
@ZenSetter("position")
|
||||
public void setPosition(Position3f position);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.entity;
|
||||
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public interface IEntityItem extends IEntity {
|
||||
@ZenGetter("item")
|
||||
public IItemStack getItem();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.entity;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.entity.IEntityXp")
|
||||
public interface IEntityXp extends IEntity {
|
||||
@ZenGetter("xp")
|
||||
public float getXp();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import java.io.Closeable;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IEventHandler")
|
||||
public interface IEventHandle extends Closeable {
|
||||
@ZenMethod
|
||||
@Override
|
||||
public void close();
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
/**
|
||||
* 37 kinds of event handlers!
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public interface IEventManager {
|
||||
public IEventHandle onPlayerCrafted(IPlayerCraftedEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerSmelted(IPlayerSmeltedEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerChangedDimension(IPlayerChangedDimensionEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerLoggedIn(IPlayerLoggedInEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerLoggedOut(IPlayerLoggedOutEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerRespawn(IPlayerRespawnEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerAttackEntity(IPlayerAttackEntityEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerBonemeal(IPlayerBonemealEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerInteractEntity(IPlayerInteractEntityEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerPickup(IPlayerPickupEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerPickupItem(IPlayerPickupItemEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerFillBucket(IPlayerFillBucketEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerDeathDrops(IPlayerDeathDropsEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerInteract(IPlayerInteractEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerOpenContainer(IPlayerOpenContainerEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerPickupXp(IPlayerPickupXpEventHandler ev);
|
||||
|
||||
/*public IEventHandle onPlayerSleepInBed(IPlayerSleepInBedEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerUseHoe(IPlayerUseHoeEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerUseItemStart(IPlayerUseItemStartEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerUseItemTick(IPlayerUseItemTickEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerUseItemStop(IPlayerUseItemStopEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerUseItemFinish(IPlayerUserItemFinishEventHandler ev);
|
||||
|
||||
public IEventHandle onPlayerChat(IPlayerChatEventHandler ev);
|
||||
|
||||
public IEventHandle onTimerSingle(int millis, ITimerEventHandler ev);
|
||||
|
||||
public IEventHandle onTimerRepeat(int millis, ITimerEventHandler ev);
|
||||
|
||||
public IEventHandle onEntityJoinWorld(IEntityJoinWorldEventHandler ev);
|
||||
|
||||
public IEventHandle onEntityStruckByLightning(IEntityStruckByLightningEventHandler ev);
|
||||
|
||||
public IEventHandle onLivingEnderTeleport(ILivingEnderTeleportEventHandler ev);
|
||||
|
||||
public IEventHandle onLivingAttackEvent(ILivingAttackEventHandler ev);
|
||||
|
||||
public IEventHandle onLivingDeathEvent(ILivingDeathEventHandler ev);
|
||||
|
||||
public IEventHandle onLivingJumpEvent(ILivingJumpEventHandler ev);
|
||||
|
||||
public IEventHandle onLivingFallEvent(ILivingFallEventHandler ev);
|
||||
|
||||
public IEventHandle onLivingHurtEvent(ILivingHurtEventHandler ev);
|
||||
|
||||
public IEventHandle onLivingDeathDropsEvent(ILivingDeathDropsEventHandler ev);
|
||||
|
||||
public IEventHandle onItemTossed(IItemTossedEventHandler ev);
|
||||
|
||||
public IEventHandle onItemExpired(IItemExpiredEventHandler ev);
|
||||
|
||||
public IEventHandle onMinecartCollision(IMinecartCollisionEventHandler ev);
|
||||
|
||||
public IEventHandle onMinecartInteract(IMinecartInteractEventHandler ev);
|
||||
|
||||
public IEventHandle onCommand(ICommandEventHandler ev);*/
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerAttackEntityEventHandler")
|
||||
public interface IPlayerAttackEntityEventHandler {
|
||||
public void handle(PlayerAttackEntityEvent event);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerBonemealEventHandler")
|
||||
public interface IPlayerBonemealEventHandler {
|
||||
public void handle(PlayerBonemealEvent event);
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public interface IPlayerChangedDimensionEventHandler {
|
||||
public void handle(PlayerChangedDimensionEvent event);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerCraftedEventHandler")
|
||||
public interface IPlayerCraftedEventHandler {
|
||||
public void handle(PlayerCraftedEvent ev);
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerDeathDropsEventHandler")
|
||||
public interface IPlayerDeathDropsEventHandler {
|
||||
public void handle(PlayerDeathDropsEvent event);
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerFillBucketEventHandler")
|
||||
public interface IPlayerFillBucketEventHandler {
|
||||
public void handle(PlayerFillBucketEvent event);
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerInteractEntityEventHandler")
|
||||
public interface IPlayerInteractEntityEventHandler {
|
||||
public void handle(PlayerInteractEntityEvent event);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerInteractEventHandler")
|
||||
public interface IPlayerInteractEventHandler {
|
||||
public void handle(PlayerInteractEvent event);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public interface IPlayerLoggedInEventHandler {
|
||||
public void handle(PlayerLoggedInEvent event);
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerLoggedOutEventHandler")
|
||||
public interface IPlayerLoggedOutEventHandler {
|
||||
public void handle(PlayerLoggedOutEvent event);
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerOpenContainerEventHandler")
|
||||
public interface IPlayerOpenContainerEventHandler {
|
||||
public void handle(PlayerOpenContainerEvent event);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerPickupEventHandler")
|
||||
public interface IPlayerPickupEventHandler {
|
||||
public void handle(PlayerPickupEvent event);
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerPickupItemEventHandler")
|
||||
public interface IPlayerPickupItemEventHandler {
|
||||
public void handle(PlayerPickupItemEvent event);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerPickupXpEventHandler")
|
||||
public interface IPlayerPickupXpEventHandler {
|
||||
public void handle(PlayerPickupXpEvent event);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerRespawnEventHandler")
|
||||
public interface IPlayerRespawnEventHandler {
|
||||
public void handle(PlayerRespawnEvent event);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.IPlayerSmeltedEventHandler")
|
||||
public interface IPlayerSmeltedEventHandler {
|
||||
public void handle(PlayerSmeltedEvent event);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.entity.IEntity;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerAttackEntityEvent")
|
||||
public class PlayerAttackEntityEvent {
|
||||
private final IPlayer player;
|
||||
private final IEntity entity;
|
||||
private boolean canceled;
|
||||
|
||||
public PlayerAttackEntityEvent(IPlayer player, IEntity entity) {
|
||||
this.player = player;
|
||||
this.entity = entity;
|
||||
canceled = false;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void cancel() {
|
||||
canceled = true;
|
||||
}
|
||||
|
||||
@ZenGetter("canceled")
|
||||
public boolean isCanceled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("entity")
|
||||
public IEntity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.block.IBlock;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.world.IBlockGroup;
|
||||
import minetweaker.api.world.IDimension;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerBonemealEvent")
|
||||
public class PlayerBonemealEvent {
|
||||
private final IPlayer player;
|
||||
private final IBlockGroup blocks;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
private boolean canceled;
|
||||
private boolean processed;
|
||||
|
||||
public PlayerBonemealEvent(IPlayer player, IBlockGroup blocks, int x, int y, int z) {
|
||||
this.player = player;
|
||||
this.blocks = blocks;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
canceled = false;
|
||||
processed = false;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void cancel() {
|
||||
canceled = true;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void process() {
|
||||
processed = true;
|
||||
}
|
||||
|
||||
@ZenGetter("canceled")
|
||||
public boolean isCanceled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
@ZenGetter("processed")
|
||||
public boolean isProcessed() {
|
||||
return processed;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("blocks")
|
||||
public IBlockGroup getBlocks() {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
@ZenGetter("x")
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@ZenGetter("y")
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
@ZenGetter("z")
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
@ZenGetter("block")
|
||||
public IBlock getBlock() {
|
||||
return blocks.getBlock(x, y, z);
|
||||
}
|
||||
|
||||
@ZenGetter("dimension")
|
||||
public IDimension getDimension() {
|
||||
return blocks.getDimension();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.world.IDimension;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerChangedDimensionEvent")
|
||||
public class PlayerChangedDimensionEvent {
|
||||
private final IPlayer player;
|
||||
private final IDimension from;
|
||||
private final IDimension to;
|
||||
|
||||
public PlayerChangedDimensionEvent(IPlayer player, IDimension from, IDimension to) {
|
||||
this.player = player;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("from")
|
||||
public IDimension getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
@ZenGetter("to")
|
||||
public IDimension getTo() {
|
||||
return to;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.recipes.ICraftingInventory;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerCraftingEvent")
|
||||
public class PlayerCraftedEvent {
|
||||
private final IPlayer player;
|
||||
private final IItemStack output;
|
||||
private final ICraftingInventory inventory;
|
||||
|
||||
public PlayerCraftedEvent(IPlayer player, IItemStack output, ICraftingInventory inventory) {
|
||||
this.player = player;
|
||||
this.output = output;
|
||||
this.inventory = inventory;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("output")
|
||||
public IItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@ZenGetter("inventory")
|
||||
public ICraftingInventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import java.util.List;
|
||||
import minetweaker.api.damage.IDamageSource;
|
||||
import minetweaker.api.entity.IEntityItem;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerDeathDropsEvent")
|
||||
public class PlayerDeathDropsEvent {
|
||||
private final IPlayer player;
|
||||
private final List<IEntityItem> items;
|
||||
private final IDamageSource damageSource;
|
||||
|
||||
public PlayerDeathDropsEvent(IPlayer player, List<IEntityItem> items, IDamageSource damageSource) {
|
||||
this.player = player;
|
||||
this.items = items;
|
||||
this.damageSource = damageSource;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("items")
|
||||
public List<IEntityItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
@ZenGetter("damageSource")
|
||||
public IDamageSource getDamageSource() {
|
||||
return damageSource;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.block.IBlock;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.world.IBlockGroup;
|
||||
import minetweaker.api.world.IDimension;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import stanhebben.zenscript.annotations.ZenSetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerFillBucketEvent")
|
||||
public class PlayerFillBucketEvent {
|
||||
private final IPlayer player;
|
||||
private final IBlockGroup blocks;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
private boolean canceled;
|
||||
private IItemStack result;
|
||||
|
||||
public PlayerFillBucketEvent(IPlayer player, IBlockGroup blocks, int x, int y, int z) {
|
||||
this.player = player;
|
||||
this.blocks = blocks;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
canceled = false;
|
||||
result = null;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void cancel() {
|
||||
canceled = true;
|
||||
}
|
||||
|
||||
@ZenGetter("canceled")
|
||||
public boolean isCanceled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the resulting item. Automatically processes the event, too.
|
||||
*
|
||||
* @param result resulting item
|
||||
*/
|
||||
@ZenSetter("result")
|
||||
public void setResult(IItemStack result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@ZenGetter("result")
|
||||
public IItemStack getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("blocks")
|
||||
public IBlockGroup getBlocks() {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
@ZenGetter("x")
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@ZenGetter("y")
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
@ZenGetter("z")
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
@ZenGetter("block")
|
||||
public IBlock getBlock() {
|
||||
return blocks.getBlock(x, y, z);
|
||||
}
|
||||
|
||||
@ZenGetter("dimension")
|
||||
public IDimension getDimension() {
|
||||
return blocks.getDimension();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.entity.IEntity;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerInteractEntityEvent")
|
||||
public class PlayerInteractEntityEvent {
|
||||
private final IPlayer player;
|
||||
private final IEntity entity;
|
||||
private boolean canceled;
|
||||
|
||||
public PlayerInteractEntityEvent(IPlayer player, IEntity entity) {
|
||||
this.player = player;
|
||||
this.entity = entity;
|
||||
canceled = false;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void cancel() {
|
||||
canceled = true;
|
||||
}
|
||||
|
||||
@ZenGetter("canceled")
|
||||
public boolean isCanceled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("entity")
|
||||
public IEntity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.block.IBlock;
|
||||
import minetweaker.api.entity.IEntity;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.world.IBlockGroup;
|
||||
import minetweaker.api.world.IDimension;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerInteractEvent")
|
||||
public class PlayerInteractEvent {
|
||||
private final IPlayer player;
|
||||
private final IEntity entity;
|
||||
private final IBlockGroup blocks;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
|
||||
private boolean canceled;
|
||||
private boolean useBlock;
|
||||
private boolean useItem;
|
||||
|
||||
public PlayerInteractEvent(IPlayer player, IEntity entity, IBlockGroup blocks, int x, int y, int z) {
|
||||
this.player = player;
|
||||
this.entity = entity;
|
||||
this.blocks = blocks;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
canceled = false;
|
||||
useBlock = false;
|
||||
useItem = false;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void cancel() {
|
||||
canceled = true;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void useBlock() {
|
||||
useBlock = true;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void useItem() {
|
||||
useItem = true;
|
||||
}
|
||||
|
||||
@ZenGetter("canceled")
|
||||
public boolean isCanceled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
@ZenGetter("usingBlock")
|
||||
public boolean isUsingBlock() {
|
||||
return useBlock;
|
||||
}
|
||||
|
||||
@ZenGetter("usingItem")
|
||||
public boolean isUsingItem() {
|
||||
return useItem;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("blocks")
|
||||
public IBlockGroup getBlocks() {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
@ZenGetter("x")
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@ZenGetter("y")
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
@ZenGetter("z")
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
@ZenGetter("block")
|
||||
public IBlock getBlock() {
|
||||
return blocks.getBlock(x, y, z);
|
||||
}
|
||||
|
||||
@ZenGetter("dimension")
|
||||
public IDimension getDimension() {
|
||||
return blocks.getDimension();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerLoggedInEvent")
|
||||
public class PlayerLoggedInEvent {
|
||||
private final IPlayer player;
|
||||
|
||||
public PlayerLoggedInEvent(IPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerLoggedOutEvent")
|
||||
public class PlayerLoggedOutEvent {
|
||||
private final IPlayer player;
|
||||
|
||||
public PlayerLoggedOutEvent(IPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.container.IContainer;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerOpenContainerEvent")
|
||||
public class PlayerOpenContainerEvent {
|
||||
private final IPlayer player;
|
||||
private final IContainer container;
|
||||
private boolean canceled;
|
||||
|
||||
public PlayerOpenContainerEvent(IPlayer player, IContainer container) {
|
||||
this.player = player;
|
||||
this.container = container;
|
||||
|
||||
canceled = false;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void cancel() {
|
||||
canceled = true;
|
||||
}
|
||||
|
||||
@ZenGetter("canceled")
|
||||
public boolean isCanceled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("container")
|
||||
public IContainer getContainer() {
|
||||
return container;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.entity.IEntity;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerPickupEvent")
|
||||
public class PlayerPickupEvent {
|
||||
private final IPlayer player;
|
||||
private final IEntity entity;
|
||||
private boolean canceled;
|
||||
private boolean processed;
|
||||
|
||||
public PlayerPickupEvent(IPlayer player, IEntity entity) {
|
||||
this.player = player;
|
||||
this.entity = entity;
|
||||
|
||||
canceled = false;
|
||||
processed = false;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void cancel() {
|
||||
canceled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the event (picks up the entity).
|
||||
*/
|
||||
@ZenMethod
|
||||
public void process() {
|
||||
processed = true;
|
||||
}
|
||||
|
||||
@ZenGetter("canceled")
|
||||
public boolean isCanceled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
@ZenGetter("processed")
|
||||
public boolean isProcessed() {
|
||||
return processed;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("entity")
|
||||
public IEntity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerPickupItemEvent")
|
||||
public class PlayerPickupItemEvent {
|
||||
private final IPlayer player;
|
||||
private final IItemStack item;
|
||||
|
||||
public PlayerPickupItemEvent(IPlayer player, IItemStack item) {
|
||||
this.player = player;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("item")
|
||||
public IItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.entity.IEntityXp;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerPickupXpEvent")
|
||||
public class PlayerPickupXpEvent {
|
||||
private final IPlayer player;
|
||||
private final IEntityXp xp;
|
||||
private boolean canceled;
|
||||
|
||||
public PlayerPickupXpEvent(IPlayer player, IEntityXp xp) {
|
||||
this.player = player;
|
||||
this.xp = xp;
|
||||
|
||||
canceled = false;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void cancel() {
|
||||
canceled = true;
|
||||
}
|
||||
|
||||
@ZenGetter("canceled")
|
||||
public boolean isCanceled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("entity")
|
||||
public IEntityXp getEntity() {
|
||||
return xp;
|
||||
}
|
||||
|
||||
@ZenGetter("xp")
|
||||
public float getXp() {
|
||||
return xp.getXp();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.event.PlayerRespawnEvent")
|
||||
public class PlayerRespawnEvent {
|
||||
private final IPlayer player;
|
||||
|
||||
public PlayerRespawnEvent(IPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.event;
|
||||
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class PlayerSmeltedEvent {
|
||||
private final IPlayer player;
|
||||
private final IItemStack output;
|
||||
|
||||
public PlayerSmeltedEvent(IPlayer player, IItemStack output) {
|
||||
this.player = player;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ZenGetter("output")
|
||||
public IItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
@@ -74,4 +74,9 @@ public class IngredientAny implements IIngredient {
|
||||
public Object getInternal() {
|
||||
return INTERNAL_ANY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "<*>";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.mods;
|
||||
|
||||
import stanhebben.zenscript.annotations.IterableSimple;
|
||||
import stanhebben.zenscript.annotations.OperatorType;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenOperator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.mods.ILoadedMods")
|
||||
@IterableSimple("minetweaker.mods.IMod")
|
||||
public interface ILoadedMods extends Iterable<IMod> {
|
||||
@ZenOperator(OperatorType.CONTAINS)
|
||||
public boolean contains(String name);
|
||||
|
||||
@ZenOperator(OperatorType.INDEXGET)
|
||||
public IMod get(String name);
|
||||
}
|
||||
@@ -1,15 +1,22 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.mods;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*
|
||||
*
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
public class IMod {
|
||||
public interface IMod {
|
||||
@ZenGetter("id")
|
||||
public String getId();
|
||||
|
||||
@ZenGetter("name")
|
||||
public String getName();
|
||||
|
||||
@ZenGetter("version")
|
||||
public String getVersion();
|
||||
|
||||
@ZenGetter("decription")
|
||||
public String getDescription();
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@ZenClass("minetweaker.recipes.IFurnaceManager")
|
||||
public interface IFurnaceManager {
|
||||
@ZenMethod
|
||||
public void remove(IIngredient ingredient);
|
||||
public void remove(IIngredient output, @Optional IIngredient input);
|
||||
|
||||
@ZenMethod
|
||||
public void addRecipe(IItemStack output, IIngredient input, @Optional double xp);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.util;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.util.Position3f")
|
||||
public class Position3f {
|
||||
private final float x;
|
||||
private final float y;
|
||||
private final float z;
|
||||
|
||||
public Position3f(float x, float y, float z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@ZenGetter("x")
|
||||
public float getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@ZenGetter("y")
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
@ZenGetter("z")
|
||||
public float getZ() {
|
||||
return z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.world;
|
||||
|
||||
import minetweaker.api.block.IBlock;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.world.IBlockGroup")
|
||||
public interface IBlockGroup {
|
||||
@ZenGetter("dimension")
|
||||
public IDimension getDimension();
|
||||
|
||||
@ZenMethod
|
||||
public IBlock getBlock(int x, int y, int z);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.world;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.world.IDimension")
|
||||
public interface IDimension extends IBlockGroup {
|
||||
@ZenGetter
|
||||
public boolean isDay();
|
||||
|
||||
@ZenMethod
|
||||
public int getBrightness(int x, int y, int z);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.api.world;
|
||||
|
||||
import java.util.List;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("minetweaker.world.IGame")
|
||||
public interface IGame {
|
||||
@ZenGetter("dimensions")
|
||||
public List<IDimension> getDimensions();
|
||||
}
|
||||
@@ -18,33 +18,7 @@ import java.util.logging.Logger;
|
||||
import minetweaker.IBracketHandler;
|
||||
import minetweaker.IRecipeRemover;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.expand.ExpandAnyArray;
|
||||
import minetweaker.expand.ExpandAnyDict;
|
||||
import minetweaker.expand.ExpandBool;
|
||||
import minetweaker.expand.ExpandByte;
|
||||
import minetweaker.expand.ExpandDouble;
|
||||
import minetweaker.expand.ExpandFloat;
|
||||
import minetweaker.expand.ExpandInt;
|
||||
import minetweaker.expand.ExpandLong;
|
||||
import minetweaker.expand.ExpandShort;
|
||||
import minetweaker.expand.ExpandString;
|
||||
import minetweaker.api.data.IData;
|
||||
import minetweaker.api.item.Condition;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemCondition;
|
||||
import minetweaker.api.item.IItemDefinition;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.item.IItemTransformer;
|
||||
import minetweaker.api.item.Transform;
|
||||
import minetweaker.api.liquid.ILiquidDefinition;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import minetweaker.api.oredict.IOreDict;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.recipes.ICraftingInventory;
|
||||
import minetweaker.api.recipes.IFurnaceManager;
|
||||
import minetweaker.api.recipes.IRecipeFunction;
|
||||
import minetweaker.api.recipes.IRecipeManager;
|
||||
import stanhebben.zenscript.IZenErrorLogger;
|
||||
import stanhebben.zenscript.TypeExpansion;
|
||||
import stanhebben.zenscript.annotations.ZenExpansion;
|
||||
@@ -82,52 +56,6 @@ public class GlobalRegistry {
|
||||
registerGlobal("print", getStaticFunction(GlobalFunctions.class, "print", String.class));
|
||||
registerGlobal("max", getStaticFunction(Math.class, "max", int.class, int.class));
|
||||
registerGlobal("min", getStaticFunction(Math.class, "min", int.class, int.class));
|
||||
|
||||
registerGlobal("logger", getStaticField(MineTweakerAPI.class, "logger"));
|
||||
registerGlobal("tweaker", getStaticField(MineTweakerAPI.class, "tweaker"));
|
||||
registerGlobal("recipes", getStaticField(MineTweakerAPI.class, "recipes"));
|
||||
registerGlobal("furnace", getStaticField(MineTweakerAPI.class, "furnace"));
|
||||
registerGlobal("oreDict", getStaticField(MineTweakerAPI.class, "oreDict"));
|
||||
|
||||
registerExpansion(ExpandAnyArray.class);
|
||||
registerExpansion(ExpandAnyDict.class);
|
||||
registerExpansion(ExpandBool.class);
|
||||
registerExpansion(ExpandByte.class);
|
||||
registerExpansion(ExpandDouble.class);
|
||||
registerExpansion(ExpandFloat.class);
|
||||
registerExpansion(ExpandInt.class);
|
||||
registerExpansion(ExpandLong.class);
|
||||
registerExpansion(ExpandShort.class);
|
||||
registerExpansion(ExpandString.class);
|
||||
|
||||
// minetweaker.api.data
|
||||
registerNativeClass(IData.class);
|
||||
|
||||
// minetweaker.api.item
|
||||
registerNativeClass(IIngredient.class);
|
||||
registerNativeClass(IItemCondition.class);
|
||||
registerNativeClass(IItemDefinition.class);
|
||||
registerNativeClass(IItemStack.class);
|
||||
registerNativeClass(IItemTransformer.class);
|
||||
registerNativeClass(Condition.class);
|
||||
registerNativeClass(Transform.class);
|
||||
|
||||
// minetweaker.api.liquid
|
||||
registerNativeClass(ILiquidDefinition.class);
|
||||
registerNativeClass(ILiquidStack.class);
|
||||
|
||||
// minetweaker.api.oredict
|
||||
registerNativeClass(IOreDict.class);
|
||||
registerNativeClass(IOreDictEntry.class);
|
||||
|
||||
// minetweaker.api.player
|
||||
registerNativeClass(IPlayer.class);
|
||||
|
||||
// minetweaker.api.recipes
|
||||
registerNativeClass(ICraftingInventory.class);
|
||||
registerNativeClass(IFurnaceManager.class);
|
||||
registerNativeClass(IRecipeFunction.class);
|
||||
registerNativeClass(IRecipeManager.class);
|
||||
}
|
||||
|
||||
private GlobalRegistry() {}
|
||||
@@ -145,7 +73,7 @@ public class GlobalRegistry {
|
||||
if (annotation instanceof ZenExpansion) {
|
||||
ZenExpansion eAnnotation = (ZenExpansion) annotation;
|
||||
if (!expansions.containsKey(eAnnotation.value())) {
|
||||
expansions.put(eAnnotation.value(), new TypeExpansion());
|
||||
expansions.put(eAnnotation.value(), new TypeExpansion(eAnnotation.value()));
|
||||
}
|
||||
expansions.get(eAnnotation.value()).expand(cls, types);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import minetweaker.tasks.RegisterZenClassesTask;
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -27,8 +29,10 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'FMLCorePlugin': 'minetweaker.mc172.transformer.MineTweakerTransformer'
|
||||
}
|
||||
task makeRegistry(type: RegisterZenClassesTask) {
|
||||
inputDir = file('build/classes/main')
|
||||
outputDir = file('build/classes/main')
|
||||
className = 'minetweaker.mc172.MineTweakerRegistry'
|
||||
}
|
||||
|
||||
tasks.jar.dependsOn(makeRegistry)
|
||||
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
@@ -70,7 +70,9 @@ public class MineTweakerCommand implements ICommand {
|
||||
"minetweaker oredict <name>",
|
||||
" Outputs all items in the given ore dictionary entry to the minetweaker log",
|
||||
"minetweaker mods",
|
||||
" Outputs all active mod IDs in the game"
|
||||
" Outputs all active mod IDs in the game",
|
||||
"minetweaker name <id>",
|
||||
" Outputs the name for the given item ID"
|
||||
/* "minetweaker name <id>[:<meta>]",
|
||||
" Prints the unlocalized name of the specified item," +
|
||||
" can be used as item or block name",
|
||||
@@ -162,7 +164,7 @@ public class MineTweakerCommand implements ICommand {
|
||||
description.append('*').append(stack.stackSize);
|
||||
}
|
||||
|
||||
sendChatMessage(icommandsender, new TweakerItemStack(stack).toString());
|
||||
sendChatMessage(icommandsender, new MCItemStack(stack).toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -185,7 +187,7 @@ public class MineTweakerCommand implements ICommand {
|
||||
description.append('*').append(stack.stackSize);
|
||||
}
|
||||
|
||||
sendChatMessage(icommandsender, new TweakerItemStack(stack).toString());
|
||||
sendChatMessage(icommandsender, new MCItemStack(stack).toString());
|
||||
}
|
||||
} else {
|
||||
sendChatMessage(icommandsender, "Hand command can only be executed by players");
|
||||
@@ -200,7 +202,7 @@ public class MineTweakerCommand implements ICommand {
|
||||
} else {
|
||||
MineTweakerAPI.logger.logCommand("Ore entries for " + entryName + ":");
|
||||
for (ItemStack ore : ores) {
|
||||
MineTweakerAPI.logger.logCommand(" " + new TweakerItemStack(ore).toString());
|
||||
MineTweakerAPI.logger.logCommand(" " + new MCItemStack(ore).toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -208,7 +210,7 @@ public class MineTweakerCommand implements ICommand {
|
||||
MineTweakerAPI.logger.logCommand("Ore entries for " + entryName + ":");
|
||||
List<ItemStack> ores = OreDictionary.getOres(entryName);
|
||||
for (ItemStack ore : ores) {
|
||||
MineTweakerAPI.logger.logCommand(" " + new TweakerItemStack(ore).toString());
|
||||
MineTweakerAPI.logger.logCommand(" " + new MCItemStack(ore).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,6 +222,13 @@ public class MineTweakerCommand implements ICommand {
|
||||
sendChatMessage(icommandsender, mod.getModId());
|
||||
MineTweakerAPI.logger.logCommand("Mod: " + mod.getModId());
|
||||
}
|
||||
} else if (arguments[0].equals("name")) {
|
||||
try {
|
||||
int id = Integer.parseInt(arguments[1]);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
MineTweakerAPI.logger.logCommand("ID must be an integer");
|
||||
}
|
||||
}
|
||||
|
||||
/*if (arguments[0].equals("name")) {
|
||||
|
||||
@@ -13,22 +13,19 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.mc172.brackets.ItemBracketHandler;
|
||||
import minetweaker.mc172.brackets.LiquidBracketHandler;
|
||||
import minetweaker.mc172.brackets.OreBracketHandler;
|
||||
import minetweaker.mc172.furnace.TweakerFurnace;
|
||||
import minetweaker.mc172.furnace.FuelTweaker;
|
||||
import minetweaker.mc172.furnace.MCFurnaceManager;
|
||||
import minetweaker.mc172.mods.MCLoadedMods;
|
||||
import minetweaker.mc172.network.MineTweakerLoadScriptsHandler;
|
||||
import minetweaker.mc172.network.MineTweakerLoadScriptsPacket;
|
||||
import minetweaker.mc172.oredict.OreDict;
|
||||
import minetweaker.mc172.recipes.MTRecipeManager;
|
||||
import minetweaker.mc172.oredict.MCOreDict;
|
||||
import minetweaker.mc172.recipes.MCRecipeManager;
|
||||
import minetweaker.mc172.util.MineTweakerHacks;
|
||||
import minetweaker.runtime.IScriptProvider;
|
||||
import minetweaker.runtime.providers.ScriptProviderCascade;
|
||||
@@ -65,28 +62,11 @@ public class MineTweakerMod {
|
||||
private boolean iAmServer = false;
|
||||
|
||||
public MineTweakerMod() {
|
||||
MineTweakerAPI.oreDict = new OreDict();
|
||||
MineTweakerAPI.recipes = new MTRecipeManager();
|
||||
MineTweakerAPI.oreDict = new MCOreDict();
|
||||
MineTweakerAPI.recipes = new MCRecipeManager();
|
||||
MineTweakerAPI.logger = new MineTweakerLogger();
|
||||
MineTweakerAPI.furnace = new TweakerFurnace();
|
||||
|
||||
/*List<Class> classes = new ArrayList<Class>();
|
||||
MineTweakerRegistry.getClasses(classes);
|
||||
|
||||
outer: for (Class cls : classes) {
|
||||
for (Annotation annotation : cls.getAnnotations()) {
|
||||
if (annotation instanceof ModOnly) {
|
||||
String[] value = ((ModOnly) annotation).value();
|
||||
for (String mod : value) {
|
||||
if (!Loader.isModLoaded(mod)) {
|
||||
continue outer; // skip this class
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MineTweakerAPI.registerClass(cls);
|
||||
}*/
|
||||
MineTweakerAPI.furnace = new MCFurnaceManager();
|
||||
MineTweakerAPI.loadedMods = new MCLoadedMods();
|
||||
|
||||
File globalDir = new File("scripts");
|
||||
if (!globalDir.exists()) {
|
||||
@@ -108,8 +88,10 @@ public class MineTweakerMod {
|
||||
MineTweakerAPI.tweaker.rollback();
|
||||
MineTweakerAPI.tweaker.load();
|
||||
|
||||
// execute script on all connected clients
|
||||
NETWORK.sendToAll(new MineTweakerLoadScriptsPacket(MineTweakerAPI.tweaker.getScriptData()));
|
||||
if (iAmServer) {
|
||||
// execute script on all connected clients
|
||||
NETWORK.sendToAll(new MineTweakerLoadScriptsPacket(MineTweakerAPI.tweaker.getScriptData()));
|
||||
}
|
||||
}
|
||||
|
||||
// ##########################
|
||||
@@ -124,29 +106,13 @@ public class MineTweakerMod {
|
||||
|
||||
@EventHandler
|
||||
public void onPostInit(FMLPostInitializationEvent ev) {
|
||||
MineTweakerAPI.registerBracketHandler(new ItemBracketHandler());
|
||||
MineTweakerAPI.registerBracketHandler(new LiquidBracketHandler());
|
||||
MineTweakerAPI.registerBracketHandler(new OreBracketHandler());
|
||||
MineTweakerAPI.registerClassRegistry(MineTweakerRegistry.class);
|
||||
|
||||
for (String registry : REGISTRIES) {
|
||||
try {
|
||||
Class cls = Class.forName(registry);
|
||||
Method method = cls.getMethod("register");
|
||||
if ((method.getModifiers() & Modifier.STATIC) == 0) {
|
||||
System.out.println("ERROR: register method in " + registry + " isn't static");
|
||||
} else {
|
||||
method.invoke(null);
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
|
||||
} catch (NoSuchMethodException ex) {
|
||||
|
||||
} catch (IllegalAccessException ex) {
|
||||
|
||||
} catch (InvocationTargetException ex) {
|
||||
|
||||
}
|
||||
MineTweakerAPI.registerClassRegistry(registry);
|
||||
}
|
||||
|
||||
FuelTweaker.INSTANCE.register();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -171,4 +137,9 @@ public class MineTweakerMod {
|
||||
public void onServerStarting(FMLServerStartingEvent ev) {
|
||||
ev.registerServerCommand(new MineTweakerCommand());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onServerStopped(FMLServerStoppedEvent ev) {
|
||||
iAmServer = false;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
import minetweaker.IBracketHandler;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.annotations.BracketHandler;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.item.IngredientAny;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -36,7 +36,7 @@ public class ItemBracketHandler implements IBracketHandler {
|
||||
public static IItemStack getItem(String name, int meta) {
|
||||
Item item = (Item) Item.itemRegistry.getObject(name);
|
||||
if (item != null) {
|
||||
return new TweakerItemStack(new ItemStack(item, 1, meta), true);
|
||||
return new MCItemStack(new ItemStack(item, 1, meta), true);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package minetweaker.mc172.brackets;
|
||||
import java.util.List;
|
||||
import minetweaker.IBracketHandler;
|
||||
import minetweaker.annotations.BracketHandler;
|
||||
import minetweaker.mc172.liquid.TweakerLiquidStack;
|
||||
import minetweaker.mc172.liquid.MCLiquidStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import minetweaker.runtime.GlobalRegistry;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
@@ -26,7 +26,7 @@ public class LiquidBracketHandler implements IBracketHandler {
|
||||
public static ILiquidStack getLiquid(String name) {
|
||||
Fluid fluid = FluidRegistry.getFluid(name);
|
||||
if (fluid != null) {
|
||||
return new TweakerLiquidStack(new FluidStack(fluid, 1));
|
||||
return new MCLiquidStack(new FluidStack(fluid, 1));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
+4
-2
@@ -8,7 +8,8 @@ package minetweaker.mc172.brackets;
|
||||
|
||||
import java.util.List;
|
||||
import minetweaker.IBracketHandler;
|
||||
import minetweaker.mc172.oredict.OreDictEntry;
|
||||
import minetweaker.annotations.BracketHandler;
|
||||
import minetweaker.mc172.oredict.MCOreDictEntry;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import minetweaker.runtime.GlobalRegistry;
|
||||
import stanhebben.zenscript.expression.ExpressionJavaCallStatic;
|
||||
@@ -23,9 +24,10 @@ import stanhebben.zenscript.util.ZenPosition;
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
@BracketHandler
|
||||
public class OreBracketHandler implements IBracketHandler {
|
||||
public static IOreDictEntry getOre(String name) {
|
||||
return new OreDictEntry(name);
|
||||
return new MCOreDictEntry(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,7 @@ import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
|
||||
public class FuelTweaker {
|
||||
public static final FuelTweaker INSTANCE = new FuelTweaker();
|
||||
@@ -71,7 +71,7 @@ public class FuelTweaker {
|
||||
private class OverridingFuelHandler implements IFuelHandler {
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel) {
|
||||
IItemStack stack = new TweakerItemStack(fuel);
|
||||
IItemStack stack = new MCItemStack(fuel);
|
||||
String name = fuel.getUnlocalizedName();
|
||||
if (quickList.containsKey(name)) {
|
||||
for (SetFuelPattern override : quickList.get(name)) {
|
||||
|
||||
+53
-13
@@ -15,7 +15,7 @@ import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.recipes.IFurnaceManager;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.mc172.util.MineTweakerUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
@@ -24,26 +24,29 @@ import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class TweakerFurnace implements IFurnaceManager {
|
||||
public TweakerFurnace() {
|
||||
public class MCFurnaceManager implements IFurnaceManager {
|
||||
public MCFurnaceManager() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(IIngredient ingredient) {
|
||||
public void remove(IIngredient output, IIngredient input) {
|
||||
if (output == null) throw new IllegalArgumentException("output cannot be null");
|
||||
|
||||
Map<ItemStack, ItemStack> smeltingList = FurnaceRecipes.smelting().getSmeltingList();
|
||||
|
||||
List<ItemStack> toRemove = new ArrayList<ItemStack>();
|
||||
List<ItemStack> toRemoveValues = new ArrayList<ItemStack>();
|
||||
for (Map.Entry<ItemStack, ItemStack> entry : smeltingList.entrySet()) {
|
||||
if (ingredient.matches(new TweakerItemStack(entry.getValue()))) {
|
||||
if (output.matches(new MCItemStack(entry.getValue()))
|
||||
&& (input == null || input.matches(new MCItemStack(entry.getKey())))) {
|
||||
toRemove.add(entry.getKey());
|
||||
toRemoveValues.add(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (toRemove.isEmpty()) {
|
||||
MineTweakerAPI.logger.logWarning("No furnace recipes for " + ingredient.toString());
|
||||
MineTweakerAPI.logger.logWarning("No furnace recipes for " + output.toString());
|
||||
} else {
|
||||
MineTweakerAPI.tweaker.apply(new RemoveAction(toRemove, toRemoveValues));
|
||||
}
|
||||
@@ -58,12 +61,12 @@ public class TweakerFurnace implements IFurnaceManager {
|
||||
|
||||
ItemStack[] items2 = MineTweakerUtil.getItemStacks(items);
|
||||
ItemStack output2 = (ItemStack) output.getInternal();
|
||||
MineTweakerAPI.tweaker.apply(new AddRecipeAction(items2, output2, xp));
|
||||
MineTweakerAPI.tweaker.apply(new AddRecipeAction(input, items2, output2, xp));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuel(IIngredient item, int fuel) {
|
||||
// TODO: complete this method
|
||||
MineTweakerAPI.tweaker.apply(new SetFuelAction(new SetFuelPattern(item, fuel)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,11 +118,13 @@ public class TweakerFurnace implements IFurnaceManager {
|
||||
}
|
||||
|
||||
private static class AddRecipeAction implements IUndoableAction {
|
||||
private final IIngredient ingredient;
|
||||
private final ItemStack[] input;
|
||||
private final ItemStack output;
|
||||
private final double xp;
|
||||
|
||||
public AddRecipeAction(ItemStack[] input, ItemStack output, double xp) {
|
||||
public AddRecipeAction(IIngredient ingredient, ItemStack[] input, ItemStack output, double xp) {
|
||||
this.ingredient = ingredient;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.xp = xp;
|
||||
@@ -128,7 +133,7 @@ public class TweakerFurnace implements IFurnaceManager {
|
||||
@Override
|
||||
public void apply() {
|
||||
for (ItemStack inputStack : input) {
|
||||
FurnaceRecipes.smelting().func_151396_a(inputStack.getItem(), output, (float) xp);
|
||||
FurnaceRecipes.smelting().func_151394_a(inputStack, output, (float) xp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,17 +144,52 @@ public class TweakerFurnace implements IFurnaceManager {
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
// TODO
|
||||
for (ItemStack inputStack : input) {
|
||||
FurnaceRecipes.smelting().getSmeltingList().remove(inputStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
return "Adding furnace recipe for " + ingredient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
return "Removing furnace recipe for " + ingredient;
|
||||
}
|
||||
}
|
||||
|
||||
private static class SetFuelAction implements IUndoableAction {
|
||||
private final SetFuelPattern pattern;
|
||||
|
||||
public SetFuelAction(SetFuelPattern pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
FuelTweaker.INSTANCE.addFuelPattern(pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
FuelTweaker.INSTANCE.removeFuelPattern(pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Setting fuel for " + pattern.getPattern();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing fuel for " + pattern.getPattern();
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -13,10 +13,10 @@ import net.minecraft.item.Item;
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class TweakerItemDefinition implements IItemDefinition {
|
||||
public class MCItemDefinition implements IItemDefinition {
|
||||
private final Item item;
|
||||
|
||||
public TweakerItemDefinition(Item item) {
|
||||
public MCItemDefinition(Item item) {
|
||||
this.item = item;
|
||||
}
|
||||
}
|
||||
+15
-12
@@ -10,7 +10,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.mc172.data.NBTConverter;
|
||||
import minetweaker.mc172.liquid.TweakerLiquidStack;
|
||||
import minetweaker.mc172.liquid.MCLiquidStack;
|
||||
import minetweaker.api.data.IData;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemCondition;
|
||||
@@ -31,26 +31,26 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class TweakerItemStack implements IItemStack {
|
||||
public class MCItemStack implements IItemStack {
|
||||
private final ItemStack stack;
|
||||
private final List<IItemStack> items;
|
||||
private IData tag = null;
|
||||
private boolean wildcardSize;
|
||||
|
||||
public TweakerItemStack(ItemStack itemStack) {
|
||||
public MCItemStack(ItemStack itemStack) {
|
||||
if (itemStack == null) throw new IllegalArgumentException("stack cannot be null");
|
||||
|
||||
stack = itemStack.copy();
|
||||
items = Collections.<IItemStack>singletonList(this);
|
||||
}
|
||||
|
||||
public TweakerItemStack(ItemStack itemStack, boolean wildcardSize) {
|
||||
public MCItemStack(ItemStack itemStack, boolean wildcardSize) {
|
||||
this(itemStack);
|
||||
|
||||
this.wildcardSize = wildcardSize;
|
||||
}
|
||||
|
||||
private TweakerItemStack(ItemStack itemStack, IData tag) {
|
||||
private MCItemStack(ItemStack itemStack, IData tag) {
|
||||
if (itemStack == null) throw new IllegalArgumentException("stack cannot be null");
|
||||
|
||||
stack = itemStack;
|
||||
@@ -60,7 +60,7 @@ public class TweakerItemStack implements IItemStack {
|
||||
|
||||
@Override
|
||||
public IItemDefinition getDefinition() {
|
||||
return new TweakerItemDefinition(stack.getItem());
|
||||
return new MCItemDefinition(stack.getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,7 +98,7 @@ public class TweakerItemStack implements IItemStack {
|
||||
@Override
|
||||
public ILiquidStack getLiquid() {
|
||||
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack);
|
||||
return liquid == null ? null : new TweakerLiquidStack(liquid);
|
||||
return liquid == null ? null : new MCLiquidStack(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,7 +109,7 @@ public class TweakerItemStack implements IItemStack {
|
||||
} else {
|
||||
ItemStack result = new ItemStack(stack.getItem(), stack.stackSize, OreDictionary.WILDCARD_VALUE);
|
||||
result.stackTagCompound = stack.stackTagCompound;
|
||||
return new TweakerItemStack(result, tag);
|
||||
return new MCItemStack(result, tag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class TweakerItemStack implements IItemStack {
|
||||
} else {
|
||||
ItemStack result = new ItemStack(stack.getItem(), stack.stackSize, damage);
|
||||
result.stackTagCompound = stack.stackTagCompound;
|
||||
return new TweakerItemStack(result, tag);
|
||||
return new MCItemStack(result, tag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class TweakerItemStack implements IItemStack {
|
||||
public IItemStack withAmount(int amount) {
|
||||
ItemStack result = new ItemStack(stack.getItem(), amount, stack.getItemDamage());
|
||||
result.stackTagCompound = stack.stackTagCompound;
|
||||
return new TweakerItemStack(result, tag);
|
||||
return new MCItemStack(result, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,7 +140,7 @@ public class TweakerItemStack implements IItemStack {
|
||||
} else {
|
||||
result.stackTagCompound = (NBTTagCompound) NBTConverter.from(tag);
|
||||
}
|
||||
return new TweakerItemStack(result, tag);
|
||||
return new MCItemStack(result, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,9 +198,12 @@ public class TweakerItemStack implements IItemStack {
|
||||
if (internal == null) {
|
||||
throw new RuntimeException("Invalid item: " + item);
|
||||
}
|
||||
|
||||
return internal.getItem() == stack.getItem()
|
||||
&& (wildcardSize || internal.stackSize == stack.stackSize)
|
||||
&& (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE || stack.getItemDamage() == internal.getItemDamage());
|
||||
&& (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE
|
||||
|| stack.getItemDamage() == internal.getItemDamage()
|
||||
|| (!stack.getHasSubtypes() && !stack.getItem().isDamageable()));
|
||||
}
|
||||
|
||||
@Override
|
||||
+3
-3
@@ -17,10 +17,10 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class TweakerLiquidDefinition implements ILiquidDefinition {
|
||||
public class MCLiquidDefinition implements ILiquidDefinition {
|
||||
private final Fluid fluid;
|
||||
|
||||
public TweakerLiquidDefinition(Fluid fluid) {
|
||||
public MCLiquidDefinition(Fluid fluid) {
|
||||
this.fluid = fluid;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class TweakerLiquidDefinition implements ILiquidDefinition {
|
||||
|
||||
@Override
|
||||
public ILiquidStack asStack(int millibuckets) {
|
||||
return new TweakerLiquidStack(new FluidStack(fluid, millibuckets));
|
||||
return new MCLiquidStack(new FluidStack(fluid, millibuckets));
|
||||
}
|
||||
|
||||
@Override
|
||||
+6
-6
@@ -17,22 +17,22 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class TweakerLiquidStack implements ILiquidStack {
|
||||
public class MCLiquidStack implements ILiquidStack {
|
||||
private final FluidStack stack;
|
||||
private IData tag = null;
|
||||
|
||||
public TweakerLiquidStack(FluidStack stack) {
|
||||
public MCLiquidStack(FluidStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
private TweakerLiquidStack(FluidStack stack, IData tag) {
|
||||
private MCLiquidStack(FluidStack stack, IData tag) {
|
||||
this.stack = stack;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidDefinition getDefinition() {
|
||||
return new TweakerLiquidDefinition(stack.getFluid());
|
||||
return new MCLiquidDefinition(stack.getFluid());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,14 +67,14 @@ public class TweakerLiquidStack implements ILiquidStack {
|
||||
public ILiquidStack withTag(IData data) {
|
||||
FluidStack result = new FluidStack(stack.fluidID, stack.amount);
|
||||
result.tag = (NBTTagCompound) NBTConverter.from(data);
|
||||
return new TweakerLiquidStack(result, data.immutable());
|
||||
return new MCLiquidStack(result, data.immutable());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidStack withAmount(int amount) {
|
||||
FluidStack result = new FluidStack(stack.fluidID, amount);
|
||||
result.tag = stack.tag;
|
||||
return new TweakerLiquidStack(result, tag);
|
||||
return new MCLiquidStack(result, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,44 @@
|
||||
package minetweaker.mc172.mods;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import minetweaker.api.mods.ILoadedMods;
|
||||
import minetweaker.api.mods.IMod;
|
||||
import stanhebben.zenscript.util.MappingIterator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class MCLoadedMods implements ILoadedMods {
|
||||
public MCLoadedMods() {}
|
||||
|
||||
@Override
|
||||
public boolean contains(String name) {
|
||||
return Loader.isModLoaded(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMod get(String name) {
|
||||
for (ModContainer mod : Loader.instance().getActiveModList()) {
|
||||
if (mod.getModId().equals(name)) {
|
||||
return new MCMod(mod);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<IMod> iterator() {
|
||||
List<ModContainer> mods = Loader.instance().getActiveModList();
|
||||
return new MappingIterator<ModContainer, IMod>(mods.iterator()) {
|
||||
@Override
|
||||
public IMod map(ModContainer value) {
|
||||
return new MCMod(value);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.mc172.mods;
|
||||
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import minetweaker.api.mods.IMod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class MCMod implements IMod {
|
||||
private final ModContainer mod;
|
||||
|
||||
public MCMod(ModContainer mod) {
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return mod.getModId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return mod.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return mod.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return mod.getMetadata().description;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -14,9 +14,9 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class OreDict implements IOreDict {
|
||||
public class MCOreDict implements IOreDict {
|
||||
@Override
|
||||
public IOreDictEntry get(String name) {
|
||||
return new OreDictEntry(OreDictionary.getOreID(name));
|
||||
return new MCOreDictEntry(OreDictionary.getOreID(name));
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -10,7 +10,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.mc172.util.MineTweakerHacks;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemCondition;
|
||||
@@ -27,17 +27,17 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class OreDictEntry implements IOreDictEntry {
|
||||
public class MCOreDictEntry implements IOreDictEntry {
|
||||
private static final List<ArrayList<ItemStack>> OREDICT_CONTENTS = MineTweakerHacks.getOreIdStacks();
|
||||
private static final List<ArrayList<ItemStack>> OREDICT_CONTENTS_UN = MineTweakerHacks.getOreIdStacksUn();
|
||||
|
||||
private final Integer id;
|
||||
|
||||
public OreDictEntry(Integer id) {
|
||||
public MCOreDictEntry(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public OreDictEntry(String id) {
|
||||
public MCOreDictEntry(String id) {
|
||||
this.id = OreDictionary.getOreID(id);
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ public class OreDictEntry implements IOreDictEntry {
|
||||
|
||||
@Override
|
||||
public void addAll(IOreDictEntry entry) {
|
||||
if (entry instanceof OreDictEntry) {
|
||||
MineTweakerAPI.tweaker.apply(new ActionAddAll(id, ((OreDictEntry) entry).id));
|
||||
if (entry instanceof MCOreDictEntry) {
|
||||
MineTweakerAPI.tweaker.apply(new ActionAddAll(id, ((MCOreDictEntry) entry).id));
|
||||
} else {
|
||||
MineTweakerAPI.logger.logError("not a valid entry");
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class OreDictEntry implements IOreDictEntry {
|
||||
public void remove(IItemStack item) {
|
||||
ItemStack result = null;
|
||||
for (ItemStack itemStack : OreDictionary.getOres(id)) {
|
||||
if (item.matches(new TweakerItemStack(itemStack))) {
|
||||
if (item.matches(new MCItemStack(itemStack))) {
|
||||
result = itemStack;
|
||||
break;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class OreDictEntry implements IOreDictEntry {
|
||||
@Override
|
||||
public boolean contains(IItemStack item) {
|
||||
for (ItemStack itemStack : OreDictionary.getOres(id)) {
|
||||
if (item.matches(new TweakerItemStack(itemStack))) {
|
||||
if (item.matches(new MCItemStack(itemStack))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -92,8 +92,8 @@ public class OreDictEntry implements IOreDictEntry {
|
||||
|
||||
@Override
|
||||
public void mirror(IOreDictEntry other) {
|
||||
if (other instanceof OreDictEntry) {
|
||||
MineTweakerAPI.tweaker.apply(new ActionMirror(id, ((OreDictEntry) other).id));
|
||||
if (other instanceof MCOreDictEntry) {
|
||||
MineTweakerAPI.tweaker.apply(new ActionMirror(id, ((MCOreDictEntry) other).id));
|
||||
} else {
|
||||
MineTweakerAPI.logger.logError("not a valid oredict entry");
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class OreDictEntry implements IOreDictEntry {
|
||||
public List<IItemStack> getItems() {
|
||||
List<IItemStack> result = new ArrayList<IItemStack>();
|
||||
for (ItemStack item : OreDictionary.getOres(id)) {
|
||||
result.add(new TweakerItemStack(item));
|
||||
result.add(new MCItemStack(item));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
+2
-2
@@ -15,10 +15,10 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class TweakerPlayer implements IPlayer {
|
||||
public class MCPlayer implements IPlayer {
|
||||
private final EntityPlayer player;
|
||||
|
||||
public TweakerPlayer(EntityPlayer player) {
|
||||
public MCPlayer(EntityPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
+11
-11
@@ -7,12 +7,12 @@
|
||||
package minetweaker.mc172.recipes;
|
||||
|
||||
import java.util.List;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.mc172.util.MineTweakerHacks;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.recipes.ICraftingInventory;
|
||||
import minetweaker.mc172.player.TweakerPlayer;
|
||||
import minetweaker.mc172.player.MCPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
@@ -24,16 +24,16 @@ import net.minecraft.item.ItemStack;
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class TweakerCraftingInventory implements ICraftingInventory {
|
||||
private static final ThreadLocal<TweakerCraftingInventory> cache = new ThreadLocal<TweakerCraftingInventory>();
|
||||
public class MCCraftingInventory implements ICraftingInventory {
|
||||
private static final ThreadLocal<MCCraftingInventory> cache = new ThreadLocal<MCCraftingInventory>();
|
||||
|
||||
public static TweakerCraftingInventory get(InventoryCrafting inventory) {
|
||||
public static MCCraftingInventory get(InventoryCrafting inventory) {
|
||||
if (cache.get() == null || cache.get().inventory != inventory) {
|
||||
TweakerCraftingInventory result = new TweakerCraftingInventory(inventory);
|
||||
MCCraftingInventory result = new MCCraftingInventory(inventory);
|
||||
cache.set(result);
|
||||
return result;
|
||||
} else {
|
||||
TweakerCraftingInventory result = cache.get();
|
||||
MCCraftingInventory result = cache.get();
|
||||
result.update();
|
||||
return result;
|
||||
}
|
||||
@@ -45,9 +45,9 @@ public class TweakerCraftingInventory implements ICraftingInventory {
|
||||
private IItemStack[] stacks;
|
||||
private ItemStack[] original;
|
||||
private int stackCount;
|
||||
private TweakerPlayer player;
|
||||
private MCPlayer player;
|
||||
|
||||
private TweakerCraftingInventory(InventoryCrafting inventory) {
|
||||
private MCCraftingInventory(InventoryCrafting inventory) {
|
||||
this.inventory = inventory;
|
||||
width = height = (int) Math.sqrt(inventory.getSizeInventory());
|
||||
stacks = new IItemStack[width * height];
|
||||
@@ -60,7 +60,7 @@ public class TweakerCraftingInventory implements ICraftingInventory {
|
||||
if (!slots.isEmpty() && slots.get(0) instanceof SlotCrafting) {
|
||||
SlotCrafting slotCrafting = (SlotCrafting) slots.get(0);
|
||||
EntityPlayer playerEntity = MineTweakerHacks.getCraftingSlotPlayer(slotCrafting);
|
||||
player = new TweakerPlayer(playerEntity);
|
||||
player = new MCPlayer(playerEntity);
|
||||
} else {
|
||||
player = null;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class TweakerCraftingInventory implements ICraftingInventory {
|
||||
original[i] = inventory.getStackInSlot(i);
|
||||
if (inventory.getStackInSlot(i) != null) {
|
||||
if (stacks[i] == null) stackCount++;
|
||||
stacks[i] = new TweakerItemStack(original[i]);
|
||||
stacks[i] = new MCItemStack(original[i]);
|
||||
} else {
|
||||
if (stacks[i] != null) stackCount--;
|
||||
stacks[i] = null;
|
||||
+10
-10
@@ -6,8 +6,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.mc172.oredict.OreDictEntry;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.mc172.oredict.MCOreDictEntry;
|
||||
import minetweaker.mc172.util.MineTweakerHacks;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
@@ -28,10 +28,10 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class MTRecipeManager implements IRecipeManager {
|
||||
public class MCRecipeManager implements IRecipeManager {
|
||||
private final List<IRecipe> recipes;
|
||||
|
||||
public MTRecipeManager() {
|
||||
public MCRecipeManager() {
|
||||
recipes = (List<IRecipe>) CraftingManager.getInstance().getRecipeList();
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class MTRecipeManager implements IRecipeManager {
|
||||
// certain special recipes have no predefined output. ignore those
|
||||
// since these cannot be removed with MineTweaker scripts
|
||||
if (recipe.getRecipeOutput() != null) {
|
||||
if (output.matches(new TweakerItemStack(recipe.getRecipeOutput()))) {
|
||||
if (output.matches(new MCItemStack(recipe.getRecipeOutput()))) {
|
||||
toRemove.add(recipe);
|
||||
removeIndex.add(i);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class MTRecipeManager implements IRecipeManager {
|
||||
outer: for (int i = 0; i < recipes.size(); i++) {
|
||||
IRecipe recipe = recipes.get(i);
|
||||
|
||||
if (recipe.getRecipeOutput() == null || !output.matches(new TweakerItemStack(recipe.getRecipeOutput()))) {
|
||||
if (recipe.getRecipeOutput() == null || !output.matches(new MCItemStack(recipe.getRecipeOutput()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class MTRecipeManager implements IRecipeManager {
|
||||
outer: for (int i = 0; i < recipes.size(); i++) {
|
||||
IRecipe recipe = recipes.get(i);
|
||||
|
||||
if (recipe.getRecipeOutput() == null || !output.matches(new TweakerItemStack(recipe.getRecipeOutput()))) {
|
||||
if (recipe.getRecipeOutput() == null || !output.matches(new MCItemStack(recipe.getRecipeOutput()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ public class MTRecipeManager implements IRecipeManager {
|
||||
if (result == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new TweakerItemStack(result);
|
||||
return new MCItemStack(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,11 +343,11 @@ public class MTRecipeManager implements IRecipeManager {
|
||||
return false;
|
||||
} else if (ingredient != null) {
|
||||
if (input instanceof ItemStack) {
|
||||
if (!ingredient.matches(new TweakerItemStack((ItemStack) input))) {
|
||||
if (!ingredient.matches(new MCItemStack((ItemStack) input))) {
|
||||
return false;
|
||||
}
|
||||
} else if (input instanceof String) {
|
||||
if (!ingredient.contains(new OreDictEntry((String) input))) {
|
||||
if (!ingredient.contains(new MCOreDictEntry((String) input))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -26,12 +26,12 @@ public class ShapedRecipeAdvanced implements IRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
return recipe.matches(TweakerCraftingInventory.get(inventory));
|
||||
return recipe.matches(MCCraftingInventory.get(inventory));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
return ((ItemStack) recipe.getCraftingResult(TweakerCraftingInventory.get(inventory)).getInternal()).copy();
|
||||
return ((ItemStack) recipe.getCraftingResult(MCCraftingInventory.get(inventory)).getInternal()).copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -28,12 +28,12 @@ public class ShapedRecipeBasic extends ShapedRecipes {
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
return recipe.matches(TweakerCraftingInventory.get(inventory));
|
||||
return recipe.matches(MCCraftingInventory.get(inventory));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
IItemStack result = recipe.getCraftingResult(TweakerCraftingInventory.get(inventory));
|
||||
IItemStack result = recipe.getCraftingResult(MCCraftingInventory.get(inventory));
|
||||
if (result == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
||||
@@ -27,11 +27,11 @@ public class ShapedRecipeOre extends ShapedOreRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
return recipe.matches(TweakerCraftingInventory.get(inventory));
|
||||
return recipe.matches(MCCraftingInventory.get(inventory));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
return ((ItemStack) recipe.getCraftingResult(TweakerCraftingInventory.get(inventory)).getInternal()).copy();
|
||||
return ((ItemStack) recipe.getCraftingResult(MCCraftingInventory.get(inventory)).getInternal()).copy();
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -25,12 +25,12 @@ public class ShapelessRecipeAdvanced implements IRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
return recipe.matches(TweakerCraftingInventory.get(inventory));
|
||||
return recipe.matches(MCCraftingInventory.get(inventory));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
return ((ItemStack) recipe.getCraftingResult(TweakerCraftingInventory.get(inventory)).getInternal()).copy();
|
||||
return ((ItemStack) recipe.getCraftingResult(MCCraftingInventory.get(inventory)).getInternal()).copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -28,11 +28,11 @@ public class ShapelessRecipeBasic extends ShapelessRecipes {
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
return recipe.matches(TweakerCraftingInventory.get(inventory));
|
||||
return recipe.matches(MCCraftingInventory.get(inventory));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
return ((ItemStack) recipe.getCraftingResult(TweakerCraftingInventory.get(inventory)).getInternal()).copy();
|
||||
return ((ItemStack) recipe.getCraftingResult(MCCraftingInventory.get(inventory)).getInternal()).copy();
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -27,11 +27,11 @@ public class ShapelessRecipeOre extends ShapelessOreRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
return recipe.matches(TweakerCraftingInventory.get(inventory));
|
||||
return recipe.matches(MCCraftingInventory.get(inventory));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
return ((ItemStack) recipe.getCraftingResult(TweakerCraftingInventory.get(inventory)).getInternal()).copy();
|
||||
return ((ItemStack) recipe.getCraftingResult(MCCraftingInventory.get(inventory)).getInternal()).copy();
|
||||
}
|
||||
}
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.mc172.transformer;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stanneke
|
||||
*/
|
||||
public class MineTweakerASM implements IClassTransformer {
|
||||
public MineTweakerASM() {}
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String newName, byte[] bytecode) {
|
||||
ClassVisitor visitor = new AnnotationDetector();
|
||||
ClassReader reader = new ClassReader(bytecode);
|
||||
reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
|
||||
return bytecode;
|
||||
}
|
||||
|
||||
private class AnnotationDetector extends ClassVisitor {
|
||||
public AnnotationDetector() {
|
||||
super(Opcodes.ASM4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
|
||||
System.out.println("Annotation: " + desc);
|
||||
|
||||
return super.visitAnnotation(desc, visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.mc172.transformer;
|
||||
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
|
||||
import java.util.Map;
|
||||
import minetweaker.mc172.MineTweakerMod;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stanneke
|
||||
*/
|
||||
//@MCVersion(MineTweakerMod.MCVERSION)
|
||||
//@IFMLLoadingPlugin.TransformerExclusions("minetweaker.mc172.transformer")
|
||||
public class MineTweakerTransformer implements IFMLLoadingPlugin {
|
||||
|
||||
@Override
|
||||
public String[] getASMTransformerClass() {
|
||||
System.out.println("MineTweakerASM transformer class loading");
|
||||
return new String[] { MineTweakerASM.class.getName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModContainerClass() {
|
||||
//return MineTweaker.class.getName();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSetupClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectData(Map<String, Object> data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccessTransformerClass() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ package minetweaker.mc172.util;
|
||||
|
||||
import java.util.List;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ public class MineTweakerUtil {
|
||||
public static IItemStack[] getIItemStacks(ItemStack... items) {
|
||||
IItemStack[] result = new IItemStack[items.length];
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
result[i] = new TweakerItemStack(items[i]);
|
||||
result[i] = new MCItemStack(items[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class MineTweakerUtil {
|
||||
public static IItemStack[] getIItemStacks(List<ItemStack> items) {
|
||||
IItemStack[] result = new IItemStack[items.size()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = new TweakerItemStack(items.get(i));
|
||||
result[i] = new MCItemStack(items.get(i));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"modid": "MineTweaker3",
|
||||
"name": "MineTweaker 3",
|
||||
"version": "1.7.2-3.0.0",
|
||||
"mcversion": "1.7.2",
|
||||
"description": "Customize your minecraft experience!",
|
||||
"url": "http://minetweaker3.powerofbytes.com/wiki/",
|
||||
"credits": "Stan Hebben",
|
||||
"authors": [ "Stan Hebben" ],
|
||||
}
|
||||
]
|
||||
@@ -1,3 +1,5 @@
|
||||
import minetweaker.tasks.RegisterZenClassesTask;
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -26,3 +28,11 @@ dependencies {
|
||||
compile project(':MineTweaker3-MC17-Main')
|
||||
compile files('libs/industrialcraft-2-2.1.476-experimental-api.jar')
|
||||
}
|
||||
|
||||
task makeRegistry(type: RegisterZenClassesTask) {
|
||||
inputDir = file('build/classes/main')
|
||||
outputDir = file('build/classes/main')
|
||||
className = 'minetweaker.mods.ic2.ClassRegistry'
|
||||
}
|
||||
|
||||
tasks.jar.dependsOn(makeRegistry)
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.mods.ic2;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.mods.ic2.expand.ItemExpansion;
|
||||
import minetweaker.mods.ic2.machines.Compressor;
|
||||
import minetweaker.mods.ic2.machines.Extractor;
|
||||
import minetweaker.mods.ic2.machines.Macerator;
|
||||
import minetweaker.mods.ic2.machines.MetalFormer;
|
||||
import minetweaker.mods.ic2.machines.OreWasher;
|
||||
import minetweaker.mods.ic2.machines.ThermalCentrifuge;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class ClassRegistry {
|
||||
public static void register() {
|
||||
if (Loader.isModLoaded("IC2")) {
|
||||
MineTweakerAPI.logger.logInfo("Loading IC2 support");
|
||||
|
||||
MineTweakerAPI.registerClass(Compressor.class);
|
||||
MineTweakerAPI.registerClass(Extractor.class);
|
||||
MineTweakerAPI.registerClass(Macerator.class);
|
||||
MineTweakerAPI.registerClass(MetalFormer.class);
|
||||
MineTweakerAPI.registerClass(OreWasher.class);
|
||||
MineTweakerAPI.registerClass(ThermalCentrifuge.class);
|
||||
|
||||
MineTweakerAPI.registerClass(ItemExpansion.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,8 @@ import java.util.List;
|
||||
import minetweaker.IBracketHandler;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.annotations.BracketHandler;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -26,11 +27,12 @@ import stanhebben.zenscript.util.ZenPosition;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@BracketHandler
|
||||
@ModOnly("IC2")
|
||||
public class IC2BracketHandler implements IBracketHandler {
|
||||
public static IItemStack getItem(String name, int meta) {
|
||||
ItemStack stack = IC2Items.getItem(name);
|
||||
stack.setItemDamage(meta);
|
||||
return new TweakerItemStack(stack);
|
||||
return new MCItemStack(stack);
|
||||
}
|
||||
|
||||
private final JavaMethod method;
|
||||
|
||||
+2
@@ -3,6 +3,7 @@ package minetweaker.mods.ic2;
|
||||
import ic2.api.tile.ExplosionWhitelist;
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -21,6 +22,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.ic2.ExplosionWhitelist")
|
||||
@ModOnly("IC2")
|
||||
public class IC2ExplosionWhitelist {
|
||||
/**
|
||||
* Adds a block to the explosion whitelist.
|
||||
|
||||
@@ -9,7 +9,7 @@ package minetweaker.mods.ic2;
|
||||
import ic2.api.recipe.IRecipeInput;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -28,7 +28,7 @@ public class IC2RecipeInput implements IRecipeInput {
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack subject) {
|
||||
return ingredient.matches(new TweakerItemStack(subject));
|
||||
return ingredient.matches(new MCItemStack(subject));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
-1
@@ -7,6 +7,7 @@
|
||||
package minetweaker.mods.ic2;
|
||||
|
||||
import ic2.api.recipe.IMachineRecipeManager;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.OneWayAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -32,7 +33,11 @@ public class MachineAddRecipeAction extends OneWayAction {
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
machine.addRecipe(input, tag, output);
|
||||
try {
|
||||
machine.addRecipe(input, tag, output);
|
||||
} catch (RuntimeException ex) {
|
||||
MineTweakerAPI.logger.logError(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-5
@@ -2,7 +2,8 @@ package minetweaker.mods.ic2.expand;
|
||||
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -16,6 +17,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenExpansion("minecraft.item.IItemStack")
|
||||
@ModOnly("IC2")
|
||||
public class ItemExpansion {
|
||||
/**
|
||||
* Gets the charge level of this item.
|
||||
@@ -94,7 +96,7 @@ public class ItemExpansion {
|
||||
Item item = eItem.getChargedItem(iStack);
|
||||
ItemStack stack2 = new ItemStack(item, 1, 0);
|
||||
ElectricItem.manager.charge(stack2, eItem.getMaxCharge(stack2), eItem.getTier(stack2), true, false);
|
||||
return new TweakerItemStack(stack2);
|
||||
return new MCItemStack(stack2);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -117,7 +119,7 @@ public class ItemExpansion {
|
||||
if (iStack.getItem() instanceof IElectricItem) {
|
||||
IElectricItem eItem = (IElectricItem) iStack.getItem();
|
||||
Item item = eItem.getEmptyItem(iStack);
|
||||
return new TweakerItemStack(new ItemStack(item, 1, 0));
|
||||
return new MCItemStack(new ItemStack(item, 1, 0));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -144,7 +146,7 @@ public class ItemExpansion {
|
||||
|
||||
ItemStack iStack = ((ItemStack) internal).copy();
|
||||
ElectricItem.manager.charge(iStack, amount, tier, true, false);
|
||||
return new TweakerItemStack(iStack);
|
||||
return new MCItemStack(iStack);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,6 +170,6 @@ public class ItemExpansion {
|
||||
|
||||
ItemStack iStack = ((ItemStack) internal).copy();
|
||||
ElectricItem.manager.discharge(iStack, amount, tier, true, false);
|
||||
return new TweakerItemStack(iStack);
|
||||
return new MCItemStack(iStack);
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -3,7 +3,8 @@ package minetweaker.mods.ic2.machines;
|
||||
import ic2.api.recipe.RecipeOutput;
|
||||
import ic2.api.recipe.Recipes;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.mc172.util.MineTweakerUtil;
|
||||
@@ -21,6 +22,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.ic2.Compressor")
|
||||
@ModOnly("IC2")
|
||||
public class Compressor {
|
||||
/**
|
||||
* Adds a new recipe to the compressor.
|
||||
@@ -62,6 +64,6 @@ public class Compressor {
|
||||
System.out.println("No output");
|
||||
return null;
|
||||
}
|
||||
return new TweakerItemStack(output.items.get(0));
|
||||
return new MCItemStack(output.items.get(0));
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -9,7 +9,8 @@ package minetweaker.mods.ic2.machines;
|
||||
import ic2.api.recipe.RecipeOutput;
|
||||
import ic2.api.recipe.Recipes;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.mc172.util.MineTweakerUtil;
|
||||
@@ -26,6 +27,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.ic2.Extractor")
|
||||
@ModOnly("IC2")
|
||||
public class Extractor {
|
||||
/**
|
||||
* Adds a new recipe to the extractor.
|
||||
@@ -64,6 +66,6 @@ public class Extractor {
|
||||
@NotNull IItemStack input) {
|
||||
RecipeOutput output = Recipes.extractor.getOutputFor((ItemStack) input.getInternal(), false);
|
||||
if (output == null || output.items.size() > 0) return null;
|
||||
return new TweakerItemStack(output.items.get(0));
|
||||
return new MCItemStack(output.items.get(0));
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -3,7 +3,8 @@ package minetweaker.mods.ic2.machines;
|
||||
import ic2.api.recipe.RecipeOutput;
|
||||
import ic2.api.recipe.Recipes;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.mc172.util.MineTweakerUtil;
|
||||
@@ -21,6 +22,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.ic2.Macerator")
|
||||
@ModOnly("IC2")
|
||||
public class Macerator {
|
||||
/**
|
||||
* Adds a new recipe to the macerator.
|
||||
@@ -59,6 +61,6 @@ public class Macerator {
|
||||
@NotNull IItemStack input) {
|
||||
RecipeOutput output = Recipes.macerator.getOutputFor((ItemStack) input.getInternal(), false);
|
||||
if (output == null || output.items.size() > 0) return null;
|
||||
return new TweakerItemStack(output.items.get(0));
|
||||
return new MCItemStack(output.items.get(0));
|
||||
}
|
||||
}
|
||||
+6
-4
@@ -9,9 +9,10 @@ package minetweaker.mods.ic2.machines;
|
||||
import ic2.api.recipe.RecipeOutput;
|
||||
import ic2.api.recipe.Recipes;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.mc172.item.TweakerItemStack;
|
||||
import minetweaker.mc172.item.MCItemStack;
|
||||
import minetweaker.mc172.util.MineTweakerUtil;
|
||||
import minetweaker.mods.ic2.IC2RecipeInput;
|
||||
import minetweaker.mods.ic2.MachineAddRecipeAction;
|
||||
@@ -24,6 +25,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.ic2.MetalFormer")
|
||||
@ModOnly("IC2")
|
||||
public class MetalFormer {
|
||||
/**
|
||||
* Adds an extruding recipe to the metal former.
|
||||
@@ -51,7 +53,7 @@ public class MetalFormer {
|
||||
public static IItemStack getExtrudingOutput(IItemStack input) {
|
||||
RecipeOutput output = Recipes.metalformerExtruding.getOutputFor((ItemStack) input.getInternal(), false);
|
||||
if (output == null || output.items.size() > 0) return null;
|
||||
return new TweakerItemStack(output.items.get(0));
|
||||
return new MCItemStack(output.items.get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +82,7 @@ public class MetalFormer {
|
||||
public static IItemStack getRollingOutput(IItemStack input) {
|
||||
RecipeOutput output = Recipes.metalformerRolling.getOutputFor((ItemStack) input.getInternal(), false);
|
||||
if (output == null || output.items.size() > 0) return null;
|
||||
return new TweakerItemStack(output.items.get(0));
|
||||
return new MCItemStack(output.items.get(0));
|
||||
}
|
||||
/**
|
||||
* Adds a extruding recipe to the metal former.
|
||||
@@ -108,6 +110,6 @@ public class MetalFormer {
|
||||
public static IItemStack getCuttingOutput(IItemStack input) {
|
||||
RecipeOutput output = Recipes.metalformerCutting.getOutputFor((ItemStack) input.getInternal(), false);
|
||||
if (output == null || output.items.size() > 0) return null;
|
||||
return new TweakerItemStack(output.items.get(0));
|
||||
return new MCItemStack(output.items.get(0));
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -3,6 +3,7 @@ package minetweaker.mods.ic2.machines;
|
||||
import ic2.api.recipe.RecipeOutput;
|
||||
import ic2.api.recipe.Recipes;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.mc172.util.MineTweakerUtil;
|
||||
@@ -18,6 +19,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.ic2.OreWasher")
|
||||
@ModOnly("IC2")
|
||||
public class OreWasher {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack[] output, IIngredient input, int millibuckets) {
|
||||
@@ -35,6 +37,6 @@ public class OreWasher {
|
||||
public static IItemStack[] getOutput(IItemStack input) {
|
||||
RecipeOutput output = Recipes.oreWashing.getOutputFor((ItemStack) input.getInternal(), false);
|
||||
if (output == null || output.items.isEmpty()) return null;
|
||||
return MineTweakerUtil.getItemStacks(output.items);
|
||||
return MineTweakerUtil.getIItemStacks(output.items);
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -3,6 +3,7 @@ package minetweaker.mods.ic2.machines;
|
||||
import ic2.api.recipe.RecipeOutput;
|
||||
import ic2.api.recipe.Recipes;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.mc172.util.MineTweakerUtil;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
@@ -20,6 +21,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.ic2.ThermalCentrifuge")
|
||||
@ModOnly("IC2")
|
||||
public class ThermalCentrifuge {
|
||||
/**
|
||||
* Adds a new recipe to the centrifuge.
|
||||
@@ -73,6 +75,6 @@ public class ThermalCentrifuge {
|
||||
public static IItemStack[] getOutput(IItemStack input) {
|
||||
RecipeOutput output = Recipes.centrifuge.getOutputFor((ItemStack) input.getInternal(), false);
|
||||
if (output == null || output.items.isEmpty()) return null;
|
||||
return MineTweakerUtil.getItemStacks(output.items);
|
||||
return MineTweakerUtil.getIItemStacks(output.items);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import minetweaker.tasks.RegisterZenClassesTask;
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -26,3 +28,11 @@ dependencies {
|
||||
compile project(':MineTweaker3-MC17-Main')
|
||||
compile files('libs/NotEnoughItems-1.7.2-1.0.1-dev.jar')
|
||||
}
|
||||
|
||||
task makeRegistry(type: RegisterZenClassesTask) {
|
||||
inputDir = file('build/classes/main')
|
||||
outputDir = file('build/classes/main')
|
||||
className = 'minetweaker.mods.nei.ClassRegistry'
|
||||
}
|
||||
|
||||
tasks.jar.dependsOn(makeRegistry)
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.mods.nei;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class ClassRegistry {
|
||||
public static void register() {
|
||||
if (Loader.isModLoaded("NotEnoughItems")) {
|
||||
MineTweakerAPI.logger.logInfo("Loading NEI support");
|
||||
|
||||
MineTweakerAPI.registerClass(NEI.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.OneWayAction;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
@@ -21,6 +22,7 @@ import minetweaker.api.item.IItemStack;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.nei.NEI")
|
||||
@ModOnly("NotEnoughItems")
|
||||
public class NEI {
|
||||
/**
|
||||
* Hides a specific item in NEI. Will take into account metadata values, if
|
||||
|
||||
@@ -33,6 +33,7 @@ import stanhebben.zenscript.util.ZenPosition;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
public class TypeExpansion {
|
||||
private final String type;
|
||||
private final Map<String, ZenExpandMember> members;
|
||||
private final Map<String, ZenExpandMember> staticMembers;
|
||||
private final List<ZenExpandCaster> casters;
|
||||
@@ -43,8 +44,12 @@ public class TypeExpansion {
|
||||
/**
|
||||
* Creates an empty type expansion. Use the expand method to register the
|
||||
* actual expansions.
|
||||
*
|
||||
* @param type type name
|
||||
*/
|
||||
public TypeExpansion() {
|
||||
public TypeExpansion(String type) {
|
||||
this.type = type;
|
||||
|
||||
members = new HashMap<String, ZenExpandMember>();
|
||||
staticMembers = new HashMap<String, ZenExpandMember>();
|
||||
casters = new ArrayList<ZenExpandCaster>();
|
||||
@@ -76,7 +81,7 @@ public class TypeExpansion {
|
||||
String name = getterAnnotation.value().length() == 0 ? method.getName() : getterAnnotation.value();
|
||||
|
||||
if (!members.containsKey(name)) {
|
||||
members.put(name, new ZenExpandMember());
|
||||
members.put(name, new ZenExpandMember(type, name));
|
||||
}
|
||||
members.get(name).setGetter(new JavaMethod(cls, method, types));
|
||||
} else if (annotation instanceof ZenSetter) {
|
||||
@@ -85,7 +90,7 @@ public class TypeExpansion {
|
||||
String name = setterAnnotation.value().length() == 0 ? method.getName() : setterAnnotation.value();
|
||||
|
||||
if (!members.containsKey(name)) {
|
||||
members.put(name, new ZenExpandMember());
|
||||
members.put(name, new ZenExpandMember(type, name));
|
||||
}
|
||||
members.get(name).setSetter(new JavaMethod(cls, method, types));
|
||||
} else if (annotation instanceof ZenOperator) {
|
||||
@@ -140,7 +145,7 @@ public class TypeExpansion {
|
||||
methodName = methodAnnotation.value();
|
||||
}
|
||||
if (!members.containsKey(methodName)) {
|
||||
members.put(methodName, new ZenExpandMember());
|
||||
members.put(methodName, new ZenExpandMember(type, methodName));
|
||||
}
|
||||
members.get(methodName).addMethod(new JavaMethod(cls, method, types));
|
||||
} else if (annotation instanceof ZenMethodStatic) {
|
||||
@@ -150,7 +155,7 @@ public class TypeExpansion {
|
||||
methodName = methodAnnotation.value();
|
||||
}
|
||||
if (!staticMembers.containsKey(methodName)) {
|
||||
staticMembers.put(methodName, new ZenExpandMember());
|
||||
staticMembers.put(methodName, new ZenExpandMember(type, methodName));
|
||||
}
|
||||
staticMembers.get(methodName).addMethod(new JavaMethod(cls, method, types));
|
||||
}
|
||||
|
||||
@@ -93,8 +93,8 @@ public class ZenTokener extends TokenStream {
|
||||
public static final int T_IMPORT = 160;
|
||||
|
||||
private static final String[] REGEXPS = {
|
||||
"#[^\n]*\n",
|
||||
"//[^\n]*\n",
|
||||
"#[^\n]*[\n\\e]",
|
||||
"//[^\n]*[\n\\e]",
|
||||
"/\\*[^\\*]*(\\*^/[^\\*]*)*\\*/",
|
||||
"[ \t\r\n]*",
|
||||
"[a-zA-Z_][a-zA-Z_0-9]*",
|
||||
|
||||
Loaded 100 of 106 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user