Skip to content

Commit

Permalink
Tongs, TFC is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Jul 2, 2021
1 parent 52ccd7e commit dce6429
Show file tree
Hide file tree
Showing 22 changed files with 392 additions and 43 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Hot Or Not
==========

TFC-1.1.5 (2021-06-12 16:06:55 +0200)
-------------------------------------
* Addable/removable items via config (ACGaming)

TFC-1.1.4 (2021-03-27 16:42:13 +0100)
-------------------------------------
* Item tooltips + configurable temperatures (ACGaming)
Expand Down
1 change: 0 additions & 1 deletion README.md

This file was deleted.

4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
modGroup=com.buuz135
minecraftVersion=1.12.2
modVersion=1.1.5
modBaseName=HotOrNotTFC
modVersion=1.1.6
modBaseName=HotOrNotPlus
forgeVersion=1.12.2-14.23.5.2847
mcpVersion=stable_39
135 changes: 106 additions & 29 deletions src/main/java/com/buuz135/hotornot/HotOrNot.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.function.Consumer;
import java.util.function.Predicate;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.MobEffects;
import net.minecraft.item.Item;
Expand All @@ -38,6 +39,7 @@
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
Expand All @@ -60,13 +62,15 @@
modid = HotOrNot.MOD_ID,
name = HotOrNot.MOD_NAME,
version = HotOrNot.VERSION,
dependencies = "required-after:tfc"
dependencies = "after:tfc"
)
public class HotOrNot
{
public static final String MOD_ID = "hotornot";
public static final String MOD_NAME = "HotOrNot for TFC";
public static final String VERSION = "1.1.5";
public static final String MOD_NAME = "HotOrNot+";
public static final String VERSION = "1.1.6";

public static final CreativeTabs HOTORNOT_TAB = new HotOrNotTab();

@SidedProxy(clientSide = "com.buuz135.hotornot.proxy.ClientProxy", serverSide = "com.buuz135.hotornot.proxy.CommonProxy")
public static CommonProxy proxy;
Expand Down Expand Up @@ -161,7 +165,24 @@ public static void onTick(TickEvent.WorldTickEvent event)
ItemStack offHand = entityPlayerMP.getHeldItemOffhand();
if (offHand.getItem().equals(CommonProxy.MITTS))
{
offHand.damageItem(1, entityPlayerMP);
if (HotConfig.MITTS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (offHand.getItem().equals(CommonProxy.WOODEN_TONGS))
{
if (HotConfig.WOODEN_TONGS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (offHand.getItem().equals(CommonProxy.IRON_TONGS))
{
if (HotConfig.IRON_TONGS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (event.world.getTotalWorldTime() % 20 == 0)
{
Expand All @@ -179,36 +200,72 @@ else if (event.world.getTotalWorldTime() % 20 == 0)

if (HotConfig.HOT_ITEMS && !stack.isEmpty() && !HotLists.isRemoved(stack))
{
// TFC ITEMS
if (stack.hasCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null))
if (Loader.isModLoaded("tfc"))
{
IItemHeat heatHandlerItem = stack.getCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null);
if (heatHandlerItem.getTemperature() >= HotConfig.HOT_ITEM)
// TFC ITEMS
if (stack.hasCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null))
{
ItemStack offHand = entityPlayerMP.getHeldItemOffhand();
if (offHand.getItem().equals(CommonProxy.MITTS))
{
offHand.damageItem(1, entityPlayerMP);
}
else if (event.world.getTotalWorldTime() % 10 == 0)
IItemHeat heatHandlerItem = stack.getCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null);
if (heatHandlerItem.getTemperature() >= HotConfig.HOT_ITEM)
{
entityPlayerMP.setFire(1);
if (HotConfig.YEET)
ItemStack offHand = entityPlayerMP.getHeldItemOffhand();
if (offHand.getItem().equals(CommonProxy.MITTS))
{
entityPlayerMP.dropItem(stack, false, true);
entityPlayerMP.inventory.deleteStack(stack);
if (HotConfig.MITTS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (offHand.getItem().equals(CommonProxy.WOODEN_TONGS))
{
if (HotConfig.WOODEN_TONGS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (offHand.getItem().equals(CommonProxy.IRON_TONGS))
{
if (HotConfig.IRON_TONGS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (event.world.getTotalWorldTime() % 10 == 0)
{
entityPlayerMP.setFire(1);
if (HotConfig.YEET)
{
entityPlayerMP.dropItem(stack, false, true);
entityPlayerMP.inventory.deleteStack(stack);
}
}
}
}
}

// MANUALLY ADDED ITEMS
else if (HotLists.isHot(stack))
{
ItemStack offHand = entityPlayerMP.getHeldItemOffhand();
if (offHand.getItem().equals(CommonProxy.MITTS))
{
offHand.damageItem(1, entityPlayerMP);
if (HotConfig.MITTS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (offHand.getItem().equals(CommonProxy.WOODEN_TONGS))
{
if (HotConfig.WOODEN_TONGS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (offHand.getItem().equals(CommonProxy.IRON_TONGS))
{
if (HotConfig.IRON_TONGS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (event.world.getTotalWorldTime() % 10 == 0)
{
Expand All @@ -225,7 +282,24 @@ else if (HotLists.isCold(stack))
ItemStack offHand = entityPlayerMP.getHeldItemOffhand();
if (offHand.getItem().equals(CommonProxy.MITTS))
{
offHand.damageItem(1, entityPlayerMP);
if (HotConfig.MITTS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (offHand.getItem().equals(CommonProxy.WOODEN_TONGS))
{
if (HotConfig.WOODEN_TONGS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (offHand.getItem().equals(CommonProxy.IRON_TONGS))
{
if (HotConfig.IRON_TONGS_DURABILITY != 0)
{
offHand.damageItem(1, entityPlayerMP);
}
}
else if (event.world.getTotalWorldTime() % 10 == 0)
{
Expand Down Expand Up @@ -273,14 +347,6 @@ public static void onTooltip(ItemTooltipEvent event)
}
}
}
else if (stack.hasCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null))
{
IItemHeat heat = stack.getCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null);
if (heat.getTemperature() >= HotConfig.HOT_ITEM)
{
event.getToolTip().add(FluidEffect.HOT.color + new TextComponentTranslation(FluidEffect.HOT.tooltip).getUnformattedText());
}
}
else if (HotLists.isHot(stack))
{
event.getToolTip().add(FluidEffect.HOT.color + new TextComponentTranslation(FluidEffect.HOT.tooltip).getUnformattedText());
Expand All @@ -293,6 +359,17 @@ else if (HotLists.isGaseous(stack))
{
event.getToolTip().add(FluidEffect.GAS.color + new TextComponentTranslation(FluidEffect.GAS.tooltip).getUnformattedText());
}
else if (Loader.isModLoaded("tfc"))
{
if (stack.hasCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null))
{
IItemHeat heat = stack.getCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null);
if (heat.getTemperature() >= HotConfig.HOT_ITEM)
{
event.getToolTip().add(FluidEffect.HOT.color + new TextComponentTranslation(FluidEffect.HOT.tooltip).getUnformattedText());
}
}
}
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/buuz135/hotornot/HotOrNotTab.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.buuz135.hotornot;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class HotOrNotTab extends CreativeTabs
{
public HotOrNotTab()
{
super(HotOrNot.MOD_ID);
}

@SideOnly(Side.CLIENT)
@Override
public ItemStack createIcon()
{
return new ItemStack(Items.LAVA_BUCKET);
}
}
10 changes: 8 additions & 2 deletions src/main/java/com/buuz135/hotornot/config/HotConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ public class HotConfig
@Config.Comment("How hot an item should be to start burning the player (in Celsius)")
public static int HOT_ITEM = 480;

@Config.Comment("Max durability of the mitts")
public static int MITTS_DURABILITY = 20 * 60 * 10;
@Config.Comment("Max durability of the wooden tongs, 0 for infinite durability")
public static int WOODEN_TONGS_DURABILITY = 1200;

@Config.Comment("Max durability of the mitts, 0 for infinite durability")
public static int MITTS_DURABILITY = 12000;

@Config.Comment("Max durability of the tongs, 0 for infinite durability")
public static int IRON_TONGS_DURABILITY = 0;

@Config.Comment("Hot items that are included manually")
public static String[] HOT_ITEM_ADDITIONS = new String[] {"minecraft:blaze_rod"};
Expand Down
41 changes: 41 additions & 0 deletions src/main/java/com/buuz135/hotornot/item/IronTongsItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.buuz135.hotornot.item;

import java.util.List;
import javax.annotation.Nullable;

import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;

import com.buuz135.hotornot.HotOrNot;
import com.buuz135.hotornot.config.HotConfig;

public class IronTongsItem extends Item
{
public IronTongsItem()
{
setRegistryName(HotOrNot.MOD_ID, "iron_tongs");
setTranslationKey(HotOrNot.MOD_ID + ".iron_tongs");
setMaxStackSize(1);
if (HotConfig.IRON_TONGS_DURABILITY != 0)
{
setMaxDamage(HotConfig.IRON_TONGS_DURABILITY);
}
setCreativeTab(HotOrNot.HOTORNOT_TAB);
}

@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
{
super.addInformation(stack, worldIn, tooltip, flagIn);
tooltip.add(new TextComponentTranslation("item.hotornot.iron_tongs.tooltip").getUnformattedComponentText());
}

@Override
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged)
{
return false;
}
}
8 changes: 6 additions & 2 deletions src/main/java/com/buuz135/hotornot/item/MittsItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ public class MittsItem extends Item
public MittsItem()
{
setRegistryName(HotOrNot.MOD_ID, "mitts");
setMaxStackSize(1);
setMaxDamage(HotConfig.MITTS_DURABILITY);
setTranslationKey(HotOrNot.MOD_ID + ".mitts");
setMaxStackSize(1);
if (HotConfig.MITTS_DURABILITY != 0)
{
setMaxDamage(HotConfig.MITTS_DURABILITY);
}
setCreativeTab(HotOrNot.HOTORNOT_TAB);
}

@Override
Expand Down
41 changes: 41 additions & 0 deletions src/main/java/com/buuz135/hotornot/item/WoodenTongsItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.buuz135.hotornot.item;

import java.util.List;
import javax.annotation.Nullable;

import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;

import com.buuz135.hotornot.HotOrNot;
import com.buuz135.hotornot.config.HotConfig;

public class WoodenTongsItem extends Item
{
public WoodenTongsItem()
{
setRegistryName(HotOrNot.MOD_ID, "wooden_tongs");
setTranslationKey(HotOrNot.MOD_ID + ".wooden_tongs");
setMaxStackSize(1);
if (HotConfig.WOODEN_TONGS_DURABILITY != 0)
{
setMaxDamage(HotConfig.WOODEN_TONGS_DURABILITY);
}
setCreativeTab(HotOrNot.HOTORNOT_TAB);
}

@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
{
super.addInformation(stack, worldIn, tooltip, flagIn);
tooltip.add(new TextComponentTranslation("item.hotornot.wooden_tongs.tooltip").getUnformattedComponentText());
}

@Override
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged)
{
return false;
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/buuz135/hotornot/proxy/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public void postInit(FMLPostInitializationEvent event)
@Override
public void modelRegistryEvent(ModelRegistryEvent event)
{
ModelLoader.setCustomModelResourceLocation(WOODEN_TONGS, 0, new ModelResourceLocation(WOODEN_TONGS.getRegistryName(), "inventory"));
ModelLoader.setCustomModelResourceLocation(MITTS, 0, new ModelResourceLocation(MITTS.getRegistryName(), "inventory"));
ModelLoader.setCustomModelResourceLocation(IRON_TONGS, 0, new ModelResourceLocation(IRON_TONGS.getRegistryName(), "inventory"));
}
}
Loading

0 comments on commit dce6429

Please sign in to comment.