Attempt to try to fix the 1.16.3's branch having multiple 'wayoftime' folders.
This commit is contained in:
parent
c159828248
commit
6b4145a67c
224 changed files with 0 additions and 24047 deletions
|
@ -1,80 +0,0 @@
|
|||
package wayoftime.bloodmagic.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
||||
/**
|
||||
* The main interface between a plugin and Blood Magic's internals.
|
||||
*
|
||||
* This API is intended for <i>compatibility</i> between other mods and Blood
|
||||
* Magic. More advanced integration is out of the scope of this API and are
|
||||
* considered "addons".
|
||||
*
|
||||
* To get an instance of this without actually creating an
|
||||
* {@link IBloodMagicPlugin}, use {@link BloodMagicPlugin.Inject}.
|
||||
*/
|
||||
public interface IBloodMagicAPI
|
||||
{
|
||||
|
||||
// /**
|
||||
// * Retrieves the instance of the blacklist.
|
||||
// *
|
||||
// * @return the active {@link IBloodMagicBlacklist} instance
|
||||
// */
|
||||
// @Nonnull
|
||||
// IBloodMagicBlacklist getBlacklist();
|
||||
|
||||
/**
|
||||
* Retrieves the instance of the recipe registrar.
|
||||
*
|
||||
* @return the active {@link IBloodMagicRecipeRegistrar} instance
|
||||
*/
|
||||
@Nonnull
|
||||
IBloodMagicRecipeRegistrar getRecipeRegistrar();
|
||||
//
|
||||
// /**
|
||||
// * Retrieves the instance of the value manager.
|
||||
// *
|
||||
// * @return the active {@link IBloodMagicValueManager} instance
|
||||
// */
|
||||
// @Nonnull
|
||||
// IBloodMagicValueManager getValueManager();
|
||||
|
||||
/**
|
||||
* Registers an {@link IBlockState} as a given component for the Blood Altar.
|
||||
* <p>
|
||||
* Valid component types:
|
||||
* <ul>
|
||||
* <li>GLOWSTONE</li>
|
||||
* <li>BLOODSTONE</li>
|
||||
* <li>BEACON</li>
|
||||
* <li>BLOODRUNE</li>
|
||||
* <li>CRYSTAL</li>
|
||||
* <li>NOTAIR</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param state The state to register
|
||||
* @param componentType The type of Blood Altar component to register as.
|
||||
*/
|
||||
void registerAltarComponent(@Nonnull BlockState state, @Nonnull String componentType);
|
||||
|
||||
/**
|
||||
* Removes an {@link IBlockState} from the component mappings
|
||||
* <p>
|
||||
* Valid component types:
|
||||
* <ul>
|
||||
* <li>GLOWSTONE</li>
|
||||
* <li>BLOODSTONE</li>
|
||||
* <li>BEACON</li>
|
||||
* <li>BLOODRUNE</li>
|
||||
* <li>CRYSTAL</li>
|
||||
* <li>NOTAIR</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param state The state to unregister
|
||||
* @param componentType The type of Blood Altar component to unregister from.
|
||||
*/
|
||||
void unregisterAltarComponent(@Nonnull BlockState state, @Nonnull String componentType);
|
||||
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
package wayoftime.bloodmagic.api;
|
||||
|
||||
/**
|
||||
* Allows recipe addition and removal.
|
||||
*/
|
||||
public interface IBloodMagicRecipeRegistrar
|
||||
{
|
||||
|
||||
// /**
|
||||
// * Adds a new recipe to the Blood Altar.
|
||||
// *
|
||||
// * @param input An input {@link Ingredient}.
|
||||
// * @param output An output {@link ItemStack}.
|
||||
// * @param minimumTier The minimum Blood Altar tier required for this recipe.
|
||||
// * @param syphon The amount of Life Essence to syphon from the Blood Altar
|
||||
// * over the course of the craft.
|
||||
// * @param consumeRate How quickly the Life Essence is syphoned.
|
||||
// * @param drainRate How quickly progress is lost if the Blood Altar runs out
|
||||
// * of Life Essence during the craft.
|
||||
// */
|
||||
// void addBloodAltar(@Nonnull Ingredient input, @Nonnull ItemStack output, @Nonnegative int minimumTier,
|
||||
// @Nonnegative int syphon, @Nonnegative int consumeRate, @Nonnegative int drainRate);
|
||||
//
|
||||
// /**
|
||||
// * Removes a Blood Altar recipe based on an input {@link ItemStack}.
|
||||
// *
|
||||
// * @param input The input item to remove the recipe of.
|
||||
// * @return Whether or not a recipe was removed.
|
||||
// */
|
||||
// boolean removeBloodAltar(@Nonnull ItemStack input);
|
||||
//
|
||||
// /**
|
||||
// * Adds a new recipe to the Alchemy Table.
|
||||
// *
|
||||
// * @param output An output {@link ItemStack}.
|
||||
// * @param syphon The amount of Life Essence to syphon from the Blood Orb's
|
||||
// * bound network over the course of the craft.
|
||||
// * @param ticks The amount of ticks it takes to complete the craft.
|
||||
// * @param minimumTier The minimum Blood Orb tier required for this recipe.
|
||||
// * @param input An array of {@link Ingredient}s to accept as inputs.
|
||||
// */
|
||||
// void addAlchemyTable(@Nonnull ItemStack output, @Nonnegative int syphon, @Nonnegative int ticks,
|
||||
// @Nonnegative int minimumTier, @Nonnull Ingredient... input);
|
||||
//
|
||||
// /**
|
||||
// * Removes an Alchemy Table recipe based on an input {@link ItemStack} array.
|
||||
// *
|
||||
// * @param input The input items to remove the recipe of.
|
||||
// * @return Whether or not a recipe was removed.
|
||||
// */
|
||||
// boolean removeAlchemyTable(@Nonnull ItemStack... input);
|
||||
//
|
||||
// /**
|
||||
// * Adds a new recipe to the Soul/Tartaric Forge.
|
||||
// *
|
||||
// * @param output An output {@link ItemStack}.
|
||||
// * @param minimumSouls The minimum number of souls that must be contained in the
|
||||
// * Soul Gem.
|
||||
// * @param soulDrain The number of souls to drain from the Soul Gem.
|
||||
// * @param input An array of {@link Ingredient}s to accept as inputs.
|
||||
// */
|
||||
// void addTartaricForge(@Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain,
|
||||
// @Nonnull Ingredient... input);
|
||||
//
|
||||
// /**
|
||||
// * Removes a Soul/Tartaric Forge recipe based on an input {@link ItemStack}
|
||||
// * array.
|
||||
// *
|
||||
// * @param input The input items to remove the recipe of.
|
||||
// * @return Whether or not a recipe was removed.
|
||||
// */
|
||||
// boolean removeTartaricForge(@Nonnull ItemStack... input);
|
||||
//
|
||||
// /**
|
||||
// * Adds a new recipe to the Alchemy Array.
|
||||
// *
|
||||
// * @param input An input {@link Ingredient}. First item put into the
|
||||
// * Alchemy Array.
|
||||
// * @param catalyst A catalyst {@link Ingredient}. Second item put into the
|
||||
// * Alchemy Array.
|
||||
// * @param output An output {@link ItemStack}.
|
||||
// * @param circleTexture The texture to render for the Alchemy Array circle.
|
||||
// */
|
||||
// void addAlchemyArray(@Nonnull Ingredient input, @Nonnull Ingredient catalyst, @Nonnull ItemStack output,
|
||||
// @Nullable ResourceLocation circleTexture);
|
||||
//
|
||||
// /**
|
||||
// * Removes an Alchemy Array recipe based on an input {@link ItemStack} and it's
|
||||
// * catalyst {@link ItemStack}.
|
||||
// *
|
||||
// * @param input The input item to remove the recipe of.
|
||||
// * @param catalyst The catalyst item to remove the recipe of.
|
||||
// * @return Whether or not a recipe was removed.
|
||||
// */
|
||||
// boolean removeAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst);
|
||||
//
|
||||
// void addSacrificeCraft(@Nonnull ItemStack output, @Nonnegative double healthRequired, @Nonnull Ingredient... input);
|
||||
//
|
||||
// boolean removeSacrificeCraft(@Nonnull ItemStack... input);
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
package wayoftime.bloodmagic.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ShapedRecipe;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
/**
|
||||
* Copied liberally from Mekanism. Thanks, pupnewfster!
|
||||
*
|
||||
*/
|
||||
public class SerializerHelper
|
||||
{
|
||||
private SerializerHelper()
|
||||
{
|
||||
}
|
||||
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
|
||||
|
||||
private static void validateKey(@Nonnull JsonObject json, @Nonnull String key)
|
||||
{
|
||||
if (!json.has(key))
|
||||
{
|
||||
throw new JsonSyntaxException("Missing '" + key + "', expected to find an object");
|
||||
}
|
||||
if (!json.get(key).isJsonObject())
|
||||
{
|
||||
throw new JsonSyntaxException("Expected '" + key + "' to be an object");
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(@Nonnull JsonObject json, @Nonnull String key)
|
||||
{
|
||||
validateKey(json, key);
|
||||
return ShapedRecipe.deserializeItem(JSONUtils.getJsonObject(json, key));
|
||||
}
|
||||
|
||||
public static JsonElement serializeItemStack(@Nonnull ItemStack stack)
|
||||
{
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty(Constants.JSON.ITEM, stack.getItem().getRegistryName().toString());
|
||||
if (stack.getCount() > 1)
|
||||
{
|
||||
json.addProperty(Constants.JSON.COUNT, stack.getCount());
|
||||
}
|
||||
if (stack.hasTag())
|
||||
{
|
||||
json.addProperty(Constants.JSON.NBT, stack.getTag().toString());
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
public static FluidStack getFluidStack(@Nonnull JsonObject json, @Nonnull String key)
|
||||
{
|
||||
validateKey(json, key);
|
||||
return deserializeFluid(JSONUtils.getJsonObject(json, key));
|
||||
}
|
||||
|
||||
public static FluidStack deserializeFluid(@Nonnull JsonObject json)
|
||||
{
|
||||
if (!json.has(Constants.JSON.AMOUNT))
|
||||
{
|
||||
throw new JsonSyntaxException("Expected to receive a amount that is greater than zero");
|
||||
}
|
||||
JsonElement count = json.get(Constants.JSON.AMOUNT);
|
||||
if (!JSONUtils.isNumber(count))
|
||||
{
|
||||
throw new JsonSyntaxException("Expected amount to be a number greater than zero.");
|
||||
}
|
||||
int amount = count.getAsJsonPrimitive().getAsInt();
|
||||
if (amount < 1)
|
||||
{
|
||||
throw new JsonSyntaxException("Expected amount to be greater than zero.");
|
||||
}
|
||||
ResourceLocation resourceLocation = new ResourceLocation(JSONUtils.getString(json, Constants.JSON.FLUID));
|
||||
Fluid fluid = ForgeRegistries.FLUIDS.getValue(resourceLocation);
|
||||
if (fluid == null || fluid == Fluids.EMPTY)
|
||||
{
|
||||
throw new JsonSyntaxException("Invalid fluid type '" + resourceLocation + "'");
|
||||
}
|
||||
CompoundNBT nbt = null;
|
||||
if (json.has(Constants.JSON.NBT))
|
||||
{
|
||||
JsonElement jsonNBT = json.get(Constants.JSON.NBT);
|
||||
try
|
||||
{
|
||||
if (jsonNBT.isJsonObject())
|
||||
{
|
||||
nbt = JsonToNBT.getTagFromJson(GSON.toJson(jsonNBT));
|
||||
} else
|
||||
{
|
||||
nbt = JsonToNBT.getTagFromJson(JSONUtils.getString(jsonNBT, Constants.JSON.NBT));
|
||||
}
|
||||
} catch (CommandSyntaxException e)
|
||||
{
|
||||
throw new JsonSyntaxException("Invalid NBT entry for fluid '" + resourceLocation + "'");
|
||||
}
|
||||
}
|
||||
return new FluidStack(fluid, amount, nbt);
|
||||
}
|
||||
|
||||
public static JsonElement serializeFluidStack(@Nonnull FluidStack stack)
|
||||
{
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty(Constants.JSON.FLUID, stack.getFluid().getRegistryName().toString());
|
||||
json.addProperty(Constants.JSON.AMOUNT, stack.getAmount());
|
||||
if (stack.hasTag())
|
||||
{
|
||||
json.addProperty(Constants.JSON.NBT, stack.getTag().toString());
|
||||
}
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
package wayoftime.bloodmagic.api.event;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
public class BloodMagicCraftedEvent extends Event
|
||||
{
|
||||
|
||||
private final boolean modifiable;
|
||||
private final ItemStack[] inputs;
|
||||
private ItemStack output;
|
||||
|
||||
public BloodMagicCraftedEvent(ItemStack output, ItemStack[] inputs, boolean modifiable)
|
||||
{
|
||||
this.modifiable = modifiable;
|
||||
this.inputs = inputs;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public boolean isModifiable()
|
||||
{
|
||||
return modifiable;
|
||||
}
|
||||
|
||||
public ItemStack[] getInputs()
|
||||
{
|
||||
return inputs;
|
||||
}
|
||||
|
||||
public ItemStack getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
public void setOutput(ItemStack output)
|
||||
{
|
||||
if (isModifiable())
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired whenever a craft is completed in a Blood Altar.
|
||||
*
|
||||
* It is not cancelable, however you can modify the output stack.
|
||||
*/
|
||||
public static class Altar extends BloodMagicCraftedEvent
|
||||
{
|
||||
|
||||
public Altar(ItemStack output, ItemStack input)
|
||||
{
|
||||
super(output, new ItemStack[]
|
||||
{ input }, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired whenever a craft is completed in a Soul Forge.
|
||||
*
|
||||
* It is not cancelable, however you can modify the output stack.
|
||||
*/
|
||||
public static class SoulForge extends BloodMagicCraftedEvent
|
||||
{
|
||||
|
||||
public SoulForge(ItemStack output, ItemStack[] inputs)
|
||||
{
|
||||
super(output, inputs, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired whenever a craft is completed in an Alchemy Table.
|
||||
*
|
||||
* It is not cancelable, however you can modify the output stack.
|
||||
*/
|
||||
public static class AlchemyTable extends BloodMagicCraftedEvent
|
||||
{
|
||||
|
||||
public AlchemyTable(ItemStack output, ItemStack[] inputs)
|
||||
{
|
||||
super(output, inputs, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,385 +0,0 @@
|
|||
package wayoftime.bloodmagic.api.event.recipes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tags.TagCollectionManager;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import wayoftime.bloodmagic.api.SerializerHelper;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
/**
|
||||
* Created by Thiakil on 12/07/2019.
|
||||
*/
|
||||
public abstract class FluidStackIngredient implements InputIngredient<FluidStack>
|
||||
{
|
||||
|
||||
public static FluidStackIngredient from(@Nonnull Fluid instance, int amount)
|
||||
{
|
||||
return from(new FluidStack(instance, amount));
|
||||
}
|
||||
|
||||
public static FluidStackIngredient from(@Nonnull FluidStack instance)
|
||||
{
|
||||
return new Single(instance);
|
||||
}
|
||||
|
||||
public static FluidStackIngredient from(@Nonnull ITag<Fluid> fluidTag, int minAmount)
|
||||
{
|
||||
return new Tagged(fluidTag, minAmount);
|
||||
}
|
||||
|
||||
public static FluidStackIngredient read(PacketBuffer buffer)
|
||||
{
|
||||
// TODO: Allow supporting serialization of different types than just the ones we
|
||||
// implement?
|
||||
IngredientType type = buffer.readEnumValue(IngredientType.class);
|
||||
if (type == IngredientType.SINGLE)
|
||||
{
|
||||
return Single.read(buffer);
|
||||
} else if (type == IngredientType.TAGGED)
|
||||
{
|
||||
return Tagged.read(buffer);
|
||||
}
|
||||
return Multi.read(buffer);
|
||||
}
|
||||
|
||||
public static FluidStackIngredient deserialize(@Nullable JsonElement json)
|
||||
{
|
||||
if (json == null || json.isJsonNull())
|
||||
{
|
||||
throw new JsonSyntaxException("Ingredient cannot be null");
|
||||
}
|
||||
if (json.isJsonArray())
|
||||
{
|
||||
JsonArray jsonArray = json.getAsJsonArray();
|
||||
int size = jsonArray.size();
|
||||
if (size == 0)
|
||||
{
|
||||
throw new JsonSyntaxException("Ingredient array cannot be empty, at least one ingredient must be defined");
|
||||
} else if (size > 1)
|
||||
{
|
||||
FluidStackIngredient[] ingredients = new FluidStackIngredient[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
// Read all the ingredients
|
||||
ingredients[i] = deserialize(jsonArray.get(i));
|
||||
}
|
||||
return createMulti(ingredients);
|
||||
}
|
||||
// If we only have a single element, just set our json as that so that we don't
|
||||
// have to use Multi for efficiency reasons
|
||||
json = jsonArray.get(0);
|
||||
}
|
||||
if (!json.isJsonObject())
|
||||
{
|
||||
throw new JsonSyntaxException("Expected fluid to be object or array of objects");
|
||||
}
|
||||
JsonObject jsonObject = json.getAsJsonObject();
|
||||
if (jsonObject.has(Constants.JSON.FLUID) && jsonObject.has(Constants.JSON.TAG))
|
||||
{
|
||||
throw new JsonParseException("An ingredient entry is either a tag or an fluid, not both");
|
||||
} else if (jsonObject.has(Constants.JSON.FLUID))
|
||||
{
|
||||
return from(SerializerHelper.deserializeFluid(jsonObject));
|
||||
} else if (jsonObject.has(Constants.JSON.TAG))
|
||||
{
|
||||
if (!jsonObject.has(Constants.JSON.AMOUNT))
|
||||
{
|
||||
throw new JsonSyntaxException("Expected to receive a amount that is greater than zero");
|
||||
}
|
||||
JsonElement count = jsonObject.get(Constants.JSON.AMOUNT);
|
||||
if (!JSONUtils.isNumber(count))
|
||||
{
|
||||
throw new JsonSyntaxException("Expected amount to be a number greater than zero.");
|
||||
}
|
||||
int amount = count.getAsJsonPrimitive().getAsInt();
|
||||
if (amount < 1)
|
||||
{
|
||||
throw new JsonSyntaxException("Expected amount to be greater than zero.");
|
||||
}
|
||||
ResourceLocation resourceLocation = new ResourceLocation(JSONUtils.getString(jsonObject, Constants.JSON.TAG));
|
||||
ITag<Fluid> tag = TagCollectionManager.getManager().getFluidTags().get(resourceLocation);
|
||||
if (tag == null)
|
||||
{
|
||||
throw new JsonSyntaxException("Unknown fluid tag '" + resourceLocation + "'");
|
||||
}
|
||||
return from(tag, amount);
|
||||
}
|
||||
throw new JsonSyntaxException("Expected to receive a resource location representing either a tag or a fluid.");
|
||||
}
|
||||
|
||||
public static FluidStackIngredient createMulti(FluidStackIngredient... ingredients)
|
||||
{
|
||||
if (ingredients.length == 0)
|
||||
{
|
||||
// TODO: Throw error
|
||||
} else if (ingredients.length == 1)
|
||||
{
|
||||
return ingredients[0];
|
||||
}
|
||||
List<FluidStackIngredient> cleanedIngredients = new ArrayList<>();
|
||||
for (FluidStackIngredient ingredient : ingredients)
|
||||
{
|
||||
if (ingredient instanceof Multi)
|
||||
{
|
||||
// Don't worry about if our inner ingredients are multi as well, as if this is
|
||||
// the only external method for
|
||||
// creating a multi ingredient, then we are certified they won't be of a higher
|
||||
// depth
|
||||
cleanedIngredients.addAll(Arrays.asList(((Multi) ingredient).ingredients));
|
||||
} else
|
||||
{
|
||||
cleanedIngredients.add(ingredient);
|
||||
}
|
||||
}
|
||||
// There should be more than a single fluid or we would have split out earlier
|
||||
return new Multi(cleanedIngredients.toArray(new FluidStackIngredient[0]));
|
||||
}
|
||||
|
||||
public static class Single extends FluidStackIngredient
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
private final FluidStack fluidInstance;
|
||||
|
||||
public Single(@Nonnull FluidStack fluidInstance)
|
||||
{
|
||||
this.fluidInstance = Objects.requireNonNull(fluidInstance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(@Nonnull FluidStack fluidStack)
|
||||
{
|
||||
return testType(fluidStack) && fluidStack.getAmount() >= fluidInstance.getAmount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testType(@Nonnull FluidStack fluidStack)
|
||||
{
|
||||
return Objects.requireNonNull(fluidStack).isFluidEqual(fluidInstance);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public FluidStack getMatchingInstance(@Nonnull FluidStack fluidStack)
|
||||
{
|
||||
return test(fluidStack) ? fluidInstance : FluidStack.EMPTY;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getRepresentations()
|
||||
{
|
||||
return Collections.singletonList(fluidInstance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
buffer.writeEnumValue(IngredientType.SINGLE);
|
||||
fluidInstance.writeToPacket(buffer);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public JsonElement serialize()
|
||||
{
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty(Constants.JSON.AMOUNT, fluidInstance.getAmount());
|
||||
json.addProperty(Constants.JSON.FLUID, fluidInstance.getFluid().getRegistryName().toString());
|
||||
if (fluidInstance.hasTag())
|
||||
{
|
||||
json.addProperty(Constants.JSON.NBT, fluidInstance.getTag().toString());
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
public static Single read(PacketBuffer buffer)
|
||||
{
|
||||
return new Single(FluidStack.readFromPacket(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Tagged extends FluidStackIngredient
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
private final ITag<Fluid> tag;
|
||||
private final int amount;
|
||||
|
||||
public Tagged(@Nonnull ITag<Fluid> tag, int amount)
|
||||
{
|
||||
this.tag = tag;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(@Nonnull FluidStack fluidStack)
|
||||
{
|
||||
return testType(fluidStack) && fluidStack.getAmount() >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testType(@Nonnull FluidStack fluidStack)
|
||||
{
|
||||
return Objects.requireNonNull(fluidStack).getFluid().isIn(tag);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public FluidStack getMatchingInstance(@Nonnull FluidStack fluidStack)
|
||||
{
|
||||
if (test(fluidStack))
|
||||
{
|
||||
// Our fluid is in the tag so we make a new stack with the given amount
|
||||
return new FluidStack(fluidStack, amount);
|
||||
}
|
||||
return FluidStack.EMPTY;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getRepresentations()
|
||||
{
|
||||
// TODO: Can this be cached some how
|
||||
List<FluidStack> representations = new ArrayList<>();
|
||||
for (Fluid fluid : TagResolverHelper.getRepresentations(tag))
|
||||
{
|
||||
representations.add(new FluidStack(fluid, amount));
|
||||
}
|
||||
return representations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
buffer.writeEnumValue(IngredientType.TAGGED);
|
||||
buffer.writeResourceLocation(TagCollectionManager.getManager().getFluidTags().getValidatedIdFromTag(tag));
|
||||
buffer.writeVarInt(amount);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public JsonElement serialize()
|
||||
{
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty(Constants.JSON.AMOUNT, amount);
|
||||
json.addProperty(Constants.JSON.TAG, TagCollectionManager.getManager().getFluidTags().getValidatedIdFromTag(tag).toString());
|
||||
return json;
|
||||
}
|
||||
|
||||
public static Tagged read(PacketBuffer buffer)
|
||||
{
|
||||
return new Tagged(FluidTags.makeWrapperTag(buffer.readResourceLocation().toString()), buffer.readVarInt());
|
||||
}
|
||||
}
|
||||
|
||||
public static class Multi extends FluidStackIngredient
|
||||
{
|
||||
|
||||
private final FluidStackIngredient[] ingredients;
|
||||
|
||||
protected Multi(@Nonnull FluidStackIngredient... ingredients)
|
||||
{
|
||||
this.ingredients = ingredients;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(@Nonnull FluidStack stack)
|
||||
{
|
||||
return Arrays.stream(ingredients).anyMatch(ingredient -> ingredient.test(stack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testType(@Nonnull FluidStack stack)
|
||||
{
|
||||
return Arrays.stream(ingredients).anyMatch(ingredient -> ingredient.testType(stack));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public FluidStack getMatchingInstance(@Nonnull FluidStack stack)
|
||||
{
|
||||
for (FluidStackIngredient ingredient : ingredients)
|
||||
{
|
||||
FluidStack matchingInstance = ingredient.getMatchingInstance(stack);
|
||||
if (!matchingInstance.isEmpty())
|
||||
{
|
||||
return matchingInstance;
|
||||
}
|
||||
}
|
||||
return FluidStack.EMPTY;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getRepresentations()
|
||||
{
|
||||
List<FluidStack> representations = new ArrayList<>();
|
||||
for (FluidStackIngredient ingredient : ingredients)
|
||||
{
|
||||
representations.addAll(ingredient.getRepresentations());
|
||||
}
|
||||
return representations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
buffer.writeEnumValue(IngredientType.MULTI);
|
||||
buffer.writeVarInt(ingredients.length);
|
||||
for (FluidStackIngredient ingredient : ingredients)
|
||||
{
|
||||
ingredient.write(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public JsonElement serialize()
|
||||
{
|
||||
JsonArray json = new JsonArray();
|
||||
for (FluidStackIngredient ingredient : ingredients)
|
||||
{
|
||||
json.add(ingredient.serialize());
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
public static FluidStackIngredient read(PacketBuffer buffer)
|
||||
{
|
||||
FluidStackIngredient[] ingredients = new FluidStackIngredient[buffer.readVarInt()];
|
||||
for (int i = 0; i < ingredients.length; i++)
|
||||
{
|
||||
ingredients[i] = FluidStackIngredient.read(buffer);
|
||||
}
|
||||
return createMulti(ingredients);
|
||||
}
|
||||
}
|
||||
|
||||
private enum IngredientType
|
||||
{
|
||||
SINGLE,
|
||||
TAGGED,
|
||||
MULTI
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package wayoftime.bloodmagic.api.event.recipes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
public interface InputIngredient<TYPE> extends Predicate<TYPE>
|
||||
{
|
||||
|
||||
/**
|
||||
* Evaluates this predicate on the given argument, ignoring any size data.
|
||||
*
|
||||
* @param type the input argument
|
||||
*
|
||||
* @return {@code true} if the input argument matches the predicate, otherwise
|
||||
* {@code false}
|
||||
*/
|
||||
boolean testType(@Nonnull TYPE type);
|
||||
|
||||
TYPE getMatchingInstance(TYPE type);
|
||||
|
||||
/**
|
||||
* Primarily for JEI, a list of valid instances of the type
|
||||
*
|
||||
* @return List (empty means no valid registrations found and recipe is to be
|
||||
* hidden)
|
||||
*
|
||||
* @apiNote Do not modify any of the values returned by the representations
|
||||
*/
|
||||
@Nonnull
|
||||
List<TYPE> getRepresentations();
|
||||
|
||||
/**
|
||||
* Writes this ingredient to a PacketBuffer.
|
||||
*
|
||||
* @param buffer The buffer to write to.
|
||||
*/
|
||||
void write(PacketBuffer buffer);
|
||||
|
||||
/**
|
||||
* Serializes this ingredient to a JsonElement
|
||||
*
|
||||
* @return JsonElement representation of this ingredient.
|
||||
*/
|
||||
@Nonnull
|
||||
JsonElement serialize();
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package wayoftime.bloodmagic.api.event.recipes;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.tags.ITag;
|
||||
|
||||
/**
|
||||
* Copied from Mekanism, including the author's rant about tags.
|
||||
*/
|
||||
public class TagResolverHelper
|
||||
{
|
||||
|
||||
public static <TYPE> List<TYPE> getRepresentations(ITag<TYPE> tag)
|
||||
{
|
||||
try
|
||||
{
|
||||
return tag.getAllElements();
|
||||
} catch (IllegalStateException e)
|
||||
{
|
||||
// Why do tags have to be such an annoyance in 1.16
|
||||
// This is needed so that we can ensure we give JEI an empty list of
|
||||
// representations
|
||||
// instead of crashing on the first run, as recipes get "initialized" before
|
||||
// tags are
|
||||
// done initializing, and we don't want to spam the log with errors. JEI and
|
||||
// things
|
||||
// still work fine regardless of this
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.api.inventory.IgnoredIInventory;
|
||||
|
||||
public abstract class BloodMagicRecipe implements IRecipe<IgnoredIInventory>
|
||||
{
|
||||
private final ResourceLocation id;
|
||||
|
||||
protected BloodMagicRecipe(ResourceLocation id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes this recipe to a PacketBuffer.
|
||||
*
|
||||
* @param buffer The buffer to write to.
|
||||
*/
|
||||
public abstract void write(PacketBuffer buffer);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@Nonnull IgnoredIInventory inv, @Nonnull World world)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDynamic()
|
||||
{
|
||||
// Note: If we make this non dynamic, we can make it show in vanilla's crafting
|
||||
// book and also then obey the recipe locking.
|
||||
// For now none of that works/makes sense in our concept so don't lock it
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getCraftingResult(@Nonnull IgnoredIInventory inv)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFit(int width, int height)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
|
@ -1,145 +0,0 @@
|
|||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import wayoftime.bloodmagic.api.event.recipes.FluidStackIngredient;
|
||||
|
||||
public abstract class RecipeARC extends BloodMagicRecipe
|
||||
{
|
||||
public static final int MAX_RANDOM_OUTPUTS = 3;
|
||||
|
||||
@Nonnull
|
||||
private final Ingredient input;
|
||||
@Nonnull
|
||||
private final Ingredient arc_tool;
|
||||
private final FluidStackIngredient inputFluid;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
private final FluidStack outputFluid;
|
||||
|
||||
private final List<Pair<ItemStack, Double>> addedItems;
|
||||
|
||||
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid)
|
||||
{
|
||||
this(id, input, arc_tool, inputFluid, output, new ArrayList<Pair<ItemStack, Double>>(), outputFluid);
|
||||
}
|
||||
|
||||
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, List<Pair<ItemStack, Double>> addedItems, FluidStack outputFluid)
|
||||
{
|
||||
super(id);
|
||||
this.input = input;
|
||||
this.arc_tool = arc_tool;
|
||||
this.inputFluid = inputFluid;
|
||||
this.output = output;
|
||||
this.addedItems = addedItems;
|
||||
this.outputFluid = outputFluid;
|
||||
}
|
||||
|
||||
public RecipeARC addRandomOutput(ItemStack stack, double chance)
|
||||
{
|
||||
if (addedItems.size() >= MAX_RANDOM_OUTPUTS)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
addedItems.add(Pair.of(stack, chance));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final Ingredient getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final Ingredient getTool()
|
||||
{
|
||||
return arc_tool;
|
||||
}
|
||||
|
||||
public final FluidStackIngredient getFluidIngredient()
|
||||
{
|
||||
return inputFluid;
|
||||
}
|
||||
|
||||
public final FluidStack getFluidOutput()
|
||||
{
|
||||
return outputFluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final NonNullList<Ingredient> getIngredients()
|
||||
{
|
||||
NonNullList<Ingredient> list = NonNullList.create();
|
||||
list.add(getInput());
|
||||
list.add(getTool());
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ItemStack> getAllListedOutputs()
|
||||
{
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
list.add(output.copy());
|
||||
for (Pair<ItemStack, Double> pair : addedItems)
|
||||
{
|
||||
list.add(pair.getLeft().copy());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ItemStack> getAllOutputs(Random rand)
|
||||
{
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
list.add(output.copy());
|
||||
for (Pair<ItemStack, Double> pair : addedItems)
|
||||
{
|
||||
if (rand.nextDouble() < pair.getRight())
|
||||
list.add(pair.getLeft().copy());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
input.write(buffer);
|
||||
arc_tool.write(buffer);
|
||||
buffer.writeItemStack(output);
|
||||
buffer.writeInt(addedItems.size());
|
||||
for (Pair<ItemStack, Double> pair : addedItems)
|
||||
{
|
||||
buffer.writeItemStack(pair.getLeft());
|
||||
buffer.writeDouble(pair.getValue());
|
||||
}
|
||||
|
||||
buffer.writeBoolean(inputFluid != null);
|
||||
if (inputFluid != null)
|
||||
{
|
||||
inputFluid.write(buffer);
|
||||
}
|
||||
|
||||
buffer.writeBoolean(outputFluid != null);
|
||||
if (outputFluid != null)
|
||||
{
|
||||
outputFluid.writeToPacket(buffer);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package wayoftime.bloodmagic.api.inventory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public final class IgnoredIInventory implements IInventory
|
||||
{
|
||||
public static final IgnoredIInventory INSTANCE = new IgnoredIInventory();
|
||||
|
||||
private IgnoredIInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int index)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int index, int count)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeStackFromSlot(int index)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int index, @Nonnull ItemStack stack)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsableByPlayer(@Nonnull PlayerEntity player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package wayoftime.bloodmagic.api.providers;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import wayoftime.bloodmagic.api.text.IHasTextComponent;
|
||||
import wayoftime.bloodmagic.api.text.IHasTranslationKey;
|
||||
|
||||
public interface IBaseProvider extends IHasTextComponent, IHasTranslationKey
|
||||
{
|
||||
ResourceLocation getRegistryName();
|
||||
|
||||
default String getName()
|
||||
{
|
||||
return getRegistryName().getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
default ITextComponent getTextComponent()
|
||||
{
|
||||
return new TranslationTextComponent(getTranslationKey());
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package wayoftime.bloodmagic.api.providers;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
public interface IEntityTypeProvider extends IBaseProvider
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
EntityType<?> getEntityType();
|
||||
|
||||
@Override
|
||||
default ResourceLocation getRegistryName()
|
||||
{
|
||||
return getEntityType().getRegistryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
default ITextComponent getTextComponent()
|
||||
{
|
||||
return getEntityType().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
default String getTranslationKey()
|
||||
{
|
||||
return getEntityType().getTranslationKey();
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package wayoftime.bloodmagic.api.text;
|
||||
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
public interface IHasTextComponent
|
||||
{
|
||||
ITextComponent getTextComponent();
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package wayoftime.bloodmagic.api.text;
|
||||
|
||||
public interface IHasTranslationKey
|
||||
{
|
||||
String getTranslationKey();
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package wayoftime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
//TODO: Will want to probably discontinue this due to The Flattening
|
||||
public enum EnumRitualController implements IStringSerializable
|
||||
{
|
||||
MASTER, IMPERFECT, INVERTED,;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString()
|
||||
{
|
||||
return this.toString();
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
package wayoftime.bloodmagic.client;
|
||||
|
||||
import net.minecraft.client.gui.ScreenManager;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemModelsProperties;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderAlchemyArray;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderAltar;
|
||||
import wayoftime.bloodmagic.client.screens.ScreenAlchemicalReactionChamber;
|
||||
import wayoftime.bloodmagic.client.screens.ScreenSoulForge;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilToggleable;
|
||||
import wayoftime.bloodmagic.common.item.soul.ItemSentientSword;
|
||||
import wayoftime.bloodmagic.iface.IMultiWillTool;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
import wayoftime.bloodmagic.tile.TileAltar;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = BloodMagic.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class ClientEvents
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent event)
|
||||
{
|
||||
ClientRegistry.bindTileEntityRenderer(TileAltar.TYPE, RenderAltar::new);
|
||||
ClientRegistry.bindTileEntityRenderer(TileAlchemyArray.TYPE, RenderAlchemyArray::new);
|
||||
// ClientRegistry.bindTileEntityRenderer(TileSoulForge.TYPE, RenderAlchemyArray::new);
|
||||
}
|
||||
|
||||
public static void registerContainerScreens()
|
||||
{
|
||||
ScreenManager.registerFactory(BloodMagicBlocks.SOUL_FORGE_CONTAINER.get(), ScreenSoulForge::new);
|
||||
ScreenManager.registerFactory(BloodMagicBlocks.ARC_CONTAINER.get(), ScreenAlchemicalReactionChamber::new);
|
||||
}
|
||||
|
||||
public static void registerItemModelProperties(FMLClientSetupEvent event)
|
||||
{
|
||||
registerToggleableProperties(BloodMagicItems.GREEN_GROVE_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.FAST_MINER_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.MAGNETISM_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.ICE_SIGIL.get());
|
||||
registerMultiWillTool(BloodMagicItems.SENTIENT_SWORD.get());
|
||||
registerMultiWillTool(BloodMagicItems.PETTY_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.LESSER_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.COMMON_GEM.get());
|
||||
|
||||
ItemModelsProperties.registerProperty(BloodMagicItems.SENTIENT_SWORD.get(), BloodMagic.rl("active"), new IItemPropertyGetter()
|
||||
{
|
||||
@Override
|
||||
public float call(ItemStack stack, ClientWorld world, LivingEntity entity)
|
||||
{
|
||||
return ((ItemSentientSword) stack.getItem()).getActivated(stack) ? 1 : 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void registerToggleableProperties(Item item)
|
||||
{
|
||||
ItemModelsProperties.registerProperty(item, BloodMagic.rl("active"), new IItemPropertyGetter()
|
||||
{
|
||||
@Override
|
||||
public float call(ItemStack stack, ClientWorld world, LivingEntity entity)
|
||||
{
|
||||
Item item = stack.getItem();
|
||||
if (item instanceof ItemSigilToggleable)
|
||||
{
|
||||
return ((ItemSigilToggleable) item).getActivated(stack) ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void registerMultiWillTool(Item item)
|
||||
{
|
||||
ItemModelsProperties.registerProperty(item, BloodMagic.rl("type"), new IItemPropertyGetter()
|
||||
{
|
||||
@Override
|
||||
public float call(ItemStack stack, ClientWorld world, LivingEntity entity)
|
||||
{
|
||||
Item item = stack.getItem();
|
||||
if (item instanceof IMultiWillTool)
|
||||
{
|
||||
return ((IMultiWillTool) item).getCurrentType(stack).ordinal();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
package wayoftime.bloodmagic.client.render;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class BloodMagicRenderer
|
||||
{
|
||||
public static float getRed(int color)
|
||||
{
|
||||
return (color >> 16 & 0xFF) / 255.0F;
|
||||
}
|
||||
|
||||
public static float getGreen(int color)
|
||||
{
|
||||
return (color >> 8 & 0xFF) / 255.0F;
|
||||
}
|
||||
|
||||
public static float getBlue(int color)
|
||||
{
|
||||
return (color & 0xFF) / 255.0F;
|
||||
}
|
||||
|
||||
public static float getAlpha(int color)
|
||||
{
|
||||
return (color >> 24 & 0xFF) / 255.0F;
|
||||
}
|
||||
|
||||
public static class Model3D
|
||||
{
|
||||
public double minX, minY, minZ;
|
||||
public double maxX, maxY, maxZ;
|
||||
|
||||
public final TextureAtlasSprite[] textures = new TextureAtlasSprite[6];
|
||||
|
||||
public final boolean[] renderSides = new boolean[]
|
||||
{ true, true, true, true, true, true, false };
|
||||
|
||||
public double sizeX()
|
||||
{
|
||||
return maxX - minX;
|
||||
}
|
||||
|
||||
public double sizeY()
|
||||
{
|
||||
return maxY - minY;
|
||||
}
|
||||
|
||||
public double sizeZ()
|
||||
{
|
||||
return maxZ - minZ;
|
||||
}
|
||||
|
||||
public void setSideRender(Direction side, boolean value)
|
||||
{
|
||||
renderSides[side.ordinal()] = value;
|
||||
}
|
||||
|
||||
public boolean shouldSideRender(Direction side)
|
||||
{
|
||||
return renderSides[side.ordinal()];
|
||||
}
|
||||
|
||||
public void setTexture(TextureAtlasSprite tex)
|
||||
{
|
||||
Arrays.fill(textures, tex);
|
||||
}
|
||||
|
||||
public void setTextures(TextureAtlasSprite down, TextureAtlasSprite up, TextureAtlasSprite north, TextureAtlasSprite south, TextureAtlasSprite west, TextureAtlasSprite east)
|
||||
{
|
||||
textures[0] = down;
|
||||
textures[1] = up;
|
||||
textures[2] = north;
|
||||
textures[3] = south;
|
||||
textures[4] = west;
|
||||
textures[5] = east;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Model2D
|
||||
{
|
||||
public double minX, minY;
|
||||
public double maxX, maxY;
|
||||
|
||||
public ResourceLocation resource;
|
||||
|
||||
public double sizeX()
|
||||
{
|
||||
return maxX - minX;
|
||||
}
|
||||
|
||||
public double sizeY()
|
||||
{
|
||||
return maxY - minY;
|
||||
}
|
||||
|
||||
public void setTexture(ResourceLocation resource)
|
||||
{
|
||||
this.resource = resource;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,168 +0,0 @@
|
|||
package wayoftime.bloodmagic.client.render;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.vector.Matrix3f;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
import wayoftime.bloodmagic.client.render.BloodMagicRenderer.Model3D;
|
||||
|
||||
/**
|
||||
* Adapted from BuildCraft
|
||||
*/
|
||||
public class RenderResizableCuboid
|
||||
{
|
||||
public static final RenderResizableCuboid INSTANCE = new RenderResizableCuboid();
|
||||
private static final Vector3f VEC_ZERO = new Vector3f(0, 0, 0);
|
||||
private static final int U_MIN = 0;
|
||||
private static final int U_MAX = 1;
|
||||
private static final int V_MIN = 2;
|
||||
private static final int V_MAX = 3;
|
||||
|
||||
protected EntityRendererManager manager = Minecraft.getInstance().getRenderManager();
|
||||
|
||||
private static Vector3f withValue(Vector3f vector, Axis axis, float value)
|
||||
{
|
||||
if (axis == Axis.X)
|
||||
{
|
||||
return new Vector3f(value, vector.getY(), vector.getZ());
|
||||
} else if (axis == Axis.Y)
|
||||
{
|
||||
return new Vector3f(vector.getX(), value, vector.getZ());
|
||||
} else if (axis == Axis.Z)
|
||||
{
|
||||
return new Vector3f(vector.getX(), vector.getY(), value);
|
||||
}
|
||||
throw new RuntimeException("Was given a null axis! That was probably not intentional, consider this a bug! (Vector = "
|
||||
+ vector + ")");
|
||||
}
|
||||
|
||||
public static double getValue(Vector3d vector, Axis axis)
|
||||
{
|
||||
if (axis == Axis.X)
|
||||
{
|
||||
return vector.x;
|
||||
} else if (axis == Axis.Y)
|
||||
{
|
||||
return vector.y;
|
||||
} else if (axis == Axis.Z)
|
||||
{
|
||||
return vector.z;
|
||||
}
|
||||
throw new RuntimeException("Was given a null axis! That was probably not intentional, consider this a bug! (Vector = "
|
||||
+ vector + ")");
|
||||
}
|
||||
|
||||
public void renderCube(Model3D cube, MatrixStack matrix, IVertexBuilder buffer, int argb, int light, int overlay)
|
||||
{
|
||||
float red = BloodMagicRenderer.getRed(argb);
|
||||
float green = BloodMagicRenderer.getGreen(argb);
|
||||
float blue = BloodMagicRenderer.getBlue(argb);
|
||||
float alpha = BloodMagicRenderer.getAlpha(argb);
|
||||
Vector3d size = new Vector3d(cube.sizeX(), cube.sizeY(), cube.sizeZ());
|
||||
matrix.push();
|
||||
matrix.translate(cube.minX, cube.minY, cube.minZ);
|
||||
MatrixStack.Entry lastMatrix = matrix.getLast();
|
||||
Matrix4f matrix4f = lastMatrix.getMatrix();
|
||||
Matrix3f normal = lastMatrix.getNormal();
|
||||
for (Direction face : Direction.values())
|
||||
{
|
||||
if (cube.shouldSideRender(face))
|
||||
{
|
||||
int ordinal = face.ordinal();
|
||||
TextureAtlasSprite sprite = cube.textures[ordinal];
|
||||
if (sprite != null)
|
||||
{
|
||||
Axis u = face.getAxis() == Axis.X ? Axis.Z : Axis.X;
|
||||
Axis v = face.getAxis() == Axis.Y ? Axis.Z : Axis.Y;
|
||||
float other = face.getAxisDirection() == AxisDirection.POSITIVE
|
||||
? (float) getValue(size, face.getAxis())
|
||||
: 0;
|
||||
|
||||
// Swap the face if this is positive: the renderer returns indexes that ALWAYS
|
||||
// are for the negative face, so light it properly this way
|
||||
face = face.getAxisDirection() == AxisDirection.NEGATIVE ? face : face.getOpposite();
|
||||
Direction opposite = face.getOpposite();
|
||||
|
||||
float minU = sprite.getMinU();
|
||||
float maxU = sprite.getMaxU();
|
||||
// Flip the v
|
||||
float minV = sprite.getMaxV();
|
||||
float maxV = sprite.getMinV();
|
||||
double sizeU = getValue(size, u);
|
||||
double sizeV = getValue(size, v);
|
||||
// TODO: Look into this more, as it makes tiling of multiple objects not render
|
||||
// properly if they don't fit the full texture.
|
||||
// Example: Mechanical pipes rendering water or lava, makes it relatively easy
|
||||
// to see the texture artifacts
|
||||
for (int uIndex = 0; uIndex < sizeU; uIndex++)
|
||||
{
|
||||
float[] baseUV = new float[]
|
||||
{ minU, maxU, minV, maxV };
|
||||
double addU = 1;
|
||||
// If the size of the texture is greater than the cuboid goes on for then make
|
||||
// sure the texture positions are lowered
|
||||
if (uIndex + addU > sizeU)
|
||||
{
|
||||
addU = sizeU - uIndex;
|
||||
baseUV[U_MAX] = baseUV[U_MIN] + (baseUV[U_MAX] - baseUV[U_MIN]) * (float) addU;
|
||||
}
|
||||
for (int vIndex = 0; vIndex < sizeV; vIndex++)
|
||||
{
|
||||
float[] uv = Arrays.copyOf(baseUV, 4);
|
||||
double addV = 1;
|
||||
if (vIndex + addV > sizeV)
|
||||
{
|
||||
addV = sizeV - vIndex;
|
||||
uv[V_MAX] = uv[V_MIN] + (uv[V_MAX] - uv[V_MIN]) * (float) addV;
|
||||
}
|
||||
float[] xyz = new float[]
|
||||
{ uIndex, (float) (uIndex + addU), vIndex, (float) (vIndex + addV) };
|
||||
|
||||
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, true, false, red, green, blue, alpha, light, overlay);
|
||||
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, true, true, red, green, blue, alpha, light, overlay);
|
||||
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, false, true, red, green, blue, alpha, light, overlay);
|
||||
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, false, false, red, green, blue, alpha, light, overlay);
|
||||
|
||||
renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, false, false, red, green, blue, alpha, light, overlay);
|
||||
renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, false, true, red, green, blue, alpha, light, overlay);
|
||||
renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, true, true, red, green, blue, alpha, light, overlay);
|
||||
renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, true, false, red, green, blue, alpha, light, overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
matrix.pop();
|
||||
}
|
||||
|
||||
private void renderPoint(Matrix4f matrix4f, Matrix3f normal, IVertexBuilder buffer, Direction face, Axis u, Axis v,
|
||||
float other, float[] uv, float[] xyz, boolean minU, boolean minV, float red, float green, float blue,
|
||||
float alpha, int light, int overlay)
|
||||
{
|
||||
int U_ARRAY = minU ? U_MIN : U_MAX;
|
||||
int V_ARRAY = minV ? V_MIN : V_MAX;
|
||||
Vector3f vertex = withValue(VEC_ZERO, u, xyz[U_ARRAY]);
|
||||
vertex = withValue(vertex, v, xyz[V_ARRAY]);
|
||||
vertex = withValue(vertex, face.getAxis(), other);
|
||||
Vector3i normalForFace = face.getDirectionVec();
|
||||
// TODO: Figure out how and why this works, it gives about the same brightness
|
||||
// as we used to have but I don't understand why/how
|
||||
float adjustment = 2.5F;
|
||||
Vector3f norm = new Vector3f(normalForFace.getX() + adjustment, normalForFace.getY()
|
||||
+ adjustment, normalForFace.getZ() + adjustment);
|
||||
norm.normalize();
|
||||
buffer.pos(matrix4f, vertex.getX(), vertex.getY(), vertex.getZ()).color(red, green, blue, alpha).tex(uv[U_ARRAY], uv[V_ARRAY]).overlay(overlay).lightmap(light).normal(normal, norm.getX(), norm.getY(), norm.getZ()).endVertex();
|
||||
}
|
||||
}
|
|
@ -1,167 +0,0 @@
|
|||
package wayoftime.bloodmagic.client.render;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.vector.Matrix3f;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
import wayoftime.bloodmagic.client.render.BloodMagicRenderer.Model2D;
|
||||
|
||||
public class RenderResizableQuadrilateral
|
||||
{
|
||||
public static final RenderResizableQuadrilateral INSTANCE = new RenderResizableQuadrilateral();
|
||||
private static final Vector3f VEC_ZERO = new Vector3f(0, 0, 0);
|
||||
private static final int U_MIN = 0;
|
||||
private static final int U_MAX = 1;
|
||||
private static final int V_MIN = 2;
|
||||
private static final int V_MAX = 3;
|
||||
|
||||
protected EntityRendererManager manager = Minecraft.getInstance().getRenderManager();
|
||||
|
||||
private static Vector3f withValue(Vector3f vector, Axis axis, float value)
|
||||
{
|
||||
if (axis == Axis.X)
|
||||
{
|
||||
return new Vector3f(value, vector.getY(), vector.getZ());
|
||||
} else if (axis == Axis.Y)
|
||||
{
|
||||
return new Vector3f(vector.getX(), value, vector.getZ());
|
||||
} else if (axis == Axis.Z)
|
||||
{
|
||||
return new Vector3f(vector.getX(), vector.getY(), value);
|
||||
}
|
||||
throw new RuntimeException("Was given a null axis! That was probably not intentional, consider this a bug! (Vector = "
|
||||
+ vector + ")");
|
||||
}
|
||||
|
||||
public static double getValue(Vector3d vector, Axis axis)
|
||||
{
|
||||
if (axis == Axis.X)
|
||||
{
|
||||
return vector.x;
|
||||
} else if (axis == Axis.Y)
|
||||
{
|
||||
return vector.y;
|
||||
} else if (axis == Axis.Z)
|
||||
{
|
||||
return vector.z;
|
||||
}
|
||||
throw new RuntimeException("Was given a null axis! That was probably not intentional, consider this a bug! (Vector = "
|
||||
+ vector + ")");
|
||||
}
|
||||
|
||||
public void renderSquare(Model2D square, MatrixStack matrix, IVertexBuilder buffer, int argb, int light, int overlay)
|
||||
{
|
||||
float red = BloodMagicRenderer.getRed(argb);
|
||||
float green = BloodMagicRenderer.getGreen(argb);
|
||||
float blue = BloodMagicRenderer.getBlue(argb);
|
||||
float alpha = BloodMagicRenderer.getAlpha(argb);
|
||||
Vector3d size = new Vector3d(square.sizeX(), 0, square.sizeY());
|
||||
matrix.push();
|
||||
matrix.translate(square.minX, 0, square.minY);
|
||||
MatrixStack.Entry lastMatrix = matrix.getLast();
|
||||
Matrix4f matrix4f = lastMatrix.getMatrix();
|
||||
Matrix3f normal = lastMatrix.getNormal();
|
||||
Direction face = Direction.UP;
|
||||
// for (Direction face : Direction.values())
|
||||
|
||||
int ordinal = face.ordinal();
|
||||
// TextureAtlasSprite sprite = cube.textures[ordinal];
|
||||
ResourceLocation rl = square.resource;
|
||||
if (rl != null)
|
||||
{
|
||||
// Minecraft.getInstance().textureManager.bindTexture(rl);
|
||||
Axis u = face.getAxis() == Axis.X ? Axis.Z : Axis.X;
|
||||
Axis v = face.getAxis() == Axis.Y ? Axis.Z : Axis.Y;
|
||||
float other = face.getAxisDirection() == AxisDirection.POSITIVE ? (float) getValue(size, face.getAxis())
|
||||
: 0;
|
||||
|
||||
// Swap the face if this is positive: the renderer returns indexes that ALWAYS
|
||||
// are for the negative face, so light it properly this way
|
||||
face = face.getAxisDirection() == AxisDirection.NEGATIVE ? face : face.getOpposite();
|
||||
// Direction opposite = face.getOpposite();
|
||||
|
||||
float minU = 0;
|
||||
float maxU = 1;
|
||||
// Flip the v
|
||||
float minV = 1;
|
||||
float maxV = 0;
|
||||
// float minU = sprite.getMinU();
|
||||
// float maxU = sprite.getMaxU();
|
||||
// // Flip the v
|
||||
// float minV = sprite.getMaxV();
|
||||
// float maxV = sprite.getMinV();
|
||||
double sizeU = getValue(size, u);
|
||||
double sizeV = getValue(size, v);
|
||||
// TODO: Look into this more, as it makes tiling of multiple objects not render
|
||||
// properly if they don't fit the full texture.
|
||||
// Example: Mechanical pipes rendering water or lava, makes it relatively easy
|
||||
// to see the texture artifacts
|
||||
for (int uIndex = 0; uIndex < sizeU; uIndex++)
|
||||
{
|
||||
float[] baseUV = new float[]
|
||||
{ minU, maxU, minV, maxV };
|
||||
double addU = 1;
|
||||
// If the size of the texture is greater than the cuboid goes on for then make
|
||||
// sure the texture positions are lowered
|
||||
if (uIndex + addU > sizeU)
|
||||
{
|
||||
// addU = sizeU - uIndex;
|
||||
baseUV[U_MAX] = baseUV[U_MIN] + (baseUV[U_MAX] - baseUV[U_MIN]) * (float) addU;
|
||||
}
|
||||
for (int vIndex = 0; vIndex < sizeV; vIndex++)
|
||||
{
|
||||
float[] uv = Arrays.copyOf(baseUV, 4);
|
||||
double addV = 1;
|
||||
if (vIndex + addV > sizeV)
|
||||
{
|
||||
// addV = sizeV - vIndex;
|
||||
uv[V_MAX] = uv[V_MIN] + (uv[V_MAX] - uv[V_MIN]) * (float) addV;
|
||||
}
|
||||
float[] xyz = new float[]
|
||||
{ uIndex, (float) (uIndex + addU), vIndex, (float) (vIndex + addV) };
|
||||
|
||||
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, true, false, red, green, blue, alpha, light, overlay);
|
||||
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, true, true, red, green, blue, alpha, light, overlay);
|
||||
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, false, true, red, green, blue, alpha, light, overlay);
|
||||
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, false, false, red, green, blue, alpha, light, overlay);
|
||||
|
||||
// renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, false, false, red, green, blue, alpha, light, overlay);
|
||||
// renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, false, true, red, green, blue, alpha, light, overlay);
|
||||
// renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, true, true, red, green, blue, alpha, light, overlay);
|
||||
// renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, true, false, red, green, blue, alpha, light, overlay);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
matrix.pop();
|
||||
}
|
||||
|
||||
private void renderPoint(Matrix4f matrix4f, Matrix3f normal, IVertexBuilder buffer, Direction face, Axis u, Axis v, float other, float[] uv, float[] xyz, boolean minU, boolean minV, float red, float green, float blue, float alpha, int light, int overlay)
|
||||
{
|
||||
int U_ARRAY = minU ? U_MIN : U_MAX;
|
||||
int V_ARRAY = minV ? V_MIN : V_MAX;
|
||||
Vector3f vertex = withValue(VEC_ZERO, u, xyz[U_ARRAY]);
|
||||
vertex = withValue(vertex, v, xyz[V_ARRAY]);
|
||||
vertex = withValue(vertex, face.getAxis(), other);
|
||||
Vector3i normalForFace = face.getDirectionVec();
|
||||
// TODO: Figure out how and why this works, it gives about the same brightness
|
||||
// as we used to have but I don't understand why/how
|
||||
float adjustment = 2.5F;
|
||||
Vector3f norm = new Vector3f(normalForFace.getX() + adjustment, normalForFace.getY()
|
||||
+ adjustment, normalForFace.getZ() + adjustment);
|
||||
norm.normalize();
|
||||
buffer.pos(matrix4f, vertex.getX(), vertex.getY(), vertex.getZ()).color(red, green, blue, alpha).tex(uv[U_ARRAY], uv[V_ARRAY]).overlay(overlay).lightmap(light).normal(normal, norm.getX(), norm.getY(), norm.getZ()).endVertex();
|
||||
}
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
package wayoftime.bloodmagic.client.render.alchemyarray;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.vector.Quaternion;
|
||||
import wayoftime.bloodmagic.client.render.BloodMagicRenderer;
|
||||
import wayoftime.bloodmagic.client.render.BloodMagicRenderer.Model2D;
|
||||
import wayoftime.bloodmagic.client.render.RenderResizableQuadrilateral;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
|
||||
public class AlchemyArrayRenderer
|
||||
{
|
||||
public final ResourceLocation arrayResource;
|
||||
|
||||
public AlchemyArrayRenderer()
|
||||
{
|
||||
this(new ResourceLocation("bloodmagic", "textures/models/alchemyarrays/sightsigil.png"));
|
||||
}
|
||||
|
||||
public AlchemyArrayRenderer(ResourceLocation arrayResource)
|
||||
{
|
||||
this.arrayResource = arrayResource;
|
||||
}
|
||||
|
||||
public float getRotation(float craftTime)
|
||||
{
|
||||
float offset = 2;
|
||||
if (craftTime >= offset)
|
||||
{
|
||||
float modifier = (float) Math.pow(craftTime - offset, 1.5);
|
||||
return modifier * 1f;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getSecondaryRotation(float craftTime)
|
||||
{
|
||||
float offset = 50;
|
||||
if (craftTime >= offset)
|
||||
{
|
||||
float modifier = (float) Math.pow(craftTime - offset, 1.7);
|
||||
return modifier * 0.5f;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getSizeModifier(float craftTime)
|
||||
{
|
||||
if (craftTime >= 150 && craftTime <= 250)
|
||||
{
|
||||
return (200 - craftTime) / 50f;
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public float getVerticalOffset(float craftTime)
|
||||
{
|
||||
if (craftTime >= 5)
|
||||
{
|
||||
if (craftTime <= 40)
|
||||
{
|
||||
return (float) (-0.4 + (0.4) * Math.pow((craftTime - 5) / 35f, 3));
|
||||
} else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -0.4f;
|
||||
}
|
||||
|
||||
public void renderAt(TileAlchemyArray tileArray, double x, double y, double z, float craftTime, MatrixStack matrixStack, IRenderTypeBuffer renderer, int combinedLightIn, int combinedOverlayIn)
|
||||
{
|
||||
matrixStack.push();
|
||||
|
||||
matrixStack.translate(0.5, 0.5, 0.5);
|
||||
|
||||
float rot = getRotation(craftTime);
|
||||
float secondaryRot = getSecondaryRotation(craftTime);
|
||||
|
||||
float size = 1.0F * getSizeModifier(craftTime);
|
||||
Direction rotation = tileArray.getRotation();
|
||||
|
||||
matrixStack.push();
|
||||
matrixStack.translate(0, getVerticalOffset(craftTime), 0);
|
||||
matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), -rotation.getHorizontalAngle(), true));
|
||||
|
||||
matrixStack.push();
|
||||
|
||||
matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), rot, true));
|
||||
matrixStack.rotate(new Quaternion(Direction.NORTH.toVector3f(), secondaryRot, true));
|
||||
matrixStack.rotate(new Quaternion(Direction.EAST.toVector3f(), secondaryRot * 0.45812f, true));
|
||||
|
||||
IVertexBuilder twoDBuffer = renderer.getBuffer(RenderType.getEntityTranslucent(arrayResource));
|
||||
Model2D arrayModel = new BloodMagicRenderer.Model2D();
|
||||
arrayModel.minX = -0.5;
|
||||
arrayModel.maxX = +0.5;
|
||||
arrayModel.minY = -0.5;
|
||||
arrayModel.maxY = +0.5;
|
||||
arrayModel.resource = arrayResource;
|
||||
|
||||
matrixStack.scale(size, size, size);
|
||||
|
||||
RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, 0xFFFFFFFF, combinedLightIn, combinedOverlayIn);
|
||||
|
||||
matrixStack.pop();
|
||||
matrixStack.pop();
|
||||
matrixStack.pop();
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
package wayoftime.bloodmagic.client.render.block;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
|
||||
public class RenderFakeBlocks
|
||||
{
|
||||
public static void drawFakeBlock(TextureAtlasSprite texture, double minX, double minY, double minZ)
|
||||
{
|
||||
if (texture == null)
|
||||
return;
|
||||
|
||||
double maxX = minX + 1;
|
||||
double maxY = minY + 1;
|
||||
double maxZ = minZ + 1;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder wr = tessellator.getBuffer();
|
||||
|
||||
Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(texture.getName());
|
||||
|
||||
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
|
||||
float texMinU = texture.getMinU();
|
||||
float texMinV = texture.getMinV();
|
||||
float texMaxU = texture.getMaxU();
|
||||
float texMaxV = texture.getMaxV();
|
||||
|
||||
wr.pos(minX, minY, minZ).tex(texMinU, texMinV).endVertex();
|
||||
wr.pos(maxX, minY, minZ).tex(texMaxU, texMinV).endVertex();
|
||||
wr.pos(maxX, minY, maxZ).tex(texMaxU, texMaxV).endVertex();
|
||||
wr.pos(minX, minY, maxZ).tex(texMinU, texMaxV).endVertex();
|
||||
|
||||
wr.pos(minX, maxY, maxZ).tex(texMinU, texMaxV).endVertex();
|
||||
wr.pos(maxX, maxY, maxZ).tex(texMaxU, texMaxV).endVertex();
|
||||
wr.pos(maxX, maxY, minZ).tex(texMaxU, texMinV).endVertex();
|
||||
wr.pos(minX, maxY, minZ).tex(texMinU, texMinV).endVertex();
|
||||
|
||||
wr.pos(maxX, minY, minZ).tex(texMinU, texMaxV).endVertex();
|
||||
wr.pos(minX, minY, minZ).tex(texMaxU, texMaxV).endVertex();
|
||||
wr.pos(minX, maxY, minZ).tex(texMaxU, texMinV).endVertex();
|
||||
wr.pos(maxX, maxY, minZ).tex(texMinU, texMinV).endVertex();
|
||||
|
||||
wr.pos(minX, minY, maxZ).tex(texMinU, texMaxV).endVertex();
|
||||
wr.pos(maxX, minY, maxZ).tex(texMaxU, texMaxV).endVertex();
|
||||
wr.pos(maxX, maxY, maxZ).tex(texMaxU, texMinV).endVertex();
|
||||
wr.pos(minX, maxY, maxZ).tex(texMinU, texMinV).endVertex();
|
||||
|
||||
wr.pos(minX, minY, minZ).tex(texMinU, texMaxV).endVertex();
|
||||
wr.pos(minX, minY, maxZ).tex(texMaxU, texMaxV).endVertex();
|
||||
wr.pos(minX, maxY, maxZ).tex(texMaxU, texMinV).endVertex();
|
||||
wr.pos(minX, maxY, minZ).tex(texMinU, texMinV).endVertex();
|
||||
|
||||
wr.pos(maxX, minY, maxZ).tex(texMinU, texMaxV).endVertex();
|
||||
wr.pos(maxX, minY, minZ).tex(texMaxU, texMaxV).endVertex();
|
||||
wr.pos(maxX, maxY, minZ).tex(texMaxU, texMinV).endVertex();
|
||||
wr.pos(maxX, maxY, maxZ).tex(texMinU, texMinV).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package wayoftime.bloodmagic.client.render.entity;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.renderer.entity.SpriteRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.IRendersAsItem;
|
||||
|
||||
public class BloodLightRenderer<T extends Entity & IRendersAsItem> extends SpriteRenderer<T>
|
||||
{
|
||||
public BloodLightRenderer(EntityRendererManager renderManagerIn)
|
||||
{
|
||||
super(renderManagerIn, Minecraft.getInstance().getItemRenderer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(T entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn)
|
||||
{
|
||||
super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package wayoftime.bloodmagic.client.render.entity;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.renderer.entity.SpriteRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.IRendersAsItem;
|
||||
|
||||
public class SoulSnareRenderer<T extends Entity & IRendersAsItem> extends SpriteRenderer<T>
|
||||
{
|
||||
public SoulSnareRenderer(EntityRendererManager renderManagerIn)
|
||||
{
|
||||
super(renderManagerIn, Minecraft.getInstance().getItemRenderer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(T entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn)
|
||||
{
|
||||
super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
|
||||
}
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
package wayoftime.bloodmagic.client.screens;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemicalReactionChamber;
|
||||
import wayoftime.bloodmagic.tile.contailer.ContainerAlchemicalReactionChamber;
|
||||
import wayoftime.bloodmagic.util.handler.event.ClientHandler;
|
||||
|
||||
public class ScreenAlchemicalReactionChamber extends ScreenBase<ContainerAlchemicalReactionChamber>
|
||||
{
|
||||
private static final ResourceLocation background = new ResourceLocation(BloodMagic.MODID, "textures/gui/arc_gui.png");
|
||||
public TileAlchemicalReactionChamber tileARC;
|
||||
|
||||
public ScreenAlchemicalReactionChamber(ContainerAlchemicalReactionChamber container, PlayerInventory playerInventory, ITextComponent title)
|
||||
{
|
||||
super(container, playerInventory, title);
|
||||
tileARC = container.tileARC;
|
||||
this.xSize = 176;
|
||||
this.ySize = 205;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
// public
|
||||
|
||||
// public ScreenSoulForge(InventoryPlayer playerInventory, IInventory tileSoulForge)
|
||||
// {
|
||||
// super(new ContainerSoulForge(playerInventory, tileSoulForge));
|
||||
// this.tileSoulForge = tileSoulForge;
|
||||
// this.xSize = 176;
|
||||
// this.ySize = 205;
|
||||
// }
|
||||
//
|
||||
@Override
|
||||
public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
super.render(stack, mouseX, mouseY, partialTicks);
|
||||
List<ITextComponent> tooltip = new ArrayList<>();
|
||||
// FluidTank inputTank = new FluidTank(FluidAttributes.BUCKET_VOLUME * 2);
|
||||
// inputTank.fill(new FluidStack(Fluids.WATER, 1000), FluidAction.EXECUTE);
|
||||
|
||||
ClientHandler.handleGuiTank(stack, tileARC.inputTank, this.guiLeft + 8, this.guiTop
|
||||
+ 40, 16, 63, 194, 1, 16, 63, mouseX, mouseY, background.toString(), tooltip);
|
||||
ClientHandler.handleGuiTank(stack, tileARC.outputTank, this.guiLeft + 152, this.guiTop
|
||||
+ 15, 16, 63, 194, 1, 16, 63, mouseX, mouseY, background.toString(), tooltip);
|
||||
|
||||
if (!tooltip.isEmpty())
|
||||
GuiUtils.drawHoveringText(stack, tooltip, mouseX, mouseY, width, height, -1, font);
|
||||
}
|
||||
|
||||
//
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(MatrixStack stack, int mouseX, int mouseY)
|
||||
{
|
||||
this.font.func_243248_b(stack, new TranslationTextComponent("tile.bloodmagic.arc.name"), 8, 5, 4210752);
|
||||
this.font.func_243248_b(stack, new TranslationTextComponent("container.inventory"), 8, 111, 4210752);
|
||||
}
|
||||
|
||||
//
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(MatrixStack stack, float partialTicks, int mouseX, int mouseY)
|
||||
{
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
getMinecraft().getTextureManager().bindTexture(background);
|
||||
int i = (this.width - this.xSize) / 2;
|
||||
int j = (this.height - this.ySize) / 2;
|
||||
this.blit(stack, i, j, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
// FluidTank inputTank = new FluidTank(FluidAttributes.BUCKET_VOLUME * 2);
|
||||
// inputTank.fill(new FluidStack(Fluids.WATER, 1000), FluidAction.EXECUTE);
|
||||
|
||||
ClientHandler.handleGuiTank(stack, tileARC.inputTank, this.guiLeft + 8, this.guiTop
|
||||
+ 40, 16, 63, 194, 1, 16, 63, mouseX, mouseY, background.toString(), null);
|
||||
ClientHandler.handleGuiTank(stack, tileARC.outputTank, this.guiLeft + 152, this.guiTop
|
||||
+ 15, 16, 63, 194, 1, 16, 63, mouseX, mouseY, background.toString(), null);
|
||||
|
||||
// int l = this.getCookProgressScaled(90);
|
||||
// this.blit(stack, i + 115, j + 14 + 90 - l, 176, 90 - l, 18, l);
|
||||
}
|
||||
|
||||
////
|
||||
// public int getCookProgressScaled(int scale)
|
||||
// {
|
||||
// double progress = ((TileSoulForge) tileSoulForge).getProgressForGui();
|
||||
//// if (tileSoulForge != null)
|
||||
//// {
|
||||
//// System.out.println("Tile is NOT null");
|
||||
//// }
|
||||
//// double progress = ((float) this.container.data.get(0)) / ((float) this.container.data.get(1));
|
||||
//// System.out.println(this.container.data.get(0));
|
||||
// return (int) (progress * scale);
|
||||
// }
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
package wayoftime.bloodmagic.client.screens;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
|
||||
public abstract class ScreenBase<T extends Container> extends ContainerScreen<T>
|
||||
{
|
||||
private static final ResourceLocation background = new ResourceLocation(BloodMagic.MODID, "textures/gui/soulforge.png");
|
||||
|
||||
protected final T container;
|
||||
|
||||
public ScreenBase(T container, PlayerInventory playerInventory, ITextComponent title)
|
||||
{
|
||||
super(container, playerInventory, title);
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
public ResourceLocation getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.renderBackground(stack);
|
||||
super.render(stack, mouseX, mouseY, partialTicks);
|
||||
|
||||
this.renderHoveredTooltip(stack, mouseX, mouseY); // @mcp: func_230459_a_ = renderHoveredToolTip
|
||||
// if (mouseX > (guiLeft + 7) && mouseX < (guiLeft + 7) + 18 && mouseY > (guiTop + 7)
|
||||
// && mouseY < (guiTop + 7) + 73)
|
||||
// this.renderTooltip(stack, LanguageMap.getInstance().func_244260_a(Arrays.asList(new TranslationTextComponent("screen.diregoo.energy", MagicHelpers.withSuffix(this.container.getEnergy()), MagicHelpers.withSuffix(this.container.getMaxPower())))), mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(MatrixStack stack, float partialTicks, int mouseX, int mouseY)
|
||||
{
|
||||
// RenderSystem.color4f(1, 1, 1, 1);
|
||||
// getMinecraft().getTextureManager().bindTexture(getBackground());
|
||||
// this.blit(stack, guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
// int maxEnergy = this.container.getMaxPower(), height = 70;
|
||||
// if (maxEnergy > 0)
|
||||
// {
|
||||
// int remaining = (this.container.getEnergy() * height) / maxEnergy;
|
||||
// this.blit(stack, guiLeft + 8, guiTop + 78 - remaining, 176, 84 - remaining, 16, remaining + 1);
|
||||
// }
|
||||
}
|
||||
|
||||
//
|
||||
protected static TranslationTextComponent getTrans(String key, Object... args)
|
||||
{
|
||||
return new TranslationTextComponent(BloodMagic.MODID + "." + key, args);
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
package wayoftime.bloodmagic.client.screens;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.tile.TileSoulForge;
|
||||
import wayoftime.bloodmagic.tile.contailer.ContainerSoulForge;
|
||||
|
||||
public class ScreenSoulForge extends ScreenBase<ContainerSoulForge>
|
||||
{
|
||||
private static final ResourceLocation background = new ResourceLocation(BloodMagic.MODID, "textures/gui/soulforge.png");
|
||||
public IInventory tileSoulForge;
|
||||
|
||||
public ScreenSoulForge(ContainerSoulForge container, PlayerInventory playerInventory, ITextComponent title)
|
||||
{
|
||||
super(container, playerInventory, title);
|
||||
tileSoulForge = container.tileForge;
|
||||
this.xSize = 176;
|
||||
this.ySize = 205;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
// public
|
||||
|
||||
// public ScreenSoulForge(InventoryPlayer playerInventory, IInventory tileSoulForge)
|
||||
// {
|
||||
// super(new ContainerSoulForge(playerInventory, tileSoulForge));
|
||||
// this.tileSoulForge = tileSoulForge;
|
||||
// this.xSize = 176;
|
||||
// this.ySize = 205;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks)
|
||||
// {
|
||||
// this.drawDefaultBackground();
|
||||
// super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
// this.renderHoveredToolTip(mouseX, mouseY);
|
||||
// }
|
||||
//
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(MatrixStack stack, int mouseX, int mouseY)
|
||||
{
|
||||
this.font.func_243248_b(stack, new TranslationTextComponent("tile.bloodmagic.soulforge.name"), 8, 5, 4210752);
|
||||
this.font.func_243248_b(stack, new TranslationTextComponent("container.inventory"), 8, 111, 4210752);
|
||||
}
|
||||
|
||||
//
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(MatrixStack stack, float partialTicks, int mouseX, int mouseY)
|
||||
{
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
getMinecraft().getTextureManager().bindTexture(background);
|
||||
int i = (this.width - this.xSize) / 2;
|
||||
int j = (this.height - this.ySize) / 2;
|
||||
this.blit(stack, i, j, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int l = this.getCookProgressScaled(90);
|
||||
this.blit(stack, i + 115, j + 14 + 90 - l, 176, 90 - l, 18, l);
|
||||
}
|
||||
|
||||
//
|
||||
public int getCookProgressScaled(int scale)
|
||||
{
|
||||
double progress = ((TileSoulForge) tileSoulForge).getProgressForGui();
|
||||
// if (tileSoulForge != null)
|
||||
// {
|
||||
// System.out.println("Tile is NOT null");
|
||||
// }
|
||||
// double progress = ((float) this.container.data.get(0)) / ((float) this.container.data.get(1));
|
||||
// System.out.println(this.container.data.get(0));
|
||||
return (int) (progress * scale);
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
package wayoftime.bloodmagic.client.utils;
|
||||
|
||||
import java.util.OptionalDouble;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderState;
|
||||
import net.minecraft.client.renderer.RenderState.AlphaState;
|
||||
import net.minecraft.client.renderer.RenderState.CullState;
|
||||
import net.minecraft.client.renderer.RenderState.FogState;
|
||||
import net.minecraft.client.renderer.RenderState.LightmapState;
|
||||
import net.minecraft.client.renderer.RenderState.LineState;
|
||||
import net.minecraft.client.renderer.RenderState.ShadeModelState;
|
||||
import net.minecraft.client.renderer.RenderState.TextureState;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.inventory.container.PlayerContainer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
|
||||
public class BMRenderTypes
|
||||
{
|
||||
public static final RenderType SOLID_FULLBRIGHT;
|
||||
public static final RenderType TRANSLUCENT_LINES;
|
||||
public static final RenderType LINES;
|
||||
public static final RenderType TRANSLUCENT_TRIANGLES;
|
||||
public static final RenderType TRANSLUCENT_POSITION_COLOR;
|
||||
public static final RenderType TRANSLUCENT_NO_DEPTH;
|
||||
public static final RenderType CHUNK_MARKER;
|
||||
public static final RenderType VEIN_MARKER;
|
||||
public static final RenderType POSITION_COLOR_TEX_LIGHTMAP;
|
||||
public static final RenderType POSITION_COLOR_LIGHTMAP;
|
||||
public static final RenderType ITEM_DAMAGE_BAR;
|
||||
protected static final RenderState.ShadeModelState SHADE_ENABLED = new RenderState.ShadeModelState(true);
|
||||
protected static final RenderState.TextureState BLOCK_SHEET_MIPPED = new RenderState.TextureState(AtlasTexture.LOCATION_BLOCKS_TEXTURE, false, true);
|
||||
protected static final RenderState.LightmapState LIGHTMAP_DISABLED = new RenderState.LightmapState(false);
|
||||
protected static final RenderState.TransparencyState TRANSLUCENT_TRANSPARENCY = new RenderState.TransparencyState("translucent_transparency", () -> {
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
}, RenderSystem::disableBlend);
|
||||
protected static final RenderState.TransparencyState NO_TRANSPARENCY = new RenderState.TransparencyState("no_transparency", RenderSystem::disableBlend, () -> {
|
||||
});
|
||||
protected static final RenderState.DepthTestState DEPTH_ALWAYS = new RenderState.DepthTestState("", GL11.GL_ALWAYS);
|
||||
|
||||
static
|
||||
{
|
||||
RenderType.State fullbrightSolidState = RenderType.State.getBuilder().shadeModel(SHADE_ENABLED).lightmap(LIGHTMAP_DISABLED).texture(BLOCK_SHEET_MIPPED).build(true);
|
||||
SOLID_FULLBRIGHT = RenderType.makeType(BloodMagic.MODID + ":block_fullbright", DefaultVertexFormats.BLOCK, GL11.GL_QUADS, 256, fullbrightSolidState);
|
||||
RenderType.State translucentNoDepthState = RenderType.State.getBuilder().transparency(TRANSLUCENT_TRANSPARENCY).line(new LineState(OptionalDouble.of(2))).texture(new TextureState()).depthTest(DEPTH_ALWAYS).build(false);
|
||||
RenderType.State translucentNoTextureState = RenderType.State.getBuilder().transparency(TRANSLUCENT_TRANSPARENCY).texture(new TextureState()).build(false);
|
||||
TRANSLUCENT_LINES = RenderType.makeType(BloodMagic.MODID + ":translucent_lines", DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINES, 256, translucentNoDepthState);
|
||||
LINES = RenderType.makeType(BloodMagic.MODID + ":lines", DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINES, 256, RenderType.State.getBuilder().build(false));
|
||||
TRANSLUCENT_TRIANGLES = RenderType.makeType(BloodMagic.MODID + ":translucent_triangle_fan", DefaultVertexFormats.POSITION_COLOR, GL11.GL_TRIANGLES, 256, translucentNoDepthState);
|
||||
TRANSLUCENT_POSITION_COLOR = RenderType.makeType(BloodMagic.MODID + ":translucent_pos_color", DefaultVertexFormats.POSITION_COLOR, GL11.GL_QUADS, 256, translucentNoTextureState);
|
||||
TRANSLUCENT_NO_DEPTH = RenderType.makeType(BloodMagic.MODID + ":translucent_no_depth", DefaultVertexFormats.POSITION_COLOR, GL11.GL_QUADS, 256, translucentNoDepthState);
|
||||
RenderType.State chunkMarkerState = RenderType.State.getBuilder().texture(new TextureState()).transparency(TRANSLUCENT_TRANSPARENCY).cull(new CullState(false)).shadeModel(new ShadeModelState(true)).line(new LineState(OptionalDouble.of(5))).build(false);
|
||||
CHUNK_MARKER = RenderType.makeType(BloodMagic.MODID + ":chunk_marker", DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINES, 256, chunkMarkerState);
|
||||
VEIN_MARKER = RenderType.makeType(BloodMagic.MODID + ":vein_marker", DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINE_LOOP, 256, chunkMarkerState);
|
||||
POSITION_COLOR_TEX_LIGHTMAP = RenderType.makeType(BloodMagic.MODID + ":pos_color_tex_lightmap", DefaultVertexFormats.POSITION_COLOR_TEX_LIGHTMAP, GL11.GL_QUADS, 256, RenderType.State.getBuilder().texture(new TextureState(PlayerContainer.LOCATION_BLOCKS_TEXTURE, false, false)).lightmap(new LightmapState(true)).build(false));
|
||||
POSITION_COLOR_LIGHTMAP = RenderType.makeType(BloodMagic.MODID + ":pos_color_lightmap", DefaultVertexFormats.POSITION_COLOR_LIGHTMAP, GL11.GL_QUADS, 256, RenderType.State.getBuilder().texture(new TextureState()).lightmap(new LightmapState(true)).build(false));
|
||||
ITEM_DAMAGE_BAR = RenderType.makeType(BloodMagic.MODID + ":item_damage_bar", DefaultVertexFormats.POSITION_COLOR, GL11.GL_QUADS, 256, RenderType.State.getBuilder().depthTest(DEPTH_ALWAYS).texture(new TextureState()).alpha(new AlphaState(0)).transparency(NO_TRANSPARENCY).build(false));
|
||||
}
|
||||
|
||||
public static RenderType getGui(ResourceLocation texture)
|
||||
{
|
||||
return RenderType.makeType("gui_" + texture, DefaultVertexFormats.POSITION_COLOR_TEX, GL11.GL_QUADS, 256, RenderType.State.getBuilder().texture(new TextureState(texture, false, false)).alpha(new AlphaState(0.5F)).build(false));
|
||||
}
|
||||
|
||||
public static RenderType getLines(float lineWidth)
|
||||
{
|
||||
return RenderType.makeType("lines_color_pos_" + lineWidth, DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINES, 256, RenderType.State.getBuilder().line(new LineState(OptionalDouble.of(lineWidth))).texture(new TextureState()).build(false));
|
||||
}
|
||||
|
||||
public static RenderType getPoints(float pointSize)
|
||||
{
|
||||
// Not really a fog state, but using it like this makes using RenderType.State
|
||||
// with custom states possible
|
||||
FogState setPointSize = new FogState(BloodMagic.MODID + ":pointsize_" + pointSize, () -> GL11.glPointSize(pointSize), () -> {
|
||||
GL11.glPointSize(1);
|
||||
});
|
||||
return RenderType.makeType("point_pos_color_" + pointSize, DefaultVertexFormats.POSITION_COLOR, GL11.GL_POINTS, 256, RenderType.State.getBuilder().fog(setPointSize).texture(new TextureState()).build(false));
|
||||
}
|
||||
|
||||
public static RenderType getPositionTex(ResourceLocation texture)
|
||||
{
|
||||
return RenderType.makeType(BloodMagic.MODID + ":pos_tex_" + texture, DefaultVertexFormats.POSITION_TEX, GL11.GL_QUADS, 256, RenderType.State.getBuilder().texture(new TextureState(texture, false, false)).build(false));
|
||||
}
|
||||
|
||||
public static RenderType getFullbrightTranslucent(ResourceLocation resourceLocation)
|
||||
{
|
||||
RenderType.State glState = RenderType.State.getBuilder().transparency(TRANSLUCENT_TRANSPARENCY).texture(new TextureState(resourceLocation, false, false)).lightmap(new LightmapState(false)).build(false);
|
||||
return RenderType.makeType("BloodMagic:fullbright_translucent_" + resourceLocation, DefaultVertexFormats.BLOCK, GL11.GL_QUADS, 256, glState);
|
||||
}
|
||||
|
||||
public static IRenderTypeBuffer wrapWithStencil(IRenderTypeBuffer in, Consumer<IVertexBuilder> setupStencilArea, String name, int ref)
|
||||
{
|
||||
return wrapWithAdditional(in, "stencil_" + name + "_" + ref, () -> {
|
||||
GL11.glEnable(GL11.GL_STENCIL_TEST);
|
||||
RenderSystem.colorMask(false, false, false, false);
|
||||
RenderSystem.depthMask(false);
|
||||
GL11.glStencilFunc(GL11.GL_NEVER, 1, 0xFF);
|
||||
GL11.glStencilOp(GL11.GL_REPLACE, GL11.GL_KEEP, GL11.GL_KEEP);
|
||||
|
||||
GL11.glStencilMask(0xFF);
|
||||
RenderSystem.clear(GL11.GL_STENCIL_BUFFER_BIT, true);
|
||||
RenderSystem.disableTexture();
|
||||
Tessellator tes = Tessellator.getInstance();
|
||||
BufferBuilder bb = tes.getBuffer();
|
||||
bb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
|
||||
setupStencilArea.accept(bb);
|
||||
tes.draw();
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.colorMask(true, true, true, true);
|
||||
RenderSystem.depthMask(true);
|
||||
GL11.glStencilMask(0x00);
|
||||
GL11.glStencilFunc(GL11.GL_EQUAL, ref, 0xFF);
|
||||
}, () -> GL11.glDisable(GL11.GL_STENCIL_TEST));
|
||||
}
|
||||
|
||||
public static IRenderTypeBuffer disableLighting(IRenderTypeBuffer in)
|
||||
{
|
||||
return wrapWithAdditional(in, "no_lighting", RenderSystem::disableLighting, () -> {
|
||||
});
|
||||
}
|
||||
|
||||
public static IRenderTypeBuffer disableCull(IRenderTypeBuffer in)
|
||||
{
|
||||
return wrapWithAdditional(in, "no_cull", RenderSystem::disableCull, RenderSystem::enableCull);
|
||||
}
|
||||
|
||||
private static IRenderTypeBuffer wrapWithAdditional(IRenderTypeBuffer in, String name, Runnable setup, Runnable teardown)
|
||||
{
|
||||
return type -> {
|
||||
return in.getBuffer(new RenderType(BloodMagic.MODID + ":" + type + "_" + name, type.getVertexFormat(), type.getDrawMode(), type.getBufferSize(), type.isUseDelegate(), false, () -> {
|
||||
type.setupRenderState();
|
||||
setup.run();
|
||||
}, () -> {
|
||||
teardown.run();
|
||||
type.clearRenderState();
|
||||
})
|
||||
{
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.alchemyarray;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
|
||||
public abstract class AlchemyArrayEffect
|
||||
{
|
||||
public abstract AlchemyArrayEffect getNewCopy();
|
||||
|
||||
public abstract void readFromNBT(CompoundNBT compound);
|
||||
|
||||
public abstract void writeToNBT(CompoundNBT compound);
|
||||
|
||||
public abstract boolean update(TileAlchemyArray array, int activeCounter);
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.alchemyarray;
|
||||
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
|
||||
public class AlchemyArrayEffectCrafting extends AlchemyArrayEffect
|
||||
{
|
||||
public final ItemStack outputStack;
|
||||
public int tickLimit;
|
||||
|
||||
public AlchemyArrayEffectCrafting(ItemStack outputStack)
|
||||
{
|
||||
this(outputStack, 200);
|
||||
}
|
||||
|
||||
public AlchemyArrayEffectCrafting(ItemStack outputStack, int tickLimit)
|
||||
{
|
||||
this.outputStack = outputStack;
|
||||
this.tickLimit = tickLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(TileAlchemyArray tile, int ticksActive)
|
||||
{
|
||||
// TODO: Add recipe rechecking to verify nothing screwy is going on.
|
||||
if (tile.getWorld().isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ticksActive >= tickLimit)
|
||||
{
|
||||
BlockPos pos = tile.getPos();
|
||||
|
||||
ItemStack output = outputStack.copy();
|
||||
|
||||
ItemEntity outputEntity = new ItemEntity(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ()
|
||||
+ 0.5, output);
|
||||
|
||||
tile.getWorld().addEntity(outputEntity);
|
||||
// tile.getWorld().spawnEntity(outputEntity);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(CompoundNBT tag)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(CompoundNBT tag)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlchemyArrayEffect getNewCopy()
|
||||
{
|
||||
return new AlchemyArrayEffectCrafting(outputStack, tickLimit);
|
||||
}
|
||||
}
|
|
@ -1,162 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.HorizontalBlock;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.DirectionProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.AbstractFurnaceTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemicalReactionChamber;
|
||||
|
||||
public class BlockAlchemicalReactionChamber extends Block
|
||||
{
|
||||
public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING;
|
||||
public static final BooleanProperty LIT = BlockStateProperties.LIT;
|
||||
|
||||
public BlockAlchemicalReactionChamber()
|
||||
{
|
||||
super(Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2).sound(SoundType.STONE));
|
||||
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH).with(LIT, Boolean.valueOf(false)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(BlockState state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world)
|
||||
{
|
||||
return new TileAlchemicalReactionChamber();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerDestroy(IWorld world, BlockPos blockPos, BlockState blockState)
|
||||
{
|
||||
TileAlchemicalReactionChamber arc = (TileAlchemicalReactionChamber) world.getTileEntity(blockPos);
|
||||
if (arc != null)
|
||||
arc.dropItems();
|
||||
|
||||
super.onPlayerDestroy(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving)
|
||||
{
|
||||
if (!state.isIn(newState.getBlock()))
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
if (tileentity instanceof TileAlchemicalReactionChamber)
|
||||
{
|
||||
((TileAlchemicalReactionChamber) tileentity).dropItems();
|
||||
worldIn.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.onReplaced(state, worldIn, pos, newState, isMoving);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult blockRayTraceResult)
|
||||
{
|
||||
if (world.isRemote)
|
||||
return ActionResultType.SUCCESS;
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileAlchemicalReactionChamber))
|
||||
return ActionResultType.FAIL;
|
||||
|
||||
NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tile, pos);
|
||||
// player.openGui(BloodMagic.instance, Constants.Gui.SOUL_FORGE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context)
|
||||
{
|
||||
return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by ItemBlocks after a block is set in the world, to allow post-place
|
||||
* logic
|
||||
*/
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack)
|
||||
{
|
||||
if (stack.hasDisplayName())
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
if (tileentity instanceof AbstractFurnaceTileEntity)
|
||||
{
|
||||
((AbstractFurnaceTileEntity) tileentity).setCustomName(stack.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the blockstate with the given rotation from the passed blockstate. If
|
||||
* inapplicable, returns the passed blockstate.
|
||||
*
|
||||
* @deprecated call via {@link IBlockState#withRotation(Rotation)} whenever
|
||||
* possible. Implementing/overriding is fine.
|
||||
*/
|
||||
@Override
|
||||
public BlockState rotate(BlockState state, Rotation rot)
|
||||
{
|
||||
return state.with(FACING, rot.rotate(state.get(FACING)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the blockstate with the given mirror of the passed blockstate. If
|
||||
* inapplicable, returns the passed blockstate.
|
||||
*
|
||||
* @deprecated call via {@link IBlockState#withMirror(Mirror)} whenever
|
||||
* possible. Implementing/overriding is fine.
|
||||
*/
|
||||
@Override
|
||||
public BlockState mirror(BlockState state, Mirror mirrorIn)
|
||||
{
|
||||
return state.rotate(mirrorIn.toRotation(state.get(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
|
||||
{
|
||||
builder.add(FACING, LIT);
|
||||
}
|
||||
|
||||
public boolean eventReceived(BlockState state, World worldIn, BlockPos pos, int id, int param)
|
||||
{
|
||||
super.eventReceived(state, worldIn, pos, id, param);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity == null ? false : tileentity.receiveClientEvent(id, param);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
import wayoftime.bloodmagic.util.Utils;
|
||||
|
||||
public class BlockAlchemyArray extends Block
|
||||
{
|
||||
protected static final VoxelShape BODY = Block.makeCuboidShape(1, 0, 1, 15, 1, 15);
|
||||
|
||||
public BlockAlchemyArray()
|
||||
{
|
||||
super(Properties.create(Material.WOOL).hardnessAndResistance(1.0F, 0).doesNotBlockMovement());
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
|
||||
{
|
||||
return BODY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(BlockState state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world)
|
||||
{
|
||||
return new TileAlchemyArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state)
|
||||
{
|
||||
return BlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult blockRayTraceResult)
|
||||
{
|
||||
TileAlchemyArray array = (TileAlchemyArray) world.getTileEntity(pos);
|
||||
|
||||
if (array == null || player.isSneaking())
|
||||
return ActionResultType.FAIL;
|
||||
|
||||
ItemStack playerItem = player.getHeldItem(hand);
|
||||
|
||||
if (!playerItem.isEmpty())
|
||||
{
|
||||
if (array.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
Utils.insertItemToTile(array, player, 0);
|
||||
world.notifyBlockUpdate(pos, state, state, 3);
|
||||
} else if (!array.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
Utils.insertItemToTile(array, player, 1);
|
||||
array.attemptCraft();
|
||||
world.notifyBlockUpdate(pos, state, state, 3);
|
||||
} else
|
||||
{
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
world.notifyBlockUpdate(pos, state, state, 3);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerDestroy(IWorld world, BlockPos blockPos, BlockState blockState)
|
||||
{
|
||||
TileAlchemyArray alchemyArray = (TileAlchemyArray) world.getTileEntity(blockPos);
|
||||
if (alchemyArray != null)
|
||||
alchemyArray.dropItems();
|
||||
|
||||
super.onPlayerDestroy(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving)
|
||||
{
|
||||
if (!state.isIn(newState.getBlock()))
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
if (tileentity instanceof TileAlchemyArray)
|
||||
{
|
||||
((TileAlchemyArray) tileentity).dropItems();
|
||||
worldIn.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.onReplaced(state, worldIn, pos, newState, isMoving);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import wayoftime.bloodmagic.iface.IAltarReader;
|
||||
import wayoftime.bloodmagic.tile.TileAltar;
|
||||
import wayoftime.bloodmagic.util.Utils;
|
||||
|
||||
public class BlockAltar extends Block
|
||||
{
|
||||
protected static final VoxelShape BODY = Block.makeCuboidShape(0, 0, 0, 16, 12, 16);
|
||||
|
||||
public BlockAltar()
|
||||
{
|
||||
super(Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
|
||||
{
|
||||
return BODY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(BlockState state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world)
|
||||
{
|
||||
return new TileAltar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult blockRayTraceResult)
|
||||
{
|
||||
TileAltar altar = (TileAltar) world.getTileEntity(pos);
|
||||
|
||||
if (altar == null || player.isSneaking())
|
||||
return ActionResultType.FAIL;
|
||||
|
||||
ItemStack playerItem = player.getHeldItem(hand);
|
||||
|
||||
if (playerItem.getItem() instanceof IAltarReader)// || playerItem.getItem() instanceof IAltarManipulator)
|
||||
{
|
||||
playerItem.getItem().onItemRightClick(world, player, hand);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
if (Utils.insertItemToTile(altar, player))
|
||||
altar.startCycle();
|
||||
else
|
||||
altar.setActive();
|
||||
|
||||
world.notifyBlockUpdate(pos, state, state, 3);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerDestroy(IWorld world, BlockPos blockPos, BlockState blockState)
|
||||
{
|
||||
TileAltar altar = (TileAltar) world.getTileEntity(blockPos);
|
||||
if (altar != null)
|
||||
altar.dropItems();
|
||||
|
||||
super.onPlayerDestroy(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving)
|
||||
{
|
||||
if (!state.isIn(newState.getBlock()))
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
if (tileentity instanceof TileAltar)
|
||||
{
|
||||
((TileAltar) tileentity).dropItems();
|
||||
worldIn.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.onReplaced(state, worldIn, pos, newState, isMoving);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.particles.RedstoneParticleData;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockBloodLight extends Block
|
||||
{
|
||||
protected static final VoxelShape BODY = Block.makeCuboidShape(7, 7, 7, 9, 9, 9);
|
||||
|
||||
public BlockBloodLight()
|
||||
{
|
||||
super(Properties.create(Material.WOOL).doesNotBlockMovement().setLightLevel((state) -> {
|
||||
return 15;
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
|
||||
{
|
||||
return BODY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state)
|
||||
{
|
||||
return BlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void animateTick(BlockState stateIn, World world, BlockPos pos, Random rand)
|
||||
{
|
||||
ClientPlayerEntity player = Minecraft.getInstance().player;
|
||||
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
world.addParticle(RedstoneParticleData.REDSTONE_DUST, pos.getX() + 0.5D
|
||||
+ rand.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0, 0, 0);
|
||||
ItemStack heldItem = player.getHeldItem(Hand.MAIN_HAND);
|
||||
|
||||
// if (heldItem.isEmpty() || heldItem.getItem() != RegistrarBloodMagicItems.SIGIL_BLOOD_LIGHT)
|
||||
// return;
|
||||
//
|
||||
// for (int i = 0; i < 8; i++) world.addParticle(RedstoneParticleData.REDSTONE_DUST, pos.getX() + 0.5D
|
||||
// + rand.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import wayoftime.bloodmagic.block.enums.BloodRuneType;
|
||||
import wayoftime.bloodmagic.iface.IBloodRune;
|
||||
|
||||
public class BlockBloodRune extends Block implements IBloodRune
|
||||
{
|
||||
private final BloodRuneType type;
|
||||
|
||||
public BlockBloodRune(BloodRuneType type)
|
||||
{
|
||||
super(Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2).sound(SoundType.STONE));
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BloodRuneType getBloodRune(World world, BlockPos pos)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable IBlockReader world, List<ITextComponent> tooltip,
|
||||
ITooltipFlag flag)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.decoration.safe"));
|
||||
super.addInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.item.ItemActivationCrystal;
|
||||
import wayoftime.bloodmagic.iface.IBindable;
|
||||
import wayoftime.bloodmagic.ritual.Ritual;
|
||||
import wayoftime.bloodmagic.tile.TileMasterRitualStone;
|
||||
import wayoftime.bloodmagic.util.helper.RitualHelper;
|
||||
|
||||
public class BlockMasterRitualStone extends Block
|
||||
{
|
||||
public final boolean isInverted;
|
||||
|
||||
public BlockMasterRitualStone(boolean isInverted)
|
||||
{
|
||||
super(Properties.create(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2));
|
||||
this.isInverted = isInverted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult blockRayTraceResult)
|
||||
{
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileMasterRitualStone)
|
||||
{
|
||||
if (heldItem.getItem() instanceof ItemActivationCrystal)
|
||||
{
|
||||
if (((IBindable) heldItem.getItem()).getBinding(heldItem) == null)
|
||||
return ActionResultType.FAIL;
|
||||
|
||||
String key = RitualHelper.getValidRitual(world, pos);
|
||||
if (!key.isEmpty())
|
||||
{
|
||||
Ritual ritual = BloodMagic.RITUAL_MANAGER.getRitual(key);
|
||||
if (ritual != null)
|
||||
{
|
||||
Direction direction = RitualHelper.getDirectionOfRitual(world, pos, ritual);
|
||||
// TODO: Give a message stating that this ritual is not a valid ritual.
|
||||
if (direction != null && RitualHelper.checkValidRitual(world, pos, ritual, direction))
|
||||
{
|
||||
if (((TileMasterRitualStone) tile).activateRitual(heldItem, player, BloodMagic.RITUAL_MANAGER.getRitual(key)))
|
||||
{
|
||||
((TileMasterRitualStone) tile).setDirection(direction);
|
||||
if (isInverted)
|
||||
((TileMasterRitualStone) tile).setInverted(true);
|
||||
}
|
||||
} else
|
||||
{
|
||||
player.sendStatusMessage(new TranslationTextComponent("chat.bloodmagic.ritual.notvalid"), true);
|
||||
}
|
||||
} else
|
||||
{
|
||||
player.sendStatusMessage(new TranslationTextComponent("chat.bloodmagic.ritual.notvalid"), true);
|
||||
}
|
||||
} else
|
||||
{
|
||||
player.sendStatusMessage(new TranslationTextComponent("chat.bloodmagic.ritual.notvalid"), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerDestroy(IWorld world, BlockPos blockPos, BlockState blockState)
|
||||
{
|
||||
TileMasterRitualStone tile = (TileMasterRitualStone) world.getTileEntity(blockPos);
|
||||
if (tile != null)
|
||||
((TileMasterRitualStone) tile).stopRitual(Ritual.BreakType.BREAK_MRS);
|
||||
|
||||
super.onPlayerDestroy(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving)
|
||||
{
|
||||
if (!state.isIn(newState.getBlock()))
|
||||
{
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileMasterRitualStone)
|
||||
{
|
||||
((TileMasterRitualStone) tile).stopRitual(Ritual.BreakType.BREAK_MRS);
|
||||
}
|
||||
|
||||
super.onReplaced(state, worldIn, pos, newState, isMoving);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExplosionDestroy(World world, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileMasterRitualStone)
|
||||
((TileMasterRitualStone) tile).stopRitual(Ritual.BreakType.EXPLOSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(BlockState state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world)
|
||||
{
|
||||
return new TileMasterRitualStone();
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import wayoftime.bloodmagic.ritual.EnumRuneType;
|
||||
import wayoftime.bloodmagic.ritual.IRitualStone;
|
||||
|
||||
public class BlockRitualStone extends Block implements IRitualStone
|
||||
{
|
||||
private final EnumRuneType type;
|
||||
|
||||
public BlockRitualStone(EnumRuneType type)
|
||||
{
|
||||
super(Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 5.0F).sound(SoundType.STONE).harvestTool(ToolType.PICKAXE).harvestLevel(2));
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable IBlockReader world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.decoration.safe"));
|
||||
super.addInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public int damageDropped(BlockState state)
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canSilkHarvest(World world, BlockPos pos, BlockState state, PlayerEntity player)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isRuneType(World world, BlockPos pos, EnumRuneType runeType)
|
||||
{
|
||||
return type.equals(runeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRuneType(World world, BlockPos pos, EnumRuneType runeType)
|
||||
{
|
||||
Block runeBlock = this;
|
||||
switch (runeType)
|
||||
{
|
||||
case AIR:
|
||||
runeBlock = BloodMagicBlocks.AIR_RITUAL_STONE.get();
|
||||
break;
|
||||
case BLANK:
|
||||
runeBlock = BloodMagicBlocks.BLANK_RITUAL_STONE.get();
|
||||
break;
|
||||
case DAWN:
|
||||
runeBlock = BloodMagicBlocks.DAWN_RITUAL_STONE.get();
|
||||
break;
|
||||
case DUSK:
|
||||
runeBlock = BloodMagicBlocks.DUSK_RITUAL_STONE.get();
|
||||
break;
|
||||
case EARTH:
|
||||
runeBlock = BloodMagicBlocks.EARTH_RITUAL_STONE.get();
|
||||
break;
|
||||
case FIRE:
|
||||
runeBlock = BloodMagicBlocks.FIRE_RITUAL_STONE.get();
|
||||
break;
|
||||
case WATER:
|
||||
runeBlock = BloodMagicBlocks.WATER_RITUAL_STONE.get();
|
||||
break;
|
||||
}
|
||||
|
||||
BlockState newState = runeBlock.getDefaultState();
|
||||
world.setBlockState(pos, newState);
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
import wayoftime.bloodmagic.tile.TileSoulForge;
|
||||
|
||||
public class BlockSoulForge extends Block// implements IBMBlock
|
||||
{
|
||||
protected static final VoxelShape BODY = Block.makeCuboidShape(1, 0, 1, 15, 12, 15);
|
||||
|
||||
public BlockSoulForge()
|
||||
{
|
||||
super(Properties.create(Material.IRON).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
|
||||
{
|
||||
return BODY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(BlockState state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world)
|
||||
{
|
||||
return new TileSoulForge();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state)
|
||||
{
|
||||
return BlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult blockRayTraceResult)
|
||||
{
|
||||
if (world.isRemote)
|
||||
return ActionResultType.SUCCESS;
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileSoulForge))
|
||||
return ActionResultType.FAIL;
|
||||
|
||||
NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tile, pos);
|
||||
// player.openGui(BloodMagic.instance, Constants.Gui.SOUL_FORGE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerDestroy(IWorld world, BlockPos blockPos, BlockState blockState)
|
||||
{
|
||||
TileSoulForge forge = (TileSoulForge) world.getTileEntity(blockPos);
|
||||
if (forge != null)
|
||||
forge.dropItems();
|
||||
|
||||
super.onPlayerDestroy(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving)
|
||||
{
|
||||
if (!state.isIn(newState.getBlock()))
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
if (tileentity instanceof TileSoulForge)
|
||||
{
|
||||
((TileSoulForge) tileentity).dropItems();
|
||||
worldIn.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.onReplaced(state, worldIn, pos, newState, isMoving);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.FlowingFluidBlock;
|
||||
import net.minecraft.fluid.FlowingFluid;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.BucketItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.extensions.IForgeContainerType;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.block.enums.BloodRuneType;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
import wayoftime.bloodmagic.ritual.EnumRuneType;
|
||||
import wayoftime.bloodmagic.tile.contailer.ContainerAlchemicalReactionChamber;
|
||||
import wayoftime.bloodmagic.tile.contailer.ContainerSoulForge;
|
||||
|
||||
public class BloodMagicBlocks
|
||||
{
|
||||
public static final ResourceLocation FLUID_STILL = new ResourceLocation("bloodmagic:block/lifeessencestill");
|
||||
public static final ResourceLocation FLUID_FLOWING = new ResourceLocation("bloodmagic:block/lifeessenceflowing");
|
||||
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, BloodMagic.MODID);
|
||||
public static final DeferredRegister<Block> BASICBLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, BloodMagic.MODID);
|
||||
public static final DeferredRegister<Item> ITEMS = BloodMagicItems.ITEMS;
|
||||
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, BloodMagic.MODID);
|
||||
public static final DeferredRegister<ContainerType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, BloodMagic.MODID);
|
||||
|
||||
// public static final RegistryObject<Block> BLOODSTONE = BASICBLOCKS.register("ruby_block", BloodstoneBlock::new);
|
||||
public static final RegistryObject<Block> SOUL_FORGE = BLOCKS.register("soulforge", BlockSoulForge::new);
|
||||
public static final RegistryObject<Block> ALCHEMY_ARRAY = BLOCKS.register("alchemyarray", BlockAlchemyArray::new);
|
||||
public static final RegistryObject<Block> BLANK_RUNE = BASICBLOCKS.register("blankrune", () -> new BlockBloodRune(BloodRuneType.BLANK));
|
||||
public static final RegistryObject<Block> SPEED_RUNE = BASICBLOCKS.register("speedrune", () -> new BlockBloodRune(BloodRuneType.SPEED));
|
||||
public static final RegistryObject<Block> SACRIFICE_RUNE = BASICBLOCKS.register("sacrificerune", () -> new BlockBloodRune(BloodRuneType.SACRIFICE));
|
||||
public static final RegistryObject<Block> SELF_SACRIFICE_RUNE = BASICBLOCKS.register("selfsacrificerune", () -> new BlockBloodRune(BloodRuneType.SELF_SACRIFICE));
|
||||
public static final RegistryObject<Block> DISPLACEMENT_RUNE = BASICBLOCKS.register("dislocationrune", () -> new BlockBloodRune(BloodRuneType.DISPLACEMENT));
|
||||
public static final RegistryObject<Block> CAPACITY_RUNE = BASICBLOCKS.register("altarcapacityrune", () -> new BlockBloodRune(BloodRuneType.CAPACITY));
|
||||
public static final RegistryObject<Block> AUGMENTED_CAPACITY_RUNE = BASICBLOCKS.register("bettercapacityrune", () -> new BlockBloodRune(BloodRuneType.AUGMENTED_CAPACITY));
|
||||
public static final RegistryObject<Block> ORB_RUNE = BASICBLOCKS.register("orbcapacityrune", () -> new BlockBloodRune(BloodRuneType.ORB));
|
||||
public static final RegistryObject<Block> ACCELERATION_RUNE = BASICBLOCKS.register("accelerationrune", () -> new BlockBloodRune(BloodRuneType.ACCELERATION));
|
||||
public static final RegistryObject<Block> CHARGING_RUNE = BASICBLOCKS.register("chargingrune", () -> new BlockBloodRune(BloodRuneType.CHARGING));
|
||||
|
||||
public static final RegistryObject<Block> BLOOD_ALTAR = BLOCKS.register("altar", () -> new BlockAltar());
|
||||
public static final RegistryObject<Block> BLOOD_LIGHT = BLOCKS.register("bloodlight", () -> new BlockBloodLight());
|
||||
|
||||
public static final RegistryObject<Block> BLANK_RITUAL_STONE = BLOCKS.register("ritualstone", () -> new BlockRitualStone(EnumRuneType.BLANK));
|
||||
public static final RegistryObject<Block> AIR_RITUAL_STONE = BLOCKS.register("airritualstone", () -> new BlockRitualStone(EnumRuneType.AIR));
|
||||
public static final RegistryObject<Block> WATER_RITUAL_STONE = BLOCKS.register("waterritualstone", () -> new BlockRitualStone(EnumRuneType.WATER));
|
||||
public static final RegistryObject<Block> FIRE_RITUAL_STONE = BLOCKS.register("fireritualstone", () -> new BlockRitualStone(EnumRuneType.FIRE));
|
||||
public static final RegistryObject<Block> EARTH_RITUAL_STONE = BLOCKS.register("earthritualstone", () -> new BlockRitualStone(EnumRuneType.EARTH));
|
||||
public static final RegistryObject<Block> DUSK_RITUAL_STONE = BLOCKS.register("duskritualstone", () -> new BlockRitualStone(EnumRuneType.DUSK));
|
||||
public static final RegistryObject<Block> DAWN_RITUAL_STONE = BLOCKS.register("lightritualstone", () -> new BlockRitualStone(EnumRuneType.DAWN));
|
||||
|
||||
public static final RegistryObject<Block> MASTER_RITUAL_STONE = BASICBLOCKS.register("masterritualstone", () -> new BlockMasterRitualStone(false));
|
||||
|
||||
public static final RegistryObject<Block> ALCHEMICAL_REACTION_CHAMBER = BLOCKS.register("alchemicalreactionchamber", () -> new BlockAlchemicalReactionChamber());
|
||||
|
||||
private static ForgeFlowingFluid.Properties makeProperties()
|
||||
{
|
||||
return new ForgeFlowingFluid.Properties(LIFE_ESSENCE_FLUID, LIFE_ESSENCE_FLUID_FLOWING, FluidAttributes.builder(FLUID_STILL, FLUID_FLOWING)).bucket(LIFE_ESSENCE_BUCKET).block(LIFE_ESSENCE_BLOCK);
|
||||
}
|
||||
|
||||
public static RegistryObject<FlowingFluid> LIFE_ESSENCE_FLUID = FLUIDS.register("life_essence_fluid", () -> new ForgeFlowingFluid.Source(makeProperties()));
|
||||
public static RegistryObject<FlowingFluid> LIFE_ESSENCE_FLUID_FLOWING = FLUIDS.register("life_essence_fluid_flowing", () -> new ForgeFlowingFluid.Flowing(makeProperties()));
|
||||
|
||||
public static RegistryObject<FlowingFluidBlock> LIFE_ESSENCE_BLOCK = BLOCKS.register("life_essence_block", () -> new FlowingFluidBlock(LIFE_ESSENCE_FLUID, Block.Properties.create(net.minecraft.block.material.Material.WATER).doesNotBlockMovement().hardnessAndResistance(100.0F).noDrops()));
|
||||
public static RegistryObject<Item> LIFE_ESSENCE_BUCKET = ITEMS.register("life_essence_bucket", () -> new BucketItem(LIFE_ESSENCE_FLUID, new Item.Properties().containerItem(Items.BUCKET).maxStackSize(1).group(BloodMagic.TAB)));
|
||||
|
||||
public static final RegistryObject<ContainerType<ContainerSoulForge>> SOUL_FORGE_CONTAINER = CONTAINERS.register("soul_forge_container", () -> IForgeContainerType.create(ContainerSoulForge::new));
|
||||
public static final RegistryObject<ContainerType<ContainerAlchemicalReactionChamber>> ARC_CONTAINER = CONTAINERS.register("arc_container", () -> IForgeContainerType.create(ContainerAlchemicalReactionChamber::new));
|
||||
// public static final RegistryObject<BloodstoneBlock> BLOOD_STONE = registerNoItem("blood_stone", () -> new BloodstoneBlock());
|
||||
//
|
||||
//// private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Function<RegistryObject<T>, Supplier<? extends Item>> itemCreator)
|
||||
//// {
|
||||
//// RegistryObject<T> ret = registerNoItem(name, sup);
|
||||
//// ITEMS.register(name, itemCreator.apply(ret));
|
||||
//// return ret;
|
||||
//// }
|
||||
//
|
||||
// private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Function<RegistryObject<T>, Supplier<? extends Item>> itemCreator)
|
||||
// {
|
||||
// RegistryObject<T> ret = registerNoItem(name, sup);
|
||||
// ITEMS.register(name, itemCreator.apply(ret));
|
||||
// return ret;
|
||||
// }
|
||||
//
|
||||
// private static <T extends Block> RegistryObject<T> registerNoItem(String name, Supplier<? extends T> sup)
|
||||
// {
|
||||
// return BLOCKS.register(name, sup);
|
||||
// }
|
||||
|
||||
// private static Supplier<BlockItem> item(final RegistryObject<? extends Block> block, final Supplier<Callable<ItemStackTileEntityRenderer>> renderMethod)
|
||||
// {
|
||||
// return () -> new BlockItem(block.get(), new Item.Properties().group(IronChests.IRONCHESTS_ITEM_GROUP).setISTER(renderMethod));
|
||||
// }
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BloodstoneBlock extends Block
|
||||
{
|
||||
public BloodstoneBlock()
|
||||
{
|
||||
super(Properties.create(Material.ROCK));
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.data.ShapedRecipeBuilder;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.data.recipe.BaseRecipeProvider;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
import wayoftime.bloodmagic.core.recipe.IngredientBloodOrb;
|
||||
|
||||
public class GeneratorBaseRecipes extends BaseRecipeProvider
|
||||
{
|
||||
public GeneratorBaseRecipes(DataGenerator gen)
|
||||
{
|
||||
super(gen, BloodMagic.MODID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes(Consumer<IFinishedRecipe> consumer)
|
||||
{
|
||||
addVanillaRecipes(consumer);
|
||||
addBloodOrbRecipes(consumer);
|
||||
}
|
||||
|
||||
private void addVanillaRecipes(Consumer<IFinishedRecipe> consumer)
|
||||
{
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.SACRIFICIAL_DAGGER.get()).key('g', Tags.Items.GLASS).key('G', Tags.Items.INGOTS_GOLD).key('i', Tags.Items.INGOTS_IRON).patternLine("ggg").patternLine(" Gg").patternLine("i g").addCriterion("has_glass", hasItem(Items.GLASS)).build(consumer, BloodMagic.rl("sacrificial_dagger"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.BLOOD_ALTAR.get()).key('a', Tags.Items.STONE).key('b', Items.FURNACE).key('c', Tags.Items.INGOTS_GOLD).key('d', BloodMagicItems.MONSTER_SOUL_RAW.get()).patternLine("a a").patternLine("aba").patternLine("cdc").addCriterion("has_will", hasItem(BloodMagicItems.MONSTER_SOUL_RAW.get())).build(consumer, BloodMagic.rl("blood_altar"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SOUL_FORGE.get()).key('s', Tags.Items.STONE).key('g', Tags.Items.INGOTS_GOLD).key('i', Tags.Items.INGOTS_IRON).key('o', Tags.Items.STORAGE_BLOCKS_IRON).patternLine("i i").patternLine("sgs").patternLine("sos").addCriterion("has_gold", hasItem(Items.GOLD_INGOT)).build(consumer, BloodMagic.rl("soul_forge"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.SOUL_SNARE.get(), 4).key('r', Tags.Items.DUSTS_REDSTONE).key('s', Tags.Items.STRING).key('i', Tags.Items.INGOTS_IRON).patternLine("sis").patternLine("iri").patternLine("sis").addCriterion("has_redstone", hasItem(Items.REDSTONE)).build(consumer, BloodMagic.rl("soul_snare"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.BASE_RITUAL_DIVINER.get()).key('a', BloodMagicItems.AIR_INSCRIPTION_TOOL.get()).key('s', Tags.Items.RODS_WOODEN).key('d', Tags.Items.GEMS_DIAMOND).key('e', BloodMagicItems.EARTH_INSCRIPTION_TOOL.get()).key('f', BloodMagicItems.FIRE_INSCRIPTION_TOOL.get()).key('w', BloodMagicItems.WATER_INSCRIPTION_TOOL.get()).patternLine("dfd").patternLine("ase").patternLine("dwd").addCriterion("has_scribe", hasItem(BloodMagicItems.AIR_INSCRIPTION_TOOL.get())).build(consumer, BloodMagic.rl("ritual_diviner_0"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.DUSK_RITUAL_DIVINER.get()).key('S', BloodMagicItems.DEMONIC_SLATE.get()).key('t', BloodMagicItems.DUSK_INSCRIPTION_TOOL.get()).key('d', BloodMagicItems.BASE_RITUAL_DIVINER.get()).patternLine(" S ").patternLine("tdt").patternLine(" S ").addCriterion("has_demon_slate", hasItem(BloodMagicItems.DEMONIC_SLATE.get())).build(consumer, BloodMagic.rl("ritual_diviner_1"));
|
||||
}
|
||||
|
||||
private void addBloodOrbRecipes(Consumer<IFinishedRecipe> consumer)
|
||||
{
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.BLANK_RUNE.get()).key('a', Tags.Items.STONE).key('s', Ingredient.fromItems(BloodMagicItems.SLATE.get())).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).patternLine("aaa").patternLine("sos").patternLine("aaa").addCriterion("has_weak_orb", hasItem(BloodMagicItems.WEAK_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("blood_rune_blank"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SPEED_RUNE.get()).key('a', Tags.Items.STONE).key('b', Ingredient.fromItems(BloodMagicItems.SLATE.get())).key('c', Ingredient.fromItems(Items.SUGAR)).key('d', BloodMagicBlocks.BLANK_RUNE.get()).patternLine("aba").patternLine("cdc").patternLine("aba").addCriterion("has_blank_rune", hasItem(BloodMagicItems.BLANK_RUNE_ITEM.get())).build(consumer, BloodMagic.rl("blood_rune_speed"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SACRIFICE_RUNE.get()).key('a', Tags.Items.STONE).key('b', BloodMagicItems.REINFORCED_SLATE.get()).key('c', Tags.Items.INGOTS_GOLD).key('d', BloodMagicBlocks.BLANK_RUNE.get()).key('e', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_APPRENTICE.get())).patternLine("aba").patternLine("cdc").patternLine("aea").addCriterion("has_apprentice_orb", hasItem(BloodMagicItems.APPRENTICE_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("blood_rune_sacrifice"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SELF_SACRIFICE_RUNE.get()).key('a', Tags.Items.STONE).key('b', Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get())).key('c', Ingredient.fromItems(Items.GLOWSTONE_DUST)).key('d', Ingredient.fromItems(BloodMagicItems.BLANK_RUNE_ITEM.get())).key('e', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_APPRENTICE.get())).patternLine("aba").patternLine("cdc").patternLine("aea").addCriterion("has_apprentice_orb", hasItem(BloodMagicItems.APPRENTICE_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("blood_rune_self_sacrifice"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.CAPACITY_RUNE.get()).key('a', Tags.Items.STONE).key('b', Items.BUCKET).key('c', BloodMagicBlocks.BLANK_RUNE.get()).key('d', BloodMagicItems.IMBUED_SLATE.get()).patternLine("aba").patternLine("bcb").patternLine("ada").addCriterion("has_imbued_slate", hasItem(BloodMagicItems.IMBUED_SLATE.get())).build(consumer, BloodMagic.rl("blood_rune_capacity"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.ORB_RUNE.get()).key('a', Tags.Items.STONE).key('b', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).key('c', BloodMagicBlocks.BLANK_RUNE.get()).key('d', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MASTER.get())).patternLine("aba").patternLine("cdc").patternLine("aba").addCriterion("has_master_orb", hasItem(BloodMagicItems.MASTER_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("blood_rune_orb"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.CHARGING_RUNE.get()).key('R', Tags.Items.DUSTS_REDSTONE).key('r', BloodMagicBlocks.BLANK_RUNE.get()).key('s', BloodMagicItems.DEMONIC_SLATE.get()).key('e', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MASTER.get())).key('G', Tags.Items.DUSTS_GLOWSTONE).patternLine("RsR").patternLine("GrG").patternLine("ReR").addCriterion("has_master_orb", hasItem(BloodMagicItems.MASTER_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("blood_rune_charging"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.BLANK_RITUAL_STONE.get(), 4).key('a', Tags.Items.OBSIDIAN).key('b', BloodMagicItems.REINFORCED_SLATE.get()).key('c', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_APPRENTICE.get())).patternLine("aba").patternLine("bcb").patternLine("aba").addCriterion("has_apprentice_orb", hasItem(BloodMagicItems.APPRENTICE_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("ritual_stone_blank"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.MASTER_RITUAL_STONE.get()).key('a', Tags.Items.OBSIDIAN).key('b', BloodMagicBlocks.BLANK_RITUAL_STONE.get()).key('c', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MAGICIAN.get())).patternLine("aba").patternLine("bcb").patternLine("aba").addCriterion("has_magician_orb", hasItem(BloodMagicItems.MAGICIAN_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("ritual_stone_master"));
|
||||
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.LAVA_CRYSTAL.get()).key('a', Tags.Items.GLASS).key('b', Items.LAVA_BUCKET).key('c', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).key('d', Tags.Items.OBSIDIAN).key('e', Tags.Items.GEMS_DIAMOND).patternLine("aba").patternLine("bcb").patternLine("ded").addCriterion("has_weak_orb", hasItem(BloodMagicItems.WEAK_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("lava_crystal"));
|
||||
// ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SPEED_RUNE.get()).key('s', Items.GLASS).key('o', Ingredient.fromItems(Items.DIAMOND)).patternLine("sss").patternLine("sos").patternLine("sss").addCriterion("has_diamond", hasItem(Items.DIAMOND)).build(consumer, new ResourceLocation(BloodMagic.MODID, "speed_rune_from_standard"));
|
||||
// ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SPEED_RUNE.get()).key('s', Items.GLASS).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).patternLine("sss").patternLine("sos").patternLine("sss").addCriterion("has_diamond", hasItem(Items.DIAMOND)).build(consumer, new ResourceLocation(BloodMagic.MODID, "speed_rune_from_orb"));
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.client.model.generators.BlockStateProvider;
|
||||
import net.minecraftforge.client.model.generators.ConfiguredModel;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
import net.minecraftforge.client.model.generators.VariantBlockStateBuilder;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.block.BlockAlchemicalReactionChamber;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
|
||||
public class GeneratorBlockStates extends BlockStateProvider
|
||||
{
|
||||
public GeneratorBlockStates(DataGenerator gen, ExistingFileHelper exFileHelper)
|
||||
{
|
||||
super(gen, BloodMagic.MODID, exFileHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerStatesAndModels()
|
||||
{
|
||||
// buildCubeAll(BloodMagicBlocks.TARTARICFORGE.get());
|
||||
// buildCubeAll(BloodMagicBlocks.SPEED_RUNE.get());
|
||||
|
||||
for (RegistryObject<Block> block : BloodMagicBlocks.BASICBLOCKS.getEntries())
|
||||
{
|
||||
buildCubeAll(block.get());
|
||||
}
|
||||
|
||||
buildCubeAll(BloodMagicBlocks.BLOOD_LIGHT.get());
|
||||
buildCubeAll(BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
buildCubeAll(BloodMagicBlocks.AIR_RITUAL_STONE.get());
|
||||
buildCubeAll(BloodMagicBlocks.WATER_RITUAL_STONE.get());
|
||||
buildCubeAll(BloodMagicBlocks.FIRE_RITUAL_STONE.get());
|
||||
buildCubeAll(BloodMagicBlocks.EARTH_RITUAL_STONE.get());
|
||||
buildCubeAll(BloodMagicBlocks.DUSK_RITUAL_STONE.get());
|
||||
buildCubeAll(BloodMagicBlocks.DAWN_RITUAL_STONE.get());
|
||||
|
||||
buildFurnace(BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER.get());
|
||||
}
|
||||
|
||||
private void buildCubeAll(Block block)
|
||||
{
|
||||
getVariantBuilder(block).forAllStates(state -> ConfiguredModel.builder().modelFile(cubeAll(block)).build());
|
||||
}
|
||||
|
||||
private void buildFurnace(Block block)
|
||||
{
|
||||
// ConfiguredModel[] furnaceModel = ConfiguredModel.builder().modelFile().build();
|
||||
ModelFile furnace_off = models().orientableWithBottom("alchemicalreactionchamber", BloodMagic.rl("block/arc_side"), BloodMagic.rl("block/arc_front"), BloodMagic.rl("block/arc_bottom"), BloodMagic.rl("block/arc_top"));
|
||||
// getVariantBuilder(block).addModels(block.getDefaultState().with(BlockAlchemicalReactionChamber.FACING, Direction.NORTH).with(BlockAlchemicalReactionChamber.LIT, false), furnaceModel);
|
||||
|
||||
VariantBlockStateBuilder builder = getVariantBuilder(block);
|
||||
|
||||
builder.partialState().with(BlockAlchemicalReactionChamber.FACING, Direction.NORTH).with(BlockAlchemicalReactionChamber.LIT, false).modelForState().modelFile(furnace_off).addModel();
|
||||
builder.partialState().with(BlockAlchemicalReactionChamber.FACING, Direction.EAST).with(BlockAlchemicalReactionChamber.LIT, false).modelForState().modelFile(furnace_off).rotationY(90).addModel();
|
||||
builder.partialState().with(BlockAlchemicalReactionChamber.FACING, Direction.SOUTH).with(BlockAlchemicalReactionChamber.LIT, false).modelForState().modelFile(furnace_off).rotationY(180).addModel();
|
||||
builder.partialState().with(BlockAlchemicalReactionChamber.FACING, Direction.WEST).with(BlockAlchemicalReactionChamber.LIT, false).modelForState().modelFile(furnace_off).rotationY(270).addModel();
|
||||
builder.partialState().with(BlockAlchemicalReactionChamber.FACING, Direction.NORTH).with(BlockAlchemicalReactionChamber.LIT, true).modelForState().modelFile(furnace_off).addModel();
|
||||
builder.partialState().with(BlockAlchemicalReactionChamber.FACING, Direction.EAST).with(BlockAlchemicalReactionChamber.LIT, true).modelForState().modelFile(furnace_off).rotationY(90).addModel();
|
||||
builder.partialState().with(BlockAlchemicalReactionChamber.FACING, Direction.SOUTH).with(BlockAlchemicalReactionChamber.LIT, true).modelForState().modelFile(furnace_off).rotationY(180).addModel();
|
||||
builder.partialState().with(BlockAlchemicalReactionChamber.FACING, Direction.WEST).with(BlockAlchemicalReactionChamber.LIT, true).modelForState().modelFile(furnace_off).rotationY(270).addModel();
|
||||
|
||||
// getVariantBuilder(block).
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import net.minecraft.data.BlockTagsProvider;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
|
||||
public class GeneratorBlockTags extends BlockTagsProvider
|
||||
{
|
||||
public GeneratorBlockTags(DataGenerator generatorIn, ExistingFileHelper exFileHelper)
|
||||
{
|
||||
super(generatorIn, BloodMagic.MODID, exFileHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTags()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a Path for the location to save the given tag.
|
||||
*/
|
||||
@Override
|
||||
protected Path makePath(ResourceLocation id)
|
||||
{
|
||||
return this.generator.getOutputFolder().resolve("data/" + id.getNamespace() + "/tags/blocks/" + id.getPath() + ".json");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a name for this provider, to use in logging.
|
||||
*/
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "Block Tags";
|
||||
}
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.model.generators.ItemModelBuilder;
|
||||
import net.minecraftforge.client.model.generators.ItemModelProvider;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
import wayoftime.bloodmagic.will.EnumDemonWillType;
|
||||
|
||||
public class GeneratorItemModels extends ItemModelProvider
|
||||
{
|
||||
public GeneratorItemModels(DataGenerator generator, ExistingFileHelper existingFileHelper)
|
||||
{
|
||||
super(generator, BloodMagic.MODID, existingFileHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerModels()
|
||||
{
|
||||
// registerBlockModel(BloodMagicBlocks.TARTARICFORGE.get());
|
||||
// registerBlockModel(BloodMagicBlocks.SPEED_RUNE.get());
|
||||
|
||||
for (RegistryObject<Item> item : BloodMagicItems.BASICITEMS.getEntries())
|
||||
{
|
||||
registerBasicItem(item.get());
|
||||
}
|
||||
|
||||
for (RegistryObject<Block> block : BloodMagicBlocks.BASICBLOCKS.getEntries())
|
||||
{
|
||||
registerBlockModel(block.get());
|
||||
}
|
||||
|
||||
registerBlockModel(BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
registerBlockModel(BloodMagicBlocks.AIR_RITUAL_STONE.get());
|
||||
registerBlockModel(BloodMagicBlocks.WATER_RITUAL_STONE.get());
|
||||
registerBlockModel(BloodMagicBlocks.FIRE_RITUAL_STONE.get());
|
||||
registerBlockModel(BloodMagicBlocks.EARTH_RITUAL_STONE.get());
|
||||
registerBlockModel(BloodMagicBlocks.DUSK_RITUAL_STONE.get());
|
||||
registerBlockModel(BloodMagicBlocks.DAWN_RITUAL_STONE.get());
|
||||
registerBlockModel(BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER.get());
|
||||
|
||||
registerToggleableItem(BloodMagicItems.GREEN_GROVE_SIGIL.get());
|
||||
registerToggleableItem(BloodMagicItems.FAST_MINER_SIGIL.get());
|
||||
registerToggleableItem(BloodMagicItems.MAGNETISM_SIGIL.get());
|
||||
registerToggleableItem(BloodMagicItems.ICE_SIGIL.get());
|
||||
registerDemonWillVariantItem(BloodMagicItems.PETTY_GEM.get());
|
||||
registerDemonWillVariantItem(BloodMagicItems.LESSER_GEM.get());
|
||||
registerDemonWillVariantItem(BloodMagicItems.COMMON_GEM.get());
|
||||
registerDemonSword(BloodMagicItems.SENTIENT_SWORD.get());
|
||||
}
|
||||
|
||||
private void registerBlockModel(Block block)
|
||||
{
|
||||
String path = block.getRegistryName().getPath();
|
||||
getBuilder(path).parent(new ModelFile.UncheckedModelFile(modLoc("block/" + path)));
|
||||
}
|
||||
|
||||
private void registerBasicItem(Item item)
|
||||
{
|
||||
String path = item.getRegistryName().getPath();
|
||||
singleTexture(path, mcLoc("item/handheld"), "layer0", modLoc("item/" + path));
|
||||
}
|
||||
|
||||
private void registerToggleableItem(Item item)
|
||||
{
|
||||
String path = item.getRegistryName().getPath();
|
||||
ModelFile activatedFile = singleTexture("item/variants/" + path + "_activated", mcLoc("item/handheld"), "layer0", modLoc("item/" + path + "_activated"));
|
||||
ModelFile deactivatedFile = singleTexture("item/variants/" + path + "_deactivated", mcLoc("item/handheld"), "layer0", modLoc("item/" + path + "_deactivated"));
|
||||
getBuilder(path).override().predicate(BloodMagic.rl("active"), 0).model(deactivatedFile).end().override().predicate(BloodMagic.rl("active"), 1).model(activatedFile).end();
|
||||
}
|
||||
|
||||
private void registerDemonWillVariantItem(Item item)
|
||||
{
|
||||
String path = item.getRegistryName().getPath();
|
||||
ItemModelBuilder builder = getBuilder(path);
|
||||
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
String name = "";
|
||||
if (type.ordinal() != 0)
|
||||
{
|
||||
name = "_" + type.name().toLowerCase();
|
||||
}
|
||||
ModelFile willFile = singleTexture("item/variants/" + path + name, mcLoc("item/handheld"), "layer0", modLoc("item/" + path + name));
|
||||
builder = builder.override().predicate(BloodMagic.rl("type"), type.ordinal()).model(willFile).end();
|
||||
}
|
||||
}
|
||||
|
||||
private void registerDemonSword(Item item)
|
||||
{
|
||||
String path = item.getRegistryName().getPath();
|
||||
ItemModelBuilder builder = getBuilder(path);
|
||||
|
||||
for (int i = 0; i <= 1; i++)
|
||||
{
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
String name = i == 0 ? "_deactivated" : "_activated";
|
||||
if (type.ordinal() != 0)
|
||||
{
|
||||
name = "_" + type.name().toLowerCase() + name;
|
||||
}
|
||||
ModelFile willFile = singleTexture("item/variants/" + path + name, mcLoc("item/handheld"), "layer0", modLoc("item/" + path + name));
|
||||
builder = builder.override().predicate(BloodMagic.rl("type"), type.ordinal()).predicate(BloodMagic.rl("active"), i).model(willFile).end();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import net.minecraft.data.BlockTagsProvider;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.ItemTagsProvider;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.tags.BloodMagicTags;
|
||||
|
||||
public class GeneratorItemTags extends ItemTagsProvider
|
||||
{
|
||||
public GeneratorItemTags(DataGenerator dataGenerator, BlockTagsProvider blockTagProvider, ExistingFileHelper existingFileHelper)
|
||||
{
|
||||
super(dataGenerator, blockTagProvider, BloodMagic.MODID, existingFileHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTags()
|
||||
{
|
||||
this.getOrCreateBuilder(BloodMagicTags.ARC_TOOL).add(Items.DIAMOND);
|
||||
// this.getOrCreateBuilder(GOORESISTANT).addTag(BlockTags.DOORS);
|
||||
// this.getOrCreateBuilder(GOORESISTANT).addTag(BlockTags.BEDS);
|
||||
// this.getOrCreateBuilder(GOORESISTANT).add(Blocks.PISTON, Blocks.PISTON_HEAD, Blocks.STICKY_PISTON, Blocks.MOVING_PISTON);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a Path for the location to save the given tag.
|
||||
*/
|
||||
@Override
|
||||
protected Path makePath(ResourceLocation id)
|
||||
{
|
||||
return this.generator.getOutputFolder().resolve("data/" + id.getNamespace() + "/tags/items/" + id.getPath() + ".json");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a name for this provider, to use in logging.
|
||||
*/
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "Item Tags";
|
||||
}
|
||||
}
|
|
@ -1,249 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraftforge.common.data.LanguageProvider;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
|
||||
public class GeneratorLanguage extends LanguageProvider
|
||||
{
|
||||
public GeneratorLanguage(DataGenerator gen)
|
||||
{
|
||||
super(gen, BloodMagic.MODID, "en_us");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addTranslations()
|
||||
{
|
||||
// Creative Tab
|
||||
add("itemGroup.bloodmagic.creativeTab", "Blood Magic");
|
||||
|
||||
add("chat.bloodmagic.damageSource", "%s's soul became too weak");
|
||||
|
||||
// Tile Entitites
|
||||
add("tile.bloodmagic.soulforge.name", "Hellfire Forge");
|
||||
add("tile.bloodmagic.arc.name", "Alchemical Reaction Chamber");
|
||||
|
||||
// Blood Orb tooltips
|
||||
add("tooltip.bloodmagic.extraInfo", "&9-Hold shift for more info-");
|
||||
add("tooltip.bloodmagic.orb.desc", "Stores raw Life Essence");
|
||||
add("tooltip.bloodmagic.orb.owner", "Added by: %s");
|
||||
add("tooltip.bloodmagic.currentOwner", "Current owner: %s");
|
||||
add("tooltip.bloodmagic.currentTier", "Current tier: %d");
|
||||
add("tooltip.bloodmagic.config.disabled", "Currently disabled in the Config");
|
||||
add("tooltip.bloodmagic.tier", "Tier %d");
|
||||
|
||||
// Sigil tooltips
|
||||
add("tooltip.bloodmagic.sigil.divination.desc", "Peer into the soul");
|
||||
add("tooltip.bloodmagic.sigil.divination.otherNetwork", "Peering into the soul of %s");
|
||||
add("tooltip.bloodmagic.sigil.divination.currentAltarTier", "Current Tier: %d");
|
||||
add("tooltip.bloodmagic.sigil.divination.currentEssence", "Current Essence: %d LP");
|
||||
add("tooltip.bloodmagic.sigil.divination.currentAltarCapacity", "Current Capacity: %d LP");
|
||||
add("tooltip.bloodmagic.sigil.divination.currentTranquility", "Current Tranquility: %d");
|
||||
// add("tooltip.bloodmagic.sigil.divination.currentInversion", "Current Inversion: %d");
|
||||
add("tooltip.bloodmagic.sigil.divination.currentBonus", "Current Bonus: +%d%%");
|
||||
|
||||
add("tooltip.bloodmagic.decoration.safe", "Safe for decoration");
|
||||
add("tooltip.bloodmagic.decoration.notSafe", "Dangerous for decoration");
|
||||
|
||||
// General Tooltips
|
||||
add("tooltip.bloodmagic.arcaneAshes", "Ashes used to draw an alchemy circle");
|
||||
add("tooltip.bloodmagic.will", "Will Quality: %s");
|
||||
add("tooltip.bloodmagic.sentientSword.desc", "Uses demon will to unleash its full potential.");
|
||||
add("tooltip.bloodmagic.sentientAxe.desc", "Uses demon will to unleash its full potential.");
|
||||
add("tooltip.bloodmagic.sentientPickaxe.desc", "Uses demon will to unleash its full potential.");
|
||||
add("tooltip.bloodmagic.sentientShovel.desc", "Uses demon will to unleash its full potential.");
|
||||
add("tooltip.bloodmagic.soulGem.petty", "A gem used to contain a little will");
|
||||
add("tooltip.bloodmagic.soulGem.lesser", "A gem used to contain some will");
|
||||
add("tooltip.bloodmagic.soulGem.common", "A gem used to contain more will");
|
||||
add("tooltip.bloodmagic.soulGem.greater", "A gem used to contain a greater amount of will");
|
||||
add("tooltip.bloodmagic.soulGem.grand", "A gem used to contain a large amount of will");
|
||||
add("tooltip.bloodmagic.soulSnare.desc", "Throw at a monster and then kill them to obtain their demonic will");
|
||||
|
||||
add("tooltip.bloodmagic.currentType.default", "Contains: Raw Will");
|
||||
add("tooltip.bloodmagic.currentType.corrosive", "Contains: Corrosive Will");
|
||||
add("tooltip.bloodmagic.currentType.destructive", "Contains: Destructive Will");
|
||||
add("tooltip.bloodmagic.currentType.vengeful", "Contains: Vengeful Will");
|
||||
add("tooltip.bloodmagic.currentType.steadfast", "Contains: Steadfast Will");
|
||||
|
||||
add("tooltip.bloodmagic.currentBaseType.default", "Raw");
|
||||
add("tooltip.bloodmagic.currentBaseType.corrosive", "Corrosive");
|
||||
add("tooltip.bloodmagic.currentBaseType.destructive", "Destructive");
|
||||
add("tooltip.bloodmagic.currentBaseType.vengeful", "Vengeful");
|
||||
add("tooltip.bloodmagic.currentBaseType.steadfast", "Steadfast");
|
||||
add("tooltip.bloodmagic.sacrificialdagger.desc", "Just a prick of the finger will suffice...");
|
||||
add("tooltip.bloodmagic.slate.desc", "Infused stone inside of a Blood Altar");
|
||||
add("tooltip.bloodmagic.inscriber.desc", "The writing is on the wall...");
|
||||
|
||||
add("tooltip.bloodmagic.sigil.water.desc", "Infinite water, anyone?");
|
||||
add("tooltip.bloodmagic.sigil.lava.desc", "HOT! DO NOT EAT");
|
||||
add("tooltip.bloodmagic.sigil.void.desc", "Better than a Swiffer®!");
|
||||
add("tooltip.bloodmagic.sigil.greengrove.desc", "Environmentally friendly");
|
||||
add("tooltip.bloodmagic.sigil.magnetism.desc", "I have a very magnetic personality");
|
||||
add("tooltip.bloodmagic.sigil.fastminer.desc", "Keep mining, and mining...");
|
||||
add("tooltip.bloodmagic.sigil.air.desc", "I feel lighter already...");
|
||||
add("tooltip.bloodmagic.sigil.bloodlight.desc", "I see a light!");
|
||||
|
||||
add("tooltip.bloodmagic.activationcrystal.weak", "Activates low-level rituals");
|
||||
add("tooltip.bloodmagic.activationcrystal.awakened", "Activates more powerful rituals");
|
||||
add("tooltip.bloodmagic.activationcrystal.creative", "Creative Only - Activates any ritual");
|
||||
|
||||
add("itemGroup.bloodmagictab", "Blood Magic");
|
||||
|
||||
// Ritual info
|
||||
add("tooltip.bloodmagic.diviner.currentRitual", "Current Ritual: %s");
|
||||
add("tooltip.bloodmagic.diviner.blankRune", "Blank Runes: %d");
|
||||
add("tooltip.bloodmagic.diviner.waterRune", "Water Runes: %d");
|
||||
add("tooltip.bloodmagic.diviner.airRune", "Air Runes: %d");
|
||||
add("tooltip.bloodmagic.diviner.fireRune", "Fire Runes: %d");
|
||||
add("tooltip.bloodmagic.diviner.earthRune", "Earth Runes: %d");
|
||||
add("tooltip.bloodmagic.diviner.duskRune", "Dusk Runes: %d");
|
||||
add("tooltip.bloodmagic.diviner.dawnRune", "Dawn Runes: %d");
|
||||
add("tooltip.bloodmagic.diviner.totalRune", "Total Runes: %d");
|
||||
add("tooltip.bloodmagic.diviner.extraInfo", "Press shift for extra info");
|
||||
add("tooltip.bloodmagic.diviner.extraExtraInfo", "-Hold shift + alt for augmentation info-");
|
||||
add("tooltip.bloodmagic.diviner.currentDirection", "Current Direction: %s");
|
||||
|
||||
add("tooltip.bloodmagic.holdShiftForInfo", "Press shift for extra info");
|
||||
|
||||
add("ritual.bloodmagic.testRitual", "Test Ritual");
|
||||
add("ritual.bloodmagic.waterRitual", "Ritual of the Full Spring");
|
||||
add("ritual.bloodmagic.lavaRitual", "Serenade of the Nether");
|
||||
add("ritual.bloodmagic.greenGroveRitual", "Ritual of the Green Grove");
|
||||
add("ritual.bloodmagic.jumpRitual", "Ritual of the High Jump");
|
||||
add("ritual.bloodmagic.wellOfSufferingRitual", "Well of Suffering");
|
||||
add("ritual.bloodmagic.featheredKnifeRitual", "Ritual of the Feathered Knife");
|
||||
add("ritual.bloodmagic.regenerationRitual", "Ritual of Regeneration");
|
||||
add("ritual.bloodmagic.harvestRitual", "Reap of the Harvest Moon");
|
||||
add("ritual.bloodmagic.magneticRitual", "Ritual of Magnetism");
|
||||
add("ritual.bloodmagic.crushingRitual", "Ritual of the Crusher");
|
||||
add("ritual.bloodmagic.fullStomachRitual", "Ritual of the Satiated Stomach");
|
||||
add("ritual.bloodmagic.interdictionRitual", "Ritual of Interdiction");
|
||||
add("ritual.bloodmagic.containmentRitual", "Ritual of Containment");
|
||||
add("ritual.bloodmagic.speedRitual", "Ritual of Speed");
|
||||
add("ritual.bloodmagic.suppressionRitual", "Ritual of Suppression");
|
||||
add("ritual.bloodmagic.expulsionRitual", "Aura of Expulsion");
|
||||
add("ritual.bloodmagic.zephyrRitual", "Call of the Zephyr");
|
||||
add("ritual.bloodmagic.upgradeRemoveRitual", "Sound of the Cleansing Soul");
|
||||
add("ritual.bloodmagic.armourEvolveRitual", "Ritual of Living Evolution");
|
||||
add("ritual.bloodmagic.animalGrowthRitual", "Ritual of the Shepherd");
|
||||
|
||||
add("ritual.bloodmagic.cobblestoneRitual", "Le Vulcanos Frigius");
|
||||
add("ritual.bloodmagic.placerRitual", "The Filler");
|
||||
add("ritual.bloodmagic.fellingRitual", "The Timberman");
|
||||
add("ritual.bloodmagic.pumpRitual", "Hymn of Siphoning");
|
||||
add("ritual.bloodmagic.altarBuilderRitual", "The Assembly of the High Altar");
|
||||
add("ritual.bloodmagic.portalRitual", "The Gate of the Fold");
|
||||
|
||||
// Guide
|
||||
add("guide.bloodmagic.name", "Sanguine Scientiem");
|
||||
add("guide.bloodmagic.landing_text", "\"It is my dear hope that by holding this tome in your hands, I may impart the knowledge of the lost art that is Blood Magic\"$(br)$(o)- Magus Arcana$()");
|
||||
|
||||
// Block names
|
||||
addBlock(BloodMagicBlocks.BLANK_RUNE, "Blank Rune");
|
||||
addBlock(BloodMagicBlocks.SPEED_RUNE, "Speed Rune");
|
||||
addBlock(BloodMagicBlocks.SACRIFICE_RUNE, "Rune of Sacrifice");
|
||||
addBlock(BloodMagicBlocks.SELF_SACRIFICE_RUNE, "Rune of Self Sacrifice");
|
||||
addBlock(BloodMagicBlocks.DISPLACEMENT_RUNE, "DisplacementRune");
|
||||
addBlock(BloodMagicBlocks.CAPACITY_RUNE, "Rune of Capacity");
|
||||
addBlock(BloodMagicBlocks.AUGMENTED_CAPACITY_RUNE, "Rune of Augmented Capacity");
|
||||
addBlock(BloodMagicBlocks.ORB_RUNE, "Rune of the Orb");
|
||||
addBlock(BloodMagicBlocks.ACCELERATION_RUNE, "Acceleration Rune");
|
||||
addBlock(BloodMagicBlocks.CHARGING_RUNE, "Charging Rune");
|
||||
addBlock(BloodMagicBlocks.BLOOD_ALTAR, "Blood Altar");
|
||||
addBlock(BloodMagicBlocks.SOUL_FORGE, "Hellfire Forge");
|
||||
addBlock(BloodMagicBlocks.BLANK_RITUAL_STONE, "Ritual Stone");
|
||||
addBlock(BloodMagicBlocks.AIR_RITUAL_STONE, "Air Ritual Stone");
|
||||
addBlock(BloodMagicBlocks.WATER_RITUAL_STONE, "Water Ritual Stone");
|
||||
addBlock(BloodMagicBlocks.FIRE_RITUAL_STONE, "Fire Ritual Stone");
|
||||
addBlock(BloodMagicBlocks.EARTH_RITUAL_STONE, "Earth Ritual Stone");
|
||||
addBlock(BloodMagicBlocks.DUSK_RITUAL_STONE, "Dusk Ritual Stone");
|
||||
addBlock(BloodMagicBlocks.DAWN_RITUAL_STONE, "Dawn Ritual Stone");
|
||||
addBlock(BloodMagicBlocks.MASTER_RITUAL_STONE, "Master Ritual Stone");
|
||||
|
||||
// Item names
|
||||
addItem(BloodMagicItems.WEAK_BLOOD_ORB, "Weak Blood Orb");
|
||||
addItem(BloodMagicItems.APPRENTICE_BLOOD_ORB, "Apprentice Blood Orb");
|
||||
addItem(BloodMagicItems.MAGICIAN_BLOOD_ORB, "Magician Blood Orb");
|
||||
addItem(BloodMagicItems.MASTER_BLOOD_ORB, "Master Blood Orb");
|
||||
addItem(BloodMagicItems.DIVINATION_SIGIL, "Divination Sigil");
|
||||
addItem(BloodMagicItems.WATER_SIGIL, "Water Sigil");
|
||||
addItem(BloodMagicItems.LAVA_SIGIL, "Lava Sigil");
|
||||
addItem(BloodMagicItems.VOID_SIGIL, "Void Sigil");
|
||||
addItem(BloodMagicItems.GREEN_GROVE_SIGIL, "Sigil of the Green Grove");
|
||||
addItem(BloodMagicItems.FAST_MINER_SIGIL, "Sigil of the Fast Miner");
|
||||
addItem(BloodMagicItems.MAGNETISM_SIGIL, "Sigil of Magnetism");
|
||||
addItem(BloodMagicItems.ICE_SIGIL, "Sigil of the Frozen Lake");
|
||||
addItem(BloodMagicItems.AIR_SIGIL, "Air Sigil");
|
||||
addItem(BloodMagicItems.BLOOD_LIGHT_SIGIL, "Sigil of the Blood Lamp");
|
||||
|
||||
addItem(BloodMagicBlocks.LIFE_ESSENCE_BUCKET, "Bucket of Life");
|
||||
addItem(BloodMagicItems.ARCANE_ASHES, "Arcane Ashes");
|
||||
addItem(BloodMagicItems.SLATE, "Blank Slate");
|
||||
addItem(BloodMagicItems.REINFORCED_SLATE, "Reinforced Slate");
|
||||
addItem(BloodMagicItems.IMBUED_SLATE, "Imbued Slate");
|
||||
addItem(BloodMagicItems.DEMONIC_SLATE, "Demonic Slate");
|
||||
addItem(BloodMagicItems.ETHEREAL_SLATE, "Ethereal Slate");
|
||||
|
||||
addItem(BloodMagicItems.DAGGER_OF_SACRIFICE, "Dagger of Sacrifice");
|
||||
addItem(BloodMagicItems.SACRIFICIAL_DAGGER, "Sacrificial Knife");
|
||||
addItem(BloodMagicItems.LAVA_CRYSTAL, "Lava Crystal");
|
||||
|
||||
addItem(BloodMagicItems.REAGENT_WATER, "Water Reagent");
|
||||
addItem(BloodMagicItems.REAGENT_LAVA, "Lava Reagent");
|
||||
addItem(BloodMagicItems.REAGENT_FAST_MINER, "Mining Reagent");
|
||||
addItem(BloodMagicItems.REAGENT_GROWTH, "Growth Reagent");
|
||||
addItem(BloodMagicItems.REAGENT_VOID, "Void Reagent");
|
||||
addItem(BloodMagicItems.REAGENT_MAGNETISM, "Magnetism Reagent");
|
||||
addItem(BloodMagicItems.REAGENT_AIR, "Air Reagent");
|
||||
addItem(BloodMagicItems.REAGENT_BLOOD_LIGHT, "Blood Lamp Reagent");
|
||||
|
||||
addItem(BloodMagicItems.PETTY_GEM, "Petty Tartaric Gem");
|
||||
addItem(BloodMagicItems.LESSER_GEM, "Lesser Tartaric Gem");
|
||||
addItem(BloodMagicItems.COMMON_GEM, "Common Tartaric Gem");
|
||||
addItem(BloodMagicItems.MONSTER_SOUL_RAW, "Demon Will");
|
||||
addItem(BloodMagicItems.MONSTER_SOUL_CORROSIVE, "Demon Will");
|
||||
addItem(BloodMagicItems.MONSTER_SOUL_DESTRUCTIVE, "Demon Will");
|
||||
addItem(BloodMagicItems.MONSTER_SOUL_STEADFAST, "Demon Will");
|
||||
addItem(BloodMagicItems.MONSTER_SOUL_VENGEFUL, "Demon Will");
|
||||
addItem(BloodMagicItems.SOUL_SNARE, "Soul Snare");
|
||||
addItem(BloodMagicItems.SENTIENT_SWORD, "Sentient Sword");
|
||||
|
||||
addItem(BloodMagicItems.WEAK_ACTIVATION_CRYSTAL, "Weak Activation Crystal");
|
||||
addItem(BloodMagicItems.AWAKENED_ACTIVATION_CRYSTAL, "Awakened Activation Crystal");
|
||||
addItem(BloodMagicItems.CREATIVE_ACTIVATION_CRYSTAL, "Creative Activation Crystal");
|
||||
addItem(BloodMagicItems.WATER_INSCRIPTION_TOOL, "Inscription Tool: Water");
|
||||
addItem(BloodMagicItems.FIRE_INSCRIPTION_TOOL, "Inscription Tool: Fire");
|
||||
addItem(BloodMagicItems.EARTH_INSCRIPTION_TOOL, "Inscription Tool: Earth");
|
||||
addItem(BloodMagicItems.AIR_INSCRIPTION_TOOL, "Inscription Tool: Air");
|
||||
addItem(BloodMagicItems.DUSK_INSCRIPTION_TOOL, "Inscription Tool: Dusk");
|
||||
|
||||
addItem(BloodMagicItems.BASE_RITUAL_DIVINER, "Ritual Diviner");
|
||||
addItem(BloodMagicItems.DUSK_RITUAL_DIVINER, "Ritual Diviner [Dusk]");
|
||||
|
||||
// addItem(BloodMagicItems , "");
|
||||
|
||||
// JEI
|
||||
add("jei.bloodmagic.recipe.minimumsouls", "Minimum: %s Will");
|
||||
add("jei.bloodmagic.recipe.soulsdrained", "Drained: %s Will");
|
||||
add("jei.bloodmagic.recipe.requiredlp", "LP: %d");
|
||||
add("jei.bloodmagic.recipe.requiredtier", "Tier: %d");
|
||||
add("jei.bloodmagic.recipe.consumptionrate", "Consumption: %s LP/t");
|
||||
add("jei.bloodmagic.recipe.drainrate", "Drain: %s LP/t");
|
||||
|
||||
add("jei.bloodmagic.recipe.altar", "Blood Altar");
|
||||
add("jei.bloodmagic.recipe.soulforge", "Hellfire Forge");
|
||||
add("jei.bloodmagic.recipe.alchemyarraycrafting", "Alchemy Array");
|
||||
|
||||
// Chat
|
||||
add("chat.bloodmagic.ritual.weak", "You feel a push, but are too weak to perform this ritual.");
|
||||
add("chat.bloodmagic.ritual.prevent", "The ritual is actively resisting you!");
|
||||
add("chat.bloodmagic.ritual.activate", "A rush of energy flows through the ritual!");
|
||||
add("chat.bloodmagic.ritual.notValid", "You feel that these runes are not configured correctly...");
|
||||
|
||||
// GUI
|
||||
add("gui.bloodmagic.empty", "Empty");
|
||||
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.LootTableProvider;
|
||||
import net.minecraft.data.loot.BlockLootTables;
|
||||
import net.minecraft.loot.LootParameterSet;
|
||||
import net.minecraft.loot.LootParameterSets;
|
||||
import net.minecraft.loot.LootPool;
|
||||
import net.minecraft.loot.LootTable;
|
||||
import net.minecraft.loot.LootTableManager;
|
||||
import net.minecraft.loot.ValidationTracker;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
|
||||
public class GeneratorLootTable extends LootTableProvider
|
||||
{
|
||||
public GeneratorLootTable(DataGenerator dataGeneratorIn)
|
||||
{
|
||||
super(dataGeneratorIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Pair<Supplier<Consumer<BiConsumer<ResourceLocation, LootTable.Builder>>>, LootParameterSet>> getTables()
|
||||
{
|
||||
return ImmutableList.of(Pair.of(Blocks::new, LootParameterSets.BLOCK));
|
||||
}
|
||||
|
||||
private static class Blocks extends BlockLootTables
|
||||
{
|
||||
@Override
|
||||
protected void addTables()
|
||||
{
|
||||
for (RegistryObject<Block> block : BloodMagicBlocks.BASICBLOCKS.getEntries())
|
||||
{
|
||||
this.registerDropSelfLootTable(block.get());
|
||||
}
|
||||
|
||||
registerDropSelfLootTable(BloodMagicBlocks.BLOOD_ALTAR.get());
|
||||
registerNoDropLootTable(BloodMagicBlocks.ALCHEMY_ARRAY.get());
|
||||
registerNoDropLootTable(BloodMagicBlocks.BLOOD_LIGHT.get());
|
||||
registerDropSelfLootTable(BloodMagicBlocks.SOUL_FORGE.get());
|
||||
registerDropSelfLootTable(BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
registerDropping(BloodMagicBlocks.AIR_RITUAL_STONE.get(), BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
registerDropping(BloodMagicBlocks.WATER_RITUAL_STONE.get(), BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
registerDropping(BloodMagicBlocks.FIRE_RITUAL_STONE.get(), BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
registerDropping(BloodMagicBlocks.EARTH_RITUAL_STONE.get(), BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
registerDropping(BloodMagicBlocks.DUSK_RITUAL_STONE.get(), BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
registerDropping(BloodMagicBlocks.DAWN_RITUAL_STONE.get(), BloodMagicBlocks.BLANK_RITUAL_STONE.get());
|
||||
registerDropSelfLootTable(BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER.get());
|
||||
}
|
||||
|
||||
private void registerNoDropLootTable(Block block)
|
||||
{
|
||||
LootPool.Builder builder = LootPool.builder().name(block.getRegistryName().toString());
|
||||
this.registerLootTable(block, LootTable.builder().addLootPool(builder));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<Block> getKnownBlocks()
|
||||
{
|
||||
return ForgeRegistries.BLOCKS.getValues().stream().filter(b -> b.getRegistryName().getNamespace().equals(BloodMagic.MODID)).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validate(Map<ResourceLocation, LootTable> map, ValidationTracker validationtracker)
|
||||
{
|
||||
map.forEach((name, table) -> LootTableManager.validateLootTable(validationtracker, name, table));
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data.recipe;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.data.RecipeProvider;
|
||||
import wayoftime.bloodmagic.common.recipe.ISubRecipeProvider;
|
||||
|
||||
public abstract class BaseRecipeProvider extends RecipeProvider
|
||||
{
|
||||
private final String modid;
|
||||
|
||||
public BaseRecipeProvider(DataGenerator gen, String modid)
|
||||
{
|
||||
super(gen);
|
||||
this.modid = modid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return super.getName() + modid;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes(Consumer<IFinishedRecipe> consumer)
|
||||
{
|
||||
getSubRecipeProviders().forEach(subRecipeProvider -> subRecipeProvider.addRecipes(consumer));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the sub/offloaded recipe providers that this recipe provider has.
|
||||
*
|
||||
* @implNote This is only called once per provider so there is no need to bother
|
||||
* caching the list that this returns
|
||||
*/
|
||||
protected List<ISubRecipeProvider> getSubRecipeProviders()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
|
@ -1,145 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementRewards;
|
||||
import net.minecraft.advancements.ICriterionInstance;
|
||||
import net.minecraft.advancements.IRequirementsStrategy;
|
||||
import net.minecraft.advancements.criterion.RecipeUnlockedTrigger;
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.common.crafting.conditions.ICondition;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public abstract class BloodMagicRecipeBuilder<BUILDER extends BloodMagicRecipeBuilder<BUILDER>>
|
||||
{
|
||||
|
||||
protected static ResourceLocation bmSerializer(String name)
|
||||
{
|
||||
return new ResourceLocation(BloodMagic.MODID, name);
|
||||
}
|
||||
|
||||
protected final List<ICondition> conditions = new ArrayList<>();
|
||||
protected final Advancement.Builder advancementBuilder = Advancement.Builder.builder();
|
||||
protected final ResourceLocation serializerName;
|
||||
|
||||
protected BloodMagicRecipeBuilder(ResourceLocation serializerName)
|
||||
{
|
||||
this.serializerName = serializerName;
|
||||
}
|
||||
|
||||
public BUILDER addCriterion(RecipeCriterion criterion)
|
||||
{
|
||||
return addCriterion(criterion.name, criterion.criterion);
|
||||
}
|
||||
|
||||
public BUILDER addCriterion(String name, ICriterionInstance criterion)
|
||||
{
|
||||
advancementBuilder.withCriterion(name, criterion);
|
||||
return (BUILDER) this;
|
||||
}
|
||||
|
||||
public BUILDER addCondition(ICondition condition)
|
||||
{
|
||||
conditions.add(condition);
|
||||
return (BUILDER) this;
|
||||
}
|
||||
|
||||
protected boolean hasCriteria()
|
||||
{
|
||||
return !advancementBuilder.getCriteria().isEmpty();
|
||||
}
|
||||
|
||||
protected abstract RecipeResult getResult(ResourceLocation id);
|
||||
|
||||
protected void validate(ResourceLocation id)
|
||||
{
|
||||
}
|
||||
|
||||
public void build(Consumer<IFinishedRecipe> consumer, ResourceLocation id)
|
||||
{
|
||||
validate(id);
|
||||
if (hasCriteria())
|
||||
{
|
||||
// If there is a way to "unlock" this recipe then add an advancement with the
|
||||
// criteria
|
||||
advancementBuilder.withParentId(new ResourceLocation("recipes/root")).withCriterion("has_the_recipe", RecipeUnlockedTrigger.create(id)).withRewards(AdvancementRewards.Builder.recipe(id)).withRequirementsStrategy(IRequirementsStrategy.OR);
|
||||
}
|
||||
consumer.accept(getResult(id));
|
||||
}
|
||||
|
||||
protected abstract class RecipeResult implements IFinishedRecipe
|
||||
{
|
||||
|
||||
private final ResourceLocation id;
|
||||
|
||||
public RecipeResult(ResourceLocation id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject getRecipeJson()
|
||||
{
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty(Constants.JSON.TYPE, serializerName.toString());
|
||||
if (!conditions.isEmpty())
|
||||
{
|
||||
JsonArray conditionsArray = new JsonArray();
|
||||
for (ICondition condition : conditions)
|
||||
{
|
||||
conditionsArray.add(CraftingHelper.serialize(condition));
|
||||
}
|
||||
jsonObject.add(Constants.JSON.CONDITIONS, conditionsArray);
|
||||
}
|
||||
this.serialize(jsonObject);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer()
|
||||
{
|
||||
// Note: This may be null if something is screwed up but this method isn't
|
||||
// actually used so it shouldn't matter
|
||||
// and in fact it will probably be null if only the API is included. But again,
|
||||
// as we manually just use
|
||||
// the serializer's name this should not effect us
|
||||
return ForgeRegistries.RECIPE_SERIALIZERS.getValue(serializerName);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getID()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JsonObject getAdvancementJson()
|
||||
{
|
||||
return hasCriteria() ? advancementBuilder.serialize() : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getAdvancementID()
|
||||
{
|
||||
return new ResourceLocation(id.getNamespace(), "recipes/" + id.getPath());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data.recipe;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.recipe.ARCRecipeProvider;
|
||||
import wayoftime.bloodmagic.common.recipe.AlchemyArrayRecipeProvider;
|
||||
import wayoftime.bloodmagic.common.recipe.BloodAltarRecipeProvider;
|
||||
import wayoftime.bloodmagic.common.recipe.ISubRecipeProvider;
|
||||
import wayoftime.bloodmagic.common.recipe.TartaricForgeRecipeProvider;
|
||||
|
||||
public class BloodMagicRecipeProvider extends BaseRecipeProvider
|
||||
{
|
||||
public BloodMagicRecipeProvider(DataGenerator gen)
|
||||
{
|
||||
super(gen, BloodMagic.MODID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ISubRecipeProvider> getSubRecipeProviders()
|
||||
{
|
||||
return Arrays.asList(new BloodAltarRecipeProvider(), new AlchemyArrayRecipeProvider(), new TartaricForgeRecipeProvider(), new ARCRecipeProvider());
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data.recipe;
|
||||
|
||||
import net.minecraft.advancements.ICriterionInstance;
|
||||
|
||||
public class RecipeCriterion
|
||||
{
|
||||
public final String name;
|
||||
public final ICriterionInstance criterion;
|
||||
|
||||
private RecipeCriterion(String name, ICriterionInstance criterion)
|
||||
{
|
||||
this.name = name;
|
||||
this.criterion = criterion;
|
||||
}
|
||||
|
||||
public static RecipeCriterion of(String name, ICriterionInstance criterion)
|
||||
{
|
||||
return new RecipeCriterion(name, criterion);
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data.recipe.builder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import wayoftime.bloodmagic.api.SerializerHelper;
|
||||
import wayoftime.bloodmagic.api.event.recipes.FluidStackIngredient;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeARC;
|
||||
import wayoftime.bloodmagic.common.data.recipe.BloodMagicRecipeBuilder;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public class ARCRecipeBuilder extends BloodMagicRecipeBuilder<ARCRecipeBuilder>
|
||||
{
|
||||
private final Ingredient input;
|
||||
private final Ingredient arcTool;
|
||||
private final FluidStackIngredient inputFluid;
|
||||
private final ItemStack output;
|
||||
private final FluidStack outputFluid;
|
||||
private final List<Pair<ItemStack, Double>> addedItems = new ArrayList<Pair<ItemStack, Double>>();
|
||||
|
||||
protected ARCRecipeBuilder(Ingredient input, Ingredient arcTool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid)
|
||||
{
|
||||
super(bmSerializer("arc"));
|
||||
this.input = input;
|
||||
this.arcTool = arcTool;
|
||||
this.inputFluid = inputFluid;
|
||||
this.output = output;
|
||||
this.outputFluid = outputFluid;
|
||||
}
|
||||
|
||||
public static ARCRecipeBuilder arc(Ingredient input, Ingredient arcTool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid)
|
||||
{
|
||||
return new ARCRecipeBuilder(input, arcTool, inputFluid, output, outputFluid);
|
||||
}
|
||||
|
||||
public ARCRecipeBuilder addRandomOutput(ItemStack stack, double chance)
|
||||
{
|
||||
if (addedItems.size() >= RecipeARC.MAX_RANDOM_OUTPUTS)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
addedItems.add(Pair.of(stack, chance));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ARCRecipeResult getResult(ResourceLocation id)
|
||||
{
|
||||
return new ARCRecipeResult(id);
|
||||
}
|
||||
|
||||
public class ARCRecipeResult extends RecipeResult
|
||||
{
|
||||
protected ARCRecipeResult(ResourceLocation id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(@Nonnull JsonObject json)
|
||||
{
|
||||
json.add(Constants.JSON.INPUT, input.serialize());
|
||||
json.add(Constants.JSON.TOOL, arcTool.serialize());
|
||||
|
||||
if (inputFluid != null)
|
||||
json.add(Constants.JSON.INPUT_FLUID, inputFluid.serialize());
|
||||
|
||||
if (addedItems.size() > 0)
|
||||
{
|
||||
JsonArray mainArray = new JsonArray();
|
||||
for (Pair<ItemStack, Double> pair : addedItems)
|
||||
{
|
||||
JsonObject jsonObj = new JsonObject();
|
||||
jsonObj.addProperty(Constants.JSON.CHANCE, pair.getValue().floatValue());
|
||||
jsonObj.add(Constants.JSON.TYPE, SerializerHelper.serializeItemStack(pair.getKey()));
|
||||
mainArray.add(jsonObj);
|
||||
}
|
||||
|
||||
json.add(Constants.JSON.ADDEDOUTPUT, mainArray);
|
||||
}
|
||||
|
||||
if (outputFluid != null)
|
||||
json.add(Constants.JSON.OUTPUT_FLUID, SerializerHelper.serializeFluidStack(outputFluid));
|
||||
|
||||
json.add(Constants.JSON.OUTPUT, SerializerHelper.serializeItemStack(output));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data.recipe.builder;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import wayoftime.bloodmagic.api.SerializerHelper;
|
||||
import wayoftime.bloodmagic.common.data.recipe.BloodMagicRecipeBuilder;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public class AlchemyArrayRecipeBuilder extends BloodMagicRecipeBuilder<AlchemyArrayRecipeBuilder>
|
||||
{
|
||||
private final ResourceLocation texture;
|
||||
private final Ingredient baseInput;
|
||||
private final Ingredient addedInput;
|
||||
private final ItemStack output;
|
||||
|
||||
protected AlchemyArrayRecipeBuilder(ResourceLocation texture, Ingredient baseInput, Ingredient addedInput, ItemStack output)
|
||||
{
|
||||
super(bmSerializer("array"));
|
||||
this.texture = texture;
|
||||
this.baseInput = baseInput;
|
||||
this.addedInput = addedInput;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public static AlchemyArrayRecipeBuilder array(ResourceLocation texture, Ingredient baseInput, Ingredient addedInput, ItemStack output)
|
||||
{
|
||||
return new AlchemyArrayRecipeBuilder(texture, baseInput, addedInput, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AlchemyArrayRecipeResult getResult(ResourceLocation id)
|
||||
{
|
||||
return new AlchemyArrayRecipeResult(id);
|
||||
}
|
||||
|
||||
public class AlchemyArrayRecipeResult extends RecipeResult
|
||||
{
|
||||
protected AlchemyArrayRecipeResult(ResourceLocation id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(@Nonnull JsonObject json)
|
||||
{
|
||||
json.addProperty(Constants.JSON.TEXTURE, texture.toString());
|
||||
// JSONUtils.getString(json, );
|
||||
json.add(Constants.JSON.BASEINPUT, baseInput.serialize());
|
||||
json.add(Constants.JSON.ADDEDINPUT, addedInput.serialize());
|
||||
json.add(Constants.JSON.OUTPUT, SerializerHelper.serializeItemStack(output));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data.recipe.builder;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import wayoftime.bloodmagic.api.SerializerHelper;
|
||||
import wayoftime.bloodmagic.common.data.recipe.BloodMagicRecipeBuilder;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public class BloodAltarRecipeBuilder extends BloodMagicRecipeBuilder<BloodAltarRecipeBuilder>
|
||||
{
|
||||
private final Ingredient input;
|
||||
private final ItemStack output;
|
||||
private final int minimumTier;
|
||||
private final int syphon;
|
||||
private final int consumeRate;
|
||||
private final int drainRate;
|
||||
|
||||
protected BloodAltarRecipeBuilder(Ingredient input, ItemStack output, int minimumTier, int syphon, int consumeRate, int drainRate)
|
||||
{
|
||||
super(bmSerializer("altar"));
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minimumTier = minimumTier;
|
||||
this.syphon = syphon;
|
||||
this.consumeRate = consumeRate;
|
||||
this.drainRate = drainRate;
|
||||
}
|
||||
|
||||
public static BloodAltarRecipeBuilder altar(Ingredient input, ItemStack output, int minimumTier, int syphon, int consumeRate, int drainRate)
|
||||
{
|
||||
return new BloodAltarRecipeBuilder(input, output, minimumTier, syphon, consumeRate, drainRate);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BloodAltarRecipeResult getResult(ResourceLocation id)
|
||||
{
|
||||
return new BloodAltarRecipeResult(id);
|
||||
}
|
||||
|
||||
public class BloodAltarRecipeResult extends RecipeResult
|
||||
{
|
||||
protected BloodAltarRecipeResult(ResourceLocation id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(@Nonnull JsonObject json)
|
||||
{
|
||||
json.add(Constants.JSON.INPUT, input.serialize());
|
||||
json.add(Constants.JSON.OUTPUT, SerializerHelper.serializeItemStack(output));
|
||||
json.addProperty(Constants.JSON.ALTAR_TIER, minimumTier);
|
||||
json.addProperty(Constants.JSON.ALTAR_SYPHON, syphon);
|
||||
json.addProperty(Constants.JSON.ALTAR_CONSUMPTION_RATE, consumeRate);
|
||||
json.addProperty(Constants.JSON.ALTAR_DRAIN_RATE, drainRate);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.data.recipe.builder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import wayoftime.bloodmagic.api.SerializerHelper;
|
||||
import wayoftime.bloodmagic.common.data.recipe.BloodMagicRecipeBuilder;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public class TartaricForgeRecipeBuilder extends BloodMagicRecipeBuilder<TartaricForgeRecipeBuilder>
|
||||
{
|
||||
private final List<Ingredient> input;
|
||||
private final ItemStack output;
|
||||
private final double minimumSouls;
|
||||
private final double soulDrain;
|
||||
|
||||
protected TartaricForgeRecipeBuilder(List<Ingredient> input, ItemStack output, double minimumSouls, double soulDrain)
|
||||
{
|
||||
super(bmSerializer("soulforge"));
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minimumSouls = minimumSouls;
|
||||
this.soulDrain = soulDrain;
|
||||
}
|
||||
|
||||
public static TartaricForgeRecipeBuilder tartaricForge(List<Ingredient> input, ItemStack output, double minimumSouls, double soulDrain)
|
||||
{
|
||||
return new TartaricForgeRecipeBuilder(input, output, minimumSouls, soulDrain);
|
||||
}
|
||||
|
||||
public static TartaricForgeRecipeBuilder tartaricForge(ItemStack output, double minimumSouls, double soulDrain, Ingredient... inputArray)
|
||||
{
|
||||
List<Ingredient> inputList = new ArrayList<Ingredient>();
|
||||
for (int i = 0; i < inputArray.length; i++)
|
||||
{
|
||||
inputList.add(inputArray[i]);
|
||||
}
|
||||
return new TartaricForgeRecipeBuilder(inputList, output, minimumSouls, soulDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TartaricForgeRecipeResult getResult(ResourceLocation id)
|
||||
{
|
||||
return new TartaricForgeRecipeResult(id);
|
||||
}
|
||||
|
||||
public class TartaricForgeRecipeResult extends RecipeResult
|
||||
{
|
||||
protected TartaricForgeRecipeResult(ResourceLocation id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(@Nonnull JsonObject json)
|
||||
{
|
||||
for (int i = 0; i < Math.min(input.size(), 4); i++)
|
||||
{
|
||||
json.add(Constants.JSON.INPUT + i, input.get(i).serialize());
|
||||
}
|
||||
|
||||
json.add(Constants.JSON.OUTPUT, SerializerHelper.serializeItemStack(output));
|
||||
json.addProperty(Constants.JSON.TARTARIC_MINIMUM, (float) minimumSouls);
|
||||
json.addProperty(Constants.JSON.TARTARIC_DRAIN, (float) soulDrain);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.LazyValue;
|
||||
|
||||
public enum BMItemTier implements IItemTier
|
||||
{
|
||||
SENTIENT(4, 512, 6.0F, 2.0F, 50, () -> {
|
||||
return Ingredient.fromItems(BloodMagicItems.IMBUED_SLATE.get());
|
||||
});
|
||||
|
||||
private final int harvestLevel;
|
||||
private final int maxUses;
|
||||
private final float efficiency;
|
||||
private final float attackDamage;
|
||||
private final int enchantability;
|
||||
private final LazyValue<Ingredient> repairMaterial;
|
||||
|
||||
private BMItemTier(int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn, int enchantabilityIn, Supplier<Ingredient> repairMaterialIn)
|
||||
{
|
||||
this.harvestLevel = harvestLevelIn;
|
||||
this.maxUses = maxUsesIn;
|
||||
this.efficiency = efficiencyIn;
|
||||
this.attackDamage = attackDamageIn;
|
||||
this.enchantability = enchantabilityIn;
|
||||
this.repairMaterial = new LazyValue<>(repairMaterialIn);
|
||||
}
|
||||
|
||||
public int getMaxUses()
|
||||
{
|
||||
return this.maxUses;
|
||||
}
|
||||
|
||||
public float getEfficiency()
|
||||
{
|
||||
return this.efficiency;
|
||||
}
|
||||
|
||||
public float getAttackDamage()
|
||||
{
|
||||
return this.attackDamage;
|
||||
}
|
||||
|
||||
public int getHarvestLevel()
|
||||
{
|
||||
return this.harvestLevel;
|
||||
}
|
||||
|
||||
public int getEnchantability()
|
||||
{
|
||||
return this.enchantability;
|
||||
}
|
||||
|
||||
public Ingredient getRepairMaterial()
|
||||
{
|
||||
return this.repairMaterial.getValue();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilAir;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilBloodLight;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilDivination;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilFastMiner;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilFrost;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilGreenGrove;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilLava;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilMagnetism;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilVoid;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilWater;
|
||||
import wayoftime.bloodmagic.common.item.soul.ItemMonsterSoul;
|
||||
import wayoftime.bloodmagic.common.item.soul.ItemSentientSword;
|
||||
import wayoftime.bloodmagic.common.item.soul.ItemSoulGem;
|
||||
import wayoftime.bloodmagic.common.item.soul.ItemSoulSnare;
|
||||
import wayoftime.bloodmagic.common.registration.impl.BloodOrbDeferredRegister;
|
||||
import wayoftime.bloodmagic.common.registration.impl.BloodOrbRegistryObject;
|
||||
import wayoftime.bloodmagic.orb.BloodOrb;
|
||||
import wayoftime.bloodmagic.ritual.EnumRuneType;
|
||||
import wayoftime.bloodmagic.will.EnumDemonWillType;
|
||||
|
||||
public class BloodMagicItems
|
||||
{
|
||||
// public static Item.ToolMaterial SOUL_TOOL_MATERIAL = EnumHelper.addToolMaterial("demonic", 4, 520, 7, 8, 50);
|
||||
// public static final BloodOrb WEAK_ORB_INSTANCE = new BloodOrb(new ResourceLocation(BloodMagic.MODID, "weakbloodorb"), 0, 5000, 10);
|
||||
public static final BloodOrbDeferredRegister BLOOD_ORBS = new BloodOrbDeferredRegister(BloodMagic.MODID);
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, BloodMagic.MODID);
|
||||
public static final DeferredRegister<Item> BASICITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, BloodMagic.MODID);
|
||||
|
||||
public static final BloodOrbRegistryObject<BloodOrb> ORB_WEAK = BLOOD_ORBS.register("weakbloodorb", () -> new BloodOrb(new ResourceLocation(BloodMagic.MODID, "weakbloodorb"), 1, 5000, 2));
|
||||
public static final BloodOrbRegistryObject<BloodOrb> ORB_APPRENTICE = BLOOD_ORBS.register("apprenticebloodorb", () -> new BloodOrb(new ResourceLocation(BloodMagic.MODID, "apprenticebloodorb"), 2, 25000, 5));
|
||||
public static final BloodOrbRegistryObject<BloodOrb> ORB_MAGICIAN = BLOOD_ORBS.register("magicianbloodorb", () -> new BloodOrb(new ResourceLocation(BloodMagic.MODID, "magicianbloodorb"), 3, 150000, 15));
|
||||
public static final BloodOrbRegistryObject<BloodOrb> ORB_MASTER = BLOOD_ORBS.register("masterbloodorb", () -> new BloodOrb(new ResourceLocation(BloodMagic.MODID, "masterbloodorb"), 4, 1000000, 25));
|
||||
public static final BloodOrbRegistryObject<BloodOrb> ORB_ARCHMAGE = BLOOD_ORBS.register("archmagebloodorb", () -> new BloodOrb(new ResourceLocation(BloodMagic.MODID, "archmagebloodorb"), 5, 10000000, 50));
|
||||
// public static final DeferredRegister<BloodOrb> BLOOD_ORBS = DeferredRegister.create(RegistrarBloodMagic.BLOOD_ORBS, BloodMagic.MODID);
|
||||
|
||||
// public static final RegistryObject<Item> BLOODSTONE_ITEM = ITEMS.register("ruby_block", () -> new BlockItem(BloodMagicBlocks.BLOODSTONE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> SOUL_FORGE_ITEM = ITEMS.register("soulforge", () -> new BlockItem(BloodMagicBlocks.SOUL_FORGE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> BLANK_RUNE_ITEM = ITEMS.register("blankrune", () -> new BlockItem(BloodMagicBlocks.BLANK_RUNE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> SPEED_RUNE_ITEM = ITEMS.register("speedrune", () -> new BlockItem(BloodMagicBlocks.SPEED_RUNE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> SACRIFICE_RUNE_ITEM = ITEMS.register("sacrificerune", () -> new BlockItem(BloodMagicBlocks.SACRIFICE_RUNE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> SELF_SACRIFICE_RUNE_ITEM = ITEMS.register("selfsacrificerune", () -> new BlockItem(BloodMagicBlocks.SELF_SACRIFICE_RUNE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> DISPLACEMENT_RUNE_ITEM = ITEMS.register("dislocationrune", () -> new BlockItem(BloodMagicBlocks.DISPLACEMENT_RUNE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> CAPACITY_RUNE_ITEM = ITEMS.register("altarcapacityrune", () -> new BlockItem(BloodMagicBlocks.CAPACITY_RUNE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> AUGMENTED_CAPACITY_RUNE_ITEM = ITEMS.register("bettercapacityrune", () -> new BlockItem(BloodMagicBlocks.AUGMENTED_CAPACITY_RUNE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> ORB_RUNE_ITEM = ITEMS.register("orbcapacityrune", () -> new BlockItem(BloodMagicBlocks.ORB_RUNE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> ACCELERATION_RUNE_ITEM = ITEMS.register("accelerationrune", () -> new BlockItem(BloodMagicBlocks.ACCELERATION_RUNE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> CHARGING_RUNE_ITEM = ITEMS.register("chargingrune", () -> new BlockItem(BloodMagicBlocks.CHARGING_RUNE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> BLANK_RITUAL_STONE_ITEM = ITEMS.register("ritualstone", () -> new BlockItem(BloodMagicBlocks.BLANK_RITUAL_STONE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> AIR_RITUAL_STONE_ITEM = ITEMS.register("airritualstone", () -> new BlockItem(BloodMagicBlocks.AIR_RITUAL_STONE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> WATER_RITUAL_STONE_ITEM = ITEMS.register("waterritualstone", () -> new BlockItem(BloodMagicBlocks.WATER_RITUAL_STONE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> FIRE_RITUAL_STONE_ITEM = ITEMS.register("fireritualstone", () -> new BlockItem(BloodMagicBlocks.FIRE_RITUAL_STONE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> EARTH_RITUAL_STONE_ITEM = ITEMS.register("earthritualstone", () -> new BlockItem(BloodMagicBlocks.EARTH_RITUAL_STONE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> DUSK_RITUAL_STONE_ITEM = ITEMS.register("duskritualstone", () -> new BlockItem(BloodMagicBlocks.DUSK_RITUAL_STONE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> DAWN_RITUAL_STONE_ITEM = ITEMS.register("lightritualstone", () -> new BlockItem(BloodMagicBlocks.DAWN_RITUAL_STONE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> ALCHEMICAL_REACTION_CHAMBER_ITEM = ITEMS.register("alchemicalreactionchamber", () -> new BlockItem(BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
|
||||
public static final RegistryObject<Item> MASTER_RITUAL_STONE_ITEM = ITEMS.register("masterritualstone", () -> new BlockItem(BloodMagicBlocks.MASTER_RITUAL_STONE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
|
||||
public static final RegistryObject<Item> BLOOD_ALTAR_ITEM = ITEMS.register("altar", () -> new BlockItem(BloodMagicBlocks.BLOOD_ALTAR.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
|
||||
// TODO: Need to rework the above instantiations for the ItemBlocks so that it's
|
||||
// done with the Blocks.
|
||||
|
||||
// public static final RegistryObject<Item> WEAK_BLOOD_ORB = BASICITEMS.register("weakbloodorb", ItemBloodOrb::new);
|
||||
// public static final RegistryObject<Item> WEAK_BLOOD_ORB = BASICITEMS.register("weakbloodorb", () -> new ItemBloodOrb(WEAK_ORB_INSTANCE));
|
||||
public static final RegistryObject<Item> WEAK_BLOOD_ORB = BASICITEMS.register("weakbloodorb", () -> new ItemBloodOrb(ORB_WEAK));
|
||||
public static final RegistryObject<Item> APPRENTICE_BLOOD_ORB = BASICITEMS.register("apprenticebloodorb", () -> new ItemBloodOrb(ORB_APPRENTICE));
|
||||
public static final RegistryObject<Item> MAGICIAN_BLOOD_ORB = BASICITEMS.register("magicianbloodorb", () -> new ItemBloodOrb(ORB_MAGICIAN));
|
||||
public static final RegistryObject<Item> MASTER_BLOOD_ORB = BASICITEMS.register("masterbloodorb", () -> new ItemBloodOrb(ORB_MASTER));
|
||||
|
||||
public static final RegistryObject<Item> DIVINATION_SIGIL = BASICITEMS.register("divinationsigil", () -> new ItemSigilDivination(true));
|
||||
public static final RegistryObject<Item> SACRIFICIAL_DAGGER = BASICITEMS.register("sacrificialdagger", () -> new ItemSacrificialDagger());
|
||||
public static final RegistryObject<Item> SLATE = BASICITEMS.register("blankslate", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REINFORCED_SLATE = BASICITEMS.register("reinforcedslate", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> IMBUED_SLATE = BASICITEMS.register("infusedslate", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> DEMONIC_SLATE = BASICITEMS.register("demonslate", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> ETHEREAL_SLATE = BASICITEMS.register("etherealslate", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> WATER_SIGIL = BASICITEMS.register("watersigil", () -> new ItemSigilWater());
|
||||
public static final RegistryObject<Item> VOID_SIGIL = BASICITEMS.register("voidsigil", () -> new ItemSigilVoid());
|
||||
public static final RegistryObject<Item> LAVA_SIGIL = BASICITEMS.register("lavasigil", () -> new ItemSigilLava());
|
||||
public static final RegistryObject<Item> GREEN_GROVE_SIGIL = ITEMS.register("growthsigil", () -> new ItemSigilGreenGrove());
|
||||
public static final RegistryObject<Item> FAST_MINER_SIGIL = ITEMS.register("miningsigil", () -> new ItemSigilFastMiner());
|
||||
public static final RegistryObject<Item> MAGNETISM_SIGIL = ITEMS.register("sigilofmagnetism", () -> new ItemSigilMagnetism());
|
||||
public static final RegistryObject<Item> ICE_SIGIL = ITEMS.register("icesigil", () -> new ItemSigilFrost());
|
||||
public static final RegistryObject<Item> AIR_SIGIL = BASICITEMS.register("airsigil", ItemSigilAir::new);
|
||||
public static final RegistryObject<Item> BLOOD_LIGHT_SIGIL = BASICITEMS.register("bloodlightsigil", ItemSigilBloodLight::new);
|
||||
|
||||
public static final RegistryObject<Item> ARCANE_ASHES = BASICITEMS.register("arcaneashes", () -> new ItemArcaneAshes());
|
||||
public static final RegistryObject<Item> DAGGER_OF_SACRIFICE = BASICITEMS.register("daggerofsacrifice", () -> new ItemDaggerOfSacrifice());
|
||||
public static final RegistryObject<Item> LAVA_CRYSTAL = BASICITEMS.register("lavacrystal", () -> new ItemLavaCrystal());
|
||||
|
||||
// Ritual stuffs
|
||||
public static final RegistryObject<Item> WEAK_ACTIVATION_CRYSTAL = BASICITEMS.register("activationcrystalweak", () -> new ItemActivationCrystal(ItemActivationCrystal.CrystalType.WEAK));
|
||||
public static final RegistryObject<Item> AWAKENED_ACTIVATION_CRYSTAL = BASICITEMS.register("activationcrystalawakened", () -> new ItemActivationCrystal(ItemActivationCrystal.CrystalType.AWAKENED));
|
||||
public static final RegistryObject<Item> CREATIVE_ACTIVATION_CRYSTAL = BASICITEMS.register("activationcrystalcreative", () -> new ItemActivationCrystal(ItemActivationCrystal.CrystalType.CREATIVE));
|
||||
|
||||
public static final RegistryObject<Item> AIR_INSCRIPTION_TOOL = BASICITEMS.register("airscribetool", () -> new ItemInscriptionTool(EnumRuneType.AIR));
|
||||
public static final RegistryObject<Item> FIRE_INSCRIPTION_TOOL = BASICITEMS.register("firescribetool", () -> new ItemInscriptionTool(EnumRuneType.FIRE));
|
||||
public static final RegistryObject<Item> WATER_INSCRIPTION_TOOL = BASICITEMS.register("waterscribetool", () -> new ItemInscriptionTool(EnumRuneType.WATER));
|
||||
public static final RegistryObject<Item> EARTH_INSCRIPTION_TOOL = BASICITEMS.register("earthscribetool", () -> new ItemInscriptionTool(EnumRuneType.EARTH));
|
||||
public static final RegistryObject<Item> DUSK_INSCRIPTION_TOOL = BASICITEMS.register("duskscribetool", () -> new ItemInscriptionTool(EnumRuneType.DUSK));
|
||||
|
||||
public static final RegistryObject<Item> BASE_RITUAL_DIVINER = BASICITEMS.register("ritualdiviner", () -> new ItemRitualDiviner(0));
|
||||
public static final RegistryObject<Item> DUSK_RITUAL_DIVINER = BASICITEMS.register("ritualdivinerdusk", () -> new ItemRitualDiviner(1));
|
||||
|
||||
// Reagents used to make the Sigils
|
||||
public static final RegistryObject<Item> REAGENT_WATER = BASICITEMS.register("reagentwater", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REAGENT_LAVA = BASICITEMS.register("reagentlava", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REAGENT_VOID = BASICITEMS.register("reagentvoid", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REAGENT_GROWTH = BASICITEMS.register("reagentgrowth", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REAGENT_FAST_MINER = BASICITEMS.register("reagentfastminer", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REAGENT_MAGNETISM = BASICITEMS.register("reagentmagnetism", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REAGENT_AIR = BASICITEMS.register("reagentair", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REAGENT_BLOOD_LIGHT = BASICITEMS.register("reagentbloodlight", () -> new ItemBase());
|
||||
|
||||
// Tartaric Gems
|
||||
public static final RegistryObject<Item> PETTY_GEM = ITEMS.register("soulgempetty", () -> new ItemSoulGem("petty", 64));
|
||||
public static final RegistryObject<Item> LESSER_GEM = ITEMS.register("soulgemlesser", () -> new ItemSoulGem("lesser", 256));
|
||||
public static final RegistryObject<Item> COMMON_GEM = ITEMS.register("soulgemcommon", () -> new ItemSoulGem("common", 1024));
|
||||
|
||||
public static final RegistryObject<Item> MONSTER_SOUL_RAW = BASICITEMS.register("basemonstersoul", () -> new ItemMonsterSoul(EnumDemonWillType.DEFAULT));
|
||||
public static final RegistryObject<Item> MONSTER_SOUL_CORROSIVE = BASICITEMS.register("basemonstersoul_corrosive", () -> new ItemMonsterSoul(EnumDemonWillType.CORROSIVE));
|
||||
public static final RegistryObject<Item> MONSTER_SOUL_DESTRUCTIVE = BASICITEMS.register("basemonstersoul_destructive", () -> new ItemMonsterSoul(EnumDemonWillType.DESTRUCTIVE));
|
||||
public static final RegistryObject<Item> MONSTER_SOUL_STEADFAST = BASICITEMS.register("basemonstersoul_steadfast", () -> new ItemMonsterSoul(EnumDemonWillType.STEADFAST));
|
||||
public static final RegistryObject<Item> MONSTER_SOUL_VENGEFUL = BASICITEMS.register("basemonstersoul_vengeful", () -> new ItemMonsterSoul(EnumDemonWillType.VENGEFUL));
|
||||
|
||||
public static final RegistryObject<Item> SOUL_SNARE = BASICITEMS.register("soulsnare", ItemSoulSnare::new);
|
||||
public static final RegistryObject<Item> SENTIENT_SWORD = ITEMS.register("soulsword", () -> new ItemSentientSword());
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
public interface IARCTool
|
||||
{
|
||||
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.core.data.Binding;
|
||||
import wayoftime.bloodmagic.iface.IBindable;
|
||||
|
||||
public class ItemActivationCrystal extends Item implements IBindable
|
||||
{
|
||||
final CrystalType type;
|
||||
|
||||
public ItemActivationCrystal(CrystalType type)
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB));
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.activationcrystal." + type.name().toLowerCase()));
|
||||
|
||||
if (!stack.hasTag())
|
||||
return;
|
||||
|
||||
Binding binding = getBinding(stack);
|
||||
if (binding != null)
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.currentOwner", binding.getOwnerName()));
|
||||
|
||||
super.addInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
|
||||
public int getCrystalLevel(ItemStack stack)
|
||||
{
|
||||
return this.type.equals(CrystalType.CREATIVE) ? Integer.MAX_VALUE : type.ordinal() + 1;
|
||||
}
|
||||
|
||||
public enum CrystalType
|
||||
{
|
||||
WEAK, AWAKENED, CREATIVE,;
|
||||
|
||||
@Nonnull
|
||||
public static ItemStack getStack(int level)
|
||||
{
|
||||
if (level < 0)
|
||||
{
|
||||
level = 0;
|
||||
}
|
||||
switch (level)
|
||||
{
|
||||
case 0:
|
||||
return new ItemStack(BloodMagicItems.WEAK_ACTIVATION_CRYSTAL.get());
|
||||
case 1:
|
||||
return new ItemStack(BloodMagicItems.AWAKENED_ACTIVATION_CRYSTAL.get());
|
||||
default:
|
||||
return new ItemStack(BloodMagicItems.CREATIVE_ACTIVATION_CRYSTAL.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
|
||||
public class ItemArcaneAshes extends Item
|
||||
{
|
||||
public ItemArcaneAshes()
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB).maxDamage(20));
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.arcaneAshes"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext context)
|
||||
{
|
||||
ItemStack stack = context.getItem();
|
||||
BlockPos newPos = context.getPos().offset(context.getFace());
|
||||
World world = context.getWorld();
|
||||
PlayerEntity player = context.getPlayer();
|
||||
|
||||
if (world.isAirBlock(newPos))
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Direction rotation = Direction.fromAngle(player.getRotationYawHead());
|
||||
world.setBlockState(newPos, BloodMagicBlocks.ALCHEMY_ARRAY.get().getDefaultState());
|
||||
TileEntity tile = world.getTileEntity(newPos);
|
||||
if (tile instanceof TileAlchemyArray)
|
||||
{
|
||||
((TileAlchemyArray) tile).setRotation(rotation);
|
||||
}
|
||||
|
||||
// PickaxeItem d;
|
||||
stack.damageItem(1, player, (entity) -> {
|
||||
entity.sendBreakAnimation(EquipmentSlotType.MAINHAND);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public ActionResultType onItemUse(PlayerEntity player, World world, BlockPos blockPos, Hand hand, Direction side, float hitX, float hitY, float hitZ)
|
||||
// {
|
||||
// ItemStack stack = player.getHeldItem(hand);
|
||||
// BlockPos newPos = blockPos.offset(side);
|
||||
//
|
||||
// if (world.isAirBlock(newPos))
|
||||
// {
|
||||
// if (!world.isRemote)
|
||||
// {
|
||||
// Direction rotation = Direction.fromAngle(player.getRotationYawHead());
|
||||
// world.setBlockState(newPos, RegistrarBloodMagicBlocks.ALCHEMY_ARRAY.getDefaultState());
|
||||
// TileEntity tile = world.getTileEntity(newPos);
|
||||
// if (tile instanceof TileAlchemyArray)
|
||||
// {
|
||||
// ((TileAlchemyArray) tile).setRotation(rotation);
|
||||
// }
|
||||
//
|
||||
// stack.damageItem(1, player);
|
||||
// }
|
||||
//
|
||||
// return ActionResultType.SUCCESS;
|
||||
// }
|
||||
//
|
||||
// return ActionResultType.FAIL;
|
||||
// }
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
|
||||
public class ItemBase extends Item
|
||||
{
|
||||
private final String desc;
|
||||
|
||||
public ItemBase()
|
||||
{
|
||||
this("");
|
||||
}
|
||||
|
||||
public ItemBase(String desc)
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(64).group(BloodMagic.TAB));
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
if (!desc.isEmpty())
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic." + desc));
|
||||
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.core.data.Binding;
|
||||
import wayoftime.bloodmagic.iface.IBindable;
|
||||
|
||||
public class ItemBindableBase extends Item implements IBindable
|
||||
{
|
||||
public ItemBindableBase()
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB));
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
if (!stack.hasTag())
|
||||
return;
|
||||
|
||||
Binding binding = getBinding(stack);
|
||||
if (binding != null)
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.currentOwner", binding.getOwnerName()));
|
||||
}
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.extensions.IForgeItem;
|
||||
import wayoftime.bloodmagic.core.data.Binding;
|
||||
import wayoftime.bloodmagic.core.data.SoulNetwork;
|
||||
import wayoftime.bloodmagic.core.data.SoulTicket;
|
||||
import wayoftime.bloodmagic.orb.BloodOrb;
|
||||
import wayoftime.bloodmagic.orb.IBloodOrb;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
public class ItemBloodOrb extends ItemBindableBase implements IBloodOrb, IForgeItem
|
||||
{
|
||||
private final Supplier<BloodOrb> sup;
|
||||
|
||||
public ItemBloodOrb(Supplier<BloodOrb> sup)
|
||||
{
|
||||
this.sup = sup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BloodOrb getOrb(ItemStack stack)
|
||||
{
|
||||
return sup.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
BloodOrb orb = getOrb(stack);
|
||||
|
||||
if (orb == null)
|
||||
return ActionResult.resultFail(stack);
|
||||
|
||||
if (world == null)
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
world.playSound(null, player.getPosX(), player.getPosY(), player.getPosZ(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F
|
||||
+ (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (!stack.hasTag())
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
Binding binding = getBinding(stack);
|
||||
if (binding == null)
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (world.isRemote)
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
SoulNetwork ownerNetwork = NetworkHelper.getSoulNetwork(binding);
|
||||
if (binding.getOwnerId().equals(player.getGameProfile().getId()))
|
||||
ownerNetwork.setOrbTier(orb.getTier());
|
||||
|
||||
ownerNetwork.add(SoulTicket.item(stack, world, player, 200), orb.getCapacity()); // Add LP to owner's network
|
||||
ownerNetwork.hurtPlayer(player, 200); // Hurt whoever is using it
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.orb.desc"));
|
||||
|
||||
BloodOrb orb = getOrb(stack);
|
||||
if (flag.isAdvanced() && orb != null)
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.orb.owner", stack.getItem().getRegistryName()));
|
||||
|
||||
super.addInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
|
||||
//
|
||||
@Override
|
||||
public ItemStack getContainerItem(ItemStack stack)
|
||||
{
|
||||
return stack.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem(ItemStack stack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.util.DamageSourceBloodMagic;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerSacrificeHelper;
|
||||
|
||||
public class ItemDaggerOfSacrifice extends Item
|
||||
{
|
||||
public ItemDaggerOfSacrifice()
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker)
|
||||
{
|
||||
if (attacker instanceof FakePlayer)
|
||||
return false;
|
||||
|
||||
if (target == null || attacker == null || attacker.getEntityWorld().isRemote
|
||||
|| (attacker instanceof PlayerEntity && !(attacker instanceof ServerPlayerEntity)))
|
||||
return false;
|
||||
|
||||
if (!target.isNonBoss())
|
||||
return false;
|
||||
|
||||
if (target instanceof PlayerEntity)
|
||||
return false;
|
||||
|
||||
if (target.isChild() && !(target instanceof IMob))
|
||||
return false;
|
||||
|
||||
if (!target.isAlive() || target.getHealth() < 0.5F)
|
||||
return false;
|
||||
|
||||
// EntityEntry entityEntry = EntityRegistry.getEntry(target.getClass());
|
||||
// if (entityEntry == null)
|
||||
// return false;
|
||||
// int lifeEssenceRatio = BloodMagicAPI.INSTANCE.getValueManager().getSacrificial().getOrDefault(entityEntry.getRegistryName(), 25);
|
||||
int lifeEssenceRatio = 25;
|
||||
|
||||
if (lifeEssenceRatio <= 0)
|
||||
return false;
|
||||
|
||||
int lifeEssence = (int) (lifeEssenceRatio * target.getHealth());
|
||||
// if (target instanceof AnimalEntity)
|
||||
// {
|
||||
// lifeEssence = (int) (lifeEssence * (1 + PurificationHelper.getCurrentPurity((AnimalEntity) target)));
|
||||
// }
|
||||
|
||||
if (target.isChild())
|
||||
{
|
||||
lifeEssence *= 0.5F;
|
||||
}
|
||||
|
||||
if (PlayerSacrificeHelper.findAndFillAltar(attacker.getEntityWorld(), target, lifeEssence, true))
|
||||
{
|
||||
target.getEntityWorld().playSound(null, target.getPosX(), target.getPosY(), target.getPosZ(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F
|
||||
+ (target.getEntityWorld().rand.nextFloat() - target.getEntityWorld().rand.nextFloat()) * 0.8F);
|
||||
target.setHealth(-1);
|
||||
target.onDeath(DamageSourceBloodMagic.INSTANCE);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.block.BlockRitualStone;
|
||||
import wayoftime.bloodmagic.ritual.EnumRuneType;
|
||||
import wayoftime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
public class ItemInscriptionTool extends Item
|
||||
{
|
||||
private final EnumRuneType type;
|
||||
|
||||
public ItemInscriptionTool(EnumRuneType type)
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB).maxDamage(40));
|
||||
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext context)
|
||||
{
|
||||
ItemStack stack = context.getItem();
|
||||
BlockPos pos = context.getPos();
|
||||
World world = context.getWorld();
|
||||
PlayerEntity player = context.getPlayer();
|
||||
BlockState state = world.getBlockState(pos);
|
||||
|
||||
if (state.getBlock() instanceof BlockRitualStone
|
||||
&& !((BlockRitualStone) state.getBlock()).isRuneType(world, pos, type))
|
||||
{
|
||||
((BlockRitualStone) state.getBlock()).setRuneType(world, pos, type);
|
||||
if (!player.isCreative())
|
||||
{
|
||||
stack.damageItem(1, player, (entity) -> {
|
||||
entity.sendBreakAnimation(EquipmentSlotType.MAINHAND);
|
||||
});
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent(TextHelper.localizeEffect("tooltip.bloodmagic.inscriber.desc")));
|
||||
}
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import wayoftime.bloodmagic.core.data.Binding;
|
||||
import wayoftime.bloodmagic.core.data.SoulTicket;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
//TODO: Make some hook somewhere that attaches the pos to the ticket otherwise the tickets are basically useless lmao
|
||||
public class ItemLavaCrystal extends ItemBindableBase
|
||||
{
|
||||
public ItemLavaCrystal()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(ItemStack stack)
|
||||
{
|
||||
Binding binding = getBinding(stack);
|
||||
if (binding != null)
|
||||
NetworkHelper.getSoulNetwork(binding.getOwnerId()).syphon(SoulTicket.item(stack, 50));
|
||||
|
||||
ItemStack returnStack = new ItemStack(this);
|
||||
returnStack.setTag(stack.getTag());
|
||||
return returnStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem(ItemStack stack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack stack)
|
||||
{
|
||||
Binding binding = getBinding(stack);
|
||||
if (binding == null)
|
||||
return -1;
|
||||
|
||||
// if (NetworkHelper.syphonFromContainer(stack, SoulTicket.item(stack, 25)))
|
||||
if (NetworkHelper.canSyphonFromContainer(stack, 50))
|
||||
return 200;
|
||||
else
|
||||
{
|
||||
PlayerEntity player = PlayerHelper.getPlayerFromUUID(binding.getOwnerId());
|
||||
if (player != null)
|
||||
player.addPotionEffect(new EffectInstance(Effects.NAUSEA, 99));
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// @Nullable
|
||||
// @Override
|
||||
// public Binding getBinding(ItemStack stack)
|
||||
// {
|
||||
// if (stack.getTag() == null) // hasTagCompound doesn't work on empty stacks with tags
|
||||
// return null;
|
||||
//
|
||||
// NBTBase bindingTag = stack.getTag().get("binding");
|
||||
// if (bindingTag == null || bindingTag.getId() != 10 || bindingTag.isEmpty()) // Make sure it's both a tag
|
||||
// // compound and that it has actual
|
||||
// // data.
|
||||
// return null;
|
||||
//
|
||||
// NBTTagCompound nbt = (NBTTagCompound) bindingTag;
|
||||
// return new Binding(NBTUtil.getUUIDFromTag(nbt.getCompoundTag("id")), nbt.getString("name"));
|
||||
// }
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext context)
|
||||
{
|
||||
BlockPos pos = context.getPos();
|
||||
Direction facing = context.getFace();
|
||||
pos = pos.offset(facing);
|
||||
PlayerEntity player = context.getPlayer();
|
||||
Hand hand = context.getHand();
|
||||
ItemStack itemstack = player.getHeldItem(hand);
|
||||
|
||||
Binding binding = getBinding(player.getHeldItem(hand));
|
||||
|
||||
if (binding == null)
|
||||
return ActionResultType.FAIL;
|
||||
|
||||
if (!player.canPlayerEdit(pos, facing, itemstack))
|
||||
return ActionResultType.FAIL;
|
||||
|
||||
if (context.getWorld().isAirBlock(pos)
|
||||
&& NetworkHelper.getSoulNetwork(binding).syphonAndDamage(player, SoulTicket.item(player.getHeldItem(hand), 100)).isSuccess())
|
||||
{
|
||||
context.getWorld().playSound(player, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, random.nextFloat()
|
||||
* 0.4F + 0.8F);
|
||||
context.getWorld().setBlockState(pos, Blocks.FIRE.getDefaultState(), 11);
|
||||
} else
|
||||
return ActionResultType.FAIL;
|
||||
|
||||
if (player instanceof ServerPlayerEntity)
|
||||
CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayerEntity) player, pos, itemstack);
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
|
@ -1,598 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.block.BlockRitualStone;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.ritual.EnumRuneType;
|
||||
import wayoftime.bloodmagic.ritual.Ritual;
|
||||
import wayoftime.bloodmagic.ritual.RitualComponent;
|
||||
import wayoftime.bloodmagic.tile.TileMasterRitualStone;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.Utils;
|
||||
import wayoftime.bloodmagic.util.handler.event.ClientHandler;
|
||||
import wayoftime.bloodmagic.util.helper.RitualHelper;
|
||||
import wayoftime.bloodmagic.util.helper.TextHelper;
|
||||
import wayoftime.bloodmagic.will.EnumDemonWillType;
|
||||
|
||||
public class ItemRitualDiviner extends Item
|
||||
{
|
||||
final int type;
|
||||
public static final String tooltipBase = "tooltip.bloodmagic.diviner.";
|
||||
public static String[] names =
|
||||
{ "normal", "dusk", "dawn" };
|
||||
|
||||
public ItemRitualDiviner(int type)
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB));
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getHighlightTip(ItemStack stack, String displayName)
|
||||
// {
|
||||
// if (Strings.isNullOrEmpty(getCurrentRitual(stack)))
|
||||
// return displayName;
|
||||
//
|
||||
// Ritual ritual = BloodMagic.RITUAL_MANAGER.getRitual(getCurrentRitual(stack));
|
||||
// if (ritual == null)
|
||||
// return displayName;
|
||||
//
|
||||
// return displayName + ": " + TextHelper.localize(ritual.getTranslationKey());
|
||||
// }
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext context)
|
||||
{
|
||||
ItemStack stack = context.getPlayer().getHeldItem(context.getHand());
|
||||
if (context.getPlayer().isSneaking())
|
||||
{
|
||||
if (context.getWorld().isRemote)
|
||||
{
|
||||
trySetDisplayedRitual(stack, context.getWorld(), context.getPos());
|
||||
}
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
} else if (addRuneToRitual(stack, context.getWorld(), context.getPos(), context.getPlayer()))
|
||||
{
|
||||
if (context.getWorld().isRemote)
|
||||
{
|
||||
spawnParticles(context.getWorld(), context.getPos().offset(context.getFace()), 15);
|
||||
}
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
// TODO: Have the diviner automagically build the ritual
|
||||
}
|
||||
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single rune to the ritual.
|
||||
*
|
||||
* @param stack - The Ritual Diviner stack
|
||||
* @param world - The World
|
||||
* @param pos - Block Position of the MRS.
|
||||
* @param player - The Player attempting to place the ritual
|
||||
* @return - True if a rune was successfully added
|
||||
*/
|
||||
public boolean addRuneToRitual(ItemStack stack, World world, BlockPos pos, PlayerEntity player)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileMasterRitualStone)
|
||||
{
|
||||
Ritual ritual = BloodMagic.RITUAL_MANAGER.getRitual(this.getCurrentRitual(stack));
|
||||
if (ritual != null)
|
||||
{
|
||||
Direction direction = getDirection(stack);
|
||||
List<RitualComponent> components = Lists.newArrayList();
|
||||
ritual.gatherComponents(components::add);
|
||||
for (RitualComponent component : components)
|
||||
{
|
||||
if (!canPlaceRitualStone(component.getRuneType(), stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
BlockPos offset = component.getOffset(direction);
|
||||
BlockPos newPos = pos.add(offset);
|
||||
BlockState state = world.getBlockState(newPos);
|
||||
Block block = state.getBlock();
|
||||
if (RitualHelper.isRune(world, newPos))
|
||||
{
|
||||
if (RitualHelper.isRuneType(world, newPos, component.getRuneType()))
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
undisplayHologram();
|
||||
}
|
||||
} else
|
||||
{
|
||||
// Replace existing ritual stone
|
||||
RitualHelper.setRuneType(world, newPos, component.getRuneType());
|
||||
return true;
|
||||
}
|
||||
} else if (block.isAir(state, world, newPos))// || block.isReplaceable(world, newPos))
|
||||
{
|
||||
if (!consumeStone(stack, world, player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
((BlockRitualStone) BloodMagicBlocks.BLANK_RITUAL_STONE.get()).setRuneType(world, newPos, component.getRuneType());
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
return false; // TODO: Possibly replace the block with a
|
||||
// ritual stone
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void trySetDisplayedRitual(ItemStack itemStack, World world, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileMasterRitualStone)
|
||||
{
|
||||
Ritual ritual = BloodMagic.RITUAL_MANAGER.getRitual(this.getCurrentRitual(itemStack));
|
||||
TileMasterRitualStone masterRitualStone = (TileMasterRitualStone) tile;
|
||||
|
||||
if (ritual != null)
|
||||
{
|
||||
Direction direction = getDirection(itemStack);
|
||||
ClientHandler.setRitualHolo(masterRitualStone, ritual, direction, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void undisplayHologram()
|
||||
{
|
||||
ClientHandler.setRitualHoloToNull();
|
||||
}
|
||||
|
||||
// TODO: Make this work for any IRitualStone
|
||||
public boolean consumeStone(ItemStack stack, World world, PlayerEntity player)
|
||||
{
|
||||
if (player.isCreative())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
NonNullList<ItemStack> inventory = player.inventory.mainInventory;
|
||||
for (ItemStack newStack : inventory)
|
||||
{
|
||||
if (newStack.isEmpty())
|
||||
{
|
||||
|
||||
continue;
|
||||
}
|
||||
Item item = newStack.getItem();
|
||||
if (item instanceof BlockItem)
|
||||
{
|
||||
Block block = ((BlockItem) item).getBlock();
|
||||
if (block instanceof BlockRitualStone)
|
||||
{
|
||||
newStack.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
if (!stack.hasTag())
|
||||
return;
|
||||
|
||||
Ritual ritual = BloodMagic.RITUAL_MANAGER.getRitual(this.getCurrentRitual(stack));
|
||||
if (ritual != null)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.diviner.currentRitual", new TranslationTextComponent(ritual.getTranslationKey())));
|
||||
|
||||
boolean sneaking = Screen.hasShiftDown();
|
||||
// boolean extraInfo = sneaking && Keyboard.isKeyDown(Keyboard.KEY_M);
|
||||
boolean extraInfo = sneaking && Screen.hasAltDown();
|
||||
|
||||
if (extraInfo)
|
||||
{
|
||||
tooltip.add(new StringTextComponent(""));
|
||||
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
if (TextHelper.canTranslate(ritual.getTranslationKey() + "." + type.name().toLowerCase() + ".info"))
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent(ritual.getTranslationKey() + "." + type.name().toLowerCase() + ".info"));
|
||||
}
|
||||
}
|
||||
} else if (sneaking)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "currentDirection", Utils.toFancyCasing(getDirection(stack).name())));
|
||||
tooltip.add(new StringTextComponent(""));
|
||||
List<RitualComponent> components = Lists.newArrayList();
|
||||
ritual.gatherComponents(components::add);
|
||||
|
||||
int blankRunes = 0;
|
||||
int airRunes = 0;
|
||||
int waterRunes = 0;
|
||||
int fireRunes = 0;
|
||||
int earthRunes = 0;
|
||||
int duskRunes = 0;
|
||||
int dawnRunes = 0;
|
||||
int totalRunes = components.size();
|
||||
|
||||
for (RitualComponent component : components)
|
||||
{
|
||||
switch (component.getRuneType())
|
||||
{
|
||||
case BLANK:
|
||||
blankRunes++;
|
||||
break;
|
||||
case AIR:
|
||||
airRunes++;
|
||||
break;
|
||||
case EARTH:
|
||||
earthRunes++;
|
||||
break;
|
||||
case FIRE:
|
||||
fireRunes++;
|
||||
break;
|
||||
case WATER:
|
||||
waterRunes++;
|
||||
break;
|
||||
case DUSK:
|
||||
duskRunes++;
|
||||
break;
|
||||
case DAWN:
|
||||
dawnRunes++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (blankRunes > 0)
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "blankRune", blankRunes).mergeStyle(EnumRuneType.BLANK.colorCode));
|
||||
if (waterRunes > 0)
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "waterRune", waterRunes).mergeStyle(EnumRuneType.WATER.colorCode));
|
||||
if (airRunes > 0)
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "airRune", airRunes).mergeStyle(EnumRuneType.AIR.colorCode));
|
||||
if (fireRunes > 0)
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "fireRune", fireRunes).mergeStyle(EnumRuneType.FIRE.colorCode));
|
||||
if (earthRunes > 0)
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "earthRune", earthRunes).mergeStyle(EnumRuneType.EARTH.colorCode));
|
||||
if (duskRunes > 0)
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "duskRune", duskRunes).mergeStyle(EnumRuneType.DUSK.colorCode));
|
||||
if (dawnRunes > 0)
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "dawnRune", dawnRunes).mergeStyle(EnumRuneType.DAWN.colorCode));
|
||||
|
||||
tooltip.add(new StringTextComponent(""));
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "totalRune", totalRunes));
|
||||
} else
|
||||
{
|
||||
tooltip.add(new StringTextComponent(""));
|
||||
if (TextHelper.canTranslate(ritual.getTranslationKey() + ".info"))
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent(ritual.getTranslationKey() + ".info"));
|
||||
tooltip.add(new StringTextComponent(""));
|
||||
}
|
||||
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "extraInfo").mergeStyle(TextFormatting.BLUE));
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "extraExtraInfo").mergeStyle(TextFormatting.BLUE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
||||
RayTraceResult ray = rayTrace(world, player, RayTraceContext.FluidMode.NONE);
|
||||
|
||||
if (ray != null && ray.getType() == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
return new ActionResult<>(ActionResultType.PASS, stack);
|
||||
}
|
||||
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
cycleRitual(stack, player, false);
|
||||
}
|
||||
|
||||
return new ActionResult<>(ActionResultType.SUCCESS, stack);
|
||||
} else
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
cycleDirection(stack, player);
|
||||
}
|
||||
}
|
||||
|
||||
return new ActionResult<>(ActionResultType.PASS, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUse(World worldIn, LivingEntity entityLiving, ItemStack stack, int count)
|
||||
{
|
||||
if (!entityLiving.world.isRemote && entityLiving instanceof PlayerEntity)
|
||||
{
|
||||
PlayerEntity player = (PlayerEntity) entityLiving;
|
||||
|
||||
RayTraceResult ray = rayTrace(player.world, player, RayTraceContext.FluidMode.NONE);
|
||||
|
||||
if (ray != null && ray.getType() == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
return;
|
||||
// return false;
|
||||
}
|
||||
|
||||
if (!player.isSwingInProgress)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
cycleRitual(stack, player, true);
|
||||
} else
|
||||
{
|
||||
cycleDirection(stack, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return false;
|
||||
}
|
||||
|
||||
public void cycleDirection(ItemStack stack, PlayerEntity player)
|
||||
{
|
||||
Direction direction = getDirection(stack);
|
||||
Direction newDirection;
|
||||
switch (direction)
|
||||
{
|
||||
case NORTH:
|
||||
newDirection = Direction.EAST;
|
||||
break;
|
||||
case EAST:
|
||||
newDirection = Direction.SOUTH;
|
||||
break;
|
||||
case SOUTH:
|
||||
newDirection = Direction.WEST;
|
||||
break;
|
||||
case WEST:
|
||||
newDirection = Direction.NORTH;
|
||||
break;
|
||||
default:
|
||||
newDirection = Direction.NORTH;
|
||||
}
|
||||
|
||||
setDirection(stack, newDirection);
|
||||
notifyDirectionChange(newDirection, player);
|
||||
}
|
||||
|
||||
public void notifyDirectionChange(Direction direction, PlayerEntity player)
|
||||
{
|
||||
player.sendStatusMessage(new TranslationTextComponent(tooltipBase + "currentDirection", Utils.toFancyCasing(direction.name())), true);
|
||||
}
|
||||
|
||||
public void setDirection(ItemStack stack, Direction direction)
|
||||
{
|
||||
if (!stack.hasTag())
|
||||
{
|
||||
stack.setTag(new CompoundNBT());
|
||||
}
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
tag.putInt(Constants.NBT.DIRECTION, direction.getIndex());
|
||||
}
|
||||
|
||||
public Direction getDirection(ItemStack stack)
|
||||
{
|
||||
if (!stack.hasTag())
|
||||
{
|
||||
stack.setTag(new CompoundNBT());
|
||||
return Direction.NORTH;
|
||||
}
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
int dir = tag.getInt(Constants.NBT.DIRECTION);
|
||||
if (dir == 0)
|
||||
{
|
||||
return Direction.NORTH;
|
||||
}
|
||||
|
||||
return Direction.values()[tag.getInt(Constants.NBT.DIRECTION)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Cycles the ritual forward or backward
|
||||
*/
|
||||
public void cycleRitual(ItemStack stack, PlayerEntity player, boolean reverse)
|
||||
{
|
||||
String key = getCurrentRitual(stack);
|
||||
List<Ritual> rituals = BloodMagic.RITUAL_MANAGER.getSortedRituals();
|
||||
if (reverse)
|
||||
Collections.reverse(rituals = Lists.newArrayList(rituals));
|
||||
|
||||
String firstId = "";
|
||||
boolean foundId = false;
|
||||
boolean foundFirst = false;
|
||||
|
||||
for (Ritual ritual : rituals)
|
||||
{
|
||||
String id = BloodMagic.RITUAL_MANAGER.getId(ritual);
|
||||
|
||||
if (!BloodMagic.RITUAL_MANAGER.enabled(id, false) || !canDivinerPerformRitual(stack, ritual))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!foundFirst)
|
||||
{
|
||||
firstId = id;
|
||||
foundFirst = true;
|
||||
}
|
||||
|
||||
if (foundId)
|
||||
{
|
||||
setCurrentRitual(stack, id);
|
||||
notifyRitualChange(id, player);
|
||||
return;
|
||||
} else if (id.equals(key))
|
||||
{
|
||||
foundId = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundFirst)
|
||||
{
|
||||
setCurrentRitual(stack, firstId);
|
||||
notifyRitualChange(firstId, player);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canDivinerPerformRitual(ItemStack stack, Ritual ritual)
|
||||
{
|
||||
if (ritual == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
List<RitualComponent> components = Lists.newArrayList();
|
||||
ritual.gatherComponents(components::add);
|
||||
for (RitualComponent component : components)
|
||||
{
|
||||
if (!canPlaceRitualStone(component.getRuneType(), stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void notifyRitualChange(String key, PlayerEntity player)
|
||||
{
|
||||
Ritual ritual = BloodMagic.RITUAL_MANAGER.getRitual(key);
|
||||
if (ritual != null)
|
||||
{
|
||||
player.sendStatusMessage(new TranslationTextComponent(ritual.getTranslationKey()), true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentRitual(ItemStack stack, String key)
|
||||
{
|
||||
if (!stack.hasTag())
|
||||
{
|
||||
stack.setTag(new CompoundNBT());
|
||||
}
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
tag.putString("current_ritual", key);
|
||||
}
|
||||
|
||||
public String getCurrentRitual(ItemStack stack)
|
||||
{
|
||||
if (!stack.hasTag())
|
||||
{
|
||||
stack.setTag(new CompoundNBT());
|
||||
}
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getString("current_ritual");
|
||||
}
|
||||
|
||||
public boolean canPlaceRitualStone(EnumRuneType rune, ItemStack stack)
|
||||
{
|
||||
int meta = type;
|
||||
switch (rune)
|
||||
{
|
||||
case BLANK:
|
||||
case AIR:
|
||||
case EARTH:
|
||||
case FIRE:
|
||||
case WATER:
|
||||
return true;
|
||||
case DUSK:
|
||||
return meta >= 1;
|
||||
case DAWN:
|
||||
return meta >= 2;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void spawnParticles(World worldIn, BlockPos pos, int amount)
|
||||
{
|
||||
BlockState state = worldIn.getBlockState(pos);
|
||||
Block block = worldIn.getBlockState(pos).getBlock();
|
||||
|
||||
if (block.isAir(state, worldIn, pos))
|
||||
{
|
||||
for (int i = 0; i < amount; ++i)
|
||||
{
|
||||
double d0 = random.nextGaussian() * 0.02D;
|
||||
double d1 = random.nextGaussian() * 0.02D;
|
||||
double d2 = random.nextGaussian() * 0.02D;
|
||||
worldIn.addParticle(ParticleTypes.HAPPY_VILLAGER, (double) ((float) pos.getX()
|
||||
+ random.nextFloat()), (double) pos.getY()
|
||||
+ (double) random.nextFloat(), (double) ((float) pos.getZ()
|
||||
+ random.nextFloat()), d0, d1, d2);
|
||||
}
|
||||
} else
|
||||
{
|
||||
for (int i1 = 0; i1 < amount; ++i1)
|
||||
{
|
||||
double d0 = random.nextGaussian() * 0.02D;
|
||||
double d1 = random.nextGaussian() * 0.02D;
|
||||
double d2 = random.nextGaussian() * 0.02D;
|
||||
worldIn.addParticle(ParticleTypes.HAPPY_VILLAGER, (double) ((float) pos.getX()
|
||||
+ random.nextFloat()), (double) pos.getY()
|
||||
+ (double) random.nextFloat()
|
||||
* 1.0f, (double) ((float) pos.getZ() + random.nextFloat()), d0, d1, d2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,204 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.UseAction;
|
||||
import net.minecraft.particles.RedstoneParticleData;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.ConfigHandler;
|
||||
import wayoftime.bloodmagic.event.SacrificeKnifeUsedEvent;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.DamageSourceBloodMagic;
|
||||
import wayoftime.bloodmagic.util.helper.NBTHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerSacrificeHelper;
|
||||
|
||||
public class ItemSacrificialDagger extends Item
|
||||
{
|
||||
|
||||
public ItemSacrificialDagger()
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB));
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
// tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect("tooltip.bloodmagic.sacrificialDagger.desc"))));
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.sacrificialdagger.desc"));
|
||||
|
||||
// if (stack.getItemDamage() == 1)
|
||||
// list.add(TextHelper.localizeEffect("tooltip.bloodmagic.sacrificialDagger.creative"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, LivingEntity entityLiving, int timeLeft)
|
||||
{
|
||||
if (entityLiving instanceof PlayerEntity && !entityLiving.getEntityWorld().isRemote)
|
||||
PlayerSacrificeHelper.sacrificePlayerHealth((PlayerEntity) entityLiving);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseDuration(ItemStack stack)
|
||||
{
|
||||
return 72000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UseAction getUseAction(ItemStack stack)
|
||||
{
|
||||
return UseAction.BOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (this.canUseForSacrifice(stack))
|
||||
{
|
||||
player.setActiveHand(hand);
|
||||
return ActionResult.resultSuccess(stack);
|
||||
}
|
||||
|
||||
int lpAdded = ConfigHandler.values.sacrificialDaggerConversion * 2;
|
||||
|
||||
// RayTraceResult rayTrace = rayTrace(world, player, false);
|
||||
// if (rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
// {
|
||||
// TileEntity tile = world.getTileEntity(rayTrace.getBlockPos());
|
||||
//
|
||||
// if (tile != null && tile instanceof TileAltar && stack.getItemDamage() == 1)
|
||||
// lpAdded = ((TileAltar) tile).getCapacity();
|
||||
// }
|
||||
|
||||
if (!player.abilities.isCreativeMode)
|
||||
{
|
||||
SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, 2, lpAdded);
|
||||
if (MinecraftForge.EVENT_BUS.post(evt))
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (evt.shouldDrainHealth)
|
||||
{
|
||||
player.hurtResistantTime = 0;
|
||||
player.attackEntityFrom(DamageSourceBloodMagic.INSTANCE, 0.001F);
|
||||
player.setHealth(Math.max(player.getHealth() - 1.998F, 0.0001f));
|
||||
if (player.getHealth() <= 0.001f && !world.isRemote)
|
||||
{
|
||||
player.onDeath(DamageSourceBloodMagic.INSTANCE);
|
||||
player.setHealth(0);
|
||||
}
|
||||
// player.attackEntityFrom(BloodMagicAPI.getDamageSource(), 2.0F);
|
||||
}
|
||||
|
||||
if (!evt.shouldFillAltar)
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
lpAdded = evt.lpAdded;
|
||||
}
|
||||
|
||||
double posX = player.getPosX();
|
||||
double posY = player.getPosY();
|
||||
double posZ = player.getPosZ();
|
||||
world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F
|
||||
+ (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
|
||||
for (int l = 0; l < 8; ++l) world.addParticle(RedstoneParticleData.REDSTONE_DUST, posX + Math.random()
|
||||
- Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), 0, 0, 0);
|
||||
|
||||
if (!world.isRemote && PlayerHelper.isFakePlayer(player))
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
// TODO - Check if SoulFray is active
|
||||
PlayerSacrificeHelper.findAndFillAltar(world, player, lpAdded, false);
|
||||
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (!world.isRemote && entity instanceof PlayerEntity)
|
||||
this.setUseForSacrifice(stack, this.isPlayerPreparedForSacrifice(world, (PlayerEntity) entity));
|
||||
}
|
||||
|
||||
public boolean isPlayerPreparedForSacrifice(World world, PlayerEntity player)
|
||||
{
|
||||
return !world.isRemote && (PlayerSacrificeHelper.getPlayerIncense(player) > 0);
|
||||
}
|
||||
|
||||
public boolean canUseForSacrifice(ItemStack stack)
|
||||
{
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
return stack.getTag().getBoolean(Constants.NBT.SACRIFICE);
|
||||
}
|
||||
|
||||
public void setUseForSacrifice(ItemStack stack, boolean sacrifice)
|
||||
{
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
stack.getTag().putBoolean(Constants.NBT.SACRIFICE, sacrifice);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public ItemMeshDefinition getMeshDefinition()
|
||||
// {
|
||||
// return stack -> {
|
||||
// String variant = "type=normal";
|
||||
// if (stack.getItemDamage() != 0)
|
||||
// variant = "type=creative";
|
||||
//
|
||||
// if (canUseForSacrifice(stack))
|
||||
// variant = "type=ceremonial";
|
||||
//
|
||||
// return new ModelResourceLocation(getRegistryName(), variant);
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void gatherVariants(Consumer<String> variants)
|
||||
// {
|
||||
// variants.accept("type=normal");
|
||||
// variants.accept("type=creative");
|
||||
// variants.accept("type=ceremonial");
|
||||
// }
|
||||
//
|
||||
// public enum DaggerType implements ISubItem
|
||||
// {
|
||||
//
|
||||
// NORMAL, CREATIVE,;
|
||||
//
|
||||
// @Nonnull
|
||||
// @Override
|
||||
// public String getInternalName()
|
||||
// {
|
||||
// return name().toLowerCase(Locale.ROOT);
|
||||
// }
|
||||
//
|
||||
// @Nonnull
|
||||
// @Override
|
||||
// public ItemStack getStack(int count)
|
||||
// {
|
||||
// return new ItemStack(RegistrarBloodMagicItems.SACRIFICIAL_DAGGER, count, ordinal());
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.core.data.Binding;
|
||||
import wayoftime.bloodmagic.iface.IBindable;
|
||||
import wayoftime.bloodmagic.iface.ISigil;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.helper.NBTHelper;
|
||||
|
||||
/**
|
||||
* Base class for all (static) sigils.
|
||||
*/
|
||||
public class ItemSigil extends Item implements IBindable, ISigil
|
||||
{
|
||||
private int lpUsed;
|
||||
|
||||
public ItemSigil(Properties prop, int lpUsed)
|
||||
{
|
||||
super(prop);
|
||||
|
||||
this.lpUsed = lpUsed;
|
||||
}
|
||||
|
||||
public boolean isUnusable(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
return stack.getTag().getBoolean(Constants.NBT.UNUSABLE);
|
||||
}
|
||||
|
||||
public ItemStack setUnusable(ItemStack stack, boolean unusable)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
stack.getTag().putBoolean(Constants.NBT.UNUSABLE, unusable);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getLpUsed()
|
||||
{
|
||||
return lpUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
if (!stack.hasTag())
|
||||
return;
|
||||
|
||||
Binding binding = getBinding(stack);
|
||||
if (binding != null)
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.currentOwner", binding.getOwnerName()));
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.core.data.SoulTicket;
|
||||
import wayoftime.bloodmagic.iface.ISigil;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
public class ItemSigilAir extends ItemSigilBase
|
||||
{
|
||||
public ItemSigilAir()
|
||||
{
|
||||
super("air", 50);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.resultFail(stack);
|
||||
|
||||
boolean unusable = isUnusable(stack);
|
||||
if (world.isRemote && !unusable)
|
||||
{
|
||||
Vector3d vec = player.getLookVec();
|
||||
double wantedVelocity = 1.7;
|
||||
|
||||
// TODO - Revisit after potions
|
||||
// if (player.isPotionActive(RegistrarBloodMagic.BOOST))
|
||||
// {
|
||||
// int amplifier = player.getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
|
||||
// wantedVelocity += (1 + amplifier) * (0.35);
|
||||
// }
|
||||
|
||||
player.setMotion(vec.x * wantedVelocity, vec.y * wantedVelocity, vec.z * wantedVelocity);
|
||||
|
||||
world.playSound(null, player.getPosX(), player.getPosY(), player.getPosZ(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F
|
||||
+ (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!player.isCreative())
|
||||
this.setUnusable(stack, !NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess());
|
||||
|
||||
if (!unusable)
|
||||
player.fallDistance = 0;
|
||||
}
|
||||
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.item.ItemSigil;
|
||||
|
||||
public class ItemSigilBase extends ItemSigil
|
||||
{
|
||||
protected final String tooltipBase;
|
||||
// private final String name;
|
||||
|
||||
public ItemSigilBase(String name, int lpUsed)
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB), lpUsed);
|
||||
// super(lpUsed);
|
||||
|
||||
// this.name = name;
|
||||
this.tooltipBase = "tooltip.bloodmagic.sigil." + name + ".";
|
||||
}
|
||||
|
||||
public ItemSigilBase(String name)
|
||||
{
|
||||
this(name, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "desc"));
|
||||
// if (TextHelper.canTranslate(tooltipBase + "desc"))
|
||||
// tooltip.addAll(Arrays.asList(WordUtils.wrap(TextHelper.localizeEffect(tooltipBase
|
||||
// + "desc"), 30, "/cut", false).split("/cut")));
|
||||
|
||||
super.addInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
|
||||
// public String getName()
|
||||
// {
|
||||
// return name;
|
||||
// }
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.core.data.SoulNetwork;
|
||||
import wayoftime.bloodmagic.core.data.SoulTicket;
|
||||
import wayoftime.bloodmagic.entity.projectile.EntityBloodLight;
|
||||
import wayoftime.bloodmagic.iface.ISigil;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.helper.NBTHelper;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
public class ItemSigilBloodLight extends ItemSigilBase
|
||||
{
|
||||
public ItemSigilBloodLight()
|
||||
{
|
||||
super("bloodlight", 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (getCooldownRemainder(stack) > 0)
|
||||
reduceCooldown(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.resultFail(stack);
|
||||
|
||||
RayTraceResult mop = rayTrace(world, player, RayTraceContext.FluidMode.NONE);
|
||||
|
||||
if (getCooldownRemainder(stack) > 0)
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (mop != null && mop.getType() == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
BlockRayTraceResult blockRayTrace = (BlockRayTraceResult) mop;
|
||||
BlockPos blockPos = blockRayTrace.getPos().offset(blockRayTrace.getFace());
|
||||
|
||||
if (world.isAirBlock(blockPos))
|
||||
{
|
||||
world.setBlockState(blockPos, BloodMagicBlocks.BLOOD_LIGHT.get().getDefaultState());
|
||||
if (!world.isRemote)
|
||||
{
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(getBinding(stack));
|
||||
network.syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed()));
|
||||
}
|
||||
resetCooldown(stack);
|
||||
player.swingArm(hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(getBinding(stack));
|
||||
EntityBloodLight light = new EntityBloodLight(world, player);
|
||||
light.func_234612_a_(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
|
||||
world.addEntity(light);
|
||||
network.syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed()));
|
||||
}
|
||||
resetCooldown(stack);
|
||||
}
|
||||
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged)
|
||||
{
|
||||
return oldStack.getItem() != newStack.getItem();
|
||||
}
|
||||
|
||||
public int getCooldownRemainder(ItemStack stack)
|
||||
{
|
||||
return NBTHelper.checkNBT(stack).getTag().getInt(Constants.NBT.TICKS_REMAINING);
|
||||
}
|
||||
|
||||
public void reduceCooldown(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack).getTag().putInt(Constants.NBT.TICKS_REMAINING, getCooldownRemainder(stack) - 1);
|
||||
}
|
||||
|
||||
public void resetCooldown(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack).getTag().putInt(Constants.NBT.TICKS_REMAINING, 10);
|
||||
}
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceContext.FluidMode;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.altar.IBloodAltar;
|
||||
import wayoftime.bloodmagic.core.data.Binding;
|
||||
import wayoftime.bloodmagic.iface.IAltarReader;
|
||||
import wayoftime.bloodmagic.iface.ISigil;
|
||||
import wayoftime.bloodmagic.util.ChatUtil;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.NumeralHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
||||
{
|
||||
|
||||
public ItemSigilDivination(boolean simple)
|
||||
{
|
||||
super(simple ? "divination" : "seer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.resultFail(stack);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
RayTraceResult position = Item.rayTrace(world, player, FluidMode.NONE);
|
||||
|
||||
if (position == null || position.getType() == RayTraceResult.Type.MISS)
|
||||
{
|
||||
super.onItemRightClick(world, player, hand);
|
||||
|
||||
Binding binding = getBinding(stack);
|
||||
if (binding != null)
|
||||
{
|
||||
int currentEssence = NetworkHelper.getSoulNetwork(binding).getCurrentEssence();
|
||||
List<ITextComponent> toSend = Lists.newArrayList();
|
||||
if (!binding.getOwnerId().equals(player.getGameProfile().getId()))
|
||||
toSend.add(new TranslationTextComponent(tooltipBase + "otherNetwork", binding.getOwnerName()));
|
||||
toSend.add(new TranslationTextComponent(tooltipBase + "currentEssence", currentEssence));
|
||||
ChatUtil.sendNoSpam(player, toSend.toArray(new ITextComponent[toSend.size()]));
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (position.getType() == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(new BlockPos(position.getHitVec()));
|
||||
|
||||
if (tile != null && tile instanceof IBloodAltar)
|
||||
{
|
||||
IBloodAltar altar = (IBloodAltar) tile;
|
||||
int tier = altar.getTier().ordinal() + 1;
|
||||
int currentEssence = altar.getCurrentBlood();
|
||||
int capacity = altar.getCapacity();
|
||||
altar.checkTier();
|
||||
ChatUtil.sendNoSpam(player, new TranslationTextComponent(tooltipBase
|
||||
+ "currentAltarTier", NumeralHelper.toRoman(tier)), new TranslationTextComponent(tooltipBase
|
||||
+ "currentEssence", currentEssence), new TranslationTextComponent(tooltipBase
|
||||
+ "currentAltarCapacity", capacity));
|
||||
}
|
||||
// else if (tile != null && tile instanceof TileIncenseAltar)
|
||||
// {
|
||||
// TileIncenseAltar altar = (TileIncenseAltar) tile;
|
||||
// altar.recheckConstruction();
|
||||
// double tranquility = altar.tranquility;
|
||||
// ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentTranquility", (int) ((100D * (int) (100 * tranquility)) / 100d)), new TextComponentTranslation(tooltipBase + "currentBonus", (int) (100 * altar.incenseAddition)));
|
||||
// } else if (tile != null && tile instanceof TileInversionPillar)
|
||||
// {
|
||||
// TileInversionPillar pillar = (TileInversionPillar) tile;
|
||||
// double inversion = pillar.getCurrentInversion();
|
||||
// ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentInversion", ((int) (10 * inversion)) / 10d));
|
||||
// }
|
||||
else
|
||||
{
|
||||
Binding binding = getBinding(stack);
|
||||
if (binding != null)
|
||||
{
|
||||
int currentEssence = NetworkHelper.getSoulNetwork(binding).getCurrentEssence();
|
||||
List<ITextComponent> toSend = Lists.newArrayList();
|
||||
if (!binding.getOwnerId().equals(player.getGameProfile().getId()))
|
||||
toSend.add(new TranslationTextComponent(tooltipBase
|
||||
+ "otherNetwork", binding.getOwnerName()));
|
||||
toSend.add(new TranslationTextComponent(tooltipBase + "currentEssence", currentEssence));
|
||||
ChatUtil.sendNoSpam(player, toSend.toArray(new ITextComponent[toSend.size()]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.util.DamageSourceBloodMagic;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
public class ItemSigilFastMiner extends ItemSigilToggleableBase
|
||||
{
|
||||
public ItemSigilFastMiner()
|
||||
{
|
||||
super("fast_miner", 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, PlayerEntity player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return;
|
||||
player.addPotionEffect(new EffectInstance(Effects.HASTE, 2, 0, true, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performArrayEffect(World world, BlockPos pos)
|
||||
{
|
||||
double radius = 10;
|
||||
int ticks = 600;
|
||||
int potionPotency = 2;
|
||||
|
||||
AxisAlignedBB bb = new AxisAlignedBB(pos).grow(radius);
|
||||
List<PlayerEntity> playerList = world.getEntitiesWithinAABB(PlayerEntity.class, bb);
|
||||
for (PlayerEntity player : playerList)
|
||||
{
|
||||
if (!player.isPotionActive(Effects.HASTE) || (player.isPotionActive(Effects.HASTE)
|
||||
&& player.getActivePotionEffect(Effects.HASTE).getAmplifier() < potionPotency))
|
||||
{
|
||||
player.addPotionEffect(new EffectInstance(Effects.HASTE, ticks, potionPotency));
|
||||
if (!player.isCreative())
|
||||
{
|
||||
player.hurtResistantTime = 0;
|
||||
player.attackEntityFrom(DamageSourceBloodMagic.INSTANCE, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasArrayEffect()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,149 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
|
||||
import net.minecraftforge.fluids.capability.wrappers.BlockWrapper;
|
||||
|
||||
public abstract class ItemSigilFluidBase extends ItemSigilBase
|
||||
{
|
||||
// Class for sigils that interact with fluids, either creating or deleting them.
|
||||
// Sigils still have to define their own onRightClick behavior, but the actual
|
||||
// fluid-interacting code is largely limited to here.
|
||||
public final FluidStack sigilFluid;
|
||||
|
||||
public ItemSigilFluidBase(String name, int lpUsed, FluidStack fluid)
|
||||
{
|
||||
super(name, lpUsed);
|
||||
sigilFluid = fluid;
|
||||
}
|
||||
|
||||
public ItemSigilFluidBase(String name, FluidStack fluid)
|
||||
{
|
||||
super(name);
|
||||
sigilFluid = fluid;
|
||||
}
|
||||
|
||||
public ItemSigilFluidBase(String name)
|
||||
{
|
||||
super(name);
|
||||
sigilFluid = null;
|
||||
}
|
||||
|
||||
// The following are handler functions for fluids, all genericized.
|
||||
// They're all based off of the Forge FluidUtil methods, but directly taking the
|
||||
// sigilFluid constant instead of getting an argument.
|
||||
|
||||
/*
|
||||
* Gets a fluid handler for the targeted block and siding. Works for both tile
|
||||
* entity liquid containers and fluid blocks. This one is literally identical to
|
||||
* the FluidUtil method of the same signature.
|
||||
*/
|
||||
@Nullable
|
||||
protected IFluidHandler getFluidHandler(World world, BlockPos blockPos, @Nullable Direction side)
|
||||
{
|
||||
BlockState state = world.getBlockState(blockPos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
IFluidHandler targetFluidHandler = FluidUtil.getFluidHandler(world, blockPos, side).orElse(null);
|
||||
|
||||
if (targetFluidHandler == null)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
return targetFluidHandler;
|
||||
// if (block instanceof IFluidBlock)
|
||||
// return new FluidBlockWrapper((IFluidBlock) block, world, blockPos);
|
||||
// else if (block instanceof BlockLiquid)
|
||||
// return new BlockLiquidWrapper((BlockLiquid) block, world, blockPos);
|
||||
// return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tries to insert fluid into a fluid handler. If doTransfer is false, only
|
||||
* simulate the transfer. If true, actually do so. Returns true if the transfer
|
||||
* is successful, false otherwise.
|
||||
*/
|
||||
protected boolean tryInsertSigilFluid(IFluidHandler destination, boolean doTransfer)
|
||||
{
|
||||
if (destination == null)
|
||||
return false;
|
||||
return destination.fill(sigilFluid, doTransfer ? FluidAction.EXECUTE : FluidAction.SIMULATE) > 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tries basically the oppostive of the above, removing fluids instead of adding
|
||||
* them
|
||||
*/
|
||||
protected boolean tryRemoveFluid(IFluidHandler source, int amount, boolean doTransfer)
|
||||
{
|
||||
if (source == null)
|
||||
return false;
|
||||
return source.drain(amount, doTransfer ? FluidAction.EXECUTE : FluidAction.SIMULATE) != null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tries to place a fluid block in the world. Returns true if successful,
|
||||
* otherwise false. This is the big troublesome one, oddly enough. It's
|
||||
* genericized in case anyone wants to create variant sigils with weird fluids.
|
||||
*/
|
||||
protected boolean tryPlaceSigilFluid(PlayerEntity player, World world, BlockPos blockPos)
|
||||
{
|
||||
BlockState state = sigilFluid.getFluid().getAttributes().getBlock(world, blockPos, sigilFluid.getFluid().getDefaultState());
|
||||
BlockWrapper wrapper = new BlockWrapper(state, world, blockPos);
|
||||
return wrapper.fill(sigilFluid, FluidAction.EXECUTE) > 0;
|
||||
// // Make sure world coordinants are valid
|
||||
// if (world == null || blockPos == null)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// // Make sure fluid is placeable
|
||||
// Fluid fluid = sigilFluid.getFluid();
|
||||
// if (!fluid.getAttributes().canBePlacedInWorld(world, blockPos, sigilFluid))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// // Check if the block is an air block or otherwise replaceable
|
||||
// BlockState state = world.getBlockState(blockPos);
|
||||
// Material mat = state.getMaterial();
|
||||
// boolean isDestSolid = mat.isSolid();
|
||||
// boolean isDestReplaceable = state.getBlock().isReplaceable(state, fluid);
|
||||
// if (!world.isAirBlock(blockPos) && isDestSolid && !isDestReplaceable)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
//// // If the fluid vaporizes, this exists here in the lava sigil solely so the code
|
||||
//// // is usable for other fluids
|
||||
//// if (world.provider.doesWaterVaporize() && fluid.doesVaporize(sigilFluid))
|
||||
//// {
|
||||
//// fluid.vaporize(player, world, blockPos, sigilFluid);
|
||||
//// return true;
|
||||
//// }
|
||||
//
|
||||
// // Finally we've done enough checking to make sure everything at the end is
|
||||
// // safe, let's place some fluid.
|
||||
// IFluidHandler handler;
|
||||
// Block block = fluid.getAttributes().getStateForPlacement(world, blockPos, sigilFluid).getBlockState().getBlock();
|
||||
// if (block instanceof IFluidBlock)
|
||||
// {
|
||||
// handler = new FluidBlockWrapper((IFluidBlock) block, world, blockPos);
|
||||
// } else if (block instanceof BlockLiquid)
|
||||
// handler = new BlockLiquidWrapper((BlockLiquid) block, world, blockPos);
|
||||
// else
|
||||
// handler = new BlockWrapper(block, world, blockPos);
|
||||
// return tryInsertSigilFluid(handler, true);
|
||||
//// return false;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import net.minecraft.enchantment.FrostWalkerEnchantment;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
public class ItemSigilFrost extends ItemSigilToggleableBase
|
||||
{
|
||||
public ItemSigilFrost()
|
||||
{
|
||||
super("frost", 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, PlayerEntity player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return;
|
||||
|
||||
FrostWalkerEnchantment.freezeNearby(player, world, player.getPosition(), 1);
|
||||
}
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import wayoftime.bloodmagic.core.data.SoulTicket;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
public class ItemSigilGreenGrove extends ItemSigilToggleableBase
|
||||
{
|
||||
public ItemSigilGreenGrove()
|
||||
{
|
||||
super("green_grove", 150);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSigilUse(ItemStack stack, PlayerEntity player, World world, BlockPos blockPos, Direction side, Vector3d vec)
|
||||
{
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return false;
|
||||
|
||||
if (NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess()
|
||||
&& applyBonemeal(stack, world, blockPos, player))
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.playEvent(2005, blockPos, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World worldIn, PlayerEntity player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return;
|
||||
|
||||
int range = 3;
|
||||
int verticalRange = 2;
|
||||
int posX = (int) Math.round(player.getPosX() - 0.5f);
|
||||
int posY = (int) player.getPosY();
|
||||
int posZ = (int) Math.round(player.getPosZ() - 0.5f);
|
||||
if (worldIn instanceof ServerWorld)
|
||||
{
|
||||
ServerWorld serverWorld = (ServerWorld) worldIn;
|
||||
for (int ix = posX - range; ix <= posX + range; ix++)
|
||||
{
|
||||
for (int iz = posZ - range; iz <= posZ + range; iz++)
|
||||
{
|
||||
for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++)
|
||||
{
|
||||
BlockPos blockPos = new BlockPos(ix, iy, iz);
|
||||
BlockState state = worldIn.getBlockState(blockPos);
|
||||
|
||||
// if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state))
|
||||
{
|
||||
if (state.getBlock() instanceof IGrowable)
|
||||
{
|
||||
if (worldIn.rand.nextInt(50) == 0)
|
||||
{
|
||||
BlockState preBlockState = worldIn.getBlockState(blockPos);
|
||||
((IGrowable) state.getBlock()).grow(serverWorld, worldIn.rand, blockPos, state);
|
||||
|
||||
BlockState newState = worldIn.getBlockState(blockPos);
|
||||
if (!newState.equals(preBlockState) && !worldIn.isRemote)
|
||||
worldIn.playEvent(2005, blockPos, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos pos, PlayerEntity player)
|
||||
{
|
||||
BlockState blockstate = worldIn.getBlockState(pos);
|
||||
int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, pos, blockstate, stack);
|
||||
if (hook != 0)
|
||||
return hook > 0;
|
||||
if (blockstate.getBlock() instanceof IGrowable)
|
||||
{
|
||||
IGrowable igrowable = (IGrowable) blockstate.getBlock();
|
||||
if (igrowable.canGrow(worldIn, pos, blockstate, worldIn.isRemote))
|
||||
{
|
||||
if (worldIn instanceof ServerWorld)
|
||||
{
|
||||
if (igrowable.canUseBonemeal(worldIn, worldIn.rand, pos, blockstate))
|
||||
{
|
||||
igrowable.grow((ServerWorld) worldIn, worldIn.rand, pos, blockstate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import wayoftime.bloodmagic.core.data.SoulTicket;
|
||||
import wayoftime.bloodmagic.iface.ISigil;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
public class ItemSigilLava extends ItemSigilFluidBase
|
||||
{
|
||||
public ItemSigilLava()
|
||||
{
|
||||
super("lava", 1000, new FluidStack(Fluids.LAVA, 10000));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.resultFail(stack);
|
||||
|
||||
if (!world.isRemote && !isUnusable(stack))
|
||||
{
|
||||
RayTraceResult rayTrace = rayTrace(world, player, RayTraceContext.FluidMode.NONE);
|
||||
|
||||
if (rayTrace == null || rayTrace.getType() != RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
return ActionResult.resultFail(stack);
|
||||
}
|
||||
|
||||
BlockRayTraceResult blockRayTrace = (BlockRayTraceResult) rayTrace;
|
||||
BlockPos blockPos = blockRayTrace.getPos();
|
||||
Direction sideHit = blockRayTrace.getFace();
|
||||
BlockPos blockpos1 = blockPos.offset(sideHit);
|
||||
|
||||
if (world.isBlockModifiable(player, blockPos) && player.canPlayerEdit(blockpos1, sideHit, stack))
|
||||
{
|
||||
|
||||
// Case for if block at blockPos is a fluid handler like a tank
|
||||
// Try to put fluid into tank
|
||||
IFluidHandler destination = getFluidHandler(world, blockPos, null);
|
||||
if (destination != null && tryInsertSigilFluid(destination, false)
|
||||
&& NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
|
||||
{
|
||||
boolean result = tryInsertSigilFluid(destination, true);
|
||||
if (result)
|
||||
return ActionResult.resultSuccess(stack);
|
||||
}
|
||||
// Do the same as above, but use sidedness to interact with the fluid handler.
|
||||
IFluidHandler destinationSide = getFluidHandler(world, blockPos, sideHit);
|
||||
if (destinationSide != null && tryInsertSigilFluid(destinationSide, false)
|
||||
&& NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
|
||||
{
|
||||
boolean result = tryInsertSigilFluid(destinationSide, true);
|
||||
if (result)
|
||||
return ActionResult.resultSuccess(stack);
|
||||
}
|
||||
|
||||
// Case for if block at blockPos is not a tank
|
||||
// Place fluid in world
|
||||
if (destination == null && destinationSide == null)
|
||||
{
|
||||
BlockPos targetPos = blockPos.offset(sideHit);
|
||||
if (tryPlaceSigilFluid(player, world, targetPos)
|
||||
&& NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
|
||||
{
|
||||
return ActionResult.resultSuccess(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.item.ExperienceOrbEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
public class ItemSigilMagnetism extends ItemSigilToggleableBase
|
||||
{
|
||||
public ItemSigilMagnetism()
|
||||
{
|
||||
super("magnetism", 50);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, PlayerEntity player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return;
|
||||
|
||||
int range = 5;
|
||||
int verticalRange = 5;
|
||||
float posX = Math.round(player.getPosX());
|
||||
float posY = (float) (player.getPosY() - player.getEyeHeight());
|
||||
float posZ = Math.round(player.getPosZ());
|
||||
List<ItemEntity> entities = player.getEntityWorld().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(posX
|
||||
- 0.5f, posY - 0.5f, posZ
|
||||
- 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range));
|
||||
List<ExperienceOrbEntity> xpOrbs = player.getEntityWorld().getEntitiesWithinAABB(ExperienceOrbEntity.class, new AxisAlignedBB(posX
|
||||
- 0.5f, posY - 0.5f, posZ
|
||||
- 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range));
|
||||
|
||||
for (ItemEntity entity : entities)
|
||||
{
|
||||
if (entity != null && !world.isRemote && entity.isAlive())
|
||||
{
|
||||
entity.onCollideWithPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
for (ExperienceOrbEntity xpOrb : xpOrbs)
|
||||
{
|
||||
if (xpOrb != null && !world.isRemote)
|
||||
{
|
||||
xpOrb.onCollideWithPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.common.item.ItemSigil;
|
||||
import wayoftime.bloodmagic.core.data.Binding;
|
||||
import wayoftime.bloodmagic.core.data.SoulTicket;
|
||||
import wayoftime.bloodmagic.iface.IActivatable;
|
||||
import wayoftime.bloodmagic.iface.ISigil;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.helper.NBTHelper;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
/**
|
||||
* Base class for all toggleable sigils.
|
||||
*/
|
||||
public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
||||
{
|
||||
|
||||
public ItemSigilToggleable(Properties property, int lpUsed)
|
||||
{
|
||||
super(property, lpUsed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getActivated(ItemStack stack)
|
||||
{
|
||||
return !stack.isEmpty() && NBTHelper.checkNBT(stack).getTag().getBoolean(Constants.NBT.ACTIVATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack setActivatedState(ItemStack stack, boolean activated)
|
||||
{
|
||||
if (!stack.isEmpty())
|
||||
{
|
||||
NBTHelper.checkNBT(stack).getTag().putBoolean(Constants.NBT.ACTIVATED, activated);
|
||||
return stack;
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.resultFail(stack);
|
||||
|
||||
if (!world.isRemote && !isUnusable(stack))
|
||||
{
|
||||
if (player.isSneaking())
|
||||
setActivatedState(stack, !getActivated(stack));
|
||||
if (getActivated(stack))
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext context)
|
||||
{
|
||||
World world = context.getWorld();
|
||||
BlockPos blockpos = context.getPos();
|
||||
|
||||
PlayerEntity player = context.getPlayer();
|
||||
ItemStack stack = context.getItem();
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
|
||||
Binding binding = getBinding(stack);
|
||||
if (binding == null || player.isSneaking()) // Make sure Sigils are bound before handling. Also ignores while
|
||||
// toggling state
|
||||
return ActionResultType.PASS;
|
||||
|
||||
return onSigilUse(stack, player, world, blockpos, context.getFace(), context.getHitVec())
|
||||
? ActionResultType.SUCCESS
|
||||
: ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
public boolean onSigilUse(ItemStack itemStack, PlayerEntity player, World world, BlockPos blockPos, Direction side, Vector3d hitVec)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (!worldIn.isRemote && entityIn instanceof PlayerEntity && getActivated(stack))
|
||||
{
|
||||
if (entityIn.ticksExisted % 100 == 0)
|
||||
{
|
||||
if (!NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage((PlayerEntity) entityIn, SoulTicket.item(stack, worldIn, entityIn, getLpUsed())).isSuccess())
|
||||
{
|
||||
setActivatedState(stack, false);
|
||||
}
|
||||
}
|
||||
|
||||
onSigilUpdate(stack, worldIn, (PlayerEntity) entityIn, itemSlot, isSelected);
|
||||
}
|
||||
}
|
||||
|
||||
public void onSigilUpdate(ItemStack stack, World world, PlayerEntity player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
|
||||
public class ItemSigilToggleableBase extends ItemSigilToggleable// implements IMeshProvider
|
||||
{
|
||||
protected final String tooltipBase;
|
||||
private final String name;
|
||||
|
||||
public ItemSigilToggleableBase(String name, int lpUsed)
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB), lpUsed);
|
||||
|
||||
this.name = name;
|
||||
this.tooltipBase = "tooltip.bloodmagic.sigil." + name + ".";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
super.addInformation(stack, world, tooltip, flag);
|
||||
if (!stack.hasTag())
|
||||
return;
|
||||
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic." + (getActivated(stack) ? "activated"
|
||||
: "deactivated")));
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public ItemMeshDefinition getMeshDefinition()
|
||||
// {
|
||||
// return new CustomMeshDefinitionActivatable("sigil_" + name.toLowerCase(Locale.ROOT));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void gatherVariants(Consumer<String> variants)
|
||||
// {
|
||||
// variants.accept("active=false");
|
||||
// variants.accept("active=true");
|
||||
// }
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.IBucketPickupHandler;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import wayoftime.bloodmagic.core.data.SoulTicket;
|
||||
import wayoftime.bloodmagic.iface.ISigil;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
public class ItemSigilVoid extends ItemSigilFluidBase
|
||||
{
|
||||
public ItemSigilVoid()
|
||||
{
|
||||
super("void", 50, new FluidStack(Fluids.EMPTY, 1000));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.resultFail(stack);
|
||||
|
||||
if (!world.isRemote && !isUnusable(stack))
|
||||
{
|
||||
RayTraceResult rayTrace = rayTrace(world, player, RayTraceContext.FluidMode.SOURCE_ONLY);
|
||||
|
||||
if (rayTrace == null || rayTrace.getType() != RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
return ActionResult.resultFail(stack);
|
||||
}
|
||||
|
||||
BlockRayTraceResult blockRayTrace = (BlockRayTraceResult) rayTrace;
|
||||
BlockPos blockPos = blockRayTrace.getPos();
|
||||
Direction sideHit = blockRayTrace.getFace();
|
||||
|
||||
if (world.isBlockModifiable(player, blockPos) && player.canPlayerEdit(blockPos, sideHit, stack))
|
||||
{
|
||||
BlockState blockState = world.getBlockState(blockPos);
|
||||
if (blockState.getBlock() instanceof IBucketPickupHandler)
|
||||
{
|
||||
if (NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
|
||||
{
|
||||
((IBucketPickupHandler) blockState.getBlock()).pickupFluid(world, blockPos, blockState);
|
||||
return ActionResult.resultSuccess(stack);
|
||||
}
|
||||
}
|
||||
// Void is simpler than the other fluid sigils, because getFluidHandler grabs
|
||||
// fluid blocks just fine
|
||||
// So extract from fluid tanks with a null side; or drain fluid blocks.
|
||||
// IFluidHandler destination = getFluidHandler(world, blockPos, sideHit);
|
||||
// if (destination != null && tryRemoveFluid(destination, 1000, false)
|
||||
// && NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
|
||||
// {
|
||||
// if (tryRemoveFluid(destination, 1000, true))
|
||||
// return ActionResult.resultSuccess(stack);
|
||||
// }
|
||||
// // Do the same as above, but use sidedness to interact with the fluid handler.
|
||||
// IFluidHandler destinationSide = getFluidHandler(world, blockPos, sideHit);
|
||||
// if (destinationSide != null && tryRemoveFluid(destinationSide, 1000, false)
|
||||
// && NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
|
||||
// {
|
||||
// if (tryRemoveFluid(destinationSide, 1000, true))
|
||||
// return ActionResult.resultSuccess(stack);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.sigil;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.CauldronBlock;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import wayoftime.bloodmagic.core.data.SoulTicket;
|
||||
import wayoftime.bloodmagic.iface.ISigil;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
public class ItemSigilWater extends ItemSigilFluidBase
|
||||
{
|
||||
public ItemSigilWater()
|
||||
{
|
||||
super("water", 100, new FluidStack(Fluids.WATER, 10000));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.resultFail(stack);
|
||||
|
||||
if (!world.isRemote && !isUnusable(stack))
|
||||
{
|
||||
RayTraceResult rayTrace = rayTrace(world, player, RayTraceContext.FluidMode.NONE);
|
||||
|
||||
if (rayTrace == null || rayTrace.getType() != RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
return ActionResult.resultFail(stack);
|
||||
}
|
||||
|
||||
BlockRayTraceResult blockRayTrace = (BlockRayTraceResult) rayTrace;
|
||||
BlockPos blockPos = blockRayTrace.getPos();
|
||||
Direction sideHit = blockRayTrace.getFace();
|
||||
BlockPos blockpos1 = blockPos.offset(sideHit);
|
||||
|
||||
if (world.isBlockModifiable(player, blockPos) && player.canPlayerEdit(blockpos1, sideHit, stack))
|
||||
{
|
||||
|
||||
// Case for if block at blockPos is a fluid handler like a tank
|
||||
// Try to put fluid into tank
|
||||
IFluidHandler destination = getFluidHandler(world, blockPos, null);
|
||||
if (destination != null && tryInsertSigilFluid(destination, false)
|
||||
&& NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
|
||||
{
|
||||
boolean result = tryInsertSigilFluid(destination, true);
|
||||
if (result)
|
||||
return ActionResult.resultSuccess(stack);
|
||||
}
|
||||
// Do the same as above, but use sidedness to interact with the fluid handler.
|
||||
IFluidHandler destinationSide = getFluidHandler(world, blockPos, sideHit);
|
||||
if (destinationSide != null && tryInsertSigilFluid(destinationSide, false)
|
||||
&& NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
|
||||
{
|
||||
boolean result = tryInsertSigilFluid(destinationSide, true);
|
||||
if (result)
|
||||
return ActionResult.resultSuccess(stack);
|
||||
}
|
||||
|
||||
// Special vanilla cauldron handling, yay.
|
||||
if (world.getBlockState(blockPos).getBlock() == Blocks.CAULDRON
|
||||
&& NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
|
||||
{
|
||||
world.setBlockState(blockPos, Blocks.CAULDRON.getDefaultState().with(CauldronBlock.LEVEL, 3));
|
||||
return ActionResult.resultSuccess(stack);
|
||||
}
|
||||
|
||||
// Case for if block at blockPos is not a tank
|
||||
// Place fluid in world
|
||||
if (destination == null && destinationSide == null)
|
||||
{
|
||||
BlockPos targetPos = blockPos.offset(sideHit);
|
||||
if (tryPlaceSigilFluid(player, world, targetPos)
|
||||
&& NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
|
||||
{
|
||||
return ActionResult.resultSuccess(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.soul;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.util.ChatUtil;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.helper.NBTHelper;
|
||||
import wayoftime.bloodmagic.will.EnumDemonWillType;
|
||||
import wayoftime.bloodmagic.will.IDemonWill;
|
||||
|
||||
public class ItemMonsterSoul extends Item implements IDemonWill
|
||||
{
|
||||
private final EnumDemonWillType type;
|
||||
|
||||
public ItemMonsterSoul(EnumDemonWillType type)
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB));
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
if (!stack.hasTag())
|
||||
return;
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.will", ChatUtil.DECIMAL_FORMAT.format(getWill(getType(stack), stack))));
|
||||
|
||||
super.addInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumDemonWillType getType(ItemStack stack)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWill(EnumDemonWillType type, ItemStack soulStack)
|
||||
{
|
||||
if (type != this.getType(soulStack))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NBTHelper.checkNBT(soulStack);
|
||||
|
||||
CompoundNBT tag = soulStack.getTag();
|
||||
|
||||
return tag.getDouble(Constants.NBT.SOULS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items)
|
||||
{
|
||||
if (this.isInGroup(group))
|
||||
{
|
||||
ItemStack stack = new ItemStack(this);
|
||||
this.setWill(type, stack, 5);
|
||||
items.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setWill(EnumDemonWillType type, ItemStack soulStack, double souls)
|
||||
{
|
||||
if (type != this.getType(soulStack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NBTHelper.checkNBT(soulStack);
|
||||
CompoundNBT tag = soulStack.getTag();
|
||||
tag.putDouble(Constants.NBT.SOULS, souls);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double drainWill(EnumDemonWillType type, ItemStack soulStack, double drainAmount)
|
||||
{
|
||||
double souls = getWill(type, soulStack);
|
||||
|
||||
double soulsDrained = Math.min(drainAmount, souls);
|
||||
setWill(type, soulStack, souls - soulsDrained);
|
||||
|
||||
return soulsDrained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createWill(double number)
|
||||
{
|
||||
ItemStack soulStack = new ItemStack(this);
|
||||
setWill(getType(soulStack), soulStack, number);
|
||||
return soulStack;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public double getWill(ItemStack willStack)
|
||||
// {
|
||||
// return this.getWill(EnumDemonWillType.DEFAULT, willStack);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setWill(ItemStack willStack, double will)
|
||||
// {
|
||||
// this.setWill(EnumDemonWillType.DEFAULT, willStack, will);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double drainWill(ItemStack willStack, double drainAmount)
|
||||
// {
|
||||
// return this.drainWill(EnumDemonWillType.DEFAULT, willStack, drainAmount);
|
||||
// }
|
||||
|
||||
}
|
|
@ -1,505 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.soul;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.monster.SlimeEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.SwordItem;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.Difficulty;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.item.BMItemTier;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
import wayoftime.bloodmagic.iface.IMultiWillTool;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.helper.NBTHelper;
|
||||
import wayoftime.bloodmagic.will.EnumDemonWillType;
|
||||
import wayoftime.bloodmagic.will.IDemonWill;
|
||||
import wayoftime.bloodmagic.will.IDemonWillWeapon;
|
||||
import wayoftime.bloodmagic.will.PlayerDemonWillHandler;
|
||||
|
||||
public class ItemSentientSword extends SwordItem implements IDemonWillWeapon, IMultiWillTool
|
||||
{
|
||||
public static int[] soulBracket = new int[]
|
||||
{ 16, 60, 200, 400, 1000, 2000, 4000 };
|
||||
public static double[] defaultDamageAdded = new double[]
|
||||
{ 1, 1.5, 2, 2.5, 3, 3.5, 4 };
|
||||
public static double[] destructiveDamageAdded = new double[]
|
||||
{ 1.5, 2.25, 3, 3.75, 4.5, 5.25, 6 };
|
||||
public static double[] vengefulDamageAdded = new double[]
|
||||
{ 0, 0.5, 1, 1.5, 2, 2.25, 2.5 };
|
||||
public static double[] steadfastDamageAdded = new double[]
|
||||
{ 0, 0.5, 1, 1.5, 2, 2.25, 2.5 };
|
||||
public static double[] soulDrainPerSwing = new double[]
|
||||
{ 0.05, 0.1, 0.2, 0.4, 0.75, 1, 1.25 };
|
||||
public static double[] soulDrop = new double[]
|
||||
{ 2, 4, 7, 10, 13, 15, 18 };
|
||||
public static double[] staticDrop = new double[]
|
||||
{ 1, 1, 2, 3, 3, 4, 4 };
|
||||
|
||||
public static double[] healthBonus = new double[]
|
||||
{ 0, 0, 0, 0, 0, 0, 0 }; // TODO: Think of implementing this later
|
||||
public static double[] vengefulAttackSpeed = new double[]
|
||||
{ -2.1, -2, -1.8, -1.7, -1.6, -1.6, -1.5 };
|
||||
public static double[] destructiveAttackSpeed = new double[]
|
||||
{ -2.6, -2.7, -2.8, -2.9, -3, -3, -3 };
|
||||
|
||||
public static int[] absorptionTime = new int[]
|
||||
{ 200, 300, 400, 500, 600, 700, 800 };
|
||||
|
||||
public static double maxAbsorptionHearts = 10;
|
||||
|
||||
public static int[] poisonTime = new int[]
|
||||
{ 25, 50, 60, 80, 100, 120, 150 };
|
||||
public static int[] poisonLevel = new int[]
|
||||
{ 0, 0, 0, 1, 1, 1, 1 };
|
||||
|
||||
public static double[] movementSpeed = new double[]
|
||||
{ 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4 };
|
||||
|
||||
public ItemSentientSword()
|
||||
{
|
||||
// super(RegistrarBloodMagicItems.SOUL_TOOL_MATERIAL);
|
||||
super(BMItemTier.SENTIENT, 6, -2.6f, new Item.Properties().maxDamage(520).group(BloodMagic.TAB));
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
// {
|
||||
// return RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL == repair.getItem()
|
||||
// || super.getIsRepairable(toRepair, repair);
|
||||
// }
|
||||
|
||||
public void recalculatePowers(ItemStack stack, World world, PlayerEntity player)
|
||||
{
|
||||
EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
recalculatePowers(stack, type, soulsRemaining);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, EnumDemonWillType type, double will)
|
||||
{
|
||||
this.setCurrentType(stack, will > 0 ? type : EnumDemonWillType.DEFAULT);
|
||||
int level = getLevel(stack, will);
|
||||
|
||||
double drain = level >= 0 ? soulDrainPerSwing[level] : 0;
|
||||
double extraDamage = getExtraDamage(type, level);
|
||||
|
||||
setActivatedState(stack, will > 16);
|
||||
|
||||
setDrainOfActivatedSword(stack, drain);
|
||||
setDamageOfActivatedSword(stack, 5 + extraDamage);
|
||||
setStaticDropOfActivatedSword(stack, level >= 0 ? staticDrop[level] : 1);
|
||||
setDropOfActivatedSword(stack, level >= 0 ? soulDrop[level] : 0);
|
||||
setAttackSpeedOfSword(stack, level >= 0 ? getAttackSpeed(type, level) : -2.4);
|
||||
setHealthBonusOfSword(stack, level >= 0 ? getHealthBonus(type, level) : 0);
|
||||
setSpeedOfSword(stack, level >= 0 ? getMovementSpeed(type, level) : 0);
|
||||
}
|
||||
|
||||
public boolean getActivated(ItemStack stack)
|
||||
{
|
||||
return !stack.isEmpty() && NBTHelper.checkNBT(stack).getTag().getBoolean(Constants.NBT.ACTIVATED);
|
||||
}
|
||||
|
||||
public ItemStack setActivatedState(ItemStack stack, boolean activated)
|
||||
{
|
||||
if (!stack.isEmpty())
|
||||
{
|
||||
NBTHelper.checkNBT(stack).getTag().putBoolean(Constants.NBT.ACTIVATED, activated);
|
||||
return stack;
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public double getExtraDamage(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
if (willBracket < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
case DEFAULT:
|
||||
return defaultDamageAdded[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveDamageAdded[willBracket];
|
||||
case VENGEFUL:
|
||||
return vengefulDamageAdded[willBracket];
|
||||
case STEADFAST:
|
||||
return steadfastDamageAdded[willBracket];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getAttackSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return vengefulAttackSpeed[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveAttackSpeed[willBracket];
|
||||
default:
|
||||
return -2.4;
|
||||
}
|
||||
}
|
||||
|
||||
public double getHealthBonus(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STEADFAST:
|
||||
return healthBonus[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double getMovementSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return movementSpeed[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void applyEffectToEntity(EnumDemonWillType type, int willBracket, LivingEntity target, LivingEntity attacker)
|
||||
{
|
||||
// switch (type)
|
||||
// {
|
||||
// case CORROSIVE:
|
||||
// target.addPotionEffect(new PotionEffect(MobEffects.WITHER, poisonTime[willBracket], poisonLevel[willBracket]));
|
||||
// break;
|
||||
// case DEFAULT:
|
||||
// break;
|
||||
// case DESTRUCTIVE:
|
||||
// break;
|
||||
// case STEADFAST:
|
||||
// if (!target.isEntityAlive())
|
||||
// {
|
||||
// float absorption = attacker.getAbsorptionAmount();
|
||||
// attacker.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, absorptionTime[willBracket], 127));
|
||||
// attacker.setAbsorptionAmount((float) Math.min(absorption
|
||||
// + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
|
||||
// }
|
||||
// break;
|
||||
// case VENGEFUL:
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker)
|
||||
{
|
||||
if (super.hitEntity(stack, target, attacker))
|
||||
{
|
||||
if (attacker instanceof PlayerEntity)
|
||||
{
|
||||
PlayerEntity attackerPlayer = (PlayerEntity) attacker;
|
||||
this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double will = PlayerDemonWillHandler.getTotalDemonWill(type, attackerPlayer);
|
||||
int willBracket = this.getLevel(stack, will);
|
||||
|
||||
applyEffectToEntity(type, willBracket, target, attackerPlayer);
|
||||
|
||||
// ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||
// if (offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
// {
|
||||
// ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
|
||||
// if (provider.providesEffectForWill(type))
|
||||
// {
|
||||
// provider.applyOnHitEffect(type, stack, offStack, attacker, target);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
if (!tag.contains(Constants.NBT.WILL_TYPE))
|
||||
{
|
||||
return EnumDemonWillType.DEFAULT;
|
||||
}
|
||||
|
||||
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
tag.putString(Constants.NBT.WILL_TYPE, type.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
recalculatePowers(player.getHeldItem(hand), world, player);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged)
|
||||
{
|
||||
return oldStack.getItem() != newStack.getItem();
|
||||
}
|
||||
|
||||
private int getLevel(ItemStack stack, double soulsRemaining)
|
||||
{
|
||||
int lvl = -1;
|
||||
for (int i = 0; i < soulBracket.length; i++)
|
||||
{
|
||||
if (soulsRemaining >= soulBracket[i])
|
||||
{
|
||||
lvl = i;
|
||||
}
|
||||
}
|
||||
|
||||
return lvl;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
if (!stack.hasTag())
|
||||
return;
|
||||
|
||||
// tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect("tooltip.bloodmagic.sentientSword.desc"))));
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.sentientSword.desc"));
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.currentType." + getCurrentType(stack).name().toLowerCase()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, PlayerEntity player, Entity entity)
|
||||
{
|
||||
recalculatePowers(stack, player.getEntityWorld(), player);
|
||||
|
||||
double drain = this.getDrainOfActivatedSword(stack);
|
||||
if (drain > 0)
|
||||
{
|
||||
EnumDemonWillType type = getCurrentType(stack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
|
||||
if (drain > soulsRemaining)
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
PlayerDemonWillHandler.consumeDemonWill(type, player, drain);
|
||||
}
|
||||
}
|
||||
|
||||
return super.onLeftClickEntity(stack, player, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getRandomDemonWillDrop(LivingEntity killedEntity, LivingEntity attackingEntity, ItemStack stack, int looting)
|
||||
{
|
||||
List<ItemStack> soulList = new ArrayList<>();
|
||||
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != Difficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
{
|
||||
return soulList;
|
||||
}
|
||||
|
||||
double willModifier = killedEntity instanceof SlimeEntity ? 0.67 : 1;
|
||||
|
||||
IDemonWill soul = ((IDemonWill) BloodMagicItems.MONSTER_SOUL_RAW.get());
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
||||
for (int i = 0; i <= looting; i++)
|
||||
{
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
|
||||
{
|
||||
ItemStack soulStack = soul.createWill(willModifier
|
||||
* (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble()
|
||||
+ this.getStaticDropOfActivatedSword(stack))
|
||||
* killedEntity.getMaxHealth() / 20d);
|
||||
soulList.add(soulStack);
|
||||
}
|
||||
}
|
||||
|
||||
return soulList;
|
||||
}
|
||||
|
||||
// TODO: Change attack speed.
|
||||
@Override
|
||||
public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack)
|
||||
{
|
||||
Multimap<Attribute, AttributeModifier> multimap = HashMultimap.create();
|
||||
if (slot == EquipmentSlotType.MAINHAND)
|
||||
{
|
||||
multimap.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), AttributeModifier.Operation.ADDITION));
|
||||
multimap.put(Attributes.ATTACK_SPEED, new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), AttributeModifier.Operation.ADDITION));
|
||||
multimap.put(Attributes.MAX_HEALTH, new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), AttributeModifier.Operation.ADDITION));
|
||||
multimap.put(Attributes.MOVEMENT_SPEED, new AttributeModifier(new UUID(0, 4218052), "Weapon modifier", this.getSpeedOfSword(stack), AttributeModifier.Operation.ADDITION));
|
||||
}
|
||||
|
||||
return multimap;
|
||||
}
|
||||
|
||||
public double getDamageOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DAMAGE);
|
||||
}
|
||||
|
||||
public void setDamageOfActivatedSword(ItemStack stack, double damage)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
tag.putDouble(Constants.NBT.SOUL_SWORD_DAMAGE, damage);
|
||||
}
|
||||
|
||||
public double getDrainOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN);
|
||||
}
|
||||
|
||||
public void setDrainOfActivatedSword(ItemStack stack, double drain)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
tag.putDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN, drain);
|
||||
}
|
||||
|
||||
public double getStaticDropOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP);
|
||||
}
|
||||
|
||||
public void setStaticDropOfActivatedSword(ItemStack stack, double drop)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
tag.putDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP, drop);
|
||||
}
|
||||
|
||||
public double getDropOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DROP);
|
||||
}
|
||||
|
||||
public void setDropOfActivatedSword(ItemStack stack, double drop)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
tag.putDouble(Constants.NBT.SOUL_SWORD_DROP, drop);
|
||||
}
|
||||
|
||||
public double getHealthBonusOfSword(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_HEALTH);
|
||||
}
|
||||
|
||||
public void setHealthBonusOfSword(ItemStack stack, double hp)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
tag.putDouble(Constants.NBT.SOUL_SWORD_HEALTH, hp);
|
||||
}
|
||||
|
||||
public double getAttackSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
public void setAttackSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
tag.putDouble(Constants.NBT.SOUL_SWORD_ATTACK_SPEED, speed);
|
||||
}
|
||||
|
||||
public double getSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_SPEED);
|
||||
}
|
||||
|
||||
public void setSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
CompoundNBT tag = stack.getTag();
|
||||
|
||||
tag.putDouble(Constants.NBT.SOUL_SWORD_SPEED, speed);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,260 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.soul;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.iface.IMultiWillTool;
|
||||
import wayoftime.bloodmagic.util.ChatUtil;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.helper.NBTHelper;
|
||||
import wayoftime.bloodmagic.will.EnumDemonWillType;
|
||||
import wayoftime.bloodmagic.will.IDemonWill;
|
||||
import wayoftime.bloodmagic.will.IDemonWillGem;
|
||||
import wayoftime.bloodmagic.will.PlayerDemonWillHandler;
|
||||
|
||||
public class ItemSoulGem extends Item implements IDemonWillGem, IMultiWillTool
|
||||
{
|
||||
private final int maxWill;
|
||||
private final String name;
|
||||
|
||||
public ItemSoulGem(String name, int maxWill)
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB));
|
||||
this.name = name;
|
||||
this.maxWill = maxWill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items)
|
||||
{
|
||||
if (this.isInGroup(group))
|
||||
{
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
ItemStack stack = new ItemStack(this);
|
||||
this.setCurrentType(type, stack);
|
||||
this.setWill(type, stack, maxWill);
|
||||
items.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double drain = Math.min(this.getWill(type, stack), this.getMaxWill(type, stack) / 10);
|
||||
|
||||
double filled = PlayerDemonWillHandler.addDemonWill(type, player, drain, stack);
|
||||
this.drainWill(type, stack, filled, true);
|
||||
|
||||
return new ActionResult<>(ActionResultType.PASS, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
if (!stack.hasTag())
|
||||
return;
|
||||
|
||||
Items d;
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.soulGem." + name));
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.will", ChatUtil.DECIMAL_FORMAT.format(getWill(type, stack))));
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.currentType." + getCurrentType(stack).name().toLowerCase()));
|
||||
|
||||
super.addInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double maxWill = getMaxWill(type, stack);
|
||||
if (maxWill <= 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 1.0 - (getWill(type, stack) / maxWill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRGBDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double maxWill = getMaxWill(type, stack);
|
||||
if (maxWill <= 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return MathHelper.hsvToRGB(Math.max(0.0F, (float) (getWill(type, stack)) / (float) maxWill) / 3.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack fillDemonWillGem(ItemStack soulGemStack, ItemStack soulStack)
|
||||
{
|
||||
if (soulStack != null && soulStack.getItem() instanceof IDemonWill)
|
||||
{
|
||||
EnumDemonWillType thisType = this.getCurrentType(soulGemStack);
|
||||
if (thisType != ((IDemonWill) soulStack.getItem()).getType(soulStack))
|
||||
{
|
||||
return soulStack;
|
||||
}
|
||||
IDemonWill soul = (IDemonWill) soulStack.getItem();
|
||||
double soulsLeft = getWill(thisType, soulGemStack);
|
||||
|
||||
if (soulsLeft < getMaxWill(thisType, soulGemStack))
|
||||
{
|
||||
double newSoulsLeft = Math.min(soulsLeft
|
||||
+ soul.getWill(thisType, soulStack), getMaxWill(thisType, soulGemStack));
|
||||
soul.drainWill(thisType, soulStack, newSoulsLeft - soulsLeft);
|
||||
|
||||
setWill(thisType, soulGemStack, newSoulsLeft);
|
||||
if (soul.getWill(thisType, soulStack) <= 0)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return soulStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWill(EnumDemonWillType type, ItemStack soulGemStack)
|
||||
{
|
||||
if (!type.equals(getCurrentType(soulGemStack)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
CompoundNBT tag = soulGemStack.getTag();
|
||||
|
||||
return tag.getDouble(Constants.NBT.SOULS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWill(EnumDemonWillType type, ItemStack soulGemStack, double souls)
|
||||
{
|
||||
setCurrentType(type, soulGemStack);
|
||||
|
||||
CompoundNBT tag = soulGemStack.getTag();
|
||||
|
||||
tag.putDouble(Constants.NBT.SOULS, souls);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double drainWill(EnumDemonWillType type, ItemStack soulGemStack, double drainAmount, boolean doDrain)
|
||||
{
|
||||
EnumDemonWillType currentType = this.getCurrentType(soulGemStack);
|
||||
if (currentType != type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
double souls = getWill(type, soulGemStack);
|
||||
|
||||
double soulsDrained = Math.min(drainAmount, souls);
|
||||
|
||||
if (doDrain)
|
||||
{
|
||||
setWill(type, soulGemStack, souls - soulsDrained);
|
||||
}
|
||||
|
||||
return soulsDrained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxWill(EnumDemonWillType type, ItemStack soulGemStack)
|
||||
{
|
||||
EnumDemonWillType currentType = getCurrentType(soulGemStack);
|
||||
if (!type.equals(currentType) && currentType != EnumDemonWillType.DEFAULT)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return maxWill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumDemonWillType getCurrentType(ItemStack soulGemStack)
|
||||
{
|
||||
NBTHelper.checkNBT(soulGemStack);
|
||||
|
||||
CompoundNBT tag = soulGemStack.getTag();
|
||||
|
||||
if (!tag.contains(Constants.NBT.WILL_TYPE))
|
||||
{
|
||||
return EnumDemonWillType.DEFAULT;
|
||||
}
|
||||
|
||||
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public void setCurrentType(EnumDemonWillType type, ItemStack soulGemStack)
|
||||
{
|
||||
NBTHelper.checkNBT(soulGemStack);
|
||||
|
||||
CompoundNBT tag = soulGemStack.getTag();
|
||||
|
||||
if (type == EnumDemonWillType.DEFAULT)
|
||||
{
|
||||
if (tag.contains(Constants.NBT.WILL_TYPE))
|
||||
{
|
||||
tag.remove(Constants.NBT.WILL_TYPE);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
tag.putString(Constants.NBT.WILL_TYPE, type.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double fillWill(EnumDemonWillType type, ItemStack stack, double fillAmount, boolean doFill)
|
||||
{
|
||||
if (!type.equals(getCurrentType(stack)) && this.getWill(getCurrentType(stack), stack) > 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double current = this.getWill(type, stack);
|
||||
double maxWill = this.getMaxWill(type, stack);
|
||||
|
||||
double filled = Math.min(fillAmount, maxWill - current);
|
||||
|
||||
if (doFill)
|
||||
{
|
||||
this.setWill(type, stack, filled + current);
|
||||
}
|
||||
|
||||
return filled;
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.item.soul;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.SnowballItem;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.entity.projectile.EntitySoulSnare;
|
||||
|
||||
public class ItemSoulSnare extends Item
|
||||
{
|
||||
public static String[] names =
|
||||
{ "base" };
|
||||
|
||||
public ItemSoulSnare()
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(16).group(BloodMagic.TAB));
|
||||
|
||||
// setTranslationKey(BloodMagic.MODID + ".soulSnare.");
|
||||
// setCreativeTab(BloodMagic.TAB_BM);
|
||||
// setHasSubtypes(true);
|
||||
// setMaxStackSize(16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand hand)
|
||||
{
|
||||
ItemStack stack = playerIn.getHeldItem(hand);
|
||||
if (!playerIn.isCreative())
|
||||
{
|
||||
stack.shrink(1);
|
||||
}
|
||||
|
||||
SnowballItem d;
|
||||
|
||||
worldIn.playSound((PlayerEntity) null, playerIn.getPosX(), playerIn.getPosY(), playerIn.getPosZ(), SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F
|
||||
/ (random.nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
System.out.println("Attempting to spawn");
|
||||
EntitySoulSnare snare = new EntitySoulSnare(worldIn, playerIn);
|
||||
snare.func_234612_a_(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
|
||||
worldIn.addEntity(snare);
|
||||
//
|
||||
// SnowballEntity snowballentity = new SnowballEntity(worldIn, playerIn);
|
||||
// snowballentity.setItem(itemstack);
|
||||
// snowballentity.func_234612_a_(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
|
||||
// worldIn.addEntity(snowballentity);
|
||||
}
|
||||
|
||||
return new ActionResult<>(ActionResultType.SUCCESS, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.soulSnare.desc"));
|
||||
|
||||
super.addInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.recipe;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.api.event.recipes.FluidStackIngredient;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.data.recipe.builder.ARCRecipeBuilder;
|
||||
|
||||
public class ARCRecipeProvider implements ISubRecipeProvider
|
||||
{
|
||||
@Override
|
||||
public void addRecipes(Consumer<IFinishedRecipe> consumer)
|
||||
{
|
||||
String basePath = "arc/";
|
||||
ARCRecipeBuilder.arc(Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), Ingredient.fromTag(Tags.Items.BONES), null, new ItemStack(BloodMagicBlocks.BLOOD_ALTAR.get()), null).addRandomOutput(new ItemStack(Items.DIAMOND), 0.5).build(consumer, BloodMagic.rl(basePath + "test1"));
|
||||
ARCRecipeBuilder.arc(Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), Ingredient.fromItems(Items.ACACIA_BOAT), FluidStackIngredient.from(Fluids.LAVA, 1000), new ItemStack(BloodMagicBlocks.BLOOD_ALTAR.get()), new FluidStack(Fluids.WATER, 100)).build(consumer, BloodMagic.rl(basePath + "test2"));
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.recipe;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.data.recipe.builder.AlchemyArrayRecipeBuilder;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
|
||||
public class AlchemyArrayRecipeProvider implements ISubRecipeProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public void addRecipes(Consumer<IFinishedRecipe> consumer)
|
||||
{
|
||||
String basePath = "array/";
|
||||
// AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/airsigil.png"), Ingredient.fromItems(Items.STONE), Ingredient.fromItems(Items.STONE), new ItemStack(Items.DIAMOND)).build(consumer, BloodMagic.rl(basePath
|
||||
// + "airsigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/divinationsigil.png"), Ingredient.fromItems(Items.REDSTONE), Ingredient.fromItems(BloodMagicItems.SLATE.get()), new ItemStack(BloodMagicItems.DIVINATION_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "divinationsigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/watersigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_WATER.get()), Ingredient.fromItems(BloodMagicItems.SLATE.get()), new ItemStack(BloodMagicItems.WATER_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "watersigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/lavasigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_LAVA.get()), Ingredient.fromItems(BloodMagicItems.SLATE.get()), new ItemStack(BloodMagicItems.LAVA_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "lavasigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/voidsigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_VOID.get()), Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new ItemStack(BloodMagicItems.VOID_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "voidsigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/growthsigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_GROWTH.get()), Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new ItemStack(BloodMagicItems.GREEN_GROVE_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "growthsigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/fastminersigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_FAST_MINER.get()), Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new ItemStack(BloodMagicItems.FAST_MINER_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "fastminersigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/magnetismsigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_MAGNETISM.get()), Ingredient.fromItems(BloodMagicItems.IMBUED_SLATE.get()), new ItemStack(BloodMagicItems.MAGNETISM_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "magnetismsigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/lightsigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_BLOOD_LIGHT.get()), Ingredient.fromItems(BloodMagicItems.IMBUED_SLATE.get()), new ItemStack(BloodMagicItems.BLOOD_LIGHT_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "bloodlightsigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/airsigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_AIR.get()), Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new ItemStack(BloodMagicItems.AIR_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "airsigil"));
|
||||
// AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/fastminersigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_FAST_MINER.get()), Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new ItemStack(BloodMagicItems.FAST_MINER_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "frostsigil"));
|
||||
// BloodAltarRecipeBuilder.altar(Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), new ItemStack(BloodMagicItems.WEAK_BLOOD_ORB.get()), AltarTier.ONE.ordinal(), 2000, 2, 1).build(consumer, new ResourceLocation(BloodMagic.MODID, basePath
|
||||
// + "weakbloodorb"));
|
||||
// BloodAltarRecipeBuilder.altar(Ingredient.fromTag(Tags.Items.STONE), new ItemStack(BloodMagicItems.SLATE.get()), AltarTier.ONE.ordinal(), 1000, 5, 5).build(consumer, new ResourceLocation(BloodMagic.MODID, basePath
|
||||
// + "slate"));
|
||||
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.recipe;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.altar.AltarTier;
|
||||
import wayoftime.bloodmagic.common.data.recipe.builder.BloodAltarRecipeBuilder;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
|
||||
public class BloodAltarRecipeProvider implements ISubRecipeProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public void addRecipes(Consumer<IFinishedRecipe> consumer)
|
||||
{
|
||||
String basePath = "altar/";
|
||||
|
||||
// ONE
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), new ItemStack(BloodMagicItems.WEAK_BLOOD_ORB.get()), AltarTier.ONE.ordinal(), 2000, 2, 1).build(consumer, new ResourceLocation(BloodMagic.MODID, basePath + "weakbloodorb"));
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromTag(Tags.Items.STONE), new ItemStack(BloodMagicItems.SLATE.get()), AltarTier.ONE.ordinal(), 1000, 5, 5).build(consumer, new ResourceLocation(BloodMagic.MODID, basePath + "slate"));
|
||||
|
||||
// TWO
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromItems(BloodMagicItems.SLATE.get()), new ItemStack(BloodMagicItems.REINFORCED_SLATE.get()), AltarTier.TWO.ordinal(), 2000, 5, 5).build(consumer, BloodMagic.rl(basePath + "reinforcedslate"));
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromTag(Tags.Items.STORAGE_BLOCKS_REDSTONE), new ItemStack(BloodMagicItems.APPRENTICE_BLOOD_ORB.get()), AltarTier.TWO.ordinal(), 5000, 5, 5).build(consumer, BloodMagic.rl(basePath + "apprenticebloodorb"));
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromItems(Items.IRON_SWORD), new ItemStack(BloodMagicItems.DAGGER_OF_SACRIFICE.get()), AltarTier.TWO.ordinal(), 3000, 5, 5).build(consumer, BloodMagic.rl(basePath + "daggerofsacrifice"));
|
||||
|
||||
// THREE
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new ItemStack(BloodMagicItems.IMBUED_SLATE.get()), AltarTier.THREE.ordinal(), 5000, 15, 10).build(consumer, BloodMagic.rl(basePath + "imbuedslate"));
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromTag(Tags.Items.STORAGE_BLOCKS_GOLD), new ItemStack(BloodMagicItems.MAGICIAN_BLOOD_ORB.get()), AltarTier.THREE.ordinal(), 25000, 20, 20).build(consumer, BloodMagic.rl(basePath + "magicianbloodorb"));
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromTag(Tags.Items.OBSIDIAN), new ItemStack(BloodMagicItems.EARTH_INSCRIPTION_TOOL.get()), AltarTier.THREE.ordinal(), 1000, 5, 5).build(consumer, BloodMagic.rl(basePath + "earth_tool"));
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromTag(Tags.Items.STORAGE_BLOCKS_LAPIS), new ItemStack(BloodMagicItems.WATER_INSCRIPTION_TOOL.get()), AltarTier.THREE.ordinal(), 1000, 5, 5).build(consumer, BloodMagic.rl(basePath + "water_tool"));
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromItems(Items.MAGMA_CREAM), new ItemStack(BloodMagicItems.FIRE_INSCRIPTION_TOOL.get()), AltarTier.THREE.ordinal(), 1000, 5, 5).build(consumer, BloodMagic.rl(basePath + "fire_tool"));
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromItems(Items.GHAST_TEAR), new ItemStack(BloodMagicItems.AIR_INSCRIPTION_TOOL.get()), AltarTier.THREE.ordinal(), 1000, 5, 5).build(consumer, BloodMagic.rl(basePath + "air_tool"));
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromItems(BloodMagicItems.LAVA_CRYSTAL.get()), new ItemStack(BloodMagicItems.WEAK_ACTIVATION_CRYSTAL.get()), AltarTier.THREE.ordinal(), 10000, 20, 10).build(consumer, BloodMagic.rl("weak_activation_crystal"));
|
||||
|
||||
// FOUR
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromItems(BloodMagicItems.IMBUED_SLATE.get()), new ItemStack(BloodMagicItems.DEMONIC_SLATE.get()), AltarTier.FOUR.ordinal(), 15000, 20, 20).build(consumer, BloodMagic.rl(basePath + "demonicslate"));
|
||||
BloodAltarRecipeBuilder.altar(Ingredient.fromTag(Tags.Items.STORAGE_BLOCKS_COAL), new ItemStack(BloodMagicItems.DUSK_INSCRIPTION_TOOL.get()), AltarTier.FOUR.ordinal(), 2000, 20, 10).build(consumer, BloodMagic.rl(basePath + "dusk_tool"));
|
||||
|
||||
// BloodAltarRecipeBuilder.altar(input, output, minimumTier, syphon, consumeRate, drainRate).build(consumer, BloodMagic.rl(basePath + ""));
|
||||
|
||||
// registrar.addBloodAltar(new OreIngredient("stone"), ItemSlate.SlateType.BLANK.getStack(), AltarTier.ONE.ordinal(), 1000, 5, 5);
|
||||
// registrar.addBloodAltar(Ingredient.fromItem(Items.BUCKET), FluidUtil.getFilledBucket(new FluidStack(BlockLifeEssence.getLifeEssence(), Fluid.BUCKET_VOLUME)), AltarTier.ONE.ordinal(), 1000, 5, 0);
|
||||
// registrar.addBloodAltar(Ingredient.fromItem(Items.BOOK), new ItemStack(RegistrarBloodMagicItems.SANGUINE_BOOK), AltarTier.ONE.ordinal(), 1000, 20, 0);
|
||||
//
|
||||
// // TWO
|
||||
// registrar.addBloodAltar(new OreIngredient("blockRedstone"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_APPRENTICE), AltarTier.TWO.ordinal(), 5000, 5, 5);
|
||||
// registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.BLANK.getStack()), ItemSlate.SlateType.REINFORCED.getStack(), AltarTier.TWO.ordinal(), 2000, 5, 5);
|
||||
// registrar.addBloodAltar(Ingredient.fromItem(Items.IRON_SWORD), new ItemStack(RegistrarBloodMagicItems.DAGGER_OF_SACRIFICE), AltarTier.TWO.ordinal(), 3000, 5, 5);
|
||||
//
|
||||
// // THREE
|
||||
// registrar.addBloodAltar(new OreIngredient("blockGold"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_MAGICIAN), AltarTier.THREE.ordinal(), 25000, 20, 20);
|
||||
// registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.REINFORCED.getStack()), ItemSlate.SlateType.IMBUED.getStack(), AltarTier.THREE.ordinal(), 5000, 15, 10);
|
||||
// registrar.addBloodAltar(new OreIngredient("obsidian"), EnumRuneType.EARTH.getStack(), AltarTier.THREE.ordinal(), 1000, 5, 5);
|
||||
// registrar.addBloodAltar(new OreIngredient("blockLapis"), EnumRuneType.WATER.getStack(), AltarTier.THREE.ordinal(), 1000, 5, 5);
|
||||
// registrar.addBloodAltar(Ingredient.fromItem(Items.MAGMA_CREAM), EnumRuneType.FIRE.getStack(), AltarTier.THREE.ordinal(), 1000, 5, 5);
|
||||
// registrar.addBloodAltar(Ingredient.fromItem(Items.GHAST_TEAR), EnumRuneType.AIR.getStack(), AltarTier.THREE.ordinal(), 1000, 5, 5);
|
||||
// registrar.addBloodAltar(Ingredient.fromItem(RegistrarBloodMagicItems.LAVA_CRYSTAL), new ItemStack(RegistrarBloodMagicItems.ACTIVATION_CRYSTAL), AltarTier.THREE.ordinal(), 10000, 20, 10);
|
||||
//
|
||||
// // FOUR
|
||||
// registrar.addBloodAltar(Ingredient.fromStacks(new ItemStack(RegistrarBloodMagicItems.BLOOD_SHARD)), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_MASTER), AltarTier.FOUR.ordinal(), 40000, 30, 50);
|
||||
// registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.IMBUED.getStack()), ItemSlate.SlateType.DEMONIC.getStack(), AltarTier.FOUR.ordinal(), 15000, 20, 20);
|
||||
// registrar.addBloodAltar(new OreIngredient("blockCoal"), EnumRuneType.DUSK.getStack(), AltarTier.FOUR.ordinal(), 2000, 20, 10);
|
||||
// registrar.addBloodAltar(new OreIngredient("enderpearl"), new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS), AltarTier.FOUR.ordinal(), 2000, 10, 10);
|
||||
// registrar.addBloodAltar(Ingredient.fromStacks(new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS)), new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS, 1, 1), AltarTier.FOUR.ordinal(), 10000, 20, 10);
|
||||
//
|
||||
// // FIVE
|
||||
// registrar.addBloodAltar(new OreIngredient("netherStar"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_ARCHMAGE), AltarTier.FIVE.ordinal(), 80000, 50, 100);
|
||||
// registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.DEMONIC.getStack()), ItemSlate.SlateType.ETHEREAL.getStack(), AltarTier.FIVE.ordinal(), 30000, 40, 100);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.recipe;
|
||||
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeARC;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyArray;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeTartaricForge;
|
||||
|
||||
public class BloodMagicRecipeType
|
||||
{
|
||||
public static final IRecipeType<RecipeBloodAltar> ALTAR = IRecipeType.register("altar");
|
||||
public static final IRecipeType<RecipeAlchemyArray> ARRAY = IRecipeType.register("array");
|
||||
public static final IRecipeType<RecipeTartaricForge> TARTARICFORGE = IRecipeType.register("soulforge");
|
||||
public static final IRecipeType<RecipeARC> ARC = IRecipeType.register("arc");
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.recipe;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
|
||||
/**
|
||||
* Interface for helping split the recipe provider over multiple classes to make
|
||||
* it a bit easier to interact with
|
||||
*/
|
||||
public interface ISubRecipeProvider
|
||||
{
|
||||
void addRecipes(Consumer<IFinishedRecipe> consumer);
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.recipe;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.data.recipe.builder.TartaricForgeRecipeBuilder;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
|
||||
public class TartaricForgeRecipeProvider implements ISubRecipeProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public void addRecipes(Consumer<IFinishedRecipe> consumer)
|
||||
{
|
||||
String basePath = "soulforge/";
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.PETTY_GEM.get()), 1, 1, Ingredient.fromTag(Tags.Items.DUSTS_REDSTONE), Ingredient.fromTag(Tags.Items.INGOTS_GOLD), Ingredient.fromTag(Tags.Items.GLASS), Ingredient.fromTag(Tags.Items.GEMS_LAPIS)).build(consumer, BloodMagic.rl(basePath + "pettytartaricgem"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.LESSER_GEM.get()), 60, 20, Ingredient.fromItems(BloodMagicItems.PETTY_GEM.get()), Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), Ingredient.fromTag(Tags.Items.STORAGE_BLOCKS_REDSTONE), Ingredient.fromTag(Tags.Items.STORAGE_BLOCKS_LAPIS)).build(consumer, BloodMagic.rl(basePath + "lessertartaricgem"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.COMMON_GEM.get()), 240, 50, Ingredient.fromItems(BloodMagicItems.LESSER_GEM.get()), Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), Ingredient.fromTag(Tags.Items.STORAGE_BLOCKS_GOLD), Ingredient.fromItems(BloodMagicItems.IMBUED_SLATE.get())).build(consumer, BloodMagic.rl(basePath + "commontartaricgem"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.SENTIENT_SWORD.get()), 0, 0, Ingredient.fromItems(BloodMagicItems.PETTY_GEM.get()), Ingredient.fromItems(Items.IRON_SWORD)).build(consumer, BloodMagic.rl(basePath + "sentientsword"));
|
||||
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_AIR.get()), 128, 20, Ingredient.fromItems(Items.GHAST_TEAR), Ingredient.fromTag(Tags.Items.FEATHERS), Ingredient.fromTag(Tags.Items.FEATHERS)).build(consumer, BloodMagic.rl(basePath + "reagent_air"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.ARCANE_ASHES.get()), 0, 0, Ingredient.fromTag(Tags.Items.DUSTS_REDSTONE), Ingredient.fromTag(Tags.Items.DYES_WHITE), Ingredient.fromTag(Tags.Items.GUNPOWDER), Ingredient.fromTag(ItemTags.COALS)).build(consumer, BloodMagic.rl(basePath + "arcaneashes"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_WATER.get()), 10, 3, Ingredient.fromItems(Items.SUGAR), Ingredient.fromItems(Items.WATER_BUCKET), Ingredient.fromItems(Items.WATER_BUCKET)).build(consumer, BloodMagic.rl(basePath + "reagent_water"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_LAVA.get()), 32, 10, Ingredient.fromItems(Items.LAVA_BUCKET), Ingredient.fromTag(Tags.Items.DUSTS_REDSTONE), Ingredient.fromTag(Tags.Items.COBBLESTONE), Ingredient.fromTag(Tags.Items.STORAGE_BLOCKS_COAL)).build(consumer, BloodMagic.rl(basePath + "reagent_lava"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_VOID.get()), 64, 10, Ingredient.fromItems(Items.BUCKET), Ingredient.fromTag(Tags.Items.STRING), Ingredient.fromTag(Tags.Items.STRING), Ingredient.fromTag(Tags.Items.GUNPOWDER)).build(consumer, BloodMagic.rl(basePath + "reagent_void"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_GROWTH.get()), 128, 20, Ingredient.fromTag(ItemTags.SAPLINGS), Ingredient.fromTag(ItemTags.SAPLINGS), Ingredient.fromItems(Items.SUGAR_CANE), Ingredient.fromItems(Items.SUGAR)).build(consumer, BloodMagic.rl(basePath + "reagent_growth"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_MAGNETISM.get()), 600, 10, Ingredient.fromTag(Tags.Items.STRING), Ingredient.fromTag(Tags.Items.INGOTS_GOLD), Ingredient.fromTag(Tags.Items.INGOTS_GOLD), Ingredient.fromTag(Tags.Items.STORAGE_BLOCKS_IRON)).build(consumer, BloodMagic.rl(basePath + "reagent_magnetism"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_FAST_MINER.get()), 128, 20, Ingredient.fromItems(Items.IRON_PICKAXE), Ingredient.fromItems(Items.IRON_AXE), Ingredient.fromItems(Items.IRON_SHOVEL), Ingredient.fromTag(Tags.Items.GUNPOWDER)).build(consumer, BloodMagic.rl(basePath + "reagent_fastminer"));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,154 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.recipe.serializer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.api.SerializerHelper;
|
||||
import wayoftime.bloodmagic.api.event.recipes.FluidStackIngredient;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeARC;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public class ARCRecipeSerializer<RECIPE extends RecipeARC> extends ForgeRegistryEntry<IRecipeSerializer<?>>
|
||||
implements IRecipeSerializer<RECIPE>
|
||||
{
|
||||
private final IFactory<RECIPE> factory;
|
||||
|
||||
public ARCRecipeSerializer(IFactory<RECIPE> factory)
|
||||
{
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public RECIPE read(@Nonnull ResourceLocation recipeId, @Nonnull JsonObject json)
|
||||
{
|
||||
JsonElement input = JSONUtils.isJsonArray(json, Constants.JSON.INPUT)
|
||||
? JSONUtils.getJsonArray(json, Constants.JSON.INPUT)
|
||||
: JSONUtils.getJsonObject(json, Constants.JSON.INPUT);
|
||||
|
||||
JsonElement tool = JSONUtils.isJsonArray(json, Constants.JSON.TOOL)
|
||||
? JSONUtils.getJsonArray(json, Constants.JSON.TOOL)
|
||||
: JSONUtils.getJsonObject(json, Constants.JSON.TOOL);
|
||||
|
||||
Ingredient inputIng = Ingredient.deserialize(input);
|
||||
Ingredient toolIng = Ingredient.deserialize(tool);
|
||||
ItemStack output = SerializerHelper.getItemStack(json, Constants.JSON.OUTPUT);
|
||||
|
||||
List<Pair<ItemStack, Double>> addedItems = new ArrayList<Pair<ItemStack, Double>>();
|
||||
if (json.has(Constants.JSON.ADDEDOUTPUT) && JSONUtils.isJsonArray(json, Constants.JSON.ADDEDOUTPUT))
|
||||
{
|
||||
JsonArray mainArray = JSONUtils.getJsonArray(json, Constants.JSON.ADDEDOUTPUT);
|
||||
|
||||
arrayLoop: for (JsonElement element : mainArray)
|
||||
{
|
||||
if (addedItems.size() >= RecipeARC.MAX_RANDOM_OUTPUTS)
|
||||
{
|
||||
break arrayLoop;
|
||||
}
|
||||
if (element.isJsonObject())
|
||||
{
|
||||
JsonObject obj = element.getAsJsonObject();
|
||||
double chance = JSONUtils.getFloat(obj, Constants.JSON.CHANCE);
|
||||
ItemStack extraDrop = SerializerHelper.getItemStack(obj, Constants.JSON.TYPE);
|
||||
|
||||
addedItems.add(Pair.of(extraDrop, chance));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluidStackIngredient inputFluidIng = null;
|
||||
|
||||
if (json.has(Constants.JSON.INPUT_FLUID))
|
||||
{
|
||||
JsonElement inputFluid = JSONUtils.isJsonArray(json, Constants.JSON.INPUT_FLUID)
|
||||
? JSONUtils.getJsonArray(json, Constants.JSON.INPUT_FLUID)
|
||||
: JSONUtils.getJsonObject(json, Constants.JSON.INPUT_FLUID);
|
||||
inputFluidIng = FluidStackIngredient.deserialize(inputFluid);
|
||||
}
|
||||
|
||||
FluidStack outputFluid = null;
|
||||
|
||||
if (json.has(Constants.JSON.OUTPUT_FLUID))
|
||||
{
|
||||
outputFluid = SerializerHelper.deserializeFluid(json);
|
||||
}
|
||||
|
||||
return this.factory.create(recipeId, inputIng, toolIng, inputFluidIng, output, addedItems, outputFluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECIPE read(@Nonnull ResourceLocation recipeId, @Nonnull PacketBuffer buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<Pair<ItemStack, Double>> addedItems = new ArrayList<Pair<ItemStack, Double>>();
|
||||
Ingredient inputIng = Ingredient.read(buffer);
|
||||
Ingredient toolIng = Ingredient.read(buffer);
|
||||
ItemStack output = buffer.readItemStack();
|
||||
|
||||
int addedItemSize = buffer.readInt();
|
||||
for (int i = 0; i < addedItemSize; i++)
|
||||
{
|
||||
ItemStack stack = buffer.readItemStack();
|
||||
double chance = buffer.readDouble();
|
||||
addedItems.add(Pair.of(stack, chance));
|
||||
}
|
||||
|
||||
FluidStackIngredient inputFluid = null;
|
||||
FluidStack outputFluid = new FluidStack(Fluids.EMPTY, 1000);
|
||||
|
||||
if (buffer.readBoolean())
|
||||
{
|
||||
inputFluid = FluidStackIngredient.read(buffer);
|
||||
}
|
||||
|
||||
if (buffer.readBoolean())
|
||||
{
|
||||
outputFluid = FluidStack.readFromPacket(buffer);
|
||||
}
|
||||
|
||||
return this.factory.create(recipeId, inputIng, toolIng, inputFluid, output, addedItems, outputFluid);
|
||||
} catch (Exception e)
|
||||
{
|
||||
BloodMagic.LOGGER.error("Error reading ARC recipe from packet.", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(@Nonnull PacketBuffer buffer, @Nonnull RECIPE recipe)
|
||||
{
|
||||
try
|
||||
{
|
||||
recipe.write(buffer);
|
||||
} catch (Exception e)
|
||||
{
|
||||
BloodMagic.LOGGER.error("Error writing ARC recipe to packet.", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IFactory<RECIPE extends RecipeARC>
|
||||
{
|
||||
RECIPE create(ResourceLocation id, Ingredient input, Ingredient arcTool, FluidStackIngredient inputFluid, ItemStack output, List<Pair<ItemStack, Double>> addedItems, FluidStack outputFluid);
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.recipe.serializer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
import wayoftime.bloodmagic.api.SerializerHelper;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyArray;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public class AlchemyArrayRecipeSerializer<RECIPE extends RecipeAlchemyArray>
|
||||
extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<RECIPE>
|
||||
{
|
||||
private final IFactory<RECIPE> factory;
|
||||
|
||||
public AlchemyArrayRecipeSerializer(IFactory<RECIPE> factory)
|
||||
{
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public RECIPE read(@Nonnull ResourceLocation recipeId, @Nonnull JsonObject json)
|
||||
{
|
||||
JsonElement input1 = JSONUtils.isJsonArray(json, Constants.JSON.BASEINPUT)
|
||||
? JSONUtils.getJsonArray(json, Constants.JSON.BASEINPUT)
|
||||
: JSONUtils.getJsonObject(json, Constants.JSON.BASEINPUT);
|
||||
|
||||
JsonElement input2 = JSONUtils.isJsonArray(json, Constants.JSON.ADDEDINPUT)
|
||||
? JSONUtils.getJsonArray(json, Constants.JSON.ADDEDINPUT)
|
||||
: JSONUtils.getJsonObject(json, Constants.JSON.ADDEDINPUT);
|
||||
|
||||
Ingredient baseInput = Ingredient.deserialize(input1);
|
||||
Ingredient addedInput = Ingredient.deserialize(input2);
|
||||
ResourceLocation texture = null;
|
||||
if (json.has(Constants.JSON.TEXTURE))
|
||||
texture = new ResourceLocation(JSONUtils.getString(json, Constants.JSON.TEXTURE));
|
||||
ItemStack output = SerializerHelper.getItemStack(json, Constants.JSON.OUTPUT);
|
||||
|
||||
return this.factory.create(recipeId, texture, baseInput, addedInput, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECIPE read(@Nonnull ResourceLocation recipeId, @Nonnull PacketBuffer buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
ResourceLocation texture = null;
|
||||
if (buffer.readBoolean())
|
||||
texture = buffer.readResourceLocation();
|
||||
Ingredient baseInput = Ingredient.read(buffer);
|
||||
Ingredient addedInput = Ingredient.read(buffer);
|
||||
ItemStack output = buffer.readItemStack();
|
||||
|
||||
return this.factory.create(recipeId, texture, baseInput, addedInput, output);
|
||||
} catch (Exception e)
|
||||
{
|
||||
// Mekanism.logger.error("Error reading electrolysis recipe from packet.", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(@Nonnull PacketBuffer buffer, @Nonnull RECIPE recipe)
|
||||
{
|
||||
try
|
||||
{
|
||||
recipe.write(buffer);
|
||||
} catch (Exception e)
|
||||
{
|
||||
// Mekanism.logger.error("Error writing electrolysis recipe to packet.", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IFactory<RECIPE extends RecipeAlchemyArray>
|
||||
{
|
||||
RECIPE create(ResourceLocation id, ResourceLocation texture, Ingredient baseInput, Ingredient addedInput, ItemStack output);
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.recipe.serializer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
import wayoftime.bloodmagic.api.SerializerHelper;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public class BloodAltarRecipeSerializer<RECIPE extends RecipeBloodAltar>
|
||||
extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<RECIPE>
|
||||
{
|
||||
private final IFactory<RECIPE> factory;
|
||||
|
||||
public BloodAltarRecipeSerializer(IFactory<RECIPE> factory)
|
||||
{
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public RECIPE read(@Nonnull ResourceLocation recipeId, @Nonnull JsonObject json)
|
||||
{
|
||||
JsonElement input = JSONUtils.isJsonArray(json, Constants.JSON.INPUT)
|
||||
? JSONUtils.getJsonArray(json, Constants.JSON.INPUT)
|
||||
: JSONUtils.getJsonObject(json, Constants.JSON.INPUT);
|
||||
|
||||
Ingredient inputIng = Ingredient.deserialize(input);
|
||||
ItemStack output = SerializerHelper.getItemStack(json, Constants.JSON.OUTPUT);
|
||||
int minimumTier = JSONUtils.getInt(json, Constants.JSON.ALTAR_TIER);
|
||||
int syphon = JSONUtils.getInt(json, Constants.JSON.ALTAR_SYPHON);
|
||||
int consumeRate = JSONUtils.getInt(json, Constants.JSON.ALTAR_CONSUMPTION_RATE);
|
||||
int drainRate = JSONUtils.getInt(json, Constants.JSON.ALTAR_DRAIN_RATE);
|
||||
|
||||
return this.factory.create(recipeId, inputIng, output, minimumTier, syphon, consumeRate, drainRate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECIPE read(@Nonnull ResourceLocation recipeId, @Nonnull PacketBuffer buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
Ingredient input = Ingredient.read(buffer);
|
||||
ItemStack output = buffer.readItemStack();
|
||||
int minimumTier = buffer.readInt();
|
||||
int syphon = buffer.readInt();
|
||||
int consumeRate = buffer.readInt();
|
||||
int drainRate = buffer.readInt();
|
||||
|
||||
return this.factory.create(recipeId, input, output, minimumTier, syphon, consumeRate, drainRate);
|
||||
} catch (Exception e)
|
||||
{
|
||||
// Mekanism.logger.error("Error reading electrolysis recipe from packet.", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(@Nonnull PacketBuffer buffer, @Nonnull RECIPE recipe)
|
||||
{
|
||||
try
|
||||
{
|
||||
recipe.write(buffer);
|
||||
} catch (Exception e)
|
||||
{
|
||||
// Mekanism.logger.error("Error writing electrolysis recipe to packet.", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IFactory<RECIPE extends RecipeBloodAltar>
|
||||
{
|
||||
RECIPE create(ResourceLocation id, Ingredient input, ItemStack output, int minimumTier, int syphon, int consumeRate, int drainRate);
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.recipe.serializer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
import wayoftime.bloodmagic.api.SerializerHelper;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeTartaricForge;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public class TartaricForgeRecipeSerializer<RECIPE extends RecipeTartaricForge>
|
||||
extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<RECIPE>
|
||||
{
|
||||
|
||||
private final IFactory<RECIPE> factory;
|
||||
|
||||
public TartaricForgeRecipeSerializer(IFactory<RECIPE> factory)
|
||||
{
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public RECIPE read(@Nonnull ResourceLocation recipeId, @Nonnull JsonObject json)
|
||||
{
|
||||
List<Ingredient> inputList = new ArrayList<Ingredient>();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (json.has(Constants.JSON.INPUT + i))
|
||||
{
|
||||
JsonElement input = JSONUtils.isJsonArray(json, Constants.JSON.INPUT + i)
|
||||
? JSONUtils.getJsonArray(json, Constants.JSON.INPUT + i)
|
||||
: JSONUtils.getJsonObject(json, Constants.JSON.INPUT + i);
|
||||
inputList.add(Ingredient.deserialize(input));
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack output = SerializerHelper.getItemStack(json, Constants.JSON.OUTPUT);
|
||||
|
||||
float minimumSouls = JSONUtils.getFloat(json, Constants.JSON.TARTARIC_MINIMUM);
|
||||
float soulDrain = JSONUtils.getFloat(json, Constants.JSON.TARTARIC_DRAIN);
|
||||
|
||||
return this.factory.create(recipeId, inputList, output, minimumSouls, soulDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECIPE read(@Nonnull ResourceLocation recipeId, @Nonnull PacketBuffer buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
int size = buffer.readInt();
|
||||
List<Ingredient> input = new ArrayList<Ingredient>(size);
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
input.add(i, Ingredient.read(buffer));
|
||||
}
|
||||
|
||||
ItemStack output = buffer.readItemStack();
|
||||
double minimumSouls = buffer.readDouble();
|
||||
double soulDrain = buffer.readDouble();
|
||||
|
||||
return this.factory.create(recipeId, input, output, minimumSouls, soulDrain);
|
||||
} catch (Exception e)
|
||||
{
|
||||
// Mekanism.logger.error("Error reading electrolysis recipe from packet.", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(@Nonnull PacketBuffer buffer, @Nonnull RECIPE recipe)
|
||||
{
|
||||
try
|
||||
{
|
||||
recipe.write(buffer);
|
||||
} catch (Exception e)
|
||||
{
|
||||
// Mekanism.logger.error("Error writing electrolysis recipe to packet.", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IFactory<RECIPE extends RecipeTartaricForge>
|
||||
{
|
||||
RECIPE create(ResourceLocation id, List<Ingredient> input, ItemStack output, double minimumSouls, double soulDrain);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.registration;
|
||||
|
||||
public interface INamedEntry
|
||||
{
|
||||
|
||||
/**
|
||||
* Used for retrieving the path/name of a registry object before the registry
|
||||
* object has been fully initialized
|
||||
*/
|
||||
String getInternalRegistryName();
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.registration;
|
||||
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
import net.minecraftforge.registries.RegistryBuilder;
|
||||
|
||||
public class WrappedDeferredRegister<T extends IForgeRegistryEntry<T>>
|
||||
{
|
||||
protected final DeferredRegister<T> internal;
|
||||
|
||||
protected WrappedDeferredRegister(String modid, IForgeRegistry<T> registry)
|
||||
{
|
||||
internal = DeferredRegister.create(registry, modid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiNote For use with custom registries
|
||||
*/
|
||||
protected WrappedDeferredRegister(String modid, Class<T> base)
|
||||
{
|
||||
internal = DeferredRegister.create(base, modid);
|
||||
}
|
||||
|
||||
protected <I extends T, W extends WrappedRegistryObject<I>> W register(String name, Supplier<? extends I> sup,
|
||||
Function<RegistryObject<I>, W> objectWrapper)
|
||||
{
|
||||
return objectWrapper.apply(internal.register(name, sup));
|
||||
}
|
||||
|
||||
/**
|
||||
* Only call this from mekanism and for custom registries
|
||||
*/
|
||||
public void createAndRegister(IEventBus bus, String name)
|
||||
{
|
||||
internal.makeRegistry(name, RegistryBuilder::new);
|
||||
register(bus);
|
||||
}
|
||||
|
||||
public void register(IEventBus bus)
|
||||
{
|
||||
internal.register(bus);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.registration;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
public class WrappedRegistryObject<T extends IForgeRegistryEntry<? super T>> implements Supplier<T>, INamedEntry
|
||||
{
|
||||
|
||||
protected RegistryObject<T> registryObject;
|
||||
|
||||
protected WrappedRegistryObject(RegistryObject<T> registryObject)
|
||||
{
|
||||
this.registryObject = registryObject;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public T get()
|
||||
{
|
||||
return registryObject.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInternalRegistryName()
|
||||
{
|
||||
return registryObject.getId().getPath();
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package wayoftime.bloodmagic.common.registration.impl;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import wayoftime.bloodmagic.common.registration.WrappedDeferredRegister;
|
||||
import wayoftime.bloodmagic.orb.BloodOrb;
|
||||
|
||||
public class BloodOrbDeferredRegister extends WrappedDeferredRegister<BloodOrb>
|
||||
{
|
||||
public BloodOrbDeferredRegister(String modid)
|
||||
{
|
||||
super(modid, BloodOrb.class);
|
||||
}
|
||||
|
||||
public BloodOrbRegistryObject<BloodOrb> register(String name, ResourceLocation rl, int tier, int capacity,
|
||||
int fillRate)
|
||||
{
|
||||
return register(name, () -> new BloodOrb(rl, tier, capacity, fillRate));
|
||||
}
|
||||
|
||||
public <ORB extends BloodOrb> BloodOrbRegistryObject<ORB> register(String name, Supplier<? extends ORB> sup)
|
||||
{
|
||||
return register(name, sup, BloodOrbRegistryObject::new);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue