Merge pull request #2 from zeroeightysix/master

Merge new commits from 086 to 064
This commit is contained in:
Christofer Minestar 2018-10-29 16:07:21 -04:00 committed by GitHub
commit e955f75392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 489 additions and 139 deletions

24
.github/ISSUE_TEMPLATE/bug-report.md vendored Normal file
View File

@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

5
.gitignore vendored
View File

@ -143,6 +143,9 @@ run/
.idea/**/gradle.xml
.idea/**/libraries
# Building
classes
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
@ -267,4 +270,4 @@ gradle-app.setting
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
# End of https://www.gitignore.io/api/linux,gradle,eclipse,windows,forgegradle,intellij+all,emacs,vim
# End of https://www.gitignore.io/api/linux,gradle,eclipse,windows,forgegradle,intellij+all,emacs,vim

View File

@ -1,20 +1,16 @@
language: java
jdk:
- oraclejdk8
before_install:
- chmod +x gradlew
- "./gradlew setupDecompWorkspace"
deploy:
- provider: releases
provider: releases
api_key:
secure: XdbjD4VQ2vXFPEwOBm9Snn1r6n+btyaHCCdCSTu4J48rTzys29Ud9ZSJK3QnpOaiHKUZP6YyP9xmYRrVWkdCJQhSZ5CYmJZeQuiwGaWL7r7ntiDVhpbxcp/ajbMCk8U1+yj8kR0unl3grnM56Ui1Oqs+CSjB29OIh+qcJs8d16vL4fYF7lQtjcVA4FKTHe3/G5HGq4nS9bmaqokjKpLSlLj/TQowsLuO3t44iTXzP3fjp4dViA2Cb7CFSOrs6yyQhNulohRMkK/0JvnwcCGQJS83cUNpKsoCWM8cDO3iZ/Me5uHq01mu1ziwBCd3cAXjepf46DvL1KGQa/OrZiI4/f9fDuTPIwh4SdKj50I88Mdh2P63AJKn+qd/i+c7MlPjqBm0pT5VT2m0CRI6dVSKmapscK5Qsto0b96lq4fQqJUPa7w622u1tTx2h6ovS4jMNhM5bMn4FN4Y1K+jWKTQw3ShOd5o4kS5yjJnDSa1pMJLyowywCFEnS4hA6RvbYRbigZvEzHypnDPNgOoSPQB6L517gInxdz4BTS619LPrJq3ae8Nmv4xMvWcjxT0DHsAWWJ9qUx+I7mF+XSt0qc0zgEPA7I50g/gx9ki0VX7BD9bv5/+jWZjZh+H1FyKtMczQRjgoF/6ferJ7tg1AaZUioW7JpFlT3U03vCQ7HLVLPw=
secure: GV6VEpKw8t5MyHVnv7PJqlIVXxXLmwTmMY9LMKRkCo475/SPC9R1JGR9awudpHlJSJWenaGyDRBCQpnbK4K/LeJHRByvTjBbZHQ5ZYELgwmwjG3L8W4dLgjEhltbJdvVChezEA4b8W3IFYr2K0vt8N9JUceIAUVmDA6X81e3boe99qyX8AOg0qXUIjVEWj0hgaXTe66Z7cylVe2po5LMO3Ke+gsdgRV2WZorX4Bc+DlYmdTXaOkGeUTZgOmju3Hv0LL6cezf/YZ2bV2d3+ZNgJc5nOaSxaE+LRP9MXn8oP7rqIxFWQU13AV24vwcK4L6EYpQ8eSDOXg4/DY13vHRNpdQHyb3Bqt6oDw86cD0wBEaZzG8tXlPYxxGsB99DvcVAUEFQSwCdQplS7Vidh29cEwl06olDVfjLfsaMxTceZ/iQLZgBCgVcDHJNo18/GkKiW5ut6lIPeNxV2S8aAmcQO57Ko0e3jhGgMe7JX/itdZIVDqM37maNVFJkczLsl0RuQGKRGBjNFxOgd/wHQsUKHXzbVbq4PjzzPbTwVWu6tzcpSoA7ZYVToyfoJ+jBogc3mZ0Khb/8BpVHu4aBQyI1rTdnV44v6GaMNrBUyT/yzpgScRYz1yC+4d8TM7CWgbWaOPYdq7jYIX6LMRx2tXDRu3oGdJvUrn/Plx5Upb6wYw=
file: build/libs/KAMI-*-release.jar
file_glob: true
skip_cleanup: true
on:
repo: wine/KAMI
repo: zeroeightysix/KAMI
tags: true

View File

@ -1,19 +0,0 @@
## Expected behavior
## Actual behavior
## Steps to reproduce the problem
1.
2.
3.
## Specifications
- Version:
- Platform:
**Note**: You don't need to follow this template unless you have a issue with something not existing, instead just write your own issue with what you want added. **Please remove this bottom text in your issue**

56
LICENSE.md Normal file
View File

@ -0,0 +1,56 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

View File

@ -1,4 +1,6 @@
# KAMI
[![Build Status](https://travis-ci.com/zeroeightysix/KAMI.svg?branch=master)](https://travis-ci.com/zeroeightysix/KAMI)
[![Maintainability](https://api.codeclimate.com/v1/badges/81228111eb82b7ca391e/maintainability)](https://codeclimate.com/github/zeroeightysix/KAMI/maintainability)
[![Issues](https://img.shields.io/github/issues/zeroeightysix/kami.svg)](https://github.com/zeroeightysix/kami/issues)
[![Discord](https://img.shields.io/badge/chat-on%20discord-brightgreen.svg)](http://discord.gg/9hvwgeg)
@ -6,7 +8,7 @@ A minecraft utility mod for anarchy servers.
See [forgehax](https://github.com/fr1kin/forgehax) for a more polished equivalent. Some features in KAMI may be based on those of forgehax, as I sometimes used it as reference.
This is by no means a finished project and isn't fully ready for release.
This is by no means a finished project and is still in rapid development.
## Installing

View File

@ -28,7 +28,7 @@ public class CommandManager {
}
}
}
KamiMod.log.info("Commands intialised");
KamiMod.log.info("Commands initialised");
}
public void callCommand(String command){

View File

@ -42,9 +42,11 @@ public class HelpCommand extends Command {
if (args[0] == null) {
Command.sendStringChatMessage(new String[]{
"KAMI " + KamiMod.MODVER,
"&7commands&r to view all available commands",
"&7bind <module> <key>&r to bind mods",
"press &b" + ModuleManager.getModuleByName("ClickGUI").getBindName() + "&r to open GUI"
"commands&7 to view all available commands",
"bind <module> <key>&7 to bind mods",
"&7Press &r" + ModuleManager.getModuleByName("ClickGUI").getBindName() + "&7 to open GUI",
"prefix <prefix>&r to change the command prefix.",
"help <subjects:[subject]> &r for more help."
});
}else{
String subject = args[0];

View File

@ -12,6 +12,8 @@ import me.zeroeightsix.kami.setting.Named;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.impl.BooleanSetting;
import me.zeroeightsix.kami.setting.impl.EnumSetting;
import me.zeroeightsix.kami.setting.impl.numerical.DoubleSetting;
import me.zeroeightsix.kami.setting.impl.numerical.FloatSetting;
import me.zeroeightsix.kami.setting.impl.numerical.IntegerSetting;
import me.zeroeightsix.kami.setting.impl.numerical.NumberSetting;
import me.zeroeightsix.kami.util.Bind;
@ -68,7 +70,13 @@ public class SettingsPanel extends OrganisedContainer {
slider.addPoof(new Slider.SliderPoof<UnboundSlider, Slider.SliderPoof.SliderPoofInfo>() {
@Override
public void execute(UnboundSlider component, SliderPoofInfo info) {
setting.setValue(info.getNewValue());
if (setting instanceof IntegerSetting)
setting.setValue(new Integer((int) info.getNewValue()));
else if (setting instanceof FloatSetting)
setting.setValue(new Float(info.getNewValue()));
else if (setting instanceof DoubleSetting)
setting.setValue(info.getNewValue());
setModule(module);
}
});
if (numberSetting.getMax() != null) slider.setMax(numberSetting.getMax().doubleValue());
@ -79,7 +87,13 @@ public class SettingsPanel extends OrganisedContainer {
slider.addPoof(new Slider.SliderPoof<Slider, Slider.SliderPoof.SliderPoofInfo>() {
@Override
public void execute(Slider component, SliderPoofInfo info) {
setting.setValue(info.getNewValue());
if (setting instanceof IntegerSetting)
setting.setValue(new Integer((int) info.getNewValue()));
else if (setting instanceof FloatSetting)
setting.setValue(new Float(info.getNewValue()));
else if (setting instanceof DoubleSetting)
setting.setValue(info.getNewValue());
setModule(module);
}
});
addChild(slider);
@ -90,8 +104,10 @@ public class SettingsPanel extends OrganisedContainer {
checkButton.addPoof(new CheckButton.CheckButtonPoof<CheckButton, CheckButton.CheckButtonPoof.CheckButtonPoofInfo>() {
@Override
public void execute(CheckButton checkButton1, CheckButtonPoofInfo info) {
if (info.getAction() == CheckButtonPoofInfo.CheckButtonPoofInfoAction.TOGGLE)
if (info.getAction() == CheckButtonPoofInfo.CheckButtonPoofInfoAction.TOGGLE) {
setting.setValue(checkButton.isToggled());
setModule(module);
}
}
});
addChild(checkButton);
@ -104,6 +120,7 @@ public class SettingsPanel extends OrganisedContainer {
@Override
public void execute(EnumButton component, EnumbuttonInfo info) {
setting.setValue(con[info.getNewIndex()]);
setModule(module);
}
});
enumbutton.setIndex(Arrays.asList(con).indexOf(setting.getValue()));

View File

@ -4,6 +4,7 @@ import com.google.common.base.Predicate;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.misc.NoEntityTrace;
import me.zeroeightsix.kami.module.modules.render.AntiFog;
import me.zeroeightsix.kami.module.modules.render.Brightness;
import me.zeroeightsix.kami.module.modules.render.NoHurtCam;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.entity.EntityPlayerSP;
@ -62,12 +63,12 @@ public class MixinEntityRenderer {
@Redirect(method = "updateLightmap", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/EntityPlayerSP;isPotionActive(Lnet/minecraft/potion/Potion;)Z"))
public boolean isPotionActive(EntityPlayerSP player, Potion potion) {
return (nightVision = ModuleManager.isModuleEnabled("Brightness")) || player.isPotionActive(potion);
return (nightVision = Brightness.shouldBeActive()) || player.isPotionActive(potion);
}
@Redirect(method = "updateLightmap", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;getNightVisionBrightness(Lnet/minecraft/entity/EntityLivingBase;F)F"))
public float getNightVisionBrightnessMixin(EntityRenderer renderer, EntityLivingBase entity, float partialTicks) {
if (nightVision) return 1;
if (nightVision) return Brightness.getCurrentBrightness();
return renderer.getNightVisionBrightness(entity, partialTicks);
}

View File

@ -1,7 +1,7 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.movement.BoatSpeed;
import me.zeroeightsix.kami.module.modules.movement.EntitySpeed;
import me.zeroeightsix.kami.util.Wrapper;
import net.minecraft.client.model.ModelBoat;
import net.minecraft.client.renderer.GlStateManager;
@ -19,8 +19,8 @@ public class MixinModelBoat {
@Inject(method = "render", at = @At("HEAD"))
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale, CallbackInfo info) {
if (Wrapper.getPlayer().getRidingEntity()==entityIn && ModuleManager.isModuleEnabled("BoatSpeed")) {
GlStateManager.color(1,1,1, BoatSpeed.getOpacity());
if (Wrapper.getPlayer().getRidingEntity() == entityIn && ModuleManager.isModuleEnabled("EntitySpeed")) {
GlStateManager.color(1, 1, 1, EntitySpeed.getOpacity());
GlStateManager.enableBlend();
}
}

View File

@ -46,7 +46,7 @@ public class ModuleManager {
System.err.println("Couldn't initiate module " + aClass.getSimpleName() + "! Err: " + e.getClass().getSimpleName() + ", message: " + e.getMessage());
}
});
KamiMod.log.info("Modules initialized");
KamiMod.log.info("Modules initialised");
getModules().sort(Comparator.comparing(Module::getName));
}

View File

@ -1,71 +0,0 @@
package me.zeroeightsix.kami.module.modules.movement;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.util.EntityUtil;
import net.minecraft.entity.item.EntityBoat;
/**
* Created by 086 on 15/12/2017.
*/
@Module.Info(name = "BoatSpeed", category = Module.Category.MOVEMENT)
public class BoatSpeed extends Module {
private Setting<Float> speed = register(Settings.f("Speed", .5f));
private Setting<Float> opacity = register(Settings.f("Opacity", .5f));
private static BoatSpeed INSTANCE;
public BoatSpeed() {
INSTANCE = this;
}
@Override
public void onRender() {
if (isDisabled()) return;
EntityBoat boat = getBoat();
if (boat == null) return;
boat.rotationYaw = mc.player.rotationYaw;
boat.updateInputs(false, false, false, false); // Make sure the boat doesn't turn etc (params: isLeftDown, isRightDown, isForwardDown, isBackDown)
}
@Override
public void onUpdate() {
EntityBoat boat = getBoat();
if (boat == null) return;
int angle;
boolean forward = mc.gameSettings.keyBindForward.isKeyDown();
boolean left = mc.gameSettings.keyBindLeft.isKeyDown();
boolean right = mc.gameSettings.keyBindRight.isKeyDown();
boolean back = mc.gameSettings.keyBindBack.isKeyDown();
if (!(forward && back)) boat.motionY = 0;
if (mc.gameSettings.keyBindJump.isKeyDown()) boat.motionY += speed.getValue() / 2f;
if (!forward && !left && !right && !back) return;
if (left && right) angle = forward ? 0 : back ? 180 : -1;
else if (forward && back) angle = left ? -90 : (right ? 90 : -1);
else {
angle = left ? -90 : (right ? 90 : 0);
if (forward) angle /= 2;
else if (back) angle = 180 - (angle / 2);
}
if (angle == -1) return;
float yaw = mc.player.rotationYaw + angle;
boat.motionX = EntityUtil.getRelativeX(yaw) * speed.getValue();
boat.motionZ = EntityUtil.getRelativeZ(yaw) * speed.getValue();
}
private EntityBoat getBoat() {
if (mc.player.getRidingEntity() != null && mc.player.getRidingEntity() instanceof EntityBoat)
return (EntityBoat) mc.player.getRidingEntity();
return null;
}
public static float getOpacity() {
return INSTANCE.opacity.getValue();
}
}

View File

@ -3,6 +3,9 @@ package me.zeroeightsix.kami.module.modules.movement;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.util.EntityUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityBoat;
import net.minecraft.entity.passive.AbstractHorse;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityPig;
@ -17,41 +20,100 @@ public class EntitySpeed extends Module {
private Setting<Float> speed = register(Settings.f("Speed", 1));
private Setting<Boolean> antiStuck = register(Settings.b("AntiStuck"));
private Setting<Boolean> flight = register(Settings.b("Flight", false));
private Setting<Boolean> wobble = register(Settings.booleanBuilder("Wobble").withValue(true).withVisibility(b -> flight.getValue()).build());
private static Setting<Float> opacity = Settings.f("Boat opacity", .5f);
public EntitySpeed() {
register(opacity);
}
@Override
public void onUpdate() {
if (isEnabled() && (mc.world != null) && (mc.player.getRidingEntity() != null) && (mc.player.getRidingEntity() instanceof EntityPig || mc.player.getRidingEntity() instanceof AbstractHorse))
{
if (mc.player.getRidingEntity().onGround) {
mc.player.getRidingEntity().motionY = 0.4D;
}
mc.player.getRidingEntity().motionY = -0.4D;
setMoveSpeedEntity(speed.getValue() * 3.8D);
if (mc.player.getRidingEntity() instanceof EntityHorse){
mc.player.getRidingEntity().rotationYaw = mc.player.rotationYaw;
if ((mc.world != null) && (mc.player.getRidingEntity() != null)) {
Entity riding = mc.player.getRidingEntity();
if (riding instanceof EntityPig || riding instanceof AbstractHorse) {
steerEntity(riding);
} else if (riding instanceof EntityBoat) {
steerBoat(getBoat());
}
}
}
private void setMoveSpeedEntity(double speed) {
if (mc.player.getRidingEntity() != null)
{
private void steerEntity(Entity entity) {
if (!flight.getValue()) {
entity.motionY = -0.4D;
}
if (flight.getValue()) {
if (mc.gameSettings.keyBindJump.isKeyDown())
entity.motionY = speed.getValue();
else if (mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown())
entity.motionY = wobble.getValue() ? Math.sin(mc.player.ticksExisted) : 0;
}
moveForward(entity, speed.getValue() * 3.8D);
if (entity instanceof EntityHorse){
entity.rotationYaw = mc.player.rotationYaw;
}
}
private void steerBoat(EntityBoat boat) {
if (boat == null) return;
int angle;
boolean forward = mc.gameSettings.keyBindForward.isKeyDown();
boolean left = mc.gameSettings.keyBindLeft.isKeyDown();
boolean right = mc.gameSettings.keyBindRight.isKeyDown();
boolean back = mc.gameSettings.keyBindBack.isKeyDown();
if (!(forward && back)) boat.motionY = 0;
if (mc.gameSettings.keyBindJump.isKeyDown()) boat.motionY += speed.getValue() / 2f;
if (!forward && !left && !right && !back) return;
if (left && right) angle = forward ? 0 : back ? 180 : -1;
else if (forward && back) angle = left ? -90 : (right ? 90 : -1);
else {
angle = left ? -90 : (right ? 90 : 0);
if (forward) angle /= 2;
else if (back) angle = 180 - (angle / 2);
}
if (angle == -1) return;
float yaw = mc.player.rotationYaw + angle;
boat.motionX = EntityUtil.getRelativeX(yaw) * speed.getValue();
boat.motionZ = EntityUtil.getRelativeZ(yaw) * speed.getValue();
}
@Override
public void onRender() {
EntityBoat boat = getBoat();
if (boat == null) return;
boat.rotationYaw = mc.player.rotationYaw;
boat.updateInputs(false, false, false, false); // Make sure the boat doesn't turn etc (params: isLeftDown, isRightDown, isForwardDown, isBackDown)
}
private EntityBoat getBoat() {
if (mc.player.getRidingEntity() != null && mc.player.getRidingEntity() instanceof EntityBoat)
return (EntityBoat) mc.player.getRidingEntity();
return null;
}
private void moveForward(Entity entity, double speed) {
if (entity != null) {
MovementInput movementInput = mc.player.movementInput;
double forward = movementInput.moveForward;
double strafe = movementInput.moveStrafe;
boolean movingForward = forward != 0;
boolean movingStrafe = strafe != 0;
float yaw = mc.player.rotationYaw;
if ((forward == 0.0D) && (strafe == 0.0D))
{
mc.player.getRidingEntity().motionX = 0.0D;
mc.player.getRidingEntity().motionZ = 0.0D;
}
else
{
if (forward != 0.0D)
{
if (!movingForward && !movingStrafe) {
setEntitySpeed(entity, 0, 0);
} else {
if (forward != 0.0D) {
if (strafe > 0.0D) {
yaw += (forward > 0.0D ? -45 : 45);
} else if (strafe < 0.0D) {
@ -68,13 +130,25 @@ public class EntitySpeed extends Module {
double motX = (forward * speed * Math.cos(Math.toRadians(yaw + 90.0F)) + strafe * speed * Math.sin(Math.toRadians(yaw + 90.0F)));
double motZ = (forward * speed * Math.sin(Math.toRadians(yaw + 90.0F)) - strafe * speed * Math.cos(Math.toRadians(yaw + 90.0F)));
if (antiStuck.getValue() && mc.world.getChunkFromChunkCoords((int) (mc.player.getRidingEntity().posX + motX) >> 4, (int) (mc.player.getRidingEntity().posZ + motZ) >> 4) instanceof EmptyChunk)
if (isBorderingChunk(entity, motX, motZ))
motX = motZ = 0;
mc.player.getRidingEntity().motionX = motX;
mc.player.getRidingEntity().motionZ = motZ;
setEntitySpeed(entity, motX, motZ);
}
}
}
private void setEntitySpeed(Entity entity, double motX, double motZ) {
entity.motionX = motX;
entity.motionZ = motZ;
}
private boolean isBorderingChunk(Entity entity, double motX, double motZ) {
return antiStuck.getValue() && mc.world.getChunkFromChunkCoords((int) (entity.posX + motX) >> 4, (int) (entity.posZ + motZ) >> 4) instanceof EmptyChunk;
}
public static float getOpacity() {
return opacity.getValue();
}
}

View File

@ -28,7 +28,7 @@ public class ArmorHUD extends Module {
ScaledResolution resolution = new ScaledResolution(mc);
int i = resolution.getScaledWidth() / 2;
int iteration = 0;
int y = resolution.getScaledHeight() - 55;
int y = resolution.getScaledHeight() - 55 - (mc.player.isInWater() ? 10 : 0);
for (ItemStack is : mc.player.inventory.armorInventory) {
iteration++;
if (is.isEmpty()) continue;

View File

@ -1,6 +1,11 @@
package me.zeroeightsix.kami.module.modules.render;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import java.util.Stack;
import java.util.function.Function;
/**
* Created by 086 on 12/12/2017.
@ -9,4 +14,100 @@ import me.zeroeightsix.kami.module.Module;
@Module.Info(name = "Brightness", description = "Makes everything brighter!", category = Module.Category.RENDER)
public class Brightness extends Module {
private Setting<Boolean> transition = register(Settings.b("Transition", true));
private Setting<Float> seconds = register(Settings.floatBuilder("Seconds").withMinimum(0f).withMaximum(10f).withValue(1f).withVisibility(o -> transition.getValue()).build());
private Setting<Transition> mode = register(Settings.enumBuilder(Transition.class).withName("Mode").withValue(Transition.SINE).withVisibility(o -> transition.getValue()).build());
private Stack<Float> transitionStack = new Stack<>();
private static float currentBrightness = 0;
private static boolean inTransition = false;
private void addTransition(boolean isUpwards) {
if (transition.getValue()) {
int length = (int) (seconds.getValue() * 20);
float[] values;
switch (mode.getValue()) {
case LINEAR:
values = linear(length, isUpwards);
break;
case SINE:
values = sine(length, isUpwards);
break;
default:
values = new float[]{0};
break;
}
for (float v : values) {
transitionStack.add(v);
}
inTransition = true;
}
}
@Override
protected void onEnable() {
super.onEnable();
addTransition(true);
}
@Override
protected void onDisable() {
setAlwaysListening(true);
super.onDisable();
addTransition(false);
}
@Override
public void onUpdate() {
if (inTransition) {
if (transitionStack.isEmpty()) {
inTransition = false;
setAlwaysListening(false);
currentBrightness = isEnabled() ? 1 : 0;
} else {
currentBrightness = transitionStack.pop();
}
}
}
private float[] createTransition(int length, boolean upwards, Function<Float, Float> function) {
float[] transition = new float[length];
for (int i = 0; i < length; i++) {
float v = function.apply(((float) i / (float) length));
if (upwards) v = 1 - v;
transition[i] = v;
}
return transition;
}
private float[] linear(int length, boolean polarity) { // length of 20 = 1 second
return createTransition(length, polarity, d -> d);
}
private float sine(float x) { // (sin(pi*x-(pi/2)) + 1) / 2
return ((float) Math.sin(Math.PI * x - Math.PI / 2) + 1) / 2;
}
private float[] sine(int length, boolean polarity) {
return createTransition(length, polarity, this::sine);
}
public static float getCurrentBrightness() {
return currentBrightness;
}
public static boolean isInTransition() {
return inTransition;
}
public static boolean shouldBeActive() {
return isInTransition() || currentBrightness == 1; // if in transition or enabled
}
public enum Transition {
LINEAR, SINE;
}
}

View File

@ -3,6 +3,9 @@ package me.zeroeightsix.kami.setting.builder.numerical;
import me.zeroeightsix.kami.setting.impl.numerical.DoubleSetting;
import me.zeroeightsix.kami.setting.impl.numerical.NumberSetting;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
/**
* Created by 086 on 13/10/2018.
*/
@ -11,4 +14,50 @@ public class DoubleSettingBuilder extends NumericalSettingBuilder<Double> {
public NumberSetting build() {
return new DoubleSetting(initialValue, predicate(), consumer(), name, visibilityPredicate(), min, max);
}
@Override
public DoubleSettingBuilder withVisibility(Predicate<Double> predicate) {
return (DoubleSettingBuilder) super.withVisibility(predicate);
}
@Override
public DoubleSettingBuilder withRestriction(Predicate<Double> predicate) {
return (DoubleSettingBuilder) super.withRestriction(predicate);
}
@Override
public DoubleSettingBuilder withConsumer(BiConsumer<Double, Double> consumer) {
return (DoubleSettingBuilder) super.withConsumer(consumer);
}
@Override
public DoubleSettingBuilder withValue(Double value) {
return (DoubleSettingBuilder) super.withValue(value);
}
@Override
public DoubleSettingBuilder withRange(Double minimum, Double maximum) {
return (DoubleSettingBuilder) super.withRange(minimum, maximum);
}
@Override
public DoubleSettingBuilder withMaximum(Double maximum) {
return (DoubleSettingBuilder) super.withMaximum(maximum);
}
@Override
public DoubleSettingBuilder withListener(BiConsumer<Double, Double> consumer) {
return (DoubleSettingBuilder) super.withListener(consumer);
}
@Override
public DoubleSettingBuilder withName(String name) {
return (DoubleSettingBuilder) super.withName(name);
}
@Override
public DoubleSettingBuilder withMinimum(Double minimum) {
return (DoubleSettingBuilder) super.withMinimum(minimum);
}
}

View File

@ -3,6 +3,9 @@ package me.zeroeightsix.kami.setting.builder.numerical;
import me.zeroeightsix.kami.setting.impl.numerical.FloatSetting;
import me.zeroeightsix.kami.setting.impl.numerical.NumberSetting;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
/**
* Created by 086 on 13/10/2018.
*/
@ -11,4 +14,50 @@ public class FloatSettingBuilder extends NumericalSettingBuilder<Float> {
public NumberSetting build() {
return new FloatSetting(initialValue, predicate(), consumer(), name, visibilityPredicate(), min, max);
}
@Override
public FloatSettingBuilder withMinimum(Float minimum) {
return (FloatSettingBuilder) super.withMinimum(minimum);
}
@Override
public FloatSettingBuilder withName(String name) {
return (FloatSettingBuilder) super.withName(name);
}
@Override
public FloatSettingBuilder withListener(BiConsumer<Float, Float> consumer) {
return (FloatSettingBuilder) super.withListener(consumer);
}
@Override
public FloatSettingBuilder withMaximum(Float maximum) {
return (FloatSettingBuilder) super.withMaximum(maximum);
}
@Override
public FloatSettingBuilder withRange(Float minimum, Float maximum) {
return (FloatSettingBuilder) super.withRange(minimum, maximum);
}
@Override
public FloatSettingBuilder withConsumer(BiConsumer<Float, Float> consumer) {
return (FloatSettingBuilder) super.withConsumer(consumer);
}
@Override
public FloatSettingBuilder withValue(Float value) {
return (FloatSettingBuilder) super.withValue(value);
}
@Override
public FloatSettingBuilder withVisibility(Predicate<Float> predicate) {
return (FloatSettingBuilder) super.withVisibility(predicate);
}
@Override
public FloatSettingBuilder withRestriction(Predicate<Float> predicate) {
return (FloatSettingBuilder) super.withRestriction(predicate);
}
}

View File

@ -3,6 +3,9 @@ package me.zeroeightsix.kami.setting.builder.numerical;
import me.zeroeightsix.kami.setting.impl.numerical.IntegerSetting;
import me.zeroeightsix.kami.setting.impl.numerical.NumberSetting;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
/**
* Created by 086 on 13/10/2018.
*/
@ -11,4 +14,49 @@ public class IntegerSettingBuilder extends NumericalSettingBuilder<Integer> {
public NumberSetting build() {
return new IntegerSetting(initialValue, predicate(), consumer(), name, visibilityPredicate(), min, max);
}
@Override
public IntegerSettingBuilder withMinimum(Integer minimum) {
return (IntegerSettingBuilder) super.withMinimum(minimum);
}
@Override
public NumericalSettingBuilder withName(String name) {
return (IntegerSettingBuilder) super.withName(name);
}
@Override
public IntegerSettingBuilder withListener(BiConsumer<Integer, Integer> consumer) {
return (IntegerSettingBuilder) super.withListener(consumer);
}
@Override
public IntegerSettingBuilder withMaximum(Integer maximum) {
return (IntegerSettingBuilder) super.withMaximum(maximum);
}
@Override
public IntegerSettingBuilder withRange(Integer minimum, Integer maximum) {
return (IntegerSettingBuilder) super.withRange(minimum, maximum);
}
@Override
public IntegerSettingBuilder withValue(Integer value) {
return (IntegerSettingBuilder) super.withValue(value);
}
@Override
public IntegerSettingBuilder withConsumer(BiConsumer<Integer, Integer> consumer) {
return (IntegerSettingBuilder) super.withConsumer(consumer);
}
@Override
public IntegerSettingBuilder withRestriction(Predicate<Integer> predicate) {
return (IntegerSettingBuilder) super.withRestriction(predicate);
}
@Override
public IntegerSettingBuilder withVisibility(Predicate<Integer> predicate) {
return (IntegerSettingBuilder) super.withVisibility(predicate);
}
}

View File

@ -64,6 +64,7 @@ public class Configuration {
loadConfiguration(register.subregister(key), element.getAsJsonObject());
} else {
Setting setting = register.getSetting(key);
if (setting == null) continue;
setting.setValue(((Convertable) setting).converter().reverse().convert(element));
}
}