Run code formatter

🦀 Way is gone 🦀
This commit is contained in:
Nicholas Ignoffo 2019-04-14 08:22:42 -07:00
parent 7c1565a68c
commit 53b6030ba9
77 changed files with 1289 additions and 2232 deletions

View file

@ -47,7 +47,8 @@ public class ItemActivationCrystal extends ItemEnum.Variant<ItemActivationCrysta
public enum CrystalType implements ISubItem {
WEAK,
AWAKENED,
CREATIVE,;
CREATIVE,
;
@Nonnull
@Override

View file

@ -3,16 +3,13 @@ package WayofTime.bloodmagic.item;
import WayofTime.bloodmagic.item.types.AlchemicVialType;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
public class ItemAlchemicVial extends ItemEnum.Variant<AlchemicVialType>
{
public ItemAlchemicVial()
{
public class ItemAlchemicVial extends ItemEnum.Variant<AlchemicVialType> {
public ItemAlchemicVial() {
super(AlchemicVialType.class, "alchemic_vial");
}
@Override
public void gatherVariants(Int2ObjectMap<String> variants)
{
public void gatherVariants(Int2ObjectMap<String> variants) {
for (AlchemicVialType type : types)
variants.put(type.ordinal(), "type=normal");
}

View file

@ -82,7 +82,7 @@ public class ItemBloodOrb extends ItemBindableBase implements IBloodOrb {
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.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);
}

View file

@ -70,7 +70,7 @@ public class ItemLavaCrystal extends ItemBindableBase implements IVariantProvide
return null;
NBTTagCompound nbt = (NBTTagCompound) bindingTag;
return new Binding(NBTUtil.getUUIDFromTag(nbt.getCompoundTag("id")),nbt.getString("name"));
return new Binding(NBTUtil.getUUIDFromTag(nbt.getCompoundTag("id")), nbt.getString("name"));
}
@Override

View file

@ -53,7 +53,7 @@ public class ItemSacrificialDagger extends ItemEnum<ItemSacrificialDagger.Dagger
@Override
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft) {
if (entityLiving instanceof EntityPlayer && !entityLiving.getEntityWorld().isRemote)
if(PlayerSacrificeHelper.sacrificePlayerHealth((EntityPlayer) entityLiving))
if (PlayerSacrificeHelper.sacrificePlayerHealth((EntityPlayer) entityLiving))
IncenseHelper.setHasMaxIncense(stack, (EntityPlayer) entityLiving, false);
}
@ -132,9 +132,9 @@ public class ItemSacrificialDagger extends ItemEnum<ItemSacrificialDagger.Dagger
if (!world.isRemote && entity instanceof EntityPlayer) {
boolean prepared = this.isPlayerPreparedForSacrifice(world, (EntityPlayer) entity);
this.setUseForSacrifice(stack, prepared);
if(IncenseHelper.getHasMaxIncense(stack) && !prepared)
if (IncenseHelper.getHasMaxIncense(stack) && !prepared)
IncenseHelper.setHasMaxIncense(stack, (EntityPlayer) entity, false);
if(prepared) {
if (prepared) {
boolean isMax = IncenseHelper.getMaxIncense((EntityPlayer) entity) == IncenseHelper.getCurrentIncense((EntityPlayer) entity);
IncenseHelper.setHasMaxIncense(stack, (EntityPlayer) entity, isMax);
}
@ -178,15 +178,15 @@ public class ItemSacrificialDagger extends ItemEnum<ItemSacrificialDagger.Dagger
}
@Override
public boolean hasEffect(ItemStack stack)
{
public boolean hasEffect(ItemStack stack) {
return IncenseHelper.getHasMaxIncense(stack) || super.hasEffect(stack);
}
public enum DaggerType implements ISubItem {
NORMAL,
CREATIVE,;
CREATIVE,
;
@Nonnull
@Override

View file

@ -32,7 +32,8 @@ public class ItemSlate extends ItemEnum.Variant<ItemSlate.SlateType> {
REINFORCED,
IMBUED,
DEMONIC,
ETHEREAL,;
ETHEREAL,
;
@Nonnull
@Override

View file

@ -93,7 +93,8 @@ public class ItemTelepositionFocus extends ItemEnum.Variant<ItemTelepositionFocu
WEAK,
ENHANCED,
REINFORCED,
DEMONIC,;
DEMONIC,
;
@Nonnull
@Override

View file

@ -22,98 +22,86 @@ import WayofTime.bloodmagic.item.block.base.ItemBlockEnum;
import WayofTime.bloodmagic.util.ChatUtil;
public class ItemBlockMimic extends ItemBlockEnum
{
public ItemBlockMimic(BlockEnum block)
{
public class ItemBlockMimic extends ItemBlockEnum {
public ItemBlockMimic(BlockEnum block) {
super(block);
setHasSubtypes(true);
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
//If not sneaking, do normal item use
if (!player.isSneaking())
{
if (!player.isSneaking()) {
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
}
//IF sneaking and player has permission, replace the targeted block
if (player.canPlayerEdit(pos, facing, stack))
{
if (player.canPlayerEdit(pos, facing, stack)) {
//Store information about the block being replaced and its appropriate itemstack
IBlockState replacedBlockstate = world.getBlockState(pos);
Block replacedBlock = replacedBlockstate.getBlock();
ItemStack replacedStack = replacedBlock.getItem(world, pos, replacedBlockstate);
//Get the state for the mimic
IBlockState mimicBlockstate = this.getBlock().getStateFromMeta(stack.getMetadata());
//Check if the block can be replaced
if (!canReplaceBlock(world, pos, replacedBlockstate))
{
if (!canReplaceBlock(world, pos, replacedBlockstate)) {
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
}
//Check if the tile entity, if any, can be replaced
TileEntity tileReplaced = world.getTileEntity(pos);
if (!canReplaceTile(tileReplaced))
{
if (!canReplaceTile(tileReplaced)) {
return EnumActionResult.FAIL;
}
//If tile can be replaced, store info about the tile
NBTTagCompound tileTag = getTagFromTileEntity(tileReplaced);
if (tileReplaced != null)
{
if (tileReplaced != null) {
NBTTagCompound voidTag = new NBTTagCompound();
voidTag.setInteger("x", pos.getX());
voidTag.setInteger("y", pos.getY());
voidTag.setInteger("z", pos.getZ());
tileReplaced.readFromNBT(voidTag);
}
//Remove one item from stack
stack.shrink(1);
//Replace the block
world.setBlockState(pos, mimicBlockstate, 3);
//Make placing sound
SoundType soundtype = this.block.getSoundType();
world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
//Replace the tile entity
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileMimic)
{
if (tile instanceof TileMimic) {
TileMimic mimic = (TileMimic) tile;
mimic.tileTag = tileTag;
mimic.setReplacedState(replacedBlockstate);
mimic.setInventorySlotContents(0, replacedStack);
mimic.refreshTileEntity();
if (player.capabilities.isCreativeMode)
{
if (player.capabilities.isCreativeMode) {
mimic.dropItemsOnBreak = false;
}
}
return EnumActionResult.SUCCESS;
}
}
return EnumActionResult.FAIL;
}
public boolean canReplaceTile(TileEntity tile)
{
if (tile instanceof TileEntityChest)
{
public boolean canReplaceTile(TileEntity tile) {
if (tile instanceof TileEntityChest) {
return true;
}
@ -124,12 +112,10 @@ public class ItemBlockMimic extends ItemBlockEnum
return state.getBlockHardness(world, pos) != -1.0F;
}
public NBTTagCompound getTagFromTileEntity(TileEntity tile)
{
public NBTTagCompound getTagFromTileEntity(TileEntity tile) {
NBTTagCompound tag = new NBTTagCompound();
if (tile != null)
{
if (tile != null) {
return tile.writeToNBT(tag);
}
@ -137,8 +123,7 @@ public class ItemBlockMimic extends ItemBlockEnum
}
@Override
public int getMetadata(int meta)
{
public int getMetadata(int meta) {
return meta;
}
}

View file

@ -23,12 +23,10 @@ import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider, IVariantProvider
{
public static String[] names = { "exact" };
public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider, IVariantProvider {
public static String[] names = {"exact"};
public ItemFluidRouterFilter()
{
public ItemFluidRouterFilter() {
super();
setTranslationKey(BloodMagic.MODID + ".fluidFilter.");
@ -37,15 +35,13 @@ public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider,
}
@Override
public String getTranslationKey(ItemStack stack)
{
public String getTranslationKey(ItemStack stack) {
return super.getTranslationKey(stack) + names[stack.getItemDamage()];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list)
{
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list) {
if (!isInCreativeTab(creativeTab))
return;
@ -55,35 +51,30 @@ public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider,
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag)
{
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
tooltip.add(TextHelper.localize("tooltip.bloodmagic.fluidFilter." + names[stack.getItemDamage()]));
super.addInformation(stack, world, tooltip, flag);
}
@Override
public IFluidFilter getInputFluidFilter(ItemStack filterStack, TileEntity tile, IFluidHandler handler)
{
public IFluidFilter getInputFluidFilter(ItemStack filterStack, TileEntity tile, IFluidHandler handler) {
IFluidFilter testFilter;
switch (filterStack.getMetadata())
{
case 0:
testFilter = new RoutingFluidFilter();
break;
switch (filterStack.getMetadata()) {
case 0:
testFilter = new RoutingFluidFilter();
break;
default:
testFilter = new RoutingFluidFilter();
default:
testFilter = new RoutingFluidFilter();
}
List<ItemStack> filteredList = new ArrayList<>();
ItemInventory inv = new ItemInventory(filterStack, 9, "");
for (int i = 0; i < inv.getSizeInventory(); i++)
{
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (stack.isEmpty())
{
if (stack.isEmpty()) {
continue;
}
@ -96,32 +87,27 @@ public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider,
}
@Override
public IFluidFilter getOutputFluidFilter(ItemStack filterStack, TileEntity tile, IFluidHandler handler)
{
public IFluidFilter getOutputFluidFilter(ItemStack filterStack, TileEntity tile, IFluidHandler handler) {
IFluidFilter testFilter;
switch (filterStack.getMetadata())
{
case 0:
testFilter = new RoutingFluidFilter();
break;
switch (filterStack.getMetadata()) {
case 0:
testFilter = new RoutingFluidFilter();
break;
default:
testFilter = new RoutingFluidFilter();
default:
testFilter = new RoutingFluidFilter();
}
List<ItemStack> filteredList = new ArrayList<>();
ItemInventory inv = new ItemInventory(filterStack, 9, ""); //TODO: Change to grab the filter from the Item later.
for (int i = 0; i < inv.getSizeInventory(); i++)
{
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (stack.isEmpty())
{
if (stack.isEmpty()) {
continue;
}
ItemStack ghostStack = GhostItemHelper.getStackFromGhost(stack);
if (ghostStack.isEmpty())
{
if (ghostStack.isEmpty()) {
ghostStack.setCount(Integer.MAX_VALUE);
}
@ -133,14 +119,12 @@ public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider,
}
@Override
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants)
{
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=exact");
}
@Override
public ItemStack getContainedStackForItem(ItemStack filterStack, ItemStack keyStack)
{
public ItemStack getContainedStackForItem(ItemStack filterStack, ItemStack keyStack) {
ItemStack copyStack = keyStack.copy();
GhostItemHelper.setItemGhostAmount(copyStack, 0);
copyStack.setCount(1);

View file

@ -22,12 +22,10 @@ import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class ItemRouterFilter extends Item implements IItemFilterProvider, IVariantProvider
{
public static String[] names = { "exact", "ignoreNBT", "modItems", "oreDict" };
public class ItemRouterFilter extends Item implements IItemFilterProvider, IVariantProvider {
public static String[] names = {"exact", "ignoreNBT", "modItems", "oreDict"};
public ItemRouterFilter()
{
public ItemRouterFilter() {
super();
setTranslationKey(BloodMagic.MODID + ".itemFilter.");
@ -36,15 +34,13 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari
}
@Override
public String getTranslationKey(ItemStack stack)
{
public String getTranslationKey(ItemStack stack) {
return super.getTranslationKey(stack) + names[stack.getItemDamage()];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list)
{
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list) {
if (!isInCreativeTab(creativeTab))
return;
@ -54,44 +50,39 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag)
{
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
tooltip.add(TextHelper.localize("tooltip.bloodmagic.itemFilter." + names[stack.getItemDamage()]));
super.addInformation(stack, world, tooltip, flag);
}
@Override
public IItemFilter getInputItemFilter(ItemStack filterStack, TileEntity tile, IItemHandler handler)
{
public IItemFilter getInputItemFilter(ItemStack filterStack, TileEntity tile, IItemHandler handler) {
IItemFilter testFilter = new TestItemFilter();
switch (filterStack.getMetadata())
{
case 0:
testFilter = new TestItemFilter();
break;
case 1:
testFilter = new IgnoreNBTItemFilter();
break;
case 2:
testFilter = new ModIdItemFilter();
break;
case 3:
testFilter = new OreDictItemFilter();
break;
switch (filterStack.getMetadata()) {
case 0:
testFilter = new TestItemFilter();
break;
case 1:
testFilter = new IgnoreNBTItemFilter();
break;
case 2:
testFilter = new ModIdItemFilter();
break;
case 3:
testFilter = new OreDictItemFilter();
break;
default:
testFilter = new DefaultItemFilter();
default:
testFilter = new DefaultItemFilter();
}
List<ItemStack> filteredList = new ArrayList<>();
ItemInventory inv = new ItemInventory(filterStack, 9, "");
for (int i = 0; i < inv.getSizeInventory(); i++)
{
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (stack.isEmpty())
{
if (stack.isEmpty()) {
continue;
}
@ -105,42 +96,37 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari
}
@Override
public IItemFilter getOutputItemFilter(ItemStack filterStack, TileEntity tile, IItemHandler handler)
{
public IItemFilter getOutputItemFilter(ItemStack filterStack, TileEntity tile, IItemHandler handler) {
IItemFilter testFilter;
switch (filterStack.getMetadata())
{
case 0:
testFilter = new TestItemFilter();
break;
case 1:
testFilter = new IgnoreNBTItemFilter();
break;
case 2:
testFilter = new ModIdItemFilter();
break;
case 3:
testFilter = new OreDictItemFilter();
break;
switch (filterStack.getMetadata()) {
case 0:
testFilter = new TestItemFilter();
break;
case 1:
testFilter = new IgnoreNBTItemFilter();
break;
case 2:
testFilter = new ModIdItemFilter();
break;
case 3:
testFilter = new OreDictItemFilter();
break;
default:
testFilter = new DefaultItemFilter();
default:
testFilter = new DefaultItemFilter();
}
List<ItemStack> filteredList = new ArrayList<>();
ItemInventory inv = new ItemInventory(filterStack, 9, ""); //TODO: Change to grab the filter from the Item later.
for (int i = 0; i < inv.getSizeInventory(); i++)
{
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (stack.isEmpty())
{
if (stack.isEmpty()) {
continue;
}
ItemStack ghostStack = GhostItemHelper.getStackFromGhost(stack);
if (ghostStack.isEmpty())
{
if (ghostStack.isEmpty()) {
ghostStack.setCount(Integer.MAX_VALUE);
}
@ -152,8 +138,7 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari
}
@Override
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants)
{
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
variants.put(0, "type=exact");
variants.put(1, "type=ignorenbt");
variants.put(2, "type=moditems");
@ -161,8 +146,7 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari
}
@Override
public ItemStack getContainedStackForItem(ItemStack filterStack, ItemStack keyStack)
{
public ItemStack getContainedStackForItem(ItemStack filterStack, ItemStack keyStack) {
ItemStack copyStack = keyStack.copy();
GhostItemHelper.setItemGhostAmount(copyStack, 0);
copyStack.setCount(1);

View file

@ -15,23 +15,19 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
public class ItemSigilBloodLight extends ItemSigilBase
{
public ItemSigilBloodLight()
{
public class ItemSigilBloodLight extends ItemSigilBase {
public ItemSigilBloodLight() {
super("blood_light", 10);
}
@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
{
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (getCooldownRemainder(stack) > 0)
reduceCooldown(stack);
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (stack.getItem() instanceof ISigil.Holding)
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
@ -43,15 +39,12 @@ public class ItemSigilBloodLight extends ItemSigilBase
if (getCooldownRemainder(stack) > 0)
return super.onItemRightClick(world, player, hand);
if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK)
{
if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK) {
BlockPos blockPos = mop.getBlockPos().offset(mop.sideHit);
if (world.isAirBlock(blockPos))
{
if (world.isAirBlock(blockPos)) {
world.setBlockState(blockPos, RegistrarBloodMagicBlocks.BLOOD_LIGHT.getDefaultState());
if (!world.isRemote)
{
if (!world.isRemote) {
SoulNetwork network = NetworkHelper.getSoulNetwork(getBinding(stack));
network.syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed()));
}
@ -59,10 +52,8 @@ public class ItemSigilBloodLight extends ItemSigilBase
player.swingArm(hand);
return super.onItemRightClick(world, player, hand);
}
} else
{
if (!world.isRemote)
{
} else {
if (!world.isRemote) {
SoulNetwork network = NetworkHelper.getSoulNetwork(getBinding(stack));
world.spawnEntity(new EntityBloodLight(world, player));
network.syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed()));
@ -74,23 +65,19 @@ public class ItemSigilBloodLight extends ItemSigilBase
}
@Override
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged)
{
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
return oldStack.getItem() != newStack.getItem();
}
public int getCooldownRemainder(ItemStack stack)
{
public int getCooldownRemainder(ItemStack stack) {
return NBTHelper.checkNBT(stack).getTagCompound().getInteger(Constants.NBT.TICKS_REMAINING);
}
public void reduceCooldown(ItemStack stack)
{
public void reduceCooldown(ItemStack stack) {
NBTHelper.checkNBT(stack).getTagCompound().setInteger(Constants.NBT.TICKS_REMAINING, getCooldownRemainder(stack) - 1);
}
public void resetCooldown(ItemStack stack)
{
public void resetCooldown(ItemStack stack) {
NBTHelper.checkNBT(stack).getTagCompound().setInteger(Constants.NBT.TICKS_REMAINING, 10);
}
}

View file

@ -71,8 +71,8 @@ public class ItemSigilTeleposition extends ItemSigilBase {
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(blockPos, player, bindingOwnerID, world, tile.getWorld().provider.getDimension(), true));
}
}
}
}
}
return super.onItemRightClick(world, player, hand);
}

View file

@ -104,7 +104,8 @@ public class ItemMonsterSoul extends ItemEnum.Variant<ItemMonsterSoul.WillType>
CORROSIVE,
DESTRUCTIVE,
VENGEFUL,
STEADFAST,;
STEADFAST,
;
@Nonnull
@Override

View file

@ -44,12 +44,12 @@ import java.util.Locale;
public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentientTool, IVariantProvider//, IMeshProvider
{
public static int[] soulBracket = new int[] {16, 60, 200, 400, 1000, 2000, 4000};
public static double[] defaultDamageAdded = new double[] {0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75};
public static float[] velocityAdded = new float[] {0.25f, 0.5f, 0.75f, 1, 1.25f, 1.5f, 1.75f};
public static double[] soulDrainPerSwing = new double[] {0.05, 0.1, 0.2, 0.4, 0.75, 1, 1.5}; //TODO
public static double[] soulDrop = new double[] {2, 4, 7, 10, 13, 16, 24};
public static double[] staticDrop = new double[] {1, 1, 2, 3, 3, 3, 4};
public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000, 2000, 4000};
public static double[] defaultDamageAdded = new double[]{0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75};
public static float[] velocityAdded = new float[]{0.25f, 0.5f, 0.75f, 1, 1.25f, 1.5f, 1.75f};
public static double[] soulDrainPerSwing = new double[]{0.05, 0.1, 0.2, 0.4, 0.75, 1, 1.5}; //TODO
public static double[] soulDrop = new double[]{2, 4, 7, 10, 13, 16, 24};
public static double[] staticDrop = new double[]{1, 1, 2, 3, 3, 3, 4};
public static float soullessShotVelocity = 2.5F;
public ItemSentientBow() {
@ -331,7 +331,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
player.addStat(StatList.getObjectUseStats(this));
return entityArrow;
}
@Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft) {
if (entityLiving instanceof EntityPlayer) {
@ -361,9 +361,9 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
ItemArrow itemarrow = ((ItemArrow) (itemstack.getItem() instanceof ItemArrow ? itemstack.getItem() : Items.ARROW));
EntityArrow entityArrow;
double amount = (this.getDropOfActivatedBow(stack) * world.rand.nextDouble() + this.getStaticDropOfActivatedBow(stack));
float newArrowVelocity = arrowVelocity * getVelocityOfArrow(stack);
if (getLevel(PlayerDemonWillHandler.getTotalDemonWill(type, player)) <= 0) {
entityArrow = itemarrow.createArrow(world, itemstack, entityLiving);
} else if (itemarrow == Items.ARROW) {
@ -382,8 +382,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
entityArrow.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, newArrowVelocity, 1.0F);
if (Float.compare(getVelocityOfArrow(stack), soullessShotVelocity) < Float.MIN_NORMAL)
{
if (Float.compare(getVelocityOfArrow(stack), soullessShotVelocity) < Float.MIN_NORMAL) {
world.playSound(null, player.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.NEUTRAL, 0.4F, 1.0F);
}

View file

@ -32,31 +32,26 @@ import WayofTime.bloodmagic.iface.IActivatable;
import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.util.helper.NBTHelper;
public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshProvider, IActivatable
{
public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshProvider, IActivatable {
public static Map<EntityPlayer, Map<EntityLivingBase, Vector3d>> floatMap = new HashMap<EntityPlayer, Map<EntityLivingBase, Vector3d>>();
public static Map<EntityPlayer, EntityLivingBase> heldEntityMap = new HashMap<EntityPlayer, EntityLivingBase>();
public static Map<EntityPlayer, Double> heldEntityOffsetMap = new HashMap<EntityPlayer, Double>();
//TODO: A lot of this stuff could be moved to a toggle-able variant
public ItemFlightScroll()
{
public ItemFlightScroll() {
super();
setTranslationKey(BloodMagic.MODID + ".icarusScroll");
setCreativeTab(BloodMagic.TAB_BM);
}
@Override
public boolean getActivated(ItemStack stack)
{
public boolean getActivated(ItemStack stack) {
return !stack.isEmpty() && NBTHelper.checkNBT(stack).getTagCompound().getBoolean(Constants.NBT.ACTIVATED);
}
@Override
public ItemStack setActivatedState(ItemStack stack, boolean activated)
{
if (!stack.isEmpty())
{
public ItemStack setActivatedState(ItemStack stack, boolean activated) {
if (!stack.isEmpty()) {
NBTHelper.checkNBT(stack).getTagCompound().setBoolean(Constants.NBT.ACTIVATED, activated);
return stack;
}
@ -65,27 +60,20 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (!world.isRemote)
{
if (player.isSneaking())
{
if (!getActivated(stack))
{
if (!world.isRemote) {
if (player.isSneaking()) {
if (!getActivated(stack)) {
double drainNeeded = getBreathCostPerSecond(stack);
if (this.drainBreath(stack, drainNeeded, false) >= drainNeeded)
{
if (this.drainBreath(stack, drainNeeded, false) >= drainNeeded) {
setActivatedState(stack, true);
}
} else
{
} else {
setActivatedState(stack, false);
}
} else
{
} else {
//TODO: Add an effect where it "draws back" like a bow in order to cast Levitation on a mob.
//Only Levitated mobs can be grabbed.
}
@ -95,27 +83,21 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr
}
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, EnumHand hand)
{
if (entity.world.isRemote)
{
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) {
if (entity.world.isRemote) {
return false;
}
//TODO: Do check to see if the entity is levitating - will only "ensnare" a mob that is levitating.
if (player.isSneaking())
{
if (player.isSneaking()) {
//TODO: Release entity completely?
removeEntity(player, entity);
} else
{
} else {
EntityLivingBase heldEntity = getHeldEntity(player);
if (heldEntity != null && heldEntity.equals(entity))
{
if (heldEntity != null && heldEntity.equals(entity)) {
heldEntityMap.remove(player);
} else
{
} else {
holdEntity(player, entity); //Hold the entity so you can place it around yourself where needed.
}
}
@ -124,18 +106,13 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected)
{
if (!world.isRemote && entity instanceof EntityPlayerMP && getActivated(stack))
{
if (entity.ticksExisted % 20 == 0)
{
public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
if (!world.isRemote && entity instanceof EntityPlayerMP && getActivated(stack)) {
if (entity.ticksExisted % 20 == 0) {
double drainNeeded = getBreathCostPerSecond(stack);
if (this.drainBreath(stack, drainNeeded, false) >= drainNeeded)
{
if (this.drainBreath(stack, drainNeeded, false) >= drainNeeded) {
this.drainBreath(stack, drainNeeded, true);
} else
{
} else {
this.setActivatedState(stack, false);
}
}
@ -143,40 +120,32 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr
onEffectUpdate(stack, world, (EntityPlayer) entity, itemSlot, isSelected);
}
if (!world.isRemote)
{
if (entity instanceof EntityPlayer)
{
if (!world.isRemote) {
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
updateHeldEntityPosition(player);
if (floatMap.containsKey(player))
{
if (floatMap.containsKey(player)) {
Map<EntityLivingBase, Vector3d> entityMap = floatMap.get(player);
if (entityMap == null)
{
if (entityMap == null) {
return;
}
List<EntityLivingBase> removalList = new ArrayList<EntityLivingBase>();
for (Entry<EntityLivingBase, Vector3d> entry : entityMap.entrySet())
{
for (Entry<EntityLivingBase, Vector3d> entry : entityMap.entrySet()) {
EntityLivingBase floatingEntity = entry.getKey();
if (floatingEntity == null || floatingEntity.isDead || floatingEntity.dimension != player.dimension)
{
if (floatingEntity == null || floatingEntity.isDead || floatingEntity.dimension != player.dimension) {
removalList.add(floatingEntity);
}
followOwner(player, floatingEntity, entry.getValue());
}
for (EntityLivingBase livingEntity : removalList)
{
for (EntityLivingBase livingEntity : removalList) {
entityMap.remove(livingEntity);
}
if (entityMap.isEmpty())
{
if (entityMap.isEmpty()) {
floatMap.remove(player);
}
@ -185,16 +154,13 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr
}
}
public static boolean updateEntityOffset(EntityPlayer player, EntityLivingBase living, Vector3d updatedOffset)
{
public static boolean updateEntityOffset(EntityPlayer player, EntityLivingBase living, Vector3d updatedOffset) {
//TODO: Check if this entity is contained in another player's map to prevent weird things.
if (floatMap.containsKey(player))
{
if (floatMap.containsKey(player)) {
Map<EntityLivingBase, Vector3d> entityMap = floatMap.get(player);
entityMap.put(living, updatedOffset);
return true;
} else
{
} else {
Map<EntityLivingBase, Vector3d> entityMap = new HashMap<EntityLivingBase, Vector3d>();
entityMap.put(living, updatedOffset);
floatMap.put(player, entityMap);
@ -203,28 +169,23 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr
}
@Nullable
public static EntityLivingBase getHeldEntity(EntityPlayer player)
{
if (heldEntityMap.containsKey(player))
{
public static EntityLivingBase getHeldEntity(EntityPlayer player) {
if (heldEntityMap.containsKey(player)) {
return heldEntityMap.get(player);
}
return null;
}
public static double getHeldEntityOffset(EntityPlayer player)
{
if (heldEntityMap.containsKey(player))
{
public static double getHeldEntityOffset(EntityPlayer player) {
if (heldEntityMap.containsKey(player)) {
return heldEntityOffsetMap.get(player);
}
return 1;
}
public static void holdEntity(EntityPlayer player, EntityLivingBase entityLiving)
{
public static void holdEntity(EntityPlayer player, EntityLivingBase entityLiving) {
float distance = player.getDistance(entityLiving);
Vec3d lookVec = player.getLookVec();
heldEntityMap.put(player, entityLiving);
@ -232,41 +193,33 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr
updateEntityOffset(player, entityLiving, new Vector3d(lookVec.x * distance, lookVec.y * distance, lookVec.z * distance));
}
public static void updateHeldEntityPosition(EntityPlayer player)
{
public static void updateHeldEntityPosition(EntityPlayer player) {
EntityLivingBase entityLiving = getHeldEntity(player);
if (entityLiving != null)
{
if (entityLiving != null) {
double offset = getHeldEntityOffset(player);
Vec3d lookVec = player.getLookVec();
updateEntityOffset(player, entityLiving, new Vector3d(lookVec.x * offset, lookVec.y * offset, lookVec.z * offset));
}
}
public static void removeEntity(EntityPlayer player, EntityLivingBase living)
{
if (living == null)
{
public static void removeEntity(EntityPlayer player, EntityLivingBase living) {
if (living == null) {
return;
}
if (floatMap.containsKey(player))
{
if (floatMap.containsKey(player)) {
Map<EntityLivingBase, Vector3d> entityMap = floatMap.get(player);
if (entityMap.containsKey(living))
{
if (entityMap.containsKey(living)) {
entityMap.remove(living);
}
if (entityMap.isEmpty())
{
if (entityMap.isEmpty()) {
floatMap.remove(player);
}
}
}
public void followOwner(EntityPlayer owner, EntityLivingBase livingEntity, Vector3d offset)
{
public void followOwner(EntityPlayer owner, EntityLivingBase livingEntity, Vector3d offset) {
double offsetX = offset.x;
double offsetY = offset.y;
double offsetZ = offset.z;
@ -287,40 +240,34 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr
vec.normalize();
if (speed <= 0.00001)
{
if (speed <= 0.00001) {
return;
}
livingEntity.setVelocity(vec.x * speed, vec.y * speed, vec.z * speed);
}
public void onEffectUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
public void onEffectUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
player.addPotionEffect(new PotionEffect(RegistrarBloodMagic.FLIGHT, 2, 0));
}
@Override
public int getMaxBreath(ItemStack stack)
{
public int getMaxBreath(ItemStack stack) {
return 20;
}
public double getBreathCostPerSecond(ItemStack stack)
{
public double getBreathCostPerSecond(ItemStack stack) {
return 0.01;
}
@Override
@SideOnly(Side.CLIENT)
public ItemMeshDefinition getMeshDefinition()
{
public ItemMeshDefinition getMeshDefinition() {
return new CustomMeshDefinitionActivatable("icarus_scroll");
}
@Override
public void gatherVariants(Consumer<String> variants)
{
public void gatherVariants(Consumer<String> variants) {
variants.accept("active=false");
variants.accept("active=true");
}

View file

@ -6,33 +6,28 @@ import net.minecraft.nbt.NBTTagCompound;
import WayofTime.bloodmagic.soul.ISoulBreathContainer;
import WayofTime.bloodmagic.util.Constants;
public abstract class ItemSoulBreathContainer extends Item implements ISoulBreathContainer
{
public abstract class ItemSoulBreathContainer extends Item implements ISoulBreathContainer {
@Override
public double getBreath(ItemStack stack)
{
public double getBreath(ItemStack stack) {
NBTTagCompound tag = stack.getTagCompound();
return tag.getDouble(Constants.NBT.BREATH);
}
@Override
public void setBreath(ItemStack stack, double amount)
{
public void setBreath(ItemStack stack, double amount) {
NBTTagCompound tag = stack.getTagCompound();
tag.setDouble(Constants.NBT.BREATH, amount);
}
@Override
public double drainBreath(ItemStack stack, double drainAmount, boolean doDrain)
{
public double drainBreath(ItemStack stack, double drainAmount, boolean doDrain) {
double breath = getBreath(stack);
double breathDrained = Math.min(drainAmount, breath);
if (doDrain)
{
if (doDrain) {
setBreath(stack, breath - breathDrained);
}
@ -40,15 +35,13 @@ public abstract class ItemSoulBreathContainer extends Item implements ISoulBreat
}
@Override
public double fillBreath(ItemStack stack, double fillAmount, boolean doFill)
{
public double fillBreath(ItemStack stack, double fillAmount, boolean doFill) {
double current = this.getBreath(stack);
double maxBreath = this.getMaxBreath(stack);
double filled = Math.min(fillAmount, maxBreath - current);
if (doFill)
{
if (doFill) {
this.setBreath(stack, filled + current);
}
@ -56,17 +49,14 @@ public abstract class ItemSoulBreathContainer extends Item implements ISoulBreat
}
@Override
public boolean showDurabilityBar(ItemStack stack)
{
public boolean showDurabilityBar(ItemStack stack) {
return true;
}
@Override
public double getDurabilityForDisplay(ItemStack stack)
{
public double getDurabilityForDisplay(ItemStack stack) {
double maxWill = getMaxBreath(stack);
if (maxWill <= 0)
{
if (maxWill <= 0) {
return 1;
}
return 1.0 - (getBreath(stack) / maxWill);

View file

@ -6,44 +6,36 @@ import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.Locale;
public enum AlchemicVialType implements ISubItem
{
public enum AlchemicVialType implements ISubItem {
BASE(0x2e35ff);
final int potionColour;
AlchemicVialType(int colour1)
{
AlchemicVialType(int colour1) {
potionColour = colour1;
}
@Nonnull
@Override
public String getInternalName()
{
public String getInternalName() {
return name().toLowerCase(Locale.ROOT);
}
@Nonnull
@Override
public ItemStack getStack(int count)
{
public ItemStack getStack(int count) {
return new ItemStack(RegistrarBloodMagicItems.ALCHEMIC_VIAL, count, ordinal());
}
public int getColourForLayer(int layer)
{
if (layer == 0)
{
public int getColourForLayer(int layer) {
if (layer == 0) {
return potionColour;
}
return -1;
}
public static int getColourForLayer(int variant, int layer)
{
if (variant >= AlchemicVialType.values().length)
{
public static int getColourForLayer(int variant, int layer) {
if (variant >= AlchemicVialType.values().length) {
return -1;
}

View file

@ -40,7 +40,8 @@ public enum ComponentTypes implements ISubItem {
CATALYST_POWER_1,
REAGENT_CLAW,
REAGENT_BOUNCE,
REAGENT_FROST,;
REAGENT_FROST,
;
@Nonnull
@Override

View file

@ -9,7 +9,8 @@ import java.util.Locale;
public enum ShardType implements ISubItem {
WEAK,
DEMONIC,;
DEMONIC,
;
@Nonnull
@Override