weapon upgrades baby
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package nmd.primal.forgecraft;
|
package nmd.primal.forgecraft;
|
||||||
|
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.inventory.ItemStackHelper;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -8,10 +9,15 @@ import net.minecraft.util.NonNullList;
|
|||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||||
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import nmd.primal.core.api.PrimalAPI;
|
import nmd.primal.core.api.PrimalAPI;
|
||||||
import nmd.primal.core.api.events.CauldronEvent;
|
import nmd.primal.core.api.events.CauldronEvent;
|
||||||
|
import nmd.primal.core.api.events.CauldronRecipeEvent;
|
||||||
import nmd.primal.core.common.helper.PlayerHelper;
|
import nmd.primal.core.common.helper.PlayerHelper;
|
||||||
|
import nmd.primal.core.common.helper.RecipeHelper;
|
||||||
|
import nmd.primal.core.common.recipes.tile.CauldronRecipe;
|
||||||
|
import nmd.primal.core.common.tiles.machines.TileCauldron;
|
||||||
import nmd.primal.forgecraft.init.ModItems;
|
import nmd.primal.forgecraft.init.ModItems;
|
||||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||||
import nmd.primal.forgecraft.items.parts.WeaponPart;
|
import nmd.primal.forgecraft.items.parts.WeaponPart;
|
||||||
@@ -20,59 +26,92 @@ import nmd.primal.forgecraft.items.tools.CustomHoe;
|
|||||||
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
|
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
|
||||||
import nmd.primal.forgecraft.items.tools.CustomShovel;
|
import nmd.primal.forgecraft.items.tools.CustomShovel;
|
||||||
import nmd.primal.forgecraft.util.ToolNBT;
|
import nmd.primal.forgecraft.util.ToolNBT;
|
||||||
|
import nmd.primal.forgecraft.util.WeaponNBT;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mminaie on 3/15/17.
|
* Created by mminaie on 3/15/17.
|
||||||
*/
|
*/
|
||||||
public class CommonEvents implements ToolNBT {
|
public class CommonEvents implements WeaponNBT {
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
|
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
|
||||||
public void onItemCrafted(CauldronEvent event){
|
public void onItemCrafted(CauldronRecipeEvent.Pre event){
|
||||||
|
|
||||||
NonNullList<ItemStack> inputs = NonNullList.<ItemStack>withSize(6,ItemStack.EMPTY);
|
CauldronRecipe recipe = event.getRecipe();
|
||||||
inputs.set(0, event.getTile().getInputHandler().getStackInSlot(0));
|
|
||||||
inputs.set(1, event.getTile().getInputHandler().getStackInSlot(1));
|
|
||||||
inputs.set(2, event.getTile().getInputHandler().getStackInSlot(2));
|
|
||||||
inputs.set(3, event.getTile().getInputHandler().getStackInSlot(3));
|
|
||||||
inputs.set(4, event.getTile().getInputHandler().getStackInSlot(4));
|
|
||||||
inputs.set(5, event.getTile().getInputHandler().getStackInSlot(5));
|
|
||||||
|
|
||||||
NonNullList<ItemStack> outputs = NonNullList.<ItemStack>withSize(6,ItemStack.EMPTY);
|
if (recipe.matches("rawbronzegladiussmite", "rawbronzegladiusbane", "rawbronzegladiuslapis")){
|
||||||
outputs.set(0, event.getTile().getOutputHandler().getStackInSlot(0));
|
|
||||||
outputs.set(1, event.getTile().getOutputHandler().getStackInSlot(1));
|
|
||||||
outputs.set(2, event.getTile().getOutputHandler().getStackInSlot(2));
|
|
||||||
outputs.set(3, event.getTile().getOutputHandler().getStackInSlot(3));
|
|
||||||
outputs.set(4, event.getTile().getOutputHandler().getStackInSlot(4));
|
|
||||||
outputs.set(5, event.getTile().getOutputHandler().getStackInSlot(5));
|
|
||||||
|
|
||||||
//System.out.println(inputs. + ":" + outputs.stream());
|
NonNullList<ItemStack> inputList = NonNullList.<ItemStack>withSize(6, ItemStack.EMPTY);
|
||||||
|
inputList.set(0, event.getTile().getInputHandler().getStackInSlot(0));
|
||||||
|
inputList.set(1, event.getTile().getInputHandler().getStackInSlot(1));
|
||||||
|
inputList.set(2, event.getTile().getInputHandler().getStackInSlot(2));
|
||||||
|
inputList.set(3, event.getTile().getInputHandler().getStackInSlot(3));
|
||||||
|
inputList.set(4, event.getTile().getInputHandler().getStackInSlot(4));
|
||||||
|
inputList.set(5, event.getTile().getInputHandler().getStackInSlot(5));
|
||||||
|
|
||||||
if(getMatchingStacks(inputs, outputs).get(0) != ItemStack.EMPTY){
|
TileCauldron tile = event.getTile();
|
||||||
|
ItemStack inputStack = tile.getInputStack(event.getOutputs().get(0));
|
||||||
|
Item inputStackItem = null;
|
||||||
|
if(inputStack.getItem() instanceof WeaponPart){
|
||||||
|
inputStackItem = inputStack.getItem();
|
||||||
|
}
|
||||||
|
ItemStack modStack = ItemStack.EMPTY;
|
||||||
|
ItemStack outputStack = event.getOutputs().get(0);
|
||||||
|
|
||||||
System.out.println(getMatchingStacks(inputs, outputs).get(0) + " : " + getMatchingStacks(inputs, outputs).get(1));
|
modStack = getOppositeStack(inputList, inputStack);
|
||||||
|
|
||||||
|
if (inputStack.hasTagCompound()) {
|
||||||
|
if (inputStack.getSubCompound("tags") != null) {
|
||||||
|
NBTTagCompound tags = inputStack.getTagCompound().copy();
|
||||||
|
if(inputStackItem != null) {
|
||||||
|
if (getModifiers(inputStack) < WeaponNBT.materialModifiers.get(((WeaponPart) outputStack.getItem()).getMaterial()) ) {
|
||||||
|
if (RecipeHelper.isOreName(modStack, "dustSilver")) {
|
||||||
|
setSmiteLevel(outputStack, getSmiteLevel(inputStack) + 1);
|
||||||
|
setModifiers(outputStack, getModifiers(inputStack) + 1);
|
||||||
|
}
|
||||||
|
if (RecipeHelper.isOreName(modStack, "foodPoison")) {
|
||||||
|
setBaneLevel(outputStack, getBaneLevel(inputStack) + 1);
|
||||||
|
setModifiers(outputStack, getModifiers(inputStack) + 1);
|
||||||
|
}
|
||||||
|
if (RecipeHelper.isOreName(modStack, "dustBlaze")) {
|
||||||
|
setFireLevel(outputStack, getFireLevel(inputStack) + 1);
|
||||||
|
setModifiers(outputStack, getModifiers(inputStack) + 1);
|
||||||
|
}
|
||||||
|
if (RecipeHelper.isOreName(modStack, "gemLapis")) {
|
||||||
|
setFortuneLevel(outputStack, getFortuneLevel(inputStack) + 1);
|
||||||
|
setModifiers(outputStack, getModifiers(inputStack) + 1);
|
||||||
|
}
|
||||||
|
if (RecipeHelper.isOreName(modStack, "boneWithered")) {
|
||||||
|
setFortuneLevel(outputStack, getFortuneLevel(inputStack) + 1);
|
||||||
|
setModifiers(outputStack, getModifiers(inputStack) + 1);
|
||||||
|
}
|
||||||
|
if (RecipeHelper.isOreName(modStack, "dustWitheredBone")) {
|
||||||
|
setFortuneLevel(outputStack, getFortuneLevel(inputStack) + 1);
|
||||||
|
setModifiers(outputStack, getModifiers(inputStack) + 1);
|
||||||
|
}
|
||||||
|
if (RecipeHelper.isOreName(modStack, "skullWithered")) {
|
||||||
|
setFortuneLevel(outputStack, getFortuneLevel(inputStack) + 1);
|
||||||
|
setModifiers(outputStack, getModifiers(inputStack) + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private NonNullList<ItemStack> getMatchingStacks(NonNullList<ItemStack> input, NonNullList<ItemStack> output){
|
private ItemStack getOppositeStack(NonNullList<ItemStack> inputList, ItemStack inputStack){
|
||||||
ItemStack inputStack = ItemStack.EMPTY;
|
ItemStack modStack = ItemStack.EMPTY;
|
||||||
ItemStack outputStack = ItemStack.EMPTY;
|
|
||||||
NonNullList<ItemStack> returnList = NonNullList.<ItemStack>withSize(2, ItemStack.EMPTY);
|
for (int i = 0; i < inputList.size(); i++) {
|
||||||
for (int i = 0; i < input.size(); i++) {
|
if(inputList.get(i) != ItemStack.EMPTY && !(inputList.get(i).getItem() instanceof WeaponPart) ){
|
||||||
if(input.get(i).getItem() instanceof WeaponPart){
|
System.out.println(inputList.get(i));
|
||||||
inputStack = input.get(i);
|
modStack = inputList.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < output.size(); i++) {
|
System.out.println(modStack);
|
||||||
if(output.get(i).getItem() instanceof WeaponPart){
|
return modStack;
|
||||||
outputStack = output.get(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(inputStack != null && outputStack != null && inputStack.equals(outputStack)){
|
|
||||||
returnList.set(0, inputStack);
|
|
||||||
returnList.set(1, outputStack);
|
|
||||||
}
|
|
||||||
return returnList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@SubscribeEvent(priority= EventPriority.HIGHEST, receiveCanceled=true)
|
/*@SubscribeEvent(priority= EventPriority.HIGHEST, receiveCanceled=true)
|
||||||
|
|||||||
23
kfc/src/main/java/nmd/primal/forgecraft/init/ModFluids.java
Normal file
23
kfc/src/main/java/nmd/primal/forgecraft/init/ModFluids.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package nmd.primal.forgecraft.init;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
import nmd.primal.core.api.PrimalAPI;
|
||||||
|
import nmd.primal.core.common.helper.RegistryHelper;
|
||||||
|
|
||||||
|
public class ModFluids {
|
||||||
|
|
||||||
|
public static Fluid SILVER_WATER;
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void registryFluidBlocks(final RegistryEvent.Register<Block> event){
|
||||||
|
final IForgeRegistry<Block> registry = event.getRegistry();
|
||||||
|
//RegistryHelper.registerFluidBlock(registry,
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -28,17 +28,80 @@ public class CauldronRecipes
|
|||||||
|
|
||||||
ItemStack defaultBronzeGladius = new ItemStack(ModItems.rawbronzegladius, 1);
|
ItemStack defaultBronzeGladius = new ItemStack(ModItems.rawbronzegladius, 1);
|
||||||
|
|
||||||
//WeaponNBT.setDefaultNBT(defaultBronzeGladius);
|
defaultBronzeGladius.getOrCreateSubCompound("tags");
|
||||||
NonNullList<ItemStack> tempList1 = NonNullList.<ItemStack>create();
|
defaultBronzeGladius.getSubCompound("tags").setInteger("smite", 0);
|
||||||
tempList1.add(0, new ItemStack(ModItems.rawbronzegladius, 1));
|
defaultBronzeGladius.getSubCompound("tags").setInteger("bane", 0);
|
||||||
|
defaultBronzeGladius.getSubCompound("tags").setInteger("fire", 0);
|
||||||
|
defaultBronzeGladius.getSubCompound("tags").setInteger("fortune", 0);
|
||||||
|
defaultBronzeGladius.getSubCompound("tags").setInteger("leech", 0);
|
||||||
|
defaultBronzeGladius.getSubCompound("tags").setInteger("sweeping", 0);
|
||||||
|
defaultBronzeGladius.getSubCompound("tags").setInteger("sharpness", 0);
|
||||||
|
defaultBronzeGladius.getSubCompound("tags").setBoolean("hot", false);
|
||||||
|
|
||||||
recipes.register(new CauldronRecipe(
|
recipes.register(new CauldronRecipe(
|
||||||
5,
|
5,
|
||||||
new FluidStack(FluidRegistry.WATER, 1000),
|
new FluidStack(FluidRegistry.WATER, 1000),
|
||||||
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
|
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
|
||||||
RecipeHelper.getOreStack("gemLapis", 1),
|
RecipeHelper.getOreStack("dustSilver", 2),
|
||||||
tempList1,
|
RecipeHelper.buildList(defaultBronzeGladius),
|
||||||
defaultBronzeGladius,
|
defaultBronzeGladius,
|
||||||
ItemStack.EMPTY).setRecipeName("rawbronzegladiuslapis"));
|
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, "rawbronzegladiussmite"));
|
||||||
|
|
||||||
|
recipes.register(new CauldronRecipe(
|
||||||
|
5,
|
||||||
|
new FluidStack(FluidRegistry.WATER, 1000),
|
||||||
|
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
|
||||||
|
RecipeHelper.getOreStack("foodPoison", 2),
|
||||||
|
RecipeHelper.buildList(defaultBronzeGladius),
|
||||||
|
defaultBronzeGladius,
|
||||||
|
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, "rawbronzegladiusbane"));
|
||||||
|
|
||||||
|
recipes.register(new CauldronRecipe(
|
||||||
|
5,
|
||||||
|
new FluidStack(FluidRegistry.WATER, 1000),
|
||||||
|
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
|
||||||
|
RecipeHelper.getOreStack("dustBlaze", 2),
|
||||||
|
RecipeHelper.buildList(defaultBronzeGladius),
|
||||||
|
defaultBronzeGladius,
|
||||||
|
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, "rawbronzegladiusfire"));
|
||||||
|
|
||||||
|
recipes.register(new CauldronRecipe(
|
||||||
|
5,
|
||||||
|
new FluidStack(FluidRegistry.WATER, 1000),
|
||||||
|
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
|
||||||
|
RecipeHelper.getOreStack("gemLapis", 2),
|
||||||
|
RecipeHelper.buildList(defaultBronzeGladius),
|
||||||
|
defaultBronzeGladius,
|
||||||
|
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, "rawbronzegladiuslapis"));
|
||||||
|
|
||||||
|
recipes.register(new CauldronRecipe(
|
||||||
|
5,
|
||||||
|
new FluidStack(FluidRegistry.WATER, 1000),
|
||||||
|
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
|
||||||
|
RecipeHelper.getOreStack("boneWithered", 1),
|
||||||
|
RecipeHelper.buildList(defaultBronzeGladius),
|
||||||
|
defaultBronzeGladius,
|
||||||
|
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, "rawbronzegladiusleech0"));
|
||||||
|
|
||||||
|
recipes.register(new CauldronRecipe(
|
||||||
|
5,
|
||||||
|
new FluidStack(FluidRegistry.WATER, 1000),
|
||||||
|
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
|
||||||
|
RecipeHelper.getOreStack("dustWitheredBone", 2),
|
||||||
|
RecipeHelper.buildList(defaultBronzeGladius),
|
||||||
|
defaultBronzeGladius,
|
||||||
|
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, "rawbronzegladiusleech1"));
|
||||||
|
|
||||||
|
recipes.register(new CauldronRecipe(
|
||||||
|
5,
|
||||||
|
new FluidStack(FluidRegistry.WATER, 1000),
|
||||||
|
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
|
||||||
|
RecipeHelper.getOreStack("skullWithered", 2),
|
||||||
|
RecipeHelper.buildList(defaultBronzeGladius),
|
||||||
|
defaultBronzeGladius,
|
||||||
|
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, "rawbronzegladiusleech2"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ public class ToolPart extends Item implements ToolNBT{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package nmd.primal.forgecraft.items.parts;
|
package nmd.primal.forgecraft.items.parts;
|
||||||
|
|
||||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
@@ -12,7 +15,9 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.SoundCategory;
|
import net.minecraft.util.SoundCategory;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import nmd.primal.core.api.PrimalAPI;
|
import nmd.primal.core.api.PrimalAPI;
|
||||||
@@ -45,8 +50,8 @@ public class WeaponPart extends Item implements WeaponNBT {
|
|||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
||||||
smite| bane | fire | fortune | leech
|
HOT | SMITE | BANE | FIRE | FORTUNE | leech
|
||||||
X.0 | 0.X | 0.0X | 0.00X | 0.000X
|
X.0 | 0.X | 0.0X | 0.00X | 0.000X | 0.0000X
|
||||||
|
|
||||||
***/
|
***/
|
||||||
|
|
||||||
@@ -58,28 +63,27 @@ public class WeaponPart extends Item implements WeaponNBT {
|
|||||||
returnFloat += 0.1F;
|
returnFloat += 0.1F;
|
||||||
}
|
}
|
||||||
if(getBaneLevel(item)>0){
|
if(getBaneLevel(item)>0){
|
||||||
returnFloat += (0.01F * getBaneLevel(item));
|
returnFloat += (0.01F);
|
||||||
}
|
}
|
||||||
if(getFireLevel(item)>0){
|
if(getFireLevel(item)>0){
|
||||||
returnFloat += (0.001F * getFireLevel(item));
|
returnFloat += (0.001F);
|
||||||
}
|
}
|
||||||
if(getFortuneLevel(item)>0){
|
if(getFortuneLevel(item)>0){
|
||||||
returnFloat += (0.0001F * getFortuneLevel(item));
|
returnFloat += (0.0001F);
|
||||||
}
|
}
|
||||||
if(getLeechLevel(item)>0){
|
if(getLeechLevel(item)>0){
|
||||||
returnFloat += (0.0001F * getLeechLevel(item));
|
returnFloat += (0.00001F);
|
||||||
|
}
|
||||||
|
if(getHot(item)){
|
||||||
|
returnFloat += 1.0F;
|
||||||
}
|
}
|
||||||
return returnFloat;
|
return returnFloat;
|
||||||
}
|
}
|
||||||
return 0.0F;
|
return 0.0F;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean isHidden()
|
public static boolean isHidden()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -87,51 +91,52 @@ public class WeaponPart extends Item implements WeaponNBT {
|
|||||||
|
|
||||||
public ToolMaterial getMaterial() {return toolMaterial;}
|
public ToolMaterial getMaterial() {return toolMaterial;}
|
||||||
|
|
||||||
public void createDefaultNBT(ItemStack item){
|
|
||||||
if (!item.hasTagCompound()) {
|
|
||||||
item.setTagCompound(new NBTTagCompound());
|
|
||||||
NBTTagCompound tags = new NBTTagCompound();
|
|
||||||
|
|
||||||
item.getTagCompound().setTag("tags", tags);
|
|
||||||
|
|
||||||
setSmiteLevel(item, 0);
|
@Override
|
||||||
setBaneLevel(item, 0);
|
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||||
setFireLevel(item, 0);
|
//System.out.println(item.getTagCompound());
|
||||||
setFortuneLevel(item, 0);
|
if(!item.hasTagCompound()) {
|
||||||
setLeechLevel(item, 0);
|
WeaponNBT.setDefaultNBT(item);
|
||||||
setSweepingLevel(item, 0);
|
|
||||||
setSharpnessLevel(item, 0);
|
|
||||||
setModifiers(item, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
|
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
|
||||||
|
|
||||||
createDefaultNBT(item);
|
if(!item.hasTagCompound()) {
|
||||||
|
WeaponNBT.setDefaultNBT(item);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
|
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
|
||||||
{
|
{
|
||||||
if(item.hasTagCompound())
|
if(stack.hasTagCompound()) {
|
||||||
{
|
if (stack.getSubCompound("tags") != null) {
|
||||||
tooltip.add(ChatFormatting.GRAY + "Upgrades left: " + (WeaponNBT.materialModifiers.get(this.toolMaterial) - getModifiers(item)));
|
tooltip.add(ChatFormatting.GRAY + "Upgrades left: " + (WeaponNBT.materialModifiers.get(this.toolMaterial) - getModifiers(stack)));
|
||||||
/*if (getEmerald(item)) {
|
|
||||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
|
||||||
}
|
}
|
||||||
if (getDiamondLevel(item) > 0) {
|
if (getSmiteLevel(stack) > 0) {
|
||||||
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
|
tooltip.add(ChatFormatting.GOLD + "Holy: " + getSmiteLevel(stack));
|
||||||
}
|
}
|
||||||
if (getRedstoneLevel(item) > 0) {
|
if (getBaneLevel(stack) > 0) {
|
||||||
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item));
|
tooltip.add(ChatFormatting.GREEN + "Spider Killing: " + getBaneLevel(stack));
|
||||||
|
}
|
||||||
|
if (getFireLevel(stack) > 0) {
|
||||||
|
tooltip.add(ChatFormatting.RED + "Flame: " + getFireLevel(stack));
|
||||||
|
}
|
||||||
|
if (getFortuneLevel(stack) > 0) {
|
||||||
|
tooltip.add(ChatFormatting.BLUE + "Thieving: " + getFortuneLevel(stack));
|
||||||
|
}
|
||||||
|
if (getLeechLevel(stack) > 0) {
|
||||||
|
tooltip.add(ChatFormatting.BLACK + "Life Steal: " + getLeechLevel(stack));
|
||||||
|
}
|
||||||
|
if(getSharpnessLevel(stack)>0){
|
||||||
|
tooltip.add(ChatFormatting.WHITE + "Sharpness: " + getSharpnessLevel(stack));
|
||||||
}
|
}
|
||||||
if (getLapisLevel(item) > 0) {
|
|
||||||
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item));
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
package nmd.primal.forgecraft.util;
|
package nmd.primal.forgecraft.util;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraftforge.oredict.OreIngredient;
|
||||||
import nmd.primal.core.api.PrimalAPI;
|
import nmd.primal.core.api.PrimalAPI;
|
||||||
|
import nmd.primal.forgecraft.init.ModItems;
|
||||||
|
import nmd.primal.forgecraft.items.parts.WeaponPart;
|
||||||
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
@@ -156,11 +161,26 @@ public interface WeaponNBT {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setDefaultNBT(ItemStack stack){
|
default boolean getHot(ItemStack stack){
|
||||||
|
|
||||||
NBTTagCompound tags = new NBTTagCompound();
|
if(!stack.isEmpty()){
|
||||||
stack.setTagCompound(tags);
|
if(stack.hasTagCompound()){
|
||||||
stack.getTagCompound().setTag("tags", tags);
|
if(stack.getSubCompound("tags") !=null){
|
||||||
|
return stack.getSubCompound("tags").getBoolean("hot");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
default void setHot(ItemStack stack){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setDefaultNBT(ItemStack stack) {
|
||||||
|
|
||||||
|
stack.getOrCreateSubCompound("tags");
|
||||||
stack.getSubCompound("tags").setInteger("smite", 0);
|
stack.getSubCompound("tags").setInteger("smite", 0);
|
||||||
stack.getSubCompound("tags").setInteger("bane", 0);
|
stack.getSubCompound("tags").setInteger("bane", 0);
|
||||||
stack.getSubCompound("tags").setInteger("fire", 0);
|
stack.getSubCompound("tags").setInteger("fire", 0);
|
||||||
@@ -168,7 +188,8 @@ public interface WeaponNBT {
|
|||||||
stack.getSubCompound("tags").setInteger("leech", 0);
|
stack.getSubCompound("tags").setInteger("leech", 0);
|
||||||
stack.getSubCompound("tags").setInteger("sweeping", 0);
|
stack.getSubCompound("tags").setInteger("sweeping", 0);
|
||||||
stack.getSubCompound("tags").setInteger("sharpness", 0);
|
stack.getSubCompound("tags").setInteger("sharpness", 0);
|
||||||
|
stack.getSubCompound("tags").setInteger("modifiers", 0);
|
||||||
|
stack.getSubCompound("tags").setBoolean("hot", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Hashtable<Item.ToolMaterial, Integer> materialModifiers = new Hashtable<Item.ToolMaterial, Integer>(){{
|
Hashtable<Item.ToolMaterial, Integer> materialModifiers = new Hashtable<Item.ToolMaterial, Integer>(){{
|
||||||
@@ -183,4 +204,10 @@ public interface WeaponNBT {
|
|||||||
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
Hashtable<Ingredient, String> StackToUpgrade = new Hashtable<Ingredient, String>(){{
|
||||||
|
|
||||||
|
put(new OreIngredient("dustSilver"), "bane");
|
||||||
|
|
||||||
|
}};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"forge_marker":1,
|
||||||
|
"textures": {
|
||||||
|
"particle": "forgecraft:items/bronze/0",
|
||||||
|
"texture": "forgecraft:items/bronze/0",
|
||||||
|
"texture1": "blocks/planks_oak"
|
||||||
|
},
|
||||||
|
"parent": "forgecraft:item/rawgladius"
|
||||||
|
}
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
{
|
||||||
|
"__comment": "Designed by Kitsushadow with Cubik Studio - https://cubik.studio",
|
||||||
|
"textures": {
|
||||||
|
"particle": "items/finished_bronze",
|
||||||
|
"texture": "items/finished_bronze",
|
||||||
|
"texture1": "blocks/planks_oak"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"__comment": "Cube23",
|
||||||
|
"from": [ 7.25, -5.5, 7.25 ],
|
||||||
|
"to": [ 9.25, 1, 8.75 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 7, 7.5, 9, 8.5 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 7, 7.5, 9, 8.5 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 7, 8, 9, 16 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 7, 8, 9, 16 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7.5, 8, 8.5, 16 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 7.5, 8, 8.5, 16 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube23",
|
||||||
|
"from": [ 6.5, 1, 7.5 ],
|
||||||
|
"to": [ 10, 6, 8.5 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 7, 7.5, 9, 8.5 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 7, 7.5, 9, 8.5 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 7, 9, 9, 16 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 7, 9, 9, 16 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7.5, 9, 8.5, 16 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 7.5, 9, 8.5, 16 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube28",
|
||||||
|
"from": [ 8, 1, 8.5 ],
|
||||||
|
"to": [ 8.5, 24, 8.501 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 7.5, 7, 8.5, 7.5 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 7.5, 8.5, 8.5, 9 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 7.5, 0, 8.5, 15 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 7.5, 0, 8.5, 15 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 8.5, 0, 9, 15 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 7, 0, 7.5, 15 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube32",
|
||||||
|
"from": [ 6.75, 21.5, 7.5 ],
|
||||||
|
"to": [ 9.75, 23, 8.5 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 7, 7.5, 9, 8.5 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 7, 7.5, 9, 8.5 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 7, 7, 9, 9.5 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 7, 7, 9, 9.5 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7.5, 7, 8.5, 9.5 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 7.5, 7, 8.5, 9.5 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube32",
|
||||||
|
"from": [ 7.25, 24.5, 7.5 ],
|
||||||
|
"to": [ 9.25, 26, 8.5 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 7, 7.5, 9, 8.5 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 7, 7.5, 9, 8.5 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 7, 7, 9, 8 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 7, 7, 9, 8 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7.5, 7, 8.5, 8 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 7.5, 7, 8.5, 8 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube9",
|
||||||
|
"from": [ 7.75, 27, 7.5 ],
|
||||||
|
"to": [ 8.75, 28, 8.5 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 8, 7.5, 8.5, 8 ], "texture": "#texture", "rotation": 180 },
|
||||||
|
"up": { "uv": [ 8, 8, 8.5, 8.5 ], "texture": "#texture", "rotation": 180 },
|
||||||
|
"north": { "uv": [ 8, 4.5, 8.5, 5.5 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 7.5, 4.5, 8, 5.5 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7.5, 4.5, 8, 5.5 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 8, 4.5, 8.5, 5.5 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube28",
|
||||||
|
"from": [ 8, 1, 7.499 ],
|
||||||
|
"to": [ 8.5, 24, 7.5 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 7.5, 7, 8.5, 7.5 ], "texture": "#texture", "rotation": 180 },
|
||||||
|
"up": { "uv": [ 7.5, 8.5, 8.5, 9 ], "texture": "#texture", "rotation": 180 },
|
||||||
|
"north": { "uv": [ 7.5, 0, 8.5, 15 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 7.5, 0, 8.5, 15 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7, 0, 7.5, 15 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 8.5, 0, 9, 15 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube13",
|
||||||
|
"from": [ 7, 23, 7.5 ],
|
||||||
|
"to": [ 9.5, 24.5, 8.5 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 7, 7.5, 9.5, 8.5 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 7, 7.5, 9.5, 8.5 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 6.5, 7.5, 9, 9 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 7, 7.5, 9.5, 9 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7.5, 7.5, 8.5, 9 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 7.5, 7.5, 8.5, 9 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube14",
|
||||||
|
"from": [ 7.5, 26, 7.5 ],
|
||||||
|
"to": [ 9, 27, 8.5 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 7.5, 7.5, 9, 8.5 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 7.5, 7.5, 9, 8.5 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 7, 5, 8.5, 6 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 7.5, 5, 9, 6 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7.5, 5, 8.5, 6 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 7.5, 5, 8.5, 6 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube17",
|
||||||
|
"from": [ 8, -8.5, 7.75 ],
|
||||||
|
"to": [ 8.5, -5.5, 8.25 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 8, 7.75, 8.5, 8.25 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 8, 7.75, 8.5, 8.25 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 7.5, 8, 8, 11 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 8, 8, 8.5, 11 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7.75, 8, 8.5, 11 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 7.75, 8, 8.5, 11 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube24",
|
||||||
|
"from": [ 6.75, 6, 7.5 ],
|
||||||
|
"to": [ 9.75, 15.5, 8.5 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 6.75, 7.5, 9.75, 8.5 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 6.75, 7.5, 9.75, 8.5 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 6.25, 0.5, 9.25, 10 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 6.75, 0.5, 9.75, 10 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7.5, 0.5, 8.5, 10 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 7.5, 0.5, 8.5, 10 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube19",
|
||||||
|
"from": [ 6.5, 15.5, 7.5 ],
|
||||||
|
"to": [ 10, 21.5, 8.5 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 6.5, 7.5, 10, 8.5 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 6.5, 7.5, 10, 8.5 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 6, 0, 9.5, 0.5 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 6.5, 0, 10, 0.5 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7.5, 0, 8.5, 0.5 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 7.5, 0, 8.5, 0.5 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Cube20",
|
||||||
|
"from": [ 8, 27.75, 7.5 ],
|
||||||
|
"to": [ 8.5, 28.75, 8.5 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 8, 7.5, 8.5, 8.5 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 8, 7.5, 8.5, 8.5 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 7.5, 3.25, 8, 4.25 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 8, 3.25, 8.5, 4.25 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 7.5, 3.25, 8.5, 4.25 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 7.5, 3.25, 8.5, 4.25 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"display": {
|
||||||
|
"thirdperson_righthand": {
|
||||||
|
"rotation": [ 0, 90, 0 ],
|
||||||
|
"translation": [ 0, 5.9, 1.33 ],
|
||||||
|
"scale": [ 0.75, 0.75, 0.75 ]
|
||||||
|
},
|
||||||
|
"thirdperson_lefthand": {
|
||||||
|
"rotation": [ 0, 90, 0 ],
|
||||||
|
"translation": [ 0, 5.9, 1.33 ],
|
||||||
|
"scale": [ 0.75, 0.75, 0.75 ]
|
||||||
|
},
|
||||||
|
"firstperson_righthand": {
|
||||||
|
"rotation": [ 0, 90, 0 ],
|
||||||
|
"translation": [ 0, 6.6, 1 ],
|
||||||
|
"scale": [ 0.75, 0.75, 0.75 ]
|
||||||
|
},
|
||||||
|
"firstperson_lefthand": {
|
||||||
|
"rotation": [ 0, 90, 0 ],
|
||||||
|
"translation": [ 0, 6.6, 1 ],
|
||||||
|
"scale": [ 0.75, 0.75, 0.75 ]
|
||||||
|
},
|
||||||
|
"gui": {
|
||||||
|
"rotation": [ 0, 0, -45 ],
|
||||||
|
"translation": [ -0.4, -0.4, 0 ],
|
||||||
|
"scale": [ 0.5, 0.5, 0.5 ]
|
||||||
|
},
|
||||||
|
"ground": {
|
||||||
|
"rotation": [ 90, 0, 0 ],
|
||||||
|
"scale": [ 0.75, 0.75, 0.75 ]
|
||||||
|
},
|
||||||
|
"fixed": {
|
||||||
|
"rotation": [ 0, 0, 45 ],
|
||||||
|
"translation": [ 0.7, -0.7, 0 ],
|
||||||
|
"scale": [ 0.66, 0.66, 0.66 ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user