use of net.minecraft.client.entity.EntityPlayerSP in project Solar by Martacus.
the class GuiCategory method initGui.
@Override
public void initGui() {
super.initGui();
int xOffset = 20;
int yOffset = 25;
int x = (this.width - WIDTH) / 2;
int y = (this.height - HEIGHT) / 2;
EntityPlayerSP player = this.mc.player;
PlayerData.PlayerSave save = PlayerData.getDataFromPlayer(player);
int buttonAmount = 0;
for (GuiPage guiPage : this.pages) {
if (save.acquiredPages.contains(guiPage.getPageID())) {
BookButton button = new BookButton(guiPage, x + xOffset, y + yOffset + (buttonAmount * 10), buttonAmount);
this.addButton(button);
buttonAmount++;
}
}
}
use of net.minecraft.client.entity.EntityPlayerSP in project Wizardry by TeamWizardry.
the class PotionNullMovement method onTick.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onTick(TickEvent.ClientTickEvent event) {
Minecraft mc = Minecraft.getMinecraft();
EntityPlayerSP player = mc.player;
if (player == null)
return;
if (player.isPotionActive(ModPotions.NULL_MOVEMENT)) {
if (!(player.movementInput instanceof NullMovementInput))
player.movementInput = new NullMovementInput(player.movementInput);
} else if (!(player.movementInput instanceof MovementInputFromOptions))
player.movementInput = new MovementInputFromOptions(mc.gameSettings);
}
use of net.minecraft.client.entity.EntityPlayerSP in project artisan-worktables by codetaylor.
the class PluginGameStages method processStagedRecipes.
@SideOnly(Side.CLIENT)
private void processStagedRecipes() {
if (!FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
if (PluginJEI.RECIPE_REGISTRY == null) {
return;
}
EntityPlayerSP player = Minecraft.getMinecraft().player;
Collection<String> unlockedStages = GameStagesHelper.getUnlockedStages(player);
GameStagesRequirementContext context = (GameStagesRequirementContext) ArtisanAPI.getRequirementContext(new ResourceLocation(ModArtisanWorktables.MOD_ID, "gamestages"));
context.setUnlockedStages(unlockedStages);
for (String name : ArtisanAPI.getWorktableNames()) {
RecipeRegistry registry = ArtisanAPI.getWorktableRecipeRegistry(name);
if (registry != null) {
for (EnumTier tier : EnumTier.values()) {
List<IArtisanRecipe> recipeList = registry.getRecipeListByTier(new ArrayList<>(), tier);
String uid = PluginJEI.createUID(name, tier);
for (IArtisanRecipe recipe : recipeList) {
IRecipeWrapper recipeWrapper = PluginJEI.RECIPE_REGISTRY.getRecipeWrapper(recipe, uid);
if (recipeWrapper == null) {
continue;
}
IRequirement requirement = recipe.getRequirement(GameStagesRequirement.LOCATION);
// noinspection unchecked
if (requirement == null || requirement.match(context)) {
PluginJEI.RECIPE_REGISTRY.unhideRecipe(recipeWrapper);
} else {
PluginJEI.RECIPE_REGISTRY.hideRecipe(recipeWrapper);
}
}
}
}
}
}
use of net.minecraft.client.entity.EntityPlayerSP in project SpongeForge by SpongePowered.
the class SpongeModNetworkManager method unbindChannel.
@Override
public void unbindChannel(ChannelBinding channel) {
checkArgument(checkNotNull(channel, "channel") instanceof SpongeModChannelBinding, "Custom channel implementation not supported");
SpongeModChannelBinding boundChannel = this.channelMap.remove(channel.getName());
checkState(boundChannel != null, "Channel is already unbound");
boundChannel.invalidate();
// Remove channel from forge's registry
NetworkRegistry.INSTANCE.channelNamesFor(Side.SERVER).remove(channel.getName());
NetworkRegistry.INSTANCE.channelNamesFor(Side.CLIENT).remove(channel.getName());
if (SpongeImpl.getGame().isServerAvailable()) {
final PlayerList playerList = SpongeImpl.getServer().getPlayerList();
if (playerList != null) {
// Server side
playerList.sendPacketToAllPlayers(getUnregPacket(channel.getName()));
}
}
if (SpongeImpl.getGame().getPlatform().getExecutionType().isClient()) {
EntityPlayerSP clientPlayer = Minecraft.getMinecraft().player;
if (clientPlayer != null) {
// Client side
clientPlayer.connection.sendPacket(getUnregPacketClient(channel.getName()));
}
}
}
use of net.minecraft.client.entity.EntityPlayerSP in project Cavern2 by kegare.
the class IPlayerMessage method onMessage.
@Override
default REPLY onMessage(REQ message, MessageContext ctx) {
IThreadListener thread = FMLCommonHandler.instance().getWorldThread(ctx.netHandler);
EntityPlayerSP player = FMLClientHandler.instance().getClientPlayerEntity();
if (thread.isCallingFromMinecraftThread()) {
return message.process(player);
}
thread.addScheduledTask(() -> {
REPLY result = message.process(player);
if (result != null) {
CaveNetworkRegistry.sendToServer(result);
}
});
return null;
}
Aggregations