Skip to content

Commit

Permalink
chore: updated Minestom version
Browse files Browse the repository at this point in the history
Took 1 hour 58 minutes
  • Loading branch information
Swofty-Developments committed Sep 4, 2024
1 parent d5e8d9f commit 15dedd8
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 42 deletions.
2 changes: 1 addition & 1 deletion anticheat/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {
}

dependencies {
implementation("net.minestom:minestom-snapshots:12794d4263") {
implementation("net.minestom:minestom-snapshots:4553d3c574") {
exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain")
}
}
Expand Down
2 changes: 1 addition & 1 deletion commons/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ java {

dependencies {
implementation(project(":packer"))
implementation("net.minestom:minestom-snapshots:12794d4263") {
implementation("net.minestom:minestom-snapshots:4553d3c574") {
exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain")
}
}
2 changes: 1 addition & 1 deletion loader/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {
implementation(project(":spark"))
implementation(project(":anticheat"))
implementation("org.slf4j:slf4j-api:2.0.13")
implementation("net.minestom:minestom-snapshots:12794d4263") {
implementation("net.minestom:minestom-snapshots:4553d3c574") {
exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain")
}
implementation("dev.hollowcube:polar:1.10.0")
Expand Down
2 changes: 1 addition & 1 deletion proxy.api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repositories {
dependencies {
implementation(project(":commons"))
implementation("com.github.Swofty-Developments:AtlasRedisAPI:1.1.2")
implementation("net.minestom:minestom-snapshots:12794d4263") {
implementation("net.minestom:minestom-snapshots:4553d3c574") {
exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain")
}
implementation("net.kyori:adventure-api:4.17.0")
Expand Down
2 changes: 1 addition & 1 deletion spark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repositories {
}

dependencies {
implementation("net.minestom:minestom-snapshots:12794d4263") {
implementation("net.minestom:minestom-snapshots:4553d3c574") {
exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain")
}
implementation(files("dependencies/spark-1.10.1.10-minestom.jar"))
Expand Down
2 changes: 1 addition & 1 deletion type.generic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies {
implementation(project(":commons"))
implementation(project(":packer"))
implementation(project(":proxy.api"))
implementation("net.minestom:minestom-snapshots:12794d4263") {
implementation("net.minestom:minestom-snapshots:4553d3c574") {
exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain")
}
implementation("dev.hollowcube:polar:1.10.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import lombok.Getter;
import net.minestom.server.MinecraftServer;
import net.minestom.server.collision.CollisionUtils;
import net.minestom.server.collision.PhysicsResult;
import net.minestom.server.collision.ShapeImpl;
import net.minestom.server.collision.*;
import net.minestom.server.coordinate.Pos;
import net.minestom.server.coordinate.Vec;
import net.minestom.server.entity.Entity;
Expand All @@ -16,6 +14,9 @@
import net.minestom.server.timer.TaskSchedule;
import net.swofty.types.generic.item.SkyBlockItem;
import net.swofty.types.generic.utility.MathUtility;
import org.jetbrains.annotations.NotNull;

import java.util.Collection;

public class ArrowEntityImpl extends LivingEntity {
private long cooldown = 0;
Expand Down Expand Up @@ -72,35 +73,37 @@ public void tick(long time) {
cooldown = System.currentTimeMillis();
}

PhysicsResult collided = CollisionUtils.checkEntityCollisions(instance, this.getBoundingBox(), posBefore, diff, 3, (e) -> e != this, result);
if (collided != null && collided.collisionShapes()[0] != shooter) {
if (collided.collisionShapes()[0] instanceof Entity entity) {
EntityType entityType = entity.getEntityType();
if (entityType == EntityType.PLAYER ||
entityType == EntityType.ARMOR_STAND) {
@NotNull Collection<EntityCollisionResult> collided = CollisionUtils.checkEntityCollisions(instance, this.getBoundingBox(), posBefore, diff, 3, (e) -> e != this, result);
for (EntityCollisionResult collisionResult : collided) {
if (collisionResult != null && collisionResult.entity() != shooter) {
if (collisionResult.entity() instanceof Entity entity) {
EntityType entityType = entity.getEntityType();
if (entityType == EntityType.PLAYER ||
entityType == EntityType.ARMOR_STAND) {
return;
}

var e = new ProjectileCollideWithEntityEvent(
this,
Pos.fromPoint(collisionResult.collisionPoint()),
entity
);
MinecraftServer.getGlobalEventHandler().call(e);
if (!e.isCancelled()) {
remove();
kill();
}
return;
}

var e = new ProjectileCollideWithEntityEvent(this, collided.newPosition(), entity);
MinecraftServer.getGlobalEventHandler().call(e);
if (!e.isCancelled()) {
remove();
kill();
}
return;
}
}

if (result.hasCollision()) {
Block hitBlock = null;
if (result.collisionShapes()[0] instanceof ShapeImpl block) {
hitBlock = block.block();
}
if (result.collisionShapes()[1] instanceof ShapeImpl block) {
hitBlock = block.block();
}
if (result.collisionShapes()[2] instanceof ShapeImpl block) {
hitBlock = block.block();
for (Shape shape : result.collisionShapes()) {
if (shape instanceof ShapeImpl block) {
hitBlock = getInstance().getBlock(block.relativeEnd());
}
}

if (hitBlock == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void kill() {

SkyBlockItem item = new SkyBlockItem(itemType, record.getAmount());
ItemTypeLinker droppedItemLinker = item.getAttributeHandler().getPotentialClassLinker();
if (player.canInsertItem(droppedItemLinker, record.getAmount())) {
if (player.canInsertItemIntoSacks(droppedItemLinker, record.getAmount())) {
player.getSackItems().increase(droppedItemLinker, record.getAmount());
} else if (player.getSkyBlockExperience().getLevel().asInt() >= 6) {
player.addAndUpdateItem(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public class SkyBlockEventHandler {
private static final ArrayList<EventMethodEntry> cachedCustomEvents = new ArrayList<>();
private static final EventNode<Event> customEventNode = (EventNode<Event>) EventNodes.CUSTOM.eventNode;

private record EventMethodEntry(Method method, Object instance, SkyBlockEvent skyBlockEvent) { }
private record EventMethodEntry(Method method,
Object instance,
SkyBlockEvent skyBlockEvent) { }

public static void registerEventMethods(Object instance) {
Class<?> clazz = instance.getClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void run(PlayerMoveEvent event) {
player.sendPacket(new CollectItemPacket(item.getEntityId(), player.getEntityId(),
item.getItem().getAmount()));

if (player.canInsertItem(item.getItem().getAttributeHandler().getPotentialClassLinker(), item.getItem().getAmount())) {
if (player.canInsertItemIntoSacks(item.getItem().getAttributeHandler().getPotentialClassLinker(), item.getItem().getAmount())) {
player.getSackItems().increase(item.getItem().getAttributeHandler().getPotentialClassLinker(), item.getItem().getAmount());
} else {
player.addAndUpdateItem(item.getItem());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void run(PlayerBlockBreakEvent event) {
*/
SkyBlockItem skyBlockItem = new SkyBlockItem(item.getItemStackBuilder().amount(dropAmount).build());
ItemTypeLinker droppedItemLinker = skyBlockItem.getAttributeHandler().getPotentialClassLinker();
if (player.canInsertItem(droppedItemLinker, dropAmount)) {
if (player.canInsertItemIntoSacks(droppedItemLinker, dropAmount)) {
player.getSackItems().increase(droppedItemLinker, dropAmount);
} else if (player.getSkyBlockExperience().getLevel().asInt() >= 6) {
player.addAndUpdateItem(skyBlockItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minestom.server.network.packet.server.play.BlockChangePacket;
import net.minestom.server.network.packet.server.play.BlockEntityDataPacket;
import net.minestom.server.network.packet.server.play.OpenSignEditorPacket;
import net.minestom.server.tag.Tag;
import net.minestom.server.timer.TaskSchedule;
import net.swofty.types.generic.user.SkyBlockPlayer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void run(InventoryPreClickEvent e, SkyBlockPlayer player) {
for (ItemStack itemStack : player.getInventory().getItemStacks()) {
SkyBlockItem item = new SkyBlockItem(itemStack);
ItemTypeLinker linker = item.getAttributeHandler().getPotentialClassLinker();
if (player.canInsertItem(linker)) {
if (player.canInsertItemIntoSacks(linker)) {
player.getSackItems().increase(linker, item.getAmount());
player.getInventory().setItemStack(slot, ItemStack.AIR);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.kyori.adventure.sound.Sound;
import net.minestom.server.MinecraftServer;
import net.minestom.server.entity.Player;
import net.minestom.server.tag.Tag;
import net.minestom.server.timer.Task;
import net.minestom.server.timer.TaskSchedule;
import net.swofty.types.generic.user.SkyBlockPlayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public int getMaxSackStorage(ItemTypeLinker sack) {
return maxStorage;
}

public boolean canInsertItem(ItemTypeLinker item) {
public boolean canInsertItemIntoSacks(ItemTypeLinker item) {
for (SkyBlockItem sack : getAllSacks()) {
if (sack.getGenericInstance() instanceof Sack sackInstance) {
for (ItemTypeLinker linker : sackInstance.getSackItems()) {
Expand All @@ -514,8 +514,8 @@ public boolean canInsertItem(ItemTypeLinker item) {
}
return false;
}
public boolean canInsertItem(ItemTypeLinker item, Integer amount) {
if (!canInsertItem(item)) return false;
public boolean canInsertItemIntoSacks(ItemTypeLinker item, Integer amount) {
if (!canInsertItemIntoSacks(item)) return false;

List<Map<SkyBlockItem, Integer>> maxStorages = new ArrayList<>();
for (SkyBlockItem sack : getAllSacks()) {
Expand Down
2 changes: 1 addition & 1 deletion type.hub/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies {
implementation(project(":type.generic"))
implementation(project(":commons"))
implementation(project(":proxy.api"))
implementation("net.minestom:minestom-snapshots:12794d4263") {
implementation("net.minestom:minestom-snapshots:4553d3c574") {
exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain")
}
}
2 changes: 1 addition & 1 deletion type.island/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies {
implementation(project(":type.generic"))
implementation(project(":commons"))
implementation(project(":proxy.api"))
implementation("net.minestom:minestom-snapshots:12794d4263") {
implementation("net.minestom:minestom-snapshots:4553d3c574") {
exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain")
}
}
2 changes: 1 addition & 1 deletion type.thefarmingislands/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies {
implementation(project(":type.generic"))
implementation(project(":commons"))
implementation(project(":proxy.api"))
implementation("net.minestom:minestom-snapshots:12794d4263") {
implementation("net.minestom:minestom-snapshots:4553d3c574") {
exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain")
}
}

0 comments on commit 15dedd8

Please sign in to comment.