- Fixed multiple saplings with the same ID not working in the Planter

- Fixed crash when using /mt hand on a dedicated server
- Fixed crash in /mt recipes in some cases
This commit is contained in:
Stan Hebben committed 2014-10-16 23:03:53 +02:00
1 parent 59ef38877f
commit 7d886a3ce3
37 files changed
+500 -99

No files matched your search

@@ -77,22 +77,22 @@ public class DataBool implements IData {
@Override
public IData getAt(int i) {
throw new RuntimeException("a bool is not indexable");
throw new UnsupportedOperationException("a bool is not indexable");
}
@Override
public void setAt(int i, IData value) {
throw new RuntimeException("a bool is not indexable");
throw new UnsupportedOperationException("a bool is not indexable");
}
@Override
public IData memberGet(String name) {
throw new RuntimeException("a bool is not indexable");
throw new UnsupportedOperationException("a bool is not indexable");
}
@Override
public void memberSet(String name, IData data) {
throw new RuntimeException("a bool is not indexable");
throw new UnsupportedOperationException("a bool is not indexable");
}
@Override
@@ -17,7 +17,7 @@ public class DataByte implements IData {
@Override
public boolean asBool() {
throw new RuntimeException("Cannot cast a byte to a bool");
throw new IllegalDataException("Cannot cast a byte to a bool");
}
@Override
@@ -77,22 +77,22 @@ public class DataByte implements IData {
@Override
public IData getAt(int i) {
throw new RuntimeException("A byte is not indexable");
throw new UnsupportedOperationException("A byte is not indexable");
}
@Override
public void setAt(int i, IData value) {
throw new RuntimeException("A byte is not indexable");
throw new UnsupportedOperationException("A byte is not indexable");
}
@Override
public IData memberGet(String name) {
throw new RuntimeException("A byte is not indexable");
throw new UnsupportedOperationException("A byte is not indexable");
}
@Override
public void memberSet(String name, IData data) {
throw new RuntimeException("A byte is not indexable");
throw new UnsupportedOperationException("A byte is not indexable");
}
@Override
@@ -74,51 +74,53 @@ public class DataByteArray implements IData {
@Override
public boolean asBool() {
throw new UnsupportedOperationException("Cannot cast an array to bool");
throw new IllegalDataException("Cannot cast an array to bool");
}
@Override
public byte asByte() {
throw new UnsupportedOperationException("Cannot cast an array to byte");
throw new IllegalDataException("Cannot cast an array to byte");
}
@Override
public short asShort() {
throw new UnsupportedOperationException("Cannot cast an array to short");
throw new IllegalDataException("Cannot cast an array to short");
}
@Override
public int asInt() {
throw new UnsupportedOperationException("Cannot cast an array to int");
throw new IllegalDataException("Cannot cast an array to int");
}
@Override
public long asLong() {
throw new UnsupportedOperationException("Cannot cast an array to long");
throw new IllegalDataException("Cannot cast an array to long");
}
@Override
public float asFloat() {
throw new UnsupportedOperationException("Cannot cast an array to float");
throw new IllegalDataException("Cannot cast an array to float");
}
@Override
public double asDouble() {
throw new UnsupportedOperationException("Cannot cast an array to double");
throw new IllegalDataException("Cannot cast an array to double");
}
@Override
public String asString() {
StringBuilder result = new StringBuilder();
result.append("X\"");
result.append("[");
boolean first = true;
for (byte value : data) {
String str = Integer.toHexString(value);
if (str.length() == 1) {
result.append('0');
}
result.append(str);
if (first)
first = false;
else
result.append(", ");
result.append(value);
}
result.append('"');
result.append("] as byte[]");
return result.toString();
}
@@ -17,7 +17,7 @@ public class DataDouble implements IData {
@Override
public boolean asBool() {
throw new RuntimeException("Cannot cast a double to a bool");
throw new IllegalDataException("Cannot cast a double to a bool");
}
@Override
@@ -77,22 +77,22 @@ public class DataDouble implements IData {
@Override
public IData getAt(int i) {
throw new RuntimeException("A double is not indexable");
throw new UnsupportedOperationException("A double is not indexable");
}
@Override
public void setAt(int i, IData value) {
throw new RuntimeException("A double is not indexable");
throw new UnsupportedOperationException("A double is not indexable");
}
@Override
public IData memberGet(String name) {
throw new RuntimeException("A double is not indexable");
throw new UnsupportedOperationException("A double is not indexable");
}
@Override
public void memberSet(String name, IData data) {
throw new RuntimeException("A double is not indexable");
throw new UnsupportedOperationException("A double is not indexable");
}
@Override
@@ -17,7 +17,7 @@ public class DataFloat implements IData {
@Override
public boolean asBool() {
throw new RuntimeException("Cannot cast a float to a bool");
throw new IllegalDataException("Cannot cast a float to a bool");
}
@Override
@@ -77,22 +77,22 @@ public class DataFloat implements IData {
@Override
public IData getAt(int i) {
throw new RuntimeException("A float is not indexable");
throw new UnsupportedOperationException("A float is not indexable");
}
@Override
public void setAt(int i, IData value) {
throw new RuntimeException("A float is not indexable");
throw new UnsupportedOperationException("A float is not indexable");
}
@Override
public IData memberGet(String name) {
throw new RuntimeException("A float is not indexable");
throw new UnsupportedOperationException("A float is not indexable");
}
@Override
public void memberSet(String name, IData data) {
throw new RuntimeException("A float is not indexable");
throw new UnsupportedOperationException("A float is not indexable");
}
@Override
@@ -74,37 +74,37 @@ public class DataIntArray implements IData {
@Override
public boolean asBool() {
throw new UnsupportedOperationException("Cannot cast an array to bool");
throw new IllegalDataException("Cannot cast an array to bool");
}
@Override
public byte asByte() {
throw new UnsupportedOperationException("Cannot cast an array to byte");
throw new IllegalDataException("Cannot cast an array to byte");
}
@Override
public short asShort() {
throw new UnsupportedOperationException("Cannot cast an array to short");
throw new IllegalDataException("Cannot cast an array to short");
}
@Override
public int asInt() {
throw new UnsupportedOperationException("Cannot cast an array to int");
throw new IllegalDataException("Cannot cast an array to int");
}
@Override
public long asLong() {
throw new UnsupportedOperationException("Cannot cast an array to long");
throw new IllegalDataException("Cannot cast an array to long");
}
@Override
public float asFloat() {
throw new UnsupportedOperationException("Cannot cast an array to float");
throw new IllegalDataException("Cannot cast an array to float");
}
@Override
public double asDouble() {
throw new UnsupportedOperationException("Cannot cast an array to double");
throw new IllegalDataException("Cannot cast an array to double");
}
@Override
@@ -21,37 +21,37 @@ public class DataList implements IData {
@Override
public boolean asBool() {
throw new RuntimeException("Cannot convert a list to a bool");
throw new IllegalDataException("Cannot convert a list to a bool");
}
@Override
public byte asByte() {
throw new RuntimeException("Cannot convert a list to a byte");
throw new IllegalDataException("Cannot convert a list to a byte");
}
@Override
public short asShort() {
throw new RuntimeException("Cannot convert a list to a short");
throw new IllegalDataException("Cannot convert a list to a short");
}
@Override
public int asInt() {
throw new RuntimeException("Cannot convert a list to an int");
throw new IllegalDataException("Cannot convert a list to an int");
}
@Override
public long asLong() {
throw new RuntimeException("Cannot convert a list to a long");
throw new IllegalDataException("Cannot convert a list to a long");
}
@Override
public float asFloat() {
throw new RuntimeException("Cannot convert a list to a float");
throw new IllegalDataException("Cannot convert a list to a float");
}
@Override
public double asDouble() {
throw new RuntimeException("Cannot convert a list to a double");
throw new IllegalDataException("Cannot convert a list to a double");
}
@Override
@@ -119,7 +119,7 @@ public class DataList implements IData {
@Override
public void setAt(int i, IData value) {
if (immutable) {
throw new RuntimeException("this list is immutable");
throw new UnsupportedOperationException("this list is immutable");
} else {
values.set(i, value);
}
@@ -127,12 +127,12 @@ public class DataList implements IData {
@Override
public IData memberGet(String name) {
throw new RuntimeException("Lists don't have members");
throw new UnsupportedOperationException("Lists don't have members");
}
@Override
public void memberSet(String name, IData data) {
throw new RuntimeException("Lists don't have members");
throw new UnsupportedOperationException("Lists don't have members");
}
@Override
@@ -17,7 +17,7 @@ public class DataLong implements IData {
@Override
public boolean asBool() {
throw new RuntimeException("Cannot cast a long to a bool");
throw new IllegalDataException("Cannot cast a long to a bool");
}
@Override
@@ -57,42 +57,42 @@ public class DataLong implements IData {
@Override
public List<IData> asList() {
throw new UnsupportedOperationException("Cannot cast a long to a list");
return null;
}
@Override
public Map<String, IData> asMap() {
throw new UnsupportedOperationException("Cannot cast a long to a map");
return null;
}
@Override
public byte[] asByteArray() {
throw new RuntimeException("Cannot cast a long to a byte array");
return null;
}
@Override
public int[] asIntArray() {
throw new RuntimeException("Cannot cast a long to an int array");
return null;
}
@Override
public IData getAt(int i) {
throw new RuntimeException("A long is not indexable");
throw new UnsupportedOperationException("A long is not indexable");
}
@Override
public void setAt(int i, IData value) {
throw new RuntimeException("A long is not indexable");
throw new UnsupportedOperationException("A long is not indexable");
}
@Override
public IData memberGet(String name) {
throw new RuntimeException("A long is not indexable");
throw new UnsupportedOperationException("A long is not indexable");
}
@Override
public void memberSet(String name, IData data) {
throw new RuntimeException("A long is not indexable");
throw new UnsupportedOperationException("A long is not indexable");
}
@Override
@@ -17,7 +17,7 @@ public class DataShort implements IData {
@Override
public boolean asBool() {
throw new RuntimeException("Cannot cast a short to a bool");
throw new IllegalDataException("Cannot cast a short to a bool");
}
@Override
@@ -77,22 +77,22 @@ public class DataShort implements IData {
@Override
public IData getAt(int i) {
throw new RuntimeException("A short is not indexable");
throw new UnsupportedOperationException("A short is not indexable");
}
@Override
public void setAt(int i, IData value) {
throw new RuntimeException("A short is not indexable");
throw new UnsupportedOperationException("A short is not indexable");
}
@Override
public IData memberGet(String name) {
throw new RuntimeException("A short is not indexable");
throw new UnsupportedOperationException("A short is not indexable");
}
@Override
public void memberSet(String name, IData data) {
throw new RuntimeException("A short is not indexable");
throw new UnsupportedOperationException("A short is not indexable");
}
@Override
@@ -82,7 +82,7 @@ public class DataString implements IData {
@Override
public void setAt(int i, IData value) {
throw new RuntimeException("Strings are immutable");
throw new UnsupportedOperationException("Strings are immutable");
}
@Override
@@ -90,13 +90,13 @@ public class DataString implements IData {
if (name.equals("length")) {
return new DataInt(value.length());
} else {
throw new RuntimeException("no such member: " + name);
throw new UnsupportedOperationException("no such member: " + name);
}
}
@Override
public void memberSet(String name, IData data) {
throw new RuntimeException("Strings are immutable");
throw new UnsupportedOperationException("Strings are immutable");
}
@Override
@@ -0,0 +1,105 @@
/*
* 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.item;
import java.util.Collections;
import java.util.List;
import minetweaker.api.player.IPlayer;
/**
*
* @author Stan
*/
public class IngredientUnknown implements IIngredient
{
public static final IngredientUnknown INSTANCE = new IngredientUnknown(1);
private final int size;
public IngredientUnknown(int size)
{
this.size = size;
}
@Override
public String getMark()
{
return null;
}
@Override
public int getAmount()
{
return size;
}
@Override
public List<IItemStack> getItems()
{
return Collections.emptyList();
}
@Override
public IIngredient amount(int amount)
{
return new IngredientUnknown(amount);
}
@Override
public IIngredient or(IIngredient ingredient)
{
return ingredient;
}
@Override
public IIngredient transform(IItemTransformer transformer)
{
return this;
}
@Override
public IIngredient only(IItemCondition condition)
{
return this;
}
@Override
public IIngredient marked(String mark)
{
return this;
}
@Override
public boolean matches(IItemStack item)
{
return false;
}
@Override
public boolean contains(IIngredient ingredient)
{
return false;
}
@Override
public IItemStack applyTransform(IItemStack item, IPlayer byPlayer)
{
return item;
}
@Override
public boolean hasTransformers()
{
return false;
}
@Override
public Object getInternal()
{
return null;
}
}
@@ -63,4 +63,7 @@ public interface IPlayer {
// not an exposed method. risks abuse
public void openBrowser(String url);
// not an exposed method, so far. would it be useful?
public void copyToClipboard(String value);
}