use of net.minecraft.client.entity.EntityClientPlayerMP in project Trains-In-Motion-1.7.10 by EternalBlueFlame.
the class EventManager method onClientKeyPress.
/**
* <h2>Keybind management</h2>
* called when a client presses a key. this coveres pretty much everything.
* Most cases just send a packet to manage things
* @see PacketKeyPress
*
* Credit to Ferdinand for help with this function.
*
* @param event the event of a key being pressed on client.
*/
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onClientKeyPress(InputEvent.KeyInputEvent event) {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (player.ridingEntity instanceof GenericRailTransport || player.ridingEntity instanceof EntitySeat) {
//for lamp
if (ClientProxy.KeyLamp.isPressed()) {
TrainsInMotion.keyChannel.sendToServer(new PacketKeyPress(0, player.ridingEntity.getEntityId()));
((GenericRailTransport) player.ridingEntity).setBoolean(GenericRailTransport.boolValues.LAMP, !((GenericRailTransport) player.ridingEntity).getBoolean(GenericRailTransport.boolValues.LAMP));
}
//for inventory
if (ClientProxy.KeyInventory.isPressed()) {
TrainsInMotion.keyChannel.sendToServer(new PacketKeyPress(1, player.ridingEntity.getEntityId()));
}
if (player.ridingEntity instanceof EntityTrainCore) {
//for speed change
if (ClientProxy.KeyAccelerate.isPressed()) {
TrainsInMotion.keyChannel.sendToServer(new PacketKeyPress(2, player.ridingEntity.getEntityId()));
} else if (ClientProxy.KeyReverse.getIsKeyPressed()) {
TrainsInMotion.keyChannel.sendToServer(new PacketKeyPress(3, player.ridingEntity.getEntityId()));
} else if (ClientProxy.KeyHorn.isPressed()) {
TrainsInMotion.keyChannel.sendToServer(new PacketKeyPress(4, player.ridingEntity.getEntityId()));
}
}
}
}
use of net.minecraft.client.entity.EntityClientPlayerMP in project TecTech by Technus.
the class ConstructableTriggerItem method onItemUseFirst.
@Override
public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity == null || aPlayer instanceof FakePlayer) {
return aPlayer instanceof EntityPlayerMP;
}
if (aPlayer instanceof EntityPlayerMP) {
// struct gen
if (aPlayer.isSneaking() && aPlayer.capabilities.isCreativeMode) {
if (tTileEntity instanceof IGregTechTileEntity) {
IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
if (metaTE instanceof IConstructable) {
((IConstructable) metaTE).construct(aStack.stackSize, false);
} else if (multiblockMap.containsKey(metaTE.getClass().getCanonicalName())) {
multiblockMap.get(metaTE.getClass().getCanonicalName()).construct(aStack.stackSize, false, tTileEntity, ((IGregTechTileEntity) tTileEntity).getFrontFacing());
}
} else if (tTileEntity instanceof IConstructable) {
((IConstructable) tTileEntity).construct(aStack.stackSize, false);
} else if (multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())) {
multiblockMap.get(tTileEntity.getClass().getCanonicalName()).construct(aStack.stackSize, false, tTileEntity, aSide);
}
}
return true;
} else if (aPlayer instanceof EntityClientPlayerMP) {
// if ((!aPlayer.isSneaking() || !aPlayer.capabilities.isCreativeMode)) {
if (tTileEntity instanceof IGregTechTileEntity) {
IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
if (metaTE instanceof IConstructable) {
((IConstructable) metaTE).construct(aStack.stackSize, true);
TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize));
return false;
} else if (multiblockMap.containsKey(metaTE.getClass().getCanonicalName())) {
multiblockMap.get(metaTE.getClass().getCanonicalName()).construct(aStack.stackSize, true, tTileEntity, ((IGregTechTileEntity) tTileEntity).getFrontFacing());
TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize));
return false;
}
} else if (tTileEntity instanceof IConstructable) {
((IConstructable) tTileEntity).construct(aStack.stackSize, true);
TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize));
return false;
} else if (multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())) {
multiblockMap.get(tTileEntity.getClass().getCanonicalName()).construct(aStack.stackSize, true, tTileEntity, aSide);
TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize));
return false;
}
// } else {
// if(tTileEntity instanceof IGregTechTileEntity) {
// IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
// if (metaTE instanceof IConstructable) {
// TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize));
// return false;
// } else if(multiblockMap.containsKey(metaTE.getClass().getCanonicalName())){
// TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize));
// return false;
// }
// } else if(tTileEntity instanceof IConstructable){
// TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize));
// return false;
// } else if(multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())){
// TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize));
// return false;
// }
// }
}
return false;
}
use of net.minecraft.client.entity.EntityClientPlayerMP in project Armourers-Workshop by RiskyKen.
the class MessageServerLibraryFileList method onMessage.
@Override
public IMessage onMessage(MessageServerLibraryFileList message, MessageContext ctx) {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
Container container = player.openContainer;
ModLogger.log("got file list type " + message.listType);
ArmourersWorkshop.proxy.libraryManager.setFileList(message.fileList, message.listType);
return null;
}
use of net.minecraft.client.entity.EntityClientPlayerMP in project Armourers-Workshop by RiskyKen.
the class MessageServerMiniArmourerSkinData method onMessage.
@Override
public IMessage onMessage(MessageServerMiniArmourerSkinData message, MessageContext ctx) {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
Minecraft mc = Minecraft.getMinecraft();
GuiScreen screen = mc.currentScreen;
if (screen != null && screen instanceof GuiMiniArmourerBuilding) {
((GuiMiniArmourerBuilding) screen).tileEntity.setSkinParts(message.skinParts);
}
return null;
}
use of net.minecraft.client.entity.EntityClientPlayerMP in project Armourers-Workshop by RiskyKen.
the class RenderSkinnedArrow method doRender.
@Override
public void doRender(EntityArrow entityArrow, double x, double y, double z, float yaw, float partialTickTime) {
if (entityArrow.shootingEntity != null && entityArrow.shootingEntity instanceof EntityClientPlayerMP) {
EntityClientPlayerMP player = (EntityClientPlayerMP) entityArrow.shootingEntity;
IEntityEquipment entityEquipment = equipmentModelRenderer.getPlayerCustomEquipmentData(player);
if (entityEquipment != null && entityEquipment.haveEquipment(SkinTypeRegistry.skinBow, 0)) {
ISkinPointer skinPointer = entityEquipment.getSkinPointer(SkinTypeRegistry.skinBow, 0);
if (ClientSkinCache.INSTANCE.isSkinInCache(skinPointer)) {
Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
if (skin != null) {
SkinPart skinPart = skin.getPart("armourers:bow.arrow");
if (skinPart != null) {
ModRenderHelper.enableAlphaBlend();
renderArrowSkin(entityArrow, x, y, z, partialTickTime, skinPart, skinPointer.getSkinDye());
ModRenderHelper.disableAlphaBlend();
return;
}
}
} else {
ClientSkinCache.INSTANCE.requestSkinFromServer(skinPointer);
}
}
}
super.doRender(entityArrow, x, y, z, yaw, partialTickTime);
}
Aggregations