mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 05:45:03 +00:00
Fixed ghost custom item duplication
This commit is contained in:
1 parent
de909472b3
commit
e32802dcc1
2 files changed
-44
No files matched your search
@@ -1,28 +0,0 @@
|
||||
package noppes.npcs.entity;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.items.ItemScripted;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
|
||||
public class EntityItemScripted extends EntityItem {
|
||||
private final ScriptCustomItem customItem;
|
||||
|
||||
public EntityItemScripted(World p_i1709_1_, double p_i1709_2_, double p_i1709_4_, double p_i1709_6_, ItemStack p_i1710_8_) {
|
||||
super(p_i1709_1_, p_i1709_2_, p_i1709_4_, p_i1709_6_, p_i1710_8_);
|
||||
this.customItem = ItemScripted.GetWrapper(this.getEntityItem());
|
||||
float entitySize = (float)(Math.sqrt(Math.pow(customItem.scaleX,2) + Math.pow(customItem.scaleZ,2)));
|
||||
this.width = 0.4F * entitySize;
|
||||
this.height = 0.4F * customItem.scaleY;
|
||||
this.delayBeforeCanPickup = 40;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBePushed() {
|
||||
if (this.delayBeforeCanPickup > 0) {
|
||||
return false;
|
||||
}
|
||||
return super.canBePushed();
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.config.ConfigScript;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.entity.EntityItemScripted;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.ItemEvent;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
@@ -160,21 +159,6 @@ public class ItemScripted extends Item implements ItemRenderInterface {
|
||||
@Override
|
||||
public void renderSpecial() {}
|
||||
|
||||
public boolean hasCustomEntity(ItemStack stack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public EntityItemScripted createEntity(World world, Entity location, ItemStack itemstack)
|
||||
{
|
||||
EntityItemScripted entityScriptedItem = new EntityItemScripted(world,location.posX,location.posY,location.posZ, itemstack);
|
||||
entityScriptedItem.motionX = location.motionX;
|
||||
entityScriptedItem.motionY = location.motionY;
|
||||
entityScriptedItem.motionZ = location.motionZ;
|
||||
|
||||
return entityScriptedItem;
|
||||
}
|
||||
|
||||
public void renderOffset(ScriptCustomItem scriptCustomItem) {
|
||||
GL11.glTranslatef(0.135F * scriptCustomItem.scaleX, 0.2F * scriptCustomItem.scaleY, 0.07F * scriptCustomItem.scaleZ);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user