Added test command for testing ore gen.
Started reimplementing quartz ore gen ontop of vanilla mechanics. Fixes several sidedness issues. Added recipe serialization for server->client sync.
This commit is contained in:
@@ -37,6 +37,11 @@ public class GrinderRecipe implements IRecipe<IInventory> {
|
||||
this.optionalResults = ImmutableList.copyOf(optionalResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(IInventory inv, World worldIn) {
|
||||
return this.ingredient.test(inv.getStackInSlot(0));
|
||||
|
||||
@@ -69,14 +69,36 @@ public class GrinderRecipeSerializer extends ForgeRegistryEntry<IRecipeSerialize
|
||||
@Nullable
|
||||
@Override
|
||||
public GrinderRecipe read(ResourceLocation recipeId, PacketBuffer buffer) {
|
||||
// FIXME NOT YET IMPLEMENTED
|
||||
throw new IllegalStateException();
|
||||
|
||||
String group = buffer.readString();
|
||||
Ingredient ingredient = Ingredient.read(buffer);
|
||||
int ingredientCount = buffer.readVarInt();
|
||||
ItemStack result = buffer.readItemStack();
|
||||
int turns = buffer.readVarInt();
|
||||
int optionalResultsCount = buffer.readVarInt();
|
||||
List<GrinderOptionalResult> optionalResults = new ArrayList<>(optionalResultsCount);
|
||||
for (int i = 0; i < optionalResultsCount; i++) {
|
||||
float chance = buffer.readFloat();
|
||||
ItemStack optionalResult = buffer.readItemStack();
|
||||
optionalResults.add(new GrinderOptionalResult(chance, optionalResult));
|
||||
}
|
||||
|
||||
return new GrinderRecipe(recipeId, group, ingredient, ingredientCount, result, turns, optionalResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer, GrinderRecipe recipe) {
|
||||
// FIXME NOT YET IMPLEMENTED
|
||||
throw new IllegalStateException();
|
||||
buffer.writeString(recipe.getGroup());
|
||||
recipe.getIngredient().write(buffer);
|
||||
buffer.writeVarInt(recipe.getIngredientCount());
|
||||
buffer.writeItemStack(recipe.getRecipeOutput());
|
||||
buffer.writeVarInt(recipe.getTurns());
|
||||
List<GrinderOptionalResult> optionalResults = recipe.getOptionalResults();
|
||||
buffer.writeVarInt(optionalResults.size());
|
||||
for (GrinderOptionalResult optionalResult : optionalResults) {
|
||||
buffer.writeFloat(optionalResult.getChance());
|
||||
buffer.writeItemStack(optionalResult.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@ public class InscriberRecipe implements IRecipe<IInventory> {
|
||||
private final ResourceLocation id;
|
||||
private final String group;
|
||||
|
||||
private Ingredient middleInput;
|
||||
private Ingredient topOptional;
|
||||
private Ingredient bottomOptional;
|
||||
private ItemStack output;
|
||||
private InscriberProcessType processType;
|
||||
private final Ingredient middleInput;
|
||||
private final Ingredient topOptional;
|
||||
private final Ingredient bottomOptional;
|
||||
private final ItemStack output;
|
||||
private final InscriberProcessType processType;
|
||||
|
||||
public InscriberRecipe(ResourceLocation id, String group, Ingredient middleInput, ItemStack output,
|
||||
Ingredient topOptional, Ingredient bottomOptional, InscriberProcessType processType) {
|
||||
@@ -63,7 +63,7 @@ public class InscriberRecipe implements IRecipe<IInventory> {
|
||||
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer() {
|
||||
return GrinderRecipeSerializer.INSTANCE;
|
||||
return InscriberRecipeSerializer.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,4 +100,8 @@ public class InscriberRecipe implements IRecipe<IInventory> {
|
||||
return processType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,14 +67,24 @@ public class InscriberRecipeSerializer extends ForgeRegistryEntry<IRecipeSeriali
|
||||
@Nullable
|
||||
@Override
|
||||
public InscriberRecipe read(ResourceLocation recipeId, PacketBuffer buffer) {
|
||||
// FIXME NOT YET IMPLEMENTED
|
||||
throw new IllegalStateException();
|
||||
String group = buffer.readString();
|
||||
Ingredient middle = Ingredient.read(buffer);
|
||||
ItemStack result = buffer.readItemStack();
|
||||
Ingredient top = Ingredient.read(buffer);
|
||||
Ingredient bottom = Ingredient.read(buffer);
|
||||
InscriberProcessType mode = buffer.readEnumValue(InscriberProcessType.class);
|
||||
|
||||
return new InscriberRecipe(recipeId, group, middle, result, top, bottom, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer, InscriberRecipe recipe) {
|
||||
// FIXME NOT YET IMPLEMENTED
|
||||
throw new IllegalStateException();
|
||||
buffer.writeString(recipe.getGroup());
|
||||
recipe.getMiddleInput().write(buffer);
|
||||
buffer.writeItemStack(recipe.getRecipeOutput());
|
||||
recipe.getTopOptional().write(buffer);
|
||||
recipe.getBottomOptional().write(buffer);
|
||||
buffer.writeEnumValue(recipe.getProcessType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user