diff --git a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemBase.java b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemBase.java index 056c86f..586d410 100644 --- a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemBase.java +++ b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemBase.java @@ -9,6 +9,7 @@ import io.github.teamgensouspark.grimoireofpatchouli.creativetabs.GoPTabs; import io.github.teamgensouspark.grimoireofpatchouli.libs.vanilia.ModItems; +import io.github.teamgensouspark.grimoireofpatchouli.utils.ModCompat; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.Item; @@ -30,14 +31,16 @@ public ItemBase(String name) { ModItems.ITEMS.add(this); } - public ItemBase(String name, boolean isGoA) { + public ItemBase(String name, ModCompat compat) { setTranslationKey(name); setRegistryName(name); setCreativeTab(GoPTabs.GOPTAB); this.name = name; this.tooltipKey = String.format("item.%s.tooltip", name); - ModItems.GOA_ITEMS.add(this); + if (compat == ModCompat.GOA) { + ModItems.GOA_ITEMS.add(this); + } } @SideOnly(Side.CLIENT) diff --git a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemMoonPhaser.java b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemMoonPhaser.java index 523777f..e08045f 100644 --- a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemMoonPhaser.java +++ b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemMoonPhaser.java @@ -1,6 +1,7 @@ package io.github.teamgensouspark.grimoireofpatchouli.item; import arekkuusu.grimoireofalice.api.recipes.MoonPhase; +import io.github.teamgensouspark.grimoireofpatchouli.utils.ModCompat; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -12,7 +13,9 @@ public class ItemMoonPhaser extends ItemBase { public ItemMoonPhaser(String name) { - super(name, true); + super(name, ModCompat.GOA); + + setMaxStackSize(1); } @Override diff --git a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemSwordBase.java b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemSwordBase.java index 8ad4226..81411f7 100644 --- a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemSwordBase.java +++ b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/ItemSwordBase.java @@ -9,6 +9,7 @@ import io.github.teamgensouspark.grimoireofpatchouli.creativetabs.GoPTabs; import io.github.teamgensouspark.grimoireofpatchouli.libs.vanilia.ModItems; +import io.github.teamgensouspark.grimoireofpatchouli.utils.ModCompat; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; @@ -31,6 +32,19 @@ public ItemSwordBase(String name, ToolMaterial material) { ModItems.ITEMS.add(this); } + public ItemSwordBase(String name, ToolMaterial material, ModCompat compat) { + super(material); + setTranslationKey(name); + setRegistryName(name); + setCreativeTab(GoPTabs.GOPTAB); + + this.name = name; + this.tooltipKey = String.format("item.%s.tooltip", name); + if (compat == ModCompat.GOA) { + ModItems.GOA_ITEMS.add(this); + } + } + @SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { diff --git a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/TouhouItem.java b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/TouhouItem.java index 3bc45dd..9f4ab26 100644 --- a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/TouhouItem.java +++ b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/TouhouItem.java @@ -4,7 +4,7 @@ import javax.annotation.Nullable; -import io.github.teamgensouspark.grimoireofpatchouli.intf.IHasTouhouCharacter; +import io.github.teamgensouspark.grimoireofpatchouli.utils.IHasTouhouCharacter; import net.katsstuff.teamnightclipse.danmakucore.entity.living.TouhouCharacter; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; diff --git a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/TouhouSword.java b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/TouhouSword.java index 44a4b1c..2eccce5 100644 --- a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/TouhouSword.java +++ b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/TouhouSword.java @@ -4,8 +4,9 @@ import javax.annotation.Nullable; -import io.github.teamgensouspark.grimoireofpatchouli.intf.IHasTouhouCharacter; import io.github.teamgensouspark.grimoireofpatchouli.libs.vanilia.ModItems; +import io.github.teamgensouspark.grimoireofpatchouli.utils.IHasTouhouCharacter; +import io.github.teamgensouspark.grimoireofpatchouli.utils.ModCompat; import net.katsstuff.teamnightclipse.danmakucore.entity.living.TouhouCharacter; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; @@ -21,6 +22,11 @@ public TouhouSword(String name, TouhouCharacter character) { this.character = character; } + public TouhouSword(String name, TouhouCharacter character, ModCompat compat) { + super(name, ModItems.TOUHOU_TOOLS,compat); + this.character = character; + } + @SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { diff --git a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/touhou/BlackSakura.java b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/touhou/BlackSakura.java index e87c292..8fd4c47 100644 --- a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/touhou/BlackSakura.java +++ b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/item/touhou/BlackSakura.java @@ -1,5 +1,7 @@ package io.github.teamgensouspark.grimoireofpatchouli.item.touhou; +import org.lwjgl.input.Keyboard; + import io.github.teamgensouspark.grimoireofpatchouli.item.TouhouSword; import io.github.teamgensouspark.kekkai.color.AtomColors; import io.github.teamgensouspark.kekkai.danmaku.DanmakuBuilder; @@ -8,11 +10,15 @@ import net.katsstuff.teamnightclipse.danmakucore.lib.data.LibShotData; import net.katsstuff.teamnightclipse.danmakucore.lib.data.LibSubEntities; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.world.World; @@ -22,6 +28,11 @@ public BlackSakura(String name) { super(name, TouhouCharacter.YOUMU_KONPAKU); } + @Override + public EnumRarity getRarity(ItemStack stack) { + return EnumRarity.EPIC; + } + @Override public float getAttackDamage() { return 9.9f; @@ -41,12 +52,45 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity en @Override public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { - KekkaiDanmakuCreationHelper.createWideShot(DanmakuBuilder.getBuilderWithEntity(playerIn) - .setShot(LibShotData.SHOT_FIRE.setMainColor(AtomColors.ATOM_COLOR_WHITE) - .setSubEntity(LibSubEntities.FIRE).setDamage(4)) - .build(), 5, 40f, 10f, 1.3d); - playerIn.getCooldownTracker().setCooldown(this, 200); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + KekkaiDanmakuCreationHelper.createWideShot(DanmakuBuilder.getBuilderWithEntity(playerIn) + .setShot(LibShotData.SHOT_FIRE.setMainColor(AtomColors.ATOM_COLOR_WHITE) + .setSubEntity(LibSubEntities.FIRE).setDamage(4)) + .setMovementData(1.4) + .build(), 5, 40f, 10f, 1.3d); + playerIn.getCooldownTracker().setCooldown(this, 180); + } else { + ItemStack stack = playerIn.getHeldItem(handIn); + playerIn.setActiveHand(handIn); + return new ActionResult<>(EnumActionResult.SUCCESS, stack); + } return super.onItemRightClick(worldIn, playerIn, handIn); } + @Override + public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft) { + if (entityLiving instanceof EntityPlayer && ((EntityPlayer) entityLiving).onGround) { + EntityPlayer player = (EntityPlayer) entityLiving; + int timeUsed = getMaxItemUseDuration(stack) - timeLeft; + if (timeUsed > 30) { + timeUsed = 30; + } + double speed = timeUsed * 0.3; + player.motionX = -Math.sin(Math.toRadians(player.rotationYaw)) * speed; + player.motionZ = Math.cos(Math.toRadians(player.rotationYaw)) * speed; + if (!player.capabilities.isCreativeMode) { + player.addExhaustion(1.5F); + } + } + } + + @Override + public EnumAction getItemUseAction(ItemStack stack) { + return EnumAction.BOW; + } + + @Override + public int getMaxItemUseDuration(ItemStack stack) { + return 7000; + } } diff --git a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/libs/danmaku/ModSpellcards.java b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/libs/danmaku/ModSpellcards.java index 2adfed2..1c9e1b6 100644 --- a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/libs/danmaku/ModSpellcards.java +++ b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/libs/danmaku/ModSpellcards.java @@ -14,10 +14,10 @@ import io.github.teamgensouspark.grimoireofpatchouli.spellcard.entitiy.PearlDarkCast; import io.github.teamgensouspark.grimoireofpatchouli.spellcard.entitiy.WaveAndParticle; import io.github.teamgensouspark.grimoireofpatchouli.spellcard.entitiy.WonderGodWind; +import io.github.teamgensouspark.grimoireofpatchouli.utils.ModCompat; import net.katsstuff.teamnightclipse.danmakucore.entity.living.TouhouCharacter; import net.katsstuff.teamnightclipse.danmakucore.entity.spellcard.Spellcard; import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -56,8 +56,6 @@ public static void initSpellCard() { @SubscribeEvent public static void onSpellCardRegister(RegistryEvent.Register event) { event.getRegistry().registerAll(SPELL_CARDS.toArray(new Spellcard[0])); - if (Loader.isModLoaded("grimoireofalice")) { - event.getRegistry().registerAll(GOA_SPELL_CARDS.toArray(new Spellcard[0])); - } + ModCompat.GOA.loadedThen(() -> event.getRegistry().registerAll(GOA_SPELL_CARDS.toArray(new Spellcard[0]))); } } diff --git a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/libs/vanilia/ModItems.java b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/libs/vanilia/ModItems.java index abf7929..16a57a1 100644 --- a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/libs/vanilia/ModItems.java +++ b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/libs/vanilia/ModItems.java @@ -7,13 +7,13 @@ import io.github.teamgensouspark.grimoireofpatchouli.Patchouli; import io.github.teamgensouspark.grimoireofpatchouli.item.*; import io.github.teamgensouspark.grimoireofpatchouli.item.touhou.*; +import io.github.teamgensouspark.grimoireofpatchouli.utils.ModCompat; import net.minecraft.item.Item; import net.minecraft.item.ItemSword; import net.minecraft.item.Item.ToolMaterial; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -33,16 +33,12 @@ public class ModItems { @SubscribeEvent public static void onItemModelReg(ModelRegistryEvent event) { ITEMS.forEach(item -> Patchouli.proxy.regCommonVaniliaIRR(item)); - if (Loader.isModLoaded("grimoireofalice")) { - GOA_ITEMS.forEach(item -> Patchouli.proxy.regCommonVaniliaIRR(item)); - } + ModCompat.GOA.loadedThen(() -> GOA_ITEMS.forEach(item -> Patchouli.proxy.regCommonVaniliaIRR(item))); } @SubscribeEvent public static void onItemReg(RegistryEvent.Register event) { event.getRegistry().registerAll(ITEMS.toArray(new Item[0])); - if (Loader.isModLoaded("grimoireofalice")) { - event.getRegistry().registerAll(GOA_ITEMS.toArray(new Item[0])); - } + ModCompat.GOA.loadedThen(() -> event.getRegistry().registerAll(GOA_ITEMS.toArray(new Item[0]))); } } diff --git a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/recepies/AnvilReceipe.java b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/recepies/AnvilReceipe.java new file mode 100644 index 0000000..70deb39 --- /dev/null +++ b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/recepies/AnvilReceipe.java @@ -0,0 +1,37 @@ +package io.github.teamgensouspark.grimoireofpatchouli.recepies; + +import arekkuusu.grimoireofalice.common.item.ModItems; +import io.github.teamgensouspark.grimoireofpatchouli.PatchouliModInfo; +import io.github.teamgensouspark.grimoireofpatchouli.utils.ModCompat; +import net.minecraft.init.Enchantments; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.AnvilUpdateEvent; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +@EventBusSubscriber(modid = PatchouliModInfo.MODID) +public class AnvilReceipe { + @SubscribeEvent + public static void onAnvilUpdate(AnvilUpdateEvent event) { + if (ModCompat.GOA.isLoaded()) { + if (event.getLeft().getItem() == ModItems.HAKUROUKEN && event.getRight().getItem() == ModItems.ROUKANKEN) { + ItemStack output = new ItemStack( + io.github.teamgensouspark.grimoireofpatchouli.libs.vanilia.ModItems.BLACK_SAKURA); + output.addEnchantment(Enchantments.SMITE, 10); + event.setOutput(output); + event.setCost(30); + + } + } else { + if (event.getLeft().getItem() == Items.DIAMOND_SWORD && event.getRight().getItem() == Items.NETHER_STAR) { + ItemStack output = new ItemStack( + io.github.teamgensouspark.grimoireofpatchouli.libs.vanilia.ModItems.BLACK_SAKURA); + output.addEnchantment(Enchantments.SMITE, 10); + event.setOutput(output); + event.setCost(30); + + } + } + } +} diff --git a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/intf/IHasTouhouCharacter.java b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/utils/IHasTouhouCharacter.java similarity index 89% rename from src/main/java/io/github/teamgensouspark/grimoireofpatchouli/intf/IHasTouhouCharacter.java rename to src/main/java/io/github/teamgensouspark/grimoireofpatchouli/utils/IHasTouhouCharacter.java index 088e477..fbb4f83 100644 --- a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/intf/IHasTouhouCharacter.java +++ b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/utils/IHasTouhouCharacter.java @@ -1,4 +1,4 @@ -package io.github.teamgensouspark.grimoireofpatchouli.intf; +package io.github.teamgensouspark.grimoireofpatchouli.utils; import java.util.List; diff --git a/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/utils/ModCompat.java b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/utils/ModCompat.java new file mode 100644 index 0000000..39d74c0 --- /dev/null +++ b/src/main/java/io/github/teamgensouspark/grimoireofpatchouli/utils/ModCompat.java @@ -0,0 +1,27 @@ +package io.github.teamgensouspark.grimoireofpatchouli.utils; + +import net.minecraftforge.fml.common.Loader; + +public class ModCompat { + private String modid; + public static final ModCompat GOA = new ModCompat("grimoireofalice"); + + public ModCompat(String modid) { + this.modid = modid; + } + + public String getModid() { + return modid; + } + + public boolean isLoaded() { + return Loader.isModLoaded(modid); + } + + public void loadedThen(Runnable F) { + if (isLoaded()) { + F.run(); + } + } + +} diff --git a/src/main/resources/assets/grimoireofpatchouli/models/item/danmaku/spellcard/wonder_godwind.json b/src/main/resources/assets/grimoireofpatchouli/models/item/danmaku/spellcard/wonder_godwind.json new file mode 100644 index 0000000..a5125e9 --- /dev/null +++ b/src/main/resources/assets/grimoireofpatchouli/models/item/danmaku/spellcard/wonder_godwind.json @@ -0,0 +1,6 @@ +{ + "parent": "danmakucore:item/danmaku/spellcard/spellcard_base", + "textures": { + "1": "grimoireofpatchouli:items/spellcard/dream_seal" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/grimoireofpatchouli/recipes/moon_phaser.json b/src/main/resources/assets/grimoireofpatchouli/recipes/moon_phaser.json new file mode 100644 index 0000000..0769dc6 --- /dev/null +++ b/src/main/resources/assets/grimoireofpatchouli/recipes/moon_phaser.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "grimoireofpatchouli:item", + "result": { + "item": "grimoireofpatchouli:moon_phaser", + "count": 1 + }, + "ingredients": [ + { + "item": "minecraft:dye", + "data": 4 + }, + { + "item": "minecraft:redstone" + }, + { + "item": "minecraft:redstone" + }, + { + "item": "minecraft:clock" + } + ] +} \ No newline at end of file