Skip to content

Commit

Permalink
Merge pull request #33 from Tctraveler/main
Browse files Browse the repository at this point in the history
Buffed TC rod, new ring, new wand focus
  • Loading branch information
Tctraveler authored Oct 13, 2024
2 parents 94aea55 + 8660d8c commit bd86194
Show file tree
Hide file tree
Showing 20 changed files with 446 additions and 10 deletions.
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {

// Thaumcraft things
implementation('com.github.GTNewHorizons:ThaumicTinkerer:2.10.1:dev')
implementation('com.github.GTNewHorizons:WarpTheory:1.4.1-GTNH:dev')
}


Expand Down
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;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package com.xir.NHUtilities.common.items;

import net.minecraft.item.Item;

import com.xir.NHUtilities.common.items.aItemCore.ItemBasic;
import com.xir.NHUtilities.common.items.baubles.GluttonyRing;
import com.xir.NHUtilities.common.items.baubles.HungerRing;
import com.xir.NHUtilities.common.items.baubles.KamiRing;
import com.xir.NHUtilities.common.items.baubles.WarpWardRing;
import com.xir.NHUtilities.common.items.lunchBoxPlus.LunchBoxPlus;
import com.xir.NHUtilities.common.items.timeVial.EternityVial;
import com.xir.NHUtilities.common.items.timeVial.TimeVial;
import com.xir.NHUtilities.common.items.wand.foci.ItemFocusTape;

public class ModsItemsList {

Expand All @@ -17,4 +21,6 @@ public class ModsItemsList {
public static final ItemBasic timeVial = new TimeVial();
public static final TimeVial eternityVial = new EternityVial();
public static final LunchBoxPlus lunchBoxPlus = new LunchBoxPlus();
public static final ItemFocusTape focusTape = new ItemFocusTape();
public static final Item warpRing = new WarpWardRing();
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
import baubles.api.BaubleType;
import baubles.api.IBauble;
import cpw.mods.fml.common.Optional;
import thaumcraft.api.IVisDiscountGear;
import thaumcraft.api.aspects.Aspect;

@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles")
public class KamiRing extends ItemBasic implements IBauble {
public class KamiRing extends ItemBasic implements IBauble, IVisDiscountGear {

public KamiRing() {
super("KamiRing");
Expand Down Expand Up @@ -74,4 +76,9 @@ public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
return true;
}

@Override
public int getVisDiscount(ItemStack var1, EntityPlayer var2, Aspect var3) {
return 60;
}
}
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;
}
}
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ public class AllTCRecipes {
public static void addAllNHUTCRecipes() {
// part
ArcaneCraftingRecipes.run();
CrucibleRecipes.run();
InfusionRecipes.run();
// part->all
AllTCRecipes.putAll(ArcaneCraftingRecipes.ArcaneCraftingRecipes);
AllTCRecipes.putAll(CrucibleRecipes.CrucibleRecipes);
AllTCRecipes.putAll(InfusionRecipes.InfusionRecipes);
// all->tcAll
ConfigResearch.recipes.putAll(AllTCRecipes);
}
Expand Down
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));
}
}
Loading

0 comments on commit bd86194

Please sign in to comment.