Skip to content

Commit

Permalink
Fix for Endgateways
Browse files Browse the repository at this point in the history
added icon and description
  • Loading branch information
19MisterX98 committed Oct 28, 2020
1 parent ace9f21 commit fa51092
Show file tree
Hide file tree
Showing 24 changed files with 342 additions and 55 deletions.
12 changes: 11 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.20.2+build.402-1.16"
modApi("me.shedaniel.cloth:config-2:4.8.1") {
exclude(group: "net.fabricmc.fabric-api")
}
//modApi("me.sargunvohra.mcmods:autoconfig1u:3.2.2") {
// exclude(group: "net.fabricmc.fabric-api")
//}
modImplementation "io.github.prospector:modmenu:1.14.6+build.31"


implementation('com.github.KaptainWutax:MathUtils:6c2d50eacad0241ff76119e6e703b70bac4b4bce') {transitive = false}
implementation('com.github.KaptainWutax:SeedUtils:0de70bc772fef95d8acfa6991e7278ee53a8b46c') {transitive = false}
Expand All @@ -38,7 +47,8 @@ dependencies {
include('com.github.KaptainWutax:BiomeUtils:8e3622bd023e4a0f665021dacbeb2c1a00c3d3c8') {transitive = false}
include('com.github.KaptainWutax:ChunkRandomReversal:209eefb8ed2bd097e3c55d3934ba508b664443da') {transitive = false}
include('com.github.KaptainWutax:LattiCG:38f0b3d33e15ad2e6ce9ddb1f588e2b9a8c96174') {transitive = false}

include "me.shedaniel.cloth:config-2:4.8.1"
//include "me.sargunvohra.mcmods:autoconfig1u:3.2.2"
// Fabric API. This is technically optional, but you probably want it anyway.
// modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.2
yarn_mappings=1.16.2+build.6
loader_version=0.9.1+build.205
minecraft_version=1.16.3
yarn_mappings=1.16.3+build.17
loader_version=0.10.0+build.208

#Fabric api
fabric_version=0.22.1+build.409-1.16

# Mod Properties
mod_version = 0.2.2-beta
maven_group = kaptainwutax
archives_base_name = seedcracker

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.14.0+build.371-1.16
2 changes: 2 additions & 0 deletions src/main/java/kaptainwutax/seedcracker/SeedCracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import kaptainwutax.seedcracker.command.ClientCommand;
import kaptainwutax.seedcracker.cracker.storage.DataStorage;
import kaptainwutax.seedcracker.finder.FinderQueue;
import kaptainwutax.seedcracker.profile.config.ConfigScreen;
import kaptainwutax.seedcracker.render.RenderQueue;
import kaptainwutax.seedutils.mc.MCVersion;
import net.fabricmc.api.ModInitializer;
Expand All @@ -18,6 +19,7 @@ public class SeedCracker implements ModInitializer {

@Override
public void onInitialize() {
ConfigScreen.loadConfig();
Features.init(MC_VERSION);
RenderQueue.get().add("hand", FinderQueue.get()::renderFinders);
}
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/kaptainwutax/seedcracker/command/CrackerCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import kaptainwutax.seedcracker.SeedCracker;
import kaptainwutax.seedcracker.finder.Finder;
import kaptainwutax.seedcracker.finder.FinderQueue;
import kaptainwutax.seedcracker.util.Log;
import net.minecraft.server.command.ServerCommandSource;


import static net.minecraft.server.command.CommandManager.literal;

public class CrackerCommand extends ClientCommand {
Expand All @@ -17,11 +21,19 @@ public String getName() {
public void build(LiteralArgumentBuilder<ServerCommandSource> builder) {
builder.then(literal("ON").executes(context -> this.setActive(true)))
.then(literal("OFF").executes(context -> this.setActive(false)));
builder.then(literal("debug").executes(context -> this.debug()));
}


private int setActive(boolean flag) {
SeedCracker.get().setActive(flag);
return 0;
}

private int debug() {
Log.warn(String.valueOf(FinderQueue.get().finderProfile.getActive(Finder.Type.DUNGEON)).toUpperCase());

return 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import net.minecraft.world.Heightmap;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.BuiltinBiomes;
import net.minecraft.world.dimension.DimensionType;

import java.util.ArrayList;
Expand All @@ -29,11 +29,11 @@ public List<BlockPos> findInChunk() {

for(int x = 0; x < 16; x += 4) {
for(int z = 0; z < 16; z += 4) {
BlockPos blockPos = this.chunkPos.getCenterBlockPos().add(x, 0, z);
BlockPos blockPos = this.chunkPos.getStartPos().add(x, 0, z);
Biome biome = this.world.getBiomeForNoiseGen(blockPos.getX() >> 2, 0, blockPos.getZ() >> 2);

//TODO: Fix this multi-threading issue.
if(biome == Biomes.THE_VOID) {
if(biome == BuiltinBiomes.THE_VOID) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public BlockFinder(World world, ChunkPos chunkPos, BlockState... blockStates) {
@Override
public List<BlockPos> findInChunk() {
List<BlockPos> result = new ArrayList<>();
Chunk chunk = this.world.getChunk(this.chunkPos.getCenterBlockPos());
Chunk chunk = this.world.getChunk(this.chunkPos.getStartPos());

for(BlockPos blockPos: this.searchPositions) {
BlockState currentState = chunk.getBlockState(blockPos);

if(this.targetBlockStates.contains(currentState)) {
result.add(this.chunkPos.getCenterBlockPos().add(blockPos));
result.add(this.chunkPos.getStartPos().add(blockPos));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.mojang.blaze3d.systems.RenderSystem;
import kaptainwutax.seedcracker.SeedCracker;
import kaptainwutax.seedcracker.profile.FinderConfig;
import kaptainwutax.seedcracker.profile.config.ConfigScreen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World;
Expand All @@ -17,7 +18,7 @@ public class FinderQueue {
private final static FinderQueue INSTANCE = new FinderQueue();
public static ExecutorService SERVICE = Executors.newFixedThreadPool(5);

public RenderType renderType = RenderType.XRAY;
public RenderType renderType = ConfigScreen.getConfig().getRENDER();
public FinderConfig finderProfile = new FinderConfig();

private FinderQueue() {
Expand Down Expand Up @@ -72,7 +73,7 @@ public void renderFinders(MatrixStack matrixStack) {
}

public void clear() {
this.renderType = RenderType.XRAY;
this.renderType = ConfigScreen.getConfig().getRENDER();
this.finderProfile = new FinderConfig();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kaptainwutax.seedcracker.finder.decorator;

import kaptainwutax.featureutils.Feature;
import kaptainwutax.featureutils.decorator.EndGateway;
import kaptainwutax.seedcracker.Features;
import kaptainwutax.seedcracker.SeedCracker;
Expand All @@ -8,10 +9,12 @@
import kaptainwutax.seedcracker.finder.Finder;
import kaptainwutax.seedcracker.render.Color;
import kaptainwutax.seedcracker.render.Cuboid;
import kaptainwutax.seedcracker.util.BiomeFixer;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.dimension.DimensionType;
Expand Down Expand Up @@ -40,7 +43,7 @@ public List<BlockPos> findInChunk() {
result.forEach(pos -> {
int height = this.findHeight(pos);

if(height >= 3 && height <= 9) {
if(height >= 3 && height <= 9 && Features.END_GATEWAY.isValidBiome(BiomeFixer.swap(biome))) {
newResult.add(pos);

EndGateway.Data data = Features.END_GATEWAY.at(pos.getX(), pos.getZ(), height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public List<BlockPos> findInChunk() {

if(SeedCracker.get().getDataStorage().addBaseData(data, DataAddedEvent.POKE_STRUCTURES)) {
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Color(102, 66, 33)));
this.renderers.add(new Cube(this.chunkPos.getCenterBlockPos().add(0, pos.getY(), 0), new Color(102, 66, 33)));
this.renderers.add(new Cube(this.chunkPos.getStartPos().add(0, pos.getY(), 0), new Color(102, 66, 33)));
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public List<BlockPos> findInChunk() {

if(SeedCracker.get().getDataStorage().addBaseData(data, DataAddedEvent.POKE_STRUCTURES)) {
this.renderers.add(new Cuboid(pos, pieceFinder.getLayout(), new Color(0, 0, 255)));
this.renderers.add(new Cube(monumentStart.getCenterBlockPos().add(0, pos.getY(), 0), new Color(0, 0, 255)));
this.renderers.add(new Cube(monumentStart.getStartPos().add(0, pos.getY(), 0), new Color(0, 0, 255)));
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public List<BlockPos> findInChunk() {

if (this.chunkPos.x % 2 == 0 && this.chunkPos.z % 2 == 0) {
this.structure.forEach((pos, state) -> {
this.world.setBlockState(this.chunkPos.getCenterBlockPos().add(pos).add(0, y, 0), state, 0);
this.world.setBlockState(this.chunkPos.getStartPos().add(pos).add(0, y, 0), state, 0);
});
}
});
Expand All @@ -85,7 +85,7 @@ public List<BlockPos> findInChunk() {
boolean found = true;

for(Map.Entry<BlockPos, BlockState> entry: this.structure.entrySet()) {
BlockPos pos = this.chunkPos.getCenterBlockPos().add(center.add(entry.getKey()));
BlockPos pos = this.chunkPos.getStartPos().add(center.add(entry.getKey()));
BlockState state = this.world.getBlockState(pos);

//Blockstate may change when it gets placed in the world, that's why it's using the block here.
Expand All @@ -96,7 +96,7 @@ public List<BlockPos> findInChunk() {
}

if(found) {
result.add(this.chunkPos.getCenterBlockPos().add(center));
result.add(this.chunkPos.getStartPos().add(center));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private boolean onChestFound(BlockPos pos) {

if(SeedCracker.get().getDataStorage().addBaseData(data, DataAddedEvent.POKE_STRUCTURES)) {
this.renderers.add(new Cuboid(box, new Color(0, 255, 255)));
this.renderers.add(new Cube(new ChunkPos(mutablePos).getCenterBlockPos().offset(Direction.UP, mutablePos.getY()), new Color(0, 255, 255)));
this.renderers.add(new Cube(new ChunkPos(mutablePos).getStartPos().offset(Direction.UP, mutablePos.getY()), new Color(0, 255, 255)));
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import net.minecraft.network.packet.s2c.play.CommandTreeS2CPacket;
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket;
import net.minecraft.server.command.CommandSource;
import net.minecraft.command.CommandSource;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.util.math.ChunkPos;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import kaptainwutax.seedcracker.SeedCracker;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.BuiltinBiomes;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -20,7 +21,7 @@ private void disconnect(CallbackInfo ci) {

@Inject(method = "getGeneratorStoredBiome", at = @At("HEAD"), cancellable = true)
private void getGeneratorStoredBiome(int x, int y, int z, CallbackInfoReturnable<Biome> ci) {
ci.setReturnValue(Biomes.THE_VOID);
ci.setReturnValue(BuiltinBiomes.THE_VOID);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class FinderConfig {

protected FinderProfile finderProfile = new YoloProfile();
protected FinderProfile finderProfile = new ModmenuProfile();
protected Map<Finder.Type, ConcurrentLinkedQueue<Finder>> activeFinders = new ConcurrentHashMap<>();

public FinderConfig() {
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/kaptainwutax/seedcracker/profile/ModmenuProfile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package kaptainwutax.seedcracker.profile;

import kaptainwutax.seedcracker.Features;
import kaptainwutax.seedcracker.SeedCracker;
import kaptainwutax.seedcracker.finder.Finder;
import kaptainwutax.seedcracker.profile.config.ConfigScreen;

public class ModmenuProfile extends CustomProfile {

public ModmenuProfile() {
super("WearBlackAllDay", true);
this.locked = false;
this.setTypeState(Finder.Type.BURIED_TREASURE,ConfigScreen.getConfig().isBURIED_TREASURE());
this.setTypeState(Finder.Type.DESERT_TEMPLE,ConfigScreen.getConfig().isDESERT_TEMPLE());
this.setTypeState(Finder.Type.END_CITY,ConfigScreen.getConfig().isEND_CITY());
this.setTypeState(Finder.Type.JUNGLE_TEMPLE,ConfigScreen.getConfig().isJUNGLE_TEMPLE());
this.setTypeState(Finder.Type.MONUMENT,ConfigScreen.getConfig().isMONUMENT());
this.setTypeState(Finder.Type.SWAMP_HUT,ConfigScreen.getConfig().isSWAMP_HUT());
this.setTypeState(Finder.Type.SHIPWRECK,ConfigScreen.getConfig().isSHIPWRECK());
this.setTypeState(Finder.Type.END_PILLARS,ConfigScreen.getConfig().isEND_PILLARS());
this.setTypeState(Finder.Type.END_GATEWAY,ConfigScreen.getConfig().isEND_GATEWAY());
this.setTypeState(Finder.Type.DUNGEON,ConfigScreen.getConfig().isDUNGEON());
this.setTypeState(Finder.Type.EMERALD_ORE,ConfigScreen.getConfig().isEMERALD_ORE());
this.setTypeState(Finder.Type.DESERT_WELL,ConfigScreen.getConfig().isDESERT_WELL());
this.setTypeState(Finder.Type.BIOME,ConfigScreen.getConfig().isBIOME());
SeedCracker.MC_VERSION = ConfigScreen.getConfig().getVERSION();
Features.init(SeedCracker.MC_VERSION);
}
}
11 changes: 0 additions & 11 deletions src/main/java/kaptainwutax/seedcracker/profile/NopeProfile.java

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/java/kaptainwutax/seedcracker/profile/YoloProfile.java

This file was deleted.

Loading

0 comments on commit fa51092

Please sign in to comment.