-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added InteractionUtils.java, GenericScreen.java, TridentHelper.java n…
…ad changed some stuff in Placer
- Loading branch information
Showing
14 changed files
with
174 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
package net.The2019.NewBase.config; | ||
|
||
public class ModuleStates { | ||
//Hud | ||
public static String coordinateDisplay = "coordinatedisplay"; | ||
public static String biomeDisplay = "biomedisplay"; | ||
public static String fpsDisplay = "fpsdisplay"; | ||
|
||
//Render | ||
public static String beehiveRender = "beehiverender"; | ||
public static String fullBrightRender = "fullbrightrender"; | ||
|
||
//Generic | ||
public static String placer = "placer"; | ||
public static String tridentHelper = "trident"; | ||
} |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...The2019/NewBase/features/ChunkRender.java → ...NewBase/features/generic/ChunkRender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/client/java/net/The2019/NewBase/features/generic/Placer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package net.The2019.NewBase.features.generic; | ||
|
||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.util.Hand; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
|
||
import static net.The2019.NewBase.config.ModuleConfig.readModule; | ||
import static net.The2019.NewBase.config.ModuleStates.placer; | ||
import static net.The2019.NewBase.utils.InteractionUtils.placeBlock; | ||
|
||
public class Placer { | ||
private static final MinecraftClient mc = MinecraftClient.getInstance(); | ||
|
||
public static void place() { | ||
ClientTickEvents.END_CLIENT_TICK.register(client -> { | ||
if(readModule(placer)){ | ||
if (mc.player != null && mc.interactionManager != null) { | ||
BlockPos pos = mc.player.getBlockPos().add(0, -1, 0); | ||
|
||
placeBlock(Hand.OFF_HAND, pos, Direction.UP, false); | ||
} | ||
} | ||
}); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/client/java/net/The2019/NewBase/features/generic/TridentHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package net.The2019.NewBase.features.generic; | ||
|
||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.item.Items; | ||
|
||
import static net.The2019.NewBase.config.ModuleConfig.readModule; | ||
import static net.The2019.NewBase.config.ModuleStates.tridentHelper; | ||
|
||
public class TridentHelper { | ||
private static final MinecraftClient mc = MinecraftClient.getInstance(); | ||
|
||
public static void tridentHelper() { | ||
ClientTickEvents.END_CLIENT_TICK.register(client -> { | ||
if (readModule(tridentHelper)){ | ||
if (mc.player != null) { | ||
if (mc.player.getActiveItem().getItem() == Items.TRIDENT){ | ||
if( mc.player.isTouchingWater()) { | ||
mc.player.setSprinting(true); | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/client/java/net/The2019/NewBase/screens/configScreen/GenericScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package net.The2019.NewBase.screens.configScreen; | ||
|
||
import net.The2019.NewBase.screens.ConfigScreen; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.client.gui.tooltip.Tooltip; | ||
import net.minecraft.client.gui.widget.ButtonWidget; | ||
import net.minecraft.client.gui.widget.TextWidget; | ||
import net.minecraft.client.option.GameOptions; | ||
import net.minecraft.text.Text; | ||
|
||
import static net.The2019.NewBase.config.ModuleConfig.readModule; | ||
import static net.The2019.NewBase.config.ModuleConfig.saveModuleState; | ||
import static net.The2019.NewBase.config.ModuleStates.*; | ||
|
||
public class GenericScreen extends Screen { | ||
private final Screen parent; | ||
private final GameOptions settings; | ||
private static int x = 20; | ||
private static int y = 50; | ||
private static final MinecraftClient mc = MinecraftClient.getInstance(); | ||
|
||
public GenericScreen(Screen parent, GameOptions settings) { | ||
super(Text.translatable("newbase.genericscreen.name")); | ||
this.parent = parent; | ||
this.settings = settings; | ||
} | ||
|
||
@Override | ||
protected void init() { | ||
|
||
this.addDrawableChild(new ButtonWidget.Builder(Text.translatable("newbase.renderscreen.back"), button -> {mc.setScreen(new ConfigScreen(mc.currentScreen, mc.options));}).dimensions(17, 20, 100,20).build()); | ||
|
||
//Placer | ||
this.addDrawable(new TextWidget(x, y, 500, 20, Text.translatable("newbase.genericscreen.placer"), mc.textRenderer).alignLeft()); | ||
this.addDrawableChild(new ButtonWidget.Builder(toggleModule(placer), button -> { | ||
saveModuleState(placer, !readModule(placer)); | ||
mc.setScreen(new GenericScreen(mc.currentScreen, mc.options)); | ||
}).tooltip(Tooltip.of(Text.translatable("newbase.hudscreen.tooltip"))).dimensions(this.width - 220, y, 200, 20).build()); | ||
|
||
//Trident Helper | ||
this.addDrawable(new TextWidget(x, y+30, 500, 20, Text.translatable("newbase.genericscreen.tridenthelper"), mc.textRenderer).alignLeft()); | ||
this.addDrawableChild(new ButtonWidget.Builder(toggleModule(tridentHelper), button -> { | ||
saveModuleState(tridentHelper, !readModule(tridentHelper)); | ||
mc.setScreen(new GenericScreen(mc.currentScreen, mc.options)); | ||
}).tooltip(Tooltip.of(Text.translatable("newbase.hudscreen.tooltip"))).dimensions(this.width - 220, y+30, 200, 20).build()); | ||
} | ||
|
||
|
||
private static Text toggleModule(String module){ | ||
if(readModule(module)){ | ||
return Text.translatable("newbase.renderscreen.enabled"); | ||
}else { | ||
return Text.translatable("newbase.renderscreen.disabled"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/client/java/net/The2019/NewBase/utils/InteractionUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package net.The2019.NewBase.utils; | ||
|
||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.util.Hand; | ||
import net.minecraft.util.hit.BlockHitResult; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
|
||
public class InteractionUtils { | ||
private static final MinecraftClient mc = MinecraftClient.getInstance(); | ||
|
||
public static void placeBlock(Hand hand, BlockPos blockPos, Direction direction, boolean indsideBlock){ | ||
mc.interactionManager.interactBlock(mc.player, hand, new BlockHitResult(mc.player.getPos(), direction, blockPos, indsideBlock)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters