file_name
stringlengths 6
86
| file_path
stringlengths 45
249
| content
stringlengths 47
6.26M
| file_size
int64 47
6.26M
| language
stringclasses 1
value | extension
stringclasses 1
value | repo_name
stringclasses 767
values | repo_stars
int64 8
14.4k
| repo_forks
int64 0
1.17k
| repo_open_issues
int64 0
788
| repo_created_at
stringclasses 767
values | repo_pushed_at
stringclasses 767
values |
---|---|---|---|---|---|---|---|---|---|---|---|
MultiroomManager.java | /FileExtraction/Java_unseen/mkulesh_onpc/app/src/main/java/com/mkulesh/onpc/fragments/MultiroomManager.java | /*
* Enhanced Music Controller
* Copyright (C) 2018-2023 by Mikhail Kulesh
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* This program 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 General Public License for more details. You should have received a copy of the GNU General
* Public License along with this program.
*/
package com.mkulesh.onpc.fragments;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import com.mkulesh.onpc.MainActivity;
import com.mkulesh.onpc.R;
import com.mkulesh.onpc.iscp.ConnectionIf;
import com.mkulesh.onpc.iscp.State;
import com.mkulesh.onpc.iscp.messages.BroadcastResponseMsg;
import com.mkulesh.onpc.iscp.messages.MultiroomDeviceInformationMsg;
import com.mkulesh.onpc.iscp.messages.MultiroomGroupSettingMsg;
import com.mkulesh.onpc.utils.Logging;
import com.mkulesh.onpc.utils.Utils;
import com.mkulesh.onpc.widgets.CheckableItemView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
class MultiroomManager
{
static AlertDialog createDeviceSelectionDialog(
@NonNull final MainActivity activity,
@NonNull CharSequence title)
{
final State state = activity.getStateManager().getState();
final FrameLayout frameView = new FrameLayout(activity);
activity.getLayoutInflater().inflate(R.layout.dialog_multiroom_layout, frameView);
// Collect available devices
final List<BroadcastResponseMsg> devices = new ArrayList<>();
for (BroadcastResponseMsg message : activity.getDeviceList().getDevices())
{
if (message.getProtoType() == ConnectionIf.ProtoType.DCP)
{
continue;
}
if (message.getIdentifier().equals(activity.myDeviceId()))
{
devices.add(0, message);
}
else
{
devices.add(message);
}
}
// Define this group ID
final int myZone = state.getActiveZone() + 1;
final int myGroupId = state.getMultiroomGroupId();
final Map<String, Boolean> attachedDevices = new HashMap<>();
// Create device list
final LinearLayout deviceGroup = frameView.findViewById(R.id.device_group);
Logging.info(activity, "Devices for group: " + myGroupId);
for (BroadcastResponseMsg msg : devices)
{
final CheckableItemView view = createDeviceItem(activity, msg,
state.multiroomLayout.get(msg.getIdentifier()),
myZone, myGroupId);
attachedDevices.put(msg.getIdentifier(), view.isChecked());
deviceGroup.addView(view);
}
// Define maximum group ID
int _maxGroupId = 0;
for (MultiroomDeviceInformationMsg di : state.multiroomLayout.values())
{
for (MultiroomDeviceInformationMsg.Zone z : di.getZones())
{
_maxGroupId = Math.max(_maxGroupId, z.getGroupid());
}
}
final int maxGroupId = _maxGroupId;
Logging.info(activity, " Maximum group ID=" + maxGroupId);
// Create dialog
final Drawable icon = Utils.getDrawable(activity, R.drawable.cmd_multiroom_group);
Utils.setDrawableColorAttr(activity, icon, android.R.attr.textColorSecondary);
return new AlertDialog.Builder(activity)
.setTitle(title)
.setIcon(icon)
.setCancelable(true)
.setView(frameView)
.setNegativeButton(R.string.action_cancel, (dialog1, which) -> dialog1.dismiss())
.setPositiveButton(R.string.action_ok, (dialog2, which) ->
{
int groupId = myGroupId;
if (myGroupId == MultiroomDeviceInformationMsg.NO_GROUP)
{
groupId = maxGroupId + 1;
}
sendGroupUpdates(activity, deviceGroup, attachedDevices, myZone, groupId);
dialog2.dismiss();
}).create();
}
private static CheckableItemView createDeviceItem(
@NonNull final MainActivity activity,
@NonNull final BroadcastResponseMsg msg,
@Nullable final MultiroomDeviceInformationMsg di,
final int zone,
final int myGroupId)
{
final ViewGroup dummyView = null;
//noinspection ConstantConditions
final CheckableItemView view = (CheckableItemView) activity.getLayoutInflater().inflate(
R.layout.checkable_item_view, dummyView, false);
final boolean myDevice = msg.getIdentifier().equals(activity.myDeviceId());
int tz = MultiroomGroupSettingMsg.TARGET_ZONE_ID;
if (myDevice)
{
view.setChecked(false);
view.setCheckBoxVisibility(View.GONE);
tz = zone;
}
view.setText(activity.getMultiroomDeviceName(msg));
String description = activity.getString(R.string.multiroom_none);
boolean attached = false;
if (di != null)
{
final int groupId = di.getGroupId(tz);
if (groupId != MultiroomDeviceInformationMsg.NO_GROUP)
{
description = activity.getString(R.string.multiroom_group)
+ " " + groupId
+ ": " + activity.getString(di.getRole(tz).getDescriptionId())
+ ", " + activity.getString(R.string.multiroom_channel)
+ " " + di.getChannelType(tz);
if (!myDevice && myGroupId == groupId)
{
attached = di.getChannelType(tz) != MultiroomDeviceInformationMsg.ChannelType.NONE;
}
}
}
view.setDescription(description);
view.setChecked(attached);
view.setTag(msg.getIdentifier());
view.setOnClickListener(v -> {
CheckableItemView cv = (CheckableItemView) v;
cv.toggle();
});
Logging.info(activity, " " + msg + "; " + description + "; attached=" + attached);
return view;
}
private static void sendGroupUpdates(
@NonNull final MainActivity activity,
@NonNull final LinearLayout deviceGroup,
@NonNull final Map<String, Boolean> attachedDevices,
int myZone,
int myGroupId)
{
final int maxDelay = 3000;
final MultiroomGroupSettingMsg removeCmd = new MultiroomGroupSettingMsg(
MultiroomGroupSettingMsg.Command.REMOVE_SLAVE, myZone, 0, maxDelay);
final MultiroomGroupSettingMsg addCmd = new MultiroomGroupSettingMsg(
MultiroomGroupSettingMsg.Command.ADD_SLAVE, myZone, myGroupId, maxDelay);
for (int i = 0; i < deviceGroup.getChildCount(); i++)
{
CheckableItemView cv = (CheckableItemView) deviceGroup.getChildAt(i);
final String id = (String) cv.getTag();
boolean attached = false;
{
Boolean _attached = attachedDevices.get(id);
if (_attached != null)
{
attached = _attached;
}
}
if (!attached && cv.isChecked())
{
addCmd.getDevice().add(id);
}
else if (attached && !cv.isChecked())
{
removeCmd.getDevice().add(id);
}
}
if (removeCmd.getDevice().size() > 0 && activity.isConnected())
{
activity.getStateManager().sendMessage(removeCmd);
}
if (addCmd.getDevice().size() > 0 && activity.isConnected())
{
activity.getStateManager().sendMessage(addCmd);
}
}
}
| 8,442 | Java | .java | mkulesh/onpc | 122 | 22 | 8 | 2018-10-13T13:24:13Z | 2024-05-05T19:04:17Z |
RemoteControlFragment.java | /FileExtraction/Java_unseen/mkulesh_onpc/app/src/main/java/com/mkulesh/onpc/fragments/RemoteControlFragment.java | /*
* Enhanced Music Controller
* Copyright (C) 2018-2023 by Mikhail Kulesh
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* This program 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 General Public License for more details. You should have received a copy of the GNU General
* Public License along with this program.
*/
package com.mkulesh.onpc.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.mkulesh.onpc.R;
import com.mkulesh.onpc.config.CfgAppSettings;
import com.mkulesh.onpc.iscp.State;
import com.mkulesh.onpc.iscp.messages.ListeningModeMsg;
import com.mkulesh.onpc.iscp.messages.OperationCommandMsg;
import com.mkulesh.onpc.iscp.messages.ReceiverInformationMsg;
import com.mkulesh.onpc.iscp.messages.SetupOperationCommandMsg;
import java.util.ArrayList;
import java.util.HashSet;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageButton;
public class RemoteControlFragment extends BaseFragment
{
private final ArrayList<View> buttons = new ArrayList<>();
public RemoteControlFragment()
{
// Empty constructor required for fragment subclasses
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
initializeFragment(inflater, container, R.layout.remote_control_fragment, CfgAppSettings.Tabs.RC);
final LinearLayout l = rootView.findViewById(R.id.remote_control_layout);
collectButtons(l, buttons);
for (View b : buttons)
{
prepareRCButton(b);
}
updateContent();
return rootView;
}
private void prepareRCButton(View b)
{
if (b.getTag() == null)
{
return;
}
String[] tokens = b.getTag().toString().split(":");
if (tokens.length != 2)
{
return;
}
final String msgName = tokens[0];
switch (msgName)
{
case SetupOperationCommandMsg.CODE:
{
final SetupOperationCommandMsg cmd = new SetupOperationCommandMsg(tokens[1]);
if (b instanceof AppCompatImageButton)
{
prepareButton((AppCompatImageButton) b, cmd, cmd.getCommand().getImageId(), cmd.getCommand().getDescriptionId());
}
else
{
prepareButtonListeners(b, cmd, null);
}
break;
}
case OperationCommandMsg.CODE:
{
final OperationCommandMsg cmd = new OperationCommandMsg(ReceiverInformationMsg.DEFAULT_ACTIVE_ZONE, tokens[1]);
if (b instanceof AppCompatImageButton)
{
prepareButton((AppCompatImageButton) b, cmd, cmd.getCommand().getImageId(), cmd.getCommand().getDescriptionId());
}
else
{
prepareButtonListeners(b, cmd, null);
}
break;
}
case ListeningModeMsg.CODE:
final ListeningModeMsg cmd = new ListeningModeMsg(ListeningModeMsg.Mode.valueOf(tokens[1]));
if (b instanceof AppCompatImageButton)
{
prepareButton((AppCompatImageButton) b, cmd, cmd.getMode().getImageId(), cmd.getMode().getDescriptionId());
}
else
{
prepareButtonListeners(b, cmd, null);
}
break;
default:
break;
}
}
@Override
protected void updateStandbyView(@Nullable final State state)
{
// Command buttons
rootView.findViewById(R.id.cmd_buttons_layout).setVisibility(View.GONE);
// All buttons
for (View b : buttons)
{
setButtonEnabled(b, state != null && state.isOn());
}
// Listening modes
rootView.findViewById(R.id.listening_mode_layout).setVisibility(
state != null && state.isListeningModeControl() ? View.VISIBLE : View.GONE);
rootView.findViewById(R.id.listening_mode).setVisibility(View.GONE);
}
@Override
protected void updateActiveView(@NonNull final State state, @NonNull final HashSet<State.ChangeType> eventChanges)
{
// Command buttons
rootView.findViewById(R.id.cmd_buttons_layout).setVisibility(View.VISIBLE);
rootView.findViewById(R.id.cmd_setup_layout).setVisibility(
state.isControlExists("Setup") ? View.VISIBLE : View.GONE);
rootView.findViewById(R.id.cmd_home_layout).setVisibility(
state.isControlExists("Home") ? View.VISIBLE : View.GONE);
rootView.findViewById(R.id.cmd_quick_menu_layout).setVisibility(
(state.isControlExists("Quick") || State.BRAND_PIONEER.equals(state.getBrand())) ? View.VISIBLE : View.GONE);
// All buttons
for (View b : buttons)
{
setButtonEnabled(b, true);
}
// Listening modes
final LinearLayout listeningModeLayout = rootView.findViewById(R.id.listening_mode_layout);
listeningModeLayout.setVisibility(state.isListeningModeControl() ? View.VISIBLE : View.GONE);
final TextView listeningMode = rootView.findViewById(R.id.listening_mode);
listeningMode.setVisibility(listeningModeLayout.getVisibility());
if (eventChanges.contains(State.ChangeType.AUDIO_CONTROL))
{
listeningMode.setText(state.listeningMode.getDescriptionId());
}
}
}
| 6,017 | Java | .java | mkulesh/onpc | 122 | 22 | 8 | 2018-10-13T13:24:13Z | 2024-05-05T19:04:17Z |
Dialogs.java | /FileExtraction/Java_unseen/mkulesh_onpc/app/src/main/java/com/mkulesh/onpc/fragments/Dialogs.java | /*
* Enhanced Music Controller
* Copyright (C) 2018-2023 by Mikhail Kulesh
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* This program 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 General Public License for more details. You should have received a copy of the GNU General
* Public License along with this program.
*/
package com.mkulesh.onpc.fragments;
import android.annotation.SuppressLint;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.Html;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.TextView;
import com.mkulesh.onpc.MainActivity;
import com.mkulesh.onpc.R;
import com.mkulesh.onpc.config.CfgFavoriteShortcuts;
import com.mkulesh.onpc.iscp.State;
import com.mkulesh.onpc.iscp.messages.DcpSearchMsg;
import com.mkulesh.onpc.iscp.messages.FirmwareUpdateMsg;
import com.mkulesh.onpc.iscp.messages.NetworkStandByMsg;
import com.mkulesh.onpc.iscp.messages.PowerStatusMsg;
import com.mkulesh.onpc.iscp.messages.PresetMemoryMsg;
import com.mkulesh.onpc.utils.Utils;
import com.mkulesh.onpc.widgets.HorizontalNumberPicker;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.appcompat.widget.AppCompatRadioButton;
public class Dialogs
{
private final MainActivity activity;
interface ButtonListener
{
void onPositiveButton();
}
public Dialogs(final MainActivity activity)
{
this.activity = activity;
}
public AlertDialog createOkDialog(@NonNull final FrameLayout frameView, @DrawableRes final int iconId, @StringRes final int titleId)
{
final Drawable icon = Utils.getDrawable(activity, iconId);
Utils.setDrawableColorAttr(activity, icon, android.R.attr.textColorSecondary);
return new AlertDialog.Builder(activity)
.setTitle(titleId)
.setIcon(icon)
.setCancelable(true)
.setView(frameView)
.setPositiveButton(activity.getResources().getString(R.string.action_ok), (dialog1, which) -> dialog1.dismiss())
.create();
}
public void showDcpSearchDialog(@NonNull final State state, final ButtonListener bl)
{
if (state.getDcpSearchCriteria() == null)
{
return;
}
final FrameLayout frameView = new FrameLayout(activity);
activity.getLayoutInflater().inflate(R.layout.dialog_dcp_search_layout, frameView);
final RadioGroup searchCriteria = frameView.findViewById(R.id.search_criteria_group);
for (int i = 0; i < state.getDcpSearchCriteria().size(); i++)
{
final ContextThemeWrapper wrappedContext = new ContextThemeWrapper(activity, R.style.RadioButtonStyle);
final AppCompatRadioButton b = new AppCompatRadioButton(wrappedContext, null, 0);
final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
b.setLayoutParams(lp);
b.setText(getTranslatedName(activity, state.getDcpSearchCriteria().get(i).first));
b.setTag(state.getDcpSearchCriteria().get(i).second);
b.setChecked(i == 0);
b.setTextColor(Utils.getThemeColorAttr(activity, android.R.attr.textColor));
b.setOnClickListener((v) -> {
for (int k = 0; k < searchCriteria.getChildCount(); k++)
{
final AppCompatRadioButton b1 = (AppCompatRadioButton) searchCriteria.getChildAt(k);
b1.setChecked(b1.getTag().equals(v.getTag()));
}
});
searchCriteria.addView(b);
}
searchCriteria.invalidate();
final AppCompatEditText searchText = frameView.findViewById(R.id.search_string);
searchText.setText(activity.getStateManager().getState().artist);
final Drawable icon = Utils.getDrawable(activity, R.drawable.cmd_search);
Utils.setDrawableColorAttr(activity, icon, android.R.attr.textColorSecondary);
final AlertDialog dialog = new AlertDialog.Builder(activity)
.setTitle(R.string.medialist_search)
.setIcon(icon)
.setCancelable(true)
.setView(frameView)
.setNegativeButton(activity.getResources().getString(R.string.action_cancel), (dialog1, which) ->
{
Utils.showSoftKeyboard(activity, searchText, false);
dialog1.dismiss();
})
.setPositiveButton(activity.getResources().getString(R.string.action_ok), (dialog2, which) ->
{
Utils.showSoftKeyboard(activity, searchText, false);
for (int i = 0; i < searchCriteria.getChildCount(); i++)
{
final AppCompatRadioButton b = (AppCompatRadioButton) searchCriteria.getChildAt(i);
if (b.isChecked() && searchText.getText() != null && searchText.getText().length() > 0)
{
activity.getStateManager().sendMessage(new DcpSearchMsg(
activity.getStateManager().getState().mediaListSid,
b.getTag().toString(),
searchText.getText().toString()));
if (bl != null)
{
bl.onPositiveButton();
}
}
}
dialog2.dismiss();
})
.create();
dialog.show();
Utils.fixDialogLayout(dialog, android.R.attr.textColorSecondary);
}
@NonNull
static String getTranslatedName(@NonNull MainActivity activity, String item)
{
final String[] sourceNames = new String[]{
"Artist",
"Album",
"Track",
"Station",
"Playlist"
};
final int[] targetNames = new int[]{
R.string.medialist_search_artist,
R.string.medialist_search_album,
R.string.medialist_search_track,
R.string.medialist_search_station,
R.string.medialist_search_playlist
};
for (int i = 0; i < sourceNames.length; i++)
{
if (sourceNames[i].equalsIgnoreCase(item))
{
return activity.getString(targetNames[i]);
}
}
return item;
}
public void showFirmwareUpdateDialog()
{
final Drawable icon = Utils.getDrawable(activity, R.drawable.cmd_firmware_update);
Utils.setDrawableColorAttr(activity, icon, android.R.attr.textColorSecondary);
final AlertDialog dialog = new AlertDialog.Builder(activity)
.setTitle(R.string.device_firmware)
.setIcon(icon)
.setCancelable(true)
.setMessage(R.string.device_firmware_confirm)
.setNegativeButton(R.string.action_cancel, (d, which) -> d.dismiss())
.setPositiveButton(R.string.action_ok, (d, which) ->
{
if (activity.isConnected())
{
activity.getStateManager().sendMessageToGroup(
new FirmwareUpdateMsg(FirmwareUpdateMsg.Status.NET));
}
d.dismiss();
})
.create();
dialog.show();
Utils.fixDialogLayout(dialog, android.R.attr.textColorSecondary);
}
public void showNetworkStandByDialog()
{
final Drawable icon = Utils.getDrawable(activity, R.drawable.menu_power_standby);
Utils.setDrawableColorAttr(activity, icon, android.R.attr.textColorSecondary);
final AlertDialog dialog = new AlertDialog.Builder(activity)
.setTitle(R.string.device_network_standby)
.setIcon(icon)
.setCancelable(true)
.setMessage(R.string.device_network_standby_confirm)
.setNegativeButton(R.string.action_cancel, (d, which) -> d.dismiss())
.setPositiveButton(R.string.action_ok, (d, which) ->
{
if (activity.isConnected())
{
activity.getStateManager().sendMessage(new NetworkStandByMsg(NetworkStandByMsg.Status.OFF));
}
d.dismiss();
})
.create();
dialog.show();
Utils.fixDialogLayout(dialog, android.R.attr.textColorSecondary);
}
public void showAvInfoDialog(@Nullable final State state)
{
if (state == null)
{
return;
}
if (state.avInfoAudioInput.isEmpty() && state.avInfoAudioOutput.isEmpty() &&
state.avInfoVideoInput.isEmpty() && state.avInfoVideoOutput.isEmpty())
{
return;
}
final FrameLayout frameView = new FrameLayout(activity);
activity.getLayoutInflater().inflate(R.layout.dialog_av_info, frameView);
if (activity.getResources() != null)
{
((TextView) frameView.findViewById(R.id.av_info_audio_input)).setText(
String.format(activity.getResources().getString(
R.string.av_info_input), state.avInfoAudioInput));
((TextView) frameView.findViewById(R.id.av_info_audio_output)).setText(
String.format(activity.getResources().getString(
R.string.av_info_output), state.avInfoAudioOutput));
((TextView) frameView.findViewById(R.id.av_info_video_input)).setText(
String.format(activity.getResources().getString(
R.string.av_info_input), state.avInfoVideoInput));
((TextView) frameView.findViewById(R.id.av_info_video_output)).setText(
String.format(activity.getResources().getString(
R.string.av_info_output), state.avInfoVideoOutput));
}
final AlertDialog dialog = createOkDialog(frameView, state.getServiceIcon(), R.string.av_info_dialog);
dialog.show();
Utils.fixDialogLayout(dialog, android.R.attr.textColorSecondary);
}
public void showPresetMemoryDialog(@NonNull final State state)
{
final FrameLayout frameView = new FrameLayout(activity);
activity.getLayoutInflater().inflate(R.layout.dialog_preset_memory, frameView);
final HorizontalNumberPicker numberPicker = frameView.findViewById(R.id.preset_memory_number);
numberPicker.minValue = 1;
numberPicker.maxValue = PresetMemoryMsg.MAX_NUMBER;
numberPicker.setValue(state.nextEmptyPreset());
numberPicker.setEnabled(true);
final Drawable icon = Utils.getDrawable(activity, R.drawable.cmd_track_menu);
Utils.setDrawableColorAttr(activity, icon, android.R.attr.textColorSecondary);
final AlertDialog dialog = new AlertDialog.Builder(activity)
.setTitle(R.string.cmd_preset_memory)
.setIcon(icon)
.setCancelable(true)
.setView(frameView)
.setNegativeButton(activity.getResources().getString(R.string.action_cancel), (dialog1, which) ->
{
Utils.showSoftKeyboard(activity, numberPicker, false);
dialog1.dismiss();
})
.setPositiveButton(activity.getResources().getString(R.string.action_ok), (dialog12, which) ->
{
Utils.showSoftKeyboard(activity, numberPicker, false);
// in order to get updated preset list, we need to request Receiver Information
activity.getStateManager().requestRIonPreset(true);
activity.getStateManager().sendMessage(new PresetMemoryMsg(numberPicker.getValue()));
})
.create();
dialog.show();
Utils.fixDialogLayout(dialog, android.R.attr.textColorSecondary);
}
public void showEditShortcutDialog(@NonNull final CfgFavoriteShortcuts.Shortcut shortcut, final ButtonListener bl)
{
final FrameLayout frameView = new FrameLayout(activity);
activity.getLayoutInflater().inflate(R.layout.dialog_favorite_shortcut_layout, frameView);
final TextView path = frameView.findViewById(R.id.favorite_shortcut_path);
path.setText(shortcut.getLabel(activity));
final EditText alias = frameView.findViewById(R.id.favorite_shortcut_alias);
alias.setText(shortcut.alias);
final Drawable icon = Utils.getDrawable(activity, R.drawable.drawer_edit_item);
Utils.setDrawableColorAttr(activity, icon, android.R.attr.textColorSecondary);
final AlertDialog dialog = new AlertDialog.Builder(activity)
.setTitle(R.string.favorite_shortcut_edit)
.setIcon(icon)
.setCancelable(false)
.setView(frameView)
.setNegativeButton(activity.getResources().getString(R.string.action_cancel), (dialog1, which) ->
{
Utils.showSoftKeyboard(activity, alias, false);
dialog1.dismiss();
})
.setPositiveButton(activity.getResources().getString(R.string.action_ok), (dialog2, which) ->
{
Utils.showSoftKeyboard(activity, alias, false);
activity.getConfiguration().favoriteShortcuts.updateShortcut(
shortcut, alias.getText().toString());
if (bl != null)
{
bl.onPositiveButton();
}
dialog2.dismiss();
})
.create();
dialog.show();
Utils.fixDialogLayout(dialog, android.R.attr.textColorSecondary);
}
public void showOnStandByDialog(@NonNull final PowerStatusMsg cmdMsg)
{
final Drawable icon = Utils.getDrawable(activity, R.drawable.menu_power_standby);
Utils.setDrawableColorAttr(activity, icon, android.R.attr.textColorSecondary);
final AlertDialog dialog = new AlertDialog.Builder(activity)
.setTitle(R.string.menu_power_standby)
.setIcon(icon)
.setCancelable(true)
.setMessage(R.string.menu_switch_off_group)
.setNeutralButton(R.string.action_cancel, (d, which) -> d.dismiss())
.setNegativeButton(R.string.action_no, (d, which) ->
{
activity.getStateManager().sendMessage(cmdMsg);
d.dismiss();
})
.setPositiveButton(R.string.action_ok, (d, which) ->
{
activity.getStateManager().sendMessageToGroup(cmdMsg);
d.dismiss();
}).create();
dialog.show();
Utils.fixDialogLayout(dialog, android.R.attr.textColorSecondary);
}
public void showHtmlDialog(@DrawableRes int icon, @StringRes int title, @StringRes int textId)
{
final AlertDialog dialog = buildHtmlDialog(icon, title, activity.getResources().getString(textId), true);
dialog.show();
Utils.fixDialogLayout(dialog, null);
}
public void showXmlDialog(@DrawableRes int icon, @StringRes int title, final String text)
{
final AlertDialog dialog = buildHtmlDialog(icon, title, text, false);
dialog.show();
Utils.fixDialogLayout(dialog, null);
}
@SuppressLint("NewApi")
private AlertDialog buildHtmlDialog(@DrawableRes int icon, @StringRes int title, final String text, final boolean isHtml)
{
final FrameLayout frameView = new FrameLayout(activity);
final AlertDialog alertDialog = new AlertDialog.Builder(activity)
.setTitle(title)
.setIcon(icon)
.setCancelable(true)
.setView(frameView)
.setPositiveButton(activity.getResources().getString(R.string.action_ok), (dialog, which) -> { /* empty */ }).create();
final LayoutInflater inflater = alertDialog.getLayoutInflater();
final FrameLayout dialogFrame = (FrameLayout) inflater.inflate(R.layout.dialog_html_layout, frameView);
if (text.isEmpty())
{
return alertDialog;
}
final TextView aboutMessage = dialogFrame.findViewById(R.id.text_message);
if (isHtml)
{
Spanned result;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
{
result = Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY);
}
else
{
result = Html.fromHtml(text);
}
aboutMessage.setText(result);
aboutMessage.setMovementMethod(LinkMovementMethod.getInstance());
}
else
{
aboutMessage.setText(text);
}
return alertDialog;
}
}
| 18,151 | Java | .java | mkulesh/onpc | 122 | 22 | 8 | 2018-10-13T13:24:13Z | 2024-05-05T19:04:17Z |
MediaListAdapter.java | /FileExtraction/Java_unseen/mkulesh_onpc/app/src/main/java/com/mkulesh/onpc/fragments/MediaListAdapter.java | /*
* Enhanced Music Controller
* Copyright (C) 2018-2023 by Mikhail Kulesh
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* This program 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 General Public License for more details. You should have received a copy of the GNU General
* Public License along with this program.
*/
package com.mkulesh.onpc.fragments;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.mkulesh.onpc.R;
import com.mkulesh.onpc.iscp.ISCPMessage;
import com.mkulesh.onpc.iscp.messages.DcpMediaContainerMsg;
import com.mkulesh.onpc.iscp.messages.DcpTunerModeMsg;
import com.mkulesh.onpc.iscp.messages.NetworkServiceMsg;
import com.mkulesh.onpc.iscp.messages.OperationCommandMsg;
import com.mkulesh.onpc.iscp.messages.PresetCommandMsg;
import com.mkulesh.onpc.iscp.messages.XmlListItemMsg;
import com.mkulesh.onpc.utils.Utils;
import java.util.ArrayList;
import androidx.annotation.NonNull;
final class MediaListAdapter extends ArrayAdapter<ISCPMessage>
{
private final MediaFragment mediaFragment;
MediaListAdapter(final MediaFragment mediaFragment, Context context, ArrayList<ISCPMessage> list)
{
super(context, 0, list);
this.mediaFragment = mediaFragment;
}
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent)
{
// Get the data item for this position
ISCPMessage item = getItem(position);
// Check if an existing view is being reused, otherwise inflate the view
if (convertView == null)
{
convertView = LayoutInflater.from(getContext()).inflate(R.layout.media_item, parent, false);
}
final ImageView icon = convertView.findViewById(R.id.media_item_icon);
final TextView tvTitle = convertView.findViewById(R.id.media_item_title);
if (item instanceof XmlListItemMsg)
{
final XmlListItemMsg msg = (XmlListItemMsg) item;
if (msg.getIcon() != XmlListItemMsg.Icon.UNKNOWN)
{
icon.setImageResource(msg.getIcon().getImageId());
icon.setVisibility(View.VISIBLE);
boolean isPlaying = msg.getIcon() == XmlListItemMsg.Icon.PLAY;
Utils.setImageViewColorAttr(mediaFragment.activity, icon,
isPlaying ? R.attr.colorAccent : R.attr.colorButtonDisabled);
}
else if (!msg.isSelectable())
{
icon.setImageDrawable(null);
icon.setVisibility(View.GONE);
}
tvTitle.setText(msg.getTitle());
tvTitle.setTextColor(Utils.getThemeColorAttr(mediaFragment.activity,
(mediaFragment.moveFrom == msg.getMessageId() || !msg.isSelectable()) ?
android.R.attr.textColorSecondary : android.R.attr.textColor));
}
else if (item instanceof NetworkServiceMsg)
{
final NetworkServiceMsg msg = (NetworkServiceMsg) item;
icon.setImageResource(msg.getService().getImageId());
final boolean isPlaying = mediaFragment.activity.getStateManager() != null &&
mediaFragment.activity.getStateManager().getState().serviceIcon == msg.getService();
Utils.setImageViewColorAttr(mediaFragment.activity, icon,
isPlaying ? R.attr.colorAccent : R.attr.colorButtonDisabled);
tvTitle.setText(msg.getService().getDescriptionId());
}
else if (item instanceof OperationCommandMsg)
{
final OperationCommandMsg msg = (OperationCommandMsg) item;
if (msg.getCommand().isImageValid())
{
icon.setImageResource(msg.getCommand().getImageId());
Utils.setImageViewColorAttr(mediaFragment.activity, icon, android.R.attr.textColor);
}
tvTitle.setText(msg.getCommand().getDescriptionId());
}
else if (item instanceof PresetCommandMsg)
{
final PresetCommandMsg msg = (PresetCommandMsg) item;
if (msg.getPreset() != PresetCommandMsg.NO_PRESET)
{
icon.setImageResource(R.drawable.media_item_play);
Utils.setImageViewColorAttr(mediaFragment.activity, icon, R.attr.colorAccent);
}
else
{
icon.setImageResource(msg.getPresetConfig().getImageId());
Utils.setImageViewColorAttr(mediaFragment.activity, icon, android.R.attr.textColor);
}
tvTitle.setText(msg.getPresetConfig().displayedString(true));
}
else if (item instanceof DcpTunerModeMsg)
{
final DcpTunerModeMsg msg = (DcpTunerModeMsg) item;
icon.setImageResource(R.drawable.media_item_radio);
final boolean isPlaying = mediaFragment.activity.getStateManager() != null &&
mediaFragment.activity.getStateManager().getState().dcpTunerMode == msg.getTunerMode();
Utils.setImageViewColorAttr(mediaFragment.activity, icon,
isPlaying ? R.attr.colorAccent : R.attr.colorButtonDisabled);
tvTitle.setText(msg.getTunerMode().getDescriptionId());
}
else if (item instanceof DcpMediaContainerMsg)
{
icon.setImageResource(OperationCommandMsg.Command.RETURN.getImageId());
Utils.setImageViewColorAttr(mediaFragment.activity, icon, android.R.attr.textColor);
tvTitle.setText(OperationCommandMsg.Command.RETURN.getDescriptionId());
}
return convertView;
}
}
| 6,169 | Java | .java | mkulesh/onpc | 122 | 22 | 8 | 2018-10-13T13:24:13Z | 2024-05-05T19:04:17Z |
MediaFragment.java | /FileExtraction/Java_unseen/mkulesh_onpc/app/src/main/java/com/mkulesh/onpc/fragments/MediaFragment.java | /*
* Enhanced Music Controller
* Copyright (C) 2018-2023 by Mikhail Kulesh
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* This program 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 General Public License for more details. You should have received a copy of the GNU General
* Public License along with this program.
*/
package com.mkulesh.onpc.fragments;
import android.content.Intent;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.mkulesh.onpc.R;
import com.mkulesh.onpc.config.CfgAppSettings;
import com.mkulesh.onpc.config.CfgFavoriteShortcuts;
import com.mkulesh.onpc.iscp.ConnectionIf;
import com.mkulesh.onpc.iscp.ISCPMessage;
import com.mkulesh.onpc.iscp.State;
import com.mkulesh.onpc.iscp.StateManager;
import com.mkulesh.onpc.iscp.messages.DcpMediaContainerMsg;
import com.mkulesh.onpc.iscp.messages.DcpTunerModeMsg;
import com.mkulesh.onpc.iscp.messages.InputSelectorMsg;
import com.mkulesh.onpc.iscp.messages.NetworkServiceMsg;
import com.mkulesh.onpc.iscp.messages.OperationCommandMsg;
import com.mkulesh.onpc.iscp.messages.PlayQueueAddMsg;
import com.mkulesh.onpc.iscp.messages.PlayQueueRemoveMsg;
import com.mkulesh.onpc.iscp.messages.PlayQueueReorderMsg;
import com.mkulesh.onpc.iscp.messages.PowerStatusMsg;
import com.mkulesh.onpc.iscp.messages.PresetCommandMsg;
import com.mkulesh.onpc.iscp.messages.ReceiverInformationMsg;
import com.mkulesh.onpc.iscp.messages.ServiceType;
import com.mkulesh.onpc.iscp.messages.XmlListItemMsg;
import com.mkulesh.onpc.utils.Logging;
import com.mkulesh.onpc.utils.Utils;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatImageButton;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.core.view.MenuCompat;
public class MediaFragment extends BaseFragment implements AdapterView.OnItemClickListener
{
private TextView titleBar;
private ListView listView;
private final MediaFilter mediaFilter = new MediaFilter();
private MediaListAdapter listViewAdapter;
private LinearLayout selectorPaletteLayout;
private XmlListItemMsg selectedItem = null;
private PresetCommandMsg selectedStation = null;
int moveFrom = -1;
private int filteredItems = 0;
public MediaFragment()
{
// Empty constructor required for fragment subclasses
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
initializeFragment(inflater, container, R.layout.media_fragment, CfgAppSettings.Tabs.MEDIA);
rootView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
selectorPaletteLayout = rootView.findViewById(R.id.selector_palette);
titleBar = rootView.findViewById(R.id.items_list_title_bar);
titleBar.setClickable(true);
titleBar.setOnClickListener(v ->
{
if (activity.isConnected())
{
if (!activity.getStateManager().getState().isTopLayer())
{
activity.getStateManager().sendMessage(activity.getStateManager().getReturnMessage());
}
}
});
listView = rootView.findViewById(R.id.items_list_view);
listView.setItemsCanFocus(false);
listView.setFocusableInTouchMode(true);
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
listView.setOnItemClickListener(this);
// media filter
mediaFilter.init(activity, rootView, () ->
{
if (activity.isConnected())
{
updateListView(activity.getStateManager().getState());
}
});
registerForContextMenu(listView);
updateContent();
return rootView;
}
@Override
public void onResume()
{
if (activity != null && activity.isConnected())
{
final boolean keepPlaybackMode = activity.getConfiguration().keepPlaybackMode();
activity.getStateManager().setPlaybackMode(keepPlaybackMode);
final State state = activity.getStateManager().getState();
if (!keepPlaybackMode && state.isUiTypeValid() && state.isPlaybackMode())
{
activity.getStateManager().sendMessage(StateManager.LIST_MSG);
}
}
mediaFilter.setVisibility(false, true);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
updateStandbyView(null);
}
@Override
public void onCreateContextMenu(@NonNull ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
{
selectedItem = null;
if (v.getId() == listView.getId() && activity.isConnected())
{
final State state = activity.getStateManager().getState();
final ReceiverInformationMsg.Selector selector = state.getActualSelector();
final ReceiverInformationMsg.NetworkService networkService = state.getNetworkService();
if (selector != null)
{
Logging.info(this, "Context menu for selector " + selector +
(networkService != null ? " and service " + networkService : ""));
ListView lv = (ListView) v;
AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) menuInfo;
final Object item = lv.getItemAtPosition(acmi.position);
final boolean isShortcut = state.isShortcutPossible();
if (item instanceof XmlListItemMsg)
{
selectedItem = (XmlListItemMsg) item;
final MenuInflater inflater = activity.getMenuInflater();
inflater.inflate(R.menu.playlist_context_menu, menu);
MenuCompat.setGroupDividerEnabled(menu, true);
final boolean isDcpItem = selectedItem.getCmdMessage() instanceof DcpMediaContainerMsg;
final boolean isDcpPlayable = isDcpItem &&
((DcpMediaContainerMsg) selectedItem.getCmdMessage()).isPlayable();
final boolean isQueue = state.serviceType == ServiceType.PLAYQUEUE ||
(isDcpItem && state.serviceType == ServiceType.DCP_PLAYQUEUE);
final boolean addToQueue = selector.isAddToQueue() ||
(networkService != null && networkService.isAddToQueue()) ||
isDcpPlayable;
final boolean isAdvQueue = activity.getConfiguration().isAdvancedQueue() ||
isDcpPlayable;
if (isQueue || addToQueue)
{
menu.setHeaderTitle(R.string.playlist_options);
}
menu.findItem(R.id.playlist_menu_add).setVisible(
!isQueue && addToQueue && !state.isPlaybackMode());
menu.findItem(R.id.playlist_menu_add_and_play).setVisible(
!isQueue && addToQueue && !state.isPlaybackMode());
menu.findItem(R.id.playlist_menu_replace).setVisible(
!isQueue && addToQueue && isAdvQueue && !state.isPlaybackMode());
menu.findItem(R.id.playlist_menu_replace_and_play).setVisible(
!isQueue && addToQueue && isAdvQueue && !state.isPlaybackMode());
menu.findItem(R.id.playlist_menu_remove).setVisible(
isQueue && !state.isPlaybackMode());
menu.findItem(R.id.playlist_menu_remove_all).setVisible(
isQueue && !state.isPlaybackMode());
menu.findItem(R.id.playlist_menu_move_from).setVisible(
isQueue && !state.isPlaybackMode());
menu.findItem(R.id.playlist_menu_move_to).setVisible(
isQueue && isMoveToValid(selectedItem.getMessageId()) && !state.isPlaybackMode());
final boolean isTrackMenu = state.isTrackMenuActive();
final boolean isPlaying = state.isPlaying() &&
selectedItem.getIcon() == XmlListItemMsg.Icon.PLAY;
menu.findItem(R.id.playlist_track_menu).setVisible(isTrackMenu && isPlaying && !isQueue);
menu.findItem(R.id.cmd_playback_mode).setVisible(isPlaying && !state.isPlaybackMode());
menu.findItem(R.id.cmd_shortcut_create).setVisible(isShortcut);
// DCP menu
menu.findItem(R.id.playlist_menu_add_to_heos_favourites).setVisible(isDcpItem);
menu.findItem(R.id.playlist_menu_remove_from_heos_favourites).setVisible(isDcpItem);
menu.findItem(R.id.playlist_menu_replace_and_play_all).setVisible(isDcpItem);
menu.findItem(R.id.playlist_menu_add_all).setVisible(isDcpItem);
menu.findItem(R.id.playlist_menu_add_and_play_all).setVisible(isDcpItem);
if (isDcpItem)
{
final List<XmlListItemMsg> menuItems = state.cloneDcpTrackMenuItems(null);
menu.findItem(R.id.playlist_menu_add_to_heos_favourites).setVisible(
findDcpMenuItem(menuItems, DcpMediaContainerMsg.SO_ADD_TO_HEOS) != null);
menu.findItem(R.id.playlist_menu_remove_from_heos_favourites).setVisible(
findDcpMenuItem(menuItems, DcpMediaContainerMsg.SO_REMOVE_FROM_HEOS) != null);
menu.findItem(R.id.playlist_menu_replace_and_play_all).setVisible(
findDcpMenuItem(menuItems, DcpMediaContainerMsg.SO_REPLACE_AND_PLAY_ALL) != null);
menu.findItem(R.id.playlist_menu_add_all).setVisible(
findDcpMenuItem(menuItems, DcpMediaContainerMsg.SO_ADD_ALL) != null);
menu.findItem(R.id.playlist_menu_add_and_play_all).setVisible(
findDcpMenuItem(menuItems, DcpMediaContainerMsg.SO_ADD_AND_PLAY_ALL) != null);
}
}
else if (item instanceof PresetCommandMsg)
{
selectedStation = (PresetCommandMsg) item;
final MenuInflater inflater = activity.getMenuInflater();
inflater.inflate(R.menu.playlist_context_menu, menu);
for (int i = 0; i < menu.size(); i++)
{
menu.getItem(i).setVisible(false);
}
menu.findItem(R.id.cmd_shortcut_create).setVisible(isShortcut);
}
if (state.protoType == ConnectionIf.ProtoType.DCP)
{
menu.findItem(R.id.playlist_menu_replace).setVisible(false);
menu.findItem(R.id.playlist_track_menu).setVisible(false);
menu.findItem(R.id.cmd_playback_mode).setVisible(false);
menu.findItem(R.id.cmd_shortcut_create).setVisible(false);
}
}
}
}
@Override
public boolean onContextItemSelected(@NonNull MenuItem item)
{
if (selectedItem != null && activity.isConnected())
{
final State state = activity.getStateManager().getState();
final int idx = selectedItem.getMessageId();
final String title = selectedItem.getTitle();
final DcpMediaContainerMsg dcpCmd = (selectedItem.getCmdMessage() instanceof DcpMediaContainerMsg) ?
(DcpMediaContainerMsg) selectedItem.getCmdMessage() : null;
Logging.info(this, "Context menu '" + item.getTitle() + "'; " + selectedItem);
selectedItem = null;
switch (item.getItemId())
{
case R.id.playlist_menu_add:
if (dcpCmd != null)
{
activity.getStateManager().sendDcpMediaCmd(dcpCmd, 3 /* add to end */);
}
else
{
activity.getStateManager().sendPlayQueueMsg(new PlayQueueAddMsg(idx, 2), false);
}
return true;
case R.id.playlist_menu_add_and_play:
if (dcpCmd != null)
{
activity.getStateManager().sendDcpMediaCmd(dcpCmd, 1 /* play now */);
}
else
{
activity.getStateManager().sendPlayQueueMsg(new PlayQueueAddMsg(idx, 0), false);
}
return true;
case R.id.playlist_menu_replace:
activity.getStateManager().sendPlayQueueMsg(new PlayQueueRemoveMsg(1, 0), false);
activity.getStateManager().sendPlayQueueMsg(new PlayQueueAddMsg(idx, 2), false);
return true;
case R.id.playlist_menu_replace_and_play:
if (dcpCmd != null)
{
activity.getStateManager().sendDcpMediaCmd(dcpCmd, 4 /* replace and play */);
}
else
{
activity.getStateManager().sendPlayQueueMsg(new PlayQueueRemoveMsg(1, 0), false);
activity.getStateManager().sendPlayQueueMsg(new PlayQueueAddMsg(idx, 0), false);
}
return true;
case R.id.playlist_menu_remove:
activity.getStateManager().sendPlayQueueMsg(new PlayQueueRemoveMsg(0, idx), false);
return true;
case R.id.playlist_menu_remove_all:
if (dcpCmd != null || activity.getConfiguration().isAdvancedQueue())
{
activity.getStateManager().sendPlayQueueMsg(new PlayQueueRemoveMsg(1, 0), false);
}
else
{
activity.getStateManager().sendPlayQueueMsg(new PlayQueueRemoveMsg(0, 0), true);
}
return true;
case R.id.playlist_menu_move_from:
moveFrom = idx;
updateListView(state);
return true;
case R.id.playlist_menu_move_to:
if (isMoveToValid(idx))
{
activity.getStateManager().sendPlayQueueMsg(new PlayQueueReorderMsg(moveFrom, idx), false);
moveFrom = -1;
}
return true;
case R.id.playlist_track_menu:
activity.getStateManager().sendTrackCmd(OperationCommandMsg.Command.MENU, false);
return true;
case R.id.cmd_playback_mode:
activity.getStateManager().sendMessage(StateManager.LIST_MSG);
return true;
case R.id.cmd_shortcut_create:
addShortcut(state, title, title);
return true;
case R.id.playlist_menu_add_to_heos_favourites:
return callDcpMenuItem(dcpCmd, DcpMediaContainerMsg.SO_ADD_TO_HEOS);
case R.id.playlist_menu_remove_from_heos_favourites:
return callDcpMenuItem(dcpCmd, DcpMediaContainerMsg.SO_REMOVE_FROM_HEOS);
case R.id.playlist_menu_replace_and_play_all:
return callDcpMenuItem(dcpCmd, DcpMediaContainerMsg.SO_REPLACE_AND_PLAY_ALL);
case R.id.playlist_menu_add_all:
return callDcpMenuItem(dcpCmd, DcpMediaContainerMsg.SO_ADD_ALL);
case R.id.playlist_menu_add_and_play_all:
return callDcpMenuItem(dcpCmd, DcpMediaContainerMsg.SO_ADD_AND_PLAY_ALL);
}
}
else if (selectedStation != null && activity.isConnected() && item.getItemId() == R.id.cmd_shortcut_create)
{
addShortcut(activity.getStateManager().getState(),
String.format("%02x", selectedStation.getPresetConfig().getId()),
selectedStation.getPresetConfig().displayedString(true));
selectedStation = null;
return true;
}
return super.onContextItemSelected(item);
}
@Nullable
private XmlListItemMsg findDcpMenuItem(@NonNull List<XmlListItemMsg> menuItems, int id)
{
for (XmlListItemMsg item : menuItems)
{
if (item.getMessageId() == id)
{
return item;
}
}
return null;
}
@SuppressWarnings("SameReturnValue")
private boolean callDcpMenuItem(DcpMediaContainerMsg dcpCmd, int id)
{
final List<XmlListItemMsg> menuItems = activity.getStateManager().getState().cloneDcpTrackMenuItems(dcpCmd);
final XmlListItemMsg item = findDcpMenuItem(menuItems, id);
if (item != null)
{
activity.getStateManager().sendMessage(item);
}
return true;
}
private void addShortcut(final @NonNull State state, final String item, final String alias)
{
if (state.isShortcutPossible())
{
final CfgFavoriteShortcuts shortcutCfg = activity.getConfiguration().favoriteShortcuts;
if (state.isPathItemsConsistent())
{
final ServiceType s = state.serviceType == null ? ServiceType.UNKNOWN : state.serviceType;
final CfgFavoriteShortcuts.Shortcut shortcut = new CfgFavoriteShortcuts.Shortcut(
shortcutCfg.getNextId(),
state.inputType,
s,
item,
alias);
if (!state.pathItems.isEmpty())
{
Logging.info(this, "full path to the item: " + state.pathItems);
shortcut.setPathItems(state.pathItems, getActivity(), s);
}
shortcutCfg.updateShortcut(shortcut, shortcut.alias);
Toast.makeText(activity, R.string.favorite_shortcut_added, Toast.LENGTH_LONG).show();
}
else
{
Toast.makeText(activity, R.string.favorite_shortcut_failed, Toast.LENGTH_LONG).show();
}
}
}
@Override
protected void updateStandbyView(@Nullable final State state)
{
mediaFilter.disable();
moveFrom = -1;
if (state != null)
{
updateSelectorButtons(state);
}
else
{
selectorPaletteLayout.removeAllViews();
}
final AppCompatImageButton cmdTopButton = rootView.findViewById(R.id.cmd_top_button);
setButtonEnabled(cmdTopButton, false);
setTitleLayout(true);
titleBar.setTag(null);
titleBar.setText(R.string.medialist_no_items);
listView.clearChoices();
listView.invalidate();
listView.setAdapter(new MediaListAdapter(this, activity, new ArrayList<>()));
setProgressIndicator(state, false);
updateTrackButtons(state);
}
@Override
protected void updateActiveView(@NonNull final State state, @NonNull final HashSet<State.ChangeType> eventChanges)
{
if (eventChanges.contains(State.ChangeType.MEDIA_ITEMS) || eventChanges.contains(State.ChangeType.RECEIVER_INFO))
{
Logging.info(this, "Updating media fragment");
mediaFilter.disable();
moveFrom = -1;
filteredItems = state.numberOfItems;
updateSelectorButtons(state);
updateListView(state);
updateTitle(state, state.numberOfItems > 0 && state.isMediaEmpty());
updateTrackButtons(state);
}
else if (eventChanges.contains(State.ChangeType.COMMON))
{
updateSelectorButtonsState(state);
updateTitle(state, state.numberOfItems > 0 && state.isMediaEmpty());
}
}
private void updateTrackButtons(State state)
{
if (state == null || state.isReceiverInformation()
|| state.isSimpleInput() || state.isMediaEmpty())
{
rootView.findViewById(R.id.track_buttons_layout).setVisibility(View.GONE);
}
else
{
rootView.findViewById(R.id.track_buttons_layout).setVisibility(View.VISIBLE);
// Up button
{
final OperationCommandMsg msg = new OperationCommandMsg(OperationCommandMsg.Command.LEFT);
final AppCompatImageButton buttonDown = rootView.findViewById(R.id.btn_track_down);
prepareButton(buttonDown, msg, msg.getCommand().getImageId(), msg.getCommand().getDescriptionId());
setButtonEnabled(buttonDown, state.isOn());
}
// Down button
{
final OperationCommandMsg msg = new OperationCommandMsg(OperationCommandMsg.Command.RIGHT);
final AppCompatImageButton buttonUp = rootView.findViewById(R.id.btn_track_up);
prepareButton(buttonUp, msg, msg.getCommand().getImageId(), msg.getCommand().getDescriptionId());
setButtonEnabled(buttonUp, state.isOn());
}
}
}
private void updateSelectorButtons(@NonNull final State state)
{
selectorPaletteLayout.removeAllViews();
List<ReceiverInformationMsg.Selector> deviceSelectors = state.cloneDeviceSelectors();
if (deviceSelectors.isEmpty())
{
return;
}
// Selectors
AppCompatButton selectedButton = null;
for (ReceiverInformationMsg.Selector s : activity.getConfiguration().getSortedDeviceSelectors(
false, state.inputType, deviceSelectors))
{
if (s.getId().equals(InputSelectorMsg.InputType.SOURCE.getCode()) &&
!s.isActiveForZone(state.getActiveZone()))
{
// #265 Add new input selector "SOURCE":
// Ignore SOURCE input for all not allowed zones
continue;
}
final InputSelectorMsg msg = new InputSelectorMsg(state.getActiveZone(), s.getId());
if (msg.getInputType() == InputSelectorMsg.InputType.NONE)
{
continue;
}
final boolean isSelected = state.isOn() && state.inputType.getCode().equals(s.getId());
final boolean waitingForData = !isSelected || !state.isTopLayer();
final AppCompatButton b = createButton(msg.getInputType().getDescriptionId(),
null, msg.getInputType(), null);
prepareButtonListeners(b, null, () ->
{
if (!state.isOn())
{
activity.getStateManager().sendMessage(
new PowerStatusMsg(state.getActiveZone(), PowerStatusMsg.PowerStatus.ON));
}
else
{
setProgressIndicator(state, waitingForData);
}
activity.getStateManager().sendMessage(msg);
});
if (activity.getConfiguration().isFriendlyNames())
{
b.setText(s.getName());
}
if (isSelected)
{
selectedButton = b;
}
selectorPaletteLayout.addView(b);
}
updateSelectorButtonsState(state);
if (selectedButton != null)
{
selectorPaletteLayout.requestChildFocus(selectedButton, selectedButton);
}
}
private void updateSelectorButtonsState(@NonNull final State state)
{
for (int i = 0; i < selectorPaletteLayout.getChildCount(); i++)
{
final View v = selectorPaletteLayout.getChildAt(i);
setButtonEnabled(v, activity.isConnected());
if (!state.isOn())
{
continue;
}
if (v.getTag() instanceof InputSelectorMsg.InputType)
{
setButtonSelected(v, state.inputType == v.getTag());
}
}
}
@SuppressWarnings("StatementWithEmptyBody")
private void updateListView(@NonNull final State state)
{
listView.clearChoices();
listView.invalidate();
final List<XmlListItemMsg> mediaItems = state.cloneMediaItems();
if (state.protoType == ConnectionIf.ProtoType.DCP && !state.isTopLayer() && mediaItems.isEmpty())
{
mediaItems.add(new XmlListItemMsg(0, 0,
getString(R.string.medialist_no_items), XmlListItemMsg.Icon.UNKNOWN,
false, null));
}
final List<NetworkServiceMsg> serviceItems = state.cloneServiceItems();
ArrayList<ISCPMessage> newItems = new ArrayList<>();
int playing = -1;
if (state.isRadioInput())
{
// Add band selectors for Denon
if (state.protoType == ConnectionIf.ProtoType.DCP)
{
for (DcpTunerModeMsg.TunerMode t : DcpTunerModeMsg.TunerMode.values())
{
if (t != DcpTunerModeMsg.TunerMode.NONE)
{
newItems.add(new DcpTunerModeMsg(t));
}
}
}
// #270 Empty FM/DAB preset list: process radio input first
// since mediaItems can be not empty due to remaining track menu items
// or active playback mode
for (ReceiverInformationMsg.Preset p : state.presetList)
{
if ((state.isFm() && p.isFm())
|| (state.isDab() && p.isDab())
|| (state.inputType == InputSelectorMsg.InputType.AM && p.isAm()))
{
final boolean isPlaying = (p.getId() == state.preset);
newItems.add(new PresetCommandMsg(
state.getActiveZone(), p, isPlaying ? state.preset : PresetCommandMsg.NO_PRESET));
if (isPlaying)
{
playing = newItems.size() - 1;
}
}
}
filteredItems = newItems.size();
}
else if (state.isSimpleInput())
{
// Nothing to do: no media items for simple input
}
else if (!mediaItems.isEmpty())
{
if (mediaItems.size() > 1)
{
mediaFilter.enable();
}
for (XmlListItemMsg i : mediaItems)
{
if (i.getTitle() != null && mediaFilter.ignore(i.getTitle()))
{
continue;
}
newItems.add(i);
if (i.getIcon() == XmlListItemMsg.Icon.PLAY)
{
playing = newItems.size() - 1;
}
}
}
else if (!serviceItems.isEmpty())
{
final ArrayList<NetworkServiceMsg> items =
activity.getConfiguration().getSortedNetworkServices(state.serviceIcon, serviceItems);
filteredItems = items.size();
newItems.addAll(items);
}
final boolean isPlayback = state.isOn() && newItems.isEmpty() && (state.isPlaybackMode() || state.isSimpleInput());
// Add "Return" button if necessary
if (activity.isConnected() && !state.isTopLayer() && !activity.getConfiguration().isBackAsReturn())
{
newItems.add(0, activity.getStateManager().getReturnMessage());
}
// Add "Playback" indication if necessary
if (isPlayback)
{
final XmlListItemMsg nsMsg = new XmlListItemMsg(-1, 0,
activity.getResources().getString(R.string.medialist_playback_mode),
XmlListItemMsg.Icon.PLAY, false, null);
newItems.add(nsMsg);
}
listViewAdapter = new MediaListAdapter(this, activity, newItems);
listView.setAdapter(listViewAdapter);
if (playing >= 0)
{
setSelection(playing, listView.getHeight() / 2);
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
if (activity.isConnected() && listViewAdapter != null && position < listViewAdapter.getCount())
{
final ISCPMessage selectedItem = listViewAdapter.getItem(position);
if (selectedItem == null)
{
return;
}
if (getContext() != null && selectedItem instanceof NetworkServiceMsg)
{
final NetworkServiceMsg cmd = (NetworkServiceMsg) selectedItem;
if (cmd.getService() == ServiceType.SPOTIFY || cmd.getService() == ServiceType.DCP_SPOTIFY)
{
Logging.info(this, "Selected media item: " + cmd + " -> launch Spotify app");
// Also see AndroidManifest.xml, queries section
Intent intent = getContext().getPackageManager().getLaunchIntentForPackage("com.spotify.music");
if (intent != null)
{
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
else
{
Toast.makeText(activity, R.string.service_spotify_missing_app, Toast.LENGTH_LONG).show();
}
return;
}
}
moveFrom = -1;
mediaFilter.setVisibility(false, true);
final State state = activity.getStateManager().getState();
if (state.protoType == ConnectionIf.ProtoType.DCP &&
selectedItem instanceof XmlListItemMsg)
{
state.storeSelectedDcpItem((XmlListItemMsg)selectedItem);
}
// #6: Unable to play music from NAS: allow to select not selectable items as well
updateTitle(state, true);
activity.getStateManager().sendMessage(selectedItem);
}
}
private boolean isMoveToValid(int messageId)
{
return moveFrom >= 0 && moveFrom != messageId;
}
private void setSelection(int i, int y_)
{
final ListView flv$ = listView;
final int position$ = i, y$ = y_;
flv$.post(() -> flv$.setSelectionFromTop(position$, y$ > 0 ? y$ : flv$.getHeight() / 2));
}
private void updateTitle(@NonNull final State state, boolean processing)
{
// Top menu button
{
final AppCompatImageButton cmdTopButton = rootView.findViewById(R.id.cmd_top_button);
setButtonEnabled(cmdTopButton, !state.isTopLayer());
final OperationCommandMsg msg = new OperationCommandMsg(OperationCommandMsg.Command.TOP);
prepareButtonListeners(cmdTopButton, msg, () -> setProgressIndicator(state, true));
}
final StringBuilder title = new StringBuilder();
final ReceiverInformationMsg.Selector selector = state.getActualSelector();
if (state.isSimpleInput())
{
if (selector != null && activity.getConfiguration().isFriendlyNames())
{
title.append(selector.getName());
}
else
{
title.append(activity.getResources().getString(state.inputType.getDescriptionId()));
}
if (state.isRadioInput())
{
title.append(" | ")
.append(activity.getResources().getString(R.string.medialist_items))
.append(": ").append(filteredItems);
}
else if (!state.title.isEmpty())
{
title.append(": ").append(state.title);
}
}
else if (state.isPlaybackMode() || state.isMenuMode())
{
title.append(state.title);
}
else if (state.inputType.isMediaList())
{
if (selector != null && state.isTopLayer() && activity.getConfiguration().isFriendlyNames())
{
title.append(selector.getName());
}
else if (state.titleBar.isEmpty() && state.serviceType != null && state.serviceType != ServiceType.UNKNOWN)
{
title.append(getString(state.serviceType.getDescriptionId()));
}
else
{
title.append(state.titleBar);
}
if (state.numberOfItems > 0)
{
if (title.length() > 0)
{
title.append(" | ");
}
title.append(activity.getResources().getString(R.string.medialist_items)).append(": ");
if (filteredItems != state.numberOfItems)
{
title.append(filteredItems).append("/");
}
title.append(state.numberOfItems);
}
}
else
{
title.append(state.titleBar);
if (title.length() > 0)
{
title.append(" | ");
}
title.append(activity.getResources().getString(R.string.medialist_no_items));
}
setTitleLayout(true);
titleBar.setTag("VISIBLE");
titleBar.setText(title.toString());
titleBar.setEnabled(!state.isTopLayer());
setProgressIndicator(state, state.inputType.isMediaList() && processing);
}
public boolean onBackPressed()
{
final StateManager stateManager = activity.getStateManager();
if (!activity.isConnected() || stateManager == null)
{
return false;
}
if (stateManager.getState().isTopLayer())
{
return false;
}
moveFrom = -1;
mediaFilter.setVisibility(false, true);
updateTitle(stateManager.getState(), true);
stateManager.sendMessage(activity.getStateManager().getReturnMessage());
return true;
}
private void setProgressIndicator(@Nullable final State state, boolean showProgress)
{
// Progress indicator
{
final AppCompatImageView btn = rootView.findViewById(R.id.progress_indicator);
btn.setVisibility(showProgress ? View.VISIBLE : View.GONE);
Utils.setImageViewColorAttr(activity, btn, R.attr.colorButtonDisabled);
}
// DCP Search button
{
final AppCompatImageButton btn = rootView.findViewById(R.id.cmd_search);
btn.setVisibility(View.GONE);
if (!showProgress && state != null && state.getDcpSearchCriteria() != null)
{
btn.setVisibility(View.VISIBLE);
prepareButtonListeners(btn, null, () -> {
final Dialogs d = new Dialogs(activity);
d.showDcpSearchDialog(state, () -> setProgressIndicator(state, true));
});
setButtonEnabled(btn, true);
}
}
// Filter button
{
final AppCompatImageButton btn = rootView.findViewById(R.id.cmd_filter);
btn.setVisibility(!showProgress && mediaFilter.isEnabled() ? View.VISIBLE : View.GONE);
if (btn.getVisibility() == View.VISIBLE)
{
prepareButtonListeners(btn, null, () ->
{
mediaFilter.setVisibility(!mediaFilter.isVisible(), false);
setTitleLayout(titleBar.getTag() != null);
});
setButtonEnabled(btn, true);
}
}
// Sort button
{
final AppCompatImageButton btn = rootView.findViewById(R.id.cmd_sort);
btn.setVisibility(View.GONE);
if (state != null && state.isOn())
{
final ReceiverInformationMsg.NetworkService networkService = state.getNetworkService();
final boolean sort = networkService != null && networkService.isSort();
if (!showProgress && sort)
{
btn.setVisibility(View.VISIBLE);
final OperationCommandMsg msg = new OperationCommandMsg(OperationCommandMsg.Command.SORT);
prepareButton(btn, msg, msg.getCommand().getImageId(), msg.getCommand().getDescriptionId());
setButtonEnabled(btn, true);
}
}
}
}
private void setTitleLayout(boolean titleVisible)
{
titleBar.setVisibility(!mediaFilter.isVisible() && titleVisible ? View.VISIBLE : View.GONE);
}
}
| 37,774 | Java | .java | mkulesh/onpc | 122 | 22 | 8 | 2018-10-13T13:24:13Z | 2024-05-05T19:04:17Z |
ParticleGenerator.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/vitox/ParticleGenerator.java | package net.vitox;
import net.minecraft.client.Minecraft;
import net.vitox.particle.util.RenderUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Particle API This Api is free2use But u have to mention me.
*
* @author Vitox
* @version 3.0
*/
public class ParticleGenerator {
private final List<Particle> particles = new ArrayList<>();
private final int amount;
private int prevWidth;
private int prevHeight;
public ParticleGenerator(final int amount) {
this.amount = amount;
}
public void draw(final int mouseX, final int mouseY) {
if(particles.isEmpty() || prevWidth != Minecraft.getMinecraft().displayWidth || prevHeight != Minecraft.getMinecraft().displayHeight) {
particles.clear();
create();
}
prevWidth = Minecraft.getMinecraft().displayWidth;
prevHeight = Minecraft.getMinecraft().displayHeight;
for(final Particle particle : particles) {
particle.fall();
particle.interpolation();
int range = 50;
final boolean mouseOver = (mouseX >= particle.x - range) && (mouseY >= particle.y - range) && (mouseX <= particle.x + range) && (mouseY <= particle.y + range);
if(mouseOver) {
particles.stream()
.filter(part -> (part.getX() > particle.getX() && part.getX() - particle.getX() < range
&& particle.getX() - part.getX() < range)
&& (part.getY() > particle.getY() && part.getY() - particle.getY() < range
|| particle.getY() > part.getY() && particle.getY() - part.getY() < range))
.forEach(connectable -> particle.connect(connectable.getX(), connectable.getY()));
}
RenderUtils.drawCircle(particle.getX(), particle.getY(), particle.size, 0xffFFFFFF);
}
}
public void draw2(final int mouseX, final int mouseY) {
if(particles.isEmpty() || prevWidth != Minecraft.getMinecraft().displayWidth || prevHeight != Minecraft.getMinecraft().displayHeight) {
particles.clear();
create();
}
prevWidth = Minecraft.getMinecraft().displayWidth;
prevHeight = Minecraft.getMinecraft().displayHeight;
for(final Particle particle : particles) {
particle.fall2();
particle.interpolation();
int range = 50;
final boolean mouseOver = (mouseX >= particle.x - range) && (mouseY >= particle.y - range) && (mouseX <= particle.x + range) && (mouseY <= particle.y + range);
if(mouseOver) {
particles.stream()
.filter(part -> (part.getX() > particle.getX() && part.getX() - particle.getX() < range
&& particle.getX() - part.getX() < range)
&& (part.getY() > particle.getY() && part.getY() - particle.getY() < range
|| particle.getY() > part.getY() && particle.getY() - part.getY() < range))
.forEach(connectable -> particle.connect(connectable.getX(), connectable.getY()));
}
RenderUtils.drawCircle(particle.getX(), particle.getY(), particle.size, 0xffFFFFFF);
}
}
private void create() {
final Random random = new Random();
for(int i = 0; i < amount; i++)
particles.add(new Particle(random.nextInt(Minecraft.getMinecraft().displayWidth), random.nextInt(Minecraft.getMinecraft().displayHeight)));
}
} | 3,653 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Particle.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/vitox/Particle.java | package net.vitox;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.vitox.particle.util.RenderUtils;
import java.util.Random;
/**
* Particle API
* This Api is free2use
* But u have to mention me.
*
* @author Vitox
* @version 3.0
*/
class Particle {
public float x;
public float y;
public final float size;
private final float ySpeed = new Random().nextInt(5);
private final float xSpeed = new Random().nextInt(5);
private int height;
private int width;
Particle(int x, int y) {
this.x = x;
this.y = y;
this.size = genRandom();
}
private float lint1(float f) {
return ((float) 1.02 * (1.0f - f)) + ((float) 1.0 * f);
}
private float lint2(float f) {
return (float) 1.02 + f * ((float) 1.0 - (float) 1.02);
}
void connect(float x, float y) {
RenderUtils.connectPoints(getX(), getY(), x, y);
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public float getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
void interpolation() {
for(int n = 0; n <= 64; ++n) {
final float f = n / 64.0f;
final float p1 = lint1(f);
final float p2 = lint2(f);
if(p1 != p2) {
y -= f;
x -= f;
}
}
}
void fall() {
final Minecraft mc = Minecraft.getMinecraft();
final ScaledResolution scaledResolution = new ScaledResolution(mc);
y = (y + ySpeed);
x = (x + xSpeed);
if(y > mc.displayHeight)
y = 1;
if(x > mc.displayWidth)
x = 1;
if(x < 1)
x = scaledResolution.getScaledWidth();
if(y < 1)
y = scaledResolution.getScaledHeight();
}
void fall2() {
final Minecraft mc = Minecraft.getMinecraft();
final ScaledResolution scaledResolution = new ScaledResolution(mc);
y = (y + ySpeed);
x = (x + xSpeed);
if(x > mc.displayWidth)
x = 1;
y -= 1;
if(x < 1)
x = scaledResolution.getScaledWidth();
y -= 1;
}
private float genRandom() {
return (float) (0.3f + Math.random() * (0.6f - 0.3f + 1.0F));
}
}
| 2,686 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
RenderUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/vitox/particle/util/RenderUtils.java | package net.vitox.particle.util;
import static org.lwjgl.opengl.GL11.*;
public class RenderUtils {
public static void connectPoints(float xOne, float yOne, float xTwo, float yTwo) {
glPushMatrix();
glEnable(GL_LINE_SMOOTH);
glColor4f(1.0F, 1.0F, 1.0F, 0.8F);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glLineWidth(0.5F);
glBegin(GL_LINES);
glVertex2f(xOne, yOne);
glVertex2f(xTwo, yTwo);
glEnd();
glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
glDisable(GL_LINE_SMOOTH);
glEnable(GL_TEXTURE_2D);
glPopMatrix();
}
public static void drawCircle(float x, float y, float radius, int color) {
float alpha = (color >> 24 & 0xFF) / 255.0F;
float red = (color >> 16 & 0xFF) / 255.0F;
float green = (color >> 8 & 0xFF) / 255.0F;
float blue = (color & 0xFF) / 255.0F;
glColor4f(red, green, blue, alpha);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glPushMatrix();
glLineWidth(1F);
glBegin(GL_POLYGON);
for(int i = 0; i <= 360; i++)
glVertex2d(x + Math.sin(i * Math.PI / 180.0D) * radius, y + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glPopMatrix();
glEnable(GL_TEXTURE_2D);
glDisable(GL_LINE_SMOOTH);
glColor4f(1F, 1F, 1F, 1F);
}
}
| 1,549 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
RotationUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/RotationUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.Listenable;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.event.TickEvent;
import net.ccbluex.liquidbounce.features.module.modules.combat.FastBow;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.Entity;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.util.*;
import org.jetbrains.annotations.NotNull;
import java.util.Random;
public final class RotationUtils extends MinecraftInstance implements Listenable {
private static Random random = new Random();
private static int keepLength;
public static Rotation targetRotation;
public static Rotation serverRotation = new Rotation(0F, 0F);
public static boolean keepCurrentRotation = false;
private static double x = random.nextDouble();
private static double y = random.nextDouble();
private static double z = random.nextDouble();
/**
* @author aquavit
*
* epic skid moment
*/
public static Rotation OtherRotation(final AxisAlignedBB bb,final Vec3 vec, final boolean predict,final boolean throughWalls, final float distance) {
final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY +
mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);
final Vec3 eyes = mc.thePlayer.getPositionEyes(1F);
VecRotation vecRotation = null;
for(double xSearch = 0.15D; xSearch < 0.85D; xSearch += 0.1D) {
for (double ySearch = 0.15D; ySearch < 1D; ySearch += 0.1D) {
for (double zSearch = 0.15D; zSearch < 0.85D; zSearch += 0.1D) {
final Vec3 vec3 = new Vec3(bb.minX + (bb.maxX - bb.minX) * xSearch,
bb.minY + (bb.maxY - bb.minY) * ySearch, bb.minZ + (bb.maxZ - bb.minZ) * zSearch);
final Rotation rotation = toRotation(vec3, predict);
final double vecDist = eyes.distanceTo(vec3);
if (vecDist > distance)
continue;
if(throughWalls || isVisible(vec3)) {
final VecRotation currentVec = new VecRotation(vec3, rotation);
if (vecRotation == null)
vecRotation = currentVec;
}
}
}
}
if(predict) eyesPos.addVector(mc.thePlayer.motionX, mc.thePlayer.motionY, mc.thePlayer.motionZ);
final double diffX = vec.xCoord - eyesPos.xCoord;
final double diffY = vec.yCoord - eyesPos.yCoord;
final double diffZ = vec.zCoord - eyesPos.zCoord;
return new Rotation(MathHelper.wrapAngleTo180_float(
(float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F
), MathHelper.wrapAngleTo180_float(
(float) (-Math.toDegrees(Math.atan2(diffY, Math.sqrt(diffX * diffX + diffZ * diffZ))))
));
}
/**
* Face block
*
* @param blockPos target block
*/
public static VecRotation faceBlock(final BlockPos blockPos) {
if (blockPos == null)
return null;
VecRotation vecRotation = null;
for(double xSearch = 0.1D; xSearch < 0.9D; xSearch += 0.1D) {
for(double ySearch = 0.1D; ySearch < 0.9D; ySearch += 0.1D) {
for (double zSearch = 0.1D; zSearch < 0.9D; zSearch += 0.1D) {
final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY + mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);
final Vec3 posVec = new Vec3(blockPos).addVector(xSearch, ySearch, zSearch);
final double dist = eyesPos.distanceTo(posVec);
final double diffX = posVec.xCoord - eyesPos.xCoord;
final double diffY = posVec.yCoord - eyesPos.yCoord;
final double diffZ = posVec.zCoord - eyesPos.zCoord;
final double diffXZ = MathHelper.sqrt_double(diffX * diffX + diffZ * diffZ);
final Rotation rotation = new Rotation(
MathHelper.wrapAngleTo180_float((float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F),
MathHelper.wrapAngleTo180_float((float) -Math.toDegrees(Math.atan2(diffY, diffXZ)))
);
final Vec3 rotationVector = getVectorForRotation(rotation);
final Vec3 vector = eyesPos.addVector(rotationVector.xCoord * dist, rotationVector.yCoord * dist,
rotationVector.zCoord * dist);
final MovingObjectPosition obj = mc.theWorld.rayTraceBlocks(eyesPos, vector, false,
false, true);
if (obj.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
final VecRotation currentVec = new VecRotation(posVec, rotation);
if (vecRotation == null || getRotationDifference(currentVec.getRotation()) < getRotationDifference(vecRotation.getRotation()))
vecRotation = currentVec;
}
}
}
}
return vecRotation;
}
/**
* Face target with bow
*
* @param target your enemy
* @param silent client side rotations
* @param predict predict new enemy position
* @param predictSize predict size of predict
*/
public static void faceBow(final Entity target, final boolean silent, final boolean predict, final float predictSize) {
final EntityPlayerSP player = mc.thePlayer;
final double posX = target.posX + (predict ? (target.posX - target.prevPosX) * predictSize : 0) - (player.posX + (predict ? (player.posX - player.prevPosX) : 0));
final double posY = target.getEntityBoundingBox().minY + (predict ? (target.getEntityBoundingBox().minY - target.prevPosY) * predictSize : 0) + target.getEyeHeight() - 0.15 - (player.getEntityBoundingBox().minY + (predict ? (player.posY - player.prevPosY) : 0)) - player.getEyeHeight();
final double posZ = target.posZ + (predict ? (target.posZ - target.prevPosZ) * predictSize : 0) - (player.posZ + (predict ? (player.posZ - player.prevPosZ) : 0));
final double posSqrt = Math.sqrt(posX * posX + posZ * posZ);
float velocity = LiquidBounce.moduleManager.getModule(FastBow.class).getState() ? 1F : player.getItemInUseDuration() / 20F;
velocity = (velocity * velocity + velocity * 2) / 3;
if(velocity > 1) velocity = 1;
final Rotation rotation = new Rotation(
(float) (Math.atan2(posZ, posX) * 180 / Math.PI) - 90,
(float) -Math.toDegrees(Math.atan((velocity * velocity - Math.sqrt(velocity * velocity * velocity * velocity - 0.006F * (0.006F * (posSqrt * posSqrt) + 2 * posY * (velocity * velocity)))) / (0.006F * posSqrt)))
);
if(silent)
setTargetRotation(rotation);
else
limitAngleChange(new Rotation(player.rotationYaw, player.rotationPitch), rotation,10 +
new Random().nextInt(6)).toPlayer(mc.thePlayer);
}
/**
* Translate vec to rotation
*
* @param vec target vec
* @param predict predict new location of your body
* @return rotation
*/
public static Rotation toRotation(final Vec3 vec, final boolean predict) {
final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY +
mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);
if(predict) eyesPos.addVector(mc.thePlayer.motionX, mc.thePlayer.motionY, mc.thePlayer.motionZ);
final double diffX = vec.xCoord - eyesPos.xCoord;
final double diffY = vec.yCoord - eyesPos.yCoord;
final double diffZ = vec.zCoord - eyesPos.zCoord;
return new Rotation(MathHelper.wrapAngleTo180_float(
(float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F
), MathHelper.wrapAngleTo180_float(
(float) (-Math.toDegrees(Math.atan2(diffY, Math.sqrt(diffX * diffX + diffZ * diffZ))))
));
}
public static Rotation toDownRotation(final Vec3 vec, final boolean predict) {
final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, 90, mc.thePlayer.posZ);
if(predict) eyesPos.addVector(mc.thePlayer.motionX, mc.thePlayer.motionY, mc.thePlayer.motionZ);
final double diffX = vec.xCoord - eyesPos.xCoord;
final double diffY = vec.yCoord - eyesPos.yCoord;
final double diffZ = vec.zCoord - eyesPos.zCoord;
return new Rotation(MathHelper.wrapAngleTo180_float(
(float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F
), MathHelper.wrapAngleTo180_float(
(float) (-Math.toDegrees(Math.atan2(diffY, Math.sqrt(diffX * diffX + diffZ * diffZ))))
));
}
/**
* Get the center of a box
*
* @param bb your box
* @return center of box
*/
public static Vec3 getCenter(final AxisAlignedBB bb) {
return new Vec3(bb.minX + (bb.maxX - bb.minX) * 0.5, bb.minY + (bb.maxY - bb.minY) * 0.5, bb.minZ + (bb.maxZ - bb.minZ) * 0.5);
}
public static VecRotation searchCenter(final AxisAlignedBB bb, final boolean outborder, final boolean random,
final boolean predict, final boolean throughWalls, final float distance) {
return searchCenter(bb, outborder, random, predict, throughWalls, distance, 0F, false);
}
public static float roundRotation(float yaw, int strength) {
return (int) Math.round(yaw / strength) * strength;
}
/**
* Search good center
*
* @param bb enemy box
* @param outborder outborder option
* @param random random option
* @param predict predict option
* @param throughWalls throughWalls option
* @return center
*/
public static VecRotation searchCenter(final AxisAlignedBB bb, final boolean outborder, final boolean random,
final boolean predict, final boolean throughWalls, final float distance, final float randomMultiply, final boolean newRandom) {
if(outborder) {
final Vec3 vec3 = new Vec3(bb.minX + (bb.maxX - bb.minX) * (x * 0.3 + 1.0), bb.minY + (bb.maxY - bb.minY) * (y * 0.3 + 1.0), bb.minZ + (bb.maxZ - bb.minZ) * (z * 0.3 + 1.0));
return new VecRotation(vec3, toRotation(vec3, predict));
}
final Vec3 randomVec = new Vec3(bb.minX + (bb.maxX - bb.minX) * x * randomMultiply * (newRandom ? Math.random() : 1), bb.minY + (bb.maxY - bb.minY) * y * randomMultiply * (newRandom ? Math.random() : 1), bb.minZ + (bb.maxZ - bb.minZ) * z * randomMultiply * (newRandom ? Math.random() : 1));
final Rotation randomRotation = toRotation(randomVec, predict);
final Vec3 eyes = mc.thePlayer.getPositionEyes(1F);
VecRotation vecRotation = null;
for(double xSearch = 0.15D; xSearch < 0.85D; xSearch += 0.1D) {
for (double ySearch = 0.15D; ySearch < 1D; ySearch += 0.1D) {
for (double zSearch = 0.15D; zSearch < 0.85D; zSearch += 0.1D) {
final Vec3 vec3 = new Vec3(bb.minX + (bb.maxX - bb.minX) * xSearch,
bb.minY + (bb.maxY - bb.minY) * ySearch, bb.minZ + (bb.maxZ - bb.minZ) * zSearch);
final Rotation rotation = toRotation(vec3, predict);
final double vecDist = eyes.distanceTo(vec3);
if (vecDist > distance)
continue;
if(throughWalls || isVisible(vec3)) {
final VecRotation currentVec = new VecRotation(vec3, rotation);
if (vecRotation == null || (random ? getRotationDifference(currentVec.getRotation(), randomRotation) < getRotationDifference(vecRotation.getRotation(), randomRotation) : getRotationDifference(currentVec.getRotation()) < getRotationDifference(vecRotation.getRotation())))
vecRotation = currentVec;
}
}
}
}
return vecRotation;
}
public static VecRotation downRot(final AxisAlignedBB bb, final boolean outborder, final boolean random,
final boolean predict, final boolean throughWalls, final float distance, final float randomMultiply, final boolean newRandom) {
if(outborder) {
final Vec3 vec3 = new Vec3(bb.minX + (bb.maxX - bb.minX) * (x * 0.3 + 1.0), bb.minY + (bb.maxY - bb.minY) * (y * 0.3 + 1.0), bb.minZ + (bb.maxZ - bb.minZ) * (z * 0.3 + 1.0));
return new VecRotation(vec3, toRotation(vec3, predict));
}
final Vec3 randomVec = new Vec3(bb.minX + (bb.maxX - bb.minX) * x * randomMultiply * (newRandom ? Math.random() : 1), bb.minY + (bb.maxY - bb.minY) * y * randomMultiply * (newRandom ? Math.random() : 1), bb.minZ + (bb.maxZ - bb.minZ) * z * randomMultiply * (newRandom ? Math.random() : 1));
final Rotation randomRotation = toRotation(randomVec, predict);
final Vec3 eyes = mc.thePlayer.getPositionEyes(1F);
VecRotation vecRotation = null;
for(double xSearch = 0.15D; xSearch < 0.85D; xSearch += 0.1D) {
for (double ySearch = 0.15D; ySearch < 1D; ySearch += 0.1D) {
for (double zSearch = 0.15D; zSearch < 0.85D; zSearch += 0.1D) {
final Vec3 vec3 = new Vec3(bb.minX + (bb.maxX - bb.minX) * xSearch,
bb.minY + (bb.maxY - bb.minY) * ySearch, bb.minZ + (bb.maxZ - bb.minZ) * zSearch);
final Rotation rotation = toDownRotation(vec3, predict);
final double vecDist = eyes.distanceTo(vec3);
if (vecDist > distance)
continue;
if(throughWalls || isVisible(vec3)) {
final VecRotation currentVec = new VecRotation(vec3, rotation);
if (vecRotation == null || (random ? getRotationDifference(currentVec.getRotation(), randomRotation) < getRotationDifference(vecRotation.getRotation(), randomRotation) : getRotationDifference(currentVec.getRotation()) < getRotationDifference(vecRotation.getRotation())))
vecRotation = currentVec;
}
}
}
}
return vecRotation;
}
/**
* Calculate difference between the client rotation and your entity
*
* @param entity your entity
* @return difference between rotation
*/
public static double getRotationDifference(final Entity entity) {
final Rotation rotation = toRotation(getCenter(entity.getEntityBoundingBox()), true);
return getRotationDifference(rotation, new Rotation(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch));
}
/**
* Calculate difference between the client rotation and your entity's back
*
* @param entity your entity
* @return difference between rotation
*/
public static double getRotationBackDifference(final Entity entity) {
final Rotation rotation = toRotation(getCenter(entity.getEntityBoundingBox()), true);
return getRotationDifference(rotation, new Rotation(mc.thePlayer.rotationYaw - 180, mc.thePlayer.rotationPitch));
}
/**
* Calculate difference between the server rotation and your rotation
*
* @param rotation your rotation
* @return difference between rotation
*/
public static double getRotationDifference(final Rotation rotation) {
return serverRotation == null ? 0D : getRotationDifference(rotation, serverRotation);
}
/**
* Calculate difference between two rotations
*
* @param a rotation
* @param b rotation
* @return difference between rotation
*/
public static double getRotationDifference(final Rotation a, final Rotation b) {
return Math.hypot(getAngleDifference(a.getYaw(), b.getYaw()), a.getPitch() - b.getPitch());
}
/**
* Limit your rotation using a turn speed
*
* @param currentRotation your current rotation
* @param targetRotation your goal rotation
* @param turnSpeed your turn speed
* @return limited rotation
*/
@NotNull
public static Rotation limitAngleChange(final Rotation currentRotation, final Rotation targetRotation, final float turnSpeed) {
final float yawDifference = getAngleDifference(targetRotation.getYaw(), currentRotation.getYaw());
final float pitchDifference = getAngleDifference(targetRotation.getPitch(), currentRotation.getPitch());
return new Rotation(
currentRotation.getYaw() + (yawDifference > turnSpeed ? turnSpeed : Math.max(yawDifference, -turnSpeed)),
currentRotation.getPitch() + (pitchDifference > turnSpeed ? turnSpeed : Math.max(pitchDifference, -turnSpeed)
));
}
/**
* Calculate difference between two angle points
*
* @param a angle point
* @param b angle point
* @return difference between angle points
*/
private static float getAngleDifference(final float a, final float b) {
return ((((a - b) % 360F) + 540F) % 360F) - 180F;
}
/**
* Calculate rotation to vector
*
* @param rotation your rotation
* @return target vector
*/
public static Vec3 getVectorForRotation(final Rotation rotation) {
float yawCos = MathHelper.cos(-rotation.getYaw() * 0.017453292F - (float) Math.PI);
float yawSin = MathHelper.sin(-rotation.getYaw() * 0.017453292F - (float) Math.PI);
float pitchCos = -MathHelper.cos(-rotation.getPitch() * 0.017453292F);
float pitchSin = MathHelper.sin(-rotation.getPitch() * 0.017453292F);
return new Vec3(yawSin * pitchCos, pitchSin, yawCos * pitchCos);
}
/**
* Allows you to check if your crosshair is over your target entity
*
* @param targetEntity your target entity
* @param blockReachDistance your reach
* @return if crosshair is over target
*/
public static boolean isFaced(final Entity targetEntity, double blockReachDistance) {
return RaycastUtils.raycastEntity(blockReachDistance, entity -> entity == targetEntity) != null;
}
/**
* Allows you to check if your enemy is behind a wall
*/
public static boolean isVisible(final Vec3 vec3) {
final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY + mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);
return mc.theWorld.rayTraceBlocks(eyesPos, vec3) == null;
}
/**
* Handle minecraft tick
*
* @param event Tick event
*/
@EventTarget
public void onTick(final TickEvent event) {
if(targetRotation != null) {
keepLength--;
if (keepLength <= 0)
reset();
}
if(random.nextGaussian() > 0.8D) x = Math.random();
if(random.nextGaussian() > 0.8D) y = Math.random();
if(random.nextGaussian() > 0.8D) z = Math.random();
}
/**
* Handle packet
*
* @param event Packet Event
*/
@EventTarget
public void onPacket(final PacketEvent event) {
final Packet<?> packet = event.getPacket();
if(packet instanceof C03PacketPlayer) {
final C03PacketPlayer packetPlayer = (C03PacketPlayer) packet;
if(targetRotation != null && !keepCurrentRotation && (targetRotation.getYaw() != serverRotation.getYaw() || targetRotation.getPitch() != serverRotation.getPitch())) {
packetPlayer.yaw = targetRotation.getYaw();
packetPlayer.pitch = targetRotation.getPitch();
packetPlayer.rotating = true;
}
if(packetPlayer.rotating) serverRotation = new Rotation(packetPlayer.yaw, packetPlayer.pitch);
}
}
/**
* Set your target rotation
*
* @param rotation your target rotation
*/
public static void setTargetRotation(final Rotation rotation) {
setTargetRotation(rotation, 0);
}
/**
* Set your target rotation
*
* @param rotation your target rotation
*/
public static void setTargetRotation(final Rotation rotation, final int keepLength) {
if(Double.isNaN(rotation.getYaw()) || Double.isNaN(rotation.getPitch())
|| rotation.getPitch() > 90 || rotation.getPitch() < -90)
return;
rotation.fixedSensitivity(mc.gameSettings.mouseSensitivity);
targetRotation = rotation;
RotationUtils.keepLength = keepLength;
}
/**
* Reset your target rotation
*/
public static void reset() {
keepLength = 0;
targetRotation = null;
}
public static Rotation getRotationsEntity(EntityLivingBase entity) {
return RotationUtils.getRotations(entity.posX, entity.posY + entity.getEyeHeight() - 0.4, entity.posZ);
}
public static Rotation getRotations(Entity ent) {
double x = ent.posX;
double z = ent.posZ;
double y = ent.posY + (double)(ent.getEyeHeight() / 2.0f);
return RotationUtils.getRotationFromPosition(x, z, y);
}
public static Rotation getRotations(double posX, double posY, double posZ) {
EntityPlayerSP player = RotationUtils.mc.thePlayer;
double x = posX - player.posX;
double y = posY - (player.posY + (double)player.getEyeHeight());
double z = posZ - player.posZ;
double dist = MathHelper.sqrt_double(x * x + z * z);
float yaw = (float)(Math.atan2(z, x) * 180.0 / 3.141592653589793) - 90.0f;
float pitch = (float)(-(Math.atan2(y, dist) * 180.0 / 3.141592653589793));
return new Rotation(yaw,pitch);
}
public static Rotation getRotationFromPosition(double x, double z, double y) {
double xDiff = x - mc.thePlayer.posX;
double zDiff = z - mc.thePlayer.posZ;
double yDiff = y - mc.thePlayer.posY - 1.2;
double dist = MathHelper.sqrt_double(xDiff * xDiff + zDiff * zDiff);
float yaw = (float)(Math.atan2(zDiff, xDiff) * 180.0 / Math.PI) - 90.0f;
float pitch = (float)(- Math.atan2(yDiff, dist) * 180.0 / Math.PI);
return new Rotation(yaw,pitch);
}
/**
* @return YESSSS!!!
*/
@Override
public boolean handleEvents() {
return true;
}
}
| 23,064 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
RollingArrayLongBuffer.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/RollingArrayLongBuffer.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
/**
* A buffer which stores it's contents in an array.
* You can only add contents to it. If you add more elements than it can hold it will overflow and
* overwrite the first element. Made to improve performance for time measurements.
*
* @author superblaubeere27
*/
public class RollingArrayLongBuffer {
private final long[] contents;
private int currentIndex = 0;
public RollingArrayLongBuffer(int length) {
this.contents = new long[length];
}
/**
* @return The contents of the buffer
*/
public long[] getContents() {
return contents;
}
/**
* Adds an element to the buffer
*
* @param l The element to be added
*/
public void add(long l) {
currentIndex = (currentIndex + 1) % contents.length;
contents[currentIndex] = l;
}
/**
* Gets the count of elements added in a row
* which are higher than l
*
* @param l The threshold timestamp
* @return The count
*/
public int getTimestampsSince(long l) {
for (int i = 0; i < contents.length; i++) {
if (contents[currentIndex < i ? contents.length - i + currentIndex : currentIndex - i] < l) {
return i;
}
}
// If every element is lower than l, return the array length
return contents.length;
}
}
| 1,596 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
MovementUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/MovementUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.modules.movement.TargetStrafe;
import net.ccbluex.liquidbounce.utils.RotationUtils;
import net.ccbluex.liquidbounce.event.MoveEvent;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.stats.StatList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
public final class MovementUtils extends MinecraftInstance {
private static double lastX = -999999.0;
private static double lastZ = -999999.0;
public static float getSpeed() {
return (float) getSpeed(mc.thePlayer.motionX, mc.thePlayer.motionZ);
}
public static double getSpeed(double motionX, double motionZ) {
return Math.sqrt(motionX * motionX + motionZ * motionZ);
}
public static boolean isOnIce() {
final EntityPlayerSP player = mc.thePlayer;
final Block blockUnder = mc.theWorld.getBlockState(new BlockPos(player.posX, player.posY - 1.0, player.posZ)).getBlock();
return blockUnder instanceof BlockIce || blockUnder instanceof BlockPackedIce;
}
public static boolean isBlockUnder() {
if (mc.thePlayer == null) return false;
if (mc.thePlayer.posY < 0.0) {
return false;
}
for (int off = 0; off < (int)mc.thePlayer.posY + 2; off += 2) {
final AxisAlignedBB bb = mc.thePlayer.getEntityBoundingBox().offset(0.0, (double)(-off), 0.0);
if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, bb).isEmpty()) {
return true;
}
}
return false;
}
public static void accelerate() {
accelerate(getSpeed());
}
public static void accelerate(final float speed) {
if(!isMoving())
return;
final double yaw = getDirection();
mc.thePlayer.motionX += -Math.sin(yaw) * speed;
mc.thePlayer.motionZ += Math.cos(yaw) * speed;
}
public static void strafe() {
strafe(getSpeed());
}
public static boolean isMoving() {
return mc.thePlayer != null && (mc.thePlayer.movementInput.moveForward != 0F || mc.thePlayer.movementInput.moveStrafe != 0F);
}
public static boolean hasMotion() {
return mc.thePlayer.motionX != 0D && mc.thePlayer.motionZ != 0D && mc.thePlayer.motionY != 0D;
}
public static void strafe(final float speed) {
if(!isMoving())
return;
final double yaw = getDirection();
mc.thePlayer.motionX = -Math.sin(yaw) * speed;
mc.thePlayer.motionZ = Math.cos(yaw) * speed;
}
public static void strafeCustom(final float speed, final float cYaw, final float strafe, final float forward) {
if(!isMoving())
return;
final double yaw = getDirectionRotation(cYaw, strafe, forward);
mc.thePlayer.motionX = -Math.sin(yaw) * speed;
mc.thePlayer.motionZ = Math.cos(yaw) * speed;
}
public static void forward(final double length) {
final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);
mc.thePlayer.setPosition(mc.thePlayer.posX + (-Math.sin(yaw) * length), mc.thePlayer.posY, mc.thePlayer.posZ + (Math.cos(yaw) * length));
}
public static double getDirection() {
final TargetStrafe ts = LiquidBounce.moduleManager.getModule(TargetStrafe.class);
return ts.getCanStrafe() ? ts.getMovingDir() : getDirectionRotation(mc.thePlayer.rotationYaw, mc.thePlayer.moveStrafing, mc.thePlayer.moveForward);
}
public static float getRawDirection() {
return getRawDirectionRotation(mc.thePlayer.rotationYaw, mc.thePlayer.moveStrafing, mc.thePlayer.moveForward);
}
public static float getRawDirection(float yaw) {
return getRawDirectionRotation(yaw, mc.thePlayer.moveStrafing, mc.thePlayer.moveForward);
}
public static double[] getXZDist(float speed, float cYaw) {
double[] arr = new double[2];
final double yaw = getDirectionRotation(cYaw, mc.thePlayer.moveStrafing, mc.thePlayer.moveForward);
arr[0] = -Math.sin(yaw) * speed;
arr[1] = Math.cos(yaw) * speed;
return arr;
}
public static float getPredictionYaw(double x, double z) {
if (mc.thePlayer == null) {
lastX = -999999.0;
lastZ = -999999.0;
return 0F;
}
if (lastX == -999999.0)
lastX = mc.thePlayer.prevPosX;
if (lastZ == -999999.0)
lastZ = mc.thePlayer.prevPosZ;
float returnValue = (float) (Math.atan2(z - lastZ, x - lastX) * 180F / Math.PI);
lastX = x;
lastZ = z;
return returnValue;
}
public static double getDirectionRotation(float yaw, float pStrafe, float pForward) {
float rotationYaw = yaw;
if(pForward < 0F)
rotationYaw += 180F;
float forward = 1F;
if(pForward < 0F)
forward = -0.5F;
else if(pForward > 0F)
forward = 0.5F;
if(pStrafe > 0F)
rotationYaw -= 90F * forward;
if(pStrafe < 0F)
rotationYaw += 90F * forward;
return Math.toRadians(rotationYaw);
}
public static float getRawDirectionRotation(float yaw, float pStrafe, float pForward) {
float rotationYaw = yaw;
if(pForward < 0F)
rotationYaw += 180F;
float forward = 1F;
if(pForward < 0F)
forward = -0.5F;
else if(pForward > 0F)
forward = 0.5F;
if(pStrafe > 0F)
rotationYaw -= 90F * forward;
if(pStrafe < 0F)
rotationYaw += 90F * forward;
return rotationYaw;
}
public static float getScaffoldRotation(float yaw, float strafe) {
float rotationYaw = yaw;
rotationYaw += 180F;
float forward = -0.5F;
if(strafe < 0F)
rotationYaw -= 90F * forward;
if(strafe > 0F)
rotationYaw += 90F * forward;
return rotationYaw;
}
public static int getJumpEffect() {
return mc.thePlayer.isPotionActive(Potion.jump) ? mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1 : 0;
}
public static int getSpeedEffect() {
return mc.thePlayer.isPotionActive(Potion.moveSpeed) ? mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1 : 0;
}
public static double getBaseMoveSpeed() {
double baseSpeed = 0.2873D;
if (mc.thePlayer.isPotionActive(Potion.moveSpeed)) {
baseSpeed *= 1.0D + 0.2D * (double)(mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1);
}
return baseSpeed;
}
public static double getBaseMoveSpeed(double customSpeed) {
double baseSpeed = isOnIce() ? 0.258977700006 : customSpeed;
if (mc.thePlayer.isPotionActive(Potion.moveSpeed)) {
int amplifier = mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier();
baseSpeed *= 1.0 + 0.2 * (amplifier + 1);
}
return baseSpeed;
}
public static double getJumpBoostModifier(double baseJumpHeight) {
return getJumpBoostModifier(baseJumpHeight, true);
}
public static double getJumpBoostModifier(double baseJumpHeight, boolean potionJump) {
if (mc.thePlayer.isPotionActive(Potion.jump) && potionJump) {
int amplifier = mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier();
baseJumpHeight += ((float)(amplifier + 1) * 0.1f);
}
return baseJumpHeight;
}
public static void setMotion(MoveEvent event, double speed, double motion, boolean smoothStrafe) {
double forward = mc.thePlayer.movementInput.moveForward;
double strafe = mc.thePlayer.movementInput.moveStrafe;
double yaw = mc.thePlayer.rotationYaw;
int direction = smoothStrafe ? 45 : 90;
if ((forward == 0.0) && (strafe == 0.0)) {
event.setX(0.0);
event.setZ(0.0);
} else {
if (forward != 0.0) {
if (strafe > 0.0) {
yaw += (forward > 0.0 ? -direction : direction);
} else if (strafe < 0.0) {
yaw += (forward > 0.0 ? direction : -direction);
}
strafe = 0.0;
if (forward > 0.0) {
forward = 1.0;
} else if (forward < 0.0) {
forward = -1.0;
}
}
double cos = Math.cos(Math.toRadians(yaw + 90.0f));
double sin = Math.sin(Math.toRadians(yaw + 90.0f));
event.setX((forward * speed * cos + strafe * speed * sin) * motion);
event.setZ((forward * speed * sin - strafe * speed * cos) * motion);
}
}
public static void setMotion(double speed, boolean smoothStrafe) {
double forward = mc.thePlayer.movementInput.moveForward;
double strafe = mc.thePlayer.movementInput.moveStrafe;
float yaw = mc.thePlayer.rotationYaw;
int direction = smoothStrafe ? 45 : 90;
if (forward == 0.0 && strafe == 0.0) {
mc.thePlayer.motionX = 0.0;
mc.thePlayer.motionZ = 0.0;
} else {
if (forward != 0.0) {
if (strafe > 0.0) {
yaw += (float)(forward > 0.0 ? -direction : direction);
} else if (strafe < 0.0) {
yaw += (float)(forward > 0.0 ? direction : -direction);
}
strafe = 0.0;
if (forward > 0.0) {
forward = 1.0;
} else if (forward < 0.0) {
forward = -1.0;
}
}
mc.thePlayer.motionX = forward * speed * (- Math.sin(Math.toRadians(yaw))) + strafe * speed * Math.cos(Math.toRadians(yaw));
mc.thePlayer.motionZ = forward * speed * Math.cos(Math.toRadians(yaw)) - strafe * speed * (- Math.sin(Math.toRadians(yaw)));
}
}
public static void setSpeed(MoveEvent moveEvent, double moveSpeed) {
setSpeed(moveEvent, moveSpeed, mc.thePlayer.rotationYaw, (double)mc.thePlayer.movementInput.moveStrafe, (double)mc.thePlayer.movementInput.moveForward);
}
public static void setSpeed(final MoveEvent moveEvent, final double moveSpeed, final float pseudoYaw, final double pseudoStrafe, final double pseudoForward) {
double forward = pseudoForward;
double strafe = pseudoStrafe;
float yaw = pseudoYaw;
if (forward == 0.0 && strafe == 0.0) {
moveEvent.setZ(0);
moveEvent.setX(0);
} else {
if (forward != 0.0) {
if (strafe > 0.0) {
yaw += ((forward > 0.0) ? -45 : 45);
} else if (strafe < 0.0) {
yaw += ((forward > 0.0) ? 45 : -45);
}
strafe = 0.0;
if (forward > 0.0) {
forward = 1.0;
} else if (forward < 0.0) {
forward = -1.0;
}
}
if (strafe > 0.0D) {
strafe = 1.0D;
} else if (strafe < 0.0D) {
strafe = -1.0D;
}
final double cos = Math.cos(Math.toRadians(yaw + 90.0f));
final double sin = Math.sin(Math.toRadians(yaw + 90.0f));
moveEvent.setX((forward * moveSpeed * cos + strafe * moveSpeed * sin));
moveEvent.setZ((forward * moveSpeed * sin - strafe * moveSpeed * cos));
}
}
}
| 12,189 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
PacketUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/PacketUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.Listenable;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.event.TickEvent;
import net.minecraft.network.Packet;
import net.minecraft.network.play.INetHandlerPlayServer;
import net.minecraft.network.play.server.S32PacketConfirmTransaction;
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
import java.util.ArrayList;
public class PacketUtils extends MinecraftInstance implements Listenable {
public static int inBound, outBound = 0;
public static int avgInBound, avgOutBound = 0;
private static ArrayList<Packet<INetHandlerPlayServer>> packets = new ArrayList<Packet<INetHandlerPlayServer>>();
private static MSTimer packetTimer = new MSTimer();
private static MSTimer wdTimer = new MSTimer();
private static int transCount = 0;
private static int wdVL = 0;
private static boolean isInventoryAction(short action) {
return action > 0 && action < 100;
}
public static boolean isWatchdogActive() {
return wdVL >= 8;
}
@EventTarget
public void onPacket(PacketEvent event) {
handlePacket(event.getPacket());
}
private static void handlePacket(Packet<?> packet) {
if (packet.getClass().getSimpleName().startsWith("C")) outBound++;
else if (packet.getClass().getSimpleName().startsWith("S")) inBound++;
if (packet instanceof S32PacketConfirmTransaction)
{
if (!isInventoryAction(((S32PacketConfirmTransaction) packet).getActionNumber()))
transCount++;
}
}
@EventTarget
public void onTick(TickEvent event) {
if (packetTimer.hasTimePassed(1000L)) {
avgInBound = inBound; avgOutBound = outBound;
inBound = outBound = 0;
packetTimer.reset();
}
if (mc.thePlayer == null || mc.theWorld == null) {
//reset all checks
wdVL = 0;
transCount = 0;
wdTimer.reset();
} else if (wdTimer.hasTimePassed(100L)) { // watchdog active when the transaction poll rate reaches about 100ms/packet.
wdVL += (transCount > 0) ? 1 : -1;
transCount = 0;
if (wdVL > 10) wdVL = 10;
if (wdVL < 0) wdVL = 0;
wdTimer.reset();
}
}
/*
* This code is from UnlegitMC/FDPClient. Please credit them when using this code in your repository.
*/
public static void sendPacketNoEvent(Packet<INetHandlerPlayServer> packet) {
packets.add(packet);
mc.getNetHandler().addToSendQueue(packet);
}
public static boolean handleSendPacket(Packet<?> packet) {
if (packets.contains(packet)) {
packets.remove(packet);
handlePacket(packet); // make sure not to skip silent packets.
return true;
}
return false;
}
/**
* @return wow
*/
@Override
public boolean handleEvents() {
return true;
}
}
| 3,302 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
PathUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/PathUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import javax.vecmath.Vector3d;
import java.util.ArrayList;
import java.util.List;
public final class PathUtils extends MinecraftInstance {
public static ArrayList<Vec3> findTeleportPath(EntityLivingBase current, EntityLivingBase target, final double dashDistance) {
double curX = current.posX;
double curY = current.posY;
double curZ = current.posZ;
double tpX = target.posX;
double tpY = target.posY;
double tpZ = target.posZ;
Vec3 topFrom = new Vec3(curX,curY,curZ);
Vec3 to = new Vec3(tpX,tpY,tpZ);
if (!canPassThrow(new BlockPos(topFrom))) {
topFrom = topFrom.addVector(0, 1, 0);
}
AStarCustomPathFinder pathfinder = new AStarCustomPathFinder(topFrom, to);
pathfinder.compute();
int i = 0;
Vec3 lastLoc = null;
Vec3 lastDashLoc = null;
ArrayList<Vec3> path = new ArrayList<>();
ArrayList<Vec3> pathFinderPath = pathfinder.getPath();
for (Vec3 pathElm : pathFinderPath) {
if (i == 0 || i == pathFinderPath.size() - 1) {
if (lastLoc != null) {
path.add(lastLoc.addVector(0.5, 0, 0.5));
}
path.add(pathElm.addVector(0.5, 0, 0.5));
lastDashLoc = pathElm;
} else {
boolean canContinue = true;
if (pathElm.squareDistanceTo(lastDashLoc) > dashDistance * dashDistance) {
canContinue = false;
} else {
double smallX = Math.min(lastDashLoc.xCoord, pathElm.xCoord);
double smallY = Math.min(lastDashLoc.yCoord, pathElm.yCoord);
double smallZ = Math.min(lastDashLoc.zCoord, pathElm.zCoord);
double bigX = Math.max(lastDashLoc.xCoord, pathElm.xCoord);
double bigY = Math.max(lastDashLoc.yCoord, pathElm.yCoord);
double bigZ = Math.max(lastDashLoc.zCoord, pathElm.zCoord);
cordsLoop:
for (int x = (int) smallX; x <= bigX; x++) {
for (int y = (int) smallY; y <= bigY; y++) {
for (int z = (int) smallZ; z <= bigZ; z++) {
if (!AStarCustomPathFinder.checkPositionValidity(x, y, z, false)) {
canContinue = false;
break cordsLoop;
}
}
}
}
}
if (!canContinue) {
path.add(lastLoc.addVector(0.5, 0, 0.5));
lastDashLoc = lastLoc;
}
}
lastLoc = pathElm;
i++;
}
return path;
}
private static boolean canPassThrow(BlockPos pos) {
Block block = Minecraft.getMinecraft().theWorld.getBlockState(new net.minecraft.util.BlockPos(pos.getX(), pos.getY(), pos.getZ())).getBlock();
return block.getMaterial() == Material.air || block.getMaterial() == Material.plants || block.getMaterial() == Material.vine || block == Blocks.ladder || block == Blocks.water || block == Blocks.flowing_water || block == Blocks.wall_sign || block == Blocks.standing_sign;
}
public static List<Vector3d> findBlinkPath(final double tpX, final double tpY, final double tpZ) {
final List<Vector3d> positions = new ArrayList<>();
double curX = mc.thePlayer.posX;
double curY = mc.thePlayer.posY;
double curZ = mc.thePlayer.posZ;
double distance = Math.abs(curX - tpX) + Math.abs(curY - tpY) + Math.abs(curZ - tpZ);
for (int count = 0; distance > 0.0D; count++) {
distance = Math.abs(curX - tpX) + Math.abs(curY - tpY) + Math.abs(curZ - tpZ);
final double diffX = curX - tpX;
final double diffY = curY - tpY;
final double diffZ = curZ - tpZ;
final double offset = (count & 1) == 0 ? 0.4D : 0.1D;
final double minX = Math.min(Math.abs(diffX), offset);
if (diffX < 0.0D) curX += minX;
if (diffX > 0.0D) curX -= minX;
final double minY = Math.min(Math.abs(diffY), 0.25D);
if (diffY < 0.0D) curY += minY;
if (diffY > 0.0D) curY -= minY;
double minZ = Math.min(Math.abs(diffZ), offset);
if (diffZ < 0.0D) curZ += minZ;
if (diffZ > 0.0D) curZ -= minZ;
positions.add(new Vector3d(curX, curY, curZ));
}
return positions;
}
public static List<Vector3d> findPath(final double tpX, final double tpY, final double tpZ, final double offset) {
final List<Vector3d> positions = new ArrayList<>();
final double steps = Math.ceil(getDistance(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, tpX, tpY, tpZ) / offset);
final double dX = tpX - mc.thePlayer.posX;
final double dY = tpY - mc.thePlayer.posY;
final double dZ = tpZ - mc.thePlayer.posZ;
for(double d = 1D; d <= steps; ++d) {
positions.add(new Vector3d(mc.thePlayer.posX + (dX * d) / steps, mc.thePlayer.posY + (dY * d) / steps, mc.thePlayer.posZ + (dZ * d) / steps));
}
return positions;
}
private static double getDistance(final double x1, final double y1, final double z1, final double x2, final double y2, final double z2) {
final double xDiff = x1 - x2;
final double yDiff = y1 - y2;
final double zDiff = z1 - z2;
return MathHelper.sqrt_double(xDiff * xDiff + yDiff * yDiff + zDiff * zDiff);
}
}
| 6,251 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
InventoryUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/InventoryUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.ccbluex.liquidbounce.event.ClickWindowEvent;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.Listenable;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import java.util.Arrays;
import java.util.List;
public final class InventoryUtils extends MinecraftInstance implements Listenable {
public static final MSTimer CLICK_TIMER = new MSTimer();
public static final List<Block> BLOCK_BLACKLIST = Arrays.asList(
Blocks.enchanting_table,
Blocks.chest,
Blocks.ender_chest,
Blocks.trapped_chest,
Blocks.anvil,
Blocks.sand,
Blocks.web,
Blocks.torch,
Blocks.crafting_table,
Blocks.furnace,
Blocks.waterlily,
Blocks.dispenser,
Blocks.stone_pressure_plate,
Blocks.wooden_pressure_plate,
Blocks.noteblock,
Blocks.dropper,
Blocks.tnt,
Blocks.standing_banner,
Blocks.wall_banner,
Blocks.redstone_torch,
// recently added
Blocks.gravel,
Blocks.cactus,
Blocks.bed,
Blocks.lever,
Blocks.standing_sign,
Blocks.wall_sign,
Blocks.jukebox,
Blocks.oak_fence,
Blocks.spruce_fence,
Blocks.birch_fence,
Blocks.jungle_fence,
Blocks.dark_oak_fence,
Blocks.oak_fence_gate,
Blocks.spruce_fence_gate,
Blocks.birch_fence_gate,
Blocks.jungle_fence_gate,
Blocks.dark_oak_fence_gate,
Blocks.nether_brick_fence,
//Blocks.cake,
Blocks.trapdoor,
Blocks.melon_block,
Blocks.brewing_stand,
Blocks.cauldron,
Blocks.skull,
Blocks.hopper,
Blocks.carpet,
Blocks.redstone_wire,
Blocks.light_weighted_pressure_plate,
Blocks.heavy_weighted_pressure_plate,
Blocks.daylight_detector
);
public static int findItem(final int startSlot, final int endSlot, final Item item) {
for(int i = startSlot; i < endSlot; i++) {
final ItemStack stack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
if(stack != null && stack.getItem() == item)
return i;
}
return -1;
}
public static boolean hasSpaceHotbar() {
for(int i = 36; i < 45; i++) {
final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
if(itemStack == null)
return true;
}
return false;
}
public static int findAutoBlockBlock() {
for(int i = 36; i < 45; i++) {
final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
if (itemStack != null && itemStack.getItem() instanceof ItemBlock && itemStack.stackSize > 0) {
final ItemBlock itemBlock = (ItemBlock) itemStack.getItem();
final Block block = itemBlock.getBlock();
if (block.isFullCube() && !BLOCK_BLACKLIST.contains(block))
return i;
}
}
/*
for(int i = 36; i < 45; i++) {
final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
if (itemStack != null && itemStack.getItem() instanceof ItemBlock && itemStack.stackSize > 0) {
final ItemBlock itemBlock = (ItemBlock) itemStack.getItem();
final Block block = itemBlock.getBlock();
if (!BLOCK_BLACKLIST.contains(block))
return i;
}
}
*/
return -1;
}
@EventTarget
public void onClick(final ClickWindowEvent event) {
CLICK_TIMER.reset();
}
@EventTarget
public void onPacket(final PacketEvent event) {
final Packet packet = event.getPacket();
if (packet instanceof C08PacketPlayerBlockPlacement)
CLICK_TIMER.reset();
}
@Override
public boolean handleEvents() {
return true;
}
}
| 4,817 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
MinecraftInstance.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/MinecraftInstance.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.minecraft.client.Minecraft;
public class MinecraftInstance {
protected static final Minecraft mc = Minecraft.getMinecraft();
}
| 373 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
PosLookInstance.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/PosLookInstance.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.minecraft.network.play.client.C03PacketPlayer.C06PacketPlayerPosLook;
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
public class PosLookInstance {
private double x = 0;
private double y = 0;
private double z = 0;
private float yaw = 0;
private float pitch = 0;
public PosLookInstance() {}
public PosLookInstance(double a, double b, double c, float d, float e) {
this.x = a;
this.y = b;
this.z = c;
this.yaw = d;
this.pitch = e;
}
public void reset() {
set(0, 0, 0, 0, 0);
}
public void set(S08PacketPlayerPosLook packet) {
set(packet.x, packet.y, packet.z, packet.yaw, packet.pitch);
}
public void set(double a, double b, double c, float d, float e) {
this.x = a;
this.y = b;
this.z = c;
this.yaw = d;
this.pitch = e;
}
public boolean equalFlag(C06PacketPlayerPosLook packet) {
return packet != null && !packet.onGround && packet.x == x && packet.y == y && packet.z == z && packet.yaw == yaw && packet.pitch == pitch;
}
}
| 1,367 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ServerUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/ServerUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.ccbluex.liquidbounce.ui.client.GuiMainMenu;
import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.entity.Entity;
public final class ServerUtils extends MinecraftInstance {
public static ServerData serverData;
public static void connectToLastServer() {
if(serverData == null)
return;
mc.displayGuiScreen(new GuiConnecting(new GuiMultiplayer(new GuiMainMenu()), mc, serverData));
}
public static String getRemoteIp() {
if (mc.theWorld == null) return "Undefined";
String serverIp = "Singleplayer";
if (mc.theWorld.isRemote) {
final ServerData serverData = mc.getCurrentServerData();
if(serverData != null)
serverIp = serverData.serverIP;
}
return serverIp;
}
public static boolean isHypixelLobby() {
if (mc.theWorld == null) return false;
String target = "CLICK TO PLAY";
for (Entity entity : mc.theWorld.loadedEntityList) {
if (entity.getName().startsWith("§e§l")) {
if (entity.getName().equals("§e§l" + target)) {
return true;
}
}
}
return false;
}
public static boolean isHypixelDomain(String s1) {
int chars = 0;
String str = "www.hypixel.net";
for (char c : str.toCharArray()) {
if (s1.contains(String.valueOf(c))) chars++;
}
return chars == str.length();
}
}
| 1,739 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
AStarCustomPathFinder.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/AStarCustomPathFinder.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.ccbluex.liquidbounce.utils.block.BlockUtils;
import net.minecraft.block.*;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import java.util.ArrayList;
import java.util.Comparator;
public class AStarCustomPathFinder {
private Vec3 startVec3;
private Vec3 endVec3;
private ArrayList<Vec3> path = new ArrayList<>();
private ArrayList<Hub> hubs = new ArrayList<>();
private ArrayList<Hub> hubsToWork = new ArrayList<>();
private double minDistanceSquared = 9;
private boolean nearest = true;
private static final Vec3[] flatCardinalDirections = {
new Vec3(1, 0, 0),
new Vec3(-1, 0, 0),
new Vec3(0, 0, 1),
new Vec3(0, 0, -1)
};
public AStarCustomPathFinder(Vec3 startVec3, Vec3 endVec3) {
this.startVec3 = BlockUtils.floorVec3(startVec3.addVector(0, 0, 0));
this.endVec3 = BlockUtils.floorVec3(endVec3.addVector(0, 0, 0));
}
public ArrayList<Vec3> getPath() {
return path;
}
public void compute() {
compute(1000, 4);
}
public void compute(int loops, int depth) {
path.clear();
hubsToWork.clear();
ArrayList<Vec3> initPath = new ArrayList<>();
initPath.add(startVec3);
hubsToWork.add(new Hub(startVec3, null, initPath, startVec3.squareDistanceTo(endVec3), 0, 0));
search:
for (int i = 0; i < loops; i++) {
hubsToWork.sort(new CompareHub());
int j = 0;
if (hubsToWork.size() == 0) {
break;
}
for (Hub hub : new ArrayList<>(hubsToWork)) {
j++;
if (j > depth) {
break;
} else {
hubsToWork.remove(hub);
hubs.add(hub);
for (Vec3 direction : flatCardinalDirections) {
Vec3 loc = BlockUtils.floorVec3(hub.getLoc().add(direction));
if (checkPositionValidity(loc, false)) {
if (addHub(hub, loc, 0)) {
break search;
}
}
}
Vec3 loc1 = BlockUtils.floorVec3(hub.getLoc().addVector(0, 1, 0));
if (checkPositionValidity(loc1, false)) {
if (addHub(hub, loc1, 0)) {
break search;
}
}
Vec3 loc2 = BlockUtils.floorVec3(hub.getLoc().addVector(0, -1, 0));
if (checkPositionValidity(loc2, false)) {
if (addHub(hub, loc2, 0)) {
break search;
}
}
}
}
}
if (nearest) {
hubs.sort(new CompareHub());
path = hubs.get(0).getPath();
}
}
public static boolean checkPositionValidity(Vec3 loc, boolean checkGround) {
return checkPositionValidity((int) loc.xCoord, (int) loc.yCoord, (int) loc.zCoord, checkGround);
}
public static boolean checkPositionValidity(int x, int y, int z, boolean checkGround) {
BlockPos block1 = new BlockPos(x, y, z);
BlockPos block2 = new BlockPos(x, y + 1, z);
BlockPos block3 = new BlockPos(x, y - 1, z);
return !isBlockSolid(block1) && !isBlockSolid(block2) && (isBlockSolid(block3) || !checkGround) && isSafeToWalkOn(block3);
}
private static boolean isBlockSolid(BlockPos blockPos) {
Block block=BlockUtils.getBlock(blockPos);
if(block==null) return false;
return block.isFullBlock() ||
(block instanceof BlockSlab) ||
(block instanceof BlockStairs)||
(block instanceof BlockCactus)||
(block instanceof BlockChest)||
(block instanceof BlockEnderChest)||
(block instanceof BlockSkull)||
(block instanceof BlockPane)||
(block instanceof BlockFence)||
(block instanceof BlockWall)||
(block instanceof BlockGlass)||
(block instanceof BlockPistonBase)||
(block instanceof BlockPistonExtension)||
(block instanceof BlockPistonMoving)||
(block instanceof BlockStainedGlass)||
(block instanceof BlockTrapDoor);
}
private static boolean isSafeToWalkOn(BlockPos blockPos) {
Block block=BlockUtils.getBlock(blockPos);
if(block==null) return false;
return !(block instanceof BlockFence) &&
!(block instanceof BlockWall);
}
public Hub isHubExisting(Vec3 loc) {
for (Hub hub : hubs) {
if (hub.getLoc().xCoord == loc.xCoord && hub.getLoc().yCoord == loc.yCoord && hub.getLoc().zCoord == loc.zCoord) {
return hub;
}
}
for (Hub hub : hubsToWork) {
if (hub.getLoc().xCoord == loc.xCoord && hub.getLoc().yCoord == loc.yCoord && hub.getLoc().zCoord == loc.zCoord) {
return hub;
}
}
return null;
}
public boolean addHub(Hub parent, Vec3 loc, double cost) {
Hub existingHub = isHubExisting(loc);
double totalCost = cost;
if (parent != null) {
totalCost += parent.getTotalCost();
}
if (existingHub == null) {
if ((loc.xCoord == endVec3.xCoord && loc.yCoord == endVec3.yCoord && loc.zCoord == endVec3.zCoord) || (minDistanceSquared != 0 && loc.squareDistanceTo(endVec3) <= minDistanceSquared)) {
path.clear();
path = parent.getPath();
path.add(loc);
return true;
} else {
ArrayList<Vec3> path = new ArrayList<>(parent.getPath());
path.add(loc);
hubsToWork.add(new Hub(loc, parent, path, loc.squareDistanceTo(endVec3), cost, totalCost));
}
} else if (existingHub.getCost() > cost) {
ArrayList<Vec3> path = new ArrayList<>(parent.getPath());
path.add(loc);
existingHub.setLoc(loc);
existingHub.setParent(parent);
existingHub.setPath(path);
existingHub.setSquareDistanceToFromTarget(loc.squareDistanceTo(endVec3));
existingHub.setCost(cost);
existingHub.setTotalCost(totalCost);
}
return false;
}
private class Hub {
private Vec3 loc = null;
private Hub parent = null;
private ArrayList<Vec3> path;
private double squareDistanceToFromTarget;
private double cost;
private double totalCost;
public Hub(Vec3 loc, Hub parent, ArrayList<Vec3> path, double squareDistanceToFromTarget, double cost, double totalCost) {
this.loc = loc;
this.parent = parent;
this.path = path;
this.squareDistanceToFromTarget = squareDistanceToFromTarget;
this.cost = cost;
this.totalCost = totalCost;
}
public Vec3 getLoc() {
return loc;
}
public Hub getParent() {
return parent;
}
public ArrayList<Vec3> getPath() {
return path;
}
public double getSquareDistanceToFromTarget() {
return squareDistanceToFromTarget;
}
public double getCost() {
return cost;
}
public void setLoc(Vec3 loc) {
this.loc = loc;
}
public void setParent(Hub parent) {
this.parent = parent;
}
public void setPath(ArrayList<Vec3> path) {
this.path = path;
}
public void setSquareDistanceToFromTarget(double squareDistanceToFromTarget) {
this.squareDistanceToFromTarget = squareDistanceToFromTarget;
}
public void setCost(double cost) {
this.cost = cost;
}
public double getTotalCost() {
return totalCost;
}
public void setTotalCost(double totalCost) {
this.totalCost = totalCost;
}
}
public class CompareHub implements Comparator<Hub> {
@Override
public int compare(Hub o1, Hub o2) {
return (int) (
(o1.getSquareDistanceToFromTarget() + o1.getTotalCost()) - (o2.getSquareDistanceToFromTarget() + o2.getTotalCost())
);
}
}
}
| 8,858 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
SessionUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/SessionUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.Listenable;
import net.ccbluex.liquidbounce.event.ScreenEvent;
import net.ccbluex.liquidbounce.event.SessionEvent;
import net.ccbluex.liquidbounce.event.WorldEvent;
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
import net.minecraft.client.gui.GuiDownloadTerrain;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.GuiConnecting;
public class SessionUtils extends MinecraftInstance implements Listenable {
private static final MSTimer sessionTimer = new MSTimer();
private static final MSTimer worldTimer = new MSTimer();
public static long lastSessionTime = 0L;
public static long backupSessionTime = 0L;
public static long lastWorldTime = 0L;
private static boolean requireDelay = false;
private static GuiScreen lastScreen = null;
@EventTarget
public void onWorld(WorldEvent event) {
lastWorldTime = System.currentTimeMillis() - worldTimer.time;
worldTimer.reset();
if (event.getWorldClient() == null) {
backupSessionTime = System.currentTimeMillis() - sessionTimer.time;
requireDelay = true;
} else {
requireDelay = false;
}
}
@EventTarget
public void onSession(SessionEvent event) {
handleConnection();
}
@EventTarget
public void onScreen(ScreenEvent event) {
if (event.getGuiScreen() == null && lastScreen != null && (lastScreen instanceof GuiDownloadTerrain || lastScreen instanceof GuiConnecting))
handleReconnection();
lastScreen = event.getGuiScreen();
}
public static void handleConnection() {
backupSessionTime = 0L;
requireDelay = true;
lastSessionTime = System.currentTimeMillis() - sessionTimer.time;
if (lastSessionTime < 0L) lastSessionTime = 0L;
sessionTimer.reset();
}
public static void handleReconnection() {
if (requireDelay) sessionTimer.time = System.currentTimeMillis() - backupSessionTime;
}
public static String getFormatSessionTime() {
if (System.currentTimeMillis() - sessionTimer.time < 0L) sessionTimer.reset();
int realTime = (int) (System.currentTimeMillis() - sessionTimer.time) / 1000;
int hours = (int) realTime / 3600;
int seconds = (realTime % 3600) % 60;
int minutes = (int) (realTime % 3600) / 60;
return hours + "h " + minutes + "m " + seconds + "s";
}
public static String getFormatLastSessionTime() {
if (lastSessionTime < 0L) lastSessionTime = 0L;
int realTime = (int) lastSessionTime / 1000;
int hours = (int) realTime / 3600;
int seconds = (realTime % 3600) % 60;
int minutes = (int) (realTime % 3600) / 60;
return hours + "h " + minutes + "m " + seconds + "s";
}
public static String getFormatWorldTime() {
if (System.currentTimeMillis() - worldTimer.time < 0L) worldTimer.reset();
int realTime = (int) (System.currentTimeMillis() - worldTimer.time) / 1000;
int hours = (int) realTime / 3600;
int seconds = (realTime % 3600) % 60;
int minutes = (int) (realTime % 3600) / 60;
return hours + "h " + minutes + "m " + seconds + "s";
}
@Override
public boolean handleEvents() {
return true;
}
}
| 3,654 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
RaycastUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/RaycastUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import com.google.common.base.Predicates;
import net.minecraft.entity.Entity;
import net.minecraft.util.*;
import java.util.List;
public final class RaycastUtils extends MinecraftInstance {
public static Entity raycastEntity(final double range, final IEntityFilter entityFilter) {
return raycastEntity(range, RotationUtils.serverRotation.getYaw(), RotationUtils.serverRotation.getPitch(),
entityFilter);
}
private static Entity raycastEntity(final double range, final float yaw, final float pitch, final IEntityFilter entityFilter) {
final Entity renderViewEntity = mc.getRenderViewEntity();
if(renderViewEntity != null && mc.theWorld != null) {
double blockReachDistance = range;
final Vec3 eyePosition = renderViewEntity.getPositionEyes(1F);
final float yawCos = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI);
final float yawSin = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI);
final float pitchCos = -MathHelper.cos(-pitch * 0.017453292F);
final float pitchSin = MathHelper.sin(-pitch * 0.017453292F);
final Vec3 entityLook = new Vec3(yawSin * pitchCos, pitchSin, yawCos * pitchCos);
final Vec3 vector = eyePosition.addVector(entityLook.xCoord * blockReachDistance, entityLook.yCoord * blockReachDistance, entityLook.zCoord * blockReachDistance);
final List<Entity> entityList = mc.theWorld.getEntitiesInAABBexcluding(renderViewEntity, renderViewEntity.getEntityBoundingBox().addCoord(entityLook.xCoord * blockReachDistance, entityLook.yCoord * blockReachDistance, entityLook.zCoord * blockReachDistance).expand(1D, 1D, 1D), Predicates.and(EntitySelectors.NOT_SPECTATING, Entity :: canBeCollidedWith));
Entity pointedEntity = null;
for(final Entity entity : entityList) {
if(!entityFilter.canRaycast(entity))
continue;
final float collisionBorderSize = entity.getCollisionBorderSize();
final AxisAlignedBB axisAlignedBB = entity.getEntityBoundingBox().expand(collisionBorderSize, collisionBorderSize, collisionBorderSize);
final MovingObjectPosition movingObjectPosition = axisAlignedBB.calculateIntercept(eyePosition, vector);
if(axisAlignedBB.isVecInside(eyePosition)) {
if(blockReachDistance >= 0.0D) {
pointedEntity = entity;
blockReachDistance = 0.0D;
}
}else if(movingObjectPosition != null) {
final double eyeDistance = eyePosition.distanceTo(movingObjectPosition.hitVec);
if(eyeDistance < blockReachDistance || blockReachDistance == 0.0D) {
if(entity == renderViewEntity.ridingEntity && !renderViewEntity.canRiderInteract()) {
if(blockReachDistance == 0.0D)
pointedEntity = entity;
}else{
pointedEntity = entity;
blockReachDistance = eyeDistance;
}
}
}
}
return pointedEntity;
}
return null;
}
public interface IEntityFilter {
boolean canRaycast(final Entity entity);
}
}
| 3,656 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
TabUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/TabUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.minecraft.client.gui.GuiTextField;
public final class TabUtils {
public static void tab(final GuiTextField... textFields) {
for(int i = 0; i < textFields.length; i++) {
final GuiTextField textField = textFields[i];
if(textField.isFocused()) {
textField.setFocused(false);
i++;
if(i >= textFields.length)
i = 0;
textFields[i].setFocused(true);
break;
}
}
}
}
| 764 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ClientUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/ClientUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import com.google.gson.JsonObject;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.login.client.C01PacketEncryptionResponse;
import net.minecraft.network.login.server.S01PacketEncryptionRequest;
import net.minecraft.util.IChatComponent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.crypto.SecretKey;
import java.lang.reflect.Field;
import java.security.PublicKey;
public final class ClientUtils extends MinecraftInstance {
private static final Logger logger = LogManager.getLogger("LiquidBounce");
private static Field fastRenderField;
static {
try {
fastRenderField = GameSettings.class.getDeclaredField("ofFastRender");
if(!fastRenderField.isAccessible())
fastRenderField.setAccessible(true);
}catch(final NoSuchFieldException ignored) {
}
}
public static Logger getLogger() {
return logger;
}
public static void disableFastRender() {
try {
if(fastRenderField != null) {
if(!fastRenderField.isAccessible())
fastRenderField.setAccessible(true);
fastRenderField.setBoolean(mc.gameSettings, false);
}
}catch(final IllegalAccessException ignored) {
}
}
public static void sendEncryption(final NetworkManager networkManager, final SecretKey secretKey, final PublicKey publicKey, final S01PacketEncryptionRequest encryptionRequest) {
networkManager.sendPacket(new C01PacketEncryptionResponse(secretKey, publicKey, encryptionRequest.getVerifyToken()), p_operationComplete_1_ -> networkManager.enableEncryption(secretKey));
}
public static void displayChatMessage(final String message) {
if (mc.thePlayer == null) {
getLogger().info("(MCChat)" + message);
return;
}
final JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("text", message);
mc.thePlayer.addChatMessage(IChatComponent.Serializer.jsonToComponent(jsonObject.toString()));
}
}
| 2,412 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
CPSCounter.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/CPSCounter.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
/**
* @author superblaubeere27
*/
public class CPSCounter {
private static final int MAX_CPS = 50;
private static final RollingArrayLongBuffer[] TIMESTAMP_BUFFERS = new RollingArrayLongBuffer[MouseButton.values().length];
static {
for (int i = 0; i < TIMESTAMP_BUFFERS.length; i++) {
TIMESTAMP_BUFFERS[i] = new RollingArrayLongBuffer(MAX_CPS);
}
}
/**
* Registers a mouse button click
*
* @param button The clicked button
*/
public static void registerClick(MouseButton button) {
TIMESTAMP_BUFFERS[button.getIndex()].add(System.currentTimeMillis());
}
/**
* Gets the count of clicks that have occurrence since the last 1000ms
*
* @param button The mouse button
* @return The CPS
*/
public static int getCPS(MouseButton button) {
return TIMESTAMP_BUFFERS[button.getIndex()].getTimestampsSince(System.currentTimeMillis() - 1000L);
}
public enum MouseButton {
LEFT(0), MIDDLE(1), RIGHT(2);
private int index;
MouseButton(int index) {
this.index = index;
}
private int getIndex() {
return index;
}
}
}
| 1,447 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
FileUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/FileUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import org.apache.commons.io.IOUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileUtils {
public static void unpackFile(File file, String name) throws IOException {
FileOutputStream fos = new FileOutputStream(file);
IOUtils.copy(FileUtils.class.getClassLoader().getResourceAsStream(name), fos);
fos.close();
}
}
| 631 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
EntityUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/EntityUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.modules.combat.NoFriends;
import net.ccbluex.liquidbounce.features.module.modules.misc.AntiBot;
import net.ccbluex.liquidbounce.features.module.modules.misc.Teams;
import net.ccbluex.liquidbounce.utils.render.ColorUtils;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityGolem;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.scoreboard.ScorePlayerTeam;
public final class EntityUtils extends MinecraftInstance {
public static boolean targetInvisible = false;
public static boolean targetPlayer = true;
public static boolean targetMobs = true;
public static boolean targetAnimals = false;
public static boolean targetDead = false;
public static boolean isSelected(final Entity entity, final boolean canAttackCheck) {
if(entity instanceof EntityLivingBase && (targetDead || entity.isEntityAlive()) && entity != mc.thePlayer) {
if(targetInvisible || !entity.isInvisible()) {
if(targetPlayer && entity instanceof EntityPlayer) {
final EntityPlayer entityPlayer = (EntityPlayer) entity;
if(canAttackCheck) {
if(AntiBot.isBot(entityPlayer))
return false;
if (isFriend(entityPlayer) && !LiquidBounce.moduleManager.getModule(NoFriends.class).getState())
return false;
if(entityPlayer.isSpectator())
return false;
final Teams teams = LiquidBounce.moduleManager.getModule(Teams.class);
return !teams.getState() || !teams.isInYourTeam(entityPlayer);
}
return true;
}
return targetMobs && isMob(entity) || targetAnimals && isAnimal(entity);
}
}
return false;
}
public static boolean isFriend(final Entity entity) {
return entity instanceof EntityPlayer && entity.getName() != null &&
LiquidBounce.fileManager.friendsConfig.isFriend(ColorUtils.stripColor(entity.getName()));
}
public static boolean isAnimal(final Entity entity) {
return entity instanceof EntityAnimal || entity instanceof EntitySquid || entity instanceof EntityGolem ||
entity instanceof EntityBat;
}
public static boolean isMob(final Entity entity) {
return entity instanceof EntityMob || entity instanceof EntityVillager || entity instanceof EntitySlime ||
entity instanceof EntityGhast || entity instanceof EntityDragon;
}
public static String getName(final NetworkPlayerInfo networkPlayerInfoIn) {
return networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() :
ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName());
}
public static int getPing(final EntityPlayer entityPlayer) {
if(entityPlayer == null)
return 0;
final NetworkPlayerInfo networkPlayerInfo = mc.getNetHandler().getPlayerInfo(entityPlayer.getUniqueID());
return networkPlayerInfo == null ? 0 : networkPlayerInfo.getResponseTime();
}
}
| 4,135 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
AnimationUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/AnimationUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils;
import java.math.*;
public final class AnimationUtils {
public static double animate(double target, double current, double speed) {
if (current == target) return current;
boolean larger = target > current;
if (speed < 0.0D) {
speed = 0.0D;
} else if (speed > 1.0D) {
speed = 1.0D;
}
double dif = Math.max(target, current) - Math.min(target, current);
double factor = dif * speed;
if (factor < 0.1D) {
factor = 0.1D;
}
if (larger) {
current += factor;
if (current >= target) current = target;
} else if (target < current) {
current -= factor;
if (current <= target) current = target;
}
return current;
}
public static float animate(float target, float current, float speed) {
if (current == target) return current;
boolean larger = target > current;
if (speed < 0.0F) {
speed = 0.0F;
} else if (speed > 1.0F) {
speed = 1.0F;
}
double dif = Math.max(target, (double)current) - Math.min(target, (double)current);
double factor = dif * (double)speed;
if (factor < 0.1D) {
factor = 0.1D;
}
if (larger) {
current += (float)factor;
if (current >= target) current = target;
} else if (target < current) {
current -= (float)factor;
if (current <= target) current = target;
}
return current;
}
public static double changer(double current, double add, double min, double max) {
current += add;
if (current > max) {
current = max;
}
if (current < min) {
current = min;
}
return current;
}
public static float changer(float current, float add, float min, float max) {
current += add;
if (current > max) {
current = max;
}
if (current < min) {
current = min;
}
return current;
}
}
| 2,231 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
RandomUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/misc/RandomUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.misc;
import java.util.Random;
public final class RandomUtils {
public static boolean nextBoolean() {
return new Random().nextBoolean();
}
public static int nextInt(final int startInclusive, final int endExclusive) {
if (endExclusive - startInclusive <= 0)
return startInclusive;
return startInclusive + new Random().nextInt(endExclusive - startInclusive);
}
public static double nextDouble(final double startInclusive, final double endInclusive) {
if(startInclusive == endInclusive || endInclusive - startInclusive <= 0D)
return startInclusive;
return startInclusive + ((endInclusive - startInclusive) * Math.random());
}
public static float nextFloat(final float startInclusive, final float endInclusive) {
if(startInclusive == endInclusive || endInclusive - startInclusive <= 0F)
return startInclusive;
return (float) (startInclusive + ((endInclusive - startInclusive) * Math.random()));
}
public static String randomNumber(final int length) {
return random(length, "123456789");
}
public static String randomString(final int length) {
return random(length, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
}
public static String random(final int length, final String chars) {
return random(length, chars.toCharArray());
}
public static String random(final int length, final char[] chars) {
final StringBuilder stringBuilder = new StringBuilder();
for(int i = 0; i < length; i++)
stringBuilder.append(chars[new Random().nextInt(chars.length)]);
return stringBuilder.toString();
}
}
| 1,960 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
FallingPlayer.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/misc/FallingPlayer.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.misc;
import net.ccbluex.liquidbounce.utils.MinecraftInstance;
import net.minecraft.util.*;
import org.jetbrains.annotations.Nullable;
public class FallingPlayer extends MinecraftInstance {
private double x;
private double y;
private double z;
private double motionX;
private double motionY;
private double motionZ;
private final float yaw;
private float strafe;
private float forward;
public FallingPlayer(double x, double y, double z, double motionX, double motionY, double motionZ, float yaw, float strafe, float forward) {
this.x = x;
this.y = y;
this.z = z;
this.motionX = motionX;
this.motionY = motionY;
this.motionZ = motionZ;
this.yaw = yaw;
this.strafe = strafe;
this.forward = forward;
}
private void calculateForTick() {
strafe *= 0.98F;
forward *= 0.98F;
float v = strafe * strafe + forward * forward;
if (v >= 0.0001f) {
v = MathHelper.sqrt_float(v);
if (v < 1.0F) {
v = 1.0F;
}
v = mc.thePlayer.jumpMovementFactor / v;
strafe = strafe * v;
forward = forward * v;
float f1 = MathHelper.sin(yaw * (float) Math.PI / 180.0F);
float f2 = MathHelper.cos(yaw * (float) Math.PI / 180.0F);
this.motionX += strafe * f2 - forward * f1;
this.motionZ += forward * f2 + strafe * f1;
}
motionY -= 0.08;
motionX *= 0.91;
motionY *= 0.9800000190734863D;
motionY *= 0.91;
motionZ *= 0.91;
x += motionX;
y += motionY;
z += motionZ;
}
public CollisionResult findCollision(int ticks) {
for (int i = 0; i < ticks; i++) {
Vec3 start = new Vec3(x, y, z);
calculateForTick();
Vec3 end = new Vec3(x, y, z);
BlockPos raytracedBlock;
float w = mc.thePlayer.width / 2F;
if ((raytracedBlock = rayTrace(start, end)) != null) return new CollisionResult(raytracedBlock, i);
if ((raytracedBlock = rayTrace(start.addVector(w, 0, w), end)) != null)
return new CollisionResult(raytracedBlock, i);
if ((raytracedBlock = rayTrace(start.addVector(-w, 0, w), end)) != null)
return new CollisionResult(raytracedBlock, i);
if ((raytracedBlock = rayTrace(start.addVector(w, 0, -w), end)) != null)
return new CollisionResult(raytracedBlock, i);
if ((raytracedBlock = rayTrace(start.addVector(-w, 0, -w), end)) != null)
return new CollisionResult(raytracedBlock, i);
if ((raytracedBlock = rayTrace(start.addVector(w, 0, w / 2f), end)) != null)
return new CollisionResult(raytracedBlock, i);
if ((raytracedBlock = rayTrace(start.addVector(-w, 0, w / 2f), end)) != null)
return new CollisionResult(raytracedBlock, i);
if ((raytracedBlock = rayTrace(start.addVector(w / 2f, 0, w), end)) != null)
return new CollisionResult(raytracedBlock, i);
if ((raytracedBlock = rayTrace(start.addVector(w / 2f, 0, -w), end)) != null)
return new CollisionResult(raytracedBlock, i);
}
return null;
}
@Nullable
private BlockPos rayTrace(Vec3 start, Vec3 end) {
MovingObjectPosition result = mc.theWorld.rayTraceBlocks(start, end, true);
if (result != null && result.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && result.sideHit == EnumFacing.UP) {
return result.getBlockPos();
}
return null;
}
public static class CollisionResult {
private final BlockPos pos;
private final int tick;
public CollisionResult(BlockPos pos, int tick) {
this.pos = pos;
this.tick = tick;
}
public BlockPos getPos() {
return pos;
}
public int getTick() {
return tick;
}
}
}
| 4,345 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
MiscUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/misc/MiscUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.misc;
import net.ccbluex.liquidbounce.utils.MinecraftInstance;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public final class MiscUtils extends MinecraftInstance {
public static void showErrorPopup(final String title, final String message) {
JOptionPane.showMessageDialog(null, message, title, JOptionPane.ERROR_MESSAGE);
}
public static void showURL(final String url) {
try {
Desktop.getDesktop().browse(new URI(url));
}catch(final IOException | URISyntaxException e) {
e.printStackTrace();
}
}
public static File openFileChooser() {
if (mc.isFullScreen())
mc.toggleFullscreen();
final JFileChooser fileChooser = new JFileChooser();
final JFrame frame = new JFrame();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
frame.setVisible(true);
frame.toFront();
frame.setVisible(false);
final int action = fileChooser.showOpenDialog(frame);
frame.dispose();
return action == JFileChooser.APPROVE_OPTION ? fileChooser.getSelectedFile() : null;
}
public static File saveFileChooser() {
if (mc.isFullScreen())
mc.toggleFullscreen();
final JFileChooser fileChooser = new JFileChooser();
final JFrame frame = new JFrame();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
frame.setVisible(true);
frame.toFront();
frame.setVisible(false);
final int action = fileChooser.showSaveDialog(frame);
frame.dispose();
return action == JFileChooser.APPROVE_OPTION ? fileChooser.getSelectedFile() : null;
}
}
| 2,030 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
StringUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/misc/StringUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.misc;
import java.util.Arrays;
import java.util.HashMap;
public final class StringUtils {
private static HashMap<String,String> stringCache = new HashMap<>();
private static HashMap<String,String> stringReplaceCache = new HashMap<>();
private static HashMap<String,String> stringRegexCache = new HashMap<>();
private static HashMap<String,String> airCache = new HashMap<>();
public static String fixString(String str) {
if (stringCache.containsKey(str)) return stringCache.get(str);
str = str.replaceAll("\uF8FF", "");//remove air chars
StringBuilder sb = new StringBuilder();
for (char c:str.toCharArray()) {
if((int) c >(33+65248) && (int) c <(128 + 65248)) {
sb.append(Character.toChars((int) c - 65248));
} else {
sb.append(c);
}
}
String result = sb.toString();
stringCache.put(str, result);
return result;
}
public static String injectAirString(String str) {
if(airCache.containsKey(str)) return airCache.get(str);
StringBuilder stringBuilder = new StringBuilder();
boolean hasAdded = false;
for(char c : str.toCharArray()) {
stringBuilder.append(c);
if (!hasAdded) stringBuilder.append('\uF8FF');
hasAdded = true;
}
String result = stringBuilder.toString();
airCache.put(str, result);
return result;
}
public static String toCompleteString(final String[] args, final int start) {
if(args.length <= start) return "";
return String.join(" ", Arrays.copyOfRange(args, start, args.length));
}
public static String replace(final String string, final String searchChars, String replaceChars) {
return replace(string, searchChars, replaceChars, false);
}
public static String replace(final String string, final String searchChars, String replaceChars, boolean forceReload) {
if(string.isEmpty() || searchChars.isEmpty() || searchChars.equals(replaceChars))
return string;
if (!forceReload && stringRegexCache.get(searchChars) != null && stringRegexCache.get(searchChars).equals(replaceChars) && stringReplaceCache.containsKey(string))
return stringReplaceCache.getOrDefault(string, replace(string, searchChars, replaceChars, true)); // will attempt to retry replacement once again
if(replaceChars == null)
replaceChars = "";
final int stringLength = string.length();
final int searchCharsLength = searchChars.length();
final StringBuilder stringBuilder = new StringBuilder(string);
for(int i = 0; i < stringLength; i++) {
final int start = stringBuilder.indexOf(searchChars, i);
if(start == -1) {
if(i == 0)
return string;
return stringBuilder.toString();
}
stringBuilder.replace(start, start + searchCharsLength, replaceChars);
}
String result = stringBuilder.toString();
stringReplaceCache.put(string, result);
stringRegexCache.put(searchChars, replaceChars);
return result;
}
}
| 3,479 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
TipSoundPlayer.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/misc/sound/TipSoundPlayer.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.misc.sound;
import javax.sound.sampled.*;
import java.io.File;
public class TipSoundPlayer {
private final File file;
public TipSoundPlayer(File file) {
this.file = file;
}
public void asyncPlay(float volume) {
Thread thread = new Thread() {
@Override
public void run() {
playSound(volume / 100F);
}
};
thread.start();
}
public void playSound(float volume) {
try {
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(file);
Clip clip = AudioSystem.getClip();
clip.open(audioInputStream);
FloatControl controller = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
float range = controller.getMaximum() - controller.getMinimum();
float value = (range * volume) + controller.getMinimum();
controller.setValue(value);
clip.start();
} catch (Exception ex) {
System.out.println("Error with playing sound.");
ex.printStackTrace();
}
}
}
| 1,352 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
MSTimer.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/timer/MSTimer.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.timer;
public final class MSTimer {
public long time = -1L;
public boolean hasTimePassed(final long MS) {
return System.currentTimeMillis() >= time + MS;
}
public long hasTimeLeft(final long MS) {
return (MS + time) - System.currentTimeMillis();
}
public void reset() {
time = System.currentTimeMillis();
}
}
| 594 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
TickTimer.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/timer/TickTimer.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.timer;
public final class TickTimer {
public int tick;
public void update() {
tick++;
}
public void reset() {
tick = 0;
}
public boolean hasTimePassed(final int ticks) {
return tick >= ticks;
}
}
| 481 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
TimeUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/timer/TimeUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.timer;
import net.ccbluex.liquidbounce.utils.misc.RandomUtils;
public final class TimeUtils {
public static long randomDelay(final int minDelay, final int maxDelay) {
return RandomUtils.nextInt(minDelay, maxDelay);
}
public static long randomClickDelay(final int minCPS, final int maxCPS) {
return (long) ((Math.random() * (1000 / minCPS - 1000 / maxCPS + 1)) + 1000 / maxCPS);
}
}
| 646 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ItemUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/item/ItemUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.item;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.JsonToNBT;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import java.util.Objects;
import java.util.regex.Pattern;
/**
* @author MCModding4K
*/
public final class ItemUtils {
/**
* Allows you to create a item using the item json
*
* @param itemArguments arguments of item
* @return created item
* @author MCModding4K
*/
public static ItemStack createItem(String itemArguments) {
try {
itemArguments = itemArguments.replace('&', '§');
Item item = new Item();
String[] args = null;
int i = 1;
int j = 0;
for (int mode = 0; mode <= Math.min(12, itemArguments.length() - 2); ++mode) {
args = itemArguments.substring(mode).split(Pattern.quote(" "));
ResourceLocation resourcelocation = new ResourceLocation(args[0]);
item = Item.itemRegistry.getObject(resourcelocation);
if (item != null)
break;
}
if (item == null)
return null;
if (Objects.requireNonNull(args).length >= 2 && args[1].matches("\\d+"))
i = Integer.parseInt(args[1]);
if (args.length >= 3 && args[2].matches("\\d+"))
j = Integer.parseInt(args[2]);
ItemStack itemstack = new ItemStack(item, i, j);
if (args.length >= 4) {
StringBuilder NBT = new StringBuilder();
for (int nbtcount = 3; nbtcount < args.length; ++nbtcount)
NBT.append(" ").append(args[nbtcount]);
itemstack.setTagCompound(JsonToNBT.getTagFromJson(NBT.toString()));
}
return itemstack;
} catch (Exception exception) {
exception.printStackTrace();
return null;
}
}
public static int getEnchantment(ItemStack itemStack, Enchantment enchantment) {
if (itemStack == null || itemStack.getEnchantmentTagList() == null || itemStack.getEnchantmentTagList().hasNoTags())
return 0;
for (int i = 0; i < itemStack.getEnchantmentTagList().tagCount(); i++) {
final NBTTagCompound tagCompound = itemStack.getEnchantmentTagList().getCompoundTagAt(i);
if ((tagCompound.hasKey("ench") && tagCompound.getShort("ench") == enchantment.effectId) || (tagCompound.hasKey("id") && tagCompound.getShort("id") == enchantment.effectId))
return tagCompound.getShort("lvl");
}
return 0;
}
public static int getEnchantmentCount(ItemStack itemStack) {
if (itemStack == null || itemStack.getEnchantmentTagList() == null || itemStack.getEnchantmentTagList().hasNoTags())
return 0;
int c = 0;
for (int i = 0; i < itemStack.getEnchantmentTagList().tagCount(); i++) {
NBTTagCompound tagCompound = itemStack.getEnchantmentTagList().getCompoundTagAt(i);
if ((tagCompound.hasKey("ench") || tagCompound.hasKey("id")))
c++;
}
return c;
}
public static int getItemDurability(ItemStack stack) {
return stack == null ? 0 : (stack.getMaxDamage() - stack.getItemDamage());
}
}
| 3,653 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ItemCreator.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/item/ItemCreator.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.item;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.JsonToNBT;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import java.util.Objects;
import java.util.regex.Pattern;
/**
* @author MCModding4K
*/
public final class ItemCreator {
/**
* Allows you to create a item using the item json
*
* @param itemArguments arguments of item
* @return created item
* @author MCModding4K
*/
public static ItemStack createItem(String itemArguments) {
try {
itemArguments = itemArguments.replace('&', '§');
Item item = new Item();
String[] args = null;
int i = 1;
int j = 0;
for (int mode = 0; mode <= Math.min(12, itemArguments.length() - 2); ++mode) {
args = itemArguments.substring(mode).split(Pattern.quote(" "));
ResourceLocation resourcelocation = new ResourceLocation(args[0]);
item = Item.itemRegistry.getObject(resourcelocation);
if (item != null)
break;
}
if (item == null)
return null;
if (Objects.requireNonNull(args).length >= 2 && args[1].matches("\\d+"))
i = Integer.parseInt(args[1]);
if (args.length >= 3 && args[2].matches("\\d+"))
j = Integer.parseInt(args[2]);
ItemStack itemstack = new ItemStack(item, i, j);
if (args.length >= 4) {
StringBuilder NBT = new StringBuilder();
for (int nbtcount = 3; nbtcount < args.length; ++nbtcount)
NBT.append(" ").append(args[nbtcount]);
itemstack.setTagCompound(JsonToNBT.getTagFromJson(NBT.toString()));
}
return itemstack;
} catch (Exception exception) {
exception.printStackTrace();
return null;
}
}
}
| 2,273 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ArmorPiece.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/item/ArmorPiece.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
public class ArmorPiece {
private ItemStack itemStack;
private int slot;
public ArmorPiece(ItemStack itemStack, int slot) {
this.itemStack = itemStack;
this.slot = slot;
}
public int getArmorType() {
return ((ItemArmor) itemStack.getItem()).armorType;
}
public int getSlot() {
return slot;
}
public ItemStack getItemStack() {
return itemStack;
}
}
| 743 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ArmorComparator.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/item/ArmorComparator.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.item;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Comparator;
//import static net.ccbluex.liquidbounce.utils.item.ItemUtils.getEnchantmentCount;
public class ArmorComparator implements Comparator<ArmorPiece> {
private static final Enchantment[] DAMAGE_REDUCTION_ENCHANTMENTS = {Enchantment.protection, Enchantment.projectileProtection, Enchantment.fireProtection, Enchantment.blastProtection};
private static final float[] ENCHANTMENT_FACTORS = {1.5f, 0.4f, 0.39f, 0.38f};
private static final float[] ENCHANTMENT_DAMAGE_REDUCTION_FACTOR = {0.04f, 0.08f, 0.15f, 0.08f};
private static final Enchantment[] OTHER_ENCHANTMENTS = {Enchantment.featherFalling, Enchantment.thorns, Enchantment.respiration, Enchantment.aquaAffinity, Enchantment.unbreaking};
private static final float[] OTHER_ENCHANTMENT_FACTORS = {3.0f, 1.0f, 0.1f, 0.05f, 0.01f};
/**
* Rounds a double. From https://stackoverflow.com/a/2808648/9140494
*
* @param value the value to be rounded
* @param places Decimal places
* @return The rounded value
*/
public static double round(double value, int places) {
if (places < 0)
throw new IllegalArgumentException();
BigDecimal bd = BigDecimal.valueOf(value);
bd = bd.setScale(places, RoundingMode.HALF_UP);
return bd.doubleValue();
}
@Override
public int compare(ArmorPiece o1, ArmorPiece o2) {
// For damage reduction it is better if it is smaller, so it has to be inverted
// The decimal values have to be rounded since in double math equals is inaccurate
// For example 1.03 - 0.41 = 0.6200000000000001 and (1.03 - 0.41) == 0.62 would be false
int compare = Double.compare(round(getThresholdedDamageReduction(o2.getItemStack()), 3), round(getThresholdedDamageReduction(o1.getItemStack()), 3));
// If both armor pieces have the exact same damage, compare enchantments
if (compare == 0) {
int otherEnchantmentCmp = Double.compare(round(getEnchantmentThreshold(o1.getItemStack()), 3), round(getEnchantmentThreshold(o2.getItemStack()), 3));
// If both have the same enchantment threshold, prefer the item with more enchantments
if (otherEnchantmentCmp == 0) {
int enchantmentCountCmp = Integer.compare(ItemUtils.getEnchantmentCount(o1.getItemStack()), ItemUtils.getEnchantmentCount(o2.getItemStack()));
if (enchantmentCountCmp != 0)
return enchantmentCountCmp;
// Then durability...
ItemArmor o1a = ((ItemArmor) o1.getItemStack().getItem());
ItemArmor o2a = ((ItemArmor) o2.getItemStack().getItem());
int durabilityCmp = Integer.compare(o1a.getArmorMaterial().getDurability(o1a.armorType), o2a.getArmorMaterial().getDurability(o2a.armorType));
if (durabilityCmp != 0) {
return durabilityCmp;
}
// Last comparision: Enchantability
return Integer.compare(o1a.getArmorMaterial().getEnchantability(), o2a.getArmorMaterial().getEnchantability());
}
return otherEnchantmentCmp;
}
return compare;
}
private float getThresholdedDamageReduction(ItemStack itemStack) {
ItemArmor item = (ItemArmor) itemStack.getItem();
return getDamageReduction(item.getArmorMaterial().getDamageReductionAmount(item.armorType), 0) * (1 - getThresholdedEnchantmentDamageReduction(itemStack));
}
private float getDamageReduction(int defensePoints, int toughness) {
return 1 - Math.min(20.0f, Math.max(defensePoints / 5.0f, defensePoints - 1 / (2 + toughness / 4.0f))) / 25.0f;
}
private float getThresholdedEnchantmentDamageReduction(ItemStack itemStack) {
float sum = 0.0f;
for (int i = 0; i < DAMAGE_REDUCTION_ENCHANTMENTS.length; i++) {
sum += ItemUtils.getEnchantment(itemStack, DAMAGE_REDUCTION_ENCHANTMENTS[i]) * ENCHANTMENT_FACTORS[i] * ENCHANTMENT_DAMAGE_REDUCTION_FACTOR[i];
}
return sum;
}
private float getEnchantmentThreshold(ItemStack itemStack) {
float sum = 0.0f;
for (int i = 0; i < OTHER_ENCHANTMENTS.length; i++) {
sum += ItemUtils.getEnchantment(itemStack, OTHER_ENCHANTMENTS[i]) * OTHER_ENCHANTMENT_FACTORS[i];
}
return sum;
}
}
| 4,825 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
RenderUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/RenderUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.modules.render.Animations;
import net.ccbluex.liquidbounce.features.module.modules.render.TargetMark;
import net.ccbluex.liquidbounce.features.module.modules.world.Scaffold;
import net.ccbluex.liquidbounce.ui.font.Fonts;
import net.ccbluex.liquidbounce.utils.MinecraftInstance;
import net.ccbluex.liquidbounce.utils.block.BlockUtils;
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
import net.minecraft.block.Block;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.shader.ShaderGroup;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.*;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Timer;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
import static java.lang.Math.*;
import static org.lwjgl.opengl.GL11.*;
public final class RenderUtils extends MinecraftInstance {
private static final Map<Integer, Boolean> glCapMap = new HashMap<>();
public static int deltaTime;
private static final int[] DISPLAY_LISTS_2D = new int[4];
static {
for (int i = 0; i < DISPLAY_LISTS_2D.length; i++) {
DISPLAY_LISTS_2D[i] = glGenLists(1);
}
glNewList(DISPLAY_LISTS_2D[0], GL_COMPILE);
quickDrawRect(-7F, 2F, -4F, 3F);
quickDrawRect(4F, 2F, 7F, 3F);
quickDrawRect(-7F, 0.5F, -6F, 3F);
quickDrawRect(6F, 0.5F, 7F, 3F);
glEndList();
glNewList(DISPLAY_LISTS_2D[1], GL_COMPILE);
quickDrawRect(-7F, 3F, -4F, 3.3F);
quickDrawRect(4F, 3F, 7F, 3.3F);
quickDrawRect(-7.3F, 0.5F, -7F, 3.3F);
quickDrawRect(7F, 0.5F, 7.3F, 3.3F);
glEndList();
glNewList(DISPLAY_LISTS_2D[2], GL_COMPILE);
quickDrawRect(4F, -20F, 7F, -19F);
quickDrawRect(-7F, -20F, -4F, -19F);
quickDrawRect(6F, -20F, 7F, -17.5F);
quickDrawRect(-7F, -20F, -6F, -17.5F);
glEndList();
glNewList(DISPLAY_LISTS_2D[3], GL_COMPILE);
quickDrawRect(7F, -20F, 7.3F, -17.5F);
quickDrawRect(-7.3F, -20F, -7F, -17.5F);
quickDrawRect(4F, -20.3F, 7.3F, -20F);
quickDrawRect(-7.3F, -20.3F, -4F, -20F);
glEndList();
}
private static final Frustum frustrum = new Frustum();
protected static float zLevel = 0F;
/**
* Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height
*/
public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height, float zLevel)
{
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos((double)(x + 0), (double)(y + height), (double)zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + height), (double)zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + 0), (double)zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
worldrenderer.pos((double)(x + 0), (double)(y + 0), (double)zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
tessellator.draw();
}
public static boolean isInViewFrustrum(Entity entity) {
return isInViewFrustrum(entity.getEntityBoundingBox()) || entity.ignoreFrustumCheck;
}
private static boolean isInViewFrustrum(AxisAlignedBB bb) {
Entity current = mc.getRenderViewEntity();
frustrum.setPosition(current.posX, current.posY, current.posZ);
return frustrum.isBoundingBoxInFrustum(bb);
}
public static float interpolate(float current, float old, float scale) {
return old + (current - old) * scale;
}
public static double interpolate(double current, double old, double scale) {
return old + (current - old) * scale;
}
public static int SkyRainbow(int var2, float st, float bright) {
double v1 = Math.ceil(System.currentTimeMillis() + (long) (var2 * 109)) / 5;
return Color.getHSBColor((double) ((float) ((v1 %= 360.0) / 360.0)) < 0.5 ? -((float) (v1 / 360.0)) : (float) (v1 / 360.0), st, bright).getRGB();
}
public static Color skyRainbow(int var2, float st, float bright) {
double v1 = Math.ceil(System.currentTimeMillis() + (long) (var2 * 109)) / 5;
return Color.getHSBColor((double) ((float) ((v1 %= 360.0) / 360.0)) < 0.5 ? -((float) (v1 / 360.0)) : (float) (v1 / 360.0), st, bright);
}
public static int getRainbowOpaque(int seconds, float saturation, float brightness, int index) {
float hue = ((System.currentTimeMillis() + index) % (int) (seconds * 1000)) / (float) (seconds * 1000);
int color = Color.HSBtoRGB(hue, saturation, brightness);
return color;
}
public static int getNormalRainbow(int delay, float sat, float brg) {
double rainbowState = Math.ceil((System.currentTimeMillis() + delay) / 20.0);
rainbowState %= 360;
return Color.getHSBColor((float) (rainbowState / 360.0f), sat, brg).getRGB();
}
public static void startSmooth() {
glEnable(2848);
glEnable(2881);
glEnable(2832);
glEnable(3042);
glBlendFunc(770, 771);
glHint(3154, 4354);
glHint(3155, 4354);
glHint(3153, 4354);
}
public static void endSmooth() {
glDisable(2848);
glDisable(2881);
glEnable(2832);
}
public static void drawExhiRect(float x, float y, float x2, float y2) {
drawRect(x - 3.5F, y - 3.5F, x2 + 3.5F, y2 + 3.5F, Color.black.getRGB());
drawRect(x - 3F, y - 3F, x2 + 3F, y2 + 3F, new Color(50, 50, 50).getRGB());
//drawBorder(x - 1.5F, y - 1.5F, x2 + 1.5F, y2 + 1.5F, 2.5F, new Color(26, 26, 26).getRGB());
drawRect(x - 2.5F, y - 2.5F, x2 + 2.5F, y2 + 2.5F, new Color(26, 26, 26).getRGB());
drawRect(x - 0.5F, y - 0.5F, x2 + 0.5F, y2 + 0.5F, new Color(50, 50, 50).getRGB());
drawRect(x, y, x2, y2, new Color(18, 18, 18).getRGB());
}
public static void drawExhiRect(float x, float y, float x2, float y2, float alpha) {
drawRect(x - 3.5F, y - 3.5F, x2 + 3.5F, y2 + 3.5F, new Color(0, 0, 0, alpha).getRGB());
drawRect(x - 3F, y - 3F, x2 + 3F, y2 + 3F, new Color(50F / 255F, 50F / 255F, 50F / 255F, alpha).getRGB());
drawRect(x - 2.5F, y - 2.5F, x2 + 2.5F, y2 + 2.5F, new Color(26F / 255F, 26F / 255F, 26F / 255F, alpha).getRGB());
drawRect(x - 0.5F, y - 0.5F, x2 + 0.5F, y2 + 0.5F, new Color(50F / 255F, 50F / 255F, 50F / 255F, alpha).getRGB());
drawRect(x, y, x2, y2, new Color(18F / 255F, 18 / 255F, 18F / 255F, alpha).getRGB());
}
public static void drawMosswareRect(final float x, final float y, final float x2, final float y2, final float width,
final int color1, final int color2) {
drawRect(x, y, x2, y2, color2);
drawBorder(x, y, x2, y2, width, color1);
}
public static void drawRoundedRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, float radius, int color) {
drawRoundedRect(paramXStart, paramYStart, paramXEnd, paramYEnd, radius, color, true);
}
public static void originalRoundedRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, float radius, int color) {
float alpha = (color >> 24 & 0xFF) / 255.0F;
float red = (color >> 16 & 0xFF) / 255.0F;
float green = (color >> 8 & 0xFF) / 255.0F;
float blue = (color & 0xFF) / 255.0F;
float z = 0;
if (paramXStart > paramXEnd) {
z = paramXStart;
paramXStart = paramXEnd;
paramXEnd = z;
}
if (paramYStart > paramYEnd) {
z = paramYStart;
paramYStart = paramYEnd;
paramYEnd = z;
}
double x1 = (double)(paramXStart + radius);
double y1 = (double)(paramYStart + radius);
double x2 = (double)(paramXEnd - radius);
double y2 = (double)(paramYEnd - radius);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(red, green, blue, alpha);
worldrenderer.begin(GL_POLYGON, DefaultVertexFormats.POSITION);
double degree = Math.PI / 180;
for (double i = 0; i <= 90; i += 1)
worldrenderer.pos(x2 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius, 0.0D).endVertex();
for (double i = 90; i <= 180; i += 1)
worldrenderer.pos(x2 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius, 0.0D).endVertex();
for (double i = 180; i <= 270; i += 1)
worldrenderer.pos(x1 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius, 0.0D).endVertex();
for (double i = 270; i <= 360; i += 1)
worldrenderer.pos(x1 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius, 0.0D).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
public static void newDrawRect(float left, float top, float right, float bottom, int color)
{
if (left < right)
{
float i = left;
left = right;
right = i;
}
if (top < bottom)
{
float j = top;
top = bottom;
bottom = j;
}
float f3 = (float)(color >> 24 & 255) / 255.0F;
float f = (float)(color >> 16 & 255) / 255.0F;
float f1 = (float)(color >> 8 & 255) / 255.0F;
float f2 = (float)(color & 255) / 255.0F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(f, f1, f2, f3);
worldrenderer.begin(7, DefaultVertexFormats.POSITION);
worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex();
worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex();
worldrenderer.pos((double)right, (double)top, 0.0D).endVertex();
worldrenderer.pos((double)left, (double)top, 0.0D).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
public static void whatRoundedRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, final int color, float radius) {
float alpharect = (color >> 24 & 0xFF) / 255.0F;
float redrect = (color >> 16 & 0xFF) / 255.0F;
float greenrect = (color >> 8 & 0xFF) / 255.0F;
float bluerect = (color & 0xFF) / 255.0F;
float z = 0;
if (paramXStart > paramXEnd) {
z = paramXStart;
paramXStart = paramXEnd;
paramXEnd = z;
}
if (paramYStart > paramYEnd) {
z = paramYStart;
paramYStart = paramYEnd;
paramYEnd = z;
}
double x1 = (double)(paramXStart + radius);
double y1 = (double)(paramYStart + radius);
double x2 = (double)(paramXEnd - radius);
double y2 = (double)(paramYEnd - radius);
glPushMatrix();
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glLineWidth(1);
glColor(color);
glBegin(GL_POLYGON);
double degree = Math.PI / 180;
for (double i = 0; i <= 90; i += 1)
glVertex2d(x2 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius);
for (double i = 90; i <= 180; i += 1)
glVertex2d(x2 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius);
for (double i = 180; i <= 270; i += 1)
glVertex2d(x1 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius);
for (double i = 270; i <= 360; i += 1)
glVertex2d(x1 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glPopMatrix();
}
public static void newDrawRect(double left, double top, double right, double bottom, int color)
{
if (left < right)
{
double i = left;
left = right;
right = i;
}
if (top < bottom)
{
double j = top;
top = bottom;
bottom = j;
}
float f3 = (float)(color >> 24 & 255) / 255.0F;
float f = (float)(color >> 16 & 255) / 255.0F;
float f1 = (float)(color >> 8 & 255) / 255.0F;
float f2 = (float)(color & 255) / 255.0F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(f, f1, f2, f3);
worldrenderer.begin(7, DefaultVertexFormats.POSITION);
worldrenderer.pos(left, bottom, 0.0D).endVertex();
worldrenderer.pos(right, bottom, 0.0D).endVertex();
worldrenderer.pos(right, top, 0.0D).endVertex();
worldrenderer.pos(left, top, 0.0D).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
public static void drawRoundedRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, float radius, int color, boolean popPush) {
float alpha = (color >> 24 & 0xFF) / 255.0F;
float red = (color >> 16 & 0xFF) / 255.0F;
float green = (color >> 8 & 0xFF) / 255.0F;
float blue = (color & 0xFF) / 255.0F;
float z = 0;
if (paramXStart > paramXEnd) {
z = paramXStart;
paramXStart = paramXEnd;
paramXEnd = z;
}
if (paramYStart > paramYEnd) {
z = paramYStart;
paramYStart = paramYEnd;
paramYEnd = z;
}
double x1 = (double)(paramXStart + radius);
double y1 = (double)(paramYStart + radius);
double x2 = (double)(paramXEnd - radius);
double y2 = (double)(paramYEnd - radius);
if (popPush) glPushMatrix();
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glLineWidth(1);
glColor4f(red, green, blue, alpha);
glBegin(GL_POLYGON);
double degree = Math.PI / 180;
for (double i = 0; i <= 90; i += 1)
glVertex2d(x2 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius);
for (double i = 90; i <= 180; i += 1)
glVertex2d(x2 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius);
for (double i = 180; i <= 270; i += 1)
glVertex2d(x1 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius);
for (double i = 270; i <= 360; i += 1)
glVertex2d(x1 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
if (popPush) glPopMatrix();
}
// rTL = radius top left, rTR = radius top right, rBR = radius bottom right, rBL = radius bottom left
public static void customRounded(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, float rTL, float rTR, float rBR, float rBL, int color) {
float alpha = (color >> 24 & 0xFF) / 255.0F;
float red = (color >> 16 & 0xFF) / 255.0F;
float green = (color >> 8 & 0xFF) / 255.0F;
float blue = (color & 0xFF) / 255.0F;
float z = 0;
if (paramXStart > paramXEnd) {
z = paramXStart;
paramXStart = paramXEnd;
paramXEnd = z;
}
if (paramYStart > paramYEnd) {
z = paramYStart;
paramYStart = paramYEnd;
paramYEnd = z;
}
double xTL = paramXStart + rTL;
double yTL = paramYStart + rTL;
double xTR = paramXEnd - rTR;
double yTR = paramYStart + rTR;
double xBR = paramXEnd - rBR;
double yBR = paramYEnd - rBR;
double xBL = paramXStart + rBL;
double yBL = paramYEnd - rBL;
glPushMatrix();
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glLineWidth(1);
glColor4f(red, green, blue, alpha);
glBegin(GL_POLYGON);
double degree = Math.PI / 180;
if (rBR <= 0)
glVertex2d(xBR, yBR);
else for (double i = 0; i <= 90; i += 1)
glVertex2d(xBR + Math.sin(i * degree) * rBR, yBR + Math.cos(i * degree) * rBR);
if (rTR <= 0)
glVertex2d(xTR, yTR);
else for (double i = 90; i <= 180; i += 1)
glVertex2d(xTR + Math.sin(i * degree) * rTR, yTR + Math.cos(i * degree) * rTR);
if (rTL <= 0)
glVertex2d(xTL, yTL);
else for (double i = 180; i <= 270; i += 1)
glVertex2d(xTL + Math.sin(i * degree) * rTL, yTL + Math.cos(i * degree) * rTL);
if (rBL <= 0)
glVertex2d(xBL, yBL);
else for (double i = 270; i <= 360; i += 1)
glVertex2d(xBL + Math.sin(i * degree) * rBL, yBL + Math.cos(i * degree) * rBL);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glPopMatrix();
}
public static void fastRoundedRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, float radius) {
float z = 0;
if (paramXStart > paramXEnd) {
z = paramXStart;
paramXStart = paramXEnd;
paramXEnd = z;
}
if (paramYStart > paramYEnd) {
z = paramYStart;
paramYStart = paramYEnd;
paramYEnd = z;
}
double x1 = (double)(paramXStart + radius);
double y1 = (double)(paramYStart + radius);
double x2 = (double)(paramXEnd - radius);
double y2 = (double)(paramYEnd - radius);
glEnable(GL_LINE_SMOOTH);
glLineWidth(1);
glBegin(GL_POLYGON);
double degree = Math.PI / 180;
for (double i = 0; i <= 90; i += 1)
glVertex2d(x2 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius);
for (double i = 90; i <= 180; i += 1)
glVertex2d(x2 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius);
for (double i = 180; i <= 270; i += 1)
glVertex2d(x1 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius);
for (double i = 270; i <= 360; i += 1)
glVertex2d(x1 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius);
glEnd();
glDisable(GL_LINE_SMOOTH);
}
public static void drawTriAngle(float cx, float cy, float r, float n, Color color, boolean polygon) {
cx *= 2.0;
cy *= 2.0;
double b = 6.2831852 / n;
double p = Math.cos(b);
double s = Math.sin(b);
r *= 2.0;
double x = r;
double y = 0.0;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
glLineWidth(1F);
enableGlCap(GL_LINE_SMOOTH);
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.resetColor();
glColor(color);
GlStateManager.scale(0.5f, 0.5f, 0.5f);
worldrenderer.begin(polygon ? GL_POLYGON : 2, DefaultVertexFormats.POSITION);
int ii = 0;
while (ii < n) {
worldrenderer.pos((double)x + cx, (double)y + cy, 0.0D).endVertex();
double t = x;
x = p * x - s * y;
y = s * t + p * y;
ii++;
}
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
GlStateManager.scale(2f, 2f, 2f);
GlStateManager.color(1, 1, 1, 1);
}
public static void drawGradientSideways(final double left, final double top, final double right, final double bottom, final int col1, final int col2) {
final float f = (col1 >> 24 & 0xFF) / 255.0f;
final float f2 = (col1 >> 16 & 0xFF) / 255.0f;
final float f3 = (col1 >> 8 & 0xFF) / 255.0f;
final float f4 = (col1 & 0xFF) / 255.0f;
final float f5 = (col2 >> 24 & 0xFF) / 255.0f;
final float f6 = (col2 >> 16 & 0xFF) / 255.0f;
final float f7 = (col2 >> 8 & 0xFF) / 255.0f;
final float f8 = (col2 & 0xFF) / 255.0f;
glEnable(3042);
glDisable(3553);
glBlendFunc(770, 771);
glEnable(2848);
glShadeModel(7425);
glPushMatrix();
glBegin(7);
glColor4f(f2, f3, f4, f);
glVertex2d(left, top);
glVertex2d(left, bottom);
glColor4f(f6, f7, f8, f5);
glVertex2d(right, bottom);
glVertex2d(right, top);
glEnd();
glPopMatrix();
glEnable(3553);
glDisable(3042);
glDisable(2848);
glShadeModel(7424);
}
public static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor)
{
float f = (float)(startColor >> 24 & 255) / 255.0F;
float f1 = (float)(startColor >> 16 & 255) / 255.0F;
float f2 = (float)(startColor >> 8 & 255) / 255.0F;
float f3 = (float)(startColor & 255) / 255.0F;
float f4 = (float)(endColor >> 24 & 255) / 255.0F;
float f5 = (float)(endColor >> 16 & 255) / 255.0F;
float f6 = (float)(endColor >> 8 & 255) / 255.0F;
float f7 = (float)(endColor & 255) / 255.0F;
GlStateManager.pushMatrix();
GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
GlStateManager.disableAlpha();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.shadeModel(7425);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.pos((double)right, (double)top, (double)zLevel).color(f1, f2, f3, f).endVertex();
worldrenderer.pos((double)left, (double)top, (double)zLevel).color(f1, f2, f3, f).endVertex();
worldrenderer.pos((double)left, (double)bottom, (double)zLevel).color(f5, f6, f7, f4).endVertex();
worldrenderer.pos((double)right, (double)bottom, (double)zLevel).color(f5, f6, f7, f4).endVertex();
tessellator.draw();
GlStateManager.shadeModel(7424);
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
}
public static void drawGradientSideways(final float left, final float top, final float right, final float bottom, final int col1, final int col2) {
final float f = (col1 >> 24 & 0xFF) / 255.0f;
final float f2 = (col1 >> 16 & 0xFF) / 255.0f;
final float f3 = (col1 >> 8 & 0xFF) / 255.0f;
final float f4 = (col1 & 0xFF) / 255.0f;
final float f5 = (col2 >> 24 & 0xFF) / 255.0f;
final float f6 = (col2 >> 16 & 0xFF) / 255.0f;
final float f7 = (col2 >> 8 & 0xFF) / 255.0f;
final float f8 = (col2 & 0xFF) / 255.0f;
glEnable(3042);
glDisable(3553);
glBlendFunc(770, 771);
glEnable(2848);
glShadeModel(7425);
glPushMatrix();
glBegin(7);
glColor4f(f2, f3, f4, f);
glVertex2f(left, top);
glVertex2f(left, bottom);
glColor4f(f6, f7, f8, f5);
glVertex2f(right, bottom);
glVertex2f(right, top);
glEnd();
glPopMatrix();
glEnable(3553);
glDisable(3042);
glDisable(2848);
glShadeModel(7424);
}
public static void drawBlockBox(final BlockPos blockPos, final Color color, final boolean outline) {
final RenderManager renderManager = mc.getRenderManager();
final Timer timer = mc.timer;
final double x = blockPos.getX() - renderManager.renderPosX;
final double y = blockPos.getY() - renderManager.renderPosY;
final double z = blockPos.getZ() - renderManager.renderPosZ;
AxisAlignedBB axisAlignedBB = new AxisAlignedBB(x, y, z, x + 1.0, y + 1, z + 1.0);
final Block block = BlockUtils.getBlock(blockPos);
if (block != null) {
final EntityPlayer player = mc.thePlayer;
final double posX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) timer.renderPartialTicks;
final double posY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) timer.renderPartialTicks;
final double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) timer.renderPartialTicks;
axisAlignedBB = block.getSelectedBoundingBox(mc.theWorld, blockPos)
.expand(0.0020000000949949026D, 0.0020000000949949026D, 0.0020000000949949026D)
.offset(-posX, -posY, -posZ);
}
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
enableGlCap(GL_BLEND);
disableGlCap(GL_TEXTURE_2D, GL_DEPTH_TEST);
glDepthMask(false);
glColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() != 255 ? color.getAlpha() : outline ? 26 : 35);
drawFilledBox(axisAlignedBB);
if (outline) {
glLineWidth(1F);
enableGlCap(GL_LINE_SMOOTH);
glColor(color);
drawSelectionBoundingBox(axisAlignedBB);
}
GlStateManager.resetColor();
glDepthMask(true);
resetCaps();
}
public static void drawSelectionBoundingBox(AxisAlignedBB boundingBox) {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
// Lower Rectangle
worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex();
// Upper Rectangle
worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex();
// Upper Rectangle
worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex();
tessellator.draw();
}
public static void drawEntityBox(final Entity entity, final Color color, final boolean outline) {
final RenderManager renderManager = mc.getRenderManager();
final Timer timer = mc.timer;
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
enableGlCap(GL_BLEND);
disableGlCap(GL_TEXTURE_2D, GL_DEPTH_TEST);
glDepthMask(false);
final double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * timer.renderPartialTicks
- renderManager.renderPosX;
final double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * timer.renderPartialTicks
- renderManager.renderPosY;
final double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * timer.renderPartialTicks
- renderManager.renderPosZ;
final AxisAlignedBB entityBox = entity.getEntityBoundingBox();
final AxisAlignedBB axisAlignedBB = new AxisAlignedBB(
entityBox.minX - entity.posX + x - 0.05D,
entityBox.minY - entity.posY + y,
entityBox.minZ - entity.posZ + z - 0.05D,
entityBox.maxX - entity.posX + x + 0.05D,
entityBox.maxY - entity.posY + y + 0.15D,
entityBox.maxZ - entity.posZ + z + 0.05D
);
if (outline) {
glLineWidth(1F);
enableGlCap(GL_LINE_SMOOTH);
glColor(color.getRed(), color.getGreen(), color.getBlue(), 95);
drawSelectionBoundingBox(axisAlignedBB);
}
glColor(color.getRed(), color.getGreen(), color.getBlue(), outline ? 26 : 35);
drawFilledBox(axisAlignedBB);
GlStateManager.resetColor();
glDepthMask(true);
resetCaps();
}
public static void drawAxisAlignedBB(final AxisAlignedBB axisAlignedBB, final Color color) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glLineWidth(2F);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
glColor(color);
drawFilledBox(axisAlignedBB);
GlStateManager.resetColor();
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
glDisable(GL_BLEND);
}
public static void drawPlatform(final double y, final Color color, final double size) {
final RenderManager renderManager = mc.getRenderManager();
final double renderY = y - renderManager.renderPosY;
drawAxisAlignedBB(new AxisAlignedBB(size, renderY + 0.02D, size, -size, renderY, -size), color);
}
public static void drawPlatform(final Entity entity, final Color color) {
final RenderManager renderManager = mc.getRenderManager();
final Timer timer = mc.timer;
TargetMark targetMark = LiquidBounce.moduleManager.getModule(TargetMark.class);
if (targetMark == null)
return;
final double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * timer.renderPartialTicks
- renderManager.renderPosX;
final double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * timer.renderPartialTicks
- renderManager.renderPosY;
final double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * timer.renderPartialTicks
- renderManager.renderPosZ;
final AxisAlignedBB axisAlignedBB = entity.getEntityBoundingBox()
.offset(-entity.posX, -entity.posY, -entity.posZ)
.offset(x, y - targetMark.moveMarkValue.get(), z);
drawAxisAlignedBB(
new AxisAlignedBB(axisAlignedBB.minX, axisAlignedBB.maxY + 0.2, axisAlignedBB.minZ, axisAlignedBB.maxX, axisAlignedBB.maxY + 0.26, axisAlignedBB.maxZ),
color
);
}
public static void drawFilledBox(final AxisAlignedBB axisAlignedBB) {
final Tessellator tessellator = Tessellator.getInstance();
final WorldRenderer worldRenderer = tessellator.getWorldRenderer();
worldRenderer.begin(7, DefaultVertexFormats.POSITION);
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
tessellator.draw();
}
public static void drawEntityOnScreen(final double posX, final double posY, final float scale, final EntityLivingBase entity) {
GlStateManager.pushMatrix();
GlStateManager.enableColorMaterial();
GlStateManager.translate(posX, posY, 50.0);
GlStateManager.scale((-scale), scale, scale);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(135F, 0F, 1F, 0F);
RenderHelper.enableStandardItemLighting();
GlStateManager.rotate(-135F, 0F, 1F, 0F);
GlStateManager.translate(0.0, 0.0, 0.0);
RenderManager rendermanager = mc.getRenderManager();
rendermanager.setPlayerViewY(180F);
rendermanager.setRenderShadow(false);
rendermanager.renderEntityWithPosYaw(entity, 0.0, 0.0, 0.0, 0F, 1F);
rendermanager.setRenderShadow(true);
GlStateManager.popMatrix();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GlStateManager.disableTexture2D();
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
}
public static void drawEntityOnScreen(final int posX, final int posY, final int scale, final EntityLivingBase entity) {
drawEntityOnScreen(posX, posY, (float) scale, entity);
}
public static void quickDrawRect(final float x, final float y, final float x2, final float y2) {
glBegin(GL_QUADS);
glVertex2d(x2, y);
glVertex2d(x, y);
glVertex2d(x, y2);
glVertex2d(x2, y2);
glEnd();
}
public static void drawRect(final float x, final float y, final float x2, final float y2, final int color) {
glPushMatrix();
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glColor(color);
glBegin(GL_QUADS);
glVertex2d(x2, y);
glVertex2d(x, y);
glVertex2d(x, y2);
glVertex2d(x2, y2);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glPopMatrix();
}
public static void drawRect(double left, double top, double right, double bottom, int color)
{
if (left < right)
{
double i = left;
left = right;
right = i;
}
if (top < bottom)
{
double j = top;
top = bottom;
bottom = j;
}
float f3 = (float)(color >> 24 & 255) / 255.0F;
float f = (float)(color >> 16 & 255) / 255.0F;
float f1 = (float)(color >> 8 & 255) / 255.0F;
float f2 = (float)(color & 255) / 255.0F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(f, f1, f2, f3);
worldrenderer.begin(7, DefaultVertexFormats.POSITION);
worldrenderer.pos(left, bottom, 0.0D).endVertex();
worldrenderer.pos(right, bottom, 0.0D).endVertex();
worldrenderer.pos(right, top, 0.0D).endVertex();
worldrenderer.pos(left, top, 0.0D).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
/**
* Like {@link #drawRect(float, float, float, float, int)}, but without setup
*/
public static void quickDrawRect(final float x, final float y, final float x2, final float y2, final int color) {
glColor(color);
glBegin(GL_QUADS);
glVertex2d(x2, y);
glVertex2d(x, y);
glVertex2d(x, y2);
glVertex2d(x2, y2);
glEnd();
}
public static void drawRect(final float x, final float y, final float x2, final float y2, final Color color) {
drawRect(x, y, x2, y2, color.getRGB());
}
public static void drawBorderedRect(final float x, final float y, final float x2, final float y2, final float width,
final int color1, final int color2) {
drawRect(x, y, x2, y2, color2);
drawBorder(x, y, x2, y2, width, color1);
}
public static void drawBorder(float x, float y, float x2, float y2, float width, int color1) {
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glColor(color1);
glLineWidth(width);
glBegin(GL_LINE_LOOP);
glVertex2d(x2, y);
glVertex2d(x, y);
glVertex2d(x, y2);
glVertex2d(x2, y2);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
}
public static void drawRectBasedBorder(float x, float y, float x2, float y2, float width, int color1) {
drawRect(x - width / 2F, y - width / 2F, x2 + width / 2F, y + width / 2F, color1);
drawRect(x - width / 2F, y + width / 2F, x + width / 2F, y2 + width / 2F, color1);
drawRect(x2 - width / 2F, y + width / 2F, x2 + width / 2F, y2 + width / 2F, color1);
drawRect(x + width / 2F, y2 - width / 2F, x2 - width / 2F, y2 + width / 2F, color1);
}
public static void drawRectBasedBorder(double x, double y, double x2, double y2, double width, int color1) {
newDrawRect(x - width / 2F, y - width / 2F, x2 + width / 2F, y + width / 2F, color1);
newDrawRect(x - width / 2F, y + width / 2F, x + width / 2F, y2 + width / 2F, color1);
newDrawRect(x2 - width / 2F, y + width / 2F, x2 + width / 2F, y2 + width / 2F, color1);
newDrawRect(x + width / 2F, y2 - width / 2F, x2 - width / 2F, y2 + width / 2F, color1);
}
public static void quickDrawBorderedRect(final float x, final float y, final float x2, final float y2, final float width, final int color1, final int color2) {
quickDrawRect(x, y, x2, y2, color2);
glColor(color1);
glLineWidth(width);
glBegin(GL_LINE_LOOP);
glVertex2d(x2, y);
glVertex2d(x, y);
glVertex2d(x, y2);
glVertex2d(x2, y2);
glEnd();
}
public static void drawLoadingCircle(float x, float y) {
for (int i = 0; i < 4; i++) {
int rot = (int) ((System.nanoTime() / 5000000 * i) % 360);
drawCircle(x, y, i * 10, rot - 180, rot);
}
}
public static void drawCircle(float x, float y, float radius, float lineWidth, int start, int end, Color color) {
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
glColor(color);
glEnable(GL_LINE_SMOOTH);
glLineWidth(lineWidth);
glBegin(GL_LINE_STRIP);
for (float i = end; i >= start; i -= (360 / 90.0f)) {
glVertex2f((float) (x + (cos(i * PI / 180) * (radius * 1.001F))), (float) (y + (sin(i * PI / 180) * (radius * 1.001F))));
}
glEnd();
glDisable(GL_LINE_SMOOTH);
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
public static void drawCircle(float x, float y, float radius, float lineWidth, int start, int end) {
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
glColor(Color.WHITE);
glEnable(GL_LINE_SMOOTH);
glLineWidth(lineWidth);
glBegin(GL_LINE_STRIP);
for (float i = end; i >= start; i -= (360 / 90.0f)) {
glVertex2f((float) (x + (cos(i * PI / 180) * (radius * 1.001F))), (float) (y + (sin(i * PI / 180) * (radius * 1.001F))));
}
glEnd();
glDisable(GL_LINE_SMOOTH);
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
public static void drawCircle(float x, float y, float radius, int start, int end) {
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
glColor(Color.WHITE);
glEnable(GL_LINE_SMOOTH);
glLineWidth(2F);
glBegin(GL_LINE_STRIP);
for (float i = end; i >= start; i -= (360 / 90.0f)) {
glVertex2f((float) (x + (cos(i * PI / 180) * (radius * 1.001F))), (float) (y + (sin(i * PI / 180) * (radius * 1.001F))));
}
glEnd();
glDisable(GL_LINE_SMOOTH);
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
public static void drawFilledCircle(final int xx, final int yy, final float radius, final Color color) {
int sections = 50;
double dAngle = 2 * Math.PI / sections;
float x, y;
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glBegin(GL_TRIANGLE_FAN);
for (int i = 0; i < sections; i++) {
x = (float) (radius * Math.sin((i * dAngle)));
y = (float) (radius * Math.cos((i * dAngle)));
glColor4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, color.getAlpha() / 255F);
glVertex2f(xx + x, yy + y);
}
GlStateManager.color(0, 0, 0);
glEnd();
glPopAttrib();
}
public static void drawFilledCircle(final float xx, final float yy, final float radius, final Color color) {
int sections = 50;
double dAngle = 2 * Math.PI / sections;
float x, y;
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glBegin(GL_TRIANGLE_FAN);
for (int i = 0; i < sections; i++) {
x = (float) (radius * Math.sin((i * dAngle)));
y = (float) (radius * Math.cos((i * dAngle)));
glColor4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, color.getAlpha() / 255F);
glVertex2f(xx + x, yy + y);
}
GlStateManager.color(0, 0, 0);
glEnd();
glPopAttrib();
}
public static void drawImage(ResourceLocation image, int x, int y, int width, int height) {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glDepthMask(false);
OpenGlHelper.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(image);
Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, width, height, width, height);
glDepthMask(true);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
}
public static void drawImage(ResourceLocation image, int x, int y, int width, int height, float alpha) {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glDepthMask(false);
OpenGlHelper.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
glColor4f(1.0F, 1.0F, 1.0F, alpha);
mc.getTextureManager().bindTexture(image);
Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, width, height, width, height);
glDepthMask(true);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
}
public static void drawImage2(ResourceLocation image, float x, float y, int width, int height) {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glDepthMask(false);
OpenGlHelper.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
glTranslatef(x, y, x);
mc.getTextureManager().bindTexture(image);
Gui.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, width, height, width, height);
glTranslatef(-x, -y, -x);
glDepthMask(true);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
}
public static void drawImage3(ResourceLocation image, float x, float y, int width, int height, float r, float g, float b, float al) {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glDepthMask(false);
OpenGlHelper.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
glColor4f(r, g, b, al);
glTranslatef(x, y, x);
mc.getTextureManager().bindTexture(image);
Gui.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, width, height, width, height);
glTranslatef(-x, -y, -x);
glDepthMask(true);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
}
public static void drawExhiEnchants(ItemStack stack, float x, float y) {
RenderHelper.disableStandardItemLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
GlStateManager.resetColor();
final int darkBorder = 0xFF000000;
if (stack.getItem() instanceof ItemArmor) {
int prot = EnchantmentHelper.getEnchantmentLevel(Enchantment.protection.effectId, stack);
int unb = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack);
int thorn = EnchantmentHelper.getEnchantmentLevel(Enchantment.thorns.effectId, stack);
if (prot > 0) {
drawExhiOutlined(prot + "", drawExhiOutlined("P", x, y, 0.35F, darkBorder, -1, true), y, 0.35F, getBorderColor(prot), getMainColor(prot), true);
y += 4;
}
if (unb > 0) {
drawExhiOutlined(unb + "", drawExhiOutlined("U", x, y, 0.35F, darkBorder, -1, true), y, 0.35F, getBorderColor(unb),getMainColor(unb), true);
y += 4;
}
if (thorn > 0) {
drawExhiOutlined(thorn + "", drawExhiOutlined("T", x, y, 0.35F, darkBorder, -1, true), y, 0.35F, getBorderColor(thorn), getMainColor(thorn), true);
y += 4;
}
}
if (stack.getItem() instanceof ItemBow) {
int power = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack);
int punch = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack);
int flame = EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack);
int unb = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack);
if (power > 0) {
drawExhiOutlined(power + "", drawExhiOutlined("Pow", x, y, 0.35F, darkBorder, -1, true), y, 0.35F, getBorderColor(power), getMainColor(power), true);
y += 4;
}
if (punch > 0) {
drawExhiOutlined(punch + "", drawExhiOutlined("Pun", x, y, 0.35F, darkBorder, -1, true), y, 0.35F, getBorderColor(punch), getMainColor(punch), true);
y += 4;
}
if (flame > 0) {
drawExhiOutlined(flame + "", drawExhiOutlined("F", x, y, 0.35F, darkBorder, -1, true), y, 0.35F, getBorderColor(flame), getMainColor(flame), true);
y += 4;
}
if (unb > 0) {
drawExhiOutlined(unb + "", drawExhiOutlined("U", x, y, 0.35F, darkBorder, -1, true), y, 0.35F, getBorderColor(unb), getMainColor(unb), true);
y += 4;
}
}
if (stack.getItem() instanceof ItemSword) {
int sharp = EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, stack);
int kb = EnchantmentHelper.getEnchantmentLevel(Enchantment.knockback.effectId, stack);
int fire = EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack);
int unb = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack);
if (sharp > 0) {
drawExhiOutlined(sharp + "", drawExhiOutlined("S", x, y, 0.35F, darkBorder, -1, true), y, 0.35F, getBorderColor(sharp), getMainColor(sharp), true);
y += 4;
}
if (kb > 0) {
drawExhiOutlined(kb + "", drawExhiOutlined("K", x, y, 0.35F, darkBorder, -1, true), y, 0.35F, getBorderColor(kb), getMainColor(kb), true);
y += 4;
}
if (fire > 0) {
drawExhiOutlined(fire + "", drawExhiOutlined("F", x, y, 0.35F, darkBorder, -1, true), y, 0.35F, getBorderColor(fire), getMainColor(fire), true);
y += 4;
}
if (unb > 0) {
drawExhiOutlined(unb + "", drawExhiOutlined("U", x, y, 0.35F, darkBorder, -1, true), y, 0.35F, getBorderColor(unb), getMainColor(unb), true);
y += 4;
}
}
GlStateManager.enableDepth();
RenderHelper.enableGUIStandardItemLighting();
}
private static float drawExhiOutlined(String text, float x, float y, float borderWidth, int borderColor, int mainColor, boolean drawText) {
Fonts.fontTahomaSmall.drawString(text, x, y - borderWidth, borderColor);
Fonts.fontTahomaSmall.drawString(text, x, y + borderWidth, borderColor);
Fonts.fontTahomaSmall.drawString(text, x - borderWidth, y, borderColor);
Fonts.fontTahomaSmall.drawString(text, x + borderWidth, y, borderColor);
if (drawText)
Fonts.fontTahomaSmall.drawString(text, x, y, mainColor);
return x + Fonts.fontTahomaSmall.getWidth(text) - 2F;
}
private static int getMainColor(int level) {
if (level == 4)
return 0xFFAA0000;
return -1;
}
private static int getBorderColor(int level) {
if (level == 2)
return 0x7055FF55;
if (level == 3)
return 0x7000AAAA;
if (level == 4)
return 0x70AA0000;
if (level >= 5)
return 0x70FFAA00;
return 0x70FFFFFF;
}
public static void glColor(final int red, final int green, final int blue, final int alpha) {
GlStateManager.color(red / 255F, green / 255F, blue / 255F, alpha / 255F);
}
public static void glColor(final Color color) {
final float red = color.getRed() / 255F;
final float green = color.getGreen() / 255F;
final float blue = color.getBlue() / 255F;
final float alpha = color.getAlpha() / 255F;
GlStateManager.color(red, green, blue, alpha);
}
public static void glColor(final int hex) {
final float alpha = (hex >> 24 & 0xFF) / 255F;
final float red = (hex >> 16 & 0xFF) / 255F;
final float green = (hex >> 8 & 0xFF) / 255F;
final float blue = (hex & 0xFF) / 255F;
GlStateManager.color(red, green, blue, alpha);
}
public static void draw2D(final EntityLivingBase entity, final double posX, final double posY, final double posZ, final int color, final int backgroundColor) {
GlStateManager.pushMatrix();
GlStateManager.translate(posX, posY, posZ);
GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0F, 1F, 0F);
GlStateManager.scale(-0.1D, -0.1D, 0.1D);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.depthMask(true);
glColor(color);
glCallList(DISPLAY_LISTS_2D[0]);
glColor(backgroundColor);
glCallList(DISPLAY_LISTS_2D[1]);
GlStateManager.translate(0, 21 + -(entity.getEntityBoundingBox().maxY - entity.getEntityBoundingBox().minY) * 12, 0);
glColor(color);
glCallList(DISPLAY_LISTS_2D[2]);
glColor(backgroundColor);
glCallList(DISPLAY_LISTS_2D[3]);
// Stop render
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
GlStateManager.popMatrix();
}
public static void draw2D(final BlockPos blockPos, final int color, final int backgroundColor) {
final RenderManager renderManager = mc.getRenderManager();
final double posX = (blockPos.getX() + 0.5) - renderManager.renderPosX;
final double posY = blockPos.getY() - renderManager.renderPosY;
final double posZ = (blockPos.getZ() + 0.5) - renderManager.renderPosZ;
GlStateManager.pushMatrix();
GlStateManager.translate(posX, posY, posZ);
GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0F, 1F, 0F);
GlStateManager.scale(-0.1D, -0.1D, 0.1D);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.depthMask(true);
glColor(color);
glCallList(DISPLAY_LISTS_2D[0]);
glColor(backgroundColor);
glCallList(DISPLAY_LISTS_2D[1]);
GlStateManager.translate(0, 9, 0);
glColor(color);
glCallList(DISPLAY_LISTS_2D[2]);
glColor(backgroundColor);
glCallList(DISPLAY_LISTS_2D[3]);
// Stop render
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
GlStateManager.popMatrix();
}
public static void renderNameTag(final String string, final double x, final double y, final double z) {
final RenderManager renderManager = mc.getRenderManager();
glPushMatrix();
glTranslated(x - renderManager.renderPosX, y - renderManager.renderPosY, z - renderManager.renderPosZ);
glNormal3f(0F, 1F, 0F);
glRotatef(-mc.getRenderManager().playerViewY, 0F, 1F, 0F);
glRotatef(mc.getRenderManager().playerViewX, 1F, 0F, 0F);
glScalef(-0.05F, -0.05F, 0.05F);
setGlCap(GL_LIGHTING, false);
setGlCap(GL_DEPTH_TEST, false);
setGlCap(GL_BLEND, true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
final int width = Fonts.font35.getStringWidth(string) / 2;
Gui.drawRect(-width - 1, -1, width + 1, Fonts.font35.FONT_HEIGHT, Integer.MIN_VALUE);
Fonts.font35.drawString(string, -width, 1.5F, Color.WHITE.getRGB(), true);
resetCaps();
glColor4f(1F, 1F, 1F, 1F);
glPopMatrix();
}
public static void drawLine(final float x, final float y, final float x1, final float y1, final float width) {
glDisable(GL_TEXTURE_2D);
glLineWidth(width);
glBegin(GL_LINES);
glVertex2f(x, y);
glVertex2f(x1, y1);
glEnd();
glEnable(GL_TEXTURE_2D);
}
public static void drawLine(final double x, final double y, final double x1, final double y1, final float width) {
glDisable(GL_TEXTURE_2D);
glLineWidth(width);
glBegin(GL_LINES);
glVertex2d(x, y);
glVertex2d(x1, y1);
glEnd();
glEnable(GL_TEXTURE_2D);
}
public static void makeScissorBox(final float x, final float y, final float x2, final float y2) {
final ScaledResolution scaledResolution = new ScaledResolution(mc);
final int factor = scaledResolution.getScaleFactor();
glScissor((int) (x * factor), (int) ((scaledResolution.getScaledHeight() - y2) * factor), (int) ((x2 - x) * factor), (int) ((y2 - y) * factor));
}
/**
* GL CAP MANAGER
*
* TODO: Remove gl cap manager and replace by something better
*/
public static void resetCaps() {
glCapMap.forEach(RenderUtils::setGlState);
}
public static void enableGlCap(final int cap) {
setGlCap(cap, true);
}
public static void enableGlCap(final int... caps) {
for (final int cap : caps)
setGlCap(cap, true);
}
public static void disableGlCap(final int cap) {
setGlCap(cap, true);
}
public static void disableGlCap(final int... caps) {
for (final int cap : caps)
setGlCap(cap, false);
}
public static void setGlCap(final int cap, final boolean state) {
glCapMap.put(cap, glGetBoolean(cap));
setGlState(cap, state);
}
public static void setGlState(final int cap, final boolean state) {
if (state)
glEnable(cap);
else
glDisable(cap);
}
}
| 63,440 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
BlendUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/BlendUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render;
import java.awt.Color;
public enum BlendUtils {
GREEN("§A"),
GOLD("§6"),
RED("§C");
String colorCode;
private BlendUtils(String colorCode) {
this.colorCode = colorCode;
}
public static Color getColorWithOpacity(Color color, int alpha) {
return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha);
}
public static Color getHealthColor(float health, float maxHealth) {
float[] fractions = new float[]{0.0F, 0.5F, 1.0F};
Color[] colors = new Color[]{new Color(108, 0, 0), new Color(255, 51, 0), Color.GREEN};
float progress = health / maxHealth;
return blendColors(fractions, colors, progress).brighter();
}
public static Color blendColors(float[] fractions, Color[] colors, float progress) {
if (fractions.length == colors.length) {
int[] indices = getFractionIndices(fractions, progress);
float[] range = new float[]{fractions[indices[0]], fractions[indices[1]]};
Color[] colorRange = new Color[]{colors[indices[0]], colors[indices[1]]};
float max = range[1] - range[0];
float value = progress - range[0];
float weight = value / max;
Color color = blend(colorRange[0], colorRange[1], (double)(1.0F - weight));
return color;
} else {
throw new IllegalArgumentException("Fractions and colours must have equal number of elements");
}
}
public static int[] getFractionIndices(float[] fractions, float progress) {
int[] range = new int[2];
int startPoint;
for(startPoint = 0; startPoint < fractions.length && fractions[startPoint] <= progress; ++startPoint) {
}
if (startPoint >= fractions.length) {
startPoint = fractions.length - 1;
}
range[0] = startPoint - 1;
range[1] = startPoint;
return range;
}
public static Color blend(Color color1, Color color2, double ratio) {
float r = (float)ratio;
float ir = 1.0F - r;
float[] rgb1 = color1.getColorComponents(new float[3]);
float[] rgb2 = color2.getColorComponents(new float[3]);
float red = rgb1[0] * r + rgb2[0] * ir;
float green = rgb1[1] * r + rgb2[1] * ir;
float blue = rgb1[2] * r + rgb2[2] * ir;
if (red < 0.0F) {
red = 0.0F;
} else if (red > 255.0F) {
red = 255.0F;
}
if (green < 0.0F) {
green = 0.0F;
} else if (green > 255.0F) {
green = 255.0F;
}
if (blue < 0.0F) {
blue = 0.0F;
} else if (blue > 255.0F) {
blue = 255.0F;
}
Color color3 = null;
try {
color3 = new Color(red, green, blue);
} catch (IllegalArgumentException var13) {
}
return color3;
}
}
| 3,014 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
CustomTexture.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/CustomTexture.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render;
import net.minecraft.client.renderer.texture.TextureUtil;
import org.lwjgl.opengl.GL11;
import java.awt.image.BufferedImage;
public class CustomTexture {
private final BufferedImage image;
private boolean unloaded;
private int textureId = -1;
public CustomTexture(BufferedImage image) {
this.image = image;
}
/**
* @return ID of this texture loaded into memory
* @throws IllegalStateException If the texture was unloaded via {@link #unload()}
*/
public int getTextureId() {
if (unloaded)
throw new IllegalStateException("Texture unloaded");
if (textureId == -1)
textureId = TextureUtil.uploadTextureImageAllocate(TextureUtil.glGenTextures(), image, true, true);
return textureId;
}
public void unload() {
if (!unloaded) {
GL11.glDeleteTextures(textureId);
unloaded = true;
}
}
@Override
protected void finalize() throws Throwable {
super.finalize();
unload();
}
}
| 1,289 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
IconUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/IconUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render;
import net.ccbluex.liquidbounce.LiquidBounce;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
public final class IconUtils {
public static ByteBuffer[] getFavicon() {
try {
return new ByteBuffer[] {readImageToBuffer(IconUtils.class.getResourceAsStream("/assets/minecraft/liquidbounce+/icon_16x16.png")), readImageToBuffer(IconUtils.class.getResourceAsStream("/assets/minecraft/liquidbounce+/icon_32x32.png"))};
}catch(IOException e) {
e.printStackTrace();
}
return null;
}
private static ByteBuffer readImageToBuffer(final InputStream imageStream) throws IOException {
if(imageStream == null)
return null;
final BufferedImage bufferedImage = ImageIO.read(imageStream);
final int[] rgb = bufferedImage.getRGB(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight(), null, 0, bufferedImage.getWidth());
final ByteBuffer byteBuffer = ByteBuffer.allocate(4 * rgb.length);
for(int i : rgb)
byteBuffer.putInt(i << 8 | i >> 24 & 255);
((java.nio.Buffer)byteBuffer).flip();
return byteBuffer;
}
}
| 1,488 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ParticleUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/ParticleUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render;
import net.vitox.ParticleGenerator;
public final class ParticleUtils {
private static final ParticleGenerator particleGenerator = new ParticleGenerator(100);
public static void drawParticles(int mouseX, int mouseY) {
particleGenerator.draw(mouseX, mouseY);
}
public static void drawSnowFall(int mouseX, int mouseY) {
particleGenerator.draw2(mouseX, mouseY);
}
}
| 648 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Stencil.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/Stencil.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.shader.Framebuffer;
import org.lwjgl.opengl.EXTFramebufferObject;
import static org.lwjgl.opengl.GL11.*;
public class Stencil {
static Minecraft mc = Minecraft.getMinecraft();
public static void dispose() {
glDisable(GL_STENCIL_TEST);
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
}
public static void erase(boolean invert) {
glStencilFunc(invert ? GL_EQUAL : GL_NOTEQUAL, 1, 65535);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
GlStateManager.colorMask(true, true, true, true);
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
glAlphaFunc(GL_GREATER, 0.0f);
}
public static void write(boolean renderClipLayer) {
Stencil.checkSetupFBO();
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 1, 65535);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
if (!renderClipLayer)
GlStateManager.colorMask(false, false, false, false);
}
public static void write(boolean renderClipLayer, Framebuffer fb, boolean clearStencil, boolean invert) {
Stencil.checkSetupFBO(fb);
if (clearStencil) {
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
glEnable(GL_STENCIL_TEST);
}
glStencilFunc(GL_ALWAYS, invert ? 0 : 1, 65535);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
if (!renderClipLayer)
GlStateManager.colorMask(false, false, false, false);
}
public static void checkSetupFBO() {
Framebuffer fbo = mc.getFramebuffer();
if (fbo != null && fbo.depthBuffer > -1) {
Stencil.setupFBO(fbo);
fbo.depthBuffer = -1;
}
}
public static void checkSetupFBO(Framebuffer fbo) {
if (fbo != null && fbo.depthBuffer > -1) {
Stencil.setupFBO(fbo);
fbo.depthBuffer = -1;
}
}
public static void setupFBO(Framebuffer fbo) {
EXTFramebufferObject.glDeleteRenderbuffersEXT(fbo.depthBuffer);
int stencil_depth_buffer_ID = EXTFramebufferObject.glGenRenderbuffersEXT();
EXTFramebufferObject.glBindRenderbufferEXT(36161, stencil_depth_buffer_ID);
EXTFramebufferObject.glRenderbufferStorageEXT(36161, 34041, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
EXTFramebufferObject.glFramebufferRenderbufferEXT(36160, 36128, 36161, stencil_depth_buffer_ID);
EXTFramebufferObject.glFramebufferRenderbufferEXT(36160, 36096, 36161, stencil_depth_buffer_ID);
}
}
| 3,018 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
WorldToScreen.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/WorldToScreen.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector2f;
import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.Vector4f;
import java.nio.FloatBuffer;
public class WorldToScreen {
public static Matrix4f getMatrix(int matrix) {
FloatBuffer floatBuffer = BufferUtils.createFloatBuffer(16);
GL11.glGetFloat(matrix, floatBuffer);
return (Matrix4f) new Matrix4f().load(floatBuffer);
}
public static Vector2f worldToScreen(Vector3f pointInWorld, int screenWidth, int screenHeight) {
return worldToScreen(pointInWorld, getMatrix(GL11.GL_MODELVIEW_MATRIX), getMatrix(GL11.GL_PROJECTION_MATRIX), screenWidth, screenHeight);
}
public static Vector2f worldToScreen(Vector3f pointInWorld, Matrix4f view, Matrix4f projection, int screenWidth, int screenHeight) {
Vector4f clipSpacePos = multiply(multiply(new Vector4f(pointInWorld.x, pointInWorld.y, pointInWorld.z, 1.0f), view), projection);
Vector3f ndcSpacePos = new Vector3f(clipSpacePos.x / clipSpacePos.w, clipSpacePos.y / clipSpacePos.w, clipSpacePos.z / clipSpacePos.w);
// System.out.println(pointInNdc);
float screenX = ((ndcSpacePos.x + 1.0f) / 2.0f) * screenWidth;
float screenY = ((1.0f - ndcSpacePos.y) / 2.0f) * screenHeight;
// nPlane = -1, fPlane = 1
if (ndcSpacePos.z < -1.0 || ndcSpacePos.z > 1.0) {
return null;
}
return new Vector2f(screenX, screenY);
}
public static Vector4f multiply(Vector4f vec, Matrix4f mat) {
return new Vector4f(
vec.x * mat.m00 + vec.y * mat.m10 + vec.z * mat.m20 + vec.w * mat.m30,
vec.x * mat.m01 + vec.y * mat.m11 + vec.z * mat.m21 + vec.w * mat.m31,
vec.x * mat.m02 + vec.y * mat.m12 + vec.z * mat.m22 + vec.w * mat.m32,
vec.x * mat.m03 + vec.y * mat.m13 + vec.z * mat.m23 + vec.w * mat.m33
);
}
}
| 2,258 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
UiUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/UiUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.GL_LINE_SMOOTH;
public class UiUtils
{
public UiUtils() {
super();
}
public static int width() {
return new ScaledResolution(Minecraft.getMinecraft()).getScaledWidth();
}
public static int height() {
return new ScaledResolution(Minecraft.getMinecraft()).getScaledHeight();
}
public static int anima(int target,int speed) {
int a=0;
if(a<target) {
a+=speed;
}
if(a>target) {
a-=speed;
}
return a;
}
private static float clamp(float t, float x, float y) {
if (t < x) return x;
if (t > y) return y;
return t;
}
public static void drawImage(ResourceLocation image, int x, int y, int width, int height) {
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
GL11.glDisable((int)2929);
GL11.glEnable((int)3042);
GL11.glDepthMask((boolean)false);
OpenGlHelper.glBlendFunc((int)770, (int)771, (int)1, (int)0);
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
Minecraft.getMinecraft().getTextureManager().bindTexture(image);
Gui.drawModalRectWithCustomSizedTexture((int)x, (int)y, (float)0.0f, (float)0.0f, (int)width, (int)height, (float)width, (float)height);
GL11.glDepthMask((boolean)true);
GL11.glDisable((int)3042);
GL11.glEnable((int)2929);
}
public static void drawImage(ResourceLocation image, int x, int y, int width, int height, Color color) {
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
GL11.glDisable((int)2929);
GL11.glEnable((int)3042);
GL11.glDepthMask((boolean)false);
OpenGlHelper.glBlendFunc((int)770, (int)771, (int)1, (int)0);
GL11.glColor4f((float)((float)color.getRed() / 255.0f), (float)((float)color.getBlue() / 255.0f), (float)((float)color.getRed() / 255.0f), (float)1.0f);
Minecraft.getMinecraft().getTextureManager().bindTexture(image);
Gui.drawModalRectWithCustomSizedTexture((int)x, (int)y, (float)0.0f, (float)0.0f, (int)width, (int)height, (float)width, (float)height);
GL11.glDepthMask((boolean)true);
GL11.glDisable((int)3042);
GL11.glEnable((int)2929);
}
public static void drawRoundRect(double d, double e, double g, double h, int color)
{
drawRect(d+1, e, g-1, h, color);
drawRect(d, e+1, d+1, h-1, color);
drawRect(d+1, e+1, d+0.5, e+0.5, color);
drawRect(d+1, e+1, d+0.5, e+0.5, color);
drawRect(g-1, e+1, g-0.5, e+0.5, color);
drawRect(g-1, e+1, g, h-1, color);
drawRect(d+1, h-1, d+0.5, h-0.5, color);
drawRect(g-1, h-1, g-0.5, h-0.5, color);
}
public static void drawRoundRectWithRect(double d, double e, double g, double h, int color)
{
drawRect(d+1, e, g-1, h, color);
drawRect(d, e+1, d+1, h-1, color);
drawRect(d+1, e+1, d+0.5, e+0.5, color);
drawRect(d+1, e+1, d+0.5, e+0.5, color);
drawRect(g-1, e+1, g-0.5, e+0.5, color);
drawRect(g-1, e+1, g, h-1, color);
drawRect(d+1, h-1, d+0.5, h-0.5, color);
drawRect(g-1, h-1, g-0.5, h-0.5, color);
}
public static void startGlScissor(int x, int y, int width, int height) {
Minecraft mc = Minecraft.getMinecraft();
int scaleFactor = 1;
int k = mc.gameSettings.guiScale;
if (k == 0) {
k = 1000;
}
while (scaleFactor < k && mc.displayWidth / (scaleFactor + 1) >= 320 && mc.displayHeight / (scaleFactor + 1) >= 240) {
++scaleFactor;
}
GL11.glPushMatrix();
GL11.glEnable(3089);
GL11.glScissor((int)(x * scaleFactor), (int)(mc.displayHeight - (y + height) * scaleFactor), (int)(width * scaleFactor), (int)(height * scaleFactor));
}
public static void stopGlScissor(){
GL11.glDisable(3089);
GL11.glPopMatrix();
}
public static void drawGradient(double x, double y, double x2, double y2, int col1, int col2) {
float f = (float)(col1 >> 24 & 255) / 255.0F;
float f1 = (float)(col1 >> 16 & 255) / 255.0F;
float f2 = (float)(col1 >> 8 & 255) / 255.0F;
float f3 = (float)(col1 & 255) / 255.0F;
float f4 = (float)(col2 >> 24 & 255) / 255.0F;
float f5 = (float)(col2 >> 16 & 255) / 255.0F;
float f6 = (float)(col2 >> 8 & 255) / 255.0F;
float f7 = (float)(col2 & 255) / 255.0F;
GL11.glEnable(3042);
GL11.glDisable(3553);
GL11.glBlendFunc(770, 771);
GL11.glEnable(2848);
GL11.glShadeModel(7425);
GL11.glPushMatrix();
GL11.glBegin(7);
GL11.glColor4f(f1, f2, f3, f);
GL11.glVertex2d(x2, y);
GL11.glVertex2d(x, y);
GL11.glColor4f(f5, f6, f7, f4);
GL11.glVertex2d(x, y2);
GL11.glVertex2d(x2, y2);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glEnable(3553);
GL11.glDisable(3042);
GL11.glDisable(2848);
GL11.glShadeModel(7424);
GL11.glColor4d(1.0D, 1.0D, 1.0D, 1.0D);
}
public static void drawGradientSideways(double left, double top, double right, double bottom, int col1, int col2) {
float f = (float)(col1 >> 24 & 255) / 255.0F;
float f1 = (float)(col1 >> 16 & 255) / 255.0F;
float f2 = (float)(col1 >> 8 & 255) / 255.0F;
float f3 = (float)(col1 & 255) / 255.0F;
float f4 = (float)(col2 >> 24 & 255) / 255.0F;
float f5 = (float)(col2 >> 16 & 255) / 255.0F;
float f6 = (float)(col2 >> 8 & 255) / 255.0F;
float f7 = (float)(col2 & 255) / 255.0F;
GL11.glEnable(3042);
GL11.glDisable(3553);
GL11.glBlendFunc(770, 771);
GL11.glEnable(2848);
GL11.glShadeModel(7425);
GL11.glPushMatrix();
GL11.glBegin(7);
GL11.glColor4f(f1, f2, f3, f);
GL11.glVertex2d(left, top);
GL11.glVertex2d(left, bottom);
GL11.glColor4f(f5, f6, f7, f4);
GL11.glVertex2d(right, bottom);
GL11.glVertex2d(right, top);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glEnable(3553);
GL11.glDisable(3042);
GL11.glDisable(2848);
GL11.glShadeModel(7424);
GL11.glColor4d(1.0D, 1.0D, 1.0D, 1.0D);
}
public static void outlineRect(double x, double y, double x1, double y1, double width, int internalColor, int borderColor) {
drawRect(x + width, y + width, x1 - width, y1 - width, internalColor);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
drawRect(x + width, y, x1 - width, y + width, borderColor);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
drawRect(x, y, x + width, y1, borderColor);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
drawRect(x1 - width, y, x1, y1, borderColor);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
drawRect(x + width, y1 - width, x1 - width, y1, borderColor);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
public static void fastShadowRoundedRect(float x, float y, float x2, float y2, float rad, float width, float r, float g, float b, float al) {
Stencil.write(true);
RenderUtils.drawRoundedRect(x, y, x2, y2, rad, new Color(r, g, b, al).getRGB());
Stencil.erase(false);
glPushMatrix();
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glShadeModel(GL_SMOOTH);
glColor4f(r, g, b, al);
glBegin(GL_QUAD_STRIP);
glVertex2f(x + width / 2F, y + width / 2F);
glColor4f(r, g, b, 0F);
glVertex2f(x - width, y - width);
glColor4f(r, g, b, al);
glVertex2f(x2 - width / 2F, y + width / 2F);
glColor4f(r, g, b, 0F);
glVertex2f(x2 + width, y - width);
glColor4f(r, g, b, al);
glVertex2f(x2 - width / 2F, y2 - width / 2F);
glColor4f(r, g, b, 0F);
glVertex2f(x2 + width, y2 + width);
glColor4f(r, g, b, al);
glVertex2f(x + width / 2F, y2 - width / 2F);
glColor4f(r, g, b, 0F);
glVertex2f(x - width, y2 + width);
glColor4f(r, g, b, al);
glVertex2f(x + width / 2F, y + width / 2F);
glColor4f(r, g, b, 0F);
glVertex2f(x - width, y - width);
glColor4f(1f, 1f, 1f, 1f);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glShadeModel(7424);
glColor4f(1, 1, 1, 1);
glPopMatrix();
Stencil.dispose();
}
public static void fastShadowRoundedRect(float x, float y, float x2, float y2, float rad, float width, Color color) {
fastShadowRoundedRect(x, y, x2, y2, rad, width, color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F, color.getAlpha() / 255.0F);
}
public static void drawRect(double x, double y, double x2, double y2, int color) {
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glPushMatrix();
RenderUtils.glColor(new Color(color));
glBegin(GL_QUADS);
glVertex2d(x2, y);
glVertex2d(x, y);
glVertex2d(x, y2);
glVertex2d(x2, y2);
glEnd();
glPopMatrix();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
}
public static void drawBorder(float x, float y, float x2, float y2, float strength, int color) {
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glPushMatrix();
RenderUtils.glColor(new Color(color));
glBegin(GL_QUADS);
glVertex2f(x - strength, y - strength);
glVertex2f(x2 + strength, y - strength);
glVertex2f(x2 + strength, y + strength);
glVertex2f(x - strength, y + strength);
glVertex2f(x - strength, y2 - strength);
glVertex2f(x2 + strength, y2 - strength);
glVertex2f(x2 + strength, y2 + strength);
glVertex2f(x - strength, y2 + strength);
glVertex2f(x - strength, y + strength);
glVertex2f(x + strength, y + strength);
glVertex2f(x + strength, y2 - strength);
glVertex2f(x - strength, y2 - strength);
glVertex2f(x2 - strength, y + strength);
glVertex2f(x2 + strength, y + strength);
glVertex2f(x2 + strength, y2 - strength);
glVertex2f(x2 - strength, y2 - strength);
glEnd();
glPopMatrix();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
}
}
| 10,268 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
AnimationUtils.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/AnimationUtils.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render;
public class AnimationUtils {
/**
* In-out-easing function
* https://github.com/jesusgollonet/processing-penner-easing
* @param t Current iteration
* @param d Total iterations
* @return Eased value
*/
public static float easeOut(float t, float d) {
return (t = t / d - 1) * t * t + 1;
}
}
| 577 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
SafeVertexBuffer.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/SafeVertexBuffer.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render;
import net.minecraft.client.renderer.vertex.VertexBuffer;
import net.minecraft.client.renderer.vertex.VertexFormat;
/**
* Like {@link VertexBuffer}, but it deletes it's contents when it is deleted
* by the garbage collector
*/
public class SafeVertexBuffer extends VertexBuffer {
public SafeVertexBuffer(VertexFormat vertexFormatIn) {
super(vertexFormatIn);
}
@Override
protected void finalize() throws Throwable {
this.deleteGlBuffers();
}
}
| 722 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
FramebufferShader.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/shader/FramebufferShader.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render.shader;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.shader.Framebuffer;
import java.awt.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL20.glUseProgram;
/**
* @author TheSlowly
*/
public abstract class FramebufferShader extends Shader {
private static Framebuffer framebuffer;
protected float red, green, blue, alpha = 1F;
protected float radius = 2F;
protected float quality = 1F;
private boolean entityShadows;
public FramebufferShader(final String fragmentShader) {
super(fragmentShader);
}
public void startDraw(final float partialTicks) {
GlStateManager.enableAlpha();
GlStateManager.pushMatrix();
GlStateManager.pushAttrib();
framebuffer = setupFrameBuffer(framebuffer);
framebuffer.framebufferClear();
framebuffer.bindFramebuffer(true);
entityShadows = mc.gameSettings.entityShadows;
mc.gameSettings.entityShadows = false;
mc.entityRenderer.setupCameraTransform(partialTicks, 0);
}
public void stopDraw(final Color color, final float radius, final float quality) {
mc.gameSettings.entityShadows = entityShadows;
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
mc.getFramebuffer().bindFramebuffer(true);
red = color.getRed() / 255F;
green = color.getGreen() / 255F;
blue = color.getBlue() / 255F;
alpha = color.getAlpha() / 255F;
this.radius = radius;
this.quality = quality;
mc.entityRenderer.disableLightmap();
RenderHelper.disableStandardItemLighting();
startShader();
mc.entityRenderer.setupOverlayRendering();
drawFramebuffer(framebuffer);
stopShader();
mc.entityRenderer.disableLightmap();
GlStateManager.popMatrix();
GlStateManager.popAttrib();
}
/**
* @param frameBuffer
* @return frameBuffer
* @author TheSlowly
*/
public Framebuffer setupFrameBuffer(Framebuffer frameBuffer) {
if(frameBuffer != null)
frameBuffer.deleteFramebuffer();
frameBuffer = new Framebuffer(mc.displayWidth, mc.displayHeight, true);
return frameBuffer;
}
/**
* @author TheSlowly
*/
public void drawFramebuffer(final Framebuffer framebuffer) {
final ScaledResolution scaledResolution = new ScaledResolution(mc);
glBindTexture(GL_TEXTURE_2D, framebuffer.framebufferTexture);
glBegin(GL_QUADS);
glTexCoord2d(0, 1);
glVertex2d(0, 0);
glTexCoord2d(0, 0);
glVertex2d(0, scaledResolution.getScaledHeight());
glTexCoord2d(1, 0);
glVertex2d(scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight());
glTexCoord2d(1, 1);
glVertex2d(scaledResolution.getScaledWidth(), 0);
glEnd();
glUseProgram(0);
}
}
| 3,309 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Shader.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/shader/Shader.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render.shader;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.ccbluex.liquidbounce.utils.MinecraftInstance;
import org.apache.commons.io.IOUtils;
import org.lwjgl.opengl.*;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
public abstract class Shader extends MinecraftInstance {
private int program;
private Map<String, Integer> uniformsMap;
public Shader(final String fragmentShader) {
int vertexShaderID, fragmentShaderID;
try {
final InputStream vertexStream = getClass().getResourceAsStream("/assets/minecraft/liquidbounce+/shader/vertex.vert");
vertexShaderID = createShader(IOUtils.toString(vertexStream), ARBVertexShader.GL_VERTEX_SHADER_ARB);
IOUtils.closeQuietly(vertexStream);
final InputStream fragmentStream = getClass().getResourceAsStream("/assets/minecraft/liquidbounce+/shader/fragment/" + fragmentShader);
fragmentShaderID = createShader(IOUtils.toString(fragmentStream), ARBFragmentShader.GL_FRAGMENT_SHADER_ARB);
IOUtils.closeQuietly(fragmentStream);
}catch(final Exception e) {
e.printStackTrace();
return;
}
if(vertexShaderID == 0 || fragmentShaderID == 0)
return;
program = ARBShaderObjects.glCreateProgramObjectARB();
if(program == 0)
return;
ARBShaderObjects.glAttachObjectARB(program, vertexShaderID);
ARBShaderObjects.glAttachObjectARB(program, fragmentShaderID);
ARBShaderObjects.glLinkProgramARB(program);
ARBShaderObjects.glValidateProgramARB(program);
ClientUtils.getLogger().info("[Shader] Successfully loaded: " + fragmentShader);
}
public void startShader() {
GL11.glPushMatrix();
GL20.glUseProgram(program);
if(uniformsMap == null) {
uniformsMap = new HashMap<>();
setupUniforms();
}
updateUniforms();
}
public void stopShader() {
GL20.glUseProgram(0);
GL11.glPopMatrix();
}
public abstract void setupUniforms();
public abstract void updateUniforms();
private int createShader(String shaderSource, int shaderType) {
int shader = 0;
try {
shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType);
if(shader == 0)
return 0;
ARBShaderObjects.glShaderSourceARB(shader, shaderSource);
ARBShaderObjects.glCompileShaderARB(shader);
if(ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE)
throw new RuntimeException("Error creating shader: " + getLogInfo(shader));
return shader;
}catch(final Exception e) {
ARBShaderObjects.glDeleteObjectARB(shader);
throw e;
}
}
private String getLogInfo(int i) {
return ARBShaderObjects.glGetInfoLogARB(i, ARBShaderObjects.glGetObjectParameteriARB(i, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB));
}
public void setUniform(final String uniformName, final int location) {
uniformsMap.put(uniformName, location);
}
public void setupUniform(final String uniformName) {
setUniform(uniformName, GL20.glGetUniformLocation(program, uniformName));
}
public int getUniform(final String uniformName) {
return uniformsMap.get(uniformName);
}
public int getProgramId() {
return program;
}
}
| 3,797 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
BackgroundShader.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/shader/shaders/BackgroundShader.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render.shader.shaders;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.utils.render.shader.Shader;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.Display;
public final class BackgroundShader extends Shader {
public final static BackgroundShader BACKGROUND_SHADER = new BackgroundShader();
private float time;
public BackgroundShader() {
super("background.frag");
}
@Override
public void setupUniforms() {
setupUniform("iResolution");
setupUniform("iTime");
}
@Override
public void updateUniforms() {
final ScaledResolution scaledResolution = new ScaledResolution(mc);
final int resolutionID = getUniform("iResolution");
if(resolutionID > -1)
GL20.glUniform2f(resolutionID, (float) Display.getWidth(), (float) Display.getHeight());
final int timeID = getUniform("iTime");
if(timeID > -1) GL20.glUniform1f(timeID, time);
time += 0.005F * RenderUtils.deltaTime;
}
}
| 1,324 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
OutlineShader.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/shader/shaders/OutlineShader.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render.shader.shaders;
import net.ccbluex.liquidbounce.utils.render.shader.FramebufferShader;
import org.lwjgl.opengl.GL20;
public final class OutlineShader extends FramebufferShader {
public static final OutlineShader OUTLINE_SHADER = new OutlineShader();
public OutlineShader() {
super("outline.frag");
}
@Override
public void setupUniforms() {
setupUniform("texture");
setupUniform("texelSize");
setupUniform("color");
setupUniform("divider");
setupUniform("radius");
setupUniform("maxSample");
}
@Override
public void updateUniforms() {
GL20.glUniform1i(getUniform("texture"), 0);
GL20.glUniform2f(getUniform("texelSize"), 1F / mc.displayWidth * (radius * quality), 1F / mc.displayHeight * (radius * quality));
GL20.glUniform4f(getUniform("color"), red, green, blue, alpha);
GL20.glUniform1f(getUniform("radius"), radius);
}
}
| 1,189 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
GlowShader.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/shader/shaders/GlowShader.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render.shader.shaders;
import net.ccbluex.liquidbounce.utils.render.shader.FramebufferShader;
import org.lwjgl.opengl.GL20;
public final class GlowShader extends FramebufferShader {
public static final GlowShader GLOW_SHADER = new GlowShader();
public GlowShader() {
super("glow.frag");
}
@Override
public void setupUniforms() {
setupUniform("texture");
setupUniform("texelSize");
setupUniform("color");
setupUniform("divider");
setupUniform("radius");
setupUniform("maxSample");
}
@Override
public void updateUniforms() {
GL20.glUniform1i(getUniform("texture"), 0);
GL20.glUniform2f(getUniform("texelSize"), 1F / mc.displayWidth * (radius * quality), 1F / mc.displayHeight * (radius * quality));
GL20.glUniform3f(getUniform("color"), red, green, blue);
GL20.glUniform1f(getUniform("divider"), 140F);
GL20.glUniform1f(getUniform("radius"), radius);
GL20.glUniform1f(getUniform("maxSample"), 10F);
}
}
| 1,275 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
BackgroundDarkShader.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/utils/render/shader/shaders/BackgroundDarkShader.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.utils.render.shader.shaders;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.utils.render.shader.Shader;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.Display;
public final class BackgroundDarkShader extends Shader {
public final static BackgroundDarkShader BACKGROUNDDARK_SHADER = new BackgroundDarkShader();
private float time;
public BackgroundDarkShader() {
super("backgrounddark.frag");
}
@Override
public void setupUniforms() {
setupUniform("iResolution");
setupUniform("iTime");
}
@Override
public void updateUniforms() {
final ScaledResolution scaledResolution = new ScaledResolution(mc);
final int resolutionID = getUniform("iResolution");
if(resolutionID > -1)
GL20.glUniform2f(resolutionID, (float) Display.getWidth(), (float) Display.getHeight());
final int timeID = getUniform("iTime");
if(timeID > -1) GL20.glUniform1f(timeID, time);
time += 0.005F * RenderUtils.deltaTime;
}
}
| 1,348 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
AbstractJavaLinkerTransformer.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/script/remapper/injection/transformers/AbstractJavaLinkerTransformer.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.script.remapper.injection.transformers;
import net.ccbluex.liquidbounce.script.remapper.injection.utils.ClassUtils;
import net.ccbluex.liquidbounce.script.remapper.injection.utils.NodeUtils;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldInsnNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.VarInsnNode;
import static org.objectweb.asm.Opcodes.*;
/**
* Transform bytecode of classes
*
* @author CCBlueX
* @class jdk/internal/dynalink/beans/AbstractJavaLinker
*/
public class AbstractJavaLinkerTransformer implements IClassTransformer {
/**
* Transform a class
*
* @param name of target class
* @param transformedName of target class
* @param basicClass bytecode of target class
* @return new bytecode
*/
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass) {
if(name.equals("jdk.internal.dynalink.beans.AbstractJavaLinker")) {
try {
final ClassNode classNode = ClassUtils.INSTANCE.toClassNode(basicClass);
classNode.methods.forEach(methodNode -> {
switch(methodNode.name + methodNode.desc) {
case "addMember(Ljava/lang/String;Ljava/lang/reflect/AccessibleObject;Ljava/util/Map;)V":
methodNode.instructions.insertBefore(methodNode.instructions.getFirst(), NodeUtils.INSTANCE.toNodes(
new VarInsnNode(ALOAD, 0),
new FieldInsnNode(GETFIELD, "jdk/internal/dynalink/beans/AbstractJavaLinker", "clazz", "Ljava/lang/Class;"),
new VarInsnNode(ALOAD, 1),
new VarInsnNode(ALOAD, 2),
new MethodInsnNode(INVOKESTATIC, "net/ccbluex/liquidbounce/script/remapper/injection/transformers/handlers/AbstractJavaLinkerHandler", "addMember", "(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/reflect/AccessibleObject;)Ljava/lang/String;", false),
new VarInsnNode(ASTORE, 1)
));
break;
case "addMember(Ljava/lang/String;Ljdk/internal/dynalink/beans/SingleDynamicMethod;Ljava/util/Map;)V":
methodNode.instructions.insertBefore(methodNode.instructions.getFirst(), NodeUtils.INSTANCE.toNodes(
new VarInsnNode(ALOAD, 0),
new FieldInsnNode(GETFIELD, "jdk/internal/dynalink/beans/AbstractJavaLinker", "clazz", "Ljava/lang/Class;"),
new VarInsnNode(ALOAD, 1),
new MethodInsnNode(INVOKESTATIC, "net/ccbluex/liquidbounce/script/remapper/injection/transformers/handlers/AbstractJavaLinkerHandler", "addMember", "(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/String;", false),
new VarInsnNode(ASTORE, 1)
));
break;
case "setPropertyGetter(Ljava/lang/String;Ljdk/internal/dynalink/beans/SingleDynamicMethod;Ljdk/internal/dynalink/beans/GuardedInvocationComponent$ValidationType;)V":
methodNode.instructions.insertBefore(methodNode.instructions.getFirst(), NodeUtils.INSTANCE.toNodes(
new VarInsnNode(ALOAD, 0),
new FieldInsnNode(GETFIELD, "jdk/internal/dynalink/beans/AbstractJavaLinker", "clazz", "Ljava/lang/Class;"),
new VarInsnNode(ALOAD, 1),
new MethodInsnNode(INVOKESTATIC, "net/ccbluex/liquidbounce/script/remapper/injection/transformers/handlers/AbstractJavaLinkerHandler", "setPropertyGetter", "(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/String;", false),
new VarInsnNode(ASTORE, 1)
));
break;
}
});
return ClassUtils.INSTANCE.toBytes(classNode);
}catch(final Throwable throwable) {
throwable.printStackTrace();
}
}
return basicClass;
}
}
| 4,654 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
FontDetails.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/font/FontDetails.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.font;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface FontDetails {
String fontName();
int fontSize() default -1;
}
| 443 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Fonts.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/font/Fonts.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.font;
import com.google.gson.*;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.ccbluex.liquidbounce.utils.misc.HttpUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import java.awt.*;
import java.io.*;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class Fonts {
// in fact these "roboto medium" is product sans lol
@FontDetails(fontName = "Roboto Medium", fontSize = 35)
public static GameFontRenderer font35;
@FontDetails(fontName = "Roboto Medium", fontSize = 40)
public static GameFontRenderer font40;
@FontDetails(fontName = "Roboto Medium", fontSize = 72)
public static GameFontRenderer font72;
@FontDetails(fontName = "Roboto Medium", fontSize = 30)
public static GameFontRenderer fontSmall;
@FontDetails(fontName = "Roboto Medium", fontSize = 24)
public static GameFontRenderer fontTiny;
@FontDetails(fontName = "Roboto Medium", fontSize = 52)
public static GameFontRenderer fontLarge;
@FontDetails(fontName = "SFUI Regular", fontSize = 35)
public static GameFontRenderer fontSFUI35;
@FontDetails(fontName = "SFUI Regular", fontSize = 40)
public static GameFontRenderer fontSFUI40;
@FontDetails(fontName = "Roboto Bold", fontSize = 180)
public static GameFontRenderer fontBold180;
@FontDetails(fontName = "Tahoma Bold", fontSize = 35)
public static GameFontRenderer fontTahoma;
@FontDetails(fontName = "Tahoma Bold", fontSize = 30)
public static GameFontRenderer fontTahoma30;
public static TTFFontRenderer fontTahomaSmall;
@FontDetails(fontName = "Bangers", fontSize = 45)
public static GameFontRenderer fontBangers;
@FontDetails(fontName = "Minecraft Font")
public static final FontRenderer minecraftFont = Minecraft.getMinecraft().fontRendererObj;
private static final List<GameFontRenderer> CUSTOM_FONT_RENDERERS = new ArrayList<>();
public static void loadFonts() {
long l = System.currentTimeMillis();
ClientUtils.getLogger().info("Loading Fonts.");
downloadFonts();
font35 = new GameFontRenderer(getFont("Roboto-Medium.ttf", 35));
font40 = new GameFontRenderer(getFont("Roboto-Medium.ttf", 40));
font72 = new GameFontRenderer(getFont("Roboto-Medium.ttf", 72));
fontSmall = new GameFontRenderer(getFont("Roboto-Medium.ttf", 30));
fontTiny = new GameFontRenderer(getFont("Roboto-Medium.ttf", 24));
fontLarge = new GameFontRenderer(getFont("Roboto-Medium.ttf", 60));
fontSFUI35 = new GameFontRenderer(getFont("sfui.ttf", 35));
fontSFUI40 = new GameFontRenderer(getFont("sfui.ttf", 40));
fontBold180 = new GameFontRenderer(getFont("Roboto-Bold.ttf", 180));
fontTahoma = new GameFontRenderer(getFont("TahomaBold.ttf", 35));
fontTahoma30 = new GameFontRenderer(getFont("TahomaBold.ttf", 30));
fontTahomaSmall = new TTFFontRenderer(getFont("Tahoma.ttf", 11));
fontBangers = new GameFontRenderer(getFont("Bangers-Regular.ttf", 45));
try {
CUSTOM_FONT_RENDERERS.clear();
final File fontsFile = new File(LiquidBounce.fileManager.fontsDir, "fonts.json");
if (fontsFile.exists()) {
final JsonElement jsonElement = new JsonParser().parse(new BufferedReader(new FileReader(fontsFile)));
if (jsonElement instanceof JsonNull)
return;
final JsonArray jsonArray = (JsonArray) jsonElement;
for (final JsonElement element : jsonArray) {
if (element instanceof JsonNull)
return;
final JsonObject fontObject = (JsonObject) element;
CUSTOM_FONT_RENDERERS.add(new GameFontRenderer(getFont(fontObject.get("fontFile").getAsString(), fontObject.get("fontSize").getAsInt())));
}
} else {
fontsFile.createNewFile();
final PrintWriter printWriter = new PrintWriter(new FileWriter(fontsFile));
printWriter.println(new GsonBuilder().setPrettyPrinting().create().toJson(new JsonArray()));
printWriter.close();
}
} catch (final Exception e) {
e.printStackTrace();
}
ClientUtils.getLogger().info("Loaded Fonts. (" + (System.currentTimeMillis() - l) + "ms)");
}
private static void downloadFonts() {
try {
final File outputFile = new File(LiquidBounce.fileManager.fontsDir, "roboto.zip");
final File sfuiFile = new File(LiquidBounce.fileManager.fontsDir, "sfui.ttf");
final File prodSansFile = new File(LiquidBounce.fileManager.fontsDir, "Roboto-Medium.ttf");
final File prodBoldFile = new File(LiquidBounce.fileManager.fontsDir, "Roboto-Bold.ttf");
final File tahomaFile = new File(LiquidBounce.fileManager.fontsDir, "TahomaBold.ttf");
final File tahomaReFile = new File(LiquidBounce.fileManager.fontsDir, "Tahoma.ttf");
final File bangersFile = new File(LiquidBounce.fileManager.fontsDir, "Bangers-Regular.ttf");
if (!outputFile.exists() || !sfuiFile.exists() || !prodSansFile.exists() || !prodBoldFile.exists() || !tahomaFile.exists() || !tahomaReFile.exists() || !bangersFile.exists()) {
ClientUtils.getLogger().info("Downloading fonts...");
HttpUtils.download("https://mokkowdev.github.io/Cloud/LiquidBounce/fonts/fonts.zip", outputFile);
ClientUtils.getLogger().info("Extract fonts...");
extractZip(outputFile.getPath(), LiquidBounce.fileManager.fontsDir.getPath());
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static FontRenderer getFontRenderer(final String name, final int size) {
for (final Field field : Fonts.class.getDeclaredFields()) {
try {
field.setAccessible(true);
final Object o = field.get(null);
if (o instanceof FontRenderer) {
final FontDetails fontDetails = field.getAnnotation(FontDetails.class);
if (fontDetails.fontName().equals(name) && fontDetails.fontSize() == size)
return (FontRenderer) o;
}
} catch (final IllegalAccessException e) {
e.printStackTrace();
}
}
for (final GameFontRenderer liquidFontRenderer : CUSTOM_FONT_RENDERERS) {
final Font font = liquidFontRenderer.getDefaultFont().getFont();
if (font.getName().equals(name) && font.getSize() == size)
return liquidFontRenderer;
}
return minecraftFont;
}
public static Object[] getFontDetails(final FontRenderer fontRenderer) {
for (final Field field : Fonts.class.getDeclaredFields()) {
try {
field.setAccessible(true);
final Object o = field.get(null);
if (o.equals(fontRenderer)) {
final FontDetails fontDetails = field.getAnnotation(FontDetails.class);
return new Object[] {fontDetails.fontName(), fontDetails.fontSize()};
}
} catch (final IllegalAccessException e) {
e.printStackTrace();
}
}
if (fontRenderer instanceof GameFontRenderer) {
final Font font = ((GameFontRenderer) fontRenderer).getDefaultFont().getFont();
return new Object[] {font.getName(), font.getSize()};
}
return null;
}
public static List<FontRenderer> getFonts() {
final List<FontRenderer> fonts = new ArrayList<>();
for (final Field fontField : Fonts.class.getDeclaredFields()) {
try {
fontField.setAccessible(true);
final Object fontObj = fontField.get(null);
if (fontObj instanceof FontRenderer) fonts.add((FontRenderer) fontObj);
} catch (final IllegalAccessException e) {
e.printStackTrace();
}
}
fonts.addAll(Fonts.CUSTOM_FONT_RENDERERS);
return fonts;
}
private static Font getFont(final String fontName, final int size) {
try {
final InputStream inputStream = new FileInputStream(new File(LiquidBounce.fileManager.fontsDir, fontName));
Font awtClientFont = Font.createFont(Font.TRUETYPE_FONT, inputStream);
awtClientFont = awtClientFont.deriveFont(Font.PLAIN, size);
inputStream.close();
return awtClientFont;
} catch (final Exception e) {
e.printStackTrace();
return new Font("default", Font.PLAIN, size);
}
}
private static void extractZip(final String zipFile, final String outputFolder) {
final byte[] buffer = new byte[1024];
try {
final File folder = new File(outputFolder);
if(!folder.exists()) folder.mkdir();
final ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(zipFile));
ZipEntry zipEntry = zipInputStream.getNextEntry();
while (zipEntry != null) {
File newFile = new File(outputFolder + File.separator + zipEntry.getName());
new File(newFile.getParent()).mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream(newFile);
int i;
while ((i = zipInputStream.read(buffer)) > 0)
fileOutputStream.write(buffer, 0, i);
fileOutputStream.close();
zipEntry = zipInputStream.getNextEntry();
}
zipInputStream.closeEntry();
zipInputStream.close();
} catch (final IOException e) {
e.printStackTrace();
}
}
}
| 10,373 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
TTFFontRenderer.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/font/TTFFontRenderer.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.font;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.vector.Vector2f;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;
import java.util.Locale;
/**
* Created by Zeb on 12/19/2016.
*/
public class TTFFontRenderer {
/**
* The font to be drawn.
*/
private Font font;
/**
* If fractional metrics should be used in the font renderer.
*/
private boolean fractionalMetrics = false;
/**
* All the character data information (regular).
*/
private CharacterData[] regularData;
/**
* All the character data information (bold).
*/
private CharacterData[] boldData;
/**
* All the character data information (italics).
*/
private CharacterData[] italicsData;
/**
* All the color codes used in minecraft.
*/
private int[] colorCodes = new int[32];
/**
* The margin on each texture.
*/
private static final int MARGIN = 4;
/**
* The character that invokes color in a string when rendered.
*/
private static final char COLOR_INVOKER = '\247';
/**
* The random offset in obfuscated text.
*/
private static int RANDOM_OFFSET = 1;
public TTFFontRenderer(Font font) {
this(font, 256);
}
public TTFFontRenderer(Font font, int characterCount) {
this(font, characterCount, true);
}
public TTFFontRenderer(Font font, boolean fractionalMetrics) {
this(font, 256, fractionalMetrics);
}
public TTFFontRenderer(Font font, int characterCount, boolean fractionalMetrics) {
this.font = font;
this.fractionalMetrics = fractionalMetrics;
// Generates all the character textures.
this.regularData = setup(new CharacterData[characterCount], Font.PLAIN);
this.boldData = setup(new CharacterData[characterCount], Font.BOLD);
this.italicsData = setup(new CharacterData[characterCount], Font.ITALIC);
}
/**
* Sets up the character data and textures.
*
* @param characterData The array of character data that should be filled.
* @param type The font type. (Regular, Bold, and Italics)
*/
private CharacterData[] setup(CharacterData[] characterData, int type) {
// Quickly generates the colors.
generateColors();
// Changes the type of the font to the given type.
Font font = this.font.deriveFont(type);
// An image just to get font data.
BufferedImage utilityImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
// The graphics of the utility image.
Graphics2D utilityGraphics = (Graphics2D) utilityImage.getGraphics();
// Sets the font of the utility image to the font.
utilityGraphics.setFont(font);
// The font metrics of the utility image.
FontMetrics fontMetrics = utilityGraphics.getFontMetrics();
// Iterates through all the characters in the character set of the font renderer.
for (int index = 0; index < characterData.length; index++) {
// The character at the current index.
char character = (char) index;
// The width and height of the character according to the font.
Rectangle2D characterBounds = fontMetrics.getStringBounds(character + "", utilityGraphics);
// The width of the character texture.
float width = (float) characterBounds.getWidth() + (2 * MARGIN);
// The height of the character texture.
float height = (float) characterBounds.getHeight();
// The image that the character will be rendered to.
BufferedImage characterImage = new BufferedImage(MathHelper.ceiling_double_int(width), MathHelper.ceiling_double_int(height), BufferedImage.TYPE_INT_ARGB);
// The graphics of the character image.
Graphics2D graphics = (Graphics2D) characterImage.getGraphics();
// Sets the font to the input font/
graphics.setFont(font);
// Sets the color to white with no alpha.
graphics.setColor(new Color(255, 255, 255, 0));
// Fills the entire image with the color above, makes it transparent.
graphics.fillRect(0, 0, characterImage.getWidth(), characterImage.getHeight());
// Sets the color to white to draw the character.
graphics.setColor(Color.WHITE);
// Enables anti-aliasing so the font doesn't have aliasing.
//graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
//graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, this.fractionalMetrics ? RenderingHints.VALUE_FRACTIONALMETRICS_ON : RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
// Draws the character.
graphics.drawString(character + "", MARGIN, fontMetrics.getAscent());
// Generates a new texture id.
int textureId = GlStateManager.generateTexture();
// Allocates the texture in opengl.
createTexture(textureId, characterImage);
// Initiates the character data and stores it in the data array.
characterData[index] = new CharacterData(character, characterImage.getWidth(), characterImage.getHeight(), textureId);
}
// Returns the filled character data array.
return characterData;
}
/**
* Uploads the opengl texture.
*
* @param textureId The texture id to upload to.
* @param image The image to upload.
*/
private void createTexture(int textureId, BufferedImage image) {
// Array of all the colors in the image.
int[] pixels = new int[image.getWidth() * image.getHeight()];
// Fetches all the colors in the image.
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
// Buffer that will store the texture data.
ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * 4); //4 for RGBA, 3 for RGB
// Puts all the pixel data into the buffer.
for (int y = 0; y < image.getHeight(); y++) {
for (int x = 0; x < image.getWidth(); x++) {
// The pixel in the image.
int pixel = pixels[y * image.getWidth() + x];
// Puts the data into the byte buffer.
buffer.put((byte)((pixel >> 16) & 0xFF));
buffer.put((byte)((pixel >> 8) & 0xFF));
buffer.put((byte)(pixel & 0xFF));
buffer.put((byte)((pixel >> 24) & 0xFF));
}
}
// Flips the byte buffer, not sure why this is needed.
((java.nio.Buffer)buffer).flip();
// Binds the opengl texture by the texture id.
GlStateManager.bindTexture(textureId);
// Sets the texture parameter stuff.
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
// Uploads the texture to opengl.
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, image.getWidth(), image.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buffer);
// Binds the opengl texture 0.
GlStateManager.bindTexture(0);
}
/**
* Renders the given string.
*
* @param text The text to be rendered.
* @param x The x position of the text.
* @param y The y position of the text.
* @param color The color of the text.
*/
public void drawString(String text, float x, float y, int color) {
renderString(text, x, y, color, false);
}
/**
* Renders the given string.
*
* @param text The text to be rendered.
* @param x The x position of the text.
* @param y The y position of the text.
* @param color The color of the text.
*/
public void drawStringWithShadow(String text, float x, float y, int color) {
GL11.glTranslated(0.5, 0.5, 0);
renderString(text, x, y, color, true);
GL11.glTranslated(-0.5, -0.5, 0);
renderString(text, x, y, color, false);
}
/**
* Renders the given string.
*
* @param text The text to be rendered.
* @param x The x position of the text.
* @param y The y position of the text.
* @param shadow If the text should be rendered with the shadow color.
* @param color The color of the text.
*/
private void renderString(String text, float x, float y, int color, boolean shadow) {
// Returns if the text is empty.
if (text.length() == 0) return;
// Pushes the matrix to store gl values.
GL11.glPushMatrix();
// Scales down to make the font look better.
GlStateManager.scale(0.5, 0.5, 1);
// Removes half the margin to render in the right spot.
x -= MARGIN / 2;
y -= MARGIN / 2;
// Adds 0.5 to x and y.
x += 0.5F;
y += 0.5F;
// Doubles the position because of the scaling.
x *= 2;
y *= 2;
// The character texture set to be used. (Regular by default)
CharacterData[] characterData = regularData;
// Booleans to handle the style.
boolean underlined = false;
boolean strikethrough = false;
boolean obfuscated = false;
// The length of the text used for the draw loop.
int length = text.length();
// The multiplier.
float multiplier = (shadow ? 4 : 1);
float a = (float)(color >> 24 & 255) / 255F;
float r = (float)(color >> 16 & 255) / 255F;
float g = (float)(color >> 8 & 255) / 255F;
float b = (float)(color & 255) / 255F;
GL11.glColor4f(r / multiplier, g / multiplier, b / multiplier, a);
// Loops through the text.
for (int i = 0; i < length; i++) {
// The character at the index of 'i'.
char character = text.charAt(i);
// The previous character.
char previous = i > 0 ? text.charAt(i - 1) : '.';
// Continues if the previous color was the color invoker.
if (previous == COLOR_INVOKER) continue;
// Sets the color if the character is the color invoker and the character index is less than the length.
if (character == COLOR_INVOKER && i < length) {
// The color index of the character after the current character.
int index = "0123456789abcdefklmnor".indexOf(text.toLowerCase(Locale.ENGLISH).charAt(i + 1));
// If the color character index is of the normal color invoking characters.
if (index < 16) {
// Resets all the styles.
obfuscated = false;
strikethrough = false;
underlined = false;
// Sets the character data to the regular type.
characterData = regularData;
// Clamps the index just to be safe in case an odd character somehow gets in here.
if (index < 0 || index > 15) index = 15;
// Adds 16 to the color index to get the darker shadow color.
if (shadow) index += 16;
// Gets the text color from the color codes array.
int textColor = this.colorCodes[index];
// Sets the current color.
GL11.glColor4d((textColor >> 16) / 255d, (textColor >> 8 & 255) / 255d, (textColor & 255) / 255d, a);
} else if (index == 16)
obfuscated = true;
else if (index == 17)
// Sets the character data to the bold type.
characterData = boldData;
else if (index == 18)
strikethrough = true;
else if (index == 19)
underlined = true;
else if (index == 20)
// Sets the character data to the italics type.
characterData = italicsData;
else if (index == 21) {
// Resets the style.
obfuscated = false;
strikethrough = false;
underlined = false;
// Sets the character data to the regular type.
characterData = regularData;
// Sets the color to white
GL11.glColor4d(1 * (shadow ? 0.25 : 1), 1 * (shadow ? 0.25 : 1), 1 * (shadow ? 0.25 : 1), a);
}
} else {
// Continues to not crash!
if (character > 255) continue;
// Sets the character to a random char if obfuscated is enabled.
if (obfuscated)
character = (char)(((int) character) + RANDOM_OFFSET);
// Draws the character.
drawChar(character, characterData, x, y);
// The character data for the given character.
CharacterData charData = characterData[character];
// Draws the strikethrough line if enabled.
if (strikethrough)
drawLine(new Vector2f(0, charData.height / 2f), new Vector2f(charData.width, charData.height / 2f), 3);
// Draws the underline if enabled.
if (underlined)
drawLine(new Vector2f(0, charData.height - 15), new Vector2f(charData.width, charData.height - 15), 3);
// Adds to the offset.
x += charData.width - (2 * MARGIN);
}
}
// Restores previous values.
GL11.glPopMatrix();
// Sets the color back to white so no odd rendering problems happen.
GL11.glColor4d(1, 1, 1, 1);
GlStateManager.bindTexture(0);
}
/**
* Gets the width of the given text.
*
* @param text The text to get the width of.
* @return The width of the given text.
*/
public float getWidth(String text) {
// The width of the string.
float width = 0;
// The character texture set to be used. (Regular by default)
CharacterData[] characterData = regularData;
// The length of the text.
int length = text.length();
// Loops through the text.
for (int i = 0; i < length; i++) {
// The character at the index of 'i'.
char character = text.charAt(i);
// The previous character.
char previous = i > 0 ? text.charAt(i - 1) : '.';
// Continues if the previous color was the color invoker.
if (previous == COLOR_INVOKER) continue;
// Sets the color if the character is the color invoker and the character index is less than the length.
if (character == COLOR_INVOKER && i < length) {
// The color index of the character after the current character.
int index = "0123456789abcdefklmnor".indexOf(text.toLowerCase(Locale.ENGLISH).charAt(i + 1));
if (index == 17)
// Sets the character data to the bold type.
characterData = boldData;
else if (index == 20)
// Sets the character data to the italics type.
characterData = italicsData;
else if (index == 21)
// Sets the character data to the regular type.
characterData = regularData;
} else {
// Continues to not crash!
if (character > 255) continue;
// The character data for the given character.
CharacterData charData = characterData[character];
// Adds to the offset.
width += (charData.width - (2 * MARGIN)) / 2;
}
}
// Returns the width.
return width + MARGIN / 2;
}
/**
* Gets the height of the given text.
*
* @param text The text to get the height of.
* @return The height of the given text.
*/
public float getHeight(String text) {
// The height of the string.
float height = 0;
// The character texture set to be used. (Regular by default)
CharacterData[] characterData = regularData;
// The length of the text.
int length = text.length();
// Loops through the text.
for (int i = 0; i < length; i++) {
// The character at the index of 'i'.
char character = text.charAt(i);
// The previous character.
char previous = i > 0 ? text.charAt(i - 1) : '.';
// Continues if the previous color was the color invoker.
if (previous == COLOR_INVOKER) continue;
// Sets the color if the character is the color invoker and the character index is less than the length.
if (character == COLOR_INVOKER && i < length) {
// The color index of the character after the current character.
int index = "0123456789abcdefklmnor".indexOf(text.toLowerCase(Locale.ENGLISH).charAt(i + 1));
if (index == 17)
// Sets the character data to the bold type.
characterData = boldData;
else if (index == 20)
// Sets the character data to the italics type.
characterData = italicsData;
else if (index == 21)
// Sets the character data to the regular type.
characterData = regularData;
} else {
// Continues to not crash!
if (character > 255) continue;
// The character data for the given character.
CharacterData charData = characterData[character];
// Sets the height if its bigger.
height = Math.max(height, charData.height);
}
}
// Returns the height.
return height / 2 - MARGIN / 2;
}
/**
* Draws the character.
*
* @param character The character to be drawn.
* @param characterData The character texture set to be used.
*/
private void drawChar(char character, CharacterData[] characterData, float x, float y) {
// The char data that stores the character data.
CharacterData charData = characterData[character];
// Binds the character data texture.
charData.bind();
GL11.glPushMatrix();
// Enables blending.
GL11.glEnable(GL11.GL_BLEND);
// Sets the blending function.
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// Begins drawing the quad.
GL11.glBegin(GL11.GL_QUADS); {
// Maps out where the texture should be drawn.
GL11.glTexCoord2f(0, 0);
GL11.glVertex2d(x, y);
GL11.glTexCoord2f(0, 1);
GL11.glVertex2d(x, y + charData.height);
GL11.glTexCoord2f(1, 1);
GL11.glVertex2d(x + charData.width, y + charData.height);
GL11.glTexCoord2f(1, 0);
GL11.glVertex2d(x + charData.width, y);
}
// Ends the quad.
GL11.glEnd();
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
// Binds the opengl texture by the texture id.
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
}
/**
* Draws a line from start to end with the given width.
*
* @param start The starting point of the line.
* @param end The ending point of the line.
* @param width The thickness of the line.
*/
private void drawLine(Vector2f start, Vector2f end, float width) {
// Disables textures so we can draw a solid line.
GL11.glDisable(GL11.GL_TEXTURE_2D);
// Sets the width.
GL11.glLineWidth(width);
// Begins drawing the line.
GL11.glBegin(GL11.GL_LINES); {
GL11.glVertex2f(start.x, start.y);
GL11.glVertex2f(end.x, end.y);
}
// Ends drawing the line.
GL11.glEnd();
// Enables texturing back on.
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
/**
* Generates all the colors.
*/
private void generateColors() {
// Iterates through 32 colors.
for (int i = 0; i < 32; i++) {
// Not sure what this variable is.
int thingy = (i >> 3 & 1) * 85;
// The red value of the color.
int red = (i >> 2 & 1) * 170 + thingy;
// The green value of the color.
int green = (i >> 1 & 1) * 170 + thingy;
// The blue value of the color.
int blue = (i >> 0 & 1) * 170 + thingy;
// Increments the red by 85, not sure why does this in minecraft's font renderer.
if (i == 6) red += 85;
// Used to make the shadow darker.
if (i >= 16) {
red /= 4;
green /= 4;
blue /= 4;
}
// Sets the color in the color code at the index of 'i'.
this.colorCodes[i] = (red & 255) << 16 | (green & 255) << 8 | blue & 255;
}
}
public Font getFont() {
return font;
}
/**
* Class that holds the data for each character.
*/
class CharacterData {
/**
* The character the data belongs to.
*/
public char character;
/**
* The width of the character.
*/
public float width;
/**
* The height of the character.
*/
public float height;
/**
* The id of the character texture.
*/
private int textureId;
public CharacterData(char character, float width, float height, int textureId) {
this.character = character;
this.width = width;
this.height = height;
this.textureId = textureId;
}
/**
* Binds the texture.
*/
public void bind() {
// Binds the opengl texture by the texture id.
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
}
}
}
| 23,178 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Panel.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/Panel.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.modules.render.ClickGUI;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.Element;
import net.ccbluex.liquidbounce.utils.MinecraftInstance;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public abstract class Panel extends MinecraftInstance {
private final String name;
public int x;
public int y;
public int x2;
public int y2;
private final int width;
private final int height;
private int scroll;
private int dragged;
private boolean open;
public boolean drag;
private boolean scrollbar;
private final List<Element> elements;
private boolean visible;
private float elementsHeight;
private float fade;
public Panel(String name, int x, int y, int width, int height, boolean open) {
this.name = name;
this.elements = new ArrayList<>();
this.scrollbar = false;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.open = open;
this.visible = true;
setupItems();
}
public abstract void setupItems();
public void drawScreen(int mouseX, int mouseY, float button) {
if(!visible)
return;
final int maxElements = Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).maxElementsValue.get();
// Drag
if(drag) {
int nx = x2 + mouseX;
int ny = y2 + mouseY;
if(nx > -1)
x = nx;
if(ny > -1)
y = ny;
}
elementsHeight = getElementsHeight() - 1;
boolean scrollbar = elements.size() >= maxElements;
if(this.scrollbar != scrollbar)
this.scrollbar = scrollbar;
LiquidBounce.clickGui.style.drawPanel(mouseX, mouseY, this);
int y = this.y + height - 2;
int count = 0;
for(final Element element : elements) {
if(++count > scroll && count < scroll + (maxElements + 1) && scroll < elements.size()) {
element.setLocation(x, y);
element.setWidth(getWidth());
if(y <= getY() + fade)
element.drawScreen(mouseX, mouseY, button);
y += element.getHeight() + 1;
element.setVisible(true);
}else
element.setVisible(false);
}
}
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
if (!visible)
return false;
if (mouseButton == 1 && isHovering(mouseX, mouseY)) {
open = !open;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("random.bow"), 1.0F));
return true;
}
for (final Element element : elements) {
if(element.getY() <= getY() + fade && element.mouseClicked(mouseX, mouseY, mouseButton)) {
return true;
}
}
return false;
}
public boolean mouseReleased(int mouseX, int mouseY, int state) {
if(!visible)
return false;
drag = false;
if(!open)
return false;
for (final Element element : elements) {
if(element.getY() <= getY() + fade && element.mouseReleased(mouseX, mouseY, state)) {
return true;
}
}
return false;
}
public boolean handleScroll(int mouseX, int mouseY, int wheel) {
final int maxElements = Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).maxElementsValue.get();
if(mouseX >= getX() && mouseX <= getX() + 100 && mouseY >= getY() && mouseY <= getY() + 19 + elementsHeight) {
if(wheel < 0 && scroll < elements.size() - maxElements) {
++scroll;
if(scroll < 0)
scroll = 0;
}else if(wheel > 0) {
--scroll;
if(scroll < 0)
scroll = 0;
}
if(wheel < 0) {
if(dragged < elements.size() - maxElements)
++dragged;
}else if(wheel > 0 && dragged >= 1) {
--dragged;
}
return true;
}
return false;
}
void updateFade(final int delta) {
if(open) {
if(fade < elementsHeight) fade += 0.4F * delta;
if(fade > elementsHeight) fade = (int) elementsHeight;
}else{
if(fade > 0) fade -= 0.4F * delta;
if(fade < 0) fade = 0;
}
}
public String getName() {
return name;
}
public int getX() {
return this.x;
}
public int getY() {
return this.y;
}
public void setX(int dragX) {
this.x = dragX;
}
public void setY(int dragY) {
this.y = dragY;
}
public int getWidth() {
return this.width;
}
public int getHeight() {
return this.height;
}
public boolean getScrollbar() {
return this.scrollbar;
}
public void setOpen(boolean open) {
this.open = open;
}
public boolean getOpen() {
return this.open;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
public boolean isVisible() {
return visible;
}
public List<Element> getElements() {
return elements;
}
public int getFade() {
return (int) fade;
}
public int getDragged() {
return dragged;
}
private int getElementsHeight() {
int height = 0;
int count = 0;
for(final Element element : elements) {
if (count >= Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).maxElementsValue.get())
continue;
height += element.getHeight() + 1;
++count;
}
return height;
}
boolean isHovering(int mouseX, int mouseY) {
final float textWidth = mc.fontRendererObj.getStringWidth(StringUtils.stripControlCodes(name)) - 100F;
return mouseX >= x - textWidth / 2F - 19F && mouseX <= x - textWidth / 2F + mc.fontRendererObj.getStringWidth(StringUtils.stripControlCodes(name)) + 19F && mouseY >= y && mouseY <= y + height - (open ? 2 : 0);
}
}
| 6,843 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ClickGui.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/ClickGui.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.modules.render.ClickGUI;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ButtonElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.Element;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ModuleElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.Style;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.SlowlyStyle;
import net.ccbluex.liquidbounce.ui.client.hud.designer.GuiHudDesigner;
import net.ccbluex.liquidbounce.ui.font.AWTFontRenderer;
import net.ccbluex.liquidbounce.utils.AnimationUtils;
import net.ccbluex.liquidbounce.utils.EntityUtils;
import net.ccbluex.liquidbounce.utils.render.ColorUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.utils.render.UiUtils;
import net.ccbluex.liquidbounce.utils.render.EaseUtils;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class ClickGui extends GuiScreen {
public final List<Panel> panels = new ArrayList<>();
private final ResourceLocation hudIcon = new ResourceLocation("liquidbounce+/custom_hud_icon.png");
public Style style = new SlowlyStyle();
private Panel clickedPanel;
private int mouseX;
private int mouseY;
public double slide, progress = 0;
public long lastMS = System.currentTimeMillis();
public ClickGui() {
final int width = 100;
final int height = 18;
int yPos = 5;
for (final ModuleCategory category : ModuleCategory.values()) {
panels.add(new Panel(category.getDisplayName(), 100, yPos, width, height, false) {
@Override
public void setupItems() {
for (Module module : LiquidBounce.moduleManager.getModules())
if (module.getCategory() == category)
getElements().add(new ModuleElement(module));
}
});
yPos += 20;
}
yPos += 20;
panels.add(new Panel("Targets", 100, yPos, width, height, false) {
@Override
public void setupItems() {
getElements().add(new ButtonElement("Players") {
@Override
public void createButton(String displayName) {
color = EntityUtils.targetPlayer ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
super.createButton(displayName);
}
@Override
public String getDisplayName() {
displayName = "Players";
color = EntityUtils.targetPlayer ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
return super.getDisplayName();
}
@Override
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
if (mouseButton == 0 && isHovering(mouseX, mouseY) && isVisible()) {
EntityUtils.targetPlayer = !EntityUtils.targetPlayer;
displayName = "Players";
color = EntityUtils.targetPlayer ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
return true;
}
return false;
}
});
getElements().add(new ButtonElement("Mobs") {
@Override
public void createButton(String displayName) {
color = EntityUtils.targetMobs ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
super.createButton(displayName);
}
@Override
public String getDisplayName() {
displayName = "Mobs";
color = EntityUtils.targetMobs ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
return super.getDisplayName();
}
@Override
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
if (mouseButton == 0 && isHovering(mouseX, mouseY) && isVisible()) {
EntityUtils.targetMobs = !EntityUtils.targetMobs;
displayName = "Mobs";
color = EntityUtils.targetMobs ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
return true;
}
return false;
}
});
getElements().add(new ButtonElement("Animals") {
@Override
public void createButton(String displayName) {
color = EntityUtils.targetAnimals ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
super.createButton(displayName);
}
@Override
public String getDisplayName() {
displayName = "Animals";
color = EntityUtils.targetAnimals ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
return super.getDisplayName();
}
@Override
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
if (mouseButton == 0 && isHovering(mouseX, mouseY) && isVisible()) {
EntityUtils.targetAnimals = !EntityUtils.targetAnimals;
displayName = "Animals";
color = EntityUtils.targetAnimals ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
return true;
}
return false;
}
});
getElements().add(new ButtonElement("Invisible") {
@Override
public void createButton(String displayName) {
color = EntityUtils.targetInvisible ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
super.createButton(displayName);
}
@Override
public String getDisplayName() {
displayName = "Invisible";
color = EntityUtils.targetInvisible ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
return super.getDisplayName();
}
@Override
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
if (mouseButton == 0 && isHovering(mouseX, mouseY) && isVisible()) {
EntityUtils.targetInvisible = !EntityUtils.targetInvisible;
displayName = "Invisible";
color = EntityUtils.targetInvisible ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
return true;
}
return false;
}
});
getElements().add(new ButtonElement("Dead") {
@Override
public void createButton(String displayName) {
color = EntityUtils.targetDead ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
super.createButton(displayName);
}
@Override
public String getDisplayName() {
displayName = "Dead";
color = EntityUtils.targetDead ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
return super.getDisplayName();
}
@Override
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
if (mouseButton == 0 && isHovering(mouseX, mouseY) && isVisible()) {
EntityUtils.targetDead = !EntityUtils.targetDead;
displayName = "Dead";
color = EntityUtils.targetDead ? ClickGUI.generateColor().getRGB() : Integer.MAX_VALUE;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
return true;
}
return false;
}
});
}
});
}
@Override
public void initGui() {
slide = progress = 0;
lastMS = System.currentTimeMillis();
super.initGui();
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
if (progress < 1) progress = (float)(System.currentTimeMillis() - lastMS) / (500F / Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).animSpeedValue.get()); // fully fps async
else progress = 1;
switch (Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).animationValue.get().toLowerCase()) {
case "slidebounce":
case "zoombounce":
slide = EaseUtils.easeOutBack(progress);
break;
case "slide":
case "zoom":
case "azura":
slide = EaseUtils.easeOutQuart(progress);
break;
case "none":
slide = 1;
break;
}
if (Mouse.isButtonDown(0) && mouseX >= 5 && mouseX <= 50 && mouseY <= height - 5 && mouseY >= height - 50)
mc.displayGuiScreen(new GuiHudDesigner());
// Enable DisplayList optimization
AWTFontRenderer.Companion.setAssumeNonVolatile(true);
final double scale = Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).scaleValue.get();
mouseX /= scale;
mouseY /= scale;
this.mouseX = mouseX;
this.mouseY = mouseY;
switch (Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).backgroundValue.get()) {
case "Default":
drawDefaultBackground();
break;
case "Gradient":
drawGradientRect(0, 0, width, height,
ColorUtils.reAlpha(ClickGUI.generateColor(), Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).gradEndValue.get()).getRGB(),
ColorUtils.reAlpha(ClickGUI.generateColor(), Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).gradStartValue.get()).getRGB());
break;
default:
break;
}
GlStateManager.disableAlpha();
RenderUtils.drawImage(hudIcon, 9, height - 41, 32, 32);
GlStateManager.enableAlpha();
switch (Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).animationValue.get().toLowerCase()) {
case "azura":
GlStateManager.translate(0, (1.0 - slide) * height * 2.0, 0);
GlStateManager.scale(scale, scale + (1.0 - slide) * 2.0, scale);
break;
case "slide":
case "slidebounce":
GlStateManager.translate(0, (1.0 - slide) * height * 2.0, 0);
GlStateManager.scale(scale, scale, scale);
break;
case "zoom":
GlStateManager.translate((1.0 - slide) * (width / 2.0), (1.0 - slide) * (height / 2.0), (1.0 - slide) * (width / 2.0));
GlStateManager.scale(scale * slide, scale * slide, scale * slide);
break;
case "zoombounce":
GlStateManager.translate((1.0 - slide) * (width / 2.0), (1.0 - slide) * (height / 2.0), 0);
GlStateManager.scale(scale * slide, scale * slide, scale * slide);
break;
case "none":
GlStateManager.scale(scale, scale, scale);
break;
}
for (final Panel panel : panels) {
panel.updateFade(RenderUtils.deltaTime);
panel.drawScreen(mouseX, mouseY, partialTicks);
}
for (final Panel panel : panels) {
for (final Element element : panel.getElements()) {
if (element instanceof ModuleElement) {
final ModuleElement moduleElement = (ModuleElement) element;
if (mouseX != 0 && mouseY != 0 && moduleElement.isHovering(mouseX, mouseY) && moduleElement.isVisible() && element.getY() <= panel.getY() + panel.getFade())
style.drawDescription(mouseX, mouseY, moduleElement.getModule().getDescription());
}
}
}
GlStateManager.disableLighting();
RenderHelper.disableStandardItemLighting();
switch (Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).animationValue.get().toLowerCase()) {
case "azura":
GlStateManager.translate(0, (1.0 - slide) * height * -2.0, 0);
break;
case "slide":
case "slidebounce":
GlStateManager.translate(0, (1.0 - slide) * height * -2.0, 0);
break;
case "zoom":
GlStateManager.translate(-1 * (1.0 - slide) * (width / 2.0), -1 * (1.0 - slide) * (height / 2.0), -1 * (1.0 - slide) * (width / 2.0));
break;
case "zoombounce":
GlStateManager.translate(-1 * (1.0 - slide) * (width / 2.0), -1 * (1.0 - slide) * (height / 2.0), 0);
break;
}
GlStateManager.scale(1, 1, 1);
AWTFontRenderer.Companion.setAssumeNonVolatile(false);
super.drawScreen(mouseX, mouseY, partialTicks);
}
public void handleMouseInput() throws IOException {
super.handleMouseInput();
int wheel = Mouse.getEventDWheel();
for (int i = panels.size() - 1; i >= 0; i--)
if (panels.get(i).handleScroll(mouseX, mouseY, wheel))
break;
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
final double scale = Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).scaleValue.get();
mouseX /= scale;
mouseY /= scale;
for (int i = panels.size() - 1; i >= 0; i--) {
if (panels.get(i).mouseClicked(mouseX, mouseY, mouseButton)){
break;
}
}
for (final Panel panel : panels) {
panel.drag = false;
if (mouseButton == 0 && panel.isHovering(mouseX, mouseY)) {
clickedPanel = panel;
break;
}
}
if (clickedPanel != null) {
clickedPanel.x2 = clickedPanel.x - mouseX;
clickedPanel.y2 = clickedPanel.y - mouseY;
clickedPanel.drag = true;
panels.remove(clickedPanel);
panels.add(clickedPanel);
clickedPanel = null;
}
super.mouseClicked(mouseX, mouseY, mouseButton);
}
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
final double scale = Objects.requireNonNull(LiquidBounce.moduleManager.getModule(ClickGUI.class)).scaleValue.get();
mouseX /= scale;
mouseY /= scale;
for (Panel panel : panels) {
panel.mouseReleased(mouseX, mouseY, state);
}
super.mouseReleased(mouseX, mouseY, state);
}
@Override
public void updateScreen() {
for (final Panel panel : panels) {
for (final Element element : panel.getElements()) {
if (element instanceof ButtonElement) {
final ButtonElement buttonElement = (ButtonElement) element;
if (buttonElement.isHovering(mouseX, mouseY)) {
if (buttonElement.hoverTime < 7)
buttonElement.hoverTime++;
} else if (buttonElement.hoverTime > 0)
buttonElement.hoverTime--;
}
if (element instanceof ModuleElement) {
if (((ModuleElement) element).getModule().getState()) {
if (((ModuleElement) element).slowlyFade < 255)
((ModuleElement) element).slowlyFade += 50;
} else if (((ModuleElement) element).slowlyFade > 0)
((ModuleElement) element).slowlyFade -= 50;
if (((ModuleElement) element).slowlyFade > 255)
((ModuleElement) element).slowlyFade = 255;
if (((ModuleElement) element).slowlyFade < 0)
((ModuleElement) element).slowlyFade = 0;
}
}
}
super.updateScreen();
}
@Override
public void onGuiClosed() {
LiquidBounce.fileManager.saveConfig(LiquidBounce.fileManager.clickGuiConfig);
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}
| 18,690 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ButtonElement.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/elements/ButtonElement.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui.elements;
import net.ccbluex.liquidbounce.LiquidBounce;
public class ButtonElement extends Element {
protected String displayName;
protected int color = 0xffffff;
public int hoverTime;
public ButtonElement(String displayName) {
createButton(displayName);
}
public void createButton(String displayName) {
this.displayName = displayName;
}
@Override
public void drawScreen(int mouseX, int mouseY, float button) {
LiquidBounce.clickGui.style.drawButtonElement(mouseX, mouseY, this);
super.drawScreen(mouseX, mouseY, button);
}
@Override
public int getHeight() {
return 16;
}
public boolean isHovering(int mouseX, int mouseY) {
return mouseX >= getX() && mouseX <= getX() + getWidth() && mouseY >= getY() && mouseY <= getY() + 16;
}
public String getDisplayName() {
return displayName;
}
public void setColor(int color) {
this.color = color;
}
public int getColor() {
return color;
}
}
| 1,291 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Element.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/elements/Element.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui.elements;
import net.ccbluex.liquidbounce.utils.MinecraftInstance;
public class Element extends MinecraftInstance {
private int x;
private int y;
private int width;
private int height;
private boolean visible;
public void setLocation(int x, int y) {
this.x = x;
this.y = y;
}
public void drawScreen(int mouseX, int mouseY, float button) {
}
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
return false;
}
public boolean mouseReleased(int mouseX, int mouseY, int state) {
return false;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
}
| 1,471 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ModuleElement.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/elements/ModuleElement.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui.elements;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.Module;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Mouse;
public class ModuleElement extends ButtonElement {
private final Module module;
private boolean showSettings;
private float settingsWidth = 0F;
private boolean wasPressed;
public int slowlySettingsYPos;
public int slowlyFade;
public ModuleElement(final Module module) {
super(null);
this.displayName = module.getName();
this.module = module;
}
@Override
public void drawScreen(int mouseX, int mouseY, float button) {
LiquidBounce.clickGui.style.drawModuleElement(mouseX, mouseY, this);
}
@Override
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
if (mouseButton == 0 && isHovering(mouseX, mouseY) && isVisible()) {
module.toggle();
return true;
//mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); duplicated lol
}
if (mouseButton == 1 && isHovering(mouseX, mouseY) && isVisible()) {
showSettings = !showSettings;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
return true;
}
return false;
}
public Module getModule() {
return module;
}
public boolean isShowSettings() {
return showSettings;
}
public void setShowSettings(boolean showSettings) {
this.showSettings = showSettings;
}
public boolean isntPressed() {
return !wasPressed;
}
public void updatePressed() {
wasPressed = Mouse.isButtonDown(0);
}
public float getSettingsWidth() {
return settingsWidth;
}
public void setSettingsWidth(float settingsWidth) {
this.settingsWidth = settingsWidth;
}
}
| 2,310 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Style.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/Style.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui.style;
import net.ccbluex.liquidbounce.ui.client.clickgui.Panel;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ButtonElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ModuleElement;
import net.ccbluex.liquidbounce.utils.MinecraftInstance;
public abstract class Style extends MinecraftInstance {
public abstract void drawPanel(final int mouseX, final int mouseY, final Panel panel);
public abstract void drawDescription(final int mouseX, final int mouseY, final String text);
public abstract void drawButtonElement(final int mouseX, final int mouseY, final ButtonElement buttonElement);
public abstract void drawModuleElement(final int mouseX, final int mouseY, final ModuleElement moduleElement);
}
| 996 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
LiquidBounceStyle.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/LiquidBounceStyle.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui.style.styles;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.modules.render.ClickGUI;
import net.ccbluex.liquidbounce.ui.client.clickgui.Panel;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ButtonElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ModuleElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.Style;
import net.ccbluex.liquidbounce.ui.font.AWTFontRenderer;
import net.ccbluex.liquidbounce.ui.font.Fonts;
import net.ccbluex.liquidbounce.ui.font.GameFontRenderer;
import net.ccbluex.liquidbounce.utils.block.BlockUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.value.*;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.math.BigDecimal;
import java.util.List;
public class LiquidBounceStyle extends Style {
private boolean mouseDown;
private boolean rightMouseDown;
@Override
public void drawPanel(int mouseX, int mouseY, Panel panel) {
RenderUtils.drawBorderedRect((float) panel.getX() - (panel.getScrollbar() ? 4 : 0), (float) panel.getY(), (float) panel.getX() + panel.getWidth(), (float) panel.getY() + 19 + panel.getFade(), 1F, new Color(255, 255, 255, 90).getRGB(), Integer.MIN_VALUE);
float textWidth = Fonts.font35.getStringWidth("§f" + StringUtils.stripControlCodes(panel.getName()));
Fonts.font35.drawString("§f" + panel.getName(), (int) (panel.getX() - (textWidth - 100.0F) / 2F), panel.getY() + 7, -16777216);
if(panel.getScrollbar() && panel.getFade() > 0) {
RenderUtils.drawRect(panel.getX() - 1.5F, panel.getY() + 21, panel.getX() - 0.5F, panel.getY() + 16 + panel.getFade(), Integer.MAX_VALUE);
RenderUtils.drawRect(panel.getX() - 2, panel.getY() + 30 + (panel.getFade() - 24F) / (panel.getElements().size() - LiquidBounce.moduleManager.getModule(ClickGUI.class).maxElementsValue.get()) * panel.getDragged() - 10.0f, panel.getX(), panel.getY() + 40 + (panel.getFade() - 24.0f) / (panel.getElements().size() - LiquidBounce.moduleManager.getModule(ClickGUI.class).maxElementsValue.get()) * panel.getDragged(), Integer.MIN_VALUE);
}
}
@Override
public void drawDescription(int mouseX, int mouseY, String text) {
int textWidth = Fonts.font35.getStringWidth(text);
RenderUtils.drawBorderedRect(mouseX + 9, mouseY, mouseX + textWidth + 14, mouseY + Fonts.font35.FONT_HEIGHT + 3, 1, new Color(255, 255, 255, 90).getRGB(), Integer.MIN_VALUE);
GlStateManager.resetColor();
Fonts.font35.drawString(text, mouseX + 12, mouseY + (Fonts.font35.FONT_HEIGHT) / 2, Integer.MAX_VALUE);
}
@Override
public void drawButtonElement(int mouseX, int mouseY, ButtonElement buttonElement) {
GlStateManager.resetColor();
Fonts.font35.drawString(buttonElement.getDisplayName(), (int) (buttonElement.getX() + 5), buttonElement.getY() + 7, buttonElement.getColor());
}
@Override
public void drawModuleElement(int mouseX, int mouseY, ModuleElement moduleElement) {
int guiColor = ClickGUI.generateColor().getRGB();
GlStateManager.resetColor();
Fonts.font35.drawString(moduleElement.getDisplayName(), (int) (moduleElement.getX() + 5), moduleElement.getY() + 7, moduleElement.getModule().getState() ? guiColor : Integer.MAX_VALUE);
final List<Value<?>> moduleValues = moduleElement.getModule().getValues();
if(!moduleValues.isEmpty()) {
Fonts.font35.drawString("+", moduleElement.getX() + moduleElement.getWidth() - 8, moduleElement.getY() + (moduleElement.getHeight() / 2), Color.WHITE.getRGB());
if(moduleElement.isShowSettings()) {
int yPos = moduleElement.getY() + 4;
for(final Value value : moduleValues) {
if (!((boolean)value.getCanDisplay().invoke()))
continue;
boolean isNumber = value.get() instanceof Number;
if (isNumber) {
AWTFontRenderer.Companion.setAssumeNonVolatile(false);
}
if (value instanceof BoolValue) {
final String text = value.getName();
final float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 14, Integer.MIN_VALUE);
if (mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= yPos + 2 && mouseY <= yPos + 14) {
if (Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
final BoolValue boolValue = (BoolValue) value;
boolValue.set(!boolValue.get());
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
}
GlStateManager.resetColor();
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, ((BoolValue) value).get() ? guiColor : Integer.MAX_VALUE);
yPos += 12;
}else if(value instanceof ListValue) {
ListValue listValue = (ListValue) value;
final String text = value.getName();
final float textWidth = Fonts.font35.getStringWidth(text);
if(moduleElement.getSettingsWidth() < textWidth + 16)
moduleElement.setSettingsWidth(textWidth + 16);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 14, Integer.MIN_VALUE);
GlStateManager.resetColor();
Fonts.font35.drawString("§c" + text, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, 0xffffff);
Fonts.font35.drawString(listValue.openList ? "-" : "+", (int) (moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() - (listValue.openList ? 5 : 6)), yPos + 4, 0xffffff);
if(mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= yPos + 2 && mouseY <= yPos + 14) {
if(Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
listValue.openList = !listValue.openList;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
}
yPos += 12;
for(final String valueOfList : listValue.getValues()) {
final float textWidth2 = Fonts.font35.getStringWidth(">" + valueOfList);
if(moduleElement.getSettingsWidth() < textWidth2 + 8)
moduleElement.setSettingsWidth(textWidth2 + 8);
if (listValue.openList) {
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 14, Integer.MIN_VALUE);
if(mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= yPos + 2 && mouseY <= yPos + 14) {
if(Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
listValue.set(valueOfList);
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
}
GlStateManager.resetColor();
Fonts.font35.drawString(">", moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, Integer.MAX_VALUE);
Fonts.font35.drawString(valueOfList, moduleElement.getX() + moduleElement.getWidth() + 14, yPos + 4, listValue.get() != null && listValue.get().equalsIgnoreCase(valueOfList) ? guiColor : Integer.MAX_VALUE);
yPos += 12;
}
}
}else if(value instanceof FloatValue) {
final FloatValue floatValue = (FloatValue) value;
final String text = value.getName() + "§f: §c" + round(floatValue.get()) + floatValue.getSuffix();
final float textWidth = Fonts.font35.getStringWidth(text);
if(moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 24, Integer.MIN_VALUE);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 8, yPos + 18, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() - 4, yPos + 19, Integer.MAX_VALUE);
final float sliderValue = moduleElement.getX() + moduleElement.getWidth() + ((moduleElement.getSettingsWidth() - 12) * (floatValue.get() - floatValue.getMinimum()) / (floatValue.getMaximum() - floatValue.getMinimum()));
RenderUtils.drawRect(8 + sliderValue, yPos + 15, sliderValue + 11, yPos + 21, guiColor);
if(mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() - 4 && mouseY >= yPos + 15 && mouseY <= yPos + 21) {
int dWheel = Mouse.getDWheel();
if (Mouse.hasWheel() && dWheel != 0) {
if (dWheel > 0)
floatValue.set(Math.min(floatValue.get() + 0.01F, floatValue.getMaximum()));
if (dWheel < 0)
floatValue.set(Math.max(floatValue.get() - 0.01F, floatValue.getMinimum()));
}
if(Mouse.isButtonDown(0)) {
double i = MathHelper.clamp_double((mouseX - moduleElement.getX() - moduleElement.getWidth() - 8) / (moduleElement.getSettingsWidth() - 12), 0, 1);
floatValue.set(round((float) (floatValue.getMinimum() + (floatValue.getMaximum() - floatValue.getMinimum()) * i)).floatValue());
}
}
GlStateManager.resetColor();
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, 0xffffff);
yPos += 22;
}else if(value instanceof IntegerValue) {
final IntegerValue integerValue = (IntegerValue) value;
final String text = value.getName() + "§f: §c" + (value instanceof BlockValue ? BlockUtils.getBlockName(integerValue.get()) + " (" + integerValue.get() + ")" : (integerValue.get() + integerValue.getSuffix()));
final float textWidth = Fonts.font35.getStringWidth(text);
if(moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 24, Integer.MIN_VALUE);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 8, yPos + 18, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() - 4, yPos + 19, Integer.MAX_VALUE);
final float sliderValue = moduleElement.getX() + moduleElement.getWidth() + ((moduleElement.getSettingsWidth() - 12) * (integerValue.get() - integerValue.getMinimum()) / (integerValue.getMaximum() - integerValue.getMinimum()));
RenderUtils.drawRect(8 + sliderValue, yPos + 15, sliderValue + 11, yPos + 21, guiColor);
if(mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= yPos + 15 && mouseY <= yPos + 21) {
int dWheel = Mouse.getDWheel();
if (Mouse.hasWheel() && dWheel != 0) {
if (dWheel > 0)
integerValue.set(Math.min(integerValue.get() + 1, integerValue.getMaximum()));
if (dWheel < 0)
integerValue.set(Math.max(integerValue.get() - 1, integerValue.getMinimum()));
}
if(Mouse.isButtonDown(0)) {
double i = MathHelper.clamp_double((mouseX - moduleElement.getX() - moduleElement.getWidth() - 8) / (moduleElement.getSettingsWidth() - 12), 0, 1);
integerValue.set((int) (integerValue.getMinimum() + (integerValue.getMaximum() - integerValue.getMinimum()) * i));
}
}
GlStateManager.resetColor();
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, 0xffffff);
yPos += 22;
}else if(value instanceof FontValue) {
final FontValue fontValue = (FontValue) value;
final FontRenderer fontRenderer = fontValue.get();
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 14, Integer.MIN_VALUE);
String displayString = "Font: Unknown";
if (fontRenderer instanceof GameFontRenderer) {
final GameFontRenderer liquidFontRenderer = (GameFontRenderer) fontRenderer;
displayString = "Font: " + liquidFontRenderer.getDefaultFont().getFont().getName() + " - " + liquidFontRenderer.getDefaultFont().getFont().getSize();
}else if(fontRenderer == Fonts.minecraftFont)
displayString = "Font: Minecraft";
else{
final Object[] objects = Fonts.getFontDetails(fontRenderer);
if(objects != null) {
displayString = objects[0] + ((int) objects[1] != -1 ? " - " + objects[1] : "");
}
}
Fonts.font35.drawString(displayString, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, Color.WHITE.getRGB());
int stringWidth = Fonts.font35.getStringWidth(displayString);
if(moduleElement.getSettingsWidth() < stringWidth + 8)
moduleElement.setSettingsWidth(stringWidth + 8);
if((Mouse.isButtonDown(0) && !mouseDown || Mouse.isButtonDown(1) && !rightMouseDown) && mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= yPos + 4 && mouseY <= yPos + 12) {
final List<FontRenderer> fonts = Fonts.getFonts();
if(Mouse.isButtonDown(0)) {
for(int i = 0; i < fonts.size(); i++) {
final FontRenderer font = fonts.get(i);
if(font == fontRenderer) {
i++;
if(i >= fonts.size())
i = 0;
fontValue.set(fonts.get(i));
break;
}
}
}else{
for(int i = fonts.size() - 1; i >= 0; i--) {
final FontRenderer font = fonts.get(i);
if(font == fontRenderer) {
i--;
if(i >= fonts.size())
i = 0;
if(i < 0)
i = fonts.size() - 1;
fontValue.set(fonts.get(i));
break;
}
}
}
}
yPos += 11;
}else{
String text = value.getName() + "§f: §c" + value.get();
float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 14, Integer.MIN_VALUE);
GlStateManager.resetColor();
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, 0xffffff);
yPos += 12;
}
if (isNumber) {
AWTFontRenderer.Companion.setAssumeNonVolatile(true);
}
}
moduleElement.updatePressed();
mouseDown = Mouse.isButtonDown(0);
rightMouseDown = Mouse.isButtonDown(1);
if(moduleElement.getSettingsWidth() > 0F && yPos > moduleElement.getY() + 4)
RenderUtils.drawBorderedRect(moduleElement.getX() + moduleElement.getWidth() + 4, moduleElement.getY() + 6, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 2, 1F, Integer.MIN_VALUE, 0);
}
}
}
private BigDecimal round(final float f) {
BigDecimal bd = new BigDecimal(Float.toString(f));
bd = bd.setScale(2, 4);
return bd;
}
}
| 20,385 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
BlackStyle.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/BlackStyle.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui.style.styles;
import net.ccbluex.liquidbounce.ui.client.clickgui.Panel;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ButtonElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ModuleElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.Style;
import net.ccbluex.liquidbounce.ui.font.Fonts;
import net.ccbluex.liquidbounce.ui.font.GameFontRenderer;
import net.ccbluex.liquidbounce.utils.block.BlockUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.value.*;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.math.BigDecimal;
import java.util.List;
public class BlackStyle extends Style {
private boolean mouseDown;
private boolean rightMouseDown;
@Override
public void drawPanel(int mouseX, int mouseY, Panel panel) {
RenderUtils.drawBorderedRect((float) panel.getX(), (float) panel.getY() - 3, (float) panel.getX() + panel.getWidth(), (float) panel.getY() + 17, 3, new Color(20, 20, 20).getRGB(), new Color(20,20,20).getRGB());
if(panel.getFade() > 0) {
RenderUtils.drawBorderedRect((float) panel.getX(), (float) panel.getY() + 17, (float) panel.getX() + panel.getWidth(), panel.getY() + 19 + panel.getFade(), 3, new Color(40,40,40).getRGB(), new Color(40,40,40).getRGB());
RenderUtils.drawBorderedRect((float) panel.getX(), panel.getY() + 17 + panel.getFade(), (float) panel.getX() + panel.getWidth(), panel.getY() + 19 + panel.getFade() + 5, 3, new Color(20,20,20).getRGB(), new Color(20,20,20).getRGB());
}
GlStateManager.resetColor();
float textWidth = Fonts.font35.getStringWidth("§f" + StringUtils.stripControlCodes(panel.getName()));
Fonts.font35.drawString(panel.getName(), (int) (panel.getX() - (textWidth - 100.0F) / 2F), panel.getY() + 7 - 3, Color.WHITE.getRGB());
}
@Override
public void drawDescription(int mouseX, int mouseY, String text) {
int textWidth = Fonts.font35.getStringWidth(text);
RenderUtils.drawBorderedRect(mouseX + 9, mouseY, mouseX + textWidth + 14, mouseY + Fonts.font35.FONT_HEIGHT + 3, 3F, new Color(40,40,40).getRGB(), new Color(40,40,40).getRGB());
GlStateManager.resetColor();
Fonts.font35.drawString(text, mouseX + 12, mouseY + (Fonts.font35.FONT_HEIGHT / 2), Color.WHITE.getRGB());
}
@Override
public void drawButtonElement(int mouseX, int mouseY, ButtonElement buttonElement) {
Gui.drawRect(buttonElement.getX() - 1, buttonElement.getY() - 1, buttonElement.getX() + buttonElement.getWidth() + 1, buttonElement.getY() + buttonElement.getHeight() + 1, hoverColor(buttonElement.getColor() != Integer.MAX_VALUE ? new Color(20,20,20) : new Color(40,40,40), buttonElement.hoverTime).getRGB());
GlStateManager.resetColor();
Fonts.font35.drawString(buttonElement.getDisplayName(), buttonElement.getX() + 5, buttonElement.getY() + 5, Color.WHITE.getRGB());
}
@Override
public void drawModuleElement(int mouseX, int mouseY, ModuleElement moduleElement) {
Gui.drawRect(moduleElement.getX() - 1, moduleElement.getY() - 1, moduleElement.getX() + moduleElement.getWidth() + 1, moduleElement.getY() + moduleElement.getHeight() + 1, hoverColor(new Color(40,40,40), moduleElement.hoverTime).getRGB());
Gui.drawRect(moduleElement.getX() - 1, moduleElement.getY() - 1, moduleElement.getX() + moduleElement.getWidth() + 1, moduleElement.getY() + moduleElement.getHeight() + 1, hoverColor(new Color(20,20,20, moduleElement.slowlyFade), moduleElement.hoverTime).getRGB());
GlStateManager.resetColor();
Fonts.font35.drawString(moduleElement.getDisplayName(), moduleElement.getX() + 5, moduleElement.getY() + 7, Color.WHITE.getRGB());
// Draw settings
final List<Value<?>> moduleValues = moduleElement.getModule().getValues();
if(!moduleValues.isEmpty()) {
Fonts.font35.drawString(">", moduleElement.getX() + moduleElement.getWidth() - 8, moduleElement.getY() + 5, Color.WHITE.getRGB());
if(moduleElement.isShowSettings()) {
if(moduleElement.getSettingsWidth() > 0F && moduleElement.slowlySettingsYPos > moduleElement.getY() + 6)
RenderUtils.drawBorderedRect(moduleElement.getX() + moduleElement.getWidth() + 4, moduleElement.getY() + 6, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), moduleElement.slowlySettingsYPos + 2, 3F, new Color(40,40,40).getRGB(), new Color(40,40,40).getRGB());
moduleElement.slowlySettingsYPos = moduleElement.getY() + 6;
for(final Value value : moduleValues) {
if (!((boolean)value.getCanDisplay().invoke()))
continue;
if(value instanceof BoolValue) {
final String text = value.getName();
final float textWidth = Fonts.font35.getStringWidth(text);
if(moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
if(mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos && mouseY <= moduleElement.slowlySettingsYPos + 12 && Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
final BoolValue boolValue = (BoolValue) value;
boolValue.set(!boolValue.get());
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, ((BoolValue) value).get() ? Color.WHITE.getRGB() : Integer.MAX_VALUE);
moduleElement.slowlySettingsYPos += 11;
}else if(value instanceof ListValue) {
final ListValue listValue = (ListValue) value;
final String text = value.getName();
final float textWidth = Fonts.font35.getStringWidth(text);
if(moduleElement.getSettingsWidth() < textWidth + 16)
moduleElement.setSettingsWidth(textWidth + 16);
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, 0xffffff);
Fonts.font35.drawString(listValue.openList ? "-" : "+", (int) (moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() - (listValue.openList ? 5 : 6)), moduleElement.slowlySettingsYPos + 2, 0xffffff);
if(mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos && mouseY <= moduleElement.slowlySettingsYPos + Fonts.font35.FONT_HEIGHT && Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
listValue.openList = !listValue.openList;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
moduleElement.slowlySettingsYPos += Fonts.font35.FONT_HEIGHT + 1;
for(final String valueOfList : listValue.getValues()) {
final float textWidth2 = Fonts.font35.getStringWidth("> " + valueOfList);
if(moduleElement.getSettingsWidth() < textWidth2 + 12)
moduleElement.setSettingsWidth(textWidth2 + 12);
if (listValue.openList) {
if(mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos + 2 && mouseY <= moduleElement.slowlySettingsYPos + 14 && Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
listValue.set(valueOfList);
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
GlStateManager.resetColor();
Fonts.font35.drawString("> " + valueOfList, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, listValue.get() != null && listValue.get().equalsIgnoreCase(valueOfList) ? Color.WHITE.getRGB() : Integer.MAX_VALUE);
moduleElement.slowlySettingsYPos += Fonts.font35.FONT_HEIGHT + 1;
}
}
if (!listValue.openList) {
moduleElement.slowlySettingsYPos += 1;
}
}else if(value instanceof FloatValue) {
final FloatValue floatValue = (FloatValue) value;
final String text = value.getName() + "§f: " + round(floatValue.get()) + floatValue.getSuffix();
final float textWidth = Fonts.font35.getStringWidth(text);
if(moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
final float valueOfSlide = drawSlider(floatValue.get(), floatValue.getMinimum(), floatValue.getMaximum(), false, moduleElement.getX() + moduleElement.getWidth() + 8, moduleElement.slowlySettingsYPos + 14, (int) moduleElement.getSettingsWidth() - 12, mouseX, mouseY, new Color(20,20,20));
if(valueOfSlide != floatValue.get())
floatValue.set(valueOfSlide);
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 3, 0xffffff);
moduleElement.slowlySettingsYPos += 19;
}else if(value instanceof IntegerValue) {
final IntegerValue integerValue = (IntegerValue) value;
final String text = value.getName() + "§f: " + (value instanceof BlockValue ? BlockUtils.getBlockName(integerValue.get()) + " (" + integerValue.get() + ")" : (integerValue.get() + integerValue.getSuffix()));
final float textWidth = Fonts.font35.getStringWidth(text);
if(moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
final float valueOfSlide = drawSlider(integerValue.get(), integerValue.getMinimum(), integerValue.getMaximum(), true, moduleElement.getX() + moduleElement.getWidth() + 8, moduleElement.slowlySettingsYPos + 14, (int) moduleElement.getSettingsWidth() - 12, mouseX, mouseY, new Color(20,20,20));
if(valueOfSlide != integerValue.get())
integerValue.set((int) valueOfSlide);
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 3, 0xffffff);
moduleElement.slowlySettingsYPos += 19;
}else if(value instanceof FontValue) {
final FontValue fontValue = (FontValue) value;
final FontRenderer fontRenderer = fontValue.get();
String displayString = "Font: Unknown";
if (fontRenderer instanceof GameFontRenderer) {
final GameFontRenderer liquidFontRenderer = (GameFontRenderer) fontRenderer;
displayString = "Font: " + liquidFontRenderer.getDefaultFont().getFont().getName() + " - " + liquidFontRenderer.getDefaultFont().getFont().getSize();
}else if(fontRenderer == Fonts.minecraftFont)
displayString = "Font: Minecraft";
else{
final Object[] objects = Fonts.getFontDetails(fontRenderer);
if(objects != null) {
displayString = objects[0] + ((int) objects[1] != -1 ? " - " + objects[1] : "");
}
}
Fonts.font35.drawString(displayString, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, Color.WHITE.getRGB());
int stringWidth = Fonts.font35.getStringWidth(displayString);
if(moduleElement.getSettingsWidth() < stringWidth + 8)
moduleElement.setSettingsWidth(stringWidth + 8);
if((Mouse.isButtonDown(0) && !mouseDown || Mouse.isButtonDown(1) && !rightMouseDown) && mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos && mouseY <= moduleElement.slowlySettingsYPos + 12) {
final List<FontRenderer> fonts = Fonts.getFonts();
if(Mouse.isButtonDown(0)) {
for(int i = 0; i < fonts.size(); i++) {
final FontRenderer font = fonts.get(i);
if(font == fontRenderer) {
i++;
if(i >= fonts.size())
i = 0;
fontValue.set(fonts.get(i));
break;
}
}
}else{
for(int i = fonts.size() - 1; i >= 0; i--) {
final FontRenderer font = fonts.get(i);
if(font == fontRenderer) {
i--;
if(i >= fonts.size())
i = 0;
if(i < 0)
i = fonts.size() - 1;
fontValue.set(fonts.get(i));
break;
}
}
}
}
moduleElement.slowlySettingsYPos += 11;
}else{
final String text = value.getName() + "§f: " + value.get();
final float textWidth = Fonts.font35.getStringWidth(text);
if(moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
GlStateManager.resetColor();
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 4, 0xffffff);
moduleElement.slowlySettingsYPos += 12;
}
}
moduleElement.updatePressed();
mouseDown = Mouse.isButtonDown(0);
rightMouseDown = Mouse.isButtonDown(1);
}
}
}
/*public static boolean drawCheckbox(final boolean value, final int x, final int y, final int mouseX, final int mouseY, final Color color) {
RenderUtils.drawRect(x, y, x + 20, y + 10, value ? Color.GREEN : Color.RED);
RenderUtils.drawFilledCircle(x + (value ? 15 : 5),y + 5, 5, Color.WHITE);
if(mouseX >= x && mouseX <= x + 20 && mouseY >= y && mouseY <= y + 10 && Mouse.isButtonDown(0))
return !value;
return value;
}*/
private BigDecimal round(final float v) {
BigDecimal bigDecimal = new BigDecimal(Float.toString(v));
bigDecimal = bigDecimal.setScale(2, 4);
return bigDecimal;
}
private Color hoverColor(final Color color, final int hover) {
final int r = color.getRed() - (hover * 2);
final int g = color.getGreen() - (hover * 2);
final int b = color.getBlue() - (hover * 2);
return new Color(Math.max(r, 0), Math.max(g, 0), Math.max(b, 0), color.getAlpha());
}
public static float drawSlider(final float value, final float min, final float max, final boolean inte, final int x, final int y, final int width, final int mouseX, final int mouseY, final Color color) {
final float displayValue = Math.max(min, Math.min(value, max));
final float sliderValue = (float) x + (float) width * (displayValue - min) / (max - min);
RenderUtils.drawRect(x, y, x + width, y + 2, Integer.MAX_VALUE);
RenderUtils.drawRect(x, y, sliderValue, y + 2, color);
RenderUtils.drawFilledCircle((int) sliderValue, y + 1, 3, color);
if (mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 3) {
int dWheel = Mouse.getDWheel();
if (Mouse.hasWheel() && dWheel != 0) {
if (dWheel > 0)
return Math.min(value + (inte ? 1F : 0.01F), max);
if (dWheel < 0)
return Math.max(value - (inte ? 1F : 0.01F), min);
}
if (Mouse.isButtonDown(0)) {
double i = MathHelper.clamp_double(((double) mouseX - (double) x) / ((double) width - 3), 0, 1);
BigDecimal bigDecimal = new BigDecimal(Double.toString((min + (max - min) * i)));
bigDecimal = bigDecimal.setScale(2, 4);
return bigDecimal.floatValue();
}
}
return value;
}
}
| 18,902 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
WhiteStyle.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/WhiteStyle.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui.style.styles;
import net.ccbluex.liquidbounce.ui.client.clickgui.Panel;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ButtonElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ModuleElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.Style;
import net.ccbluex.liquidbounce.ui.font.Fonts;
import net.ccbluex.liquidbounce.ui.font.GameFontRenderer;
import net.ccbluex.liquidbounce.utils.block.BlockUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.value.*;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.math.BigDecimal;
import java.util.List;
public class WhiteStyle extends Style {
private boolean mouseDown;
private boolean rightMouseDown;
public static float drawSlider(final float value, final float min, final float max, final boolean inte, final int x, final int y, final int width, final int mouseX, final int mouseY, final Color color) {
final float displayValue = Math.max(min, Math.min(value, max));
final float sliderValue = (float) x + (float) width * (displayValue - min) / (max - min);
RenderUtils.drawRect(x, y, x + width, y + 2, new Color(120, 120, 120).getRGB());
RenderUtils.drawRect(x, y, sliderValue, y + 2, color);
RenderUtils.drawFilledCircle((int) sliderValue, y + 1, 3, color);
if (mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 3) {
int dWheel = Mouse.getDWheel();
if (Mouse.hasWheel() && dWheel != 0) {
if (dWheel > 0)
return Math.min(value + (inte ? 1F : 0.01F), max);
if (dWheel < 0)
return Math.max(value - (inte ? 1F : 0.01F), min);
}
if (Mouse.isButtonDown(0)) {
double i = MathHelper.clamp_double(((double) mouseX - (double) x) / ((double) width - 3), 0, 1);
BigDecimal bigDecimal = new BigDecimal(Double.toString((min + (max - min) * i)));
bigDecimal = bigDecimal.setScale(2, 4);
return bigDecimal.floatValue();
}
}
return value;
}
@Override
public void drawPanel(int mouseX, int mouseY, Panel panel) {
RenderUtils.drawBorderedRect((float) panel.getX(), (float) panel.getY() - 3, (float) panel.getX() + panel.getWidth(), (float) panel.getY() + 17, 3, new Color(217, 217, 217).getRGB(), new Color(217, 217, 217).getRGB());
if (panel.getFade() > 0) {
RenderUtils.drawBorderedRect((float) panel.getX(), (float) panel.getY() + 17, (float) panel.getX() + panel.getWidth(), panel.getY() + 19 + panel.getFade(), 3, new Color(217, 217, 217).getRGB(), new Color(217, 217, 217).getRGB());
RenderUtils.drawBorderedRect((float) panel.getX(), panel.getY() + 17 + panel.getFade(), (float) panel.getX() + panel.getWidth(), panel.getY() + 19 + panel.getFade() + 5, 3, new Color(217, 217, 217).getRGB(), new Color(217, 217, 217).getRGB());
}
GlStateManager.resetColor();
float textWidth = Fonts.font35.getStringWidth("§f" + StringUtils.stripControlCodes(panel.getName()));
Fonts.font35.drawString(panel.getName(), (int) (panel.getX() - (textWidth - 100.0F) / 2F), panel.getY() + 7 - 3, Color.BLACK.getRGB());
}
@Override
public void drawDescription(int mouseX, int mouseY, String text) {
int textWidth = Fonts.font35.getStringWidth(text);
RenderUtils.drawBorderedRect(mouseX + 9, mouseY, mouseX + textWidth + 14, mouseY + Fonts.font35.FONT_HEIGHT + 3, 3F, new Color(217, 217, 217).getRGB(), new Color(217, 217, 217).getRGB());
GlStateManager.resetColor();
Fonts.font35.drawString(text, mouseX + 12, mouseY + (Fonts.font35.FONT_HEIGHT / 2), Color.BLACK.getRGB());
}
@Override
public void drawButtonElement(int mouseX, int mouseY, ButtonElement buttonElement) {
Gui.drawRect(buttonElement.getX() - 1, buttonElement.getY() - 1, buttonElement.getX() + buttonElement.getWidth() + 1, buttonElement.getY() + buttonElement.getHeight() + 1, hoverColor(buttonElement.getColor() != Integer.MAX_VALUE ? new Color(14, 159, 255) : new Color(255, 255, 255), buttonElement.hoverTime).getRGB());
GlStateManager.resetColor();
Fonts.font35.drawString(buttonElement.getDisplayName(), buttonElement.getX() + 5, buttonElement.getY() + 7, Color.BLACK.getRGB());
}
@Override
public void drawModuleElement(int mouseX, int mouseY, ModuleElement moduleElement) {
Gui.drawRect(moduleElement.getX() - 1, moduleElement.getY() - 1, moduleElement.getX() + moduleElement.getWidth() + 1, moduleElement.getY() + moduleElement.getHeight() + 1, hoverColor(new Color(255,255,255), moduleElement.hoverTime).getRGB());
Gui.drawRect(moduleElement.getX() - 1, moduleElement.getY() - 1, moduleElement.getX() + moduleElement.getWidth() + 1, moduleElement.getY() + moduleElement.getHeight() + 1, hoverColor(new Color(14,159,255, moduleElement.slowlyFade), moduleElement.hoverTime).getRGB());
GlStateManager.resetColor();
Fonts.font35.drawString(moduleElement.getDisplayName(), moduleElement.getX() + 5, moduleElement.getY() + 7, Color.BLACK.getRGB());
// Draw settings
final List<Value<?>> moduleValues = moduleElement.getModule().getValues();
if (!moduleValues.isEmpty()) {
Fonts.font35.drawString("-", moduleElement.getX() + moduleElement.getWidth() - 8, moduleElement.getY() + 5, Color.BLACK.getRGB());
if (moduleElement.isShowSettings()) {
if (moduleElement.getSettingsWidth() > 0F && moduleElement.slowlySettingsYPos > moduleElement.getY() + 6)
RenderUtils.drawBorderedRect(moduleElement.getX() + moduleElement.getWidth() + 4, moduleElement.getY() + 6, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), moduleElement.slowlySettingsYPos + 2, 3F, Color.white.getRGB(), Color.white.getRGB());
moduleElement.slowlySettingsYPos = moduleElement.getY() + 6;
for (final Value value : moduleValues) {
if(!((boolean)value.getCanDisplay().invoke()))
continue;
if (value instanceof BoolValue) {
final String text = value.getName();
final float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
if (mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos && mouseY <= moduleElement.slowlySettingsYPos + 12 && Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
final BoolValue boolValue = (BoolValue) value;
boolValue.set(!boolValue.get());
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, ((BoolValue) value).get() ? Color.BLACK.getRGB() : new Color(120, 120, 120).getRGB());
moduleElement.slowlySettingsYPos += 11;
} else if (value instanceof ListValue) {
final ListValue listValue = (ListValue) value;
final String text = value.getName();
final float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 16)
moduleElement.setSettingsWidth(textWidth + 16);
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, 0xFF000000);
Fonts.font35.drawString(listValue.openList ? "-" : "+", (int) (moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() - (listValue.openList ? 5 : 6)), moduleElement.slowlySettingsYPos + 2, 0xFF000000);
if (mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos && mouseY <= moduleElement.slowlySettingsYPos + Fonts.font35.FONT_HEIGHT && Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
listValue.openList = !listValue.openList;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
moduleElement.slowlySettingsYPos += Fonts.font35.FONT_HEIGHT + 1;
for (final String valueOfList : listValue.getValues()) {
final float textWidth2 = Fonts.font35.getStringWidth("- " + valueOfList);
if (moduleElement.getSettingsWidth() < textWidth2 + 12)
moduleElement.setSettingsWidth(textWidth2 + 12);
if (listValue.openList) {
if (mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos + 2 && mouseY <= moduleElement.slowlySettingsYPos + 14 && Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
listValue.set(valueOfList);
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
GlStateManager.resetColor();
Fonts.font35.drawString("- " + valueOfList, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, listValue.get() != null && listValue.get().equalsIgnoreCase(valueOfList) ? Color.BLACK.getRGB() : new Color(120, 120, 120).getRGB());
moduleElement.slowlySettingsYPos += Fonts.font35.FONT_HEIGHT + 1;
}
}
if (!listValue.openList) {
moduleElement.slowlySettingsYPos += 1;
}
} else if (value instanceof FloatValue) {
final FloatValue floatValue = (FloatValue) value;
final String text = value.getName() + ": " + round(floatValue.get()) + floatValue.getSuffix();
final float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
final float valueOfSlide = drawSlider(floatValue.get(), floatValue.getMinimum(), floatValue.getMaximum(), false, moduleElement.getX() + moduleElement.getWidth() + 8, moduleElement.slowlySettingsYPos + 14, (int) moduleElement.getSettingsWidth() - 12, mouseX, mouseY, new Color(7, 152, 252));
if (valueOfSlide != floatValue.get())
floatValue.set(valueOfSlide);
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 3, 0xFF000000);
moduleElement.slowlySettingsYPos += 19;
} else if (value instanceof IntegerValue) {
final IntegerValue integerValue = (IntegerValue) value;
final String text = value.getName() + ": " + (value instanceof BlockValue ? BlockUtils.getBlockName(integerValue.get()) + " (" + integerValue.get() + ")" : (integerValue.get() + integerValue.getSuffix()));
final float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
final float valueOfSlide = drawSlider(integerValue.get(), integerValue.getMinimum(), integerValue.getMaximum(), true, moduleElement.getX() + moduleElement.getWidth() + 8, moduleElement.slowlySettingsYPos + 14, (int) moduleElement.getSettingsWidth() - 12, mouseX, mouseY, new Color(7, 152, 252));
if (valueOfSlide != integerValue.get())
integerValue.set((int) valueOfSlide);
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 3, 0xFF000000);
moduleElement.slowlySettingsYPos += 19;
} else if (value instanceof FontValue) {
final FontValue fontValue = (FontValue) value;
final FontRenderer fontRenderer = fontValue.get();
String displayString = "Font: Unknown";
if (fontRenderer instanceof GameFontRenderer) {
final GameFontRenderer liquidFontRenderer = (GameFontRenderer) fontRenderer;
displayString = "Font: " + liquidFontRenderer.getDefaultFont().getFont().getName() + " - " + liquidFontRenderer.getDefaultFont().getFont().getSize();
} else if (fontRenderer == Fonts.minecraftFont)
displayString = "Font: Minecraft";
else {
final Object[] objects = Fonts.getFontDetails(fontRenderer);
if (objects != null) {
displayString = objects[0] + ((int) objects[1] != -1 ? " - " + objects[1] : "");
}
}
Fonts.font35.drawString(displayString, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, Color.BLACK.getRGB());
int stringWidth = Fonts.font35.getStringWidth(displayString);
if (moduleElement.getSettingsWidth() < stringWidth + 8)
moduleElement.setSettingsWidth(stringWidth + 8);
if ((Mouse.isButtonDown(0) && !mouseDown || Mouse.isButtonDown(1) && !rightMouseDown) && mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos && mouseY <= moduleElement.slowlySettingsYPos + 12) {
final List<FontRenderer> fonts = Fonts.getFonts();
if (Mouse.isButtonDown(0)) {
for (int i = 0; i < fonts.size(); i++) {
final FontRenderer font = fonts.get(i);
if (font == fontRenderer) {
i++;
if (i >= fonts.size())
i = 0;
fontValue.set(fonts.get(i));
break;
}
}
} else {
for (int i = fonts.size() - 1; i >= 0; i--) {
final FontRenderer font = fonts.get(i);
if (font == fontRenderer) {
i--;
if (i >= fonts.size())
i = 0;
if (i < 0)
i = fonts.size() - 1;
fontValue.set(fonts.get(i));
break;
}
}
}
}
moduleElement.slowlySettingsYPos += 11;
} else {
final String text = value.getName() + ": " + value.get();
final float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
GlStateManager.resetColor();
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 4, 0xFF000000);
moduleElement.slowlySettingsYPos += 12;
}
}
moduleElement.updatePressed();
mouseDown = Mouse.isButtonDown(0);
rightMouseDown = Mouse.isButtonDown(1);
}
}
}
private BigDecimal round(final float v) {
BigDecimal bigDecimal = new BigDecimal(Float.toString(v));
bigDecimal = bigDecimal.setScale(2, 4);
return bigDecimal;
}
private Color hoverColor(final Color color, final int hover) {
final int r = color.getRed() - (hover * 2);
final int g = color.getGreen() - (hover * 2);
final int b = color.getBlue() - (hover * 2);
return new Color(Math.max(r, 0), Math.max(g, 0), Math.max(b, 0), color.getAlpha());
}
}
| 18,561 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
NullStyle.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/NullStyle.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui.style.styles;
import net.ccbluex.liquidbounce.features.module.modules.render.ClickGUI;
import net.ccbluex.liquidbounce.ui.client.clickgui.Panel;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ButtonElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ModuleElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.Style;
import net.ccbluex.liquidbounce.ui.font.AWTFontRenderer;
import net.ccbluex.liquidbounce.ui.font.Fonts;
import net.ccbluex.liquidbounce.ui.font.GameFontRenderer;
import net.ccbluex.liquidbounce.utils.block.BlockUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.value.*;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.math.BigDecimal;
import java.util.List;
public class NullStyle extends Style {
private boolean mouseDown;
private boolean rightMouseDown;
private Color modifyAlpha(Color col, int alpha) {
return new Color(col.getRed(), col.getGreen(), col.getBlue(), alpha);
}
@Override
public void drawPanel(int mouseX, int mouseY, Panel panel) {
RenderUtils.drawGradientSideways((float) panel.getX() - 3, (float) panel.getY(), (float) panel.getX() + panel.getWidth() + 3, (float) panel.getY() + 19, modifyAlpha(ClickGUI.generateColor(), 120).getRGB(), modifyAlpha(ClickGUI.generateColor().darker().darker(), 120).getRGB());
GlStateManager.resetColor();
if(panel.getFade() > 0)
RenderUtils.drawRect((float) panel.getX(), (float) panel.getY() + 19, (float) panel.getX() + panel.getWidth(), panel.getY() + 19 + panel.getFade(), Integer.MIN_VALUE);
GlStateManager.resetColor();
float textWidth = Fonts.font35.getStringWidth("§f" + StringUtils.stripControlCodes(panel.getName()));
Fonts.font35.drawString("§f" + panel.getName(), (int) (panel.getX() - (textWidth - 100.0F) / 2F), panel.getY() + 7, Integer.MAX_VALUE);
}
@Override
public void drawDescription(int mouseX, int mouseY, String text) {
int textWidth = Fonts.font35.getStringWidth(text);
RenderUtils.drawRect(mouseX + 9, mouseY, mouseX + textWidth + 14, mouseY + Fonts.font35.FONT_HEIGHT + 3, modifyAlpha(ClickGUI.generateColor(), 120).getRGB());
GlStateManager.resetColor();
Fonts.font35.drawString(text, mouseX + 12, mouseY + (Fonts.font35.FONT_HEIGHT / 2), Integer.MAX_VALUE);
}
@Override
public void drawButtonElement(int mouseX, int mouseY, ButtonElement buttonElement) {
GlStateManager.resetColor();
Fonts.font35.drawString(buttonElement.getDisplayName(), (int) (buttonElement.getX() + 5), buttonElement.getY() + 7, buttonElement.getColor());
}
@Override
public void drawModuleElement(int mouseX, int mouseY, ModuleElement moduleElement) {
final int guiColor = ClickGUI.generateColor().getRGB();
GlStateManager.resetColor();
Fonts.font35.drawString(moduleElement.getDisplayName(), (int) (moduleElement.getX() + 5), moduleElement.getY() + 7, moduleElement.getModule().getState() ? guiColor : Integer.MAX_VALUE);
final List<Value<?>> moduleValues = moduleElement.getModule().getValues();
if(!moduleValues.isEmpty()) {
Fonts.font35.drawString("+", moduleElement.getX() + moduleElement.getWidth() - 10, moduleElement.getY() + (moduleElement.getHeight() / 2), Color.WHITE.getRGB());
if(moduleElement.isShowSettings()) {
int yPos = moduleElement.getY() + 4;
for(final Value value : moduleValues) {
if (!((boolean)value.getCanDisplay().invoke()))
continue;
boolean isNumber = value.get() instanceof Number;
if (isNumber) {
AWTFontRenderer.Companion.setAssumeNonVolatile(false);
}
if (value instanceof BoolValue) {
String text = value.getName();
float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 14, Integer.MIN_VALUE);
if (mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= yPos + 2 && mouseY <= yPos + 14) {
if (Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
final BoolValue boolValue = (BoolValue) value;
boolValue.set(!boolValue.get());
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
}
GlStateManager.resetColor();
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, ((BoolValue) value).get() ? guiColor : Integer.MAX_VALUE);
yPos += 12;
}else if(value instanceof ListValue) {
ListValue listValue = (ListValue) value;
String text = value.getName();
float textWidth = Fonts.font35.getStringWidth(text);
if(moduleElement.getSettingsWidth() < textWidth + 16)
moduleElement.setSettingsWidth(textWidth + 16);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 14, Integer.MIN_VALUE);
GlStateManager.resetColor();
Fonts.font35.drawString("§c" + text, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, 0xffffff);
Fonts.font35.drawString(listValue.openList ? "-" : "+", (int) (moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() - (listValue.openList ? 5 : 6)), yPos + 4, 0xffffff);
if(mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= yPos + 2 && mouseY <= yPos + 14) {
if(Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
listValue.openList = !listValue.openList;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
}
yPos += 12;
for(final String valueOfList : listValue.getValues()) {
final float textWidth2 = Fonts.font35.getStringWidth(">" + valueOfList);
if(moduleElement.getSettingsWidth() < textWidth2 + 12)
moduleElement.setSettingsWidth(textWidth2 + 12);
if (listValue.openList) {
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 14, Integer.MIN_VALUE);
if(mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= yPos + 2 && mouseY <= yPos + 14) {
if(Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
listValue.set(valueOfList);
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
}
GlStateManager.resetColor();
Fonts.font35.drawString(">", moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, Integer.MAX_VALUE);
Fonts.font35.drawString(valueOfList, moduleElement.getX() + moduleElement.getWidth() + 14, yPos + 4, listValue.get() != null && listValue.get().equalsIgnoreCase(valueOfList) ? guiColor : Integer.MAX_VALUE);
yPos += 12;
}
}
}else if(value instanceof FloatValue) {
FloatValue floatValue = (FloatValue) value;
String text = value.getName() + "§f: §c" + round(floatValue.get()) + floatValue.getSuffix();
float textWidth = Fonts.font35.getStringWidth(text);
if(moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 24, Integer.MIN_VALUE);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 8, yPos + 18, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() - 4, yPos + 19, Integer.MAX_VALUE);
float sliderValue = moduleElement.getX() + moduleElement.getWidth() + ((moduleElement.getSettingsWidth() - 12) * (floatValue.get() - floatValue.getMinimum()) / (floatValue.getMaximum() - floatValue.getMinimum()));
RenderUtils.drawRect(8 + sliderValue, yPos + 15, sliderValue + 11, yPos + 21, guiColor);
if(mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() - 4 && mouseY >= yPos + 15 && mouseY <= yPos + 21) {
int dWheel = Mouse.getDWheel();
if (Mouse.hasWheel() && dWheel != 0) {
if (dWheel > 0)
floatValue.set(Math.min(floatValue.get() + 0.01F, floatValue.getMaximum()));
if (dWheel < 0)
floatValue.set(Math.max(floatValue.get() - 0.01F, floatValue.getMinimum()));
}
if(Mouse.isButtonDown(0)) {
double i = MathHelper.clamp_double((mouseX - moduleElement.getX() - moduleElement.getWidth() - 8) / (moduleElement.getSettingsWidth() - 12), 0, 1);
floatValue.set(round((float) (floatValue.getMinimum() + (floatValue.getMaximum() - floatValue.getMinimum()) * i)).floatValue());
}
}
GlStateManager.resetColor();
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, 0xffffff);
yPos += 22;
}else if(value instanceof IntegerValue) {
IntegerValue integerValue = (IntegerValue) value;
String text = value.getName() + "§f: §c" + (value instanceof BlockValue ? BlockUtils.getBlockName(integerValue.get()) + " (" + integerValue.get() + ")" : (integerValue.get() + integerValue.getSuffix()));
float textWidth = Fonts.font35.getStringWidth(text);
if(moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 24, Integer.MIN_VALUE);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 8, yPos + 18, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() - 4, yPos + 19, Integer.MAX_VALUE);
float sliderValue = moduleElement.getX() + moduleElement.getWidth() + ((moduleElement.getSettingsWidth() - 12) * (integerValue.get() - integerValue.getMinimum()) / (integerValue.getMaximum() - integerValue.getMinimum()));
RenderUtils.drawRect(8 + sliderValue, yPos + 15, sliderValue + 11, yPos + 21, guiColor);
if(mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= yPos + 15 && mouseY <= yPos + 21) {
int dWheel = Mouse.getDWheel();
if (Mouse.hasWheel() && dWheel != 0) {
if (dWheel > 0)
integerValue.set(Math.min(integerValue.get() + 1, integerValue.getMaximum()));
if (dWheel < 0)
integerValue.set(Math.max(integerValue.get() - 1, integerValue.getMinimum()));
}
if(Mouse.isButtonDown(0)) {
double i = MathHelper.clamp_double((mouseX - moduleElement.getX() - moduleElement.getWidth() - 8) / (moduleElement.getSettingsWidth() - 12), 0, 1);
integerValue.set((int) (integerValue.getMinimum() + (integerValue.getMaximum() - integerValue.getMinimum()) * i));
}
}
GlStateManager.resetColor();
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, 0xffffff);
yPos += 22;
}else if(value instanceof FontValue) {
final FontValue fontValue = (FontValue) value;
final FontRenderer fontRenderer = fontValue.get();
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 14, Integer.MIN_VALUE);
String displayString = "Font: Unknown";
if (fontRenderer instanceof GameFontRenderer) {
final GameFontRenderer liquidFontRenderer = (GameFontRenderer) fontRenderer;
displayString = "Font: " + liquidFontRenderer.getDefaultFont().getFont().getName() + " - " + liquidFontRenderer.getDefaultFont().getFont().getSize();
}else if(fontRenderer == Fonts.minecraftFont)
displayString = "Font: Minecraft";
else{
final Object[] objects = Fonts.getFontDetails(fontRenderer);
if(objects != null) {
displayString = objects[0] + ((int) objects[1] != -1 ? " - " + objects[1] : "");
}
}
Fonts.font35.drawString(displayString, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, Color.WHITE.getRGB());
int stringWidth = Fonts.font35.getStringWidth(displayString);
if(moduleElement.getSettingsWidth() < stringWidth + 8)
moduleElement.setSettingsWidth(stringWidth + 8);
if((Mouse.isButtonDown(0) && !mouseDown || Mouse.isButtonDown(1) && !rightMouseDown) && mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= yPos + 4 && mouseY <= yPos + 12) {
final List<FontRenderer> fonts = Fonts.getFonts();
if(Mouse.isButtonDown(0)) {
for(int i = 0; i < fonts.size(); i++) {
final FontRenderer font = fonts.get(i);
if(font == fontRenderer) {
i++;
if(i >= fonts.size())
i = 0;
fontValue.set(fonts.get(i));
break;
}
}
}else{
for(int i = fonts.size() - 1; i >= 0; i--) {
final FontRenderer font = fonts.get(i);
if(font == fontRenderer) {
i--;
if(i >= fonts.size())
i = 0;
if(i < 0)
i = fonts.size() - 1;
fontValue.set(fonts.get(i));
break;
}
}
}
}
yPos += 11;
}else{
String text = value.getName() + "§f: §c" + value.get();
float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
RenderUtils.drawRect(moduleElement.getX() + moduleElement.getWidth() + 4, yPos + 2, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 14, Integer.MIN_VALUE);
GlStateManager.resetColor();
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, yPos + 4, 0xffffff);
yPos += 12;
}
if (isNumber) {
// This state is cleaned up in ClickGUI
AWTFontRenderer.Companion.setAssumeNonVolatile(true);
}
}
moduleElement.updatePressed();
mouseDown = Mouse.isButtonDown(0);
rightMouseDown = Mouse.isButtonDown(1);
if(moduleElement.getSettingsWidth() > 0F && yPos > moduleElement.getY() + 4)
RenderUtils.drawBorderedRect(moduleElement.getX() + moduleElement.getWidth() + 4, moduleElement.getY() + 6, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), yPos + 2, 1F, Integer.MIN_VALUE, 0);
}
}
}
private BigDecimal round(final float f) {
BigDecimal bd = new BigDecimal(Float.toString(f));
bd = bd.setScale(2, 4);
return bd;
}
}
| 20,107 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
SlowlyStyle.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/SlowlyStyle.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui.style.styles;
import net.ccbluex.liquidbounce.ui.client.clickgui.Panel;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ButtonElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ModuleElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.Style;
import net.ccbluex.liquidbounce.ui.font.AWTFontRenderer;
import net.ccbluex.liquidbounce.ui.font.Fonts;
import net.ccbluex.liquidbounce.ui.font.GameFontRenderer;
import net.ccbluex.liquidbounce.utils.block.BlockUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.value.*;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.math.BigDecimal;
import java.util.List;
public class SlowlyStyle extends Style {
private boolean mouseDown;
private boolean rightMouseDown;
public static float drawSlider(final float value, final float min, final float max, final boolean inte, final int x, final int y, final int width, final int mouseX, final int mouseY, final Color color) {
final float displayValue = Math.max(min, Math.min(value, max));
final float sliderValue = (float) x + (float) width * (displayValue - min) / (max - min);
RenderUtils.drawRect(x, y, x + width, y + 2, Integer.MAX_VALUE);
RenderUtils.drawRect(x, y, sliderValue, y + 2, color);
RenderUtils.drawFilledCircle((int) sliderValue, y + 1, 3, color);
if (mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 3) {
int dWheel = Mouse.getDWheel();
if (Mouse.hasWheel() && dWheel != 0) {
if (dWheel > 0)
return Math.min(value + (inte ? 1F : 0.01F), max);
if (dWheel < 0)
return Math.max(value - (inte ? 1F : 0.01F), min);
}
if (Mouse.isButtonDown(0)) {
double i = MathHelper.clamp_double(((double) mouseX - (double) x) / ((double) width - 3), 0, 1);
BigDecimal bigDecimal = new BigDecimal(Double.toString((min + (max - min) * i)));
bigDecimal = bigDecimal.setScale(2, 4);
return bigDecimal.floatValue();
}
}
return value;
}
@Override
public void drawPanel(int mouseX, int mouseY, Panel panel) {
RenderUtils.drawBorderedRect((float) panel.getX(), (float) panel.getY() - 3, (float) panel.getX() + panel.getWidth(), (float) panel.getY() + 17, 3, new Color(0, 0, 0).getRGB(), new Color(0, 0, 0).getRGB());
if (panel.getFade() > 0) {
RenderUtils.drawBorderedRect((float) panel.getX(), (float) panel.getY() + 17, (float) panel.getX() + panel.getWidth(), panel.getY() + 19 + panel.getFade(), 3, new Color(0, 0, 0).getRGB(), new Color(0, 0, 0).getRGB());
RenderUtils.drawBorderedRect((float) panel.getX(), panel.getY() + 17 + panel.getFade(), (float) panel.getX() + panel.getWidth(), panel.getY() + 19 + panel.getFade() + 5, 3, new Color(0, 0, 0).getRGB(), new Color(0, 0, 0).getRGB());
}
GlStateManager.resetColor();
float textWidth = Fonts.font35.getStringWidth("§f" + StringUtils.stripControlCodes(panel.getName()));
Fonts.font35.drawString(panel.getName(), (int) (panel.getX() - (textWidth - 100.0F) / 2F), panel.getY() + 7 - 3, Color.WHITE.getRGB());
}
@Override
public void drawDescription(int mouseX, int mouseY, String text) {
int textWidth = Fonts.font35.getStringWidth(text);
RenderUtils.drawBorderedRect(mouseX + 9, mouseY, mouseX + textWidth + 14, mouseY + Fonts.font35.FONT_HEIGHT + 3, 3F, new Color(0, 0, 0).getRGB(), new Color(0, 0, 0).getRGB());
GlStateManager.resetColor();
Fonts.font35.drawString(text, mouseX + 12, mouseY + (Fonts.font35.FONT_HEIGHT / 2), Color.WHITE.getRGB());
}
@Override
public void drawButtonElement(int mouseX, int mouseY, ButtonElement buttonElement) {
Gui.drawRect(buttonElement.getX() - 1, buttonElement.getY() - 1, buttonElement.getX() + buttonElement.getWidth() + 1, buttonElement.getY() + buttonElement.getHeight() + 1, hoverColor(buttonElement.getColor() != Integer.MAX_VALUE ? new Color(10, 10, 10) : new Color(0, 0, 0), buttonElement.hoverTime).getRGB());
GlStateManager.resetColor();
Fonts.font35.drawString(buttonElement.getDisplayName(), buttonElement.getX() + 5, buttonElement.getY() + 7, Color.WHITE.getRGB());
}
@Override
public void drawModuleElement(int mouseX, int mouseY, ModuleElement moduleElement) {
Gui.drawRect(moduleElement.getX() - 1, moduleElement.getY() - 1, moduleElement.getX() + moduleElement.getWidth() + 1, moduleElement.getY() + moduleElement.getHeight() + 1, hoverColor(new Color(40, 40, 40), moduleElement.hoverTime).getRGB());
Gui.drawRect(moduleElement.getX() - 1, moduleElement.getY() - 1, moduleElement.getX() + moduleElement.getWidth() + 1, moduleElement.getY() + moduleElement.getHeight() + 1, hoverColor(new Color(0, 0, 0, moduleElement.slowlyFade), moduleElement.hoverTime).getRGB());
GlStateManager.resetColor();
Fonts.font35.drawString(moduleElement.getDisplayName(), moduleElement.getX() + 5, moduleElement.getY() + 7, Color.WHITE.getRGB());
// Draw settings
final List<Value<?>> moduleValues = moduleElement.getModule().getValues();
if (!moduleValues.isEmpty()) {
Fonts.font35.drawString(">", moduleElement.getX() + moduleElement.getWidth() - 8, moduleElement.getY() + 5, Color.WHITE.getRGB());
if (moduleElement.isShowSettings()) {
if (moduleElement.getSettingsWidth() > 0F && moduleElement.slowlySettingsYPos > moduleElement.getY() + 6)
RenderUtils.drawBorderedRect(moduleElement.getX() + moduleElement.getWidth() + 4, moduleElement.getY() + 6, moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth(), moduleElement.slowlySettingsYPos + 2, 3F, new Color(0, 0, 0).getRGB(), new Color(0, 0, 0).getRGB());
moduleElement.slowlySettingsYPos = moduleElement.getY() + 6;
for (final Value value : moduleValues) {
if (!((boolean)value.getCanDisplay().invoke()))
continue;
boolean isNumber = value.get() instanceof Number;
if (isNumber) {
AWTFontRenderer.Companion.setAssumeNonVolatile(false);
}
if (value instanceof BoolValue) {
final String text = value.getName();
final float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
if (mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos && mouseY <= moduleElement.slowlySettingsYPos + 12 && Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
final BoolValue boolValue = (BoolValue) value;
boolValue.set(!boolValue.get());
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, ((BoolValue) value).get() ? Color.WHITE.getRGB() : Integer.MAX_VALUE);
moduleElement.slowlySettingsYPos += 11;
} else if (value instanceof ListValue) {
final ListValue listValue = (ListValue) value;
final String text = value.getName();
final float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 16)
moduleElement.setSettingsWidth(textWidth + 16);
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, 0xffffff);
Fonts.font35.drawString(listValue.openList ? "-" : "+", (int) (moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() - (listValue.openList ? 5 : 6)), moduleElement.slowlySettingsYPos + 2, 0xffffff);
if (mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos && mouseY <= moduleElement.slowlySettingsYPos + Fonts.font35.FONT_HEIGHT && Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
listValue.openList = !listValue.openList;
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
moduleElement.slowlySettingsYPos += Fonts.font35.FONT_HEIGHT + 1;
for (final String valueOfList : listValue.getValues()) {
final float textWidth2 = Fonts.font35.getStringWidth("> " + valueOfList);
if (moduleElement.getSettingsWidth() < textWidth2 + 12)
moduleElement.setSettingsWidth(textWidth2 + 12);
if (listValue.openList) {
if (mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos + 2 && mouseY <= moduleElement.slowlySettingsYPos + 14 && Mouse.isButtonDown(0) && moduleElement.isntPressed()) {
listValue.set(valueOfList);
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
GlStateManager.resetColor();
Fonts.font35.drawString("> " + valueOfList, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, listValue.get() != null && listValue.get().equalsIgnoreCase(valueOfList) ? Color.WHITE.getRGB() : Integer.MAX_VALUE);
moduleElement.slowlySettingsYPos += Fonts.font35.FONT_HEIGHT + 1;
}
}
if (!listValue.openList) {
moduleElement.slowlySettingsYPos += 1;
}
} else if (value instanceof FloatValue) {
final FloatValue floatValue = (FloatValue) value;
final String text = value.getName() + "§f: " + round(floatValue.get()) + floatValue.getSuffix();
final float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
final float valueOfSlide = drawSlider(floatValue.get(), floatValue.getMinimum(), floatValue.getMaximum(), false, moduleElement.getX() + moduleElement.getWidth() + 8, moduleElement.slowlySettingsYPos + 14, (int) moduleElement.getSettingsWidth() - 12, mouseX, mouseY, new Color(120, 120, 120));
if (valueOfSlide != floatValue.get())
floatValue.set(valueOfSlide);
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 3, 0xffffff);
moduleElement.slowlySettingsYPos += 19;
} else if (value instanceof IntegerValue) {
final IntegerValue integerValue = (IntegerValue) value;
final String text = value.getName() + "§f: " + (value instanceof BlockValue ? BlockUtils.getBlockName(integerValue.get()) + " (" + integerValue.get() + ")" : (integerValue.get() + integerValue.getSuffix()));
final float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
final float valueOfSlide = drawSlider(integerValue.get(), integerValue.getMinimum(), integerValue.getMaximum(), true, moduleElement.getX() + moduleElement.getWidth() + 8, moduleElement.slowlySettingsYPos + 14, (int) moduleElement.getSettingsWidth() - 12, mouseX, mouseY, new Color(120, 120, 120));
if (valueOfSlide != integerValue.get())
integerValue.set((int) valueOfSlide);
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 3, 0xffffff);
moduleElement.slowlySettingsYPos += 19;
} else if (value instanceof FontValue) {
final FontValue fontValue = (FontValue) value;
final FontRenderer fontRenderer = fontValue.get();
String displayString = "Font: Unknown";
if (fontRenderer instanceof GameFontRenderer) {
final GameFontRenderer liquidFontRenderer = (GameFontRenderer) fontRenderer;
displayString = "Font: " + liquidFontRenderer.getDefaultFont().getFont().getName() + " - " + liquidFontRenderer.getDefaultFont().getFont().getSize();
} else if (fontRenderer == Fonts.minecraftFont)
displayString = "Font: Minecraft";
else {
final Object[] objects = Fonts.getFontDetails(fontRenderer);
if (objects != null) {
displayString = objects[0] + ((int) objects[1] != -1 ? " - " + objects[1] : "");
}
}
Fonts.font35.drawString(displayString, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 2, Color.WHITE.getRGB());
int stringWidth = Fonts.font35.getStringWidth(displayString);
if (moduleElement.getSettingsWidth() < stringWidth + 8)
moduleElement.setSettingsWidth(stringWidth + 8);
if ((Mouse.isButtonDown(0) && !mouseDown || Mouse.isButtonDown(1) && !rightMouseDown) && mouseX >= moduleElement.getX() + moduleElement.getWidth() + 4 && mouseX <= moduleElement.getX() + moduleElement.getWidth() + moduleElement.getSettingsWidth() && mouseY >= moduleElement.slowlySettingsYPos && mouseY <= moduleElement.slowlySettingsYPos + 12) {
final List<FontRenderer> fonts = Fonts.getFonts();
if (Mouse.isButtonDown(0)) {
for (int i = 0; i < fonts.size(); i++) {
final FontRenderer font = fonts.get(i);
if (font == fontRenderer) {
i++;
if (i >= fonts.size())
i = 0;
fontValue.set(fonts.get(i));
break;
}
}
} else {
for (int i = fonts.size() - 1; i >= 0; i--) {
final FontRenderer font = fonts.get(i);
if (font == fontRenderer) {
i--;
if (i >= fonts.size())
i = 0;
if (i < 0)
i = fonts.size() - 1;
fontValue.set(fonts.get(i));
break;
}
}
}
}
moduleElement.slowlySettingsYPos += 11;
} else {
final String text = value.getName() + "§f: " + value.get();
final float textWidth = Fonts.font35.getStringWidth(text);
if (moduleElement.getSettingsWidth() < textWidth + 8)
moduleElement.setSettingsWidth(textWidth + 8);
GlStateManager.resetColor();
Fonts.font35.drawString(text, moduleElement.getX() + moduleElement.getWidth() + 6, moduleElement.slowlySettingsYPos + 4, 0xffffff);
moduleElement.slowlySettingsYPos += 12;
}
if (isNumber) {
AWTFontRenderer.Companion.setAssumeNonVolatile(true);
}
}
moduleElement.updatePressed();
mouseDown = Mouse.isButtonDown(0);
rightMouseDown = Mouse.isButtonDown(1);
}
}
}
private BigDecimal round(final float v) {
BigDecimal bigDecimal = new BigDecimal(Float.toString(v));
bigDecimal = bigDecimal.setScale(2, 4);
return bigDecimal;
}
private Color hoverColor(final Color color, final int hover) {
final int r = color.getRed() - (hover * 2);
final int g = color.getGreen() - (hover * 2);
final int b = color.getBlue() - (hover * 2);
return new Color(Math.max(r, 0), Math.max(g, 0), Math.max(b, 0), color.getAlpha());
}
}
| 18,878 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
NewUi.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/newVer/NewUi.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.ui.client.clickgui.newVer;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.modules.render.NewGUI;
import net.ccbluex.liquidbounce.ui.client.clickgui.newVer.element.CategoryElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.newVer.element.SearchElement;
import net.ccbluex.liquidbounce.ui.client.clickgui.newVer.element.module.ModuleElement;
import net.ccbluex.liquidbounce.ui.font.Fonts;
import net.ccbluex.liquidbounce.utils.MouseUtils;
import net.ccbluex.liquidbounce.utils.AnimationUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.utils.render.Stencil;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static org.lwjgl.opengl.GL11.*;
public class NewUi extends GuiScreen {
private static NewUi instance;
public static final NewUi getInstance() {
return instance == null ? instance = new NewUi() : instance;
}
public static void resetInstance() {
instance = new NewUi();
}
private NewUi() {
for (ModuleCategory c : ModuleCategory.values())
categoryElements.add(new CategoryElement(c));
categoryElements.get(0).setFocused(true);
}
public final List<CategoryElement> categoryElements = new ArrayList<>();
private float startYAnim = height / 2F;
private float endYAnim = height / 2F;
private SearchElement searchElement;
private float fading = 0F;
public void initGui() {
Keyboard.enableRepeatEvents(true);
for (CategoryElement ce : categoryElements) {
for (ModuleElement me : ce.getModuleElements()) {
if (me.listeningKeybind())
me.resetState();
}
}
searchElement = new SearchElement(40F, 115F, 180F, 20F);
super.initGui();
}
public void onGuiClosed() {
for (CategoryElement ce : categoryElements) {
if (ce.getFocused())
ce.handleMouseRelease(-1, -1, 0, 0, 0, 0, 0);
}
Keyboard.enableRepeatEvents(false);
}
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
// will draw reduced ver once it gets under 1140x780.
drawFullSized(mouseX, mouseY, partialTicks, NewGUI.getAccentColor());
}
private void drawFullSized(int mouseX, int mouseY, float partialTicks, Color accentColor) {
RenderUtils.originalRoundedRect(30F, 30F, this.width - 30F, this.height - 30F, 8F, 0xFF101010);
// something to make it look more like windoze
if (MouseUtils.mouseWithinBounds(mouseX, mouseY, this.width - 54F, 30F, this.width - 30F, 50F))
fading += 0.2F * RenderUtils.deltaTime * 0.045F;
else
fading -= 0.2F * RenderUtils.deltaTime * 0.045F;
fading = MathHelper.clamp_float(fading, 0F, 1F);
RenderUtils.customRounded(this.width - 54F, 30F, this.width - 30F, 50F, 0F, 8F, 0F, 8F, new Color(1F, 0F, 0F, fading).getRGB());
GlStateManager.disableAlpha();
RenderUtils.drawImage(IconManager.removeIcon, this.width - 47, 35, 10, 10);
GlStateManager.enableAlpha();
Stencil.write(true);
RenderUtils.drawFilledCircle(65F, 80F, 25F, new Color(45, 45, 45));
Stencil.erase(true);
if (mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()) != null) {
final ResourceLocation skin = mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()).getLocationSkin();
glPushMatrix();
glTranslatef(40F, 55F, 0F);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glDepthMask(false);
OpenGlHelper.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
glColor4f(1f, 1f, 1f, 1f);
mc.getTextureManager().bindTexture(skin);
Gui.drawScaledCustomSizeModalRect(0, 0, 8F, 8F, 8, 8, 50, 50,
64F, 64F);
glDepthMask(true);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glPopMatrix();
}
Stencil.dispose();
if (Fonts.fontLarge.getStringWidth(mc.thePlayer.getGameProfile().getName()) > 70)
Fonts.fontLarge.drawString(Fonts.fontLarge.trimStringToWidth(mc.thePlayer.getGameProfile().getName(), 50) + "...", 100, 78 - Fonts.fontLarge.FONT_HEIGHT + 15, -1);
else
Fonts.fontLarge.drawString(mc.thePlayer.getGameProfile().getName(), 100, 78 - Fonts.fontLarge.FONT_HEIGHT + 15, -1);
if (searchElement.drawBox(mouseX, mouseY, accentColor)) {
searchElement.drawPanel(mouseX, mouseY, 230, 50, width - 260, height - 80, Mouse.getDWheel(), categoryElements, accentColor);
return;
}
final float elementHeight = 24;
float startY = 140F;
for (CategoryElement ce : categoryElements) {
ce.drawLabel(mouseX, mouseY, 30F, startY, 200F, elementHeight);
if (ce.getFocused()) {
startYAnim = NewGUI.fastRenderValue.get() ? startY + 6F : AnimationUtils.animate(startY + 6F, startYAnim, (startYAnim - (startY + 5F) > 0 ? 0.65F : 0.55F) * RenderUtils.deltaTime * 0.025F);
endYAnim = NewGUI.fastRenderValue.get() ? startY + elementHeight - 6F : AnimationUtils.animate(startY + elementHeight - 6F, endYAnim, (endYAnim - (startY + elementHeight - 5F) < 0 ? 0.65F : 0.55F) * RenderUtils.deltaTime * 0.025F);
ce.drawPanel(mouseX, mouseY, 230, 50, width - 260, height - 80, Mouse.getDWheel(), accentColor);
}
startY += elementHeight;
}
RenderUtils.originalRoundedRect(32F, startYAnim, 34F, endYAnim, 1F, accentColor.getRGB());
super.drawScreen(mouseX, mouseY, partialTicks);
}
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
if (MouseUtils.mouseWithinBounds(mouseX, mouseY, this.width - 54F, 30F, this.width - 30F, 50F)) {
mc.displayGuiScreen(null);
return;
}
final float elementHeight = 24;
float startY = 140F;
searchElement.handleMouseClick(mouseX, mouseY, mouseButton, 230, 50, width - 260, height - 80, categoryElements);
if (!searchElement.isTyping()) for (CategoryElement ce : categoryElements) {
if (ce.getFocused())
ce.handleMouseClick(mouseX, mouseY, mouseButton, 230, 50, width - 260, height - 80);
if (MouseUtils.mouseWithinBounds(mouseX, mouseY, 30F, startY, 230F, startY + elementHeight) && !searchElement.isTyping()) {
categoryElements.forEach(e -> e.setFocused(false));
ce.setFocused(true);
return;
}
startY += elementHeight;
}
}
protected void keyTyped(char typedChar, int keyCode) throws IOException {
for (CategoryElement ce : categoryElements) {
if (ce.getFocused()) {
if (ce.handleKeyTyped(typedChar, keyCode))
return;
}
}
if (searchElement.handleTyping(typedChar, keyCode, 230, 50, width - 260, height - 80, categoryElements))
return;
super.keyTyped(typedChar, keyCode);
}
protected void mouseReleased(int mouseX, int mouseY, int state) {
searchElement.handleMouseRelease(mouseX, mouseY, state, 230, 50, width - 260, height - 80, categoryElements);
if (!searchElement.isTyping())
for (CategoryElement ce : categoryElements) {
if (ce.getFocused())
ce.handleMouseRelease(mouseX, mouseY, state, 230, 50, width - 260, height - 80);
}
super.mouseReleased(mouseX, mouseY, state);
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}
| 8,545 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
FileManager.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/file/FileManager.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.file;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.file.configs.*;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.ccbluex.liquidbounce.utils.MinecraftInstance;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.util.ResourceLocation;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.lang.reflect.Field;
public class FileManager extends MinecraftInstance {
public File dir = new File(mc.mcDataDir, LiquidBounce.CLIENT_NAME);
public final File oldDir = new File(mc.mcDataDir, LiquidBounce.CLIENT_NAME + "-1.8");
public final File fontsDir = new File(dir, "fonts");
public final File settingsDir = new File(dir, "settings");
public final File soundsDir = new File(dir, "sounds");
public final File themesDir = new File(dir, "themes");
public final FileConfig modulesConfig = new ModulesConfig(new File(dir, "modules.json"));
public final FileConfig valuesConfig = new ValuesConfig(new File(dir, "values.json"));
public final FileConfig clickGuiConfig = new ClickGuiConfig(new File(dir, "clickgui.json"));
public final AccountsConfig accountsConfig = new AccountsConfig(new File(dir, "accounts.json"));
public final FriendsConfig friendsConfig = new FriendsConfig(new File(dir, "friends.json"));
public final FileConfig xrayConfig = new XRayConfig(new File(dir, "xray-blocks.json"));
public final FileConfig hudConfig = new HudConfig(new File(dir, "hud.json"));
public final FileConfig shortcutsConfig = new ShortcutsConfig(new File(dir, "shortcuts.json"));
public final File backgroundFile = new File(dir, "userbackground.png");
public static final Gson PRETTY_GSON = new GsonBuilder().setPrettyPrinting().create();
/**
* Constructor of file manager
* Setup everything important
*/
public FileManager() {
setupFolder();
loadBackground();
}
/**
* Setup folder
*/
public void setupFolder() {
if(!dir.exists()) {
if (oldDir.exists()) {
if (!oldDir.renameTo(dir))
dir = oldDir; // if renaming failed, continue to use the old folder.
} else
dir.mkdir();
}
if(!fontsDir.exists())
fontsDir.mkdir();
if(!settingsDir.exists())
settingsDir.mkdir();
if(!soundsDir.exists())
soundsDir.mkdir();
if(!themesDir.exists())
themesDir.mkdir();
}
/**
* Load all configs in file manager
*/
public void loadAllConfigs() {
for(final Field field : getClass().getDeclaredFields()) {
if(field.getType() == FileConfig.class) {
try {
if(!field.isAccessible())
field.setAccessible(true);
final FileConfig fileConfig = (FileConfig) field.get(this);
loadConfig(fileConfig);
}catch(final IllegalAccessException e) {
ClientUtils.getLogger().error("Failed to load config file of field " + field.getName() + ".", e);
}
}
}
}
/**
* Load a list of configs
*
* @param configs list
*/
public void loadConfigs(final FileConfig... configs) {
for(final FileConfig fileConfig : configs)
loadConfig(fileConfig);
}
/**
* Load one config
*
* @param config to load
*/
public void loadConfig(final FileConfig config) {
if(!config.hasConfig()) {
ClientUtils.getLogger().info("[FileManager] Skipped loading config: " + config.getFile().getName() + ".");
saveConfig(config, true);
return;
}
try {
config.loadConfig();
ClientUtils.getLogger().info("[FileManager] Loaded config: " + config.getFile().getName() + ".");
}catch(final Throwable t) {
ClientUtils.getLogger().error("[FileManager] Failed to load config file: " + config.getFile().getName() + ".", t);
}
}
/**
* Save all configs in file manager
*/
public void saveAllConfigs() {
for(final Field field : getClass().getDeclaredFields()) {
if(field.getType() == FileConfig.class) {
try {
if(!field.isAccessible())
field.setAccessible(true);
final FileConfig fileConfig = (FileConfig) field.get(this);
saveConfig(fileConfig);
}catch(final IllegalAccessException e) {
ClientUtils.getLogger().error("[FileManager] Failed to save config file of field " +
field.getName() + ".", e);
}
}
}
}
/**
* Save a list of configs
*
* @param configs list
*/
public void saveConfigs(final FileConfig... configs) {
for(final FileConfig fileConfig : configs)
saveConfig(fileConfig);
}
/**
* Save one config
*
* @param config to save
*/
public void saveConfig(final FileConfig config) {
saveConfig(config, false);
}
/**
* Save one config
*
* @param config to save
* @param ignoreStarting check starting
*/
private void saveConfig(final FileConfig config, final boolean ignoreStarting) {
if (!ignoreStarting && LiquidBounce.INSTANCE.isStarting())
return;
try {
if(!config.hasConfig())
config.createConfig();
config.saveConfig();
ClientUtils.getLogger().info("[FileManager] Saved config: " + config.getFile().getName() + ".");
}catch(final Throwable t) {
ClientUtils.getLogger().error("[FileManager] Failed to save config file: " +
config.getFile().getName() + ".", t);
}
}
/**
* Load background for background
*/
public void loadBackground() {
if(backgroundFile.exists()) {
try {
final BufferedImage bufferedImage = ImageIO.read(new FileInputStream(backgroundFile));
if(bufferedImage == null)
return;
LiquidBounce.INSTANCE.setBackground(new ResourceLocation(LiquidBounce.CLIENT_NAME.toLowerCase() + "/userbackground.png"));
mc.getTextureManager().loadTexture(LiquidBounce.INSTANCE.getBackground(), new DynamicTexture(bufferedImage));
ClientUtils.getLogger().info("[FileManager] Loaded background.");
} catch (final Exception e) {
ClientUtils.getLogger().error("[FileManager] Failed to load background.", e);
}
}
}
}
| 7,181 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
FileConfig.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/file/FileConfig.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.file;
import java.io.File;
import java.io.IOException;
public abstract class FileConfig {
private final File file;
/**
* Constructor of config
*
* @param file of config
*/
public FileConfig(final File file) {
this.file = file;
}
/**
* Load config from file
*
* @throws IOException
*/
protected abstract void loadConfig() throws IOException;
/**
* Save config to file
*
* @throws IOException
*/
protected abstract void saveConfig() throws IOException;
/**
* Create config
*
* @throws IOException
*/
public void createConfig() throws IOException {
file.createNewFile();
}
/**
* @return config file exist
*/
public boolean hasConfig() {
return file.exists();
}
/**
* @return file of config
*/
public File getFile() {
return file;
}
}
| 1,162 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ValuesConfig.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/file/configs/ValuesConfig.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.file.configs;
import com.google.gson.*;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.special.AntiForge;
import net.ccbluex.liquidbounce.features.special.AutoReconnect;
import net.ccbluex.liquidbounce.features.special.BungeeCordSpoof;
import net.ccbluex.liquidbounce.features.special.MacroManager;
import net.ccbluex.liquidbounce.file.FileConfig;
import net.ccbluex.liquidbounce.file.FileManager;
import net.ccbluex.liquidbounce.ui.client.GuiBackground;
import net.ccbluex.liquidbounce.ui.client.GuiMainMenu;
import net.ccbluex.liquidbounce.ui.client.altmanager.menus.altgenerator.GuiTheAltening;
import net.ccbluex.liquidbounce.utils.EntityUtils;
import net.ccbluex.liquidbounce.value.Value;
import java.io.*;
import java.util.Iterator;
import java.util.Map;
public class ValuesConfig extends FileConfig {
/**
* Constructor of config
*
* @param file of config
*/
public ValuesConfig(final File file) {
super(file);
}
/**
* Load config from file
*
* @throws IOException
*/
@Override
protected void loadConfig() throws IOException {
final JsonElement jsonElement = new JsonParser().parse(new BufferedReader(new FileReader(getFile())));
if(jsonElement instanceof JsonNull)
return;
final JsonObject jsonObject = (JsonObject) jsonElement;
final Iterator<Map.Entry<String, JsonElement>> iterator = jsonObject.entrySet().iterator();
while(iterator.hasNext()) {
final Map.Entry<String, JsonElement> entry = iterator.next();
if (entry.getKey().equalsIgnoreCase("CommandPrefix")) {
LiquidBounce.commandManager.setPrefix(entry.getValue().getAsCharacter());
} else if (entry.getKey().equalsIgnoreCase("ShowRichPresence")) {
LiquidBounce.clientRichPresence.setShowRichPresenceValue(entry.getValue().getAsBoolean());
} else if (entry.getKey().equalsIgnoreCase("targets")) {
JsonObject jsonValue = (JsonObject) entry.getValue();
if (jsonValue.has("TargetPlayer"))
EntityUtils.targetPlayer = jsonValue.get("TargetPlayer").getAsBoolean();
if (jsonValue.has("TargetMobs"))
EntityUtils.targetMobs = jsonValue.get("TargetMobs").getAsBoolean();
if (jsonValue.has("TargetAnimals"))
EntityUtils.targetAnimals = jsonValue.get("TargetAnimals").getAsBoolean();
if (jsonValue.has("TargetInvisible"))
EntityUtils.targetInvisible = jsonValue.get("TargetInvisible").getAsBoolean();
if (jsonValue.has("TargetDead"))
EntityUtils.targetDead = jsonValue.get("TargetDead").getAsBoolean();
} else if (entry.getKey().equalsIgnoreCase("macros")) {
JsonArray jsonValue = entry.getValue().getAsJsonArray();
for (final JsonElement macroElement : jsonValue) {
JsonObject macroObject = macroElement.getAsJsonObject();
JsonElement keyValue = macroObject.get("key");
JsonElement commandValue = macroObject.get("command");
MacroManager.INSTANCE.addMacro(keyValue.getAsInt(), commandValue.getAsString());
}
} else if (entry.getKey().equalsIgnoreCase("features")) {
JsonObject jsonValue = (JsonObject) entry.getValue();
if (jsonValue.has("DarkMode"))
LiquidBounce.INSTANCE.setDarkMode(jsonValue.get("DarkMode").getAsBoolean());
if (jsonValue.has("AntiForge"))
AntiForge.enabled = jsonValue.get("AntiForge").getAsBoolean();
if (jsonValue.has("AntiForgeFML"))
AntiForge.blockFML = jsonValue.get("AntiForgeFML").getAsBoolean();
if (jsonValue.has("AntiForgeProxy"))
AntiForge.blockProxyPacket = jsonValue.get("AntiForgeProxy").getAsBoolean();
if (jsonValue.has("AntiForgePayloads"))
AntiForge.blockPayloadPackets = jsonValue.get("AntiForgePayloads").getAsBoolean();
if (jsonValue.has("BungeeSpoof"))
BungeeCordSpoof.enabled = jsonValue.get("BungeeSpoof").getAsBoolean();
if (jsonValue.has("AutoReconnectDelay"))
AutoReconnect.INSTANCE.setDelay(jsonValue.get("AutoReconnectDelay").getAsInt());
} else if (entry.getKey().equalsIgnoreCase("thealtening")) {
JsonObject jsonValue = (JsonObject) entry.getValue();
if (jsonValue.has("API-Key"))
GuiTheAltening.Companion.setApiKey(jsonValue.get("API-Key").getAsString());
} else if (entry.getKey().equalsIgnoreCase("MainMenuParallax")) {
GuiMainMenu.Companion.setUseParallax(entry.getValue().getAsBoolean());
} else if (entry.getKey().equalsIgnoreCase("Background")) {
JsonObject jsonValue = (JsonObject) entry.getValue();
if (jsonValue.has("Enabled"))
GuiBackground.Companion.setEnabled(jsonValue.get("Enabled").getAsBoolean());
if (jsonValue.has("Particles"))
GuiBackground.Companion.setParticles(jsonValue.get("Particles").getAsBoolean());
} else {
final Module module = LiquidBounce.moduleManager.getModule(entry.getKey());
if(module != null) {
final JsonObject jsonModule = (JsonObject) entry.getValue();
for(final Value moduleValue : module.getValues()) {
final JsonElement element = jsonModule.get(moduleValue.getName());
if(element != null) moduleValue.fromJson(element);
}
}
}
}
}
/**
* Save config to file
*
* @throws IOException
*/
@Override
protected void saveConfig() throws IOException {
final JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("CommandPrefix", LiquidBounce.commandManager.getPrefix());
jsonObject.addProperty("ShowRichPresence", LiquidBounce.clientRichPresence.getShowRichPresenceValue());
final JsonObject jsonTargets = new JsonObject();
jsonTargets.addProperty("TargetPlayer", EntityUtils.targetPlayer);
jsonTargets.addProperty("TargetMobs", EntityUtils.targetMobs);
jsonTargets.addProperty("TargetAnimals", EntityUtils.targetAnimals);
jsonTargets.addProperty("TargetInvisible", EntityUtils.targetInvisible);
jsonTargets.addProperty("TargetDead", EntityUtils.targetDead);
jsonObject.add("targets", jsonTargets);
final JsonArray jsonMacros = new JsonArray();
MacroManager.INSTANCE.getMacroMapping().forEach((k, v) -> {
final JsonObject jsonMacro = new JsonObject();
jsonMacro.addProperty("key", k);
jsonMacro.addProperty("command", v);
jsonMacros.add(jsonMacro);
});
jsonObject.add("macros", jsonMacros);
final JsonObject jsonFeatures = new JsonObject();
jsonFeatures.addProperty("DarkMode", LiquidBounce.INSTANCE.getDarkMode());
jsonFeatures.addProperty("AntiForge", AntiForge.enabled);
jsonFeatures.addProperty("AntiForgeFML", AntiForge.blockFML);
jsonFeatures.addProperty("AntiForgeProxy", AntiForge.blockProxyPacket);
jsonFeatures.addProperty("AntiForgePayloads", AntiForge.blockPayloadPackets);
jsonFeatures.addProperty("BungeeSpoof", BungeeCordSpoof.enabled);
jsonFeatures.addProperty("AutoReconnectDelay", AutoReconnect.INSTANCE.getDelay());
jsonObject.add("features", jsonFeatures);
final JsonObject theAlteningObject = new JsonObject();
theAlteningObject.addProperty("API-Key", GuiTheAltening.Companion.getApiKey());
jsonObject.add("thealtening", theAlteningObject);
jsonObject.addProperty("MainMenuParallax", GuiMainMenu.Companion.getUseParallax());
final JsonObject backgroundObject = new JsonObject();
backgroundObject.addProperty("Enabled", GuiBackground.Companion.getEnabled());
backgroundObject.addProperty("Particles", GuiBackground.Companion.getParticles());
jsonObject.add("Background", backgroundObject);
LiquidBounce.moduleManager.getModules().stream().filter(module -> !module.getValues().isEmpty()).forEach(module -> {
final JsonObject jsonModule = new JsonObject();
module.getValues().forEach(value -> jsonModule.add(value.getName(), value.toJson()));
jsonObject.add(module.getName(), jsonModule);
});
final PrintWriter printWriter = new PrintWriter(new FileWriter(getFile()));
printWriter.println(FileManager.PRETTY_GSON.toJson(jsonObject));
printWriter.close();
}
}
| 9,288 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ClickGuiConfig.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/file/configs/ClickGuiConfig.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.file.configs;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.file.FileConfig;
import net.ccbluex.liquidbounce.file.FileManager;
import net.ccbluex.liquidbounce.ui.client.clickgui.Panel;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.Element;
import net.ccbluex.liquidbounce.ui.client.clickgui.elements.ModuleElement;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import java.io.*;
public class ClickGuiConfig extends FileConfig {
/**
* Constructor of config
*
* @param file of config
*/
public ClickGuiConfig(final File file) {
super(file);
}
/**
* Load config from file
*
* @throws IOException
*/
@Override
protected void loadConfig() throws IOException {
final JsonElement jsonElement = new JsonParser().parse(new BufferedReader(new FileReader(getFile())));
if(jsonElement instanceof JsonNull)
return;
final JsonObject jsonObject = (JsonObject) jsonElement;
for (final Panel panel : LiquidBounce.clickGui.panels) {
if(!jsonObject.has(panel.getName()))
continue;
try {
final JsonObject panelObject = jsonObject.getAsJsonObject(panel.getName());
panel.setOpen(panelObject.get("open").getAsBoolean());
panel.setVisible(panelObject.get("visible").getAsBoolean());
panel.setX(panelObject.get("posX").getAsInt());
panel.setY(panelObject.get("posY").getAsInt());
for(final Element element : panel.getElements()) {
if(!(element instanceof ModuleElement))
continue;
final ModuleElement moduleElement = (ModuleElement) element;
if(!panelObject.has(moduleElement.getModule().getName()))
continue;
try {
final JsonObject elementObject = panelObject.getAsJsonObject(moduleElement.getModule().getName());
moduleElement.setShowSettings(elementObject.get("Settings").getAsBoolean());
}catch(final Exception e) {
ClientUtils.getLogger().error("Error while loading clickgui module element with the name '" + moduleElement.getModule().getName() + "' (Panel Name: " + panel.getName() + ").", e);
}
}
}catch(final Exception e) {
ClientUtils.getLogger().error("Error while loading clickgui panel with the name '" + panel.getName() + "'.", e);
}
}
}
/**
* Save config to file
*
* @throws IOException
*/
@Override
protected void saveConfig() throws IOException {
final JsonObject jsonObject = new JsonObject();
for (final Panel panel : LiquidBounce.clickGui.panels) {
final JsonObject panelObject = new JsonObject();
panelObject.addProperty("open", panel.getOpen());
panelObject.addProperty("visible", panel.isVisible());
panelObject.addProperty("posX", panel.getX());
panelObject.addProperty("posY", panel.getY());
for(final Element element : panel.getElements()) {
if(!(element instanceof ModuleElement))
continue;
final ModuleElement moduleElement = (ModuleElement) element;
final JsonObject elementObject = new JsonObject();
elementObject.addProperty("Settings", moduleElement.isShowSettings());
panelObject.add(moduleElement.getModule().getName(), elementObject);
}
jsonObject.add(panel.getName(), panelObject);
}
final PrintWriter printWriter = new PrintWriter(new FileWriter(getFile()));
printWriter.println(FileManager.PRETTY_GSON.toJson(jsonObject));
printWriter.close();
}
} | 4,337 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ModulesConfig.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/file/configs/ModulesConfig.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.file.configs;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.file.FileConfig;
import net.ccbluex.liquidbounce.file.FileManager;
import net.ccbluex.liquidbounce.features.module.modules.misc.AutoDisable.DisableEvent;
import java.io.*;
import java.util.Iterator;
import java.util.Map;
public class ModulesConfig extends FileConfig {
/**
* Constructor of config
*
* @param file of config
*/
public ModulesConfig(final File file) {
super(file);
}
/**
* Load config from file
*
* @throws IOException
*/
@Override
protected void loadConfig() throws IOException {
final JsonElement jsonElement = new JsonParser().parse(new BufferedReader(new FileReader(getFile())));
if(jsonElement instanceof JsonNull)
return;
final Iterator<Map.Entry<String, JsonElement>> entryIterator = jsonElement.getAsJsonObject().entrySet().iterator();
while(entryIterator.hasNext()) {
final Map.Entry<String, JsonElement> entry = entryIterator.next();
final Module module = LiquidBounce.moduleManager.getModule(entry.getKey());
if(module != null) {
final JsonObject jsonModule = (JsonObject) entry.getValue();
module.setState(jsonModule.get("State").getAsBoolean());
module.setKeyBind(jsonModule.get("KeyBind").getAsInt());
if(jsonModule.has("Array"))
module.setArray(jsonModule.get("Array").getAsBoolean());
if (jsonModule.has("AutoDisable")) {
module.getAutoDisables().clear();
try {
JsonArray jsonAD = jsonModule.getAsJsonArray("AutoDisable");
if (jsonAD.size() > 0) for (int i = 0; i <= jsonAD.size() - 1; i++) {
try {
DisableEvent disableEvent = DisableEvent.valueOf(jsonAD.get(i).getAsString());
module.getAutoDisables().add(disableEvent);
} catch (Exception e) {
// nothing
}
}
} catch (Exception e) {
//nothing.
}
}
}
}
}
/**
* Save config to file
*
* @throws IOException
*/
@Override
protected void saveConfig() throws IOException {
final JsonObject jsonObject = new JsonObject();
for (final Module module : LiquidBounce.moduleManager.getModules()) {
final JsonObject jsonMod = new JsonObject();
jsonMod.addProperty("State", module.getState());
jsonMod.addProperty("KeyBind", module.getKeyBind());
jsonMod.addProperty("Array", module.getArray());
final JsonArray jsonAD = new JsonArray();
for (DisableEvent e : module.getAutoDisables()) {
jsonAD.add(new JsonPrimitive(e.toString()));
}
jsonMod.add("AutoDisable", jsonAD);
jsonObject.add(module.getName(), jsonMod);
}
final PrintWriter printWriter = new PrintWriter(new FileWriter(getFile()));
printWriter.println(FileManager.PRETTY_GSON.toJson(jsonObject));
printWriter.close();
}
}
| 3,902 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
XRayConfig.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/file/configs/XRayConfig.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.file.configs;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.modules.render.XRay;
import net.ccbluex.liquidbounce.file.FileConfig;
import net.ccbluex.liquidbounce.file.FileManager;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.minecraft.block.Block;
import java.io.*;
public class XRayConfig extends FileConfig {
/**
* Constructor of config
*
* @param file of config
*/
public XRayConfig(final File file) {
super(file);
}
/**
* Load config from file
*
* @throws IOException
*/
@Override
protected void loadConfig() throws IOException {
final XRay xRay = LiquidBounce.moduleManager.getModule(XRay.class);
if(xRay == null) {
ClientUtils.getLogger().error("[FileManager] Failed to find xray module.");
return;
}
final JsonArray jsonArray = new JsonParser().parse(new BufferedReader(new FileReader(getFile()))).getAsJsonArray();
xRay.getXrayBlocks().clear();
for(final JsonElement jsonElement : jsonArray) {
try {
final Block block = Block.getBlockFromName(jsonElement.getAsString());
if (xRay.getXrayBlocks().contains(block)) {
ClientUtils.getLogger().error("[FileManager] Skipped xray block '" + block.getRegistryName() + "' because the block is already added.");
continue;
}
xRay.getXrayBlocks().add(block);
}catch(final Throwable throwable) {
ClientUtils.getLogger().error("[FileManager] Failed to add block to xray.", throwable);
}
}
}
/**
* Save config to file
*
* @throws IOException
*/
@Override
protected void saveConfig() throws IOException {
final XRay xRay = LiquidBounce.moduleManager.getModule(XRay.class);
if(xRay == null) {
ClientUtils.getLogger().error("[FileManager] Failed to find xray module.");
return;
}
final JsonArray jsonArray = new JsonArray();
for (final Block block : xRay.getXrayBlocks())
jsonArray.add(FileManager.PRETTY_GSON.toJsonTree(Block.getIdFromBlock(block)));
final PrintWriter printWriter = new PrintWriter(new FileWriter(getFile()));
printWriter.println(FileManager.PRETTY_GSON.toJson(jsonArray));
printWriter.close();
}
}
| 2,813 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
HudConfig.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/file/configs/HudConfig.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.file.configs;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.file.FileConfig;
import net.ccbluex.liquidbounce.ui.client.hud.Config;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class HudConfig extends FileConfig {
/**
* Constructor of config
*
* @param file of config
*/
public HudConfig(final File file) {
super(file);
}
/**
* Load config from file
*
* @throws IOException
*/
@Override
protected void loadConfig() throws IOException {
LiquidBounce.hud.clearElements();
LiquidBounce.hud = new Config(FileUtils.readFileToString(getFile())).toHUD();
}
/**
* Save config to file
*
* @throws IOException
*/
@Override
protected void saveConfig() throws IOException {
final PrintWriter printWriter = new PrintWriter(new FileWriter(getFile()));
printWriter.println(new Config(LiquidBounce.hud).toJson());
printWriter.close();
}
}
| 1,340 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
AccountsConfig.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/file/configs/AccountsConfig.java | /*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.file.configs;
import com.google.gson.*;
import me.liuli.elixir.account.CrackedAccount;
import me.liuli.elixir.account.MinecraftAccount;
import me.liuli.elixir.account.MojangAccount;
import me.liuli.elixir.manage.AccountSerializer;
import net.ccbluex.liquidbounce.file.FileConfig;
import net.ccbluex.liquidbounce.file.FileManager;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
public class AccountsConfig extends FileConfig {
private final List<MinecraftAccount> accounts = new ArrayList<>();
/**
* Constructor of config
*
* @param file of config
*/
public AccountsConfig(final File file) {
super(file);
}
/**
* Load config from file
*
* @throws IOException
*/
@Override
protected void loadConfig() throws IOException {
clearAccounts();
final JsonElement jsonElement = new JsonParser().parse(new BufferedReader(new FileReader(getFile())));
if (jsonElement instanceof JsonNull)
return;
for (final JsonElement accountElement : jsonElement.getAsJsonArray()) {
final JsonObject accountObject = accountElement.getAsJsonObject();
try{
// Import Elixir account format
accounts.add(AccountSerializer.INSTANCE.fromJson(accountElement.getAsJsonObject()));
} catch (JsonSyntaxException | IllegalStateException e) {
// Import old account format
JsonElement name = accountObject.get("name");
JsonElement password = accountObject.get("password");
JsonElement inGameName = accountObject.get("inGameName");
if (inGameName.isJsonNull() && password.isJsonNull()) {
final MojangAccount mojangAccount = new MojangAccount();
mojangAccount.setEmail(name.getAsString());
mojangAccount.setName(inGameName.getAsString());
mojangAccount.setPassword(password.getAsString());
accounts.add(mojangAccount);
} else {
final CrackedAccount crackedAccount = new CrackedAccount();
crackedAccount.setName(name.getAsString());
accounts.add(crackedAccount);
}
}
}
}
/**
* Save config to file
*
* @throws IOException
*/
@Override
protected void saveConfig() throws IOException {
final JsonArray jsonArray = new JsonArray();
for (final MinecraftAccount minecraftAccount : accounts) {
jsonArray.add(AccountSerializer.INSTANCE.toJson(minecraftAccount));
}
final PrintWriter printWriter = new PrintWriter(new FileWriter(getFile()));
printWriter.println(FileManager.PRETTY_GSON.toJson(jsonArray));
printWriter.close();
}
/**
* Add cracked account to config
*
* @param name of account
*/
public void addCrackedAccount(final String name) {
final CrackedAccount crackedAccount = new CrackedAccount();
crackedAccount.setName(name);
if (accountExists(crackedAccount))
return;
accounts.add(crackedAccount);
}
/**
* Add account to config
*
* @param name of account
* @param password of password
*/
public void addMojangAccount(final String name, final String password) {
final MojangAccount mojangAccount = new MojangAccount();
mojangAccount.setName(name);
mojangAccount.setPassword(password);
if (accountExists(mojangAccount))
return;
accounts.add(mojangAccount);
}
/**
* Add account to config
*/
public void addAccount(final MinecraftAccount account) {
accounts.add(account);
}
/**
* Remove account from config
*
* @param selectedSlot of the account
*/
public void removeAccount(final int selectedSlot) {
accounts.remove(selectedSlot);
}
/**
* Removed an account from the config
*
* @param account the account
*/
public void removeAccount(MinecraftAccount account) {
accounts.remove(account);
}
/**
* Check if the account is already added
*/
public boolean accountExists(final MinecraftAccount newAccount) {
for (final MinecraftAccount minecraftAccount : accounts)
if (minecraftAccount.getClass().getName().equals(newAccount.getClass().getName()) && minecraftAccount.getName().equals(newAccount.getName()))
return true;
return false;
}
/**
* Clear all minecraft accounts from alt array
*/
public void clearAccounts() {
accounts.clear();
}
/**
* Get Alts
*
* @return list of Alt Accounts
*/
public List<MinecraftAccount> getAccounts() {
return accounts;
}
}
| 5,170 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
FriendsConfig.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/file/configs/FriendsConfig.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.file.configs;
import com.google.gson.*;
import net.ccbluex.liquidbounce.file.FileConfig;
import net.ccbluex.liquidbounce.file.FileManager;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
public class FriendsConfig extends FileConfig {
private final List<Friend> friends = new ArrayList<>();
/**
* Constructor of config
*
* @param file of config
*/
public FriendsConfig(final File file) {
super(file);
}
/**
* Load config from file
*
* @throws IOException
*/
@Override
protected void loadConfig() throws IOException {
clearFriends();
try {
final JsonElement jsonElement = new JsonParser().parse(new BufferedReader(new FileReader(getFile())));
if (jsonElement instanceof JsonNull)
return;
for (final JsonElement friendElement : jsonElement.getAsJsonArray()) {
JsonObject friendObject = friendElement.getAsJsonObject();
addFriend(friendObject.get("playerName").getAsString(), friendObject.get("alias").getAsString());
}
} catch (JsonSyntaxException | IllegalStateException ex) {
//When the JSON Parse fail, the client try to load and update the old config
ClientUtils.getLogger().info("[FileManager] Try to load old Friends config...");
final BufferedReader bufferedReader = new BufferedReader(new FileReader(getFile()));
String line;
while ((line = bufferedReader.readLine()) != null) {
if (!line.contains("{") && !line.contains("}")) {
line = line.replace(" ", "").replace("\"", "").replace(",", "");
if (line.contains(":")) {
String[] data = line.split(":");
addFriend(data[0], data[1]);
} else
addFriend(line);
}
}
bufferedReader.close();
ClientUtils.getLogger().info("[FileManager] Loaded old Friends config...");
//Save the friends into a new valid JSON file
saveConfig();
ClientUtils.getLogger().info("[FileManager] Saved Friends to new config...");
}
}
/**
* Save config to file
*
* @throws IOException
*/
@Override
protected void saveConfig() throws IOException {
final JsonArray jsonArray = new JsonArray();
for (final Friend friend : getFriends()) {
JsonObject friendObject = new JsonObject();
friendObject.addProperty("playerName", friend.getPlayerName());
friendObject.addProperty("alias", friend.getAlias());
jsonArray.add(friendObject);
}
final PrintWriter printWriter = new PrintWriter(new FileWriter(getFile()));
printWriter.println(FileManager.PRETTY_GSON.toJson(jsonArray));
printWriter.close();
}
/**
* Add friend to config
*
* @param playerName of friend
* @return of successfully added friend
*/
public boolean addFriend(final String playerName) {
return addFriend(playerName, playerName);
}
/**
* Add friend to config
*
* @param playerName of friend
* @param alias of friend
* @return of successfully added friend
*/
public boolean addFriend(final String playerName, final String alias) {
if(isFriend(playerName))
return false;
friends.add(new Friend(playerName, alias));
return true;
}
/**
* Remove friend from config
*
* @param playerName of friend
*/
public boolean removeFriend(final String playerName) {
if(!isFriend(playerName))
return false;
friends.removeIf(friend -> friend.getPlayerName().equals(playerName));
return true;
}
/**
* Check is friend
*
* @param playerName of friend
* @return is friend
*/
public boolean isFriend(final String playerName) {
for(final Friend friend : friends)
if(friend.getPlayerName().equals(playerName))
return true;
return false;
}
/**
* Clear all friends from config
*/
public void clearFriends() {
friends.clear();
}
/**
* Get friends
*
* @return list of friends
*/
public List<Friend> getFriends() {
return friends;
}
public class Friend {
private final String playerName;
private final String alias;
/**
* @param playerName of friend
* @param alias of friend
*/
Friend(final String playerName, final String alias) {
this.playerName = playerName;
this.alias = alias;
}
/**
* @return name of friend
*/
public String getPlayerName() {
return playerName;
}
/**
* @return alias of friend
*/
public String getAlias() {
return alias;
}
}
}
| 5,416 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
AntiForge.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/special/AntiForge.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.special;
import io.netty.buffer.Unpooled;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.Listenable;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.features.module.ModuleManager;
import net.ccbluex.liquidbounce.features.module.modules.world.Scaffold;
import net.ccbluex.liquidbounce.utils.MinecraftInstance;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C17PacketCustomPayload;
public class AntiForge extends MinecraftInstance implements Listenable {
public static boolean enabled = true;
public static boolean blockFML = true;
public static boolean blockProxyPacket = true;
public static boolean blockPayloadPackets = true;
@EventTarget
public void onPacket(PacketEvent event) {
final Packet<?> packet = event.getPacket();
if (enabled && !mc.isIntegratedServerRunning()) {
try {
if(blockProxyPacket && packet.getClass().getName().equals("net.minecraftforge.fml.common.network.internal.FMLProxyPacket"))
event.cancelEvent();
if(blockPayloadPackets && packet instanceof C17PacketCustomPayload) {
final C17PacketCustomPayload customPayload = (C17PacketCustomPayload) packet;
if(!customPayload.getChannelName().startsWith("MC|"))
event.cancelEvent();
else if(customPayload.getChannelName().equalsIgnoreCase("MC|Brand"))
customPayload.data = (new PacketBuffer(Unpooled.buffer()).writeString("vanilla"));
}
}catch(final Exception e) {
e.printStackTrace();
}
}
}
@Override
public boolean handleEvents() {
return true;
}
}
| 2,108 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ColorElement.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/color/ColorElement.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.color;
import net.ccbluex.liquidbounce.value.IntegerValue;
import static net.ccbluex.liquidbounce.features.module.modules.color.ColorMixer.regenerateColors;
public class ColorElement extends IntegerValue {
public ColorElement(int counter, Material m, IntegerValue basis) {
super("Color" + counter + "-" + m.getColorName(), 255, 0, 255, () -> (basis.get() >= counter));
}
public ColorElement(int counter, Material m) {
super("Color" + counter + "-" + m.getColorName(), 255, 0, 255);
}
@Override
protected void onChanged(final Integer oldValue, final Integer newValue) {
regenerateColors(true);
}
enum Material {
RED("Red"),
GREEN("Green"),
BLUE("Blue");
private final String colName;
Material(String name) {
this.colName = name;
}
public String getColorName() {
return this.colName;
}
}
}
| 1,195 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ColorMixer.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/color/ColorMixer.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.color;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.TickEvent;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.utils.render.BlendUtils;
import net.ccbluex.liquidbounce.value.IntegerValue;
import java.awt.Color;
import java.lang.reflect.Field;
@ModuleInfo(name = "ColorMixer", description = "Mix two colors together.", category = ModuleCategory.COLOR, canEnable = false)
public class ColorMixer extends Module {
private static float[] lastFraction = new float[]{};
public static Color[] lastColors = new Color[]{};
public final IntegerValue blendAmount = new IntegerValue("Mixer-Amount", 2, 2, 10) {
@Override
protected void onChanged(final Integer oldValue, final Integer newValue) {
regenerateColors(oldValue != newValue);
}
};
/*
@Override
public void onInitialize() {
regenerateColors();
}
*/
public final ColorElement col1RedValue = new ColorElement(1, ColorElement.Material.RED);
public final ColorElement col1GreenValue = new ColorElement(1, ColorElement.Material.GREEN);
public final ColorElement col1BlueValue = new ColorElement(1, ColorElement.Material.BLUE);
public final ColorElement col2RedValue = new ColorElement(2, ColorElement.Material.RED);
public final ColorElement col2GreenValue = new ColorElement(2, ColorElement.Material.GREEN);
public final ColorElement col2BlueValue = new ColorElement(2, ColorElement.Material.BLUE);
public final ColorElement col3RedValue = new ColorElement(3, ColorElement.Material.RED, blendAmount);
public final ColorElement col3GreenValue = new ColorElement(3, ColorElement.Material.GREEN, blendAmount);
public final ColorElement col3BlueValue = new ColorElement(3, ColorElement.Material.BLUE, blendAmount);
public final ColorElement col4RedValue = new ColorElement(4, ColorElement.Material.RED, blendAmount);
public final ColorElement col4GreenValue = new ColorElement(4, ColorElement.Material.GREEN, blendAmount);
public final ColorElement col4BlueValue = new ColorElement(4, ColorElement.Material.BLUE, blendAmount);
public final ColorElement col5RedValue = new ColorElement(5, ColorElement.Material.RED, blendAmount);
public final ColorElement col5GreenValue = new ColorElement(5, ColorElement.Material.GREEN, blendAmount);
public final ColorElement col5BlueValue = new ColorElement(5, ColorElement.Material.BLUE, blendAmount);
public final ColorElement col6RedValue = new ColorElement(6, ColorElement.Material.RED, blendAmount);
public final ColorElement col6GreenValue = new ColorElement(6, ColorElement.Material.GREEN, blendAmount);
public final ColorElement col6BlueValue = new ColorElement(6, ColorElement.Material.BLUE, blendAmount);
public final ColorElement col7RedValue = new ColorElement(7, ColorElement.Material.RED, blendAmount);
public final ColorElement col7GreenValue = new ColorElement(7, ColorElement.Material.GREEN, blendAmount);
public final ColorElement col7BlueValue = new ColorElement(7, ColorElement.Material.BLUE, blendAmount);
public final ColorElement col8RedValue = new ColorElement(8, ColorElement.Material.RED, blendAmount);
public final ColorElement col8GreenValue = new ColorElement(8, ColorElement.Material.GREEN, blendAmount);
public final ColorElement col8BlueValue = new ColorElement(8, ColorElement.Material.BLUE, blendAmount);
public final ColorElement col9RedValue = new ColorElement(9, ColorElement.Material.RED, blendAmount);
public final ColorElement col9GreenValue = new ColorElement(9, ColorElement.Material.GREEN, blendAmount);
public final ColorElement col9BlueValue = new ColorElement(9, ColorElement.Material.BLUE, blendAmount);
public final ColorElement col10RedValue = new ColorElement(10, ColorElement.Material.RED, blendAmount);
public final ColorElement col10GreenValue = new ColorElement(10, ColorElement.Material.GREEN, blendAmount);
public final ColorElement col10BlueValue = new ColorElement(10, ColorElement.Material.BLUE, blendAmount);
public static Color getMixedColor(int index, int seconds) {
final ColorMixer colMixer = LiquidBounce.moduleManager.getModule(ColorMixer.class);
if (colMixer == null) return Color.white;
if (lastColors.length <= 0 || lastFraction.length <= 0) regenerateColors(true); // just to make sure it won't go white
return BlendUtils.blendColors(lastFraction, lastColors, (System.currentTimeMillis() + index) % (seconds * 1000) / (float) (seconds * 1000));
}
public static void regenerateColors(boolean forceValue) {
final ColorMixer colMixer = LiquidBounce.moduleManager.getModule(ColorMixer.class);
if (colMixer == null) return;
// color generation
if (forceValue || lastColors.length <= 0 || lastColors.length != (colMixer.blendAmount.get() * 2) - 1) {
Color[] generator = new Color[(colMixer.blendAmount.get() * 2) - 1];
// reflection is cool
for (int i = 1; i <= colMixer.blendAmount.get(); i++) {
Color result = Color.white;
try {
Field red = ColorMixer.class.getField("col"+i+"RedValue");
Field green = ColorMixer.class.getField("col"+i+"GreenValue");
Field blue = ColorMixer.class.getField("col"+i+"BlueValue");
int r = ((ColorElement)red.get(colMixer)).get();
int g = ((ColorElement)green.get(colMixer)).get();
int b = ((ColorElement)blue.get(colMixer)).get();
result = new Color(Math.max(0, Math.min(r, 255)), Math.max(0, Math.min(g, 255)), Math.max(0, Math.min(b, 255)));
} catch (Exception e) {
e.printStackTrace();
}
generator[i - 1] = result;
}
int h = colMixer.blendAmount.get();
for (int z = colMixer.blendAmount.get() - 2; z >= 0; z--) {
generator[h] = generator[z];
h++;
}
lastColors = generator;
}
// cache thingy
if (forceValue || lastFraction.length <= 0 || lastFraction.length != (colMixer.blendAmount.get() * 2) - 1) {
// color frac regenerate if necessary
float[] colorFraction = new float[(colMixer.blendAmount.get() * 2) - 1];
for (int i = 0; i <= (colMixer.blendAmount.get() * 2) - 2; i++)
{
colorFraction[i] = (float)i / (float)((colMixer.blendAmount.get() * 2) - 2);
}
lastFraction = colorFraction;
}
}
}
| 7,205 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Scaffold.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/Scaffold.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.world;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.*;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.features.module.modules.render.BlockOverlay;
import net.ccbluex.liquidbounce.features.module.modules.movement.Fly;
import net.ccbluex.liquidbounce.features.module.modules.movement.Sprint;
import net.ccbluex.liquidbounce.features.module.modules.movement.Speed;
import net.ccbluex.liquidbounce.injection.access.StaticStorage;
import net.ccbluex.liquidbounce.ui.font.Fonts;
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notification;
import net.ccbluex.liquidbounce.utils.*;
import net.ccbluex.liquidbounce.utils.block.BlockUtils;
import net.ccbluex.liquidbounce.utils.block.PlaceInfo;
import net.ccbluex.liquidbounce.utils.misc.RandomUtils;
import net.ccbluex.liquidbounce.utils.render.BlurUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
import net.ccbluex.liquidbounce.utils.timer.TickTimer;
import net.ccbluex.liquidbounce.utils.timer.TimeUtils;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.FloatValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.ccbluex.liquidbounce.value.ListValue;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C09PacketHeldItemChange;
import net.minecraft.network.play.client.C0APacketAnimation;
import net.minecraft.network.play.client.C0BPacketEntityAction;
import net.minecraft.stats.StatList;
import net.minecraft.util.*;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import java.awt.*;
@ModuleInfo(name = "Scaffold", description = "Automatically places blocks beneath your feet.", category = ModuleCategory.WORLD, keyBind = Keyboard.KEY_I)
public class Scaffold extends Module {
/**
* OPTIONS (Tower)
*/
// Global settings
private final BoolValue towerEnabled = new BoolValue("EnableTower", false);
private final ListValue towerModeValue = new ListValue("TowerMode", new String[] {
"Jump", "Motion", "StableMotion", "ConstantMotion", "MotionTP", "Packet", "Teleport", "AAC3.3.9", "AAC3.6.4", "Verus"
}, "Motion", () -> towerEnabled.get());
private final ListValue towerPlaceModeValue = new ListValue("Tower-PlaceTiming", new String[]{"Pre", "Post"}, "Post");
private final BoolValue stopWhenBlockAbove = new BoolValue("StopWhenBlockAbove", false, () -> towerEnabled.get());
private final BoolValue onJumpValue = new BoolValue("OnJump", false, () -> towerEnabled.get());
private final BoolValue noMoveOnlyValue = new BoolValue("NoMove", true, () -> towerEnabled.get());
private final BoolValue noMoveFreezeValue = new BoolValue("NoMoveFreezePlayer", true, () -> towerEnabled.get() && noMoveOnlyValue.get());
private final FloatValue towerTimerValue = new FloatValue("TowerTimer", 1F, 0.1F, 10F, () -> towerEnabled.get());
// Jump mode
private final FloatValue jumpMotionValue = new FloatValue("JumpMotion", 0.42F, 0.3681289F, 0.79F, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("Jump"));
private final IntegerValue jumpDelayValue = new IntegerValue("JumpDelay", 0, 0, 20, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("Jump"));
// StableMotion
private final FloatValue stableMotionValue = new FloatValue("StableMotion", 0.41982F, 0.1F, 1F, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("StableMotion"));
private final BoolValue stableFakeJumpValue = new BoolValue("StableFakeJump", false, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("StableMotion"));
private final BoolValue stableStopValue = new BoolValue("StableStop", false, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("StableMotion"));
private final IntegerValue stableStopDelayValue = new IntegerValue("StableStopDelay", 1500, 0, 5000, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("StableMotion") && stableStopValue.get());
// ConstantMotion
private final FloatValue constantMotionValue = new FloatValue("ConstantMotion", 0.42F, 0.1F, 1F, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("ConstantMotion"));
private final FloatValue constantMotionJumpGroundValue = new FloatValue("ConstantMotionJumpGround", 0.79F, 0.76F, 1F, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("ConstantMotion"));
// Teleport
private final FloatValue teleportHeightValue = new FloatValue("TeleportHeight", 1.15F, 0.1F, 5F, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("Teleport"));
private final IntegerValue teleportDelayValue = new IntegerValue("TeleportDelay", 0, 0, 20, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("Teleport"));
private final BoolValue teleportGroundValue = new BoolValue("TeleportGround", true, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("Teleport"));
private final BoolValue teleportNoMotionValue = new BoolValue("TeleportNoMotion", false, () -> towerEnabled.get() && towerModeValue.get().equalsIgnoreCase("Teleport"));
/**
* OPTIONS (Scaffold)
*/
// Mode
public final ListValue modeValue = new ListValue("Mode", new String[]{"Normal", "Rewinside", "Expand"}, "Normal");
// Delay
private final BoolValue placeableDelay = new BoolValue("PlaceableDelay", false);
private final IntegerValue maxDelayValue = new IntegerValue("MaxDelay", 0, 0, 1000, "ms") {
@Override
protected void onChanged(final Integer oldValue, final Integer newValue) {
final int i = minDelayValue.get();
if (i > newValue)
set(i);
}
};
private final IntegerValue minDelayValue = new IntegerValue("MinDelay", 0, 0, 1000, "ms") {
@Override
protected void onChanged(final Integer oldValue, final Integer newValue) {
final int i = maxDelayValue.get();
if (i < newValue)
set(i);
}
};
// idfk what is this
private final BoolValue smartDelay = new BoolValue("SmartDelay", true);
// AutoBlock
private final ListValue autoBlockMode = new ListValue("AutoBlock", new String[]{"Spoof", "Switch", "Off"}, "Spoof");
private final BoolValue stayAutoBlock = new BoolValue("StayAutoBlock", false, () -> !autoBlockMode.get().equalsIgnoreCase("off"));
//make sprint compatible with tower.add sprint tricks
public final ListValue sprintModeValue = new ListValue("SprintMode", new String[]{"Same", "Ground", "Air", "Off"}, "Off");
// Basic stuff
private final BoolValue swingValue = new BoolValue("Swing", true);
private final BoolValue downValue = new BoolValue("Down", false);
private final BoolValue searchValue = new BoolValue("Search", true);
private final ListValue placeModeValue = new ListValue("PlaceTiming", new String[]{"Pre", "Post"}, "Post");
// Eagle
private final BoolValue eagleValue = new BoolValue("Eagle", false);
private final BoolValue eagleSilentValue = new BoolValue("EagleSilent", false, () -> eagleValue.get());
private final IntegerValue blocksToEagleValue = new IntegerValue("BlocksToEagle", 0, 0, 10, () -> eagleValue.get());
private final FloatValue eagleEdgeDistanceValue = new FloatValue("EagleEdgeDistance", 0.2F, 0F, 0.5F, "m", () -> eagleValue.get());
// Expand
private final BoolValue omniDirectionalExpand = new BoolValue("OmniDirectionalExpand", true, () -> modeValue.get().equalsIgnoreCase("expand"));
private final IntegerValue expandLengthValue = new IntegerValue("ExpandLength", 5, 1, 6, " blocks", () -> modeValue.get().equalsIgnoreCase("expand"));
// Rotations
private final BoolValue rotationsValue = new BoolValue("Rotations", true);
private final BoolValue noHitCheckValue = new BoolValue("NoHitCheck", false, () -> rotationsValue.get());
public final ListValue rotationModeValue = new ListValue("RotationMode", new String[]{"Normal", "AAC", "Static", "Static2", "Static3", "Spin", "Custom"}, "Normal"); // searching reason
public final ListValue rotationLookupValue = new ListValue("RotationLookup", new String[]{"Normal", "AAC", "Same"}, "Normal");
private final FloatValue maxTurnSpeed = new FloatValue("MaxTurnSpeed", 180F, 0F, 180F, "°", () -> rotationsValue.get()) {
@Override
protected void onChanged(final Float oldValue, final Float newValue) {
final float i = minTurnSpeed.get();
if (i > newValue)
set(i);
}
};
private final FloatValue minTurnSpeed = new FloatValue("MinTurnSpeed", 180F, 0F, 180F, "°", () -> rotationsValue.get()) {
@Override
protected void onChanged(final Float oldValue, final Float newValue) {
final float i = maxTurnSpeed.get();
if (i < newValue)
set(i);
}
};
private final FloatValue staticPitchValue = new FloatValue("Static-Pitch", 86F, 80F, 90F, "°", () -> rotationModeValue.get().toLowerCase().startsWith("static"));
private final FloatValue customYawValue = new FloatValue("Custom-Yaw", 135F, -180F, 180F, "°", () -> rotationModeValue.get().equalsIgnoreCase("custom"));
private final FloatValue customPitchValue = new FloatValue("Custom-Pitch", 86F, -90F, 90F, "°", () -> rotationModeValue.get().equalsIgnoreCase("custom"));
private final FloatValue speenSpeedValue = new FloatValue("Spin-Speed", 5F, -90F, 90F, "°", () -> rotationModeValue.get().equalsIgnoreCase("spin"));
private final FloatValue speenPitchValue = new FloatValue("Spin-Pitch", 90F, -90F, 90F, "°", () -> rotationModeValue.get().equalsIgnoreCase("spin"));
private final BoolValue keepRotOnJumpValue = new BoolValue("KeepRotOnJump", true, () -> (!rotationModeValue.get().equalsIgnoreCase("normal") && !rotationModeValue.get().equalsIgnoreCase("aac")));
private final BoolValue keepRotationValue = new BoolValue("KeepRotation", false, () -> rotationsValue.get());
private final IntegerValue keepLengthValue = new IntegerValue("KeepRotationLength", 0, 0, 20, () -> rotationsValue.get() && !keepRotationValue.get());
private final ListValue placeConditionValue = new ListValue("Place-Condition", new String[] {"Air", "FallDown", "NegativeMotion", "Always"}, "Always");
private final BoolValue rotationStrafeValue = new BoolValue("RotationStrafe", false);
// Zitter
private final BoolValue zitterValue = new BoolValue("Zitter", false, () -> !isTowerOnly());
private final ListValue zitterModeValue = new ListValue("ZitterMode", new String[]{"Teleport", "Smooth"}, "Teleport", () -> !isTowerOnly() && zitterValue.get());
private final FloatValue zitterSpeed = new FloatValue("ZitterSpeed", 0.13F, 0.1F, 0.3F, () -> !isTowerOnly() && zitterValue.get() && zitterModeValue.get().equalsIgnoreCase("teleport"));
private final FloatValue zitterStrength = new FloatValue("ZitterStrength", 0.072F, 0.05F, 0.2F, () -> !isTowerOnly() && zitterValue.get() && zitterModeValue.get().equalsIgnoreCase("teleport"));
private final IntegerValue zitterDelay = new IntegerValue("ZitterDelay", 100, 0, 500, "ms", () -> !isTowerOnly() && zitterValue.get() && zitterModeValue.get().equalsIgnoreCase("smooth"));
// Game
private final FloatValue timerValue = new FloatValue("Timer", 1F, 0.1F, 10F, () -> !isTowerOnly());
public final FloatValue speedModifierValue = new FloatValue("SpeedModifier", 1F, 0, 2F, "x");
public final FloatValue xzMultiplier = new FloatValue("XZ-Multiplier", 1F, 0F, 4F, "x");
private final BoolValue customSpeedValue = new BoolValue("CustomSpeed", false);
private final FloatValue customMoveSpeedValue = new FloatValue("CustomMoveSpeed", 0.3F, 0, 5F, () -> customSpeedValue.get());
// Safety
private final BoolValue sameYValue = new BoolValue("SameY", false, () -> !towerEnabled.get());
private final BoolValue autoJumpValue = new BoolValue("AutoJump", false, () -> !isTowerOnly());
private final BoolValue smartSpeedValue = new BoolValue("SmartSpeed", false, () -> !isTowerOnly());
private final BoolValue safeWalkValue = new BoolValue("SafeWalk", true);
private final BoolValue airSafeValue = new BoolValue("AirSafe", false, () -> safeWalkValue.get());
private final BoolValue autoDisableSpeedValue = new BoolValue("AutoDisable-Speed", true);
// Visuals
public final ListValue counterDisplayValue = new ListValue("Counter", new String[]{"Off", "Simple", "Advanced", "Sigma", "Novoline"}, "Simple");
private final BoolValue markValue = new BoolValue("Mark", false);
private final IntegerValue redValue = new IntegerValue("Red", 0, 0, 255, () -> markValue.get());
private final IntegerValue greenValue = new IntegerValue("Green", 120, 0, 255, () -> markValue.get());
private final IntegerValue blueValue = new IntegerValue("Blue", 255, 0, 255, () -> markValue.get());
private final IntegerValue alphaValue = new IntegerValue("Alpha", 120, 0, 255, () -> markValue.get());
private final BoolValue blurValue = new BoolValue("Blur-Advanced", false, () -> counterDisplayValue.get().equalsIgnoreCase("advanced"));
private final FloatValue blurStrength = new FloatValue("Blur-Strength", 1F, 0F, 30F, "x", () -> counterDisplayValue.get().equalsIgnoreCase("advanced"));
/**
* MODULE
*/
// Target block
private PlaceInfo targetPlace, towerPlace;
// Launch position
private int launchY;
private boolean faceBlock;
// Rotation lock
private Rotation lockRotation;
private Rotation lookupRotation;
private Rotation speenRotation;
// Auto block slot
private int slot, lastSlot;
// Zitter Smooth
private boolean zitterDirection;
// Delay
private final MSTimer delayTimer = new MSTimer();
private final MSTimer towerDelayTimer = new MSTimer();
private final MSTimer zitterTimer = new MSTimer();
private long delay;
// Eagle
private int placedBlocksWithoutEagle = 0;
private boolean eagleSneaking;
// Down
private boolean shouldGoDown = false;
// Render thingy
private float progress = 0;
private float spinYaw = 0F;
private long lastMS = 0L;
// Mode stuff
private final TickTimer timer = new TickTimer();
private double jumpGround = 0;
private int verusState = 0;
private boolean verusJumped = false;
public boolean isTowerOnly() {
return (towerEnabled.get() && !onJumpValue.get());
}
public boolean towerActivation() {
return towerEnabled.get() && (!onJumpValue.get() || mc.gameSettings.keyBindJump.isKeyDown()) && (!noMoveOnlyValue.get() || !MovementUtils.isMoving());
}
/**
* Enable module
*/
@Override
public void onEnable() {
if (mc.thePlayer == null) return;
progress = 0;
spinYaw = 0;
launchY = (int) mc.thePlayer.posY;
lastSlot = mc.thePlayer.inventory.currentItem;
slot = mc.thePlayer.inventory.currentItem;
if (autoDisableSpeedValue.get() && LiquidBounce.moduleManager.getModule(Speed.class).getState()) {
LiquidBounce.moduleManager.getModule(Speed.class).setState(false);
LiquidBounce.hud.addNotification(new Notification("Speed is disabled to prevent flags/errors.", Notification.Type.WARNING));
}
faceBlock = false;
lastMS = System.currentTimeMillis();
}
//Send jump packets, bypasses Hypixel.
private void fakeJump() {
mc.thePlayer.isAirBorne = true;
mc.thePlayer.triggerAchievement(StatList.jumpStat);
}
/**
* Move player
*/
private void move(MotionEvent event) {
switch (towerModeValue.get().toLowerCase()) {
case "jump":
if (mc.thePlayer.onGround && timer.hasTimePassed(jumpDelayValue.get())) {
fakeJump();
mc.thePlayer.motionY = jumpMotionValue.get();
timer.reset();
}
break;
case "motion":
if (mc.thePlayer.onGround) {
fakeJump();
mc.thePlayer.motionY = 0.42D;
} else if (mc.thePlayer.motionY < 0.1D) mc.thePlayer.motionY = -0.3D;
break;
case "motiontp":
if (mc.thePlayer.onGround) {
fakeJump();
mc.thePlayer.motionY = 0.42D;
} else if (mc.thePlayer.motionY < 0.23D)
mc.thePlayer.setPosition(mc.thePlayer.posX, (int) mc.thePlayer.posY, mc.thePlayer.posZ);
break;
case "packet":
if (mc.thePlayer.onGround && timer.hasTimePassed(2)) {
fakeJump();
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,
mc.thePlayer.posY + 0.42D, mc.thePlayer.posZ, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,
mc.thePlayer.posY + 0.76D, mc.thePlayer.posZ, false));
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 1.08D, mc.thePlayer.posZ);
timer.reset();
}
break;
case "teleport":
if (teleportNoMotionValue.get())
mc.thePlayer.motionY = 0;
if ((mc.thePlayer.onGround || !teleportGroundValue.get()) && timer.hasTimePassed(teleportDelayValue.get())) {
fakeJump();
mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + teleportHeightValue.get(), mc.thePlayer.posZ);
timer.reset();
}
break;
case "stablemotion":
if (stableFakeJumpValue.get())
fakeJump();
mc.thePlayer.motionY = stableMotionValue.get();
if (stableStopValue.get() && towerDelayTimer.hasTimePassed(stableStopDelayValue.get())) {
mc.thePlayer.motionY = -0.28D;
towerDelayTimer.reset();
}
break;
case "constantmotion":
if (mc.thePlayer.onGround) {
fakeJump();
jumpGround = mc.thePlayer.posY;
mc.thePlayer.motionY = constantMotionValue.get();
}
if (mc.thePlayer.posY > jumpGround + constantMotionJumpGroundValue.get()) {
fakeJump();
mc.thePlayer.setPosition(mc.thePlayer.posX, (int) mc.thePlayer.posY, mc.thePlayer.posZ);
mc.thePlayer.motionY = constantMotionValue.get();
jumpGround = mc.thePlayer.posY;
}
break;
case "aac3.3.9":
if (mc.thePlayer.onGround) {
fakeJump();
mc.thePlayer.motionY = 0.4001;
}
mc.timer.timerSpeed = 1F;
if (mc.thePlayer.motionY < 0) {
mc.thePlayer.motionY -= 0.00000945;
mc.timer.timerSpeed = 1.6F;
}
break;
case "aac3.6.4":
if (mc.thePlayer.ticksExisted % 4 == 1) {
mc.thePlayer.motionY = 0.4195464;
mc.thePlayer.setPosition(mc.thePlayer.posX - 0.035, mc.thePlayer.posY, mc.thePlayer.posZ);
} else if (mc.thePlayer.ticksExisted % 4 == 0) {
mc.thePlayer.motionY = -0.5;
mc.thePlayer.setPosition(mc.thePlayer.posX + 0.035, mc.thePlayer.posY, mc.thePlayer.posZ);
}
break;
case "verus": // thanks ratted client
if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(0, -0.01, 0)).isEmpty() && mc.thePlayer.onGround && mc.thePlayer.isCollidedVertically) {
verusState = 0;
verusJumped = true;
}
if (verusJumped) {
MovementUtils.strafe();
switch (verusState) {
case 0:
fakeJump();
mc.thePlayer.motionY = 0.41999998688697815;
++verusState;
break;
case 1:
++verusState;
break;
case 2:
++verusState;
break;
case 3:
event.setOnGround(true);
mc.thePlayer.motionY = 0.0;
++verusState;
break;
case 4:
++verusState;
break;
}
verusJumped = false;
}
verusJumped = true;
break;
}
}
/**
* Update event
*
* @param event
*/
@EventTarget
public void onUpdate(final UpdateEvent event) {
if (towerActivation()) {
shouldGoDown = false;
mc.gameSettings.keyBindSneak.pressed = false;
mc.thePlayer.setSprinting(false);
return;
}
mc.timer.timerSpeed = timerValue.get();
shouldGoDown = downValue.get() && !sameYValue.get() && GameSettings.isKeyDown(mc.gameSettings.keyBindSneak) && getBlocksAmount() > 1;
if (shouldGoDown)
mc.gameSettings.keyBindSneak.pressed = false;
// scaffold custom speed if enabled
if (customSpeedValue.get())
MovementUtils.strafe(customMoveSpeedValue.get());
if (mc.thePlayer.onGround) {
final String mode = modeValue.get();
// Rewinside scaffold mode
if (mode.equalsIgnoreCase("Rewinside")) {
MovementUtils.strafe(0.2F);
mc.thePlayer.motionY = 0D;
}
// Smooth Zitter
if (zitterValue.get() && zitterModeValue.get().equalsIgnoreCase("smooth")) {
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindRight))
mc.gameSettings.keyBindRight.pressed = false;
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindLeft))
mc.gameSettings.keyBindLeft.pressed = false;
if (zitterTimer.hasTimePassed(zitterDelay.get())) {
zitterDirection = !zitterDirection;
zitterTimer.reset();
}
if (zitterDirection) {
mc.gameSettings.keyBindRight.pressed = true;
mc.gameSettings.keyBindLeft.pressed = false;
} else {
mc.gameSettings.keyBindRight.pressed = false;
mc.gameSettings.keyBindLeft.pressed = true;
}
}
// Eagle
if (eagleValue.get() && !shouldGoDown) {
double dif = 0.5D;
if (eagleEdgeDistanceValue.get() > 0) {
for (int i = 0; i < 4; i++) {
final BlockPos blockPos = new BlockPos(mc.thePlayer.posX + (i == 0 ? (-1) : i == 1 ? 1 : 0), mc.thePlayer.posY - (mc.thePlayer.posY == (int) mc.thePlayer.posY + 0.5D ? 0D : 1.0D), mc.thePlayer.posZ + (i == 2 ? -1 : i == 3 ? 1 : 0));
final PlaceInfo placeInfo = PlaceInfo.get(blockPos);
if (BlockUtils.isReplaceable(blockPos) && placeInfo != null) {
double calcDif = i > 1 ? mc.thePlayer.posZ - blockPos.getZ() : mc.thePlayer.posX - blockPos.getX();
calcDif -= 0.5D;
if (calcDif < 0)
calcDif *= -1;
calcDif -= 0.5D;
if (calcDif < dif)
dif = calcDif;
}
}
}
if (placedBlocksWithoutEagle >= blocksToEagleValue.get()) {
final boolean shouldEagle = mc.theWorld.getBlockState(
new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1D, mc.thePlayer.posZ)).getBlock() == Blocks.air || dif < eagleEdgeDistanceValue.get();
if (eagleSilentValue.get()) {
if (eagleSneaking != shouldEagle) {
mc.getNetHandler().addToSendQueue(
new C0BPacketEntityAction(mc.thePlayer, shouldEagle ?
C0BPacketEntityAction.Action.START_SNEAKING :
C0BPacketEntityAction.Action.STOP_SNEAKING)
);
}
eagleSneaking = shouldEagle;
} else
mc.gameSettings.keyBindSneak.pressed = shouldEagle;
placedBlocksWithoutEagle = 0;
} else
placedBlocksWithoutEagle++;
}
// Zitter
if (zitterValue.get() && zitterModeValue.get().equalsIgnoreCase("teleport")) {
MovementUtils.strafe(zitterSpeed.get());
final double yaw = Math.toRadians(mc.thePlayer.rotationYaw + (zitterDirection ? 90D : -90D));
mc.thePlayer.motionX -= Math.sin(yaw) * zitterStrength.get();
mc.thePlayer.motionZ += Math.cos(yaw) * zitterStrength.get();
zitterDirection = !zitterDirection;
}
}
if (sprintModeValue.get().equalsIgnoreCase("off") || (sprintModeValue.get().equalsIgnoreCase("ground") && !mc.thePlayer.onGround) || (sprintModeValue.get().equalsIgnoreCase("air") && mc.thePlayer.onGround)) {
mc.thePlayer.setSprinting(false);
}
//Auto Jump thingy
if (shouldGoDown) {
launchY = (int) mc.thePlayer.posY - 1;
} else if (!sameYValue.get()) {
if ((!autoJumpValue.get() && !(smartSpeedValue.get() && LiquidBounce.moduleManager.getModule(Speed.class).getState())) || GameSettings.isKeyDown(mc.gameSettings.keyBindJump) || mc.thePlayer.posY < launchY) launchY = (int) mc.thePlayer.posY;
if (autoJumpValue.get() && !LiquidBounce.moduleManager.getModule(Speed.class).getState() && MovementUtils.isMoving() && mc.thePlayer.onGround && mc.thePlayer.jumpTicks == 0) {
mc.thePlayer.jump();
mc.thePlayer.jumpTicks = 10;
}
}
}
@EventTarget
public void onPacket(final PacketEvent event) {
if (mc.thePlayer == null)
return;
final Packet<?> packet = event.getPacket();
// AutoBlock
if (packet instanceof C09PacketHeldItemChange) {
final C09PacketHeldItemChange packetHeldItemChange = (C09PacketHeldItemChange) packet;
slot = packetHeldItemChange.getSlotId();
}
}
@EventTarget
//took it from applyrotationstrafe XD. staticyaw comes from bestnub.
public void onStrafe(final StrafeEvent event) {
if (lookupRotation != null && rotationStrafeValue.get()) {
final int dif = (int) ((MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw - lookupRotation.getYaw() - 23.5F - 135) + 180) / 45);
final float yaw = lookupRotation.getYaw();
final float strafe = event.getStrafe();
final float forward = event.getForward();
final float friction = event.getFriction();
float calcForward = 0F;
float calcStrafe = 0F;
/*
Rotation Dif
7 \ 0 / 1 + + + + | -
6 + 2 -- F -- + S -
5 / 4 \ 3 - - - + | -
*/
switch (dif) {
case 0: {
calcForward = forward;
calcStrafe = strafe;
break;
}
case 1: {
calcForward += forward;
calcStrafe -= forward;
calcForward += strafe;
calcStrafe += strafe;
break;
}
case 2: {
calcForward = strafe;
calcStrafe = -forward;
break;
}
case 3: {
calcForward -= forward;
calcStrafe -= forward;
calcForward += strafe;
calcStrafe -= strafe;
break;
}
case 4: {
calcForward = -forward;
calcStrafe = -strafe;
break;
}
case 5: {
calcForward -= forward;
calcStrafe += forward;
calcForward -= strafe;
calcStrafe -= strafe;
break;
}
case 6: {
calcForward = -strafe;
calcStrafe = forward;
break;
}
case 7: {
calcForward += forward;
calcStrafe += forward;
calcForward -= strafe;
calcStrafe += strafe;
break;
}
}
if (calcForward > 1f || calcForward < 0.9f && calcForward > 0.3f || calcForward < -1f || calcForward > -0.9f && calcForward < -0.3f) {
calcForward *= 0.5f;
}
if (calcStrafe > 1f || calcStrafe < 0.9f && calcStrafe > 0.3f || calcStrafe < -1f || calcStrafe > -0.9f && calcStrafe < -0.3f) {
calcStrafe *= 0.5f;
}
float f = calcStrafe * calcStrafe + calcForward * calcForward;
if (f >= 1.0E-4F) {
f = MathHelper.sqrt_float(f);
if (f < 1.0F)
f = 1.0F;
f = friction / f;
calcStrafe *= f;
calcForward *= f;
final float yawSin = MathHelper.sin((float) (yaw * Math.PI / 180F));
final float yawCos = MathHelper.cos((float) (yaw * Math.PI / 180F));
mc.thePlayer.motionX += calcStrafe * yawCos - calcForward * yawSin;
mc.thePlayer.motionZ += calcForward * yawCos + calcStrafe * yawSin;
}
event.cancelEvent();
}
}
private boolean shouldPlace() {
boolean placeWhenAir = placeConditionValue.get().equalsIgnoreCase("air");
boolean placeWhenFall = placeConditionValue.get().equalsIgnoreCase("falldown");
boolean placeWhenNegativeMotion = placeConditionValue.get().equalsIgnoreCase("negativemotion");
boolean alwaysPlace = placeConditionValue.get().equalsIgnoreCase("always");
return towerActivation() || alwaysPlace || (placeWhenAir && !mc.thePlayer.onGround) || (placeWhenFall && mc.thePlayer.fallDistance > 0) || (placeWhenNegativeMotion && mc.thePlayer.motionY < 0);
}
@EventTarget
public void onMotion(final MotionEvent event) {
// XZReducer
mc.thePlayer.motionX *= xzMultiplier.get();
mc.thePlayer.motionZ *= xzMultiplier.get();
// Lock Rotation
if (rotationsValue.get() && keepRotationValue.get() && lockRotation != null) {
if (rotationModeValue.get().equalsIgnoreCase("spin")) {
spinYaw += speenSpeedValue.get();
spinYaw = MathHelper.wrapAngleTo180_float(spinYaw);
speenRotation = new Rotation(spinYaw, speenPitchValue.get());
RotationUtils.setTargetRotation(speenRotation);
} else if (lockRotation != null)
RotationUtils.setTargetRotation(RotationUtils.limitAngleChange(RotationUtils.serverRotation, lockRotation, RandomUtils.nextFloat(minTurnSpeed.get(), maxTurnSpeed.get())));
}
final String mode = modeValue.get();
final EventState eventState = event.getEventState();
// i think patches should be here instead
for (int i = 0; i < 8; i++) {
if (mc.thePlayer.inventory.mainInventory[i] != null
&& mc.thePlayer.inventory.mainInventory[i].stackSize <= 0)
mc.thePlayer.inventory.mainInventory[i] = null;
}
if ((!rotationsValue.get() || noHitCheckValue.get() || faceBlock) && placeModeValue.get().equalsIgnoreCase(eventState.getStateName()) && !towerActivation()) {
place(false);
}
if (eventState == EventState.PRE && !towerActivation()) {
if (!shouldPlace() || (!autoBlockMode.get().equalsIgnoreCase("Off") ? InventoryUtils.findAutoBlockBlock() == -1 : mc.thePlayer.getHeldItem() == null ||
!(mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock)))
return;
findBlock(mode.equalsIgnoreCase("expand") && !towerActivation());
}
if (targetPlace == null) {
if (placeableDelay.get())
delayTimer.reset();
}
if (!towerActivation()) {
verusState = 0;
towerPlace = null;
return;
}
mc.timer.timerSpeed = towerTimerValue.get();
if (noMoveOnlyValue.get() && noMoveFreezeValue.get())
mc.thePlayer.motionX = mc.thePlayer.motionZ = 0;
if (towerPlaceModeValue.get().equalsIgnoreCase(eventState.getStateName())) place(true);
if (eventState == EventState.PRE) {
towerPlace = null;
timer.update();
final boolean isHeldItemBlock = mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock;
if (InventoryUtils.findAutoBlockBlock() != -1 || isHeldItemBlock) {
launchY = (int)mc.thePlayer.posY;
if (towerModeValue.get().equalsIgnoreCase("verus") || !stopWhenBlockAbove.get() || BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX,
mc.thePlayer.posY + 2, mc.thePlayer.posZ)) instanceof BlockAir) {
move(event);
}
final BlockPos blockPos = new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1D, mc.thePlayer.posZ);
if (mc.theWorld.getBlockState(blockPos).getBlock() instanceof BlockAir) {
if (search(blockPos, true, true) && rotationsValue.get()) {
final VecRotation vecRotation = RotationUtils.faceBlock(blockPos);
if (vecRotation != null) {
RotationUtils.setTargetRotation(RotationUtils.limitAngleChange(RotationUtils.serverRotation, vecRotation.getRotation(), RandomUtils.nextFloat(minTurnSpeed.get(), maxTurnSpeed.get())));
towerPlace.setVec3(vecRotation.getVec());
}
}
}
}
}
}
/**
* Search for new target block
*/
private void findBlock(final boolean expand) {
final BlockPos blockPosition = shouldGoDown ? (mc.thePlayer.posY == (int) mc.thePlayer.posY + 0.5D ? new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 0.6D, mc.thePlayer.posZ)
: new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 0.6, mc.thePlayer.posZ).down()) :
(!towerActivation() && (sameYValue.get() || ((autoJumpValue.get() || (smartSpeedValue.get() && LiquidBounce.moduleManager.getModule(Speed.class).getState())) && !GameSettings.isKeyDown(mc.gameSettings.keyBindJump))) && launchY <= mc.thePlayer.posY ? (new BlockPos(mc.thePlayer.posX, launchY - 1, mc.thePlayer.posZ)) :
(mc.thePlayer.posY == (int) mc.thePlayer.posY + 0.5D ? new BlockPos(mc.thePlayer)
: new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ).down()));
if (!expand && (!BlockUtils.isReplaceable(blockPosition) || search(blockPosition, !shouldGoDown, false)))
return;
if (expand) {
double yaw = Math.toRadians(mc.thePlayer.rotationYaw);
int x = omniDirectionalExpand.get() ? (int) Math.round(-Math.sin(yaw)) : mc.thePlayer.getHorizontalFacing().getDirectionVec().getX();
int z = omniDirectionalExpand.get() ? (int) Math.round(Math.cos(yaw)) : mc.thePlayer.getHorizontalFacing().getDirectionVec().getZ();
for (int i = 0; i < expandLengthValue.get(); i++) {
if (search(blockPosition.add(x * i, 0, z * i), false, false))
return;
}
} else if (searchValue.get()) {
for (int x = -1; x <= 1; x++)
for (int z = -1; z <= 1; z++)
if (search(blockPosition.add(x, 0, z), !shouldGoDown, false))
return;
}
}
/**
* Place target block
*/
private void place(boolean towerActive) {
if ((towerActive ? towerPlace : targetPlace) == null) {
if (placeableDelay.get())
delayTimer.reset();
return;
}
if (!towerActivation() && (!delayTimer.hasTimePassed(delay) || (smartDelay.get() && mc.rightClickDelayTimer > 0) || ((sameYValue.get() || ((autoJumpValue.get() || (smartSpeedValue.get() && LiquidBounce.moduleManager.getModule(Speed.class).getState())) && !GameSettings.isKeyDown(mc.gameSettings.keyBindJump))) && launchY - 1 != (int) (towerActive ? towerPlace : targetPlace).getVec3().yCoord)))
return;
int blockSlot = -1;
ItemStack itemStack = mc.thePlayer.getHeldItem();
if (mc.thePlayer.getHeldItem() == null || !(mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock)) {
if (autoBlockMode.get().equalsIgnoreCase("Off"))
return;
blockSlot = InventoryUtils.findAutoBlockBlock();
if (blockSlot == -1)
return;
if (autoBlockMode.get().equalsIgnoreCase("Spoof")) {
mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(blockSlot - 36));
itemStack = mc.thePlayer.inventoryContainer.getSlot(blockSlot).getStack();
} else {
mc.thePlayer.inventory.currentItem = blockSlot - 36;
mc.playerController.updateController();
}
}
// blacklist check
if (itemStack != null && itemStack.getItem() != null && itemStack.getItem() instanceof ItemBlock) {
Block block = ((ItemBlock)itemStack.getItem()).getBlock();
if (InventoryUtils.BLOCK_BLACKLIST.contains(block) || !block.isFullCube() || itemStack.stackSize <= 0) return;
}
if (mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, itemStack, (towerActive ? towerPlace : targetPlace).getBlockPos(),
(towerActive ? towerPlace : targetPlace).getEnumFacing(), (towerActive ? towerPlace : targetPlace).getVec3())) {
delayTimer.reset();
delay = (!placeableDelay.get() ? 0L : TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get()));
if (mc.thePlayer.onGround) {
final float modifier = speedModifierValue.get();
mc.thePlayer.motionX *= modifier;
mc.thePlayer.motionZ *= modifier;
}
if (swingValue.get())
mc.thePlayer.swingItem();
else
mc.getNetHandler().addToSendQueue(new C0APacketAnimation());
}
// Reset
if (towerActive)
this.towerPlace = null;
else
this.targetPlace = null;
if (!stayAutoBlock.get() && blockSlot >= 0 && !autoBlockMode.get().equalsIgnoreCase("Switch"))
mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));
}
/**
* Disable scaffold module
*/
@Override
public void onDisable() {
if (mc.thePlayer == null) return;
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) {
mc.gameSettings.keyBindSneak.pressed = false;
if (eagleSneaking)
mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));
}
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindRight))
mc.gameSettings.keyBindRight.pressed = false;
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindLeft))
mc.gameSettings.keyBindLeft.pressed = false;
lockRotation = null;
lookupRotation = null;
mc.timer.timerSpeed = 1F;
shouldGoDown = false;
faceBlock = false;
if (lastSlot != mc.thePlayer.inventory.currentItem && autoBlockMode.get().equalsIgnoreCase("switch")) {
mc.thePlayer.inventory.currentItem = lastSlot;
mc.playerController.updateController();
}
if (slot != mc.thePlayer.inventory.currentItem && autoBlockMode.get().equalsIgnoreCase("spoof"))
mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));
}
/**
* Entity movement event
*
* @param event
*/
@EventTarget
public void onMove(final MoveEvent event) {
if (!safeWalkValue.get() || shouldGoDown)
return;
if (airSafeValue.get() || mc.thePlayer.onGround)
event.setSafeWalk(true);
}
@EventTarget
public void onJump(final JumpEvent event) {
if (towerActivation())
event.cancelEvent();
}
/**
* Scaffold visuals
*
* @param event
*/
@EventTarget
public void onRender2D(final Render2DEvent event) {
progress = (float) (System.currentTimeMillis() - lastMS) / 100F;
if (progress >= 1) progress = 1;
String counterMode = counterDisplayValue.get();
final ScaledResolution scaledResolution = new ScaledResolution(mc);
final String info = getBlocksAmount() + " blocks";
int infoWidth = Fonts.fontSFUI40.getStringWidth(info);
int infoWidth2 = Fonts.minecraftFont.getStringWidth(getBlocksAmount()+"");
if (counterMode.equalsIgnoreCase("simple")) {
Fonts.minecraftFont.drawString(getBlocksAmount()+"", scaledResolution.getScaledWidth() / 2 - (infoWidth2 / 2) - 1, scaledResolution.getScaledHeight() / 2 - 36, 0xFF000000, false);
Fonts.minecraftFont.drawString(getBlocksAmount()+"", scaledResolution.getScaledWidth() / 2 - (infoWidth2 / 2) + 1, scaledResolution.getScaledHeight() / 2 - 36, 0xFF000000, false);
Fonts.minecraftFont.drawString(getBlocksAmount()+"", scaledResolution.getScaledWidth() / 2 - (infoWidth2 / 2), scaledResolution.getScaledHeight() / 2 - 35, 0xFF000000, false);
Fonts.minecraftFont.drawString(getBlocksAmount()+"", scaledResolution.getScaledWidth() / 2 - (infoWidth2 / 2), scaledResolution.getScaledHeight() / 2 - 37, 0xFF000000, false);
Fonts.minecraftFont.drawString(getBlocksAmount()+"", scaledResolution.getScaledWidth() / 2 - (infoWidth2 / 2), scaledResolution.getScaledHeight() / 2 - 36, -1, false);
}
if (counterMode.equalsIgnoreCase("advanced")) {
boolean canRenderStack = (slot >= 0 && slot < 9 && mc.thePlayer.inventory.mainInventory[slot] != null && mc.thePlayer.inventory.mainInventory[slot].getItem() != null && mc.thePlayer.inventory.mainInventory[slot].getItem() instanceof ItemBlock);
if (blurValue.get())
BlurUtils.blurArea(scaledResolution.getScaledWidth() / 2 - (infoWidth / 2) - 4, scaledResolution.getScaledHeight() / 2 - 39, scaledResolution.getScaledWidth() / 2 + (infoWidth / 2) + 4, scaledResolution.getScaledHeight() / 2 - (canRenderStack ? 5 : 26), blurStrength.get());
RenderUtils.drawRect(scaledResolution.getScaledWidth() / 2 - (infoWidth / 2) - 4, scaledResolution.getScaledHeight() / 2 - 40, scaledResolution.getScaledWidth() / 2 + (infoWidth / 2) + 4, scaledResolution.getScaledHeight() / 2 - 39, (getBlocksAmount() > 1 ? 0xFFFFFFFF : 0xFFFF1010));
RenderUtils.drawRect(scaledResolution.getScaledWidth() / 2 - (infoWidth / 2) - 4, scaledResolution.getScaledHeight() / 2 - 39, scaledResolution.getScaledWidth() / 2 + (infoWidth / 2) + 4, scaledResolution.getScaledHeight() / 2 - 26, 0xA0000000);
if (canRenderStack) {
RenderUtils.drawRect(scaledResolution.getScaledWidth() / 2 - (infoWidth / 2) - 4, scaledResolution.getScaledHeight() / 2 - 26, scaledResolution.getScaledWidth() / 2 + (infoWidth / 2) + 4, scaledResolution.getScaledHeight() / 2 - 5, 0xA0000000);
GlStateManager.pushMatrix();
GlStateManager.translate(scaledResolution.getScaledWidth() / 2 - 8, scaledResolution.getScaledHeight() / 2 - 25, scaledResolution.getScaledWidth() / 2 - 8);
renderItemStack(mc.thePlayer.inventory.mainInventory[slot], 0, 0);
GlStateManager.popMatrix();
}
GlStateManager.resetColor();
Fonts.fontSFUI40.drawCenteredString(info, scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 2 - 36, -1);
}
if (counterMode.equalsIgnoreCase("sigma")) {
GlStateManager.translate(0, -14F - (progress * 4F), 0);
//GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glColor4f(0.15F, 0.15F, 0.15F, progress);
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
GL11.glVertex2d(scaledResolution.getScaledWidth() / 2 - 3, scaledResolution.getScaledHeight() - 60);
GL11.glVertex2d(scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() - 57);
GL11.glVertex2d(scaledResolution.getScaledWidth() / 2 + 3, scaledResolution.getScaledHeight() - 60);
GL11.glEnd();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
//GL11.glPopMatrix();
RenderUtils.drawRoundedRect(scaledResolution.getScaledWidth() / 2 - (infoWidth / 2) - 4, scaledResolution.getScaledHeight() - 60, scaledResolution.getScaledWidth() / 2 + (infoWidth / 2) + 4, scaledResolution.getScaledHeight() - 74, 2F, new Color(0.15F, 0.15F, 0.15F, progress).getRGB());
GlStateManager.resetColor();
Fonts.fontSFUI35.drawCenteredString(info, scaledResolution.getScaledWidth() / 2 + 0.1F, scaledResolution.getScaledHeight() - 70, new Color(1F, 1F, 1F, 0.8F * progress).getRGB(), false);
GlStateManager.translate(0, 14F + (progress * 4F), 0);
}
if (counterMode.equalsIgnoreCase("novoline")) {
if (slot >= 0 && slot < 9 && mc.thePlayer.inventory.mainInventory[slot] != null && mc.thePlayer.inventory.mainInventory[slot].getItem() != null && mc.thePlayer.inventory.mainInventory[slot].getItem() instanceof ItemBlock) {
//RenderUtils.drawRect(scaledResolution.getScaledWidth() / 2 - (infoWidth / 2) - 4, scaledResolution.getScaledHeight() / 2 - 26, scaledResolution.getScaledWidth() / 2 + (infoWidth / 2) + 4, scaledResolution.getScaledHeight() / 2 - 5, 0xA0000000);
GlStateManager.pushMatrix();
GlStateManager.translate(scaledResolution.getScaledWidth() / 2 - 22, scaledResolution.getScaledHeight() / 2 + 16, scaledResolution.getScaledWidth() / 2 - 22);
renderItemStack(mc.thePlayer.inventory.mainInventory[slot], 0, 0);
GlStateManager.popMatrix();
}
GlStateManager.resetColor();
Fonts.minecraftFont.drawString(getBlocksAmount()+" blocks", scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 2 + 20, -1, true);
}
}
private void renderItemStack(ItemStack stack, int x, int y) {
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
RenderHelper.enableGUIStandardItemLighting();
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x, y);
mc.getRenderItem().renderItemOverlays(mc.fontRendererObj, stack, x, y);
RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
/**
* Scaffold visuals
*
* @param event
*/
@EventTarget
public void onRender3D(final Render3DEvent event) {
if (!markValue.get())
return;
double yaw = Math.toRadians(mc.thePlayer.rotationYaw);
int x = omniDirectionalExpand.get() ? (int) Math.round(-Math.sin(yaw)) : mc.thePlayer.getHorizontalFacing().getDirectionVec().getX();
int z = omniDirectionalExpand.get() ? (int) Math.round(Math.cos(yaw)) : mc.thePlayer.getHorizontalFacing().getDirectionVec().getZ();
for (int i = 0; i < ((modeValue.get().equalsIgnoreCase("Expand") && !towerActivation()) ? expandLengthValue.get() + 1 : 2); i++) {
final BlockPos blockPos = new BlockPos(
mc.thePlayer.posX + x * i,
(!towerActivation()
&& (sameYValue.get() ||
((autoJumpValue.get() ||
(smartSpeedValue.get() && LiquidBounce.moduleManager.getModule(Speed.class).getState()))
&& !GameSettings.isKeyDown(mc.gameSettings.keyBindJump)))
&& launchY <= mc.thePlayer.posY) ? launchY - 1 : (mc.thePlayer.posY - (mc.thePlayer.posY == (int) mc.thePlayer.posY + 0.5D ? 0D : 1.0D) - (shouldGoDown ? 1D : 0)),
mc.thePlayer.posZ + z * i);
final PlaceInfo placeInfo = PlaceInfo.get(blockPos);
if (BlockUtils.isReplaceable(blockPos) && placeInfo != null) {
RenderUtils.drawBlockBox(blockPos, new Color(redValue.get(), greenValue.get(), blueValue.get(), alphaValue.get()), false);
break;
}
}
}
private boolean search(final BlockPos blockPosition, final boolean checks) {
return search(blockPosition, checks, false);
}
/**
* Search for placeable block
*
* @param blockPosition pos
* @param checks visible
* @return
*/
private boolean search(final BlockPos blockPosition, final boolean checks, boolean towerActive) {
faceBlock = false;
if (!BlockUtils.isReplaceable(blockPosition))
return false;
final boolean staticYawMode = rotationLookupValue.get().equalsIgnoreCase("AAC")
|| (rotationLookupValue.get().equalsIgnoreCase("same") && (rotationModeValue.get().equalsIgnoreCase("AAC")
|| (rotationModeValue.get().contains("Static") && !rotationModeValue.get().equalsIgnoreCase("static3"))));
final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY + mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);
PlaceRotation placeRotation = null;
for (final EnumFacing side : StaticStorage.facings()) {
final BlockPos neighbor = blockPosition.offset(side);
if (!BlockUtils.canBeClicked(neighbor))
continue;
final Vec3 dirVec = new Vec3(side.getDirectionVec());
for (double xSearch = 0.1D; xSearch < 0.9D; xSearch += 0.1D) {
for (double ySearch = 0.1D; ySearch < 0.9D; ySearch += 0.1D) {
for (double zSearch = 0.1D; zSearch < 0.9D; zSearch += 0.1D) {
final Vec3 posVec = new Vec3(blockPosition).addVector(xSearch, ySearch, zSearch);
final double distanceSqPosVec = eyesPos.squareDistanceTo(posVec);
final Vec3 hitVec = posVec.add(new Vec3(dirVec.xCoord * 0.5, dirVec.yCoord * 0.5, dirVec.zCoord * 0.5));
if (checks && (eyesPos.squareDistanceTo(hitVec) > 18D || distanceSqPosVec > eyesPos.squareDistanceTo(posVec.add(dirVec)) || mc.theWorld.rayTraceBlocks(eyesPos, hitVec, false, true, false) != null))
continue;
// face block
for (int i = 0; i < (staticYawMode ? 2 : 1); i++) {
final double diffX = staticYawMode && i == 0 ? 0 : hitVec.xCoord - eyesPos.xCoord;
final double diffY = hitVec.yCoord - eyesPos.yCoord;
final double diffZ = staticYawMode && i == 1 ? 0 : hitVec.zCoord - eyesPos.zCoord;
final double diffXZ = MathHelper.sqrt_double(diffX * diffX + diffZ * diffZ);
Rotation rotation = new Rotation(
MathHelper.wrapAngleTo180_float((float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F),
MathHelper.wrapAngleTo180_float((float) -Math.toDegrees(Math.atan2(diffY, diffXZ)))
);
lookupRotation = rotation;
if (rotationModeValue.get().equalsIgnoreCase("static") && (keepRotOnJumpValue.get() || !mc.gameSettings.keyBindJump.isKeyDown()))
rotation = new Rotation(MovementUtils.getScaffoldRotation(mc.thePlayer.rotationYaw, mc.thePlayer.moveStrafing), staticPitchValue.get());
if ((rotationModeValue.get().equalsIgnoreCase("static2") || rotationModeValue.get().equalsIgnoreCase("static3")) && (keepRotOnJumpValue.get() || !mc.gameSettings.keyBindJump.isKeyDown()))
rotation = new Rotation(rotation.getYaw(), staticPitchValue.get());
if (rotationModeValue.get().equalsIgnoreCase("custom") && (keepRotOnJumpValue.get() || !mc.gameSettings.keyBindJump.isKeyDown()))
rotation = new Rotation(mc.thePlayer.rotationYaw + customYawValue.get(), customPitchValue.get());
if (rotationModeValue.get().equalsIgnoreCase("spin") && speenRotation != null && (keepRotOnJumpValue.get() || !mc.gameSettings.keyBindJump.isKeyDown()))
rotation = speenRotation;
final Vec3 rotationVector = RotationUtils.getVectorForRotation(rotationLookupValue.get().equalsIgnoreCase("same") ? rotation : lookupRotation);
final Vec3 vector = eyesPos.addVector(rotationVector.xCoord * 4, rotationVector.yCoord * 4, rotationVector.zCoord * 4);
final MovingObjectPosition obj = mc.theWorld.rayTraceBlocks(eyesPos, vector, false, false, true);
if (!(obj.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && obj.getBlockPos().equals(neighbor)))
continue;
if (placeRotation == null || RotationUtils.getRotationDifference(rotation) < RotationUtils.getRotationDifference(placeRotation.getRotation()))
placeRotation = new PlaceRotation(new PlaceInfo(neighbor, side.getOpposite(), hitVec), rotation);
}
}
}
}
}
if (placeRotation == null) return false;
if (rotationsValue.get()) {
if (minTurnSpeed.get() < 180) {
final Rotation limitedRotation = RotationUtils.limitAngleChange(RotationUtils.serverRotation, placeRotation.getRotation(), RandomUtils.nextFloat(minTurnSpeed.get(), maxTurnSpeed.get()));
if ((int)(10 * MathHelper.wrapAngleTo180_float(limitedRotation.getYaw())) == (int)(10 * MathHelper.wrapAngleTo180_float(placeRotation.getRotation().getYaw()))
&& (int)(10 * MathHelper.wrapAngleTo180_float(limitedRotation.getPitch())) == (int)(10 * MathHelper.wrapAngleTo180_float(placeRotation.getRotation().getPitch()))) {
RotationUtils.setTargetRotation(placeRotation.getRotation(), keepLengthValue.get());
lockRotation = placeRotation.getRotation();
faceBlock = true;
} else {
RotationUtils.setTargetRotation(limitedRotation, keepLengthValue.get());
lockRotation = limitedRotation;
faceBlock = false;
}
} else {
RotationUtils.setTargetRotation(placeRotation.getRotation(), keepLengthValue.get());
lockRotation = placeRotation.getRotation();
faceBlock = true;
}
if (rotationLookupValue.get().equalsIgnoreCase("same"))
lookupRotation = lockRotation;
}
if (towerActive)
towerPlace = placeRotation.getPlaceInfo();
else
targetPlace = placeRotation.getPlaceInfo();
return true;
}
/**
* @return hotbar blocks amount
*/
private int getBlocksAmount() {
int amount = 0;
for (int i = 36; i < 45; i++) {
final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
if (itemStack != null && itemStack.getItem() instanceof ItemBlock) {
Block block = ((ItemBlock)itemStack.getItem()).getBlock();
if (!InventoryUtils.BLOCK_BLACKLIST.contains(block) && block.isFullCube()) amount += itemStack.stackSize;
}
}
return amount;
}
@Override
public String getTag() {
return (towerActivation()) ? "Tower, " + towerPlaceModeValue.get() : placeModeValue.get();
}
} | 59,474 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
AutoHypixel.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/AutoHypixel.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.misc;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.event.MotionEvent;
import net.ccbluex.liquidbounce.event.Render2DEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.ui.font.Fonts;
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.utils.render.Stencil;
import net.ccbluex.liquidbounce.utils.AnimationUtils;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.ListValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.ccbluex.liquidbounce.value.TextValue;
import net.minecraft.network.play.server.S02PacketChat;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.MathHelper;
import java.awt.Color;
import java.text.DecimalFormat;
import java.util.List;
@ModuleInfo(name = "AutoHypixel", spacedName = "Auto Hypixel", description = "Automatically send you into random games on Hypixel after you die or win.", category = ModuleCategory.MISC)
public class AutoHypixel extends Module {
private final IntegerValue delayValue = new IntegerValue("Delay", 0, 0, 5000, "ms");
private final BoolValue autoGGValue = new BoolValue("Auto-GG", true);
private final TextValue ggMessageValue = new TextValue("GG-Message", "gOoD GaMe", () -> autoGGValue.get());
private final BoolValue checkValue = new BoolValue("CheckGameMode", true);
private final BoolValue antiSnipeValue = new BoolValue("AntiSnipe", true);
private final BoolValue renderValue = new BoolValue("Render", true);
private final ListValue modeValue = new ListValue("Mode", new String[]{"Solo", "Teams", "Ranked", "Mega"}, "Solo");
private final ListValue soloTeamsValue = new ListValue("Solo/Teams-Mode", new String[]{"Normal", "Insane"}, "Insane", () -> modeValue.get().equalsIgnoreCase("solo") || modeValue.get().equalsIgnoreCase("teams"));
private final ListValue megaValue = new ListValue("Mega-Mode", new String[]{"Normal", "Doubles"}, "Normal", () -> modeValue.get().equalsIgnoreCase("mega"));
private final MSTimer timer = new MSTimer();
public static String gameMode = "NONE";
public boolean shouldChangeGame, useOtherWord = false;
private final DecimalFormat dFormat = new DecimalFormat("0.0");
private float posY = -20F;
private final String[] strings = new String[]{
"1st Killer -",
"1st Place -",
"died! Want to play again? Click here!",
"won! Want to play again? Click here!",
"- Damage Dealt -",
"1st -",
"Winning Team -",
"Winners:",
"Winner:",
"Winning Team:",
" win the game!",
"1st Place:",
"Last team standing!",
"Winner #1 (",
"Top Survivors",
"Winners -"};
@Override
public void onEnable() {
shouldChangeGame = false;
timer.reset();
}
@EventTarget
public void onRender2D(Render2DEvent event) {
if (checkValue.get() && !gameMode.toLowerCase().contains("skywars"))
return;
ScaledResolution sc = new ScaledResolution(mc);
float middleX = sc.getScaledWidth() / 2F;
String detail = "Next game in " + dFormat.format((float)timer.hasTimeLeft(delayValue.get()) / 1000F) + "s...";
float middleWidth = Fonts.font40.getStringWidth(detail) / 2F;
float strength = MathHelper.clamp_float((float) timer.hasTimeLeft(delayValue.get()) / delayValue.get(), 0F, 1F);
float wid = strength * (5F + middleWidth) * 2F;
posY = AnimationUtils.animate(shouldChangeGame ? 10F : -20F, posY, 0.25F * 0.05F * RenderUtils.deltaTime);
if (!renderValue.get() || posY < -15)
return;
Stencil.write(true);
RenderUtils.drawRoundedRect(middleX - 5F - middleWidth, posY, middleX + 5F + middleWidth, posY + 15F, 3F, 0xA0000000);
Stencil.erase(true);
RenderUtils.drawRect(middleX - 5F - middleWidth, posY, middleX - 5F - middleWidth + wid, posY + 15F, new Color(0.4F, 0.8F, 0.4F, 0.35F).getRGB());
Stencil.dispose();
GlStateManager.resetColor();
Fonts.fontSFUI40.drawString(detail, middleX - middleWidth - 1F, posY + 4F, -1);
}
@EventTarget
public void onMotion(MotionEvent event) {
if ((!checkValue.get() || gameMode.toLowerCase().contains("skywars")) && shouldChangeGame && timer.hasTimePassed(delayValue.get())) {
mc.thePlayer.sendChatMessage("/play "+modeValue.get().toLowerCase()+(modeValue.get().equalsIgnoreCase("ranked")?"_normal":modeValue.get().equalsIgnoreCase("mega")?"_"+megaValue.get().toLowerCase():"_"+soloTeamsValue.get().toLowerCase()));
shouldChangeGame = false;
}
if (!shouldChangeGame) timer.reset();
}
@EventTarget
public void onPacket(PacketEvent event) {
if (event.getPacket() instanceof S02PacketChat) {
S02PacketChat chat = (S02PacketChat) event.getPacket();
if (chat.getChatComponent() != null) {
if (antiSnipeValue.get() && chat.getChatComponent().getUnformattedText().contains("Sending you to")) {
event.cancelEvent();
return;
}
for (String s : strings)
if (chat.getChatComponent().getUnformattedText().contains(s)) {
//LiquidBounce.hud.addNotification(new Notification("Attempting to send you to the next game in "+dFormat.format((double)delayValue.get()/1000D)+"s.",1000L));
if (autoGGValue.get() && chat.getChatComponent().getUnformattedText().contains(strings[3])) mc.thePlayer.sendChatMessage(ggMessageValue.get());
shouldChangeGame = true;
break;
}
}
}
}
}
| 6,640 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
NameProtect.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/NameProtect.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.misc;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.TextEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.file.configs.FriendsConfig;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.ccbluex.liquidbounce.utils.misc.StringUtils;
import net.ccbluex.liquidbounce.utils.render.ColorUtils;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.TextValue;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.util.ResourceLocation;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
@ModuleInfo(name = "NameProtect", spacedName = "Name Protect", description = "Changes player names client-side.", category = ModuleCategory.MISC)
public class NameProtect extends Module {
private final TextValue fakeNameValue = new TextValue("FakeName", "&cMe");
private final TextValue allFakeNameValue = new TextValue("AllPlayersFakeName", "Censored");
public final BoolValue selfValue = new BoolValue("Yourself", true);
public final BoolValue tagValue = new BoolValue("Tag", false);
public final BoolValue allPlayersValue = new BoolValue("AllPlayers", false);
public final BoolValue skinProtectValue = new BoolValue("SkinProtect", false);
public final BoolValue customSkinValue = new BoolValue("CustomSkin", false, () -> skinProtectValue.get());
public ResourceLocation skinImage;
public NameProtect() {
File skinFile = new File(LiquidBounce.fileManager.dir, "cskin.png");
if (skinFile.isFile()) {
try {
final BufferedImage bufferedImage = ImageIO.read(new FileInputStream(skinFile));
if (bufferedImage == null)
return;
skinImage = new ResourceLocation(LiquidBounce.CLIENT_NAME.toLowerCase() + "/cskin.png");
mc.getTextureManager().loadTexture(skinImage, new DynamicTexture(bufferedImage));
ClientUtils.getLogger().info("Loaded custom skin for NameProtect.");
} catch (final Exception e) {
ClientUtils.getLogger().error("Failed to load custom skin.", e);
}
}
}
@EventTarget
public void onText(final TextEvent event) {
if (mc.thePlayer == null || event.getText().contains("§8[§9§l" + LiquidBounce.CLIENT_NAME + "§8] §3") || event.getText().startsWith("/") || event.getText().startsWith(LiquidBounce.commandManager.getPrefix() + ""))
return;
for (final FriendsConfig.Friend friend : LiquidBounce.fileManager.friendsConfig.getFriends())
event.setText(StringUtils.replace(event.getText(), friend.getPlayerName(), ColorUtils.translateAlternateColorCodes(friend.getAlias()) + "§f"));
event.setText(StringUtils.replace(
event.getText(),
mc.thePlayer.getName(),
(selfValue.get() ? (tagValue.get() ? StringUtils.injectAirString(mc.thePlayer.getName()) + " §7(§r" + ColorUtils.translateAlternateColorCodes(fakeNameValue.get() + "§r§7)") : ColorUtils.translateAlternateColorCodes(fakeNameValue.get()) + "§r") : mc.thePlayer.getName())
));
if(allPlayersValue.get())
for(final NetworkPlayerInfo playerInfo : mc.getNetHandler().getPlayerInfoMap())
event.setText(StringUtils.replace(event.getText(), playerInfo.getGameProfile().getName(), ColorUtils.translateAlternateColorCodes(allFakeNameValue.get()) + "§f"));
}
}
| 4,069 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
AntiBot.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/AntiBot.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.misc;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.AttackEvent;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.event.UpdateEvent;
import net.ccbluex.liquidbounce.event.WorldEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notification;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.ccbluex.liquidbounce.utils.EntityUtils;
import net.ccbluex.liquidbounce.utils.render.ColorUtils;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.ccbluex.liquidbounce.value.FloatValue;
import net.ccbluex.liquidbounce.value.ListValue;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S0BPacketAnimation;
import net.minecraft.network.play.server.S14PacketEntity;
import net.minecraft.network.play.server.S38PacketPlayerListItem;
import net.minecraft.network.play.server.S41PacketServerDifficulty;
import net.minecraft.world.WorldSettings;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.LinkedList;
import java.util.Map;
import java.util.stream.Stream;
@ModuleInfo(name = "AntiBot", spacedName = "Anti Bot", description = "Prevents KillAura from attacking AntiCheat bots.", category = ModuleCategory.MISC)
public class AntiBot extends Module {
private final BoolValue czechHekValue = new BoolValue("CzechMatrix", false);
private final BoolValue czechHekPingCheckValue = new BoolValue("PingCheck", true, () -> czechHekValue.get());
private final BoolValue czechHekGMCheckValue = new BoolValue("GamemodeCheck", true, () -> czechHekValue.get());
private final BoolValue tabValue = new BoolValue("Tab", true);
private final ListValue tabModeValue = new ListValue("TabMode", new String[] {"Equals", "Contains"}, "Contains");
private final BoolValue entityIDValue = new BoolValue("EntityID", true);
private final BoolValue colorValue = new BoolValue("Color", false);
private final BoolValue livingTimeValue = new BoolValue("LivingTime", false);
private final IntegerValue livingTimeTicksValue = new IntegerValue("LivingTimeTicks", 40, 1, 200);
private final BoolValue groundValue = new BoolValue("Ground", true);
private final BoolValue airValue = new BoolValue("Air", false);
private final BoolValue invalidGroundValue = new BoolValue("InvalidGround", true);
private final BoolValue swingValue = new BoolValue("Swing", false);
private final BoolValue healthValue = new BoolValue("Health", false);
private final BoolValue invalidHealthValue = new BoolValue("InvalidHealth", false);
private final FloatValue minHealthValue = new FloatValue("MinHealth", 0F, 0F, 100F);
private final FloatValue maxHealthValue = new FloatValue("MaxHealth", 20F, 0F, 100F);
private final BoolValue derpValue = new BoolValue("Derp", true);
private final BoolValue wasInvisibleValue = new BoolValue("WasInvisible", false);
private final BoolValue armorValue = new BoolValue("Armor", false);
private final BoolValue pingValue = new BoolValue("Ping", false);
private final BoolValue needHitValue = new BoolValue("NeedHit", false);
private final BoolValue duplicateInWorldValue = new BoolValue("DuplicateInWorld", false);
private final BoolValue drvcValue = new BoolValue("ReverseCheck", true, () -> duplicateInWorldValue.get());
private final BoolValue duplicateInTabValue = new BoolValue("DuplicateInTab", false);
private final BoolValue experimentalNPCDetection = new BoolValue("ExperimentalNPCDetection", false);
private final BoolValue illegalName = new BoolValue("IllegalName", false);
private final BoolValue removeFromWorld = new BoolValue("RemoveFromWorld", false);
private final IntegerValue removeIntervalValue = new IntegerValue("Remove-Interval", 20, 1, 100, " tick");
private final BoolValue debugValue = new BoolValue("Debug", false);
private final List<Integer> ground = new ArrayList<>();
private final List<Integer> air = new ArrayList<>();
private final Map<Integer, Integer> invalidGround = new HashMap<>();
private final List<Integer> swing = new ArrayList<>();
private final List<Integer> invisible = new ArrayList<>();
private final List<Integer> hitted = new ArrayList<>();
private boolean wasAdded = (mc.thePlayer != null);
@Override
public void onDisable() {
clearAll();
super.onDisable();
}
@EventTarget
public void onUpdate(final UpdateEvent event) {
if(mc.thePlayer == null || mc.theWorld == null)
return;
if (removeFromWorld.get() && mc.thePlayer.ticksExisted > 0 && mc.thePlayer.ticksExisted % removeIntervalValue.get() == 0){
List<EntityPlayer> ent = new ArrayList<>();
for (EntityPlayer entity : mc.theWorld.playerEntities) {
if (entity != mc.thePlayer && isBot(entity))
ent.add(entity);
}
if (ent.isEmpty()) return;
for (EntityPlayer e : ent) {
mc.theWorld.removeEntity(e);
if (debugValue.get()) ClientUtils.displayChatMessage("§7[§a§lAnti Bot§7] §fRemoved §r"+e.getName()+" §fdue to it being a bot.");
}
}
}
@EventTarget
public void onPacket(final PacketEvent event) {
if(mc.thePlayer == null || mc.theWorld == null)
return;
final Packet<?> packet = event.getPacket();
if (czechHekValue.get()) {
if (packet instanceof S41PacketServerDifficulty) wasAdded = false;
if (packet instanceof S38PacketPlayerListItem) {
final S38PacketPlayerListItem packetListItem = (S38PacketPlayerListItem) event.getPacket();
final S38PacketPlayerListItem.AddPlayerData data = packetListItem.getEntries().get(0);
if (data.getProfile() != null && data.getProfile().getName() != null) {
if (!wasAdded)
wasAdded = data.getProfile().getName().equals(mc.thePlayer.getName());
else if (!mc.thePlayer.isSpectator() && !mc.thePlayer.capabilities.allowFlying && (!czechHekPingCheckValue.get() || data.getPing() != 0) && (!czechHekGMCheckValue.get() || data.getGameMode() != WorldSettings.GameType.NOT_SET)) {
event.cancelEvent();
if (debugValue.get()) ClientUtils.displayChatMessage("§7[§a§lAnti Bot/§6Matrix§7] §fPrevented §r"+data.getProfile().getName()+" §ffrom spawning.");
}
}
}
}
if(packet instanceof S14PacketEntity) {
final S14PacketEntity packetEntity = (S14PacketEntity) event.getPacket();
final Entity entity = packetEntity.getEntity(mc.theWorld);
if(entity instanceof EntityPlayer) {
if(packetEntity.getOnGround() && !ground.contains(entity.getEntityId()))
ground.add(entity.getEntityId());
if(!packetEntity.getOnGround() && !air.contains(entity.getEntityId()))
air.add(entity.getEntityId());
if(packetEntity.getOnGround()) {
if(entity.prevPosY != entity.posY)
invalidGround.put(entity.getEntityId(), invalidGround.getOrDefault(entity.getEntityId(), 0) + 1);
}else{
final int currentVL = invalidGround.getOrDefault(entity.getEntityId(), 0) / 2;
if (currentVL <= 0)
invalidGround.remove(entity.getEntityId());
else
invalidGround.put(entity.getEntityId(), currentVL);
}
if(entity.isInvisible() && !invisible.contains(entity.getEntityId()))
invisible.add(entity.getEntityId());
}
}
if(packet instanceof S0BPacketAnimation) {
final S0BPacketAnimation packetAnimation = (S0BPacketAnimation) event.getPacket();
final Entity entity = mc.theWorld.getEntityByID(packetAnimation.getEntityID());
if(entity instanceof EntityLivingBase && packetAnimation.getAnimationType() == 0 && !swing.contains(entity.getEntityId()))
swing.add(entity.getEntityId());
}
}
@EventTarget
public void onAttack(final AttackEvent e) {
final Entity entity = e.getTargetEntity();
if(entity instanceof EntityLivingBase && !hitted.contains(entity.getEntityId()))
hitted.add(entity.getEntityId());
}
@EventTarget
public void onWorld(final WorldEvent event) {
clearAll();
}
private void clearAll() {
hitted.clear();
swing.clear();
ground.clear();
invalidGround.clear();
invisible.clear();
}
public static boolean isBot(final EntityLivingBase entity) {
if (!(entity instanceof EntityPlayer) || entity == mc.thePlayer)
return false;
final AntiBot antiBot = LiquidBounce.moduleManager.getModule(AntiBot.class);
if (antiBot == null || !antiBot.getState())
return false;
if (antiBot.experimentalNPCDetection.get() && (entity.getDisplayName().getUnformattedText().toLowerCase().contains("npc") || entity.getDisplayName().getUnformattedText().toLowerCase().contains("cit-")))
return true;
if (antiBot.illegalName.get() && (entity.getName().contains(" ") || entity.getDisplayName().getUnformattedText().contains(" ")))
return true;
if (antiBot.colorValue.get() && !entity.getDisplayName().getFormattedText()
.replace("§r", "").contains("§"))
return true;
if (antiBot.livingTimeValue.get() && entity.ticksExisted < antiBot.livingTimeTicksValue.get())
return true;
if (antiBot.groundValue.get() && !antiBot.ground.contains(entity.getEntityId()))
return true;
if (antiBot.airValue.get() && !antiBot.air.contains(entity.getEntityId()))
return true;
if(antiBot.swingValue.get() && !antiBot.swing.contains(entity.getEntityId()))
return true;
if (antiBot.invalidHealthValue.get() && entity.getHealth() == Double.NaN)
return true;
if(antiBot.healthValue.get() && (entity.getHealth() > antiBot.maxHealthValue.get() || entity.getHealth() < antiBot.minHealthValue.get()))
return true;
if(antiBot.entityIDValue.get() && (entity.getEntityId() >= 1000000000 || entity.getEntityId() <= -1))
return true;
if(antiBot.derpValue.get() && (entity.rotationPitch > 90F || entity.rotationPitch < -90F))
return true;
if(antiBot.wasInvisibleValue.get() && antiBot.invisible.contains(entity.getEntityId()))
return true;
if(antiBot.armorValue.get()) {
final EntityPlayer player = (EntityPlayer) entity;
if (player.inventory.armorInventory[0] == null && player.inventory.armorInventory[1] == null &&
player.inventory.armorInventory[2] == null && player.inventory.armorInventory[3] == null)
return true;
}
if(antiBot.pingValue.get()) {
EntityPlayer player = (EntityPlayer) entity;
if(mc.getNetHandler().getPlayerInfo(player.getUniqueID()) != null && mc.getNetHandler().getPlayerInfo(player.getUniqueID()).getResponseTime() == 0)
return true;
}
if(antiBot.needHitValue.get() && !antiBot.hitted.contains(entity.getEntityId()))
return true;
if(antiBot.invalidGroundValue.get() && antiBot.invalidGround.getOrDefault(entity.getEntityId(), 0) >= 10)
return true;
if(antiBot.tabValue.get()) {
final boolean equals = antiBot.tabModeValue.get().equalsIgnoreCase("Equals");
final String targetName = ColorUtils.stripColor(entity.getDisplayName().getFormattedText());
if (targetName != null) {
for (final NetworkPlayerInfo networkPlayerInfo : mc.getNetHandler().getPlayerInfoMap()) {
final String networkName = ColorUtils.stripColor(EntityUtils.getName(networkPlayerInfo));
if (networkName == null)
continue;
if (equals ? targetName.equals(networkName) : targetName.contains(networkName))
return false;
}
return true;
}
}
if (antiBot.duplicateInWorldValue.get()) {
if (antiBot.drvcValue.get() && reverse(mc.theWorld.loadedEntityList.stream())
.filter(currEntity -> currEntity instanceof EntityPlayer && ((EntityPlayer) currEntity)
.getDisplayNameString().equals(((EntityPlayer) currEntity).getDisplayNameString()))
.count() > 1)
return true;
if (mc.theWorld.loadedEntityList.stream()
.filter(currEntity -> currEntity instanceof EntityPlayer && ((EntityPlayer) currEntity)
.getDisplayNameString().equals(((EntityPlayer) currEntity).getDisplayNameString()))
.count() > 1)
return true;
}
if (antiBot.duplicateInTabValue.get()) {
if (mc.getNetHandler().getPlayerInfoMap().stream()
.filter(networkPlayer -> entity.getName().equals(ColorUtils.stripColor(EntityUtils.getName(networkPlayer))))
.count() > 1)
return true;
}
return entity.getName().isEmpty() || entity.getName().equals(mc.thePlayer.getName());
}
private static <T> Stream<T> reverse(Stream<T> stream) { // from Don't Panic!
LinkedList<T> stack = new LinkedList<>();
stream.forEach(stack::push);
return stack.stream();
}
}
| 14,681 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
BanChecker.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/BanChecker.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.misc;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notification;
import net.ccbluex.liquidbounce.utils.misc.HttpUtils;
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
@ModuleInfo(name = "BanChecker", spacedName = "Ban Checker", description = "Checks for ban on Hypixel every minute and alert you if there is any.", category = ModuleCategory.MISC)
public class BanChecker extends Module {
// no u
private static String API_PUNISHMENT = aB("68747470733a2f2f6170692e706c616e636b652e696f2f6879706978656c2f76312f70756e6973686d656e745374617473");
public final BoolValue alertValue = new BoolValue("Alert", true);
public final BoolValue serverCheckValue = new BoolValue("ServerCheck", true);
public final IntegerValue alertTimeValue = new IntegerValue("Alert-Time", 10, 1, 50, " seconds");
public static int WATCHDOG_BAN_LAST_MIN = 0;
public static int LAST_TOTAL_STAFF = -1;
public static int STAFF_BAN_LAST_MIN = 0;
private String checkTag = "Idle...";
public BanChecker() {
(new Thread("Hypixel-BanChecker") {
public void run() {
MSTimer checkTimer = new MSTimer();
while (true) {
if (checkTimer.hasTimePassed(60000L)) {
try {
String apiContent = HttpUtils.get(API_PUNISHMENT);
final JsonObject jsonObject = new JsonParser().parse(apiContent).getAsJsonObject();
if (jsonObject.get("success").getAsBoolean() && jsonObject.has("record")) {
JsonObject objectAPI = jsonObject.get("record").getAsJsonObject();
WATCHDOG_BAN_LAST_MIN = objectAPI.get("watchdog_lastMinute").getAsInt();
int staffBanTotal = objectAPI.get("staff_total").getAsInt();
if (staffBanTotal < LAST_TOTAL_STAFF)
staffBanTotal = LAST_TOTAL_STAFF;
if (LAST_TOTAL_STAFF == -1)
LAST_TOTAL_STAFF = staffBanTotal;
else {
STAFF_BAN_LAST_MIN = staffBanTotal - LAST_TOTAL_STAFF;
LAST_TOTAL_STAFF = staffBanTotal;
}
checkTag = STAFF_BAN_LAST_MIN+"";
if (LiquidBounce.moduleManager.getModule(BanChecker.class).getState() && alertValue.get() && mc.thePlayer != null && (!serverCheckValue.get() || isOnHypixel()))
if (STAFF_BAN_LAST_MIN > 0)
LiquidBounce.hud.addNotification(new Notification("Staffs banned " + STAFF_BAN_LAST_MIN + " players in the last minute!", STAFF_BAN_LAST_MIN > 3 ? Notification.Type.ERROR : Notification.Type.WARNING, alertTimeValue.get() * 1000L));
else
LiquidBounce.hud.addNotification(new Notification("Staffs didn't ban any player in the last minute.", Notification.Type.SUCCESS, alertTimeValue.get() * 1000L));
// watchdog ban doesnt matter, open an issue if you want to add it.
}
} catch (Exception e) {
e.printStackTrace();
if (LiquidBounce.moduleManager.getModule(BanChecker.class).getState() && alertValue.get() && mc.thePlayer != null && (!serverCheckValue.get() || isOnHypixel()))
LiquidBounce.hud.addNotification(new Notification("An error has occurred.", Notification.Type.ERROR, 1000L));
}
checkTimer.reset();
}
}
}
}).start();
}
public boolean isOnHypixel() {
return !mc.isIntegratedServerRunning() && mc.getCurrentServerData().serverIP.contains("hypixel.net");
}
public static String aB(String str) { // :trole:
String result = new String();char[] charArray = str.toCharArray();for(int i = 0; i < charArray.length; i=i+2) {String st = ""+charArray[i]+""+charArray[i+1];char ch = (char)Integer.parseInt(st, 16);result = result + ch;};return result;
}
@Override
public String getTag() {
return checkTag;
}
}
| 5,307 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Patcher.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/Patcher.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.misc;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.UpdateEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.value.*;
import org.lwjgl.opengl.Display;
import java.util.HashMap;
@ModuleInfo(name = "Patcher", description = "improving your experience without bloatware, aka. Essential.", category = ModuleCategory.MISC)
public class Patcher extends Module {
public static final BoolValue noHitDelay = new BoolValue("NoHitDelay", false);
public static final BoolValue tabOutReduceFPS = new BoolValue("ReduceFPSWhenNoFocus", false);
public static final BoolValue jumpPatch = new BoolValue("JumpFix", true);
public static final BoolValue chatPosition = new BoolValue("ChatPosition1.12", true);
public static final BoolValue silentNPESP = new BoolValue("SilentNPE-SpawnPlayer", true);
public static final BoolValue thirdPersonCrosshair = new BoolValue("ThirdPersonCrosshair", true);
public int oldFPS = 0;
@Override
public void onEnable() {
oldFPS = mc.gameSettings.limitFramerate;
}
@EventTarget
public void onUpdate(UpdateEvent event) {
if(tabOutReduceFPS.get()) {
if (!Display.isActive()) {
mc.gameSettings.limitFramerate = 3;
} else if (Display.isActive()){
mc.gameSettings.limitFramerate = oldFPS;
}
}
}
}
| 1,859 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Spammer.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/Spammer.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.misc;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.UpdateEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.utils.misc.RandomUtils;
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
import net.ccbluex.liquidbounce.utils.timer.TimeUtils;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.ccbluex.liquidbounce.value.TextValue;
import java.util.Random;
@ModuleInfo(name = "Spammer", description = "Spams the chat with a given message.", category = ModuleCategory.MISC)
public class Spammer extends Module {
private final IntegerValue maxDelayValue = new IntegerValue("MaxDelay", 1000, 0, 5000, "ms") {
@Override
protected void onChanged(final Integer oldValue, final Integer newValue) {
final int minDelayValueObject = minDelayValue.get();
if(minDelayValueObject > newValue)
set(minDelayValueObject);
delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());
}
};
private final IntegerValue minDelayValue = new IntegerValue("MinDelay", 500, 0, 5000, "ms") {
@Override
protected void onChanged(final Integer oldValue, final Integer newValue) {
final int maxDelayValueObject = maxDelayValue.get();
if(maxDelayValueObject < newValue)
set(maxDelayValueObject);
delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());
}
};
private final TextValue messageValue = new TextValue("Message", "Example text");
private final BoolValue customValue = new BoolValue("Custom", false);
private final TextValue blankText = new TextValue("Placeholder guide", "", () -> customValue.get());
private final TextValue guideFloat = new TextValue("%f", "Random float", () -> customValue.get());
private final TextValue guideInt = new TextValue("%i", "Random integer (max length 10000)", () -> customValue.get());
private final TextValue guideString = new TextValue("%s", "Random string (max length 9)", () -> customValue.get());
private final TextValue guideShortString = new TextValue("%ss", "Random short string (max length 5)", () -> customValue.get());
private final TextValue guideLongString = new TextValue("%ls", "Random long string (max length 16)", () -> customValue.get());
private final MSTimer msTimer = new MSTimer();
private long delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());
@EventTarget
public void onUpdate(UpdateEvent event) {
if(msTimer.hasTimePassed(delay)) {
mc.thePlayer.sendChatMessage(customValue.get() ? replace(messageValue.get()) : messageValue.get() + " >" + RandomUtils.randomString(5 + new Random().nextInt(5)) + "<");
msTimer.reset();
delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());
}
}
private String replace(String object) {
final Random r = new Random();
while(object.contains("%f"))
object = object.substring(0, object.indexOf("%f")) + r.nextFloat() + object.substring(object.indexOf("%f") + "%f".length());
while(object.contains("%i"))
object = object.substring(0, object.indexOf("%i")) + r.nextInt(10000) + object.substring(object.indexOf("%i") + "%i".length());
while(object.contains("%s"))
object = object.substring(0, object.indexOf("%s")) + RandomUtils.randomString(r.nextInt(8) + 1) + object.substring(object.indexOf("%s") + "%s".length());
while(object.contains("%ss"))
object = object.substring(0, object.indexOf("%ss")) + RandomUtils.randomString(r.nextInt(4) + 1) + object.substring(object.indexOf("%ss") + "%ss".length());
while(object.contains("%ls"))
object = object.substring(0, object.indexOf("%ls")) + RandomUtils.randomString(r.nextInt(15) + 1) + object.substring(object.indexOf("%ls") + "%ls".length());
return object;
}
}
| 4,515 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
PingSpoof.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/PingSpoof.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.exploit;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.event.UpdateEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.utils.timer.TimeUtils;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C00PacketKeepAlive;
import net.minecraft.network.play.client.C16PacketClientStatus;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@ModuleInfo(name = "PingSpoof", spacedName = "Ping Spoof", description = "Spoofs your ping to a given value.", category = ModuleCategory.EXPLOIT)
public class PingSpoof extends Module {
private final IntegerValue maxDelayValue = new IntegerValue("MaxDelay", 1000, 0, 5000, "ms") {
@Override
protected void onChanged(final Integer oldValue, final Integer newValue) {
final int minDelayValue = PingSpoof.this.minDelayValue.get();
if(minDelayValue > newValue)
set(minDelayValue);
}
};
private final IntegerValue minDelayValue = new IntegerValue("MinDelay", 500, 0, 5000, "ms") {
@Override
protected void onChanged(final Integer oldValue, final Integer newValue) {
final int maxDelayValue = PingSpoof.this.maxDelayValue.get();
if(maxDelayValue < newValue)
set(maxDelayValue);
}
};
private final HashMap<Packet<?>, Long> packetsMap = new HashMap<>();
@Override
public void onDisable() {
packetsMap.clear();
}
@EventTarget
public void onPacket(final PacketEvent event) {
final Packet packet = event.getPacket();
if ((packet instanceof C00PacketKeepAlive || packet instanceof C16PacketClientStatus) && !(mc.thePlayer.isDead || mc.thePlayer.getHealth() <= 0) && !packetsMap.containsKey(packet)) {
event.cancelEvent();
synchronized(packetsMap) {
packetsMap.put(packet, System.currentTimeMillis() + TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get()));
}
}
}
@EventTarget(ignoreCondition = true)
public void onUpdate(final UpdateEvent event) {
try {
synchronized(packetsMap) {
for(final Iterator<Map.Entry<Packet<?>, Long>> iterator = packetsMap.entrySet().iterator(); iterator.hasNext(); ) {
final Map.Entry<Packet<?>, Long> entry = iterator.next();
if(entry.getValue() < System.currentTimeMillis()) {
mc.getNetHandler().addToSendQueue(entry.getKey());
iterator.remove();
}
}
}
}catch(final Throwable t) {
t.printStackTrace();
}
}
}
| 3,252 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Phase.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/Phase.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.exploit;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.*;
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.*;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.utils.MovementUtils;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.ccbluex.liquidbounce.utils.PacketUtils;
import net.ccbluex.liquidbounce.utils.block.BlockUtils;
import net.ccbluex.liquidbounce.utils.timer.TickTimer;
import net.ccbluex.liquidbounce.value.ListValue;
import net.minecraft.block.BlockAir;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.init.Blocks;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C0BPacketEntityAction;
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
@ModuleInfo(name = "Phase", description = "Allows you to walk through blocks.", category = ModuleCategory.EXPLOIT)
public class Phase extends Module {
public final ListValue modeValue = new ListValue("Mode", new String[] {
"Vanilla",
"Skip",
"Spartan",
"Clip",
"AAC3.5.0",
"AACv4",
"Mineplex",
"Redesky",
"SmartVClip"
}, "Vanilla");
private final TickTimer tickTimer = new TickTimer();
private boolean mineplexClip, noRot;
private TickTimer mineplexTickTimer = new TickTimer();
private int stage;
@Override
public void onEnable(){
stage = 0;
if (modeValue.get().equalsIgnoreCase("aacv4"))
mc.timer.timerSpeed = 0.1F;
}
@Override
public void onDisable(){
if (modeValue.get().equalsIgnoreCase("aacv4"))
mc.timer.timerSpeed = 1F;
}
@EventTarget
public void onUpdate(final UpdateEvent event) {
if(modeValue.get().equalsIgnoreCase("aacv4")){
switch (stage) {
case 1: {
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY + -0.00000001, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, false));
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, false));
break;
}
case 3:{
this.setState(false);
break;
}
}
stage++;
return;
}else if(modeValue.get().equalsIgnoreCase("redesky")){
switch (stage) {
case 0:{
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY - 0.00000001, mc.thePlayer.posZ);
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY - 0.00000001, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, false));
break;
}
case 1:{
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ);
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, false));
break;
}
case 3:{
this.setState(false);
}
}
stage++;
return;
}
final boolean isInsideBlock = BlockUtils.collideBlockIntersects(mc.thePlayer.getEntityBoundingBox(), block -> !(block instanceof BlockAir));
if (isInsideBlock && !modeValue.get().equalsIgnoreCase("Mineplex") && !modeValue.get().equalsIgnoreCase("SmartVClip")) {
mc.thePlayer.noClip = true;
mc.thePlayer.motionY = 0D;
mc.thePlayer.onGround = true;
}
final NetHandlerPlayClient netHandlerPlayClient = mc.getNetHandler();
switch(modeValue.get().toLowerCase()) {
case "vanilla": {
if(!mc.thePlayer.onGround || !tickTimer.hasTimePassed(2) || !mc.thePlayer.isCollidedHorizontally || !(!isInsideBlock || mc.thePlayer.isSneaking()))
break;
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(0.5D, 0, 0.5D, true));
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.2D, mc.thePlayer.posZ, true));
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(0.5D, 0, 0.5D, true));
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 0.5D, mc.thePlayer.posY, mc.thePlayer.posZ + 0.5D, true));
final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);
final double x = -Math.sin(yaw) * 0.04D;
final double z = Math.cos(yaw) * 0.04D;
mc.thePlayer.setPosition(mc.thePlayer.posX + x, mc.thePlayer.posY, mc.thePlayer.posZ + z);
tickTimer.reset();
break;
}
case "skip": {
if(!mc.thePlayer.onGround || !tickTimer.hasTimePassed(2) || !mc.thePlayer.isCollidedHorizontally || !(!isInsideBlock || mc.thePlayer.isSneaking()))
break;
final double direction = MovementUtils.getDirection();
final double posX = -Math.sin(direction) * 0.3;
final double posZ = Math.cos(direction) * 0.3;
for(int i = 0; i < 3; ++i) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.06, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + posX * i, mc.thePlayer.posY, mc.thePlayer.posZ + posZ * i, true));
}
mc.thePlayer.setEntityBoundingBox(mc.thePlayer.getEntityBoundingBox().offset(posX, 0.0D, posZ));
mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX + posX, mc.thePlayer.posY, mc.thePlayer.posZ + posZ);
tickTimer.reset();
break;
}
case "spartan": {
if(!mc.thePlayer.onGround || !tickTimer.hasTimePassed(2) || !mc.thePlayer.isCollidedHorizontally || !(!isInsideBlock || mc.thePlayer.isSneaking()))
break;
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(0.5D, 0, 0.5D, true));
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - 0.2D, mc.thePlayer.posZ, true));
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(0.5D, 0, 0.5D, true));
netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 0.5D, mc.thePlayer.posY, mc.thePlayer.posZ + 0.5D, true));
final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);
final double x = -Math.sin(yaw) * 0.04D;
final double z = Math.cos(yaw) * 0.04D;
mc.thePlayer.setPosition(mc.thePlayer.posX + x, mc.thePlayer.posY, mc.thePlayer.posZ + z);
tickTimer.reset();
break;
}
case "clip": {
if(!tickTimer.hasTimePassed(2) || !mc.thePlayer.isCollidedHorizontally || !(!isInsideBlock || mc.thePlayer.isSneaking()))
break;
final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);
final double oldX = mc.thePlayer.posX;
final double oldZ = mc.thePlayer.posZ;
for(int i = 1; i <= 10; i++) {
final double x = -Math.sin(yaw) * i;
final double z = Math.cos(yaw) * i;
if(BlockUtils.getBlock(new BlockPos(oldX + x, mc.thePlayer.posY, oldZ + z)) instanceof BlockAir && BlockUtils.getBlock(new BlockPos(oldX + x, mc.thePlayer.posY + 1, oldZ + z)) instanceof BlockAir) {
mc.thePlayer.setPosition(oldX + x, mc.thePlayer.posY, oldZ + z);
break;
}
}
tickTimer.reset();
break;
}
case "aac3.5.0": {
if(!tickTimer.hasTimePassed(2) || !mc.thePlayer.isCollidedHorizontally || !(!isInsideBlock || mc.thePlayer.isSneaking()))
break;
final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);
final double oldX = mc.thePlayer.posX;
final double oldZ = mc.thePlayer.posZ;
final double x = -Math.sin(yaw);
final double z = Math.cos(yaw);
mc.thePlayer.setPosition(oldX + x, mc.thePlayer.posY, oldZ + z);
tickTimer.reset();
break;
}
case "smartvclip": {
boolean cageCollision = (mc.theWorld.getBlockState(new BlockPos(mc.thePlayer).up(3)).getBlock() != Blocks.air
&& mc.theWorld.getBlockState(new BlockPos(mc.thePlayer).down()).getBlock() != Blocks.air);
noRot = (mc.thePlayer.ticksExisted >= 0 && mc.thePlayer.ticksExisted <= 40 && cageCollision);
if (mc.thePlayer.ticksExisted >= 20 && mc.thePlayer.ticksExisted < 40 && cageCollision)
{
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - 4, mc.thePlayer.posZ, false));
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY - 4, mc.thePlayer.posZ);
}
break;
}
case "redesky": {
this.setState(false);
break;
}
case "redesky2": {
this.setState(false);
break;
}
}
tickTimer.update();
}
@EventTarget
public void onBlockBB(final BlockBBEvent event) {
if (mc.thePlayer != null && BlockUtils.collideBlockIntersects(mc.thePlayer.getEntityBoundingBox(), block -> !(block instanceof BlockAir)) && event.getBoundingBox() != null && event.getBoundingBox().maxY > mc.thePlayer.getEntityBoundingBox().minY && !modeValue.get().equalsIgnoreCase("Mineplex") && !modeValue.get().equalsIgnoreCase("SmartVClip")) {
final AxisAlignedBB axisAlignedBB = event.getBoundingBox();
event.setBoundingBox(new AxisAlignedBB(axisAlignedBB.maxX, mc.thePlayer.getEntityBoundingBox().minY, axisAlignedBB.maxZ, axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ));
}
}
@EventTarget
public void onPacket(final PacketEvent event) {
final Packet<?> packet = event.getPacket();
if(packet instanceof C03PacketPlayer) {
final C03PacketPlayer packetPlayer = (C03PacketPlayer) packet;
if(modeValue.get().equalsIgnoreCase("AAC3.5.0")) {
final float yaw = (float) MovementUtils.getDirection();
packetPlayer.x = packetPlayer.x - MathHelper.sin(yaw) * 0.00000001D;
packetPlayer.z = packetPlayer.z + MathHelper.cos(yaw) * 0.00000001D;
}
if (modeValue.get().equalsIgnoreCase("SmartVClip") && noRot && packetPlayer.rotating)
event.cancelEvent();
}
if (packet instanceof C0BPacketEntityAction && modeValue.get().equalsIgnoreCase("SmartVClip") && noRot)
event.cancelEvent();
}
@EventTarget
private void onMove(final MoveEvent event) {
if (modeValue.get().equalsIgnoreCase("mineplex")) {
if (mc.thePlayer.isCollidedHorizontally)
mineplexClip = true;
if (!mineplexClip)
return;
mineplexTickTimer.update();
event.setX(0);
event.setZ(0);
if (mineplexTickTimer.hasTimePassed(3)) {
mineplexTickTimer.reset();
mineplexClip = false;
} else if (mineplexTickTimer.hasTimePassed(1)) {
final double offset = mineplexTickTimer.hasTimePassed(2) ? 1.6D : 0.06D;
final double direction = MovementUtils.getDirection();
mc.thePlayer.setPosition(mc.thePlayer.posX + (-Math.sin(direction) * offset), mc.thePlayer.posY, mc.thePlayer.posZ + (Math.cos(direction) * offset));
}
}
if (modeValue.get().equalsIgnoreCase("SmartVClip") && noRot)
event.zeroXZ();
}
@EventTarget
public void onPushOut(PushOutEvent event) {
event.cancelEvent();
}
@EventTarget
public void onJump(JumpEvent event) {
if (modeValue.get().equalsIgnoreCase("SmartVClip") && noRot) event.cancelEvent();
}
@Override
public String getTag() {
return modeValue.get();
}
}
| 14,553 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Plugins.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/Plugins.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.exploit;
import joptsimple.internal.Strings;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.event.UpdateEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.ccbluex.liquidbounce.utils.timer.TickTimer;
import net.minecraft.network.play.client.C14PacketTabComplete;
import net.minecraft.network.play.server.S3APacketTabComplete;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ModuleInfo(name = "Plugins", description = "Allows you to see which plugins the server is using.", category = ModuleCategory.EXPLOIT)
public class Plugins extends Module {
private final TickTimer tickTimer = new TickTimer();
@Override
public void onEnable() {
if(mc.thePlayer == null)
return;
mc.getNetHandler().addToSendQueue(new C14PacketTabComplete("/"));
tickTimer.reset();
}
@EventTarget
public void onUpdate(UpdateEvent event) {
tickTimer.update();
if(tickTimer.hasTimePassed(20)) {
ClientUtils.displayChatMessage("§cTimed out.");
tickTimer.reset();
setState(false);
}
}
@EventTarget
public void onPacket(PacketEvent event) {
if(event.getPacket() instanceof S3APacketTabComplete) {
final S3APacketTabComplete s3APacketTabComplete = (S3APacketTabComplete) event.getPacket();
final List<String> plugins = new ArrayList<>();
final String[] commands = s3APacketTabComplete.func_149630_c();
for(final String command1 : commands) {
final String[] command = command1.split(":");
if(command.length > 1) {
final String pluginName = command[0].replace("/", "");
if(!plugins.contains(pluginName))
plugins.add(pluginName);
}
}
Collections.sort(plugins);
if(!plugins.isEmpty())
ClientUtils.displayChatMessage("§aPlugins §7(§8" + plugins.size() + "§7): §c" + Strings.join(plugins.toArray(new String[0]), "§7, §c"));
else
ClientUtils.displayChatMessage("§cNo plugins found.");
setState(false);
tickTimer.reset();
}
}
}
| 2,789 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Teleport.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/Teleport.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.exploit;
import net.ccbluex.liquidbounce.event.*;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.ccbluex.liquidbounce.utils.MovementUtils;
import net.ccbluex.liquidbounce.utils.PathUtils;
import net.ccbluex.liquidbounce.utils.block.BlockUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.utils.timer.TickTimer;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.ListValue;
import net.minecraft.block.BlockAir;
import net.minecraft.block.BlockFence;
import net.minecraft.block.BlockSnow;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C0BPacketEntityAction;
import net.minecraft.network.play.client.C0BPacketEntityAction.Action;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.lwjgl.opengl.GL11.*;
@ModuleInfo(name = "Teleport", description = "Allows you to teleport around.", category = ModuleCategory.EXPLOIT)
public class Teleport extends Module {
private final BoolValue ignoreNoCollision = new BoolValue("IgnoreNoCollision", true);
private final ListValue modeValue = new ListValue("Mode", new String[] {"Blink", "Flag", "Rewinside", "OldRewinside", "Spoof", "Minesucht", "AAC3.5.0"}, "Blink");
private final ListValue buttonValue = new ListValue("Button", new String[] {"Left", "Right", "Middle"}, "Middle");
private final BoolValue requireSneak = new BoolValue("RequireSneak", true, () -> (modeValue.get().equalsIgnoreCase("blink") || modeValue.get().equalsIgnoreCase("flag")));
private final TickTimer flyTimer = new TickTimer();
private boolean hadGround;
private double fixedY;
private final List<Packet<?>> packets = new ArrayList<>();
private boolean disableLogger = false;
private boolean zitter = false;
private boolean doTeleport = false;
private boolean freeze = false;
private final TickTimer freezeTimer = new TickTimer();
private int delay;
private BlockPos endPos;
private MovingObjectPosition objectPosition;
@Override
public void onEnable() {
if(modeValue.get().equalsIgnoreCase("AAC3.5.0")) {
ClientUtils.displayChatMessage("§c>>> §a§lTeleport §fAAC 3.5.0 §c<<<");
ClientUtils.displayChatMessage("§cHow to teleport: §aPress " + buttonValue.get() + " mouse button.");
ClientUtils.displayChatMessage("§cHow to cancel teleport: §aDisable teleport module.");
}
}
@Override
public void onDisable() {
fixedY = 0D;
delay = 0;
mc.timer.timerSpeed = 1F;
endPos = null;
hadGround = false;
freeze = false;
disableLogger = false;
flyTimer.reset();
packets.clear();
super.onDisable();
}
@EventTarget
public void onUpdate(final UpdateEvent event) {
final int buttonIndex = Arrays.asList(buttonValue.getValues()).indexOf(buttonValue.get());
if(modeValue.get().equals("AAC3.5.0")) {
freezeTimer.update();
if(freeze && freezeTimer.hasTimePassed(40)) {
freezeTimer.reset();
freeze = false;
setState(false);
}
if(!flyTimer.hasTimePassed(60)) {
flyTimer.update();
if(mc.thePlayer.onGround) {
mc.thePlayer.jump();
}else{
MovementUtils.forward(zitter ? -0.21D : 0.21D);
zitter = !zitter;
}
hadGround = false;
return;
}
if(mc.thePlayer.onGround)
hadGround = true;
if(!hadGround)
return;
if(mc.thePlayer.onGround)
mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + 0.2D, mc.thePlayer.posZ);
final float vanillaSpeed = 2F;
mc.thePlayer.capabilities.isFlying = false;
mc.thePlayer.motionY = 0;
mc.thePlayer.motionX = 0;
mc.thePlayer.motionZ = 0;
if(mc.gameSettings.keyBindJump.isKeyDown())
mc.thePlayer.motionY += vanillaSpeed;
if(mc.gameSettings.keyBindSneak.isKeyDown())
mc.thePlayer.motionY -= vanillaSpeed;
MovementUtils.strafe(vanillaSpeed);
if(Mouse.isButtonDown(buttonIndex) && !doTeleport) {
mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY - 11, mc.thePlayer.posZ);
disableLogger = true;
packets.forEach(packet -> mc.getNetHandler().addToSendQueue(packet));
freezeTimer.reset();
freeze = true;
}
doTeleport = Mouse.isButtonDown(buttonIndex);
return;
}
if(mc.currentScreen == null && Mouse.isButtonDown(buttonIndex) && delay <= 0) {
endPos = objectPosition.getBlockPos();
if(BlockUtils.getBlock(endPos).getMaterial() == Material.air) {
endPos = null;
return;
}
ClientUtils.displayChatMessage("§7[§8§lTeleport§7] §3Position was set to §8" + endPos.getX() + "§3, §8" + ((BlockUtils.getBlock(objectPosition.getBlockPos()).getCollisionBoundingBox(mc.theWorld, objectPosition.getBlockPos(), BlockUtils.getBlock(objectPosition.getBlockPos()).getDefaultState()) == null ? endPos.getY() + BlockUtils.getBlock(endPos).getBlockBoundsMaxY() : BlockUtils.getBlock(objectPosition.getBlockPos()).getCollisionBoundingBox(mc.theWorld, objectPosition.getBlockPos(), BlockUtils.getBlock(objectPosition.getBlockPos()).getDefaultState()).maxY) + fixedY) + "§3, §8" + endPos.getZ());
delay = 6;
}
if(delay > 0)
--delay;
if(endPos != null) {
final double endX = (double) endPos.getX() + 0.5D;
final double endY = (BlockUtils.getBlock((objectPosition == null || objectPosition.getBlockPos() == null) ? endPos : objectPosition.getBlockPos())
.getCollisionBoundingBox(mc.theWorld, objectPosition.getBlockPos(), BlockUtils.getBlock(objectPosition.getBlockPos()).getDefaultState()) == null ? endPos.getY() + BlockUtils.getBlock(endPos).getBlockBoundsMaxY() : BlockUtils.getBlock(objectPosition.getBlockPos()).getCollisionBoundingBox(mc.theWorld, objectPosition.getBlockPos(), BlockUtils.getBlock(objectPosition.getBlockPos()).getDefaultState()).maxY) + fixedY;
final double endZ = (double) endPos.getZ() + 0.5D;
switch(modeValue.get().toLowerCase()) {
case "blink":
if(!requireSneak.get() || mc.thePlayer.isSneaking()) {
// Sneak
mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.STOP_SNEAKING));
// Teleport
PathUtils.findBlinkPath(endX, endY, endZ).forEach(vector3d -> {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vector3d.x, vector3d.y, vector3d.z, true));
mc.thePlayer.setPosition(endX, endY, endZ);
});
// Sneak
mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.START_SNEAKING));
// Notify
ClientUtils.displayChatMessage("§7[§8§lTeleport§7] §3You were teleported to §8" + endX + "§3, §8" + endY + "§3, §8" + endZ);
}
break;
case "flag":
if(!requireSneak.get() || mc.thePlayer.isSneaking()) {
// Sneak
mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.STOP_SNEAKING));
// Teleport
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 5D, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 0.5D, mc.thePlayer.posY, mc.thePlayer.posZ + 0.5D, true));
MovementUtils.forward(0.04D);
// Sneak
mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.START_SNEAKING));
// Notify
ClientUtils.displayChatMessage("§7[§8§lTeleport§7] §3You were teleported to §8" + endX + "§3, §8" + endY + "§3, §8" + endZ);
}
break;
case "rewinside":
mc.thePlayer.motionY = 0.1;
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.6D, mc.thePlayer.posZ, true));
if((int) mc.thePlayer.posX == (int) endX && (int) mc.thePlayer.posY == (int) endY && (int) mc.thePlayer.posZ == (int) endZ) {
ClientUtils.displayChatMessage("§7[§8§lTeleport§7] §3You were teleported to §8" + endX + "§3, §8" + endY + "§3, §8" + endZ);
endPos = null;
}else
ClientUtils.displayChatMessage("§7[§8§lTeleport§7] §3Teleport try...");
break;
case "oldrewinside":
mc.thePlayer.motionY = 0.1;
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
if((int) mc.thePlayer.posX == (int) endX && (int) mc.thePlayer.posY == (int) endY && (int) mc.thePlayer.posZ == (int) endZ) {
ClientUtils.displayChatMessage("§7[§8§lTeleport§7] §3You were teleported to §8" + endX + "§3, §8" + endY + "§3, §8" + endZ);
endPos = null;
}else
ClientUtils.displayChatMessage("§7[§8§lTeleport§7] §3Teleport try...");
MovementUtils.forward(0.04D);
break;
case "minesucht":
if(!mc.thePlayer.isSneaking())
break;
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));
ClientUtils.displayChatMessage("§7[§8§lTeleport§7] §3You were teleported to §8" + endX + "§3, §8" + endY + "§3, §8" + endZ);
break;
}
}
}
@EventTarget
public void onRender3D(final Render3DEvent event) {
if(modeValue.get().equals("AAC3.5.0"))
return;
final Vec3 lookVec = new Vec3(mc.thePlayer.getLookVec().xCoord * 300, mc.thePlayer.getLookVec().yCoord * 300, mc.thePlayer.getLookVec().zCoord * 300);
final Vec3 posVec = new Vec3(mc.thePlayer.posX, mc.thePlayer.posY + 1.62, mc.thePlayer.posZ);
objectPosition = mc.thePlayer.worldObj.rayTraceBlocks(posVec, posVec.add(lookVec), false, ignoreNoCollision.get(), false);
if (objectPosition == null || objectPosition.getBlockPos() == null)
return;
final BlockPos belowBlockPos = new BlockPos(objectPosition.getBlockPos().getX(), objectPosition.getBlockPos().getY() - 1, objectPosition.getBlockPos().getZ());
fixedY = BlockUtils.getBlock(objectPosition.getBlockPos()) instanceof BlockFence ? (mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(objectPosition.getBlockPos().getX() + 0.5D - mc.thePlayer.posX, objectPosition.getBlockPos().getY() + 1.5D - mc.thePlayer.posY, objectPosition.getBlockPos().getZ() + 0.5D - mc.thePlayer.posZ)).isEmpty() ? 0.5D : 0D) : BlockUtils.getBlock(belowBlockPos) instanceof BlockFence ? (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(objectPosition.getBlockPos().getX() + 0.5D - mc.thePlayer.posX, objectPosition.getBlockPos().getY() + 0.5D - mc.thePlayer.posY, objectPosition.getBlockPos().getZ() + 0.5D - mc.thePlayer.posZ)).isEmpty() || BlockUtils.getBlock(objectPosition.getBlockPos()).getCollisionBoundingBox(mc.theWorld, objectPosition.getBlockPos(), BlockUtils.getBlock(objectPosition.getBlockPos()).getDefaultState()) == null ? 0D : 0.5D - BlockUtils.getBlock(objectPosition.getBlockPos()).getBlockBoundsMaxY()) : BlockUtils.getBlock(objectPosition.getBlockPos()) instanceof BlockSnow ? BlockUtils.getBlock(objectPosition.getBlockPos()).getBlockBoundsMaxY() - 0.125D : 0D;
final int x = objectPosition.getBlockPos().getX();
final double y = (BlockUtils.getBlock(objectPosition.getBlockPos()).getCollisionBoundingBox(mc.theWorld, objectPosition.getBlockPos(), BlockUtils.getBlock(objectPosition.getBlockPos()).getDefaultState()) == null ? objectPosition.getBlockPos().getY() + BlockUtils.getBlock(objectPosition.getBlockPos()).getBlockBoundsMaxY() : BlockUtils.getBlock(objectPosition.getBlockPos()).getCollisionBoundingBox(mc.theWorld, objectPosition.getBlockPos(), BlockUtils.getBlock(objectPosition.getBlockPos()).getDefaultState()).maxY) - 1D + fixedY;
final int z = objectPosition.getBlockPos().getZ();
if(!(BlockUtils.getBlock(objectPosition.getBlockPos()) instanceof BlockAir)) {
final RenderManager renderManager = mc.getRenderManager();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glLineWidth(2F);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
RenderUtils.glColor(modeValue.get().equalsIgnoreCase("minesucht") && mc.thePlayer.getPosition().getY() != y + 1 ? new Color(255, 0, 0, 90) : !mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(x + 0.5D - mc.thePlayer.posX, y + 1D - mc.thePlayer.posY, z + 0.5D - mc.thePlayer.posZ)).isEmpty() ? new Color(255, 0, 0, 90) : new Color(0, 255, 0, 90));
RenderUtils.drawFilledBox(new AxisAlignedBB(x - renderManager.renderPosX, (y + 1) - renderManager.renderPosY, z - renderManager.renderPosZ, x - renderManager.renderPosX + 1.0D, y + 1.2D - renderManager.renderPosY, z - renderManager.renderPosZ + 1.0D));
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
glDisable(GL_BLEND);
RenderUtils.renderNameTag(Math.round(mc.thePlayer.getDistance(x + 0.5D, y + 1D, z + 0.5D)) + "m", x + 0.5, y + 1.7, z + 0.5);
GlStateManager.resetColor();
}
}
@EventTarget
public void onMove(final MoveEvent event) {
if (modeValue.get().equalsIgnoreCase("aac3.5.0") && freeze) {
event.zeroXZ();
}
}
@EventTarget
public void onPacket(final PacketEvent event) {
final Packet<?> packet = event.getPacket();
if(disableLogger)
return;
if(packet instanceof C03PacketPlayer) {
final C03PacketPlayer packetPlayer = (C03PacketPlayer) packet;
switch(modeValue.get().toLowerCase()) {
case "spoof":
if(endPos == null)
break;
packetPlayer.x = endPos.getX() + 0.5D;
packetPlayer.y = endPos.getY() + 1;
packetPlayer.z = endPos.getZ() + 0.5D;
mc.thePlayer.setPosition(endPos.getX() + 0.5D, endPos.getY() + 1, endPos.getZ() + 0.5D);
break;
case "aac3.5.0":
if(!flyTimer.hasTimePassed(60))
return;
event.cancelEvent();
if(!(packet instanceof C03PacketPlayer.C04PacketPlayerPosition) && !(packet instanceof C03PacketPlayer.C06PacketPlayerPosLook))
return;
packets.add(packet);
break;
}
}
}
@Override
public String getTag() {
return modeValue.get();
}
}
| 18,637 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ItemTeleport.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/ItemTeleport.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.exploit;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.Render3DEvent;
import net.ccbluex.liquidbounce.event.UpdateEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.ccbluex.liquidbounce.utils.MovementUtils;
import net.ccbluex.liquidbounce.utils.block.BlockUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.ListValue;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import org.lwjgl.input.Mouse;
import javax.vecmath.Vector3f;
import java.awt.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.lwjgl.opengl.GL11.*;
@ModuleInfo(name = "ItemTeleport", spacedName = "Item Teleport", description = "Allows you to pick up items far away by teleporting.", category = ModuleCategory.EXPLOIT)
public class ItemTeleport extends Module {
private final ListValue modeValue = new ListValue("Mode", new String[] {"New", "Old"}, "New");
private final BoolValue resetAfterTp = new BoolValue("ResetAfterTP", true);
private final ListValue buttonValue = new ListValue("Button", new String[] {"Left", "Right", "Middle"}, "Middle");
private int delay;
private BlockPos endPos;
private MovingObjectPosition objectPosition;
@Override
public void onDisable() {
delay = 0;
endPos = null;
super.onDisable();
}
@EventTarget
public void onUpdate(final UpdateEvent event) {
if(mc.currentScreen == null && Mouse.isButtonDown(Arrays.asList(buttonValue.getValues()).indexOf(buttonValue.get())) && delay <= 0) {
endPos = objectPosition.getBlockPos();
if(BlockUtils.getBlock(endPos).getMaterial() == Material.air) {
endPos = null;
return;
}
ClientUtils.displayChatMessage("§7[§8§lItemTeleport§7] §3Position was set to §8" + endPos.getX() + "§3, §8" + endPos.getY() + "§3, §8" + endPos.getZ());
delay = 6;
}
if(delay > 0)
--delay;
if(endPos != null && mc.thePlayer.isSneaking()) {
if(!mc.thePlayer.onGround) {
final double endX = (double) endPos.getX() + 0.5D;
final double endY = (double) endPos.getY() + 1D;
final double endZ = (double) endPos.getZ() + 0.5D;
switch(modeValue.get().toLowerCase()) {
case "old":
for(final Vector3f vector3f : vanillaTeleportPositions(endX, endY, endZ, 4D))
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vector3f.getX(), vector3f.getY(), vector3f.getZ(), false));
break;
case "new":
for(final Vector3f vector3f : vanillaTeleportPositions(endX, endY, endZ, 5D)) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vector3f.x, vector3f.y, vector3f.z, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 4.0, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vector3f.x, vector3f.y, vector3f.z, true));
MovementUtils.forward(0.04);
}
break;
}
if(resetAfterTp.get())
endPos = null;
ClientUtils.displayChatMessage("§7[§8§lItemTeleport§7] §3Tried to collect items");
}else
mc.thePlayer.jump();
}
}
@EventTarget
public void onRender3D(final Render3DEvent event) {
objectPosition = mc.thePlayer.rayTrace(1000, event.getPartialTicks());
if(objectPosition.getBlockPos() == null)
return;
final int x = objectPosition.getBlockPos().getX();
final int y = objectPosition.getBlockPos().getY();
final int z = objectPosition.getBlockPos().getZ();
if(BlockUtils.getBlock(objectPosition.getBlockPos()).getMaterial() != Material.air) {
final RenderManager renderManager = mc.getRenderManager();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glLineWidth(2F);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
RenderUtils.glColor(BlockUtils.getBlock(objectPosition.getBlockPos().up()).getMaterial() != Material.air ? new Color(255, 0, 0, 90) : new Color(0, 255, 0, 90));
RenderUtils.drawFilledBox(new AxisAlignedBB(x - renderManager.renderPosX, (y + 1) - renderManager.renderPosY, z - renderManager.renderPosZ, x - renderManager.renderPosX + 1D, y + 1.2D - renderManager.renderPosY, z - renderManager.renderPosZ + 1D));
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
glDisable(GL_BLEND);
RenderUtils.renderNameTag(Math.round(mc.thePlayer.getDistance(x, y, z)) + "m", x + 0.5, y + 1.7, z + 0.5);
GlStateManager.resetColor();
}
}
private java.util.List<Vector3f> vanillaTeleportPositions(final double tpX, final double tpY, final double tpZ, final double speed) {
final List<Vector3f> positions = new ArrayList<>();
double posX = tpX - mc.thePlayer.posX;
double posZ = tpZ - mc.thePlayer.posZ;
float yaw = (float) ((Math.atan2(posZ, posX) * 180 / Math.PI) - 90F);
double tmpX;
double tmpY = mc.thePlayer.posY;
double tmpZ;
double steps = 1;
for(double d = speed; d < getDistance(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, tpX, tpY, tpZ); d += speed)
steps++;
for(double d = speed; d < getDistance(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, tpX, tpY, tpZ); d += speed) {
tmpX = mc.thePlayer.posX - (Math.sin(Math.toRadians(yaw)) * d);
tmpZ = mc.thePlayer.posZ + Math.cos(Math.toRadians(yaw)) * d;
tmpY -= (mc.thePlayer.posY - tpY) / steps;
positions.add(new Vector3f((float) tmpX, (float) tmpY, (float) tmpZ));
}
positions.add(new Vector3f((float) tpX, (float) tpY, (float) tpZ));
return positions;
}
private double getDistance(double x1, double y1, double z1, double x2, double y2, double z2) {
double d0 = x1 - x2;
double d1 = y1 - y2;
double d2 = z1 - z2;
return MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2);
}
}
| 7,893 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Skeletal.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/render/Skeletal.java | /*
* LiquidBounce+ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/WYSI-Foundation/LiquidBouncePlus/
*
* This code belongs to WYSI-Foundation. Please give credits when using this in your repository.
*/
package net.ccbluex.liquidbounce.features.module.modules.render;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.Render3DEvent;
import net.ccbluex.liquidbounce.event.UpdateModelEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.entity.player.EntityPlayer;
import org.lwjgl.opengl.GL11;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
@ModuleInfo(name = "Skeletal", description = "idk", category = ModuleCategory.RENDER)
public class Skeletal extends Module {
private final Map playerRotationMap = new WeakHashMap();
private final IntegerValue red = new IntegerValue("Red", 255, 0, 255);
private final IntegerValue green = new IntegerValue("Green", 255, 0, 255);
private final IntegerValue blue = new IntegerValue("Blue", 255, 0, 255);
private final BoolValue smoothLines = new BoolValue("SmoothLines", true);
@EventTarget
public final void onModelUpdate(UpdateModelEvent event) {
ModelPlayer model = event.getModel();
this.playerRotationMap.put(event.getPlayer(), new float[][]{{model.bipedHead.rotateAngleX, model.bipedHead.rotateAngleY, model.bipedHead.rotateAngleZ}, {model.bipedRightArm.rotateAngleX, model.bipedRightArm.rotateAngleY, model.bipedRightArm.rotateAngleZ}, {model.bipedLeftArm.rotateAngleX, model.bipedLeftArm.rotateAngleY, model.bipedLeftArm.rotateAngleZ}, {model.bipedRightLeg.rotateAngleX, model.bipedRightLeg.rotateAngleY, model.bipedRightLeg.rotateAngleZ}, {model.bipedLeftLeg.rotateAngleX, model.bipedLeftLeg.rotateAngleY, model.bipedLeftLeg.rotateAngleZ}});
}
@EventTarget
public void onRender(Render3DEvent event) {
this.setupRender(true);
GL11.glEnable(2903);
GL11.glDisable(2848);
this.playerRotationMap.keySet().removeIf(var0 -> contain((EntityPlayer) var0));
Map playerRotationMap = this.playerRotationMap;
List worldPlayers = mc.theWorld.playerEntities;
Object[] players = playerRotationMap.keySet().toArray();
int playersLength = players.length;
for (int i = 0; i < playersLength; ++i) {
EntityPlayer player = (EntityPlayer) players[i];
float[][] entPos = (float[][]) playerRotationMap.get(player);
if (entPos == null || player.getEntityId() == -1488 || !player.isEntityAlive() || !RenderUtils.isInViewFrustrum(player) ||
player.isDead || player == mc.thePlayer || player.isPlayerSleeping() || player.isInvisible())
continue;
GL11.glPushMatrix();
float[][] modelRotations = (float[][]) playerRotationMap.get(player);
GL11.glLineWidth(1.0f);
GL11.glColor4f(red.get() / 255.0f, green.get() / 255.0f, blue.get() / 255.0f, 1.0f);
double x = interpolate(player.posX, player.lastTickPosX, event.getPartialTicks()) - mc.getRenderManager().renderPosX;
double y = interpolate(player.posY, player.lastTickPosY, event.getPartialTicks()) - mc.getRenderManager().renderPosY;
double z = interpolate(player.posZ, player.lastTickPosZ, event.getPartialTicks()) - mc.getRenderManager().renderPosZ;
GL11.glTranslated(x, y, z);
float bodyYawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * mc.timer.renderPartialTicks;
GL11.glRotatef((-bodyYawOffset), 0.0f, 1.0f, 0.0f);
GL11.glTranslated(0.0, 0.0, (player.isSneaking() ? -0.235 : 0.0));
float legHeight = player.isSneaking() ? 0.6f : 0.75f;
float rad = 57.29578f;
GL11.glPushMatrix();
GL11.glTranslated(-0.125, legHeight, 0.0);
if (modelRotations[3][0] != 0.0f) {
GL11.glRotatef((modelRotations[3][0] * 57.29578f), 1.0f, 0.0f, 0.0f);
}
if (modelRotations[3][1] != 0.0f) {
GL11.glRotatef((modelRotations[3][1] * 57.29578f), 0.0f, 1.0f, 0.0f);
}
if (modelRotations[3][2] != 0.0f) {
GL11.glRotatef((modelRotations[3][2] * 57.29578f), 0.0f, 0.0f, 1.0f);
}
GL11.glBegin(3);
GL11.glVertex3d(0.0, 0.0, 0.0);
GL11.glVertex3d(0.0, (-legHeight), 0.0);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0.125, legHeight, 0.0);
if (modelRotations[4][0] != 0.0f) {
GL11.glRotatef((modelRotations[4][0] * 57.29578f), 1.0f, 0.0f, 0.0f);
}
if (modelRotations[4][1] != 0.0f) {
GL11.glRotatef((modelRotations[4][1] * 57.29578f), 0.0f, 1.0f, 0.0f);
}
if (modelRotations[4][2] != 0.0f) {
GL11.glRotatef((modelRotations[4][2] * 57.29578f), 0.0f, 0.0f, 1.0f);
}
GL11.glBegin(3);
GL11.glVertex3d(0.0, 0.0, 0.0);
GL11.glVertex3d(0.0, (-legHeight), 0.0);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glTranslated(0.0, 0.0, (player.isSneaking() ? 0.25 : 0.0));
GL11.glPushMatrix();
GL11.glTranslated(0.0, (player.isSneaking() ? -0.05 : 0.0), (player.isSneaking() ? -0.01725 : 0.0));
GL11.glPushMatrix();
GL11.glTranslated(-0.375, (legHeight + 0.55), 0.0);
if (modelRotations[1][0] != 0.0f) {
GL11.glRotatef((modelRotations[1][0] * 57.29578f), 1.0f, 0.0f, 0.0f);
}
if (modelRotations[1][1] != 0.0f) {
GL11.glRotatef((modelRotations[1][1] * 57.29578f), 0.0f, 1.0f, 0.0f);
}
if (modelRotations[1][2] != 0.0f) {
GL11.glRotatef((-modelRotations[1][2] * 57.29578f), 0.0f, 0.0f, 1.0f);
}
GL11.glBegin(3);
GL11.glVertex3d(0.0, 0.0, 0.0);
GL11.glVertex3d(0.0, -0.5, 0.0);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0.375, (legHeight + 0.55), 0.0);
if (modelRotations[2][0] != 0.0f) {
GL11.glRotatef((modelRotations[2][0] * 57.29578f), 1.0f, 0.0f, 0.0f);
}
if (modelRotations[2][1] != 0.0f) {
GL11.glRotatef((modelRotations[2][1] * 57.29578f), 0.0f, 1.0f, 0.0f);
}
if (modelRotations[2][2] != 0.0f) {
GL11.glRotatef((-modelRotations[2][2] * 57.29578f), 0.0f, 0.0f, 1.0f);
}
GL11.glBegin(3);
GL11.glVertex3d(0.0, 0.0, 0.0);
GL11.glVertex3d(0.0, -0.5, 0.0);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glRotatef((bodyYawOffset - player.rotationYawHead), 0.0f, 1.0f, 0.0f);
GL11.glPushMatrix();
GL11.glTranslated(0.0, (legHeight + 0.55), 0.0);
if (modelRotations[0][0] != 0.0f) {
GL11.glRotatef((modelRotations[0][0] * 57.29578f), 1.0f, 0.0f, 0.0f);
}
GL11.glBegin(3);
GL11.glVertex3d(0.0, 0.0, 0.0);
GL11.glVertex3d(0.0, 0.3, 0.0);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glPopMatrix();
GL11.glRotatef((player.isSneaking() ? 25.0f : 0.0f), 1.0f, 0.0f, 0.0f);
GL11.glTranslated(0.0, (player.isSneaking() ? -0.16175 : 0.0), (player.isSneaking() ? -0.48025 : 0.0));
GL11.glPushMatrix();
GL11.glTranslated(0.0, legHeight, 0.0);
GL11.glBegin(3);
GL11.glVertex3d(-0.125, 0.0, 0.0);
GL11.glVertex3d(0.125, 0.0, 0.0);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0.0, legHeight, 0.0);
GL11.glBegin(3);
GL11.glVertex3d(0.0, 0.0, 0.0);
GL11.glVertex3d(0.0, 0.55, 0.0);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0.0, (legHeight + 0.55), 0.0);
GL11.glBegin(3);
GL11.glVertex3d(-0.375, 0.0, 0.0);
GL11.glVertex3d(0.375, 0.0, 0.0);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glPopMatrix();
}
this.setupRender(false);
}
private void setupRender(boolean start) {
boolean smooth = this.smoothLines.get();
if (start) {
if (smooth) {
RenderUtils.startSmooth();
} else {
GL11.glDisable(2848);
}
GL11.glDisable(2929);
GL11.glDisable(3553);
} else {
GL11.glEnable(3553);
GL11.glEnable(2929);
if (smooth) {
RenderUtils.endSmooth();
}
}
GL11.glDepthMask((!start ? 1 : 0) != 0);
}
private boolean contain(EntityPlayer var0) {
return !mc.theWorld.playerEntities.contains(var0);
}
public static double interpolate(double current, double old, double scale) {
return old + (current - old) * scale;
}
}
| 9,853 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ClickGUI.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/render/ClickGUI.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.render;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.event.TickEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.features.module.modules.color.ColorMixer;
import net.ccbluex.liquidbounce.ui.client.clickgui.ClickGui;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.*;
import net.ccbluex.liquidbounce.utils.render.ColorUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.FloatValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.ccbluex.liquidbounce.value.ListValue;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S2EPacketCloseWindow;
import org.lwjgl.input.Keyboard;
import java.awt.*;
@ModuleInfo(name = "ClickGUI", description = "Opens the ClickGUI.", category = ModuleCategory.RENDER, keyBind = Keyboard.KEY_RSHIFT, forceNoSound = true, onlyEnable = true)
public class ClickGUI extends Module {
private final ListValue styleValue = new ListValue("Style", new String[] {"LiquidBounce", "Null", "Slowly", "Black", "White", /* "Astolfo", "Test", "Novoline", "Flux"*/}, "Null") {
@Override
protected void onChanged(final String oldValue, final String newValue) {
updateStyle();
}
};
public final FloatValue scaleValue = new FloatValue("Scale", 1F, 0.4F, 2F);
public final IntegerValue maxElementsValue = new IntegerValue("MaxElements", 15, 1, 20);
private static final ListValue colorModeValue = new ListValue("Color", new String[] {"Custom", "Sky", "Rainbow", "LiquidSlowly", "Fade", "Mixer"}, "Custom");
private static final IntegerValue colorRedValue = new IntegerValue("Red", 0, 0, 255);
private static final IntegerValue colorGreenValue = new IntegerValue("Green", 160, 0, 255);
private static final IntegerValue colorBlueValue = new IntegerValue("Blue", 255, 0, 255);
private static final FloatValue saturationValue = new FloatValue("Saturation", 1F, 0F, 1F);
private static final FloatValue brightnessValue = new FloatValue("Brightness", 1F, 0F, 1F);
private static final IntegerValue mixerSecondsValue = new IntegerValue("Seconds", 2, 1, 10);
public final ListValue backgroundValue = new ListValue("Background", new String[] {"Default", "Gradient", "None"}, "Default");
public final IntegerValue gradStartValue = new IntegerValue("GradientStartAlpha", 255, 0, 255, () -> backgroundValue.get().equalsIgnoreCase("gradient"));
public final IntegerValue gradEndValue = new IntegerValue("GradientEndAlpha", 0, 0, 255, () -> backgroundValue.get().equalsIgnoreCase("gradient"));
public final ListValue animationValue = new ListValue("Animation", new String[] {"Azura", "Slide", "SlideBounce", "Zoom", "ZoomBounce", "None"}, "Azura");
public final FloatValue animSpeedValue = new FloatValue("AnimSpeed", 1F, 0.01F, 5F, "x");
public static Color generateColor() {
Color c = new Color(255, 255, 255, 255);
switch (colorModeValue.get().toLowerCase()) {
case "custom":
c = new Color(colorRedValue.get(), colorGreenValue.get(), colorBlueValue.get());
break;
case "rainbow":
c = new Color(RenderUtils.getRainbowOpaque(mixerSecondsValue.get(), saturationValue.get(), brightnessValue.get(), 0));
break;
case "sky":
c = RenderUtils.skyRainbow(0, saturationValue.get(), brightnessValue.get());
break;
case "liquidslowly":
c = ColorUtils.LiquidSlowly(System.nanoTime(), 0, saturationValue.get(), brightnessValue.get());
break;
case "fade":
c = ColorUtils.fade(new Color(colorRedValue.get(), colorGreenValue.get(), colorBlueValue.get()), 0, 100);
break;
case "mixer":
c = ColorMixer.getMixedColor(0, mixerSecondsValue.get());
break;
}
return c;
}
@Override
public void onEnable() {
updateStyle();
LiquidBounce.clickGui.progress = 0;
LiquidBounce.clickGui.slide = 0;
LiquidBounce.clickGui.lastMS = System.currentTimeMillis();
mc.displayGuiScreen(LiquidBounce.clickGui);
}
private void updateStyle() {
switch(styleValue.get().toLowerCase()) {
case "liquidbounce":
LiquidBounce.clickGui.style = new LiquidBounceStyle();
break;
case "null":
LiquidBounce.clickGui.style = new NullStyle();
break;
case "slowly":
LiquidBounce.clickGui.style = new SlowlyStyle();
break;
case "black":
LiquidBounce.clickGui.style = new BlackStyle();
break;
case "white":
LiquidBounce.clickGui.style = new WhiteStyle();
break;
/* case "astolfo":
LiquidBounce.clickGui.style = new AstolfoStyle();
break;
case "test":
LiquidBounce.clickGui.style = new TestStyle();
break;*/
}
}
}
| 5,752 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
ESP.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/render/ESP.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.render;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.Render2DEvent;
import net.ccbluex.liquidbounce.event.Render3DEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.features.module.modules.color.ColorMixer;
import net.ccbluex.liquidbounce.ui.font.GameFontRenderer;
import net.ccbluex.liquidbounce.ui.font.Fonts;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.ccbluex.liquidbounce.utils.EntityUtils;
import net.ccbluex.liquidbounce.utils.render.BlendUtils;
import net.ccbluex.liquidbounce.utils.render.ColorUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.utils.render.WorldToScreen;
import net.ccbluex.liquidbounce.utils.render.shader.FramebufferShader;
import net.ccbluex.liquidbounce.utils.render.shader.shaders.GlowShader;
import net.ccbluex.liquidbounce.utils.render.shader.shaders.OutlineShader;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.FloatValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.ccbluex.liquidbounce.value.ListValue;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Timer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector2f;
import org.lwjgl.util.vector.Vector3f;
import java.awt.*;
import java.text.DecimalFormat;
import static net.ccbluex.liquidbounce.utils.render.WorldToScreen.getMatrix;
import static org.lwjgl.opengl.GL11.*;
@ModuleInfo(name = "ESP", description = "Allows you to see targets through walls.", category = ModuleCategory.RENDER)
public class ESP extends Module {
private DecimalFormat decimalFormat = new DecimalFormat("0.0");
public static boolean renderNameTags = true;
public final ListValue modeValue = new ListValue("Mode", new String[]{"Box", "OtherBox", "WireFrame", "2D", "Real2D", "Outline", "ShaderOutline", "ShaderGlow"}, "Box");
public final BoolValue real2dcsgo = new BoolValue("2D-CSGOStyle", true, () -> modeValue.get().equalsIgnoreCase("real2d"));
public final BoolValue real2dShowHealth = new BoolValue("2D-ShowHealth", true, () -> modeValue.get().equalsIgnoreCase("real2d"));
public final BoolValue real2dShowHeldItem = new BoolValue("2D-ShowHeldItem", true, () -> modeValue.get().equalsIgnoreCase("real2d"));
public final BoolValue real2dShowName = new BoolValue("2D-ShowEntityName", true, () -> modeValue.get().equalsIgnoreCase("real2d"));
public final BoolValue real2dOutline = new BoolValue("2D-Outline", true, () -> modeValue.get().equalsIgnoreCase("real2d"));
public final FloatValue outlineWidth = new FloatValue("Outline-Width", 3F, 0.5F, 5F, () -> modeValue.get().equalsIgnoreCase("outline"));
public final FloatValue wireframeWidth = new FloatValue("WireFrame-Width", 2F, 0.5F, 5F, () -> modeValue.get().equalsIgnoreCase("wireframe"));
private final FloatValue shaderOutlineRadius = new FloatValue("ShaderOutline-Radius", 1.35F, 1F, 2F, "x", () -> modeValue.get().equalsIgnoreCase("shaderoutline"));
private final FloatValue shaderGlowRadius = new FloatValue("ShaderGlow-Radius", 2.3F, 2F, 3F, "x", () -> modeValue.get().equalsIgnoreCase("shaderglow"));
private final ListValue colorModeValue = new ListValue("Color", new String[] {"Custom", "Health", "Rainbow", "Sky", "LiquidSlowly", "Fade", "Mixer"}, "Custom");
private final IntegerValue colorRedValue = new IntegerValue("Red", 255, 0, 255);
private final IntegerValue colorGreenValue = new IntegerValue("Green", 255, 0, 255);
private final IntegerValue colorBlueValue = new IntegerValue("Blue", 255, 0, 255);
private final FloatValue saturationValue = new FloatValue("Saturation", 1F, 0F, 1F);
private final FloatValue brightnessValue = new FloatValue("Brightness", 1F, 0F, 1F);
private final IntegerValue mixerSecondsValue = new IntegerValue("Seconds", 2, 1, 10);
private final BoolValue colorTeam = new BoolValue("Team", false);
@EventTarget
public void onRender3D(Render3DEvent event) {
final String mode = modeValue.get();
Matrix4f mvMatrix = getMatrix(GL11.GL_MODELVIEW_MATRIX);
Matrix4f projectionMatrix = getMatrix(GL11.GL_PROJECTION_MATRIX);
boolean real2d = mode.equalsIgnoreCase("real2d");
if (real2d) {
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glOrtho(0, mc.displayWidth, mc.displayHeight, 0, -1.0f, 1.0);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPushMatrix();
GL11.glLoadIdentity();
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
GL11.glLineWidth(1.0f);
}
for (final Entity entity : mc.theWorld.loadedEntityList) {
if (entity != null && entity != mc.thePlayer && EntityUtils.isSelected(entity, false) && RenderUtils.isInViewFrustrum(entity)) {
final EntityLivingBase entityLiving = (EntityLivingBase) entity;
Color color = getColor(entityLiving);
switch (mode.toLowerCase()) {
case "box":
case "otherbox":
RenderUtils.drawEntityBox(entity, color, !mode.equalsIgnoreCase("otherbox"));
break;
case "2d": {
final RenderManager renderManager = mc.getRenderManager();
final Timer timer = mc.timer;
final double posX = entityLiving.lastTickPosX + (entityLiving.posX - entityLiving.lastTickPosX) * timer.renderPartialTicks - renderManager.renderPosX;
final double posY = entityLiving.lastTickPosY + (entityLiving.posY - entityLiving.lastTickPosY) * timer.renderPartialTicks - renderManager.renderPosY;
final double posZ = entityLiving.lastTickPosZ + (entityLiving.posZ - entityLiving.lastTickPosZ) * timer.renderPartialTicks - renderManager.renderPosZ;
RenderUtils.draw2D(entityLiving, posX, posY, posZ, color.getRGB(), Color.BLACK.getRGB());
break;
}
case "real2d": {
final RenderManager renderManager = mc.getRenderManager();
final Timer timer = mc.timer;
AxisAlignedBB bb = entityLiving.getEntityBoundingBox()
.offset(-entityLiving.posX, -entityLiving.posY, -entityLiving.posZ)
.offset(entityLiving.lastTickPosX + (entityLiving.posX - entityLiving.lastTickPosX) * timer.renderPartialTicks,
entityLiving.lastTickPosY + (entityLiving.posY - entityLiving.lastTickPosY) * timer.renderPartialTicks,
entityLiving.lastTickPosZ + (entityLiving.posZ - entityLiving.lastTickPosZ) * timer.renderPartialTicks)
.offset(-renderManager.renderPosX, -renderManager.renderPosY, -renderManager.renderPosZ);
double[][] boxVertices = {
{bb.minX, bb.minY, bb.minZ},
{bb.minX, bb.maxY, bb.minZ},
{bb.maxX, bb.maxY, bb.minZ},
{bb.maxX, bb.minY, bb.minZ},
{bb.minX, bb.minY, bb.maxZ},
{bb.minX, bb.maxY, bb.maxZ},
{bb.maxX, bb.maxY, bb.maxZ},
{bb.maxX, bb.minY, bb.maxZ},
};
float minX = mc.displayWidth;
float minY = mc.displayHeight;
float maxX = 0;
float maxY = 0;
for (double[] boxVertex : boxVertices) {
Vector2f screenPos = WorldToScreen.worldToScreen(new Vector3f((float) boxVertex[0], (float) boxVertex[1], (float) boxVertex[2]), mvMatrix, projectionMatrix, mc.displayWidth, mc.displayHeight);
if (screenPos == null) {
continue;
}
minX = Math.min(screenPos.x, minX);
minY = Math.min(screenPos.y, minY);
maxX = Math.max(screenPos.x, maxX);
maxY = Math.max(screenPos.y, maxY);
}
if (!(minX >= mc.displayWidth || minY >= mc.displayHeight || maxX <= 0 || maxY <= 0)) {
if (real2dOutline.get()) {
GL11.glLineWidth(2f);
GL11.glColor4f(0f, 0f, 0f, 1.0f);
if (real2dcsgo.get()) {
float distX = (maxX - minX) / 3f;
float distY = (maxY - minY) / 3f;
GL11.glBegin(GL11.GL_LINE_STRIP);
GL11.glVertex2f(minX, minY + distY);
GL11.glVertex2f(minX, minY);
GL11.glVertex2f(minX + distX, minY);
GL11.glEnd();
GL11.glBegin(GL11.GL_LINE_STRIP);
GL11.glVertex2f(minX, maxY - distY);
GL11.glVertex2f(minX, maxY);
GL11.glVertex2f(minX + distX, maxY);
GL11.glEnd();
GL11.glBegin(GL11.GL_LINE_STRIP);
GL11.glVertex2f(maxX - distX, minY);
GL11.glVertex2f(maxX, minY);
GL11.glVertex2f(maxX, minY + distY);
GL11.glEnd();
GL11.glBegin(GL11.GL_LINE_STRIP);
GL11.glVertex2f(maxX - distX, maxY);
GL11.glVertex2f(maxX, maxY);
GL11.glVertex2f(maxX, maxY - distY);
GL11.glEnd();
} else {
GL11.glBegin(GL11.GL_LINE_LOOP);
GL11.glVertex2f(minX, minY);
GL11.glVertex2f(minX, maxY);
GL11.glVertex2f(maxX, maxY);
GL11.glVertex2f(maxX, minY);
GL11.glEnd();
}
GL11.glLineWidth(1.0f);
}
GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, 1.0f);
if (real2dcsgo.get()) {
float distX = (maxX - minX) / 3f;
float distY = (maxY - minY) / 3f;
GL11.glBegin(GL11.GL_LINE_STRIP);
GL11.glVertex2f(minX, minY + distY);
GL11.glVertex2f(minX, minY);
GL11.glVertex2f(minX + distX, minY);
GL11.glEnd();
GL11.glBegin(GL11.GL_LINE_STRIP);
GL11.glVertex2f(minX, maxY - distY);
GL11.glVertex2f(minX, maxY);
GL11.glVertex2f(minX + distX, maxY);
GL11.glEnd();
GL11.glBegin(GL11.GL_LINE_STRIP);
GL11.glVertex2f(maxX - distX, minY);
GL11.glVertex2f(maxX, minY);
GL11.glVertex2f(maxX, minY + distY);
GL11.glEnd();
GL11.glBegin(GL11.GL_LINE_STRIP);
GL11.glVertex2f(maxX - distX, maxY);
GL11.glVertex2f(maxX, maxY);
GL11.glVertex2f(maxX, maxY - distY);
GL11.glEnd();
} else {
GL11.glBegin(GL11.GL_LINE_LOOP);
GL11.glVertex2f(minX, minY);
GL11.glVertex2f(minX, maxY);
GL11.glVertex2f(maxX, maxY);
GL11.glVertex2f(maxX, minY);
GL11.glEnd();
}
if (real2dShowHealth.get()) {
float barHeight = (maxY - minY) * (1 - entityLiving.getHealth() / entityLiving.getMaxHealth());
GL11.glColor4f(0.1f, 1f, 0.1f, 1f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(maxX + 2, minY + barHeight);
GL11.glVertex2f(maxX + 2, maxY);
GL11.glVertex2f(maxX + 4, maxY);
GL11.glVertex2f(maxX + 4, minY + barHeight);
GL11.glEnd();
GL11.glColor4f(1f, 1f, 1f, 1f);
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
mc.fontRendererObj.drawStringWithShadow(decimalFormat.format(entityLiving.getHealth()) + " HP", maxX + 4, minY + barHeight, -1);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
GlStateManager.resetColor();
}
if (real2dShowHeldItem.get() && entityLiving.getHeldItem() != null && entityLiving.getHeldItem().getItem() != null) {
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
int stringWidth = mc.fontRendererObj.getStringWidth(entityLiving.getHeldItem().getDisplayName());
mc.fontRendererObj.drawStringWithShadow(entityLiving.getHeldItem().getDisplayName(), minX + (maxX - minX) / 2 - (stringWidth / 2), maxY + 2, -1);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
}
if (real2dShowName.get()) {
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
int stringWidth = mc.fontRendererObj.getStringWidth(entityLiving.getDisplayName().getFormattedText());
mc.fontRendererObj.drawStringWithShadow(entityLiving.getDisplayName().getFormattedText(), minX + (maxX - minX) / 2 - (stringWidth / 2), minY - 12, -1);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
}
}
break;
}
}
}
}
if (real2d) {
glEnable(GL_DEPTH_TEST);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPopMatrix();
GL11.glPopAttrib();
}
}
@EventTarget
public void onRender2D(final Render2DEvent event) {
final String mode = modeValue.get().toLowerCase();
final FramebufferShader shader = mode.equalsIgnoreCase("shaderoutline")
? OutlineShader.OUTLINE_SHADER : mode.equalsIgnoreCase("shaderglow")
? GlowShader.GLOW_SHADER : null;
if (shader == null) return;
shader.startDraw(event.getPartialTicks());
renderNameTags = false;
try {
for (final Entity entity : mc.theWorld.loadedEntityList) {
if (!EntityUtils.isSelected(entity, false))
continue;
mc.getRenderManager().renderEntityStatic(entity, mc.timer.renderPartialTicks, true);
}
} catch (final Exception ex) {
ClientUtils.getLogger().error("An error occurred while rendering all entities for shader esp", ex);
}
renderNameTags = true;
final float radius = mode.equalsIgnoreCase("shaderoutline")
? shaderOutlineRadius.get() : mode.equalsIgnoreCase("shaderglow")
? shaderGlowRadius.get() : 1F;
shader.stopDraw(getColor(null), radius, 1F);
}
public final Color getColor(final Entity entity) {
if (entity instanceof EntityLivingBase) {
final EntityLivingBase entityLivingBase = (EntityLivingBase) entity;
if (colorModeValue.get().equalsIgnoreCase("Health"))
return BlendUtils.getHealthColor(entityLivingBase.getHealth(), entityLivingBase.getMaxHealth());
if (entityLivingBase.hurtTime > 0)
return Color.RED;
if (EntityUtils.isFriend(entityLivingBase))
return Color.BLUE;
if (colorTeam.get()) {
final char[] chars = entityLivingBase.getDisplayName().getFormattedText().toCharArray();
int color = Integer.MAX_VALUE;
for (int i = 0; i < chars.length; i++) {
if (chars[i] != '§' || i + 1 >= chars.length)
continue;
final int index = GameFontRenderer.getColorIndex(chars[i + 1]);
if (index < 0 || index > 15)
continue;
color = ColorUtils.hexColors[index];
break;
}
return new Color(color);
}
}
switch (colorModeValue.get()) {
case "Custom":
return new Color(colorRedValue.get(), colorGreenValue.get(), colorBlueValue.get());
case "Rainbow":
return new Color(RenderUtils.getRainbowOpaque(mixerSecondsValue.get(), saturationValue.get(), brightnessValue.get(), 0));
case "Sky":
return RenderUtils.skyRainbow(0, saturationValue.get(), brightnessValue.get());
case "LiquidSlowly":
return ColorUtils.LiquidSlowly(System.nanoTime(), 0, saturationValue.get(), brightnessValue.get());
case "Mixer":
return ColorMixer.getMixedColor(0, mixerSecondsValue.get());
case "Fade":
return ColorUtils.fade(new Color(colorRedValue.get(), colorGreenValue.get(), colorBlueValue.get()), 0, 100);
default:
return Color.white;
}
}
}
| 15,777 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
TargetMark.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/render/TargetMark.java | /*
* LiquidBounce+ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/WYSI-Foundation/LiquidBouncePlus/
*
* This code belongs to WYSI-Foundation. Please give credits when using this in your repository.
*/
package net.ccbluex.liquidbounce.features.module.modules.render;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.*;
import net.ccbluex.liquidbounce.features.module.modules.color.ColorMixer;
import net.ccbluex.liquidbounce.features.module.modules.combat.KillAura;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.ui.font.GameFontRenderer;
import net.ccbluex.liquidbounce.utils.AnimationUtils;
import net.ccbluex.liquidbounce.utils.render.BlendUtils;
import net.ccbluex.liquidbounce.utils.render.ColorUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.value.*;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.AxisAlignedBB;
import org.lwjgl.opengl.GL11;
import java.awt.Color;
@ModuleInfo(name = "TargetMark", spacedName = "Target Mark", description = "Displays your KillAura's target in 3D.", category = ModuleCategory.RENDER)
public class TargetMark extends Module {
public final ListValue modeValue = new ListValue("Mode", new String[]{"Default", "Box", "Jello", "Tracers"}, "Default");
private final ListValue colorModeValue = new ListValue("Color", new String[] {"Custom", "Rainbow", "Sky", "LiquidSlowly", "Fade", "Mixer", "Health"}, "Custom");
private final IntegerValue colorRedValue = new IntegerValue("Red", 255, 0, 255);
private final IntegerValue colorGreenValue = new IntegerValue("Green", 255, 0, 255);
private final IntegerValue colorBlueValue = new IntegerValue("Blue", 255, 0, 255);
private final IntegerValue colorAlphaValue = new IntegerValue("Alpha", 255, 0, 255);
private final FloatValue jelloAlphaValue = new FloatValue("JelloEndAlphaPercent", 0.4F, 0F, 1F, "x", () -> modeValue.get().equalsIgnoreCase("jello"));
private final FloatValue jelloWidthValue = new FloatValue("JelloCircleWidth", 3F, 0.01F, 5F, () -> modeValue.get().equalsIgnoreCase("jello"));
private final FloatValue jelloGradientHeightValue = new FloatValue("JelloGradientHeight", 3F, 1F, 8F, "m", () -> modeValue.get().equalsIgnoreCase("jello"));
private final FloatValue jelloFadeSpeedValue = new FloatValue("JelloFadeSpeed", 0.1F, 0.01F, 0.5F, "x", () -> modeValue.get().equalsIgnoreCase("jello"));
private final FloatValue saturationValue = new FloatValue("Saturation", 1F, 0F, 1F);
private final FloatValue brightnessValue = new FloatValue("Brightness", 1F, 0F, 1F);
private final IntegerValue mixerSecondsValue = new IntegerValue("Seconds", 2, 1, 10);
public final FloatValue moveMarkValue = new FloatValue("MoveMarkY", 0.6F, 0F, 2F, () -> modeValue.get().equalsIgnoreCase("default"));
private final FloatValue thicknessValue = new FloatValue("Thickness", 1F, 0.1F, 5F, () -> modeValue.get().equalsIgnoreCase("tracers"));
private final BoolValue colorTeam = new BoolValue("Team", false);
private EntityLivingBase entity;
private double direction = 1,
yPos, progress = 0;
private float al = 0;
private AxisAlignedBB bb;
private KillAura aura;
private long lastMS = System.currentTimeMillis();
private long lastDeltaMS = 0L;
@Override
public void onInitialize() {
aura = LiquidBounce.moduleManager.getModule(KillAura.class);
}
@EventTarget
public void onTick(TickEvent event) {
if (modeValue.get().equalsIgnoreCase("jello") && !aura.getTargetModeValue().get().equalsIgnoreCase("multi"))
al = AnimationUtils.changer(al, (aura.getTarget() != null ? jelloFadeSpeedValue.get() : -jelloFadeSpeedValue.get()), 0F, colorAlphaValue.get() / 255.0F);
}
@EventTarget
public void onRender3D(Render3DEvent event) {
if (modeValue.get().equalsIgnoreCase("jello") && !aura.getTargetModeValue().get().equalsIgnoreCase("multi")) {
double lastY = yPos;
if (al > 0F) {
if (System.currentTimeMillis() - lastMS >= 1000L) {
direction = -direction;
lastMS = System.currentTimeMillis();
}
long weird = (direction > 0 ? System.currentTimeMillis() - lastMS : 1000L - (System.currentTimeMillis() - lastMS));
progress = (double)weird / 1000D;
lastDeltaMS = System.currentTimeMillis() - lastMS;
} else { // keep the progress
lastMS = System.currentTimeMillis() - lastDeltaMS;
}
if (aura.getTarget() != null) {
entity = aura.getTarget();
bb = entity.getEntityBoundingBox();
}
if (bb == null || entity == null) return;
double radius = bb.maxX - bb.minX;
double height = bb.maxY - bb.minY;
double posX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * mc.timer.renderPartialTicks;
double posY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * mc.timer.renderPartialTicks;
double posZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * mc.timer.renderPartialTicks;
yPos = easeInOutQuart(progress) * height;
double deltaY = (direction > 0 ? yPos - lastY : lastY - yPos) * -direction * jelloGradientHeightValue.get();
if (al <= 0 && entity != null) {
entity = null;
return;
}
Color colour = getColor(entity);
float r = colour.getRed() / 255.0F;
float g = colour.getGreen() / 255.0F;
float b = colour.getBlue() / 255.0F;
pre3D();
//post circles
GL11.glTranslated(-mc.getRenderManager().viewerPosX, -mc.getRenderManager().viewerPosY, -mc.getRenderManager().viewerPosZ);
GL11.glBegin(GL11.GL_QUAD_STRIP);
for (int i = 0; i <= 360; i++) {
double calc = i * Math.PI / 180;
double posX2 = posX - Math.sin(calc) * radius;
double posZ2 = posZ + Math.cos(calc) * radius;
GL11.glColor4f(r, g, b, 0F);
GL11.glVertex3d(posX2, posY + yPos + deltaY, posZ2);
GL11.glColor4f(r, g, b, al * jelloAlphaValue.get());
GL11.glVertex3d(posX2, posY + yPos, posZ2);
}
GL11.glEnd();
drawCircle(posX, posY + yPos, posZ, jelloWidthValue.get(), radius, r, g, b, al);
post3D();
} else if (modeValue.get().equalsIgnoreCase("default")) {
if (!aura.getTargetModeValue().get().equalsIgnoreCase("multi") && aura.getTarget() != null) RenderUtils.drawPlatform(aura.getTarget(), (aura.getHitable()) ? ColorUtils.reAlpha(getColor(aura.getTarget()), colorAlphaValue.get()) : new Color(255, 0, 0, colorAlphaValue.get()));
} else if (modeValue.get().equalsIgnoreCase("tracers")) {
if (!aura.getTargetModeValue().get().equalsIgnoreCase("multi") && aura.getTarget() != null) {
final Tracers tracers = LiquidBounce.moduleManager.getModule(Tracers.class);
if (tracers == null) return;
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glLineWidth(thicknessValue.get());
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
GL11.glBegin(GL11.GL_LINES);
int dist = (int)(mc.thePlayer.getDistanceToEntity(aura.getTarget()) * 2);
if (dist > 255) dist = 255;
tracers.drawTraces(aura.getTarget(), getColor(aura.getTarget()), false);
GL11.glEnd();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
GlStateManager.resetColor();
}
} else {
if (!aura.getTargetModeValue().get().equalsIgnoreCase("multi") && aura.getTarget() != null) RenderUtils.drawEntityBox(aura.getTarget(), (aura.getHitable()) ? ColorUtils.reAlpha(getColor(aura.getTarget()), colorAlphaValue.get()) : new Color(255, 0, 0, colorAlphaValue.get()), false);
}
}
public final Color getColor(final Entity ent) {
if (ent instanceof EntityLivingBase) {
final EntityLivingBase entityLivingBase = (EntityLivingBase) ent;
if (colorModeValue.get().equalsIgnoreCase("Health"))
return BlendUtils.getHealthColor(entityLivingBase.getHealth(), entityLivingBase.getMaxHealth());
if (colorTeam.get()) {
final char[] chars = entityLivingBase.getDisplayName().getFormattedText().toCharArray();
int color = Integer.MAX_VALUE;
for (int i = 0; i < chars.length; i++) {
if (chars[i] != '§' || i + 1 >= chars.length)
continue;
final int index = GameFontRenderer.getColorIndex(chars[i + 1]);
if (index < 0 || index > 15)
continue;
color = ColorUtils.hexColors[index];
break;
}
return new Color(color);
}
}
switch (colorModeValue.get()) {
case "Custom":
return new Color(colorRedValue.get(), colorGreenValue.get(), colorBlueValue.get());
case "Rainbow":
return new Color(RenderUtils.getRainbowOpaque(mixerSecondsValue.get(), saturationValue.get(), brightnessValue.get(), 0));
case "Sky":
return RenderUtils.skyRainbow(0, saturationValue.get(), brightnessValue.get());
case "LiquidSlowly":
return ColorUtils.LiquidSlowly(System.nanoTime(), 0, saturationValue.get(), brightnessValue.get());
case "Mixer":
return ColorMixer.getMixedColor(0, mixerSecondsValue.get());
default:
return ColorUtils.fade(new Color(colorRedValue.get(), colorGreenValue.get(), colorBlueValue.get()), 0, 100);
}
}
public static void pre3D() {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
GL11.glDisable(2884);
}
public static void post3D() {
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
GL11.glColor4f(1, 1, 1, 1);
}
private void drawCircle(double x, double y, double z, float width, double radius, float red, float green, float blue, float alp) {
GL11.glLineWidth(width);
GL11.glBegin(GL11.GL_LINE_LOOP);
GL11.glColor4f(red, green, blue, alp);
for (int i = 0; i <= 360; i += 1) {
double posX = x - Math.sin(i * Math.PI / 180) * radius;
double posZ = z + Math.cos(i * Math.PI / 180) * radius;
GL11.glVertex3d(posX, y, posZ);
}
GL11.glEnd();
}
private double easeInOutQuart(double x) {
return (x < 0.5) ? 8 * x * x * x * x : 1 - Math.pow(-2 * x + 2, 4) / 2;
}
@Override
public String getTag() {
return modeValue.get();
}
} | 11,409 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Fullbright.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/render/Fullbright.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.render;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.ClientShutdownEvent;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.UpdateEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.value.ListValue;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@ModuleInfo(name = "Fullbright", description = "Brightens up the world around you.", category = ModuleCategory.RENDER)
public class Fullbright extends Module {
private final ListValue modeValue = new ListValue("Mode", new String[] {"Gamma", "NightVision"}, "Gamma");
private float prevGamma = -1;
@Override
public void onEnable() {
prevGamma = mc.gameSettings.gammaSetting;
}
@Override
public void onDisable() {
if(prevGamma == -1)
return;
mc.gameSettings.gammaSetting = prevGamma;
prevGamma = -1;
if(mc.thePlayer != null) mc.thePlayer.removePotionEffectClient(Potion.nightVision.id);
}
@EventTarget(ignoreCondition = true)
public void onUpdate(final UpdateEvent event) {
if (getState() || LiquidBounce.moduleManager.getModule(XRay.class).getState()) {
switch(modeValue.get().toLowerCase()) {
case "gamma":
if(mc.gameSettings.gammaSetting <= 100F)
mc.gameSettings.gammaSetting++;
break;
case "nightvision":
mc.thePlayer.addPotionEffect(new PotionEffect(Potion.nightVision.id, 1337, 1));
break;
}
}else if(prevGamma != -1) {
mc.gameSettings.gammaSetting = prevGamma;
prevGamma = -1;
}
}
@EventTarget(ignoreCondition = true)
public void onShutdown(final ClientShutdownEvent event) {
onDisable();
}
@Override
public String getTag() {
return modeValue.get();
}
}
| 2,380 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
NewGUI.java | /FileExtraction/Java_unseen/MokkowDev_LiquidBouncePlusPlus/src/main/java/net/ccbluex/liquidbounce/features/module/modules/render/NewGUI.java | /*
* LiquidBounce++ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/PlusPlusMC/LiquidBouncePlusPlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.render;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.features.module.modules.color.ColorMixer;
import net.ccbluex.liquidbounce.ui.client.clickgui.newVer.NewUi;
import net.ccbluex.liquidbounce.utils.render.ColorUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.value.*;
import java.awt.Color;
@ModuleInfo(name = "NewGUI", description = "next generation clickgui.", category = ModuleCategory.RENDER, forceNoSound = true, onlyEnable = true)
public class NewGUI extends Module {
public static final BoolValue fastRenderValue = new BoolValue("FastRender", false);
private static final ListValue colorModeValue = new ListValue("Color", new String[] {"Custom", "Sky", "Rainbow", "LiquidSlowly", "Fade", "Mixer"}, "Custom");
private static final IntegerValue colorRedValue = new IntegerValue("Red", 0, 0, 255);
private static final IntegerValue colorGreenValue = new IntegerValue("Green", 140, 0, 255);
private static final IntegerValue colorBlueValue = new IntegerValue("Blue", 255, 0, 255);
private static final FloatValue saturationValue = new FloatValue("Saturation", 1F, 0F, 1F);
private static final FloatValue brightnessValue = new FloatValue("Brightness", 1F, 0F, 1F);
private static final IntegerValue mixerSecondsValue = new IntegerValue("Seconds", 2, 1, 10);
@Override
public void onEnable() {
mc.displayGuiScreen(NewUi.getInstance());
}
public static Color getAccentColor() {
Color c = new Color(255, 255, 255, 255);
switch (colorModeValue.get().toLowerCase()) {
case "custom":
c = new Color(colorRedValue.get(), colorGreenValue.get(), colorBlueValue.get());
break;
case "rainbow":
c = new Color(RenderUtils.getRainbowOpaque(mixerSecondsValue.get(), saturationValue.get(), brightnessValue.get(), 0));
break;
case "sky":
c = RenderUtils.skyRainbow(0, saturationValue.get(), brightnessValue.get());
break;
case "liquidslowly":
c = ColorUtils.LiquidSlowly(System.nanoTime(), 0, saturationValue.get(), brightnessValue.get());
break;
case "fade":
c = ColorUtils.fade(new Color(colorRedValue.get(), colorGreenValue.get(), colorBlueValue.get()), 0, 100);
break;
case "mixer":
c = ColorMixer.getMixedColor(0, mixerSecondsValue.get());
break;
}
return c;
}
}
| 2,976 | Java | .java | MokkowDev/LiquidBouncePlusPlus | 82 | 28 | 3 | 2022-07-27T12:21:34Z | 2023-12-31T08:57:34Z |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.