-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from Tctraveler/main
Buffed TC rod, new ring, new wand focus
- Loading branch information
Showing
20 changed files
with
446 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
src/main/java/com/xir/NHUtilities/common/events/WarpWardRingEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.xir.NHUtilities.common.events; | ||
|
||
import static shukaro.warptheory.handlers.WarpHandler.Knowledge; | ||
|
||
import java.util.Optional; | ||
import java.util.Random; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.StatCollector; | ||
import net.minecraft.world.World; | ||
import net.minecraftforge.event.world.BlockEvent; | ||
|
||
import com.xir.NHUtilities.common.items.baubles.WarpWardRing; | ||
import com.xir.NHUtilities.utils.InventoryUtils; | ||
|
||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
import gregtech.api.metatileentity.BaseMetaTileEntity; | ||
import shukaro.warptheory.util.ChatHelper; | ||
import shukaro.warptheory.util.FormatCodes; | ||
|
||
public class WarpWardRingEvent { | ||
|
||
@SubscribeEvent | ||
public void onWarpWardRingPlacingGTBlocks(BlockEvent.PlaceEvent event) { | ||
int x = event.x, y = event.y, z = event.z; | ||
EntityPlayer player = event.player; | ||
World world = event.world; | ||
TileEntity tileEntity = world.getTileEntity(x, y, z); | ||
if (tileEntity == null) return; | ||
Optional<ItemStack> baublesItem = InventoryUtils.getItemInPlayerBaublesInventory(player, WarpWardRing.class); | ||
if (!baublesItem.isPresent()) return; | ||
if (tileEntity instanceof BaseMetaTileEntity) { | ||
Random random = new Random(); | ||
int number = random.nextInt(100) + 1; | ||
if (number <= 3) { | ||
String name = player.getCommandSenderName(); | ||
int warpPerm = Knowledge.getWarpPerm(name); | ||
int warpSticky = Knowledge.getWarpSticky(name); | ||
int warpTemp = Knowledge.getWarpTemp(name); | ||
int warpCounter = Knowledge.getWarpCounter(name); | ||
if (warpCounter == 0) { | ||
ChatHelper.sendToPlayer( | ||
player, | ||
FormatCodes.Purple.code + FormatCodes.Italic.code | ||
+ StatCollector.translateToLocal("chat.nhutilities.1")); | ||
return; | ||
} else { | ||
int amount = random.nextInt(10) + 1; | ||
if (warpCounter <= amount) { | ||
Knowledge.setWarpTemp(name, 0); | ||
Knowledge.setWarpSticky(name, 0); | ||
Knowledge.setWarpPerm(name, 0); | ||
Knowledge.setWarpCounter(name, 0); | ||
ChatHelper.sendToPlayer( | ||
player, | ||
FormatCodes.Purple.code + FormatCodes.Italic.code | ||
+ StatCollector.translateToLocal("chat.nhutilities.2")); | ||
} else { | ||
Knowledge.setWarpCounter(name, warpCounter - amount); | ||
if (warpTemp <= amount) { | ||
Knowledge.setWarpTemp(name, 0); | ||
amount -= warpTemp; | ||
if (warpSticky <= amount) { | ||
Knowledge.setWarpSticky(name, 0); | ||
amount -= warpSticky; | ||
if (warpPerm <= amount) { | ||
Knowledge.setWarpPerm(name, 0); | ||
} else { | ||
Knowledge.setWarpPerm(name, warpPerm - amount); | ||
} | ||
} else { | ||
Knowledge.setWarpSticky(name, warpSticky - amount); | ||
} | ||
} else { | ||
Knowledge.setWarpTemp(name, warpTemp - amount); | ||
} | ||
} | ||
ChatHelper.sendToPlayer( | ||
player, | ||
FormatCodes.Purple.code + FormatCodes.Italic.code | ||
+ StatCollector.translateToLocal("chat.nhutilities.3")); | ||
} | ||
} | ||
} else { | ||
return; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/main/java/com/xir/NHUtilities/common/items/baubles/WarpWardRing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.xir.NHUtilities.common.items.baubles; | ||
|
||
import net.minecraft.creativetab.CreativeTabs; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.potion.PotionEffect; | ||
|
||
import com.xir.NHUtilities.common.items.aItemCore.ItemBasic; | ||
|
||
import baubles.api.BaubleType; | ||
import baubles.api.IBauble; | ||
import thaumcraft.api.IVisDiscountGear; | ||
import thaumcraft.api.aspects.Aspect; | ||
import thaumcraft.common.config.Config; | ||
|
||
public class WarpWardRing extends ItemBasic implements IBauble, IVisDiscountGear { | ||
|
||
public WarpWardRing() { | ||
super("WarpWardRing"); | ||
this.setMaxStackSize(1); | ||
this.setCreativeTab(CreativeTabs.tabTools); | ||
} | ||
|
||
@Override | ||
public BaubleType getBaubleType(ItemStack itemstack) { | ||
return BaubleType.RING; | ||
} | ||
|
||
@Override | ||
public void onWornTick(ItemStack itemstack, EntityLivingBase player) { | ||
player.addPotionEffect(new PotionEffect(Config.potionWarpWardID, 200, 0)); | ||
} | ||
|
||
@Override | ||
public void onEquipped(ItemStack itemstack, EntityLivingBase player) { | ||
|
||
} | ||
|
||
@Override | ||
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) { | ||
player.removePotionEffect(Config.potionWarpWardID); | ||
} | ||
|
||
@Override | ||
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public int getVisDiscount(ItemStack var1, EntityPlayer var2, Aspect var3) { | ||
return 10; | ||
} | ||
} |
106 changes: 106 additions & 0 deletions
106
src/main/java/com/xir/NHUtilities/common/items/wand/foci/ItemFocusTape.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package com.xir.NHUtilities.common.items.wand.foci; | ||
|
||
import net.minecraft.client.renderer.texture.IIconRegister; | ||
import net.minecraft.creativetab.CreativeTabs; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.MovingObjectPosition; | ||
import net.minecraft.world.World; | ||
|
||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
import gregtech.api.metatileentity.BaseMetaTileEntity; | ||
import gregtech.api.metatileentity.implementations.MTEHatchMaintenance; | ||
import thaumcraft.api.aspects.Aspect; | ||
import thaumcraft.api.aspects.AspectList; | ||
import thaumcraft.api.wands.ItemFocusBasic; | ||
import thaumcraft.common.items.wands.ItemWandCasting; | ||
|
||
public class ItemFocusTape extends ItemFocusBasic { | ||
|
||
private final String name = "focus_tape"; | ||
private static final AspectList cost = new AspectList().add(Aspect.ORDER, 500); | ||
|
||
public ItemFocusTape() { | ||
setMaxDamage(0); | ||
setMaxStackSize(1); | ||
setNoRepair(); | ||
setCreativeTab(CreativeTabs.tabTools); | ||
setUnlocalizedName(name); | ||
} | ||
|
||
@Override | ||
public AspectList getVisCost(ItemStack focus) { | ||
return cost; | ||
} | ||
|
||
@Override | ||
@SideOnly(Side.CLIENT) | ||
public void registerIcons(final IIconRegister iconRegister) { | ||
icon = iconRegister.registerIcon("nhutilities:" + name); | ||
} | ||
|
||
@Override | ||
public String getSortingHelper(final ItemStack itemStack) { | ||
return "TAPE" + super.getSortingHelper(itemStack); | ||
} | ||
|
||
@Override | ||
public boolean isVisCostPerTick(ItemStack focusstack) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public WandFocusAnimation getAnimation(ItemStack focusstack) { | ||
return WandFocusAnimation.CHARGE; | ||
} | ||
|
||
@Override | ||
public int getFocusColor(ItemStack focusstack) { | ||
return 0x404040; | ||
} | ||
|
||
@Override | ||
public ItemStack onFocusRightClick(ItemStack wandstack, World world, EntityPlayer player, | ||
MovingObjectPosition movingobjectposition) { | ||
if (world.isRemote || movingobjectposition == null) { | ||
return wandstack; | ||
} | ||
ItemWandCasting wandCasting = (ItemWandCasting) wandstack.getItem(); | ||
int x = movingobjectposition.blockX; | ||
int y = movingobjectposition.blockY; | ||
int z = movingobjectposition.blockZ; | ||
TileEntity mTileEntity = world.getTileEntity(x, y, z); | ||
if (!(mTileEntity instanceof BaseMetaTileEntity mBaseMetaTileEntity)) { | ||
return wandstack; | ||
} | ||
if (wandCasting != null | ||
&& (mBaseMetaTileEntity.getMetaTileEntity() instanceof MTEHatchMaintenance hatchMaintenance) | ||
&& (!hatchMaintenance.mWrench || !hatchMaintenance.mSolderingTool | ||
|| !hatchMaintenance.mSoftHammer | ||
|| !hatchMaintenance.mHardHammer | ||
|| !hatchMaintenance.mScrewdriver | ||
|| !hatchMaintenance.mCrowbar | ||
|| hatchMaintenance.getBaseMetaTileEntity() | ||
.isActive())) { | ||
if (wandCasting.consumeAllVis(wandstack, player, this.getVisCost(wandstack), true, false)) { | ||
hatchMaintenance.mHardHammer = true; | ||
hatchMaintenance.mCrowbar = true; | ||
hatchMaintenance.mScrewdriver = true; | ||
hatchMaintenance.mSoftHammer = true; | ||
hatchMaintenance.mSolderingTool = true; | ||
hatchMaintenance.mWrench = true; | ||
hatchMaintenance.getBaseMetaTileEntity() | ||
.setActive(false); | ||
world.playSoundEffect(x, y, z, "thaumcraft:wand", 1.0F, 1.0F); | ||
} | ||
} | ||
return wandstack; | ||
} | ||
|
||
@Override | ||
public int getActivationCooldown(ItemStack stack) { | ||
return 100; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/com/xir/NHUtilities/common/recipes/TCRecipes/CrucibleRecipes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.xir.NHUtilities.common.recipes.TCRecipes; | ||
|
||
import java.util.HashMap; | ||
|
||
import net.minecraft.item.ItemStack; | ||
|
||
import com.xir.NHUtilities.common.items.ModsItemsList; | ||
import com.xir.NHUtilities.loader.ResearchLoader; | ||
|
||
import gregtech.api.enums.ItemList; | ||
import thaumcraft.api.ThaumcraftApi; | ||
import thaumcraft.api.aspects.Aspect; | ||
import thaumcraft.api.aspects.AspectList; | ||
|
||
public class CrucibleRecipes { | ||
|
||
public static HashMap<String, Object> CrucibleRecipes = new HashMap<>(); | ||
private static final AspectList focus_tape = new AspectList().add(Aspect.ORDER, 20) | ||
.add(Aspect.ENTROPY, 20) | ||
.add(Aspect.TOOL, 40); | ||
|
||
public static void run() { | ||
CrucibleRecipes.put( | ||
"focustape", | ||
ThaumcraftApi.addCrucibleRecipe( | ||
ResearchLoader.focus_tape.toUpperCase(), | ||
new ItemStack(ModsItemsList.focusTape, 1), | ||
ItemList.Duct_Tape.get(1), | ||
focus_tape)); | ||
} | ||
} |
Oops, something went wrong.