mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 09:12:22 +00:00
Made item events use IItemCustomizable interface.
This commit is contained in:
1 parent
6d80acb5f0
commit
d394174108
4 files changed
+17
-55
No files matched your search
@@ -1,24 +1,13 @@
|
||||
package noppes.npcs.items;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.ItemEvent;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
import noppes.npcs.scripted.item.ScriptLinkedItem;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -104,26 +93,6 @@ public class ItemLinked extends ItemCustomizable {
|
||||
return true;
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction(ItemStack stack)
|
||||
{
|
||||
IItemStack istack = NpcAPI.Instance().getIItemStack(stack);
|
||||
if (istack instanceof ScriptLinkedItem) {
|
||||
switch (((ScriptLinkedItem) istack).getItemUseAction()) {
|
||||
case 0:
|
||||
return EnumAction.none;
|
||||
case 1:
|
||||
return EnumAction.block;
|
||||
case 2:
|
||||
return EnumAction.bow;
|
||||
case 3:
|
||||
return EnumAction.eat;
|
||||
case 4:
|
||||
return EnumAction.drink;
|
||||
}
|
||||
}
|
||||
return super.getItemUseAction(stack);
|
||||
}
|
||||
|
||||
public void renderOffset(ScriptLinkedItem scriptCustomItem) {
|
||||
GL11.glTranslatef(0.135F * scriptCustomItem.itemDisplay.scaleX, 0.2F * scriptCustomItem.itemDisplay.scaleY, 0.07F * scriptCustomItem.itemDisplay.scaleZ);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
package noppes.npcs.items;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
@@ -24,7 +17,6 @@ import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.ItemEvent;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
import noppes.npcs.scripted.item.ScriptCustomizableItem;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ItemScripted extends ItemCustomizable {
|
||||
|
||||
@@ -5,16 +5,17 @@ import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.event.IItemEvent;
|
||||
import noppes.npcs.api.item.IItemCustom;
|
||||
import noppes.npcs.api.item.IItemCustomizable;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
|
||||
public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public final IItemCustom item;
|
||||
public final IItemCustomizable item;
|
||||
|
||||
public ItemEvent(IItemCustom item) {
|
||||
public ItemEvent(IItemCustomizable item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
public IItemCustom getItem() {
|
||||
public IItemCustomizable getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -23,7 +24,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
}
|
||||
|
||||
public static class InitEvent extends ItemEvent implements IItemEvent.InitEvent {
|
||||
public InitEvent(IItemCustom item) {
|
||||
public InitEvent(IItemCustomizable item) {
|
||||
super(item);
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public static class UpdateEvent extends ItemEvent implements IItemEvent.UpdateEvent {
|
||||
public final IEntity entity;
|
||||
|
||||
public UpdateEvent(IItemCustom item, IEntity entity) {
|
||||
public UpdateEvent(IItemCustomizable item, IEntity entity) {
|
||||
super(item);
|
||||
this.entity = entity;
|
||||
}
|
||||
@@ -54,7 +55,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public final IEntity entity;
|
||||
public final IPlayer player;
|
||||
|
||||
public TossedEvent(IItemCustom item, IPlayer player, IEntity entity) {
|
||||
public TossedEvent(IItemCustomizable item, IPlayer player, IEntity entity) {
|
||||
super(item);
|
||||
this.entity = entity;
|
||||
this.player = player;
|
||||
@@ -76,7 +77,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public static class PickedUpEvent extends ItemEvent implements IItemEvent.PickedUpEvent {
|
||||
public final IPlayer player;
|
||||
|
||||
public PickedUpEvent(IItemCustom item, IPlayer player) {
|
||||
public PickedUpEvent(IItemCustomizable item, IPlayer player) {
|
||||
super(item);
|
||||
this.player = player;
|
||||
}
|
||||
@@ -94,7 +95,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public static class SpawnEvent extends ItemEvent implements IItemEvent.SpawnEvent {
|
||||
public final IEntity entity;
|
||||
|
||||
public SpawnEvent(IItemCustom item, IEntity entity){
|
||||
public SpawnEvent(IItemCustomizable item, IEntity entity){
|
||||
super(item);
|
||||
this.entity = entity;
|
||||
}
|
||||
@@ -114,7 +115,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public final IEntity target;
|
||||
public final IPlayer player;
|
||||
|
||||
public InteractEvent(IItemCustom item, IPlayer player, int type, IEntity target) {
|
||||
public InteractEvent(IItemCustomizable item, IPlayer player, int type, IEntity target) {
|
||||
super(item);
|
||||
this.type = type;
|
||||
this.target = target;
|
||||
@@ -148,7 +149,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public final Object target;
|
||||
public final IPlayer player;
|
||||
|
||||
public RightClickEvent(IItemCustom item, IPlayer player, int type, Object target) {
|
||||
public RightClickEvent(IItemCustomizable item, IPlayer player, int type, Object target) {
|
||||
super(item);
|
||||
this.type = type;
|
||||
this.target = target;
|
||||
@@ -178,7 +179,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public final IEntity target;
|
||||
public final IEntity swingingEntity;
|
||||
|
||||
public AttackEvent(IItemCustom item, IEntity swingingEntity, int type, IEntity target) {
|
||||
public AttackEvent(IItemCustomizable item, IEntity swingingEntity, int type, IEntity target) {
|
||||
super(item);
|
||||
this.type = type;
|
||||
this.target = target;
|
||||
@@ -207,7 +208,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public final IPlayer player;
|
||||
public final int duration;
|
||||
|
||||
public StartUsingItem(IItemCustom item, IPlayer player, int duration){
|
||||
public StartUsingItem(IItemCustomizable item, IPlayer player, int duration){
|
||||
super(item);
|
||||
this.player = player;
|
||||
this.duration = duration;
|
||||
@@ -231,7 +232,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public final IPlayer player;
|
||||
public final int duration;
|
||||
|
||||
public UsingItem(IItemCustom item, IPlayer player, int duration){
|
||||
public UsingItem(IItemCustomizable item, IPlayer player, int duration){
|
||||
super(item);
|
||||
this.player = player;
|
||||
this.duration = duration;
|
||||
@@ -255,7 +256,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public final IPlayer player;
|
||||
public final int duration;
|
||||
|
||||
public StopUsingItem(IItemCustom item, IPlayer player, int duration){
|
||||
public StopUsingItem(IItemCustomizable item, IPlayer player, int duration){
|
||||
super(item);
|
||||
this.player = player;
|
||||
this.duration = duration;
|
||||
@@ -279,7 +280,7 @@ public class ItemEvent extends CustomNPCsEvent implements IItemEvent {
|
||||
public final IPlayer player;
|
||||
public final int duration;
|
||||
|
||||
public FinishUsingItem(IItemCustom item, IPlayer player, int duration){
|
||||
public FinishUsingItem(IItemCustomizable item, IPlayer player, int duration){
|
||||
super(item);
|
||||
this.player = player;
|
||||
this.duration = duration;
|
||||
|
||||
Reference in new issue
Block a user