-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
233 additions
and
0 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
41 changes: 41 additions & 0 deletions
41
src/main/java/de/hysky/skyblocker/skyblock/carnival/CatchAFish.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,41 @@ | ||
package de.hysky.skyblocker.skyblock.carnival; | ||
|
||
import java.awt.Color; | ||
|
||
import de.hysky.skyblocker.config.SkyblockerConfigManager; | ||
import de.hysky.skyblocker.skyblock.entity.MobGlow; | ||
import de.hysky.skyblocker.utils.ItemUtils; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.entity.EquipmentSlot; | ||
import net.minecraft.entity.decoration.ArmorStandEntity; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Box; | ||
|
||
public class CatchAFish { | ||
private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); | ||
private static final Box AREA = Box.enclosing(new BlockPos(-69, 65, -5), new BlockPos(-87, 84, 22)); | ||
private static final String YELLOW_FISH_TEXTURE = "ewogICJ0aW1lc3RhbXAiIDogMTcyMDA1MjU4MjAwMSwKICAicHJvZmlsZUlkIiA6ICIzM2Y4ZGExMTU1MzQ0YWQ5OWQ0Y2Q2ZjNhYjFjMjNhYSIsCiAgInByb2ZpbGVOYW1lIiA6ICJCXzFfUl9CIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzM2MGY0Zjk5Yzc4YWRkZGVhYjI3NmViZGY2YWI5YTBmY2ZmYWJkNDlmMGI1NDNlMTk4MWFjN2JkM2Q1NWIxOGEiLAogICAgICAibWV0YWRhdGEiIDogewogICAgICAgICJtb2RlbCIgOiAic2xpbSIKICAgICAgfQogICAgfQogIH0KfQ=="; | ||
private static final int YELLOW = Color.YELLOW.getRGB(); | ||
|
||
public static int getFishGlowColor(ArmorStandEntity armorStand) { | ||
ItemStack stack = armorStand.getEquippedStack(EquipmentSlot.HEAD); | ||
|
||
if (!stack.isEmpty() && stack.isOf(Items.PLAYER_HEAD) && ItemUtils.getHeadTexture(stack).equals(YELLOW_FISH_TEXTURE)) { | ||
return YELLOW; | ||
} | ||
|
||
return MobGlow.NO_GLOW; | ||
} | ||
|
||
public static boolean isInCatchAFish() { | ||
if (ChivalrousCarnival.isInCarnival() && SkyblockerConfigManager.get().helpers.carnival.catchAFishHelper && CLIENT.player != null) { | ||
BlockPos pos = CLIENT.player.getBlockPos(); | ||
|
||
return AREA.contains(pos.getX(), pos.getY(), pos.getZ()); | ||
} | ||
|
||
return false; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/de/hysky/skyblocker/skyblock/carnival/ChivalrousCarnival.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,12 @@ | ||
package de.hysky.skyblocker.skyblock.carnival; | ||
|
||
import de.hysky.skyblocker.utils.Area; | ||
import de.hysky.skyblocker.utils.Location; | ||
import de.hysky.skyblocker.utils.Utils; | ||
|
||
public class ChivalrousCarnival { | ||
|
||
protected static boolean isInCarnival() { | ||
return Utils.isOnSkyblock() && Utils.getLocation() == Location.HUB && Utils.getArea() == Area.CARNIVAL; | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
src/main/java/de/hysky/skyblocker/skyblock/carnival/ZombieShootout.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,85 @@ | ||
package de.hysky.skyblocker.skyblock.carnival; | ||
|
||
import de.hysky.skyblocker.annotations.Init; | ||
import de.hysky.skyblocker.config.SkyblockerConfigManager; | ||
import de.hysky.skyblocker.skyblock.entity.MobGlow; | ||
import de.hysky.skyblocker.utils.render.RenderHelper; | ||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; | ||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.Blocks; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.entity.EquipmentSlot; | ||
import net.minecraft.entity.mob.ZombieEntity; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.state.property.Properties; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Box; | ||
|
||
public class ZombieShootout { | ||
private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); | ||
private static final float[] RED = { 1, 0, 0 }; | ||
private static final Box SHOOTING_BOX = Box.enclosing(new BlockPos(-100, 70, 15), new BlockPos(-102, 75, 13)); | ||
private static final BlockPos[] LAMPS = { | ||
new BlockPos(-96, 76, 31), | ||
new BlockPos(-99, 77, 32), | ||
new BlockPos(-102, 75, 32), | ||
new BlockPos(-106, 77, 31), | ||
new BlockPos(-109, 75, 30), | ||
new BlockPos(-112, 76, 28), | ||
new BlockPos(-115, 77, 25), | ||
new BlockPos(-117, 76, 22), | ||
new BlockPos(-118, 76, 19), | ||
new BlockPos(-119, 75, 15), | ||
new BlockPos(-119, 77, 12), | ||
new BlockPos(-118, 76, 9) | ||
}; | ||
|
||
@Init | ||
public static void init() { | ||
WorldRenderEvents.AFTER_TRANSLUCENT.register(ZombieShootout::render); | ||
} | ||
|
||
private static void render(WorldRenderContext context) { | ||
if (isInZombieShootout() && CLIENT.world != null) { | ||
for (BlockPos pos : LAMPS) { | ||
BlockState state = CLIENT.world.getBlockState(pos); | ||
Block block = state.getBlock(); | ||
|
||
if (block.equals(Blocks.REDSTONE_LAMP) && state.contains(Properties.LIT) && state.get(Properties.LIT)) { | ||
RenderHelper.renderOutline(context, pos, RED, 5f, false); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public static int getZombieGlowColor(ZombieEntity zombie) { | ||
if (!zombie.getEquippedStack(EquipmentSlot.CHEST).isEmpty()) { | ||
Item item = zombie.getEquippedStack(EquipmentSlot.CHEST).getItem(); | ||
|
||
//Uses the same colors as the dojo stuff | ||
return switch (item) { | ||
case Item i when i == Items.DIAMOND_CHESTPLATE -> 0x00ffff; | ||
case Item i when i == Items.GOLDEN_CHESTPLATE -> 0xffd700; | ||
case Item i when i == Items.IRON_CHESTPLATE -> 0xc0c0c0; | ||
case Item i when i == Items.LEATHER_CHESTPLATE -> 0xa52a2a; | ||
|
||
default -> MobGlow.NO_GLOW; | ||
}; | ||
} | ||
|
||
return MobGlow.NO_GLOW; | ||
} | ||
|
||
public static boolean isInZombieShootout() { | ||
if (ChivalrousCarnival.isInCarnival() && SkyblockerConfigManager.get().helpers.carnival.zombieShootoutHelper && CLIENT.player != null) { | ||
BlockPos pos = CLIENT.player.getBlockPos(); | ||
|
||
return SHOOTING_BOX.contains(pos.getX(), pos.getY(), pos.getZ()); | ||
} | ||
|
||
return false; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package de.hysky.skyblocker.utils; | ||
|
||
import java.util.Arrays; | ||
|
||
/** | ||
* An area of a Skyblock Island. | ||
*/ | ||
public enum Area { | ||
CARNIVAL("Carnival"), | ||
UNKNOWN("Unknown"); | ||
|
||
private final String name; | ||
|
||
Area(String name) { | ||
this.name = name; | ||
} | ||
|
||
public static Area from(String name) { | ||
return Arrays.stream(values()) | ||
.filter(area -> name.equals(area.name)) | ||
.findFirst() | ||
.orElse(UNKNOWN); | ||
} | ||
} |
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