Remove arbitrary old Minebot hooks

This commit is contained in:
Brady 2018-08-08 03:37:29 -05:00
parent ebde6f26e9
commit db01331560
No known key found for this signature in database
GPG Key ID: 73A788379A197567
7 changed files with 0 additions and 224 deletions

View File

@ -41,9 +41,6 @@ public enum Baritone {
*/ */
private boolean initialized; private boolean initialized;
private Memory memory;
private HookStateManager hookStateManager;
private GameActionHandler actionHandler;
private GameEventHandler gameEventHandler; private GameEventHandler gameEventHandler;
private InputOverrideHandler inputOverrideHandler; private InputOverrideHandler inputOverrideHandler;
private List<Behavior> behaviors; private List<Behavior> behaviors;
@ -54,9 +51,6 @@ public enum Baritone {
private boolean active; private boolean active;
public void init() { public void init() {
this.memory = new Memory();
this.hookStateManager = new HookStateManager();
this.actionHandler = new GameActionHandler();
this.gameEventHandler = new GameEventHandler(); this.gameEventHandler = new GameEventHandler();
this.inputOverrideHandler = new InputOverrideHandler(); this.inputOverrideHandler = new InputOverrideHandler();
this.behaviors = new ArrayList<>(); this.behaviors = new ArrayList<>();
@ -72,18 +66,6 @@ public enum Baritone {
return this.initialized; return this.initialized;
} }
public final Memory getMemory() {
return this.memory;
}
public final HookStateManager getHookStateManager() {
return this.hookStateManager;
}
public final GameActionHandler getActionHandler() {
return this.actionHandler;
}
public final GameEventHandler getGameEventHandler() { public final GameEventHandler getGameEventHandler() {
return this.gameEventHandler; return this.gameEventHandler;
} }

View File

@ -1,34 +0,0 @@
/*
* This file is part of Baritone.
*
* Baritone 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.
*
* Baritone 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 Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.bot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
/**
* @author Brady
* @since 7/31/2018 10:56 PM
*/
public final class GameActionHandler {
GameActionHandler() {
}
public final void onPlacedBlock(ItemStack stack, BlockPos pos) {
}
}

View File

@ -1,42 +0,0 @@
/*
* This file is part of Baritone.
*
* Baritone 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.
*
* Baritone 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 Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.bot;
import java.util.ArrayList;
import java.util.List;
/**
* @author Brady
* @since 7/31/2018 10:29 PM
*/
public final class HookStateManager {
HookStateManager() {}
public final boolean shouldCancelDebugRenderRight() {
return false;
}
public final boolean shouldOverrideDebugInfoLeft() {
return false;
}
public final List<String> getDebugInfoLeft() {
return new ArrayList<>();
}
}

View File

@ -1,41 +0,0 @@
/*
* This file is part of Baritone.
*
* Baritone 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.
*
* Baritone 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 Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.bot;
import net.minecraft.util.math.BlockPos;
/**
* @author Brady
* @since 7/31/2018 10:50 PM
*/
public final class Memory {
public final void scanBlock(BlockPos pos) {
checkActive(() -> {
// We might want to always run this method even if Baritone
// isn't active, this is just an example of the implementation
// of checkActive(Runnable).
});
}
private void checkActive(Runnable runnable) {
if (Baritone.INSTANCE.isActive()) {
runnable.run();
}
}
}

View File

@ -1,67 +0,0 @@
/*
* This file is part of Baritone.
*
* Baritone 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.
*
* Baritone 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 Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.launch.mixins;
import baritone.bot.HookStateManager;
import baritone.bot.Baritone;
import net.minecraft.client.gui.GuiOverlayDebug;
import net.minecraft.client.gui.ScaledResolution;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List;
/**
* @author Brady
* @since 7/31/2018 10:28 PM
*/
@Mixin(GuiOverlayDebug.class)
public abstract class MixinGuiOverlayDebug {
@Shadow protected abstract void renderDebugInfoRight(ScaledResolution scaledResolution);
@Redirect(
method = "renderDebugInfo",
at = @At(
value = "INVOKE",
target = "net/minecraft/client/gui/GuiOverlayDebug.renderDebugInfoRight(Lnet/minecraft/client/gui/ScaledResolution;)V"
)
)
private void onRenderDebugInfoRight(GuiOverlayDebug gui, ScaledResolution scaledResolution) {
if (!Baritone.INSTANCE.getHookStateManager().shouldCancelDebugRenderRight()) {
this.renderDebugInfoRight(scaledResolution);
}
}
@Inject(
method = "call",
at = @At("HEAD"),
cancellable = true
)
private void call(CallbackInfoReturnable<List<String>> cir) {
HookStateManager hooks = Baritone.INSTANCE.getHookStateManager();
if (hooks.shouldOverrideDebugInfoLeft()) {
cir.setReturnValue(hooks.getDebugInfoLeft());
}
}
}

View File

@ -23,9 +23,6 @@ import baritone.bot.event.events.WorldEvent;
import baritone.bot.event.events.type.EventState; import baritone.bot.event.events.type.EventState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.math.BlockPos;
import org.spongepowered.asm.lib.Opcodes; import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@ -33,7 +30,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
/** /**
* @author Brady * @author Brady
@ -110,23 +106,6 @@ public class MixinMinecraft {
this.leftClickCounter = value; this.leftClickCounter = value;
} }
@Inject(
method = "rightClickMouse",
at = @At(
value = "INVOKE_ASSIGN",
target = "net/minecraft/client/entity/EntityPlayerSP.swingArm(Lnet/minecraft/util/EnumHand;)V"
),
locals = LocalCapture.CAPTURE_FAILHARD
)
private void postSwingArm(CallbackInfo ci, ItemStack stack, BlockPos pos, int stackCount, EnumActionResult result) {
Minecraft mc = (Minecraft) (Object) this;
Baritone bot = Baritone.INSTANCE;
bot.getMemory().scanBlock(pos);
bot.getMemory().scanBlock(pos.offset(mc.objectMouseOver.sideHit));
bot.getActionHandler().onPlacedBlock(stack, pos);
}
@Inject( @Inject(
method = "loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Ljava/lang/String;)V", method = "loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Ljava/lang/String;)V",
at = @At("HEAD") at = @At("HEAD")

View File

@ -9,7 +9,6 @@
"MixinEntityRenderer", "MixinEntityRenderer",
"MixinGameSettings", "MixinGameSettings",
"MixinGuiContainer", "MixinGuiContainer",
"MixinGuiOverlayDebug",
"MixinGuiScreen", "MixinGuiScreen",
"MixinKeyBinding", "MixinKeyBinding",
"MixinMain", "MixinMain",