mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 01:45:07 +00:00
IWorld:
-Fixed isPlaceCancelled and isBreakCancelled functions
This commit is contained in:
1 parent
22a4082890
commit
19e14983aa
3 files changed
+16
-15
No files matched your search
@@ -57,6 +57,7 @@ import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.data.DataTimers;
|
||||
import noppes.npcs.roles.*;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.entity.ScriptNpc;
|
||||
import noppes.npcs.scripted.event.NpcEvent;
|
||||
import noppes.npcs.util.GameProfileAlt;
|
||||
@@ -69,7 +70,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
|
||||
public static final GameProfileAlt chateventProfile = new GameProfileAlt();
|
||||
public static FakePlayer chateventPlayer;
|
||||
public static FakePlayer CommandPlayer;
|
||||
public DataDisplay display;
|
||||
public DataStats stats;
|
||||
public DataAI ai;
|
||||
@@ -901,6 +901,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
EntityUtil.Copy(this, chateventPlayer);
|
||||
chateventProfile.npc = this;
|
||||
chateventPlayer.refreshDisplayName();
|
||||
IItemStack stack = NpcAPI.Instance().createItem("minecraft:stone",0,1);
|
||||
chateventPlayer.setCurrentItemOrArmor(0, stack.getMCItemStack());
|
||||
return chateventPlayer;
|
||||
}
|
||||
|
||||
@@ -1578,17 +1580,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
display.readToNBT(compound);
|
||||
}
|
||||
|
||||
public Entity func_174793_f() {
|
||||
if (this.worldObj.isRemote) {
|
||||
return this;
|
||||
} else {
|
||||
EntityUtil.Copy(this, CommandPlayer);
|
||||
CommandPlayer.setWorld(this.worldObj);
|
||||
CommandPlayer.setPosition(this.posX, this.posY, this.posZ);
|
||||
return CommandPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName() {
|
||||
return display.name;
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.BlockSnapshot;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
@@ -30,6 +31,7 @@ import noppes.npcs.api.handler.data.ISound;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.api.scoreboard.IScoreboard;
|
||||
import noppes.npcs.blocks.tiles.TileBigSign;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -476,9 +478,13 @@ public class ScriptWorld implements IWorld {
|
||||
Block mcBlock = block.getMCBlock();
|
||||
int metadata = this.getBlockMetadata(posX,posY,posZ);
|
||||
|
||||
FakePlayer fakePlayer = new FakePlayer(this.world, EntityNPCInterface.chateventProfile);
|
||||
IItemStack stack = NpcAPI.Instance().createItem("minecraft:stone",0,1);
|
||||
fakePlayer.setCurrentItemOrArmor(0, stack.getMCItemStack());
|
||||
|
||||
final BlockEvent.PlaceEvent placeEvent = new BlockEvent.PlaceEvent(
|
||||
new BlockSnapshot(this.world, (int)Math.floor(posX), (int)Math.floor(posY), (int)Math.floor(posZ), mcBlock, metadata),
|
||||
Blocks.air, EntityNPCInterface.CommandPlayer);
|
||||
Blocks.air, fakePlayer);
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(placeEvent);
|
||||
|
||||
@@ -498,8 +504,12 @@ public class ScriptWorld implements IWorld {
|
||||
Block mcBlock = block.getMCBlock();
|
||||
int metadata = this.getBlockMetadata(posX,posY,posZ);
|
||||
|
||||
FakePlayer fakePlayer = new FakePlayer(this.world, EntityNPCInterface.chateventProfile);
|
||||
IItemStack stack = NpcAPI.Instance().createItem("minecraft:stone",0,1);
|
||||
fakePlayer.setCurrentItemOrArmor(0, stack.getMCItemStack());
|
||||
|
||||
final BlockEvent.BreakEvent placeEvent = new BlockEvent.BreakEvent(posX, posY, posZ, world,
|
||||
mcBlock, metadata, EntityNPCInterface.CommandPlayer);
|
||||
mcBlock, metadata, fakePlayer);
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(placeEvent);
|
||||
|
||||
|
||||
Reference in new issue
Block a user