Compare commits

...

18 Commits

Author SHA1 Message Date
Dominika 4cb439ec0b
change default scaffold mode to normal, not legit 2020-04-25 18:13:47 -04:00
Dominika 0173ef8871
Merge pull request #749 from nucleusboi/scaffold-improvements
Scaffold tower
2020-04-25 18:04:42 -04:00
Nucleus 1e876a3515 Stop bulli 2020-04-25 23:26:20 +02:00
Dominika b2b7fada47
don't enable customchat by default 2020-04-25 17:21:54 -04:00
Nucleus 367552f4df Add author 2020-04-25 22:50:26 +02:00
Nucleus 27546ac902 Forgot to remove this variable 2020-04-25 21:47:53 +02:00
Nucleus 4ae0a42288 Fix slot not switching to blocks 2020-04-25 19:41:59 +02:00
Nucleus 60614c7bce Add scaffold towering 2020-04-25 19:32:29 +02:00
Bella 454dc66303
Remove preHook and hook scripts for #download
Unfortunately the files are too big to do so, so we're doing weekly downloads from now on, on the website
2020-04-25 12:20:59 -04:00
Dominika db4b424310
Merge pull request #747 from nucleusboi/stash-finder 2020-04-25 12:16:24 -04:00
Nucleus b0e67bec61 Add author to Stashfinder 2020-04-25 18:15:01 +02:00
Nucleus 59817a0009 Add Stashfinder 2020-04-25 17:57:13 +02:00
Bella 3678a5772c
collapse for loop as apparently this is valid syntax in kotlin 2020-04-24 22:44:21 -04:00
Bella 456cd901e6
added noglitchblocks to close #725 2020-04-24 21:58:51 -04:00
Bella f1501b6f77
Merge branch 'kotlinization#421' 2020-04-24 11:31:25 -04:00
Bella 0e25473c86
implement forgelin fully and fix crashes 2020-04-24 11:27:36 -04:00
Bella 3191a63a84
try to compile kotlin properly 3.0 2020-04-23 12:37:03 -04:00
Bella 6c1c6459f5
use both forgelin and kotlin plugins 2020-04-23 10:12:56 -04:00
11 changed files with 276 additions and 67 deletions

View File

@ -2,8 +2,6 @@ language: java
jdk:
- openjdk8
before_install:
- "./scripts/preHook.sh"
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
- chmod +x gradlew
- "./gradlew setupDecompWorkspace"
deploy:
@ -16,5 +14,4 @@ deploy:
on:
repo: kami-blue/client
tags: true
after_success:
- "./scripts/hook.sh"

View File

@ -1,7 +1,6 @@
// forge's stuff
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
jcenter()
maven {
@ -17,18 +16,28 @@ buildscript {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: "${kotlin_version}" }
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'kotlin'
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'com.github.johnrengelman.shadow'
version project.modVersion
group project.modGroup // http://maven.apache.org/guides/mini/guide-naming-conventions.html
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
@ -59,6 +68,10 @@ repositories {
name = "jitpack.io"
url = "https://jitpack.io"
}
maven {
name = "forgelin-repo"
url "http://maven.shadowfacts.net/"
}
mavenCentral()
jcenter()
}
@ -80,7 +93,14 @@ dependencies {
compile 'club.minnced:java-discord-rpc:2.0.2'
compile 'com.github.MrPowerGamerBR:TemmieWebhook:-SNAPSHOT'
compile 'com.github.kevinsawicki:http-request:http-request-6.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile group: "net.shadowfacts", name: "Forgelin", version: "1.8.4"
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk7", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: kotlin_version
compile group: "org.jetbrains", name: "annotations", version: annotations_version
compile group: "org.jetbrains.kotlinx", name: "kotlinx-coroutines-core", version: coroutines_version
compile group: "org.jetbrains.kotlinx", name: "kotlinx-coroutines-jdk8", version: coroutines_version
}
processResources {
@ -116,7 +136,14 @@ shadowJar {
include(dependency('org.javassist:javassist'))
include(dependency('com.github.MrPowerGamerBR:TemmieWebhook'))
include(dependency('com.github.kevinsawicki:http-request'))
include(dependency('org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version'))
include(dependency("org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}"))
include(dependency("org.jetbrains:annotations:${annotations_version}"))
include(dependency("org.jetbrains.kotlinx:kotlinx-coroutines-core:${coroutines_version}"))
include(dependency("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${coroutines_version}"))
include(dependency('net.shadowfacts:Forgelin'))
}
exclude 'dummyThing' // can someone explain why this is here
classifier = 'release'
@ -149,13 +176,3 @@ jar {
}
build.dependsOn(shadowJar)
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}

View File

@ -3,4 +3,7 @@ modGroup=me.zeroeightsix
modVersion=1.1.4-beta
modBaseName=kamiblue
forgeVersion=1.12.2-14.23.5.2847
mcpVersion=stable_39
mcpVersion=stable_39
kotlin_version=1.3.50
annotations_version=16.0.3
coroutines_version=1.3.1

View File

@ -1,22 +0,0 @@
#!/bin/bash
if [[ "$TRAVIS_PULL_REQUEST" == "true" ]]; then exit 0; else echo "">/dev/null; fi
CUR_VER="$(tail -c +2 ./scripts/curVer)"
COMMIT_TRIM="${TRAVIS_COMMIT::7}"
COMMIT_MSG="$TRAVIS_COMMIT_MESSAGE"
if [[ "$BRANCH" == "master" ]]; then
# Send message with branch name
curl -H "Content-Type: application/json" -X POST -d '{"embeds": [{"title": "","color": 10195199,"description": "**Changelog:** '"$COMMIT_MSG"'\nBranch: `'"$BRANCH"'`\nCommit: ['${COMMIT_TRIM}'](https://github.com/kami-blue/client/commits/'${COMMIT_TRIM}') Direct: ['${COMMIT_TRIM}'](https://github.com/kami-blue/client/commit/'${TRAVIS_COMMIT}') "}]}' "$WEBHOOK"
# Find the release file and rename it to kamiblue-version-commit-release.jar
BUILD_DIR="$(readlink -f ./build/libs/)"
JAR_DIR="$(ls "$BUILD_DIR" | grep "release")"
mv ${BUILD_DIR}/${JAR_DIR} ${BUILD_DIR}/kamiblue-${CUR_VER}-${COMMIT_TRIM}-release.jar
JAR_DIR="$(ls "$BUILD_DIR" | grep "release")"
# Upload the release file
curl -F content=@"$BUILD_DIR/$JAR_DIR" "$WEBHOOK"
else
exit 0
fi

View File

@ -1,8 +0,0 @@
#!/bin/bash
CUR_VER="$(cat ./scripts/curVer)"
COMMIT_TRIM="${TRAVIS_COMMIT::7}"
sed -i "s/modVersion=.*/modVersion=${CUR_VER:1}-$COMMIT_TRIM/" gradle.properties
sed -i "s/\"version\": \".*\",/\"version\": \"${CUR_VER:1}-$COMMIT_TRIM\",/" src/main/resources/mcmod.info
sed -i "s/MODVER = \".*\";/MODVER = \"$CUR_VER-$COMMIT_TRIM\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java

View File

@ -35,7 +35,7 @@ public class MixinLoaderForge implements IFMLLoadingPlugin {
@Override
public String getSetupClass() {
return null;
return "net.shadowfacts.forgelin.preloader.ForgelinSetup";
}
@Override

View File

@ -26,7 +26,6 @@ public class RunConfig extends Module {
private Setting<Boolean> hasRunDiscordSettings = register(Settings.b("DiscordRPC", false));
private Setting<Boolean> hasRunFixGui = register(Settings.b("FixGui", false));
private Setting<Boolean> hasRunTabFriends = register(Settings.b("TabFriends", false));
private Setting<Boolean> hasRunCustomChat = register(Settings.b("CustomChat", false));
private Setting<Boolean> hasRunTooltips = register(Settings.b("Tooltips", false));
public void onEnable() {
@ -51,10 +50,6 @@ public class RunConfig extends Module {
MODULE_MANAGER.getModule(TabFriends.class).enable();
hasRunTabFriends.setValue(true);
}
if (!hasRunCustomChat.getValue()) {
MODULE_MANAGER.getModule(CustomChat.class).enable();
hasRunCustomChat.setValue(true);
}
if (!hasRunTooltips.getValue()) {
MODULE_MANAGER.getModule(Tooltips.class).enable();
hasRunTooltips.setValue(true);

View File

@ -0,0 +1,105 @@
package me.zeroeightsix.kami.module.modules.misc
import me.zeroeightsix.kami.module.Module
import me.zeroeightsix.kami.setting.Settings
import me.zeroeightsix.kami.util.LogUtil
import me.zeroeightsix.kami.util.MessageSendHelper
import net.minecraft.client.audio.PositionedSoundRecord
import net.minecraft.init.SoundEvents
import net.minecraft.tileentity.TileEntity
import net.minecraft.tileentity.TileEntityChest
import net.minecraft.tileentity.TileEntityShulkerBox
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.ChunkPos
import kotlin.math.roundToInt
/**
* @author Nucleus
*/
@Module.Info(
name = "StashFinder",
category = Module.Category.MISC,
description = "Logs chests and shulkers around you."
)
class StashFinder : Module() {
private val logChests = register(Settings.b("Chests"))
private val chestDensity = register(Settings.integerBuilder("Min Chests").withMinimum(1).withMaximum(20).withValue(5))
private val logShulkers = register(Settings.b("Shulkers"))
private val shulkerDensity = register(Settings.integerBuilder("Min Shulkers").withMinimum(1).withMaximum(20).withValue(1))
private val logToChat = register(Settings.b("Log To Chat"))
private val playSound = register(Settings.b("Play Sound"))
private data class ChunkStats(var chests: Int = 0, var shulkers: Int = 0, var hot: Boolean = false) {
val tileEntities = mutableListOf<TileEntity>()
fun add(tileEntity: TileEntity) {
when (tileEntity) {
is TileEntityChest -> chests++
is TileEntityShulkerBox -> shulkers++
}
tileEntities.add(tileEntity)
}
// Averages the positions of all the tile entities
fun getPosition(): IntArray {
val x = tileEntities.map { it.pos.x }.average().roundToInt()
val y = tileEntities.map { it.pos.y }.average().roundToInt()
val z = tileEntities.map { it.pos.z }.average().roundToInt()
return intArrayOf(x, y, z)
}
override fun toString(): String {
return "($chests chests, $shulkers shulkers)"
}
}
private val chunkData = hashMapOf<Long, ChunkStats>()
private val knownPositions = mutableListOf<BlockPos>()
override fun onEnable() {
super.onEnable()
chunkData.clear()
knownPositions.clear()
}
private fun logTileEntity(tileEntity: TileEntity) {
if (knownPositions.contains(tileEntity.pos)) return
knownPositions.add(tileEntity.pos)
val chunk = ChunkPos.asLong(tileEntity.pos.x / 16, tileEntity.pos.z / 16)
val chunkStats = chunkData.getOrPut(chunk, { ChunkStats() })
chunkStats.add(tileEntity)
if (chunkStats.chests >= chestDensity.value || chunkStats.shulkers >= shulkerDensity.value) {
chunkStats.hot = true
}
}
override fun onUpdate() {
super.onUpdate()
mc.world.loadedTileEntityList
.filter { (it is TileEntityChest && logChests.value) || (it is TileEntityShulkerBox && logShulkers.value) }
.forEach { logTileEntity(it) }
chunkData.values.filter { it.hot }.forEach { chunkStats ->
chunkStats.hot = false
// mfw int array instead of Vec3i
LogUtil.writeCoords(chunkStats.getPosition(), chunkStats.toString())
if (playSound.value) {
mc.getSoundHandler().playSound(PositionedSoundRecord.getRecord(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f))
}
if (logToChat.value) {
val positionString = chunkStats.getPosition().joinToString { "$it" }
MessageSendHelper.sendChatMessage("$chatName $positionString $chunkStats")
}
}
}
}

View File

@ -0,0 +1,63 @@
package me.zeroeightsix.kami.module.modules.player
import me.zeroeightsix.kami.module.Module
import me.zeroeightsix.kami.setting.Settings
import net.minecraft.client.network.NetHandlerPlayClient
import net.minecraft.network.play.client.CPacketPlayerDigging
import net.minecraft.util.EnumFacing
import net.minecraft.util.math.BlockPos
/**
* @author gbl
*
* Used with permission from GPL licensing as proven by
* https://github.com/gbl/AntiGhost/issues/1
* and
* https://github.com/gbl/AntiGhost/issues/6
*
* You can view the source code here:
* https://github.com/gbl/AntiGhost/
*/
@Module.Info(
name = "NoGlitchBlocks",
description = "Prevents blocks desyncing and creating ghost blocks",
category = Module.Category.PLAYER
)
class NoGlitchBlocks : Module() {
private val range = register(Settings.integerBuilder("Range").withRange(1, 5).withValue(4).build())
private var previous = -1
private var conn: NetHandlerPlayClient? = null
public override fun onEnable() {
conn = mc.connection
previous = range.value
}
override fun onUpdate() {
if (mc.player == null || mc.isIntegratedServerRunning) return
if (conn == null) {
conn = mc.connection
}
if (previous != range.value) {
previous = range.value
return // prevents running when changing size
}
run()
}
private fun run() {
if (conn == null) {
return
}
val pos = mc.player.position
for (dx in -range.value..range.value) for (dy in -range.value..range.value) for (dz in -range.value..range.value) {
val packet = CPacketPlayerDigging(
CPacketPlayerDigging.Action.ABORT_DESTROY_BLOCK,
BlockPos(pos.getX() + dx, pos.getY() + dy, pos.getZ() + dz),
EnumFacing.UP /* with ABORT_DESTROY_BLOCK, this value is unused */
)
conn!!.sendPacket(packet)
}
}
}

View File

@ -10,6 +10,7 @@ import me.zeroeightsix.kami.util.Wrapper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockFalling;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CPacketEntityAction;
@ -25,6 +26,7 @@ import static me.zeroeightsix.kami.util.BlockInteractionHelper.*;
* Created by 086 on 20/01/19
* Updated by Polymer on 16/01/20
* Updated by dominikaaaa on 02/03/20
* Updated by Nucleus on 25/04/20
* @see me.zeroeightsix.kami.mixin.client.MixinEntity
*/
@Module.Info(
@ -35,12 +37,14 @@ import static me.zeroeightsix.kami.util.BlockInteractionHelper.*;
public class Scaffold extends Module {
private Setting<Boolean> placeBlocks = register(Settings.b("Place Blocks", true));
private Setting<Mode> modeSetting = register(Settings.enumBuilder(Mode.class).withName("Mode").withValue(Mode.LEGIT).build());
private Setting<Boolean> tower = register(Settings.b("Tower", false));
private Setting<Mode> modeSetting = register(Settings.e("Mode", Mode.NORMAL));
private Setting<Boolean> randomDelay = register(Settings.booleanBuilder("Random Delay").withValue(false).withVisibility(v -> modeSetting.getValue().equals(Mode.LEGIT)).build());
private Setting<Integer> delayRange = register(Settings.integerBuilder("Delay Range").withMinimum(0).withValue(6).withMaximum(10).withVisibility(v -> modeSetting.getValue().equals(Mode.LEGIT) && randomDelay.getValue()).build());
private Setting<Integer> ticks = register(Settings.integerBuilder("Ticks").withMinimum(0).withMaximum(60).withValue(2).withVisibility(v -> !modeSetting.getValue().equals(Mode.LEGIT)).build());
private Setting<Integer> ticks = register(Settings.integerBuilder("Ticks").withMinimum(0).withMaximum(60).withValue(2).withVisibility(v -> modeSetting.getValue().equals(Mode.NORMAL)).build());
private boolean shouldSlow = false;
private double towerStart = 0.0;
private static Scaffold INSTANCE;
@ -53,7 +57,7 @@ public class Scaffold extends Module {
}
private enum Mode {
NEITHER, LEGIT
NORMAL, LEGIT
}
@EventHandler
@ -74,6 +78,7 @@ public class Scaffold extends Module {
public void onUpdate() {
if (mc.player == null || MODULE_MANAGER.isModuleEnabled(Freecam.class)) return;
shouldSlow = false;
boolean towering = mc.gameSettings.keyBindJump.isKeyDown() && tower.getValue();
Vec3d vec3d = EntityUtil.getInterpolatedPos(mc.player, ticks.getValue());
if (modeSetting.getValue().equals(Mode.LEGIT)) vec3d = EntityUtil.getInterpolatedPos(mc.player, 0);
@ -84,17 +89,24 @@ public class Scaffold extends Module {
/* when legitBridge is enabled */
/* check if block behind player is air or other replaceable block and if it is, make the player crouch */
if (modeSetting.getValue().equals(Mode.LEGIT) && Wrapper.getWorld().getBlockState(legitPos.down()).getMaterial().isReplaceable() && mc.player.onGround) {
if (modeSetting.getValue().equals(Mode.LEGIT) && Wrapper.getWorld().getBlockState(legitPos.down()).getMaterial().isReplaceable() && mc.player.onGround && !towering) {
shouldSlow = true;
mc.player.movementInput.sneak = true;
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, Action.START_SNEAKING));
}
if (towering) {
if (!(mc.player.posY > blockPos.y + 1.0f)) {
return;
}
}
/* check if block is already placed */
if (!Wrapper.getWorld().getBlockState(blockPos).getMaterial().isReplaceable()) {
return;
}
int oldSlot = mc.player.inventory.currentItem;
setSlotToBlocks(belowBlockPos);
/* check if we don't have a block adjacent to the blockPos */
@ -102,8 +114,31 @@ public class Scaffold extends Module {
/* place the block */
if (placeBlocks.getValue()) placeBlockScaffold(blockPos);
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, Action.STOP_SNEAKING));
shouldSlow = false;
/* Reset the slot */
mc.player.inventory.currentItem = oldSlot;
if (towering) {
final double motion = 0.42d; // jump motion
if (mc.player.onGround) {
towerStart = mc.player.posY;
mc.player.motionY = motion;
}
if (mc.player.posY > towerStart + motion) {
mc.player.setPosition(mc.player.posX, (int)mc.player.posY, mc.player.posZ);
mc.player.motionY = motion;
towerStart = mc.player.posY;
}
} else {
towerStart = 0.0;
}
if (shouldSlow) {
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, Action.STOP_SNEAKING));
shouldSlow = false;
}
}
private float getRandomInRange() {
@ -132,13 +167,9 @@ public class Scaffold extends Module {
break;
}
/* check if any blocks were found, and if they were then set the slot */
int oldSlot = 1; /* make it 1, instead of -1 so you don't get kicked if it was -1 */
if (newSlot != -1) {
oldSlot = Wrapper.getPlayer().inventory.currentItem;
Wrapper.getPlayer().inventory.currentItem = newSlot;
}
/* reset slot back to the original one */
Wrapper.getPlayer().inventory.currentItem = oldSlot;
}
}

View File

@ -0,0 +1,28 @@
package net.shadowfacts.forgelin.preloader;
import net.minecraftforge.fml.relauncher.IFMLCallHook;
import java.util.Map;
/**
* @author shadowfacts
*/
public class ForgelinSetup implements IFMLCallHook {
@Override
public void injectData(Map<String, Object> data) {
ClassLoader loader = (ClassLoader)data.get("classLoader");
try {
loader.loadClass("net.shadowfacts.forgelin.KotlinAdapter");
} catch (ClassNotFoundException e) {
// this should never happen
throw new RuntimeException("Couldn't find Forgelin langague adapter, this shouldn't be happening", e);
}
}
@Override
public Void call() throws Exception {
return null;
}
}