- Ported chest loot modification from ModTweaker

- Ported setLocalization from ModTweaker
- Ported seed modification from ModTweaker
- Fixed IClient setting
- Added dev builds to the build script
This commit is contained in:
Stan Hebben committed 2014-08-31 18:40:06 +02:00
1 parent 2e34ac5c14
commit aa2da58446
38 files changed
+2226 -50

No files matched your search

@@ -18,4 +18,7 @@ public interface IClient {
*/
@ZenGetter("player")
public IPlayer getPlayer();
@ZenGetter("language")
public String getLanguage();
}
@@ -8,6 +8,7 @@ import minetweaker.api.liquid.ILiquidDefinition;
import minetweaker.api.world.IBiome;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenMethod;
/**
* Game interface. Used to obtain general game information.
@@ -55,4 +56,42 @@ public interface IGame {
*/
@ZenGetter("entities")
public List<IEntityDefinition> getEntities();
/**
* Sets a localization value.
*
* @param key localization key
* @param value localization value
*/
@ZenMethod
public void setLocalization(String key, String value);
/**
* Sets a localization value.
*
* @param lang language
* @param key localization key
* @param value localization value
*/
@ZenMethod
public void setLocalization(String lang, String key, String value);
/**
* Gets a localized string.
*
* @param key localization key
* @return localized value
*/
@ZenMethod
public String localize(String key);
/**
* Gets a localized string.
*
* @param key localization key
* @param lang language
* @return localized value
*/
@ZenMethod
public String localize(String key, String lang);
}
@@ -0,0 +1,36 @@
/*
* 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.vanilla;
import java.util.List;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.WeightedItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenMethod;
/**
*
* @author Stan
*/
@ZenClass("vanilla.ILootRegistry")
public interface ILootRegistry {
@ZenMethod
public void addChestLoot(String name, WeightedItemStack item);
@ZenMethod
public void addChestLoot(String name, WeightedItemStack item, int min, int max);
@ZenMethod
public void removeChestLoot(String name, IIngredient ingredient);
@ZenMethod
public List<LootEntry> getLoot(String name);
@ZenGetter("lootTypes")
public List<String> getLootTypes();
}
@@ -0,0 +1,30 @@
/*
* 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.vanilla;
import java.util.List;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.WeightedItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenMethod;
/**
*
* @author Stan
*/
@ZenClass("vanilla.ISeedRegistry")
public interface ISeedRegistry {
@ZenMethod
public void addSeed(WeightedItemStack item);
@ZenMethod
public void removeSeed(IIngredient item);
@ZenGetter("seeds")
public List<WeightedItemStack> getSeeds();
}
@@ -0,0 +1,23 @@
/*
* 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.vanilla;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
/**
*
* @author Stan
*/
@ZenClass("vanilla.IVanilla")
public interface IVanilla {
@ZenGetter("loot")
public ILootRegistry getLoot();
@ZenGetter("seeds")
public ISeedRegistry getSeeds();
}
@@ -0,0 +1,60 @@
/*
* 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.vanilla;
import minetweaker.api.item.WeightedItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
/**
*
* @author Stan
*/
@ZenClass("vanilla.LootEntry")
public class LootEntry {
private final WeightedItemStack item;
private final int minAmount;
private final int maxAmount;
public LootEntry(WeightedItemStack item, int minAmount, int maxAmount) {
this.item = item;
this.minAmount = minAmount;
this.maxAmount = maxAmount;
}
@ZenGetter("item")
public WeightedItemStack getItem() {
return item;
}
@ZenGetter("minAmount")
public int getMinAmount() {
return minAmount;
}
@ZenGetter("maxAmount")
public int getMaxAmount() {
return maxAmount;
}
@Override
public String toString() {
StringBuilder message = new StringBuilder();
message.append(getItem().getStack());
message.append(" (weight ");
message.append((int) getItem().getChance());
if (getMinAmount() != 0 || getMaxAmount() != 1) {
message.append(", ");
message.append(getMinAmount());
message.append("-");
message.append(getMaxAmount());
}
message.append(")");
return message.toString();
}
}