Initial work on DemonWillGauge

Includes the PacketHandler as well as the base system for HUDElements. Still need a replacement for the GuiConfig.
This commit is contained in:
WayofTime 2020-11-11 21:15:58 -05:00
parent 648b96601d
commit b6931a3116
17 changed files with 858 additions and 33 deletions

View file

@ -167,6 +167,8 @@ public class BloodMagicItems
public static final RegistryObject<Item> DESTRUCTIVE_CRYSTAL = BASICITEMS.register("destructivecrystal", () -> new ItemDemonCrystal(EnumDemonWillType.DESTRUCTIVE));
public static final RegistryObject<Item> STEADFAST_CRYSTAL = BASICITEMS.register("steadfastcrystal", () -> new ItemDemonCrystal(EnumDemonWillType.STEADFAST));
public static final RegistryObject<Item> DEMON_WILL_GAUGE = BASICITEMS.register("demonwillgauge", ItemDemonWillGauge::new);
// 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

@ -0,0 +1,12 @@
package wayoftime.bloodmagic.common.item;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IDemonWillViewer
{
boolean canSeeDemonWillAura(World world, ItemStack stack, PlayerEntity player);
int getDemonWillAuraResolution(World world, ItemStack stack, PlayerEntity player);
}

View file

@ -0,0 +1,52 @@
package wayoftime.bloodmagic.common.item;
import java.util.List;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
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.util.handler.event.GenericHandler;
public class ItemDemonWillGauge extends Item implements IDemonWillViewer
{
public ItemDemonWillGauge()
{
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.add(new TranslationTextComponent("tooltip.bloodmagic.willGauge"));
}
@Override
public boolean canSeeDemonWillAura(World world, ItemStack stack, PlayerEntity player)
{
return true;
}
@Override
public int getDemonWillAuraResolution(World world, ItemStack stack, PlayerEntity player)
{
return 100;
}
@Override
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
{
if (entityIn instanceof PlayerEntity && entityIn.ticksExisted % 50 == 0)
{
GenericHandler.sendPlayerDemonWillAura((PlayerEntity) entityIn);
}
}
}