Java 类net.minecraftforge.fml.common.network.internal.FMLNetworkHandler 实例源码
项目:Mods
文件:BlockUpgradeStation.java
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote)
if (state.getValue(HOLDER))
FMLNetworkHandler.openGui(playerIn, TF2weapons.instance, 2, worldIn, pos.getX(), pos.getY(),
pos.getZ());
else
for (int x = -1; x < 2; x++)
for (int y = -1; y < 2; y++)
for (int z = -1; z < 2; z++)
if (worldIn.getBlockState(pos.add(x, y, z)).getBlock() instanceof BlockUpgradeStation
&& worldIn.getBlockState(pos.add(x, y, z)).getValue(HOLDER)) {
FMLNetworkHandler.openGui(playerIn, TF2weapons.instance, 2, worldIn, pos.getX() + x,
pos.getY() + y, pos.getZ() + z);
return true;
}
return true;
}
项目:Mods
文件:EntityTF2Character.java
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
if (!(player.getHeldItemMainhand() != null
&& player.getHeldItemMainhand().getItem() instanceof ItemMonsterPlacerPlus)
&& (this.getOwner() == player || this.getAttackTarget() == null || this.friendly) && this.isEntityAlive() && !this.isTrading()
&& !this.isChild() && !player.isSneaking()) {
if (this.world.isRemote && player.getTeam() == null
&& ((this.getCapability(TF2weapons.WEAPONS_CAP, null).state & 1) == 0 || this.friendly)
&& !player.isCreative())
ClientProxy.displayScreenConfirm("Choose a team to interact",
"Visit the Mann Co. Store located in a village");
if (!this.world.isRemote && (TF2Util.isOnSameTeam(this, player) || player.isCreative())
&& (this.tradeOffers == null || !this.tradeOffers.isEmpty())) {
this.setCustomer(player);
FMLNetworkHandler.openGui(player, TF2weapons.instance, 4, world, this.getEntityId(), 0, 0);
}
player.addStat(StatList.TALKED_TO_VILLAGER);
return true;
} else
return super.processInteract(player, hand);
}
项目:Overlord
文件:EntityConvertedSkeleton.java
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
EntityLivingBase owner = this.getOwner();
if (owner != null) {
if (owner.equals(player)) {
if (!player.isSneaking()) {
FMLNetworkHandler.openGui(player, Overlord.instance, hashCode(), world, (int) this.posX, (int) this.posY, (int) this.posZ);
return true;
} else {
if (!world.isRemote) {
ItemStack stack = player.getHeldItem(hand);
if (!stack.isEmpty()) {
if (stack.getItem() == Overlord.converted_spawner) {
NBTTagCompound compound = new NBTTagCompound();
this.writeEntityToNBT(compound);
stack.setTagCompound(compound);
}
}
}
}
}
}
return super.processInteract(player, hand);
}
项目:Overlord
文件:EntityBabySkeleton.java
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
EntityLivingBase owner = this.getOwner();
if (owner != null) {
if (owner.equals(player)) {
if (!player.isSneaking()) {
FMLNetworkHandler.openGui(player, Overlord.instance, hashCode(), world, (int) this.posX, (int) this.posY, (int) this.posZ);
return true;
} else {
if (!world.isRemote) {
ItemStack itemStackUsing = player.getHeldItem(hand);
if (!itemStackUsing.isEmpty()) {
if (itemStackUsing.getItem() == Overlord.baby_spawner) {
NBTTagCompound compound = new NBTTagCompound();
this.writeEntityToNBT(compound);
itemStackUsing.setTagCompound(compound);
}
}
}
}
}
}
return super.processInteract(player, hand);
}
项目:Overlord
文件:EntitySkeletonWarrior.java
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
if (this.getOwner() != null) {
if (this.getOwner().equals(player)) {
if (!player.isSneaking()) {
FMLNetworkHandler.openGui(player, Overlord.instance, hashCode(), world, (int) this.posX, (int) this.posY, (int) this.posZ);
return true;
} else {
if (!world.isRemote) {
ItemStack stack = player.getHeldItem(hand);
if (!stack.isEmpty()) {
if (stack.getItem() == Overlord.warrior_spawner) {
NBTTagCompound compound = new NBTTagCompound();
this.writeEntityToNBT(compound);
stack.setTagCompound(compound);
}
}
}
}
}
}
return super.processInteract(player, hand);
}
项目:Overlord
文件:ItemOverlordsSeal.java
@SuppressWarnings("unchecked")
@Override
@Nonnull
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, @Nonnull EnumHand hand) {
ItemStack stack = playerIn.getHeldItem(hand);
if (stack.getTagCompound() == null)
stack.setTagCompound(new NBTTagCompound());
if (!stack.getTagCompound().hasKey("Owner")) {
stack.getTagCompound().setString("Owner", playerIn.getUniqueID().toString());
stack.getTagCompound().setString("OwnerName", playerIn.getDisplayNameString());
return new ActionResult(EnumActionResult.SUCCESS, stack);
} else if (canOpenGui) {
if (stack.getTagCompound().getString("Owner").equals(playerIn.getUniqueID().toString())) {
FMLNetworkHandler.openGui(playerIn, Overlord.instance, -1, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);
if (consumable)
stack.shrink(1);
return new ActionResult(EnumActionResult.SUCCESS, stack);
} else {
return new ActionResult(EnumActionResult.FAIL, stack);
}
} else {
return new ActionResult(EnumActionResult.PASS, stack);
}
}
项目:Count-Armours
文件:EntityTradeable.java
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
ItemStack itemstack = player.getHeldItem(hand);
boolean flag = itemstack.getItem() == Items.NAME_TAG;
if (flag) {
return itemstack.interactWithEntity(player, this, hand);
} else if (this.isEntityAlive() && !this.isTrading()) {
if (this.buyingList == null) {
this.populateBuyingList();
}
if (!this.buyingList.isEmpty()) {
FMLNetworkHandler.openGui(player, AOTA.instance, hashCode(), world, (int) posX, (int) posY, (int) posZ);
if (!this.world.isRemote)
this.setCustomer(player);
return true;
} else {
AOTA.logWarn("Tradeable entity " + hashCode() + " has an empty buyingList.");
return super.processInteract(player, hand);
}
} else {
return super.processInteract(player, hand);
}
}
项目:Sugar-Cane-Uses
文件:BlockDehydrator.java
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if(worldIn.isRemote)
return true;
else if(!playerIn.isSneaking()){
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityDehydrator)
{
FMLNetworkHandler.openGui(playerIn, PSC.MODID, 0, worldIn, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}else
return false;
}
项目:Alloycraft
文件:ForgeTeslaBlock.java
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof ForgeTeslaTileEntity)
{
FMLNetworkHandler.openGui(playerIn, AlloycraftMain.instance, AlloycraftMain.guiIDForgeTesla, worldIn, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}
}
项目:Alloycraft
文件:ForgeBlock.java
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof ForgeTileEntity)
{
FMLNetworkHandler.openGui(playerIn, AlloycraftMain.instance, AlloycraftMain.guiIDForge, worldIn, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}
}
项目:Talismans2
文件:BlockTalismanCrafter.java
@Override
public boolean onBlockActivated(World world, BlockPos pos,
IBlockState state, EntityPlayer entity, EnumFacing side,
float x, float y, float z)
{
int X = (int) x;
int Y = (int) y;
int Z = (int) z;
if (!world.isRemote)
{
FMLNetworkHandler.openGui(entity, Talismans2.instance, 0, world, X,Y, Z);
System.out.print("OPEN GUI MAYBE");
}
return true;
}
项目:Project-Zed
文件:BlockNuclearController.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand,
ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
TileEntityNuclearController te = (TileEntityNuclearController) world.getTileEntity(blockPos);
if (te != null) {
if (stack == null || !(stack.getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityNuclearController.class),
world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockNuclearIOPort.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand,
ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
TileEntityNuclearIOPort te = (TileEntityNuclearIOPort) world.getTileEntity(blockPos);
if (te != null) {
if (player.getActiveItemStack() == null || !(player.getActiveItemStack().getItem() instanceof ItemWrench)) FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityNuclearIOPort.class),
world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockIndustrialQuarry.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand,
ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
TileEntityIndustrialQuarry te = (TileEntityIndustrialQuarry) world.getTileEntity(blockPos);
if (te != null) {
if (stack == null || !(stack.getItem() instanceof ItemWrench)) {
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialQuarry.class), world,
blockPos.getX(), blockPos.getY(), blockPos.getZ());
player.addChatComponentMessage(ChatUtils.createComponent(false, "is done: " + te.isDone()));
}
else return false;
}
return true;
}
// player.addChatComponentMessage(ChatUtils.createComponent(false, "is done: " + te.isDone()));
}
项目:Project-Zed
文件:BlockEnergyCell.java
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState block, EntityPlayer player, EnumHand hand, ItemStack stack,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
TileEntityEnergyBankBase te = (TileEntityEnergyBankBase) world.getTileEntity(pos);
if (te != null) {
if (stack == null || !(stack.getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityEnergyBankBase.class),
world, pos.getX(), pos.getY(), pos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockRFBridge.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack stack,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
TileEntityRFBridge te = (TileEntityRFBridge) world.getTileEntity(blockPos);
if (te != null) {
if (player.getActiveItemStack() == null || !(player.getActiveItemStack().getItem() instanceof ItemWrench))
FMLNetworkHandler.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityRFBridge.class), world,
blockPos.getX(), blockPos.getY(), blockPos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockIndustrialEnergizer.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack stack,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
AbstractTileEntityMachine te = (AbstractTileEntityMachine) world.getTileEntity(blockPos);
if (te != null) {
if (stack == null || !(stack.getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialEnergizer.class),
world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockIndustrialFurnace.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack stack,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
AbstractTileEntityMachine te = (AbstractTileEntityMachine) world.getTileEntity(blockPos);
if (te != null) {
if (stack == null || !(stack.getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialFurnace.class),
world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockIndustrialPlanter.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand,
ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
AbstractTileEntityMachine te = (AbstractTileEntityMachine) world.getTileEntity(blockPos);
if (te != null) {
if (stack == null || !(stack.getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialPlanter.class),
world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockIndustrialStorageUnit.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand,
ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
TileEntityIndustrialStorageUnit te = (TileEntityIndustrialStorageUnit) world.getTileEntity(blockPos);
if (te != null) {
if (player.getActiveItemStack() == null || !(player.getActiveItemStack().getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialStorageUnit.class),
world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockIndustrialCrusher.java
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState block, EntityPlayer player, EnumHand hand, ItemStack stack,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
AbstractTileEntityMachine te = (AbstractTileEntityMachine) world.getTileEntity(pos);
if (te != null) {
if (stack == null || !(stack.getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialCrusher.class),
world, pos.getX(), pos.getY(), pos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockIndustrialLoader.java
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack stack,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
TileEntityIndustrialLoader te = (TileEntityIndustrialLoader) world.getTileEntity(pos);
if (te != null) {
if (player.getActiveItemStack() == null || !(player.getActiveItemStack().getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialLoader.class),
world, pos.getX(), pos.getY(), pos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockPatternEncoder.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand,
ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
TileEntityPatternEncoder te = (TileEntityPatternEncoder) world.getTileEntity(blockPos);
if (te != null) {
if (player.getActiveItemStack() == null || !(player.getActiveItemStack().getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityPatternEncoder.class),
world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockIndustrialMetalPress.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack stack,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
AbstractTileEntityMachine te = (AbstractTileEntityMachine) world.getTileEntity(blockPos);
if (te != null) {
if (stack == null || !(stack.getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialMetalPress.class),
world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockIndustrialHarvester.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack stack,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
AbstractTileEntityMachine te = (AbstractTileEntityMachine) world.getTileEntity(blockPos);
if (te != null) {
if (stack == null || !(stack.getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialHarvester.class),
world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
else return false;
}
return true;
}
}
项目:Project-Zed
文件:BlockIndustrialLumberMill.java
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack stack,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
else {
AbstractTileEntityMachine te = (AbstractTileEntityMachine) world.getTileEntity(blockPos);
if (te != null) {
if (stack == null || !(stack.getItem() instanceof ItemWrench))
FMLNetworkHandler
.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialLumberMill.class),
world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
else return false;
}
return true;
}
}
项目:VillagerInventory
文件:VillagerInventoryMod.java
@SubscribeEvent
public static void onPlayerEntityInteract(PlayerInteractEvent.EntityInteract event)
{
// if the villager inventory gui is enabled, if the entity being interacted with is a villager, and if the player is sneaking...
if ((ModConfiguration.enableInventoryGui) && (event.getTarget() instanceof EntityVillager) && (EntityUtils.getFlag(event.getEntityPlayer(), 2)))
{
// if opening the gui requires the player to not be holding anything, check to ensure that the player isn't holding anything
if (!ModConfiguration.requireEmptyHand || (ModConfiguration.requireEmptyHand && event.getEntityPlayer().inventory.getCurrentItem().isEmpty()))
{
// if the event is running on the server
if (!event.getWorld().isRemote)
{
// cast the entity to type EntityVillager
EntityVillager villager = (EntityVillager)event.getTarget();
// get the entity id of the villager
int entityId = villager.getEntityId();
// and read it's profession and career from it's nbt data
NBTTagCompound compound = new NBTTagCompound();
villager.writeEntityToNBT(compound);
int professionId = compound.getInteger("Profession");
int careerId = compound.getInteger("Career");
// send a message to the client to tell it what the villager's career is
NETWORK.sendTo(new VillagerCareerMessage(entityId, careerId), (EntityPlayerMP)event.getEntityPlayer());
// open the inventory gui
FMLNetworkHandler.openGui(event.getEntityPlayer(), VillagerInventoryMod.INSTANCE, ModGuiHandler.GUI_VILLAGER_INVENTORY, event.getWorld(), entityId, professionId, careerId);
}
// cancel the event which would show the trading gui
event.setCanceled(true);
}
}
}
项目:Mods
文件:BlockRIGEnchant.java
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote)
FMLNetworkHandler.openGui(playerIn, RIG.instance, 0, worldIn, pos.getX(), pos.getY(), pos.getZ());
return true;
}
项目:Mods
文件:TF2ShowGuiHandler.java
@Override
public IMessage onMessage(final ShowGuiMessage message, MessageContext ctx) {
if (message.id != 99)
FMLNetworkHandler.openGui(ctx.getServerHandler().player, TF2weapons.instance, message.id,
ctx.getServerHandler().player.world, 0, 0, 0);
else {
}
return null;
}
项目:Mods
文件:BlockAmmoFurnace.java
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote)
FMLNetworkHandler.openGui(playerIn, TF2weapons.instance, 3, worldIn, pos.getX(), pos.getY(), pos.getZ());
return true;
}
项目:Mods
文件:BlockCabinet.java
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
EnumHand hand, @Nullable EnumFacing side, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote)
FMLNetworkHandler.openGui(playerIn, TF2weapons.instance, 1, worldIn, pos.getX(), pos.getY(), pos.getZ());
return true;
}
项目:Overlord
文件:BlockSkeletonMaker.java
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
if (worldIn.isRemote)
return true;
else if (!playerIn.isSneaking()) {
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntitySkeletonMaker || tileentity instanceof TileEntityBabySkeletonMaker) {
FMLNetworkHandler.openGui(playerIn, Overlord.MODID, 0, worldIn, pos.getX(), pos.getY(), pos.getZ());
}
return true;
} else
return false;
}
项目:Overlord
文件:ItemSquadEditor.java
@SuppressWarnings("unchecked")
@Override
@Nonnull
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, @Nonnull EnumHand hand) {
FMLNetworkHandler.openGui(playerIn, Overlord.instance, -2, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);
return new ActionResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(hand));
}
项目:LootableBodies
文件:EntityLootableBody.java
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand, ItemStack item){
if(player.getPosition().distanceSq(this.getPosition()) < 25) {
FMLNetworkHandler.openGui(player, LootableBodies.getInstance(), 0, getEntityWorld(), this.getEntityId(), 0, 0);
return true;
}
return false;
}
项目:TombCraft
文件:Tomb_Riser.java
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
if(!worldIn.isRemote)
{
FMLNetworkHandler.openGui(playerIn, TombCraft.instance, GuiId.TOMB_RISER.ordinal(), worldIn, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}
项目:TombCraft
文件:Relic_Lab.java
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
if(!worldIn.isRemote)
{
FMLNetworkHandler.openGui(playerIn, TombCraft.instance, GuiId.RELIC_LAB.ordinal(), worldIn, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}
项目:MoarCarts
文件:EntityMinecartBase.java
@Override
public boolean interactFirst(EntityPlayer player)
{
if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, player)))
{
return true;
}
if (!this.worldObj.isRemote && !player.isSneaking())
{
FMLNetworkHandler.openGui(player, MoarCarts.instance, 2, player.worldObj, this.getEntityId(), 0, 0);
}
return true;
}
项目:Wars-Mod
文件:PacketOpenTeamSelect.java
@Override
public IMessage handleClientMessage(EntityPlayer player, PacketOpenTeamSelect message, MessageContext ctx) {
System.out.println(String.format("Received %s from %s", "command to open team selection gui", player.getDisplayName().getUnformattedText()));
FMLNetworkHandler.openGui(player, WarsMod.instance, 3, player.worldObj, 0, 0, 0);
return null;
}
项目:Wars-Mod
文件:BlockSelectorGames.java
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack held, EnumFacing side, float par7, float par8, float par9) {
if (player.isSneaking())
return false;
FMLNetworkHandler.openGui(player, WarsMod.instance, 7, world, pos.getX(), pos.getY(), pos.getZ());
return true;
}
项目:Wars-Mod
文件:BlockSelectorSpleef.java
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack held, EnumFacing side, float par7, float par8, float par9) {
if (player.isSneaking())
return false;
FMLNetworkHandler.openGui(player, WarsMod.instance, 5, world, pos.getX(), pos.getY(), pos.getZ());
return true;
}