use of net.minecraft.client.entity.player.ClientPlayerEntity in project Overloaded by CJ-MC-Mods.
the class ItemRailGun method onMouseEvent.
@SubscribeEvent
public void onMouseEvent(InputEvent.MouseScrollEvent event) {
ClientPlayerEntity player = Minecraft.getInstance().player;
if (event.getScrollDelta() != 0 && player != null && player.isShiftKeyDown()) {
ItemStack stack = player.getMainHandItem();
if (player.isShiftKeyDown() && !stack.isEmpty() && stack.getItem() == this) {
int powerDelta = Long.signum(Math.round(event.getScrollDelta())) * OverloadedConfig.INSTANCE.railGun.stepEnergy;
if (InputMappings.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), ((ClientProxy) Overloaded.proxy).railGun100x.getKey().getValue())) {
powerDelta *= 100;
}
Overloaded.proxy.networkWrapper.sendToServer(new RailGunSettingsMessage(powerDelta));
event.setCanceled(true);
}
}
}
use of net.minecraft.client.entity.player.ClientPlayerEntity in project Overloaded by CJ-MC-Mods.
the class RenderMultiToolAssist method onMouseEvent.
@SubscribeEvent
public static void onMouseEvent(InputEvent.MouseScrollEvent event) {
ClientPlayerEntity player = Minecraft.getInstance().player;
if (event.getScrollDelta() != 0 && player != null && player.isShiftKeyDown()) {
ItemStack stack = player.getMainHandItem();
if (player.isShiftKeyDown() && !stack.isEmpty() && stack.getItem() == ModItems.multiTool) {
changeHelpMode((int) Math.round(event.getScrollDelta()));
player.displayClientMessage(new StringTextComponent("Assist Mode: " + getAssistMode().getName()), true);
event.setCanceled(true);
}
}
}
Aggregations