2016-06-23 03:49:47 +00:00
|
|
|
/*
|
|
|
|
* Minecraft Forge
|
|
|
|
* Copyright (c) 2016.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation version 2.1
|
|
|
|
* of the License.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2012-10-28 10:58:23 +00:00
|
|
|
package net.minecraftforge.event;
|
|
|
|
|
2016-05-29 21:05:07 +00:00
|
|
|
import net.minecraft.network.NetHandlerPlayServer;
|
|
|
|
import net.minecraft.network.play.client.CPacketChatMessage;
|
|
|
|
import net.minecraftforge.common.ForgeHooks;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
|
|
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
2012-12-13 05:58:35 +00:00
|
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
2016-03-01 12:58:03 +00:00
|
|
|
import net.minecraft.util.text.ITextComponent;
|
2012-10-28 10:58:23 +00:00
|
|
|
|
2014-07-06 20:07:49 +00:00
|
|
|
/**
|
|
|
|
* ServerChatEvent is fired whenever a C01PacketChatMessage is processed. <br>
|
2016-05-29 21:05:07 +00:00
|
|
|
* This event is fired via {@link ForgeHooks#onServerChatEvent(NetHandlerPlayServer, String, ITextComponent)},
|
|
|
|
* which is executed by the {@link NetHandlerPlayServer#processChatMessage(CPacketChatMessage)}<br>
|
2014-07-06 20:07:49 +00:00
|
|
|
* <br>
|
|
|
|
* {@link #username} contains the username of the player sending the chat message.<br>
|
|
|
|
* {@link #message} contains the message being sent.<br>
|
|
|
|
* {@link #player} the instance of EntityPlayerMP for the player sending the chat message.<br>
|
|
|
|
* {@link #component} contains the instance of ChatComponentTranslation for the sent message.<br>
|
|
|
|
* <br>
|
|
|
|
* This event is {@link Cancelable}. <br>
|
|
|
|
* If this event is canceled, the chat message is never distributed to all clients.<br>
|
|
|
|
* <br>
|
|
|
|
* This event does not have a result. {@link HasResult}<br>
|
|
|
|
* <br>
|
|
|
|
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
|
|
|
**/
|
2012-10-28 10:58:23 +00:00
|
|
|
@Cancelable
|
2013-02-15 11:22:59 +00:00
|
|
|
public class ServerChatEvent extends Event
|
|
|
|
{
|
2016-03-02 04:42:36 +00:00
|
|
|
private final String message, username;
|
|
|
|
private final EntityPlayerMP player;
|
|
|
|
private ITextComponent component;
|
|
|
|
public ServerChatEvent(EntityPlayerMP player, String message, ITextComponent component)
|
2012-10-28 10:58:23 +00:00
|
|
|
{
|
|
|
|
super();
|
|
|
|
this.message = message;
|
|
|
|
this.player = player;
|
2014-02-05 08:05:37 +00:00
|
|
|
this.username = player.getGameProfile().getName();
|
2013-06-30 12:50:11 +00:00
|
|
|
this.component = component;
|
2012-10-28 10:58:23 +00:00
|
|
|
}
|
2015-05-25 19:02:47 +00:00
|
|
|
|
2016-03-01 12:58:03 +00:00
|
|
|
public void setComponent(ITextComponent e)
|
2015-05-25 19:02:47 +00:00
|
|
|
{
|
2016-03-02 04:42:36 +00:00
|
|
|
this.component = e;
|
2015-05-25 19:02:47 +00:00
|
|
|
}
|
|
|
|
|
2016-03-01 12:58:03 +00:00
|
|
|
public ITextComponent getComponent()
|
2015-05-25 19:02:47 +00:00
|
|
|
{
|
|
|
|
return this.component;
|
|
|
|
}
|
2016-03-02 04:42:36 +00:00
|
|
|
|
|
|
|
public String getMessage() { return this.message; }
|
|
|
|
public String getUsername() { return this.username; }
|
|
|
|
public EntityPlayerMP getPlayer() { return this.player; }
|
2012-10-28 10:58:23 +00:00
|
|
|
}
|