-
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.
移植高版本类似暴食魔符的功能 暴食指环 饥饿指环(大雾。。)
- Loading branch information
Showing
12 changed files
with
206 additions
and
3 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
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/xir/NHUtilities/common/nhutilies/events/GluttonyRingEvent.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.xir.NHUtilities.common.nhutilies.events; | ||
|
||
import java.util.Optional; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.EnumAction; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.event.entity.player.PlayerUseItemEvent; | ||
|
||
import com.brandon3055.draconicevolution.common.utills.InventoryUtils; | ||
import com.xir.NHUtilities.common.nhutilies.items.GluttonyRing; | ||
|
||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
|
||
public class GluttonyRingEvent { | ||
|
||
@SubscribeEvent | ||
public void onGluttonyRingEating(PlayerUseItemEvent.Start event) { | ||
EntityPlayer entityPlayer = event.entityPlayer; | ||
if (entityPlayer.getHeldItem() == null) return; | ||
Optional<ItemStack> baublesItem = InventoryUtils | ||
.getItemInPlayerBaublesInventory(entityPlayer, GluttonyRing.class); | ||
if (baublesItem.isPresent() && (event.item.getItemUseAction() == EnumAction.eat) | ||
&& entityPlayer.getFoodStats() | ||
.getFoodLevel() < 20) { | ||
event.duration = 2; | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/com/xir/NHUtilities/common/nhutilies/items/GluttonyRing.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,47 @@ | ||
package com.xir.NHUtilities.common.nhutilies.items; | ||
|
||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import baubles.api.BaubleType; | ||
import baubles.api.IBauble; | ||
|
||
public class GluttonyRing extends ItemBasic implements IBauble { | ||
|
||
public GluttonyRing() { | ||
setMaxStackSize(1); | ||
setUnlocalizedName("GluttonyRing"); | ||
setTextureName("GluttonyRing"); | ||
|
||
} | ||
|
||
@Override | ||
public BaubleType getBaubleType(ItemStack itemstack) { | ||
return BaubleType.RING; | ||
} | ||
|
||
@Override | ||
public void onWornTick(ItemStack itemstack, EntityLivingBase player) { | ||
|
||
} | ||
|
||
@Override | ||
public void onEquipped(ItemStack itemstack, EntityLivingBase player) { | ||
|
||
} | ||
|
||
@Override | ||
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) { | ||
|
||
} | ||
|
||
@Override | ||
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) { | ||
return true; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/com/xir/NHUtilities/common/nhutilies/items/HungerRing.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,52 @@ | ||
package com.xir.NHUtilities.common.nhutilies.items; | ||
|
||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.FoodStats; | ||
|
||
import baubles.api.BaubleType; | ||
import baubles.api.IBauble; | ||
|
||
public class HungerRing extends ItemBasic implements IBauble { | ||
|
||
public HungerRing() { | ||
setMaxStackSize(1); | ||
setUnlocalizedName("HungerRing"); | ||
setTextureName("HungerRing"); | ||
|
||
} | ||
|
||
@Override | ||
public BaubleType getBaubleType(ItemStack itemstack) { | ||
return BaubleType.RING; | ||
} | ||
|
||
@Override | ||
public void onWornTick(ItemStack itemstack, EntityLivingBase player) { | ||
FoodStats foodStats = ((EntityPlayer) player).getFoodStats(); | ||
if (foodStats.getFoodLevel() >= 1) { | ||
foodStats.setFoodLevel(0); | ||
} | ||
} | ||
|
||
@Override | ||
public void onEquipped(ItemStack itemstack, EntityLivingBase player) { | ||
|
||
} | ||
|
||
@Override | ||
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) { | ||
|
||
} | ||
|
||
@Override | ||
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) { | ||
return true; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/com/xir/NHUtilities/common/nhutilies/items/ItemBasic.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,48 @@ | ||
package com.xir.NHUtilities.common.nhutilies.items; | ||
|
||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import com.xir.NHUtilities.main.NHUtilities; | ||
|
||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
|
||
/** | ||
* The aim is to simplify some writing as well as others | ||
*/ | ||
public class ItemBasic extends Item { | ||
|
||
private static final String MODID = String.format("item.%s:", NHUtilities.MODID); | ||
private String unlocalizedName; | ||
|
||
@Override | ||
public Item setTextureName(String TextureName) { | ||
this.iconString = NHUtilities.MODID + ":" + TextureName; | ||
return this; | ||
} | ||
|
||
@Override | ||
@SideOnly(Side.CLIENT) | ||
protected String getIconString() { | ||
return this.iconString == null | ||
? "MISSING_ICON_ITEM_" + itemRegistry.getIDForObject(this) + "_" + this.unlocalizedName | ||
: this.iconString; | ||
} | ||
|
||
@Override | ||
public Item setUnlocalizedName(String unlocalizedName) { | ||
this.unlocalizedName = unlocalizedName; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String getUnlocalizedName() { | ||
return MODID + this.unlocalizedName; | ||
} | ||
|
||
@Override | ||
public String getUnlocalizedName(ItemStack stack) { | ||
return getUnlocalizedName(); | ||
} | ||
} |
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,14 @@ | ||
package com.xir.NHUtilities.loader; | ||
|
||
import com.xir.NHUtilities.common.nhutilies.items.GluttonyRing; | ||
import com.xir.NHUtilities.common.nhutilies.items.HungerRing; | ||
|
||
import cpw.mods.fml.common.registry.GameRegistry; | ||
|
||
public class ItemLoader { | ||
|
||
public static void registerNHUtilitiesItems() { | ||
GameRegistry.registerItem(new GluttonyRing(), "GluttonyRing"); | ||
GameRegistry.registerItem(new HungerRing(), "HungerRing"); | ||
} | ||
} |
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,3 +1,5 @@ | ||
key.toggleTeleporterMKII=Toggle Enhanced Charm of Dislocation GUI | ||
info.teleporterInfBaubles.txt=Support putting in-any-baubles | ||
info.teleporterInfBaublesButton.txt=Support the use of - button - to open the baubles | ||
item.NHUtilities:GluttonyRing.name=GluttonyRing | ||
item.NHUtilities:HungerRing.name=HungerRing |
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,3 +1,5 @@ | ||
key.toggleTeleporterMKII=开关高级传送器GUI | ||
info.teleporterInfBaubles.txt=支持放入-任意-饰品栏目 | ||
info.teleporterInfBaublesButton.txt=支持使用-按键-打开饰品 | ||
item.NHUtilities:GluttonyRing.name=暴食指环 | ||
item.NHUtilities:HungerRing.name=饥饿指环 |
Binary file added
BIN
+1.85 KB
src/main/resources/assets/NHUtilities/textures/items/GluttonyRing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.