Finalized ARC

Finished 99% of the implementation work for the ARC and recipe system. Still need to populate the recipes (which will require textures for some items have have yet to be added).
This commit is contained in:
WayofTime 2020-10-30 16:41:41 -04:00
parent 9fa68e86ae
commit 1ead4ff820
56 changed files with 945 additions and 129 deletions

View file

@ -8,6 +8,7 @@ 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.arc.ItemARCToolBase;
import wayoftime.bloodmagic.common.item.sigil.ItemSigilAir;
import wayoftime.bloodmagic.common.item.sigil.ItemSigilBloodLight;
import wayoftime.bloodmagic.common.item.sigil.ItemSigilDivination;
@ -98,6 +99,7 @@ public class BloodMagicItems
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());
public static final RegistryObject<Item> WEAK_BLOOD_SHARD = BASICITEMS.register("weakbloodshard", () -> new ItemBase());
// Ritual stuffs
public static final RegistryObject<Item> WEAK_ACTIVATION_CRYSTAL = BASICITEMS.register("activationcrystalweak", () -> new ItemActivationCrystal(ItemActivationCrystal.CrystalType.WEAK));
@ -136,4 +138,8 @@ public class BloodMagicItems
public static final RegistryObject<Item> SOUL_SNARE = BASICITEMS.register("soulsnare", ItemSoulSnare::new);
public static final RegistryObject<Item> SENTIENT_SWORD = ITEMS.register("soulsword", () -> new ItemSentientSword());
// ARC Tools
public static final RegistryObject<Item> SANGUINE_REVERTER = BASICITEMS.register("sanguinereverter", () -> new ItemARCToolBase(32, 2));
public static final RegistryObject<Item> PRIMITIVE_FURNACE_CELL = BASICITEMS.register("furnacecell_primitive", () -> new ItemARCToolBase(128, 1.25));
}

View file

@ -1,6 +1,11 @@
package wayoftime.bloodmagic.common.item;
import net.minecraft.item.ItemStack;
public interface IARCTool
{
default double getCraftingSpeedMultiplier(ItemStack stack)
{
return 1;
}
}

View file

@ -0,0 +1,23 @@
package wayoftime.bloodmagic.common.item.arc;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import wayoftime.bloodmagic.BloodMagic;
import wayoftime.bloodmagic.common.item.IARCTool;
public class ItemARCToolBase extends Item implements IARCTool
{
private final double craftingMultiplier;
public ItemARCToolBase(int maxDamage, double craftingMultiplier)
{
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB).maxDamage(maxDamage));
this.craftingMultiplier = craftingMultiplier;
}
@Override
public double getCraftingSpeedMultiplier(ItemStack stack)
{
return craftingMultiplier;
}
}

View file

@ -0,0 +1,101 @@
package wayoftime.bloodmagic.common.item.inventory;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
public class InventoryWrapper implements IInventory
{
protected int[] syncedSlots = new int[0];
protected NonNullList<ItemStack> inventory;
private int size;
public InventoryWrapper(int size)
{
this.inventory = NonNullList.withSize(size, ItemStack.EMPTY);
this.size = size;
}
@Override
public void clear()
{
this.inventory = NonNullList.withSize(size, ItemStack.EMPTY);
}
@Override
public int getSizeInventory()
{
return size;
}
@Override
public boolean isEmpty()
{
for (ItemStack stack : inventory) if (!stack.isEmpty())
return false;
return true;
}
@Override
public ItemStack getStackInSlot(int index)
{
return inventory.get(index);
}
@Override
public ItemStack decrStackSize(int index, int count)
{
if (!getStackInSlot(index).isEmpty())
{
if (getStackInSlot(index).getCount() <= count)
{
ItemStack itemStack = inventory.get(index);
inventory.set(index, ItemStack.EMPTY);
markDirty();
return itemStack;
}
ItemStack itemStack = inventory.get(index).split(count);
markDirty();
return itemStack;
}
return ItemStack.EMPTY;
}
@Override
public ItemStack removeStackFromSlot(int slot)
{
if (!inventory.get(slot).isEmpty())
{
ItemStack itemStack = inventory.get(slot);
setInventorySlotContents(slot, ItemStack.EMPTY);
return itemStack;
}
return ItemStack.EMPTY;
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack)
{
inventory.set(slot, stack);
if (!stack.isEmpty() && stack.getCount() > getInventoryStackLimit())
stack.setCount(getInventoryStackLimit());
markDirty();
}
@Override
public void markDirty()
{
}
@Override
public boolean isUsableByPlayer(PlayerEntity player)
{
return false;
}
}

View file

@ -1,6 +1,7 @@
package wayoftime.bloodmagic.common.item.sigil;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.IGrowable;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@ -64,7 +65,7 @@ public class ItemSigilGreenGrove extends ItemSigilToggleableBase
// if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state))
{
if (state.getBlock() instanceof IGrowable)
if (state.getBlock() instanceof IGrowable && state.getBlock() != Blocks.GRASS_BLOCK)
{
if (worldIn.rand.nextInt(50) == 0)
{