forked from Buuz135/HotOrNot
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp item registry, change wooden tongs recipe
- Loading branch information
Showing
16 changed files
with
408 additions
and
519 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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
modGroup=com.buuz135 | ||
minecraftVersion=1.12.2 | ||
modVersion=1.1.6 | ||
modVersion=1.1.7 | ||
modBaseName=HotOrNotPlus | ||
forgeVersion=1.12.2-14.23.5.2847 | ||
mcpVersion=stable_39 |
Large diffs are not rendered by default.
Oops, something went wrong.
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,99 @@ | ||
package com.buuz135.hotornot.client; | ||
|
||
import java.util.function.Consumer; | ||
import java.util.function.Predicate; | ||
|
||
import net.minecraft.entity.player.EntityPlayerMP; | ||
import net.minecraft.init.MobEffects; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.potion.PotionEffect; | ||
import net.minecraft.util.text.TextComponentTranslation; | ||
import net.minecraft.util.text.TextFormatting; | ||
import net.minecraftforge.event.entity.player.ItemTooltipEvent; | ||
import net.minecraftforge.fluids.FluidStack; | ||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; | ||
import net.minecraftforge.fluids.capability.IFluidHandlerItem; | ||
import net.minecraftforge.fml.common.Loader; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
|
||
import com.buuz135.hotornot.config.HotConfig; | ||
import com.buuz135.hotornot.config.HotLists; | ||
import net.dries007.tfc.api.capability.heat.CapabilityItemHeat; | ||
import net.dries007.tfc.api.capability.heat.IItemHeat; | ||
|
||
@Mod.EventBusSubscriber(value = Side.CLIENT) | ||
public class HotTooltip | ||
{ | ||
@SubscribeEvent | ||
public static void onTooltip(ItemTooltipEvent event) | ||
{ | ||
ItemStack stack = event.getItemStack(); | ||
if (HotConfig.TOOLTIP && !stack.isEmpty() && !HotLists.isRemoved(stack)) | ||
{ | ||
if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) | ||
{ | ||
IFluidHandlerItem fluidHandlerItem = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); | ||
FluidStack fluidStack = fluidHandlerItem.drain(1000, false); | ||
if (fluidStack != null) | ||
{ | ||
for (FluidEffect effect : FluidEffect.values()) | ||
{ | ||
if (effect.isValid.test(fluidStack)) | ||
{ | ||
event.getToolTip().add(effect.color + new TextComponentTranslation(effect.tooltip).getUnformattedText()); | ||
} | ||
} | ||
} | ||
} | ||
else if (HotLists.isHot(stack)) | ||
{ | ||
event.getToolTip().add(FluidEffect.HOT.color + new TextComponentTranslation(FluidEffect.HOT.tooltip).getUnformattedText()); | ||
} | ||
else if (HotLists.isCold(stack)) | ||
{ | ||
event.getToolTip().add(FluidEffect.COLD.color + new TextComponentTranslation(FluidEffect.COLD.tooltip).getUnformattedText()); | ||
} | ||
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()); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
public enum FluidEffect | ||
{ | ||
HOT(fluidStack -> fluidStack.getFluid().getTemperature(fluidStack) >= HotConfig.HOT_FLUID + 273 && HotConfig.HOT_FLUIDS, entityPlayerMP -> entityPlayerMP.setFire(1), TextFormatting.RED, "tooltip.hotornot.toohot"), | ||
COLD(fluidStack -> fluidStack.getFluid().getTemperature(fluidStack) <= HotConfig.COLD_FLUID + 273 && HotConfig.COLD_FLUIDS, entityPlayerMP -> | ||
{ | ||
entityPlayerMP.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 21, 1)); | ||
entityPlayerMP.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 21, 1)); | ||
}, TextFormatting.AQUA, "tooltip.hotornot.toocold"), | ||
GAS(fluidStack -> fluidStack.getFluid().isGaseous(fluidStack) && HotConfig.GASEOUS_FLUIDS, entityPlayerMP -> entityPlayerMP.addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 21, 1)), TextFormatting.YELLOW, "tooltip.hotornot.toolight"); | ||
|
||
public final Predicate<FluidStack> isValid; | ||
public final Consumer<EntityPlayerMP> interactPlayer; | ||
public final TextFormatting color; | ||
public final String tooltip; | ||
|
||
FluidEffect(Predicate<FluidStack> isValid, Consumer<EntityPlayerMP> interactPlayer, TextFormatting color, String tooltip) | ||
{ | ||
this.isValid = isValid; | ||
this.interactPlayer = interactPlayer; | ||
this.color = color; | ||
this.tooltip = tooltip; | ||
} | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
src/main/java/com/buuz135/hotornot/handler/ClientRegistryHandler.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,29 @@ | ||
package com.buuz135.hotornot.handler; | ||
|
||
import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||
import net.minecraft.item.Item; | ||
import net.minecraftforge.client.event.ModelRegistryEvent; | ||
import net.minecraftforge.client.model.ModelLoader; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
|
||
import com.buuz135.hotornot.HotOrNot; | ||
import com.buuz135.hotornot.item.ModItems; | ||
|
||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = HotOrNot.MOD_ID) | ||
public class ClientRegistryHandler | ||
{ | ||
@SubscribeEvent | ||
public static void registerModels(ModelRegistryEvent event) | ||
{ | ||
registerModel(ModItems.WOODEN_TONGS, 0); | ||
registerModel(ModItems.MITTS, 0); | ||
registerModel(ModItems.IRON_TONGS, 0); | ||
} | ||
|
||
private static void registerModel(Item item, int meta) | ||
{ | ||
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory")); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/buuz135/hotornot/handler/RegistryHandler.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,19 @@ | ||
package com.buuz135.hotornot.handler; | ||
|
||
import net.minecraft.item.Item; | ||
import net.minecraftforge.event.RegistryEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
|
||
import com.buuz135.hotornot.HotOrNot; | ||
import com.buuz135.hotornot.item.ModItems; | ||
|
||
@Mod.EventBusSubscriber(modid = HotOrNot.MOD_ID) | ||
public class RegistryHandler | ||
{ | ||
@SubscribeEvent | ||
public static void registerItems(RegistryEvent.Register<Item> event) | ||
{ | ||
event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); | ||
} | ||
} |
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
41 changes: 0 additions & 41 deletions
41
src/main/java/com/buuz135/hotornot/item/IronTongsItem.java
This file was deleted.
Oops, something went wrong.
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,17 @@ | ||
package com.buuz135.hotornot.item; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import net.minecraft.item.Item; | ||
|
||
import com.buuz135.hotornot.config.HotConfig; | ||
|
||
public class ModItems | ||
{ | ||
public static List<Item> ITEMS = new ArrayList<>(); | ||
|
||
public static Item WOODEN_TONGS = new HotItem("wooden_tongs", HotConfig.WOODEN_TONGS_DURABILITY); | ||
public static Item MITTS = new HotItem("mitts", HotConfig.MITTS_DURABILITY); | ||
public static Item IRON_TONGS = new HotItem("iron_tongs", HotConfig.IRON_TONGS_DURABILITY); | ||
} |
41 changes: 0 additions & 41 deletions
41
src/main/java/com/buuz135/hotornot/item/WoodenTongsItem.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.