-
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.
Merge pull request #26 from Keriils/fix-bug
fix & adjust & add kami ring test
- Loading branch information
Showing
21 changed files
with
266 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
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 @@ | ||
[] |
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,7 @@ | ||
[ | ||
{ | ||
"uuid": "00e4a3be-ed21-4be2-88a6-8e82729eaced", | ||
"name": "Xir_", | ||
"level": 5 | ||
} | ||
] |
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 @@ | ||
[] |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/xir/NHUtilities/common/api/IEntityInvulnerable.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,7 @@ | ||
package com.xir.NHUtilities.common.api; | ||
|
||
public interface IEntityInvulnerable { | ||
|
||
void setEntityInvulnerable(boolean invulnerable); | ||
|
||
} |
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
77 changes: 77 additions & 0 deletions
77
src/main/java/com/xir/NHUtilities/common/items/baubles/KamiRing.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,77 @@ | ||
package com.xir.NHUtilities.common.items.baubles; | ||
|
||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import com.xir.NHUtilities.common.api.IEntityInvulnerable; | ||
import com.xir.NHUtilities.common.items.aItemCore.ItemBasic; | ||
|
||
import baubles.api.BaubleType; | ||
import baubles.api.IBauble; | ||
import cpw.mods.fml.common.Optional; | ||
|
||
@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles") | ||
public class KamiRing extends ItemBasic implements IBauble { | ||
|
||
public KamiRing() { | ||
super("KamiRing"); | ||
setMaxStackSize(1); | ||
} | ||
|
||
@Override | ||
@Optional.Method(modid = "Baubles") | ||
public BaubleType getBaubleType(ItemStack itemstack) { | ||
return BaubleType.RING; | ||
} | ||
|
||
@Override | ||
@Optional.Method(modid = "Baubles") | ||
public void onWornTick(ItemStack itemstack, @NotNull EntityLivingBase player) { | ||
|
||
if (!player.isEntityInvulnerable() && (player instanceof IEntityInvulnerable entityInvulnerable)) { | ||
entityInvulnerable.setEntityInvulnerable(true); | ||
} | ||
|
||
if (player instanceof EntityPlayer entityPlayer) { | ||
if (entityPlayer.isDead) entityPlayer.isDead = false; | ||
if (entityPlayer.worldObj.getTotalWorldTime() % 10 == 0) { | ||
if (entityPlayer.getFoodStats() | ||
.getFoodLevel() != 20) { | ||
entityPlayer.getFoodStats() | ||
.addStats(20, 5.0F); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
@Optional.Method(modid = "Baubles") | ||
public void onEquipped(ItemStack itemstack, EntityLivingBase player) { | ||
|
||
} | ||
|
||
@Override | ||
@Optional.Method(modid = "Baubles") | ||
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) { | ||
|
||
if (player.isEntityInvulnerable() && (player instanceof IEntityInvulnerable entityInvulnerable)) { | ||
entityInvulnerable.setEntityInvulnerable(false); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
@Optional.Method(modid = "Baubles") | ||
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) { | ||
return true; | ||
} | ||
|
||
@Override | ||
@Optional.Method(modid = "Baubles") | ||
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) { | ||
return true; | ||
} | ||
} |
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.