Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 authored Sep 3, 2023
2 parents 2d56a4c + eda306b commit 79ba48d
Show file tree
Hide file tree
Showing 139 changed files with 2,267 additions and 1,459 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
blank_issues_enabled: true
contact_links:
- name: Reddit Community
url: https://www.reddit.com/r/WurstClient/
- name: WurstForum
url: https://wurstforum.net/?utm_source=GitHub&utm_medium=Wurst7+repo
about: For general discussion, support, memes, etc.
- name: Contact Alexander
url: https://www.wurstclient.net/contact/?utm_source=GitHub&utm_medium=Wurst7&utm_campaign=Issues&utm_content=Contact+Alexander
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,25 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
push:
branches: [ "master" ]
paths:
- '**.java'
- 'gradle**'
- 'build.gradle'
pull_request:
branches: [ "master" ]
paths:
- '**.java'
- 'gradle**'
- 'build.gradle'

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/jsonsyntax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: JSON syntax

on:
push:
branches: [ "master" ]
paths:
- '**.json'
pull_request:
Expand All @@ -14,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: json-syntax-check
- name: Check JSON syntax
uses: limitusus/json-syntax-check@v2
with:
pattern: "\\.json$"
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'maven-publish'
}

Expand Down
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Fabric Properties
# check these at https://fabricmc.net/develop/ and
# https://www.curseforge.com/minecraft/mc-mods/fabric-api
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
loader_version=0.14.21
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.14.22

#Fabric api
fabric_version=0.82.0+1.19.4
fabric_version=0.87.0+1.20.1

# Mod Properties
mod_version = v7.35.1-MC1.19.4
mod_version = v7.37-MC1.20.1
maven_group = net.wurstclient
archives_base_name = Wurst-Client

Expand Down
14 changes: 2 additions & 12 deletions src/main/java/net/wurstclient/Feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringJoiner;

import net.minecraft.client.MinecraftClient;
import net.minecraft.text.StringVisitable;
import net.minecraft.text.Style;
import net.wurstclient.event.EventManager;
import net.wurstclient.keybinds.PossibleKeybind;
import net.wurstclient.mixinterface.IMinecraftClient;
import net.wurstclient.settings.Setting;
import net.wurstclient.util.ChatUtils;

public abstract class Feature
{
Expand All @@ -48,14 +45,7 @@ public abstract class Feature

public String getWrappedDescription(int width)
{
List<StringVisitable> lines = MC.textRenderer.getTextHandler()
.wrapLines(getDescription(), width, Style.EMPTY);

StringJoiner joiner = new StringJoiner("\n");
lines.stream().map(StringVisitable::getString)
.forEach(s -> joiner.add(s));

return joiner.toString();
return ChatUtils.wrapText(getDescription(), width);
}

public Category getCategory()
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/wurstclient/WurstClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public enum WurstClient
public static MinecraftClient MC;
public static IMinecraftClient IMC;

public static final String VERSION = "7.35.1";
public static final String MC_VERSION = "1.19.4";
public static final String VERSION = "7.37";
public static final String MC_VERSION = "1.20.1";

private WurstAnalytics analytics;
private EventManager eventManager;
Expand Down
55 changes: 27 additions & 28 deletions src/main/java/net/wurstclient/ai/PathFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

import net.minecraft.block.*;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.LavaFluid;
import net.minecraft.fluid.WaterFluid;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.wurstclient.WurstClient;
Expand Down Expand Up @@ -197,15 +200,13 @@ private ArrayList<PathPos> getNeighbors(PathPos pos)
&& (flying || canClimbUpAt(pos) || goal.equals(up)
|| canSafelyStandOn(north) || canSafelyStandOn(east)
|| canSafelyStandOn(south) || canSafelyStandOn(west))
&& (divingAllowed || BlockUtils.getState(up.up())
.getMaterial() != Material.WATER))
&& (divingAllowed || BlockUtils.getBlock(up.up()) != Blocks.WATER))
neighbors.add(new PathPos(up, onGround));

// down
if(pos.getY() > WurstClient.MC.world.getBottomY() && canGoThrough(down)
&& canGoAbove(down.down()) && (flying || canFallBelow(pos))
&& (divingAllowed
|| BlockUtils.getState(pos).getMaterial() != Material.WATER))
&& (divingAllowed || BlockUtils.getBlock(pos) != Blocks.WATER))
neighbors.add(new PathPos(down));

return neighbors;
Expand Down Expand Up @@ -247,8 +248,7 @@ protected boolean isPassable(BlockPos pos)
if(!canGoAbove(pos.down()))
return false;

if(!divingAllowed
&& BlockUtils.getState(up).getMaterial() == Material.WATER)
if(!divingAllowed && BlockUtils.getBlock(up) == Blocks.WATER)
return false;

return true;
Expand All @@ -266,8 +266,7 @@ protected boolean isPassableWithoutMining(BlockPos pos)
if(!canGoAbove(pos.down()))
return false;

if(!divingAllowed
&& BlockUtils.getState(up).getMaterial() == Material.WATER)
if(!divingAllowed && BlockUtils.getBlock(up) == Blocks.WATER)
return false;

return true;
Expand All @@ -278,16 +277,15 @@ protected boolean isMineable(BlockPos pos)
return false;
}

@SuppressWarnings("deprecation")
protected boolean canBeSolid(BlockPos pos)
{
BlockState state = BlockUtils.getState(pos);
Material material = state.getMaterial();
Block block = state.getBlock();

return material.blocksMovement()
&& !(block instanceof AbstractSignBlock)
|| block instanceof LadderBlock || jesus
&& (material == Material.WATER || material == Material.LAVA);
return state.blocksMovement() && !(block instanceof AbstractSignBlock)
|| block instanceof LadderBlock
|| jesus && (block == Blocks.WATER || block == Blocks.LAVA);
}

@SuppressWarnings("deprecation")
Expand All @@ -300,9 +298,9 @@ private boolean canGoThrough(BlockPos pos)
return false;

// check if solid
Material material = BlockUtils.getState(pos).getMaterial();
Block block = BlockUtils.getBlock(pos);
if(material.blocksMovement() && !(block instanceof AbstractSignBlock))
BlockState state = BlockUtils.getState(pos);
Block block = state.getBlock();
if(state.blocksMovement() && !(block instanceof AbstractSignBlock))
return false;

// check if trapped
Expand All @@ -312,7 +310,7 @@ private boolean canGoThrough(BlockPos pos)

// check if safe
if(!invulnerable
&& (material == Material.LAVA || material == Material.FIRE))
&& (block == Blocks.LAVA || block instanceof AbstractFireBlock))
return false;

return true;
Expand All @@ -332,13 +330,14 @@ private boolean canGoAbove(BlockPos pos)
private boolean canSafelyStandOn(BlockPos pos)
{
// check if solid
Material material = BlockUtils.getState(pos).getMaterial();
if(!canBeSolid(pos))
return false;

// check if safe
if(!invulnerable
&& (material == Material.CACTUS || material == Material.LAVA))
BlockState state = BlockUtils.getState(pos);
Fluid fluid = state.getFluidState().getFluid();
if(!invulnerable && (state.getBlock() instanceof CactusBlock
|| fluid instanceof LavaFluid))
return false;

return true;
Expand Down Expand Up @@ -381,7 +380,7 @@ private boolean canFallBelow(PathPos pos)
// check if block resets fall damage
Block prevBlock = BlockUtils.getBlock(prevPos);
BlockState prevState = BlockUtils.getState(prevPos);
if(prevState.getMaterial() == Material.WATER
if(prevState.getFluidState().getFluid() instanceof WaterFluid
|| prevBlock instanceof LadderBlock
|| prevBlock instanceof VineBlock
|| prevBlock instanceof CobwebBlock)
Expand All @@ -395,8 +394,8 @@ private boolean canFallBelow(PathPos pos)

private boolean canFlyAt(BlockPos pos)
{
return flying || !noWaterSlowdown
&& BlockUtils.getState(pos).getMaterial() == Material.WATER;
return flying
|| !noWaterSlowdown && BlockUtils.getBlock(pos) == Blocks.WATER;
}

private boolean canClimbUpAt(BlockPos pos)
Expand All @@ -422,15 +421,15 @@ private boolean canMoveSidewaysInMidairAt(BlockPos pos)
{
// check feet
Block blockFeet = BlockUtils.getBlock(pos);
if(BlockUtils.getState(pos).getMaterial().isLiquid()
if(BlockUtils.getBlock(pos) instanceof FluidBlock
|| blockFeet instanceof LadderBlock
|| blockFeet instanceof VineBlock
|| blockFeet instanceof CobwebBlock)
return true;

// check head
Block blockHead = BlockUtils.getBlock(pos.up());
if(BlockUtils.getState(pos.up()).getMaterial().isLiquid()
if(BlockUtils.getBlock(pos.up()) instanceof FluidBlock
|| blockHead instanceof CobwebBlock)
return true;

Expand All @@ -445,12 +444,12 @@ private float getCost(BlockPos current, BlockPos next)
for(int i = 0; i < positions.length; i++)
{
BlockPos pos = positions[i];
Material material = BlockUtils.getState(pos).getMaterial();
Block block = BlockUtils.getBlock(pos);

// liquids
if(material == Material.WATER && !noWaterSlowdown)
if(block == Blocks.WATER && !noWaterSlowdown)
costs[i] *= 1.3164437838225804F;
else if(material == Material.LAVA)
else if(block == Blocks.LAVA)
costs[i] *= 4.539515393656079F;

// soul sand
Expand Down
Loading

0 comments on commit 79ba48d

Please sign in to comment.