Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fire pit works (just) Lots of tweaks and fixes here and there: biome …
…registry no longer gives type warnings; opening a gui now should make use of an enum; trees now have heat + burn time values. Added stick heat capability for stick -> torch recipe. Also added Firepit recipe manager (for future recipe madness) Signed-off-by: alcatrazEscapee <alex@molleroneill.com>
- Loading branch information
1 parent
aa960bd
commit 162b02d
Showing
28 changed files
with
630 additions
and
92 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
96 changes: 96 additions & 0 deletions
96
src/main/java/net/dries007/tfc/api/capability/ItemStickCapability.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,96 @@ | ||
/* | ||
* Work under Copyright. Licensed under the EUPL. | ||
* See the project README.md and LICENSE.txt for more information. | ||
* | ||
*/ | ||
|
||
package net.dries007.tfc.api.capability; | ||
|
||
import java.util.List; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
import net.minecraft.client.resources.I18n; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.common.capabilities.Capability; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
import net.minecraftforge.fml.relauncher.SideOnly; | ||
|
||
import net.dries007.tfc.api.capability.heat.CapabilityItemHeat; | ||
import net.dries007.tfc.api.capability.heat.ItemHeatHandler; | ||
import net.dries007.tfc.api.capability.size.CapabilityItemSize; | ||
import net.dries007.tfc.api.capability.size.IItemSize; | ||
import net.dries007.tfc.api.capability.size.Size; | ||
import net.dries007.tfc.api.capability.size.Weight; | ||
|
||
import static net.dries007.tfc.api.util.TFCConstants.MOD_ID; | ||
|
||
public class ItemStickCapability extends ItemHeatHandler implements IItemSize | ||
{ | ||
public static final ResourceLocation KEY = new ResourceLocation(MOD_ID, "stick"); | ||
private static final float MELTING_POINT = 80f; | ||
private static final float HEAT_CAPACITY = 1f; | ||
|
||
public ItemStickCapability(@Nullable NBTTagCompound nbt) | ||
{ | ||
//todo: check values | ||
super(nbt, HEAT_CAPACITY, MELTING_POINT); | ||
if (nbt != null) | ||
deserializeNBT(nbt); | ||
} | ||
|
||
@Override | ||
public Size getSize(@Nonnull ItemStack stack) | ||
{ | ||
return Size.SMALL; | ||
} | ||
|
||
@Override | ||
public Weight getWeight(@Nonnull ItemStack stack) | ||
{ | ||
return Weight.LIGHT; | ||
} | ||
|
||
@Override | ||
public float getHeatCapacity() | ||
{ | ||
return HEAT_CAPACITY; | ||
} | ||
|
||
@Override | ||
public float getMeltingPoint() | ||
{ | ||
return MELTING_POINT; | ||
} | ||
|
||
@Override | ||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) | ||
{ | ||
return capability == CapabilityItemHeat.ITEM_HEAT_CAPABILITY || capability == CapabilityItemSize.ITEM_SIZE_CAPABILITY; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
@SuppressWarnings("unchecked") | ||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) | ||
{ | ||
return hasCapability(capability, facing) ? (T) this : null; | ||
} | ||
|
||
@SideOnly(Side.CLIENT) | ||
@Override | ||
public void addHeatInfo(ItemStack stack, List<String> text, boolean clearStackNBT) | ||
{ | ||
float temperature = getTemperature(); | ||
if (temperature > MELTING_POINT * 0.9f) | ||
text.add(I18n.format("tfc.enum.heat.torch.lit")); | ||
else if (temperature > 1f) | ||
text.add(I18n.format("tfc.enum.heat.torch.catchingFire")); | ||
|
||
if (clearStackNBT && temperature <= 0 && stack.hasTagCompound()) | ||
stack.setTagCompound(null); | ||
} | ||
} |
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
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
Oops, something went wrong.