Skip to content

Commit

Permalink
Merge branch '1.19.4' into just-unimined-update
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail authored Nov 14, 2023
2 parents a1ac87f + e183dcb commit 5795baa
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build -Pmod_version="$(git describe --always --tags | cut -c2-)"
run: ./gradlew build -Pmod_version="$(git describe --always --tags --first-parent | cut -c2-)"

- name: Archive Artifacts
uses: actions/upload-artifact@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ mapping

libs/lwjgl-platform-2.9.4-nightly-20150209-natives-osx.jar
libs/java-objc-bridge-1.1.jar

mapping
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RUN apt update -y

RUN apt install \
openjdk-17-jdk \
git \
--assume-yes

COPY . /code
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.13.2-yellow.svg" alt="Minecraft"/></a>
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.14.4-yellow.svg" alt="Minecraft"/></a>
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.15.2-yellow.svg" alt="Minecraft"/></a>
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.16.5-brightgreen.svg" alt="Minecraft"/></a>
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.16.5-yellow.svg" alt="Minecraft"/></a>
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.17.1-yellow.svg" alt="Minecraft"/></a>
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.18.2-brightgreen.svg" alt="Minecraft"/></a>
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.18.2-yellow.svg" alt="Minecraft"/></a>
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.19.2-brightgreen.svg" alt="Minecraft"/></a>
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.19.4-brightgreen.svg" alt="Minecraft"/></a>
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.20.1-brightgreen.svg" alt="Minecraft"/></a>
Expand Down Expand Up @@ -60,7 +60,7 @@ Baritone is the pathfinding system used in [Impact](https://impactclient.net/) s

| Forge | Fabric |
|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
| [1.12.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.2.18/baritone-api-forge-1.2.18.jar) | |
| [1.12.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.2.19/baritone-api-forge-1.2.19.jar) | |
| [1.16.5 Forge](https://github.com/cabaletta/baritone/releases/download/v1.6.5/baritone-api-forge-1.6.5.jar) | [1.16.5 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.6.5/baritone-api-fabric-1.6.5.jar) |
| [1.17.1 Forge](https://github.com/cabaletta/baritone/releases/download/v1.7.3/baritone-api-forge-1.7.3.jar) | [1.17.1 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.7.3/baritone-api-fabric-1.7.3.jar) |
| [1.18.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.8.5/baritone-api-forge-1.8.5.jar) | [1.18.2 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.8.5/baritone-api-fabric-1.8.5.jar) |
Expand All @@ -69,7 +69,7 @@ Baritone is the pathfinding system used in [Impact](https://impactclient.net/) s
| [1.19.4 Forge](https://github.com/cabaletta/baritone/releases/download/v1.9.3/baritone-api-forge-1.9.3.jar) | [1.19.4 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.9.3/baritone-api-fabric-1.9.3.jar) |
| [1.20.1 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.1/baritone-api-forge-1.10.1.jar) | [1.20.1 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.1/baritone-api-fabric-1.10.1.jar) |

**Message for 2b2t players looking for 1.19/1.20 Baritone** Download it from right above ^. But also please check back in a few days for Baritone Elytra ([vid 1](https://youtu.be/4bGGPo8yiHo) [vid 2](https://www.youtube.com/watch?v=pUN9nmINe3I)), which will be ported to 1.19/1.20 soon! It will work on 2b2t with its anticheat, that was the whole point of Baritone Elytra (it's fully vanilla compatible). Also join [**the discord**](http://discord.gg/s6fRBAUpmr). Thanks!
**Message for 2b2t players looking for 1.19/1.20 Baritone** If you like, please try the beta for Baritone Elytra for 2b2t, find it in #announcements of [the Baritone discord](http://discord.gg/s6fRBAUpmr). It supports 1.19.4 and 1.20.1, Forge or Fabric. If you have to see it to believe it, watch [this YouTube video](https://youtu.be/NnSlQi-68eQ).

**How to immediately get started:** Type `#goto 1000 500` in chat to go to x=1000 z=500. Type `#mine diamond_ore` to mine diamond ore. Type `#stop` to stop. For more, read [the usage page](USAGE.md) and/or watch this [tutorial playlist](https://www.youtube.com/playlist?list=PLnwnJ1qsS7CoQl9Si-RTluuzCo_4Oulpa). Also try `#elytra` for Elytra flying in the Nether using fireworks.

Expand Down
17 changes: 12 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,19 @@ allprojects {
apply plugin: "maven-publish"

archivesBaseName = rootProject.archives_base_name
def vers = 'git describe --always --dirty'.execute().text.trim()
if (vers.isEmpty()) {

def vers = ""
try {
vers = 'git describe --always --tags --first-parent --dirty'.execute().text.trim()
} catch (Exception e) {
println "Version detection failed: " + e
}
if (!vers.startsWith("v")) {
println "using version number: " + rootProject.mod_version
version = rootProject.mod_version
} else {
version = rootProject.mod_version + "-" + vers
version = vers.substring(1)
println "Detected version " + version
}
group = rootProject.maven_group

Expand Down Expand Up @@ -70,7 +77,7 @@ allprojects {
// The following line declares the yarn mappings you may select this one as well.
// mappings "net.fabricmc:yarn:1.17.1+build.32:v2"
//launchImplementation('dev.babbaj:nether-pathfinder:1.3.0')
implementation 'dev.babbaj:nether-pathfinder:1.3.0'
implementation 'dev.babbaj:nether-pathfinder:1.4.1'
}

unimined.minecraft(sourceSets.main, true) {
Expand Down Expand Up @@ -141,4 +148,4 @@ javadoc {
options.encoding "UTF-8" // allow emoji in comments :^)
source = sourceSets.api.allJava
classpath += sourceSets.api.compileClasspath
}
}
7 changes: 3 additions & 4 deletions buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ private String getJavaBinPathForProguard() throws Exception {
ex.printStackTrace();
}

path = findJavaByGradleCurrentRuntime();
if (path != null) return path;

try {
path = findJavaByJavaHome();
if (path != null) return path;
Expand All @@ -133,10 +136,6 @@ private String getJavaBinPathForProguard() throws Exception {
ex.printStackTrace();
}


path = findJavaByGradleCurrentRuntime();
if (path != null) return path;

throw new Exception("Unable to find java to determine ProGuard libraryjars. Please specify forkOptions.executable in javaCompile," +
" JAVA_HOME environment variable, or make sure to run Gradle with the correct JDK (a v1.8 only)");
}
Expand Down
2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ publishing {
repositories {
// Add repositories to publish to here.
}
}
}
11 changes: 8 additions & 3 deletions src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ public final class Settings {
/**
* Automatically elytra fly without having to force the client-sided rotations.
*/
public final Setting<Boolean> elytraFreeLook = new Setting<>(false);
public final Setting<Boolean> elytraFreeLook = new Setting<>(true);

/**
* Forces the client-sided yaw rotation to an average of the last {@link #smoothLookTicks} of server-sided rotations.
Expand All @@ -753,7 +753,7 @@ public final class Settings {
/**
* Same as {@link #smoothLook} but for elytra flying.
*/
public final Setting<Boolean> elytraSmoothLook = new Setting<>(true);
public final Setting<Boolean> elytraSmoothLook = new Setting<>(false);

/**
* The number of ticks to average across for {@link #smoothLook};
Expand Down Expand Up @@ -1426,7 +1426,7 @@ public final class Settings {
* Whether nether-pathfinder should generate terrain based on {@link #elytraNetherSeed}.
* If false all chunks that haven't been loaded are assumed to be air.
*/
public final Setting<Boolean> elytraPredictTerrain = new Setting<>(true);
public final Setting<Boolean> elytraPredictTerrain = new Setting<>(false);

/**
* Automatically swap the current elytra with a new one when the durability gets too low
Expand Down Expand Up @@ -1468,6 +1468,11 @@ public final class Settings {
*/
public final Setting<Boolean> elytraTermsAccepted = new Setting<>(false);

/**
* Verbose chat logging in elytra mode
*/
public final Setting<Boolean> elytraChatSpam = new Setting<>(false);

/**
* A map of lowercase setting field names to their respective setting
*/
Expand Down
1 change: 0 additions & 1 deletion src/main/java/baritone/behavior/LookBehavior.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public void onTick(TickEvent event) {

@Override
public void onPlayerUpdate(PlayerUpdateEvent event) {
System.out.println(event.getState() + " " + ctx.player().getXRot() + " " + ctx.player().getYRot() + " " + ctx.player().xRotO + " " + ctx.player().yRotO);

if (this.target == null) {
return;
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/baritone/cache/CachedWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ private synchronized void prune() {
int distZ = ((region.getZ() << 9) + 256) - pruneCenter.getZ();
double dist = Math.sqrt(distX * distX + distZ * distZ);
if (dist > 1024) {
if (!Baritone.settings().censorCoordinates.value) {
logDebug("Deleting cached region " + region.getX() + "," + region.getZ() + " from ram");
}
logDebug("Deleting cached region from ram");
cachedRegions.remove(getRegionID(region.getX(), region.getZ()));
}
}
Expand Down
38 changes: 30 additions & 8 deletions src/main/java/baritone/cache/FasterWorldScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import baritone.api.cache.ICachedWorld;
import baritone.api.cache.IWorldScanner;
import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.BlockOptionalMeta;
import baritone.api.utils.BlockOptionalMetaLookup;
import baritone.api.utils.IPlayerContext;
import baritone.utils.accessor.IPalettedContainer;
Expand All @@ -45,6 +46,9 @@

public enum FasterWorldScanner implements IWorldScanner {
INSTANCE;

private static final BlockState[] PALETTE_REGISTRY_SENTINEL = new BlockState[0];

@Override
public List<BlockPos> scanChunkRadius(IPlayerContext ctx, BlockOptionalMetaLookup filter, int max, int yLevelThreshold, int maxSearchRadius) {
assert ctx.world() != null;
Expand Down Expand Up @@ -151,7 +155,7 @@ private Stream<BlockPos> scanChunkInternal(IPlayerContext ctx, BlockOptionalMeta
long chunkX = (long) pos.x << 4;
long chunkZ = (long) pos.z << 4;

int playerSectionY = ctx.playerFeet().y >> 4;
int playerSectionY = (ctx.playerFeet().y - ctx.world().getMinBuildHeight()) >> 4;

return collectChunkSections(lookup, chunkProvider.getChunk(pos.x, pos.z, false), chunkX, chunkZ, playerSectionY).stream();
}
Expand Down Expand Up @@ -219,13 +223,18 @@ private void visitSection(BlockOptionalMetaLookup lookup, LevelChunkSection sect

private boolean[] getIncludedFilterIndices(BlockOptionalMetaLookup lookup, Palette<BlockState> palette) {
boolean commonBlockFound = false;
IdMapper<BlockState> paletteMap = getPalette(palette);
int size = paletteMap.size();
BlockState[] paletteMap = getPalette(palette);

if (paletteMap == PALETTE_REGISTRY_SENTINEL) {
return getIncludedFilterIndicesFromRegistry(lookup);
}

int size = paletteMap.length;

boolean[] isInFilter = new boolean[size];

for (int i = 0; i < size; i++) {
BlockState state = paletteMap.byId(i);
BlockState state = paletteMap[i];
if (lookup.has(state)) {
isInFilter[i] = true;
commonBlockFound = true;
Expand All @@ -240,21 +249,34 @@ private boolean[] getIncludedFilterIndices(BlockOptionalMetaLookup lookup, Palet
return isInFilter;
}

private boolean[] getIncludedFilterIndicesFromRegistry(BlockOptionalMetaLookup lookup) {
boolean[] isInFilter = new boolean[Block.BLOCK_STATE_REGISTRY.size()];

for (BlockOptionalMeta bom : lookup.blocks()) {
for (BlockState state : bom.getAllBlockStates()) {
isInFilter[Block.BLOCK_STATE_REGISTRY.getId(state)] = true;
}
}

return isInFilter;
}

/**
* cheats to get the actual map of id -> blockstate from the various palette implementations
*/
private static IdMapper<BlockState> getPalette(Palette<BlockState> palette) {
private static BlockState[] getPalette(Palette<BlockState> palette) {
if (palette instanceof GlobalPalette) {
return Block.BLOCK_STATE_REGISTRY;
// copying the entire registry is not nice so we treat it as a special case
return PALETTE_REGISTRY_SENTINEL;
} else {
FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
palette.write(buf);
int size = buf.readVarInt();
IdMapper<BlockState> states = new IdMapper<>();
BlockState[] states = new BlockState[size];
for (int i = 0; i < size; i++) {
BlockState state = Block.BLOCK_STATE_REGISTRY.byId(buf.readVarInt());
assert state != null;
states.addMapping(state, i);
states[i] = state;
}
return states;
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/baritone/process/BuilderProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,9 @@ private boolean valid(BlockState current, BlockState desired, boolean itemVerify
if (desired.getBlock() instanceof AirBlock && Baritone.settings().buildIgnoreBlocks.value.contains(current.getBlock())) {
return true;
}
if (!(current.getBlock() instanceof AirBlock) && Baritone.settings().buildIgnoreExisting.value && !itemVerify) {
return true;
}
if (Baritone.settings().buildSkipBlocks.value.contains(desired.getBlock()) && !itemVerify) {
return true;
}
Expand Down
22 changes: 10 additions & 12 deletions src/main/java/baritone/process/ElytraProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
private ElytraBehavior behavior;
private boolean predictingTerrain;

@Override
public void onLostControl() {
this.state = State.START_FLYING; // TODO: null state?
this.goingToLandingSpot = false;
this.landingSpot = null;
this.reachedGoal = false;
this.goal = null;
destroyBehaviorAsync();
}

private ElytraProcess(Baritone baritone) {
super(baritone);
baritone.getGameEventHandler().registerEventListener(this);
Expand Down Expand Up @@ -276,16 +286,6 @@ public void landingSpotIsBad(BetterBlockPos endPos) {
this.state = State.FLYING;
}

@Override
public void onLostControl() {
this.goal = null;
this.goingToLandingSpot = false;
this.landingSpot = null;
this.reachedGoal = false;
this.state = State.START_FLYING; // TODO: null state?
destroyBehaviorAsync();
}

private void destroyBehaviorAsync() {
ElytraBehavior behavior = this.behavior;
if (behavior != null) {
Expand Down Expand Up @@ -405,8 +405,6 @@ public enum State {

@Override
public void onRenderPass(RenderEvent event) {
System.out.println(event.getPartialTicks() + " " + ctx.player().getXRot() + " " + ctx.player().getYRot() + " " + ctx.player().xRotO + " " + ctx.player().yRotO);

if (this.behavior != null) this.behavior.onRenderPass(event);
}

Expand Down
Loading

0 comments on commit 5795baa

Please sign in to comment.