diff --git a/build.gradle b/build.gradle index 953b8af..ae4487c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.10-SNAPSHOT' + id 'fabric-loom' version '1.11-SNAPSHOT' id 'maven-publish' } diff --git a/gradle.properties b/gradle.properties index 225a09f..4affd94 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,17 +2,17 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://modmuss50.me/fabric.html -minecraft_version=1.21.5 -yarn_mappings=1.21.5+build.1 -loader_version=0.16.13 +minecraft_version=1.21.8 +yarn_mappings=1.21.8+build.1 +loader_version=0.16.14 # Mod Properties -mod_version=2.0.2 +mod_version=2.0.3 maven_group=systems.brn archives_base_name=plasticgun # Dependencies # check this on https://modmuss50.me/fabric.html -fabric_version=0.120.0+1.21.5 +fabric_version=0.129.0+1.21.8 -trinkets_version=3.11.0-beta.1+polymerport.1 -polymer_version=0.12.3+1.21.5 -server_translations_api_version=2.5.0+1.21.5-rc1 \ No newline at end of file +trinkets_version=3.11.0-beta.1+polymerport.2 +polymer_version=0.13.7+1.21.8 +server_translations_api_version=2.5.1+1.21.5 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cea7a79..ca025c8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/systems/brn/plasticgun/bullets/BulletEntity.java b/src/main/java/systems/brn/plasticgun/bullets/BulletEntity.java index 89871af..c70ccf2 100644 --- a/src/main/java/systems/brn/plasticgun/bullets/BulletEntity.java +++ b/src/main/java/systems/brn/plasticgun/bullets/BulletEntity.java @@ -36,7 +36,7 @@ public class BulletEntity extends PersistentProjectileEntity implements PolymerE private final float scale; public BulletEntity(LivingEntity livingEntity, ItemStack stack, Hand hand, Gun gun, float scale, double damage, float speed, double explosionPower, double repulsionPower, boolean isIncendiary) { - super(BULLET_ENTITY_TYPE, livingEntity.getPos().x, livingEntity.getPos().y + 1.75d, livingEntity.getPos().z, livingEntity.getEntityWorld(), stack, livingEntity.getStackInHand(hand)); + super(BULLET_ENTITY_TYPE, livingEntity.getPos().x, livingEntity.getPos().y + 1.75d, livingEntity.getPos().z, livingEntity.getWorld(), stack, livingEntity.getStackInHand(hand)); this.setOwner(livingEntity); this.setVelocity(livingEntity, livingEntity.getPitch(), livingEntity.getYaw(), 0.0F, speed, 0); this.pickupType = PickupPermission.DISALLOWED; diff --git a/src/main/java/systems/brn/plasticgun/grenades/GrenadeItem.java b/src/main/java/systems/brn/plasticgun/grenades/GrenadeItem.java index e76d0f4..3a71765 100644 --- a/src/main/java/systems/brn/plasticgun/grenades/GrenadeItem.java +++ b/src/main/java/systems/brn/plasticgun/grenades/GrenadeItem.java @@ -117,14 +117,14 @@ public class GrenadeItem extends SimpleItem implements PolymerItem { public void turnIntoEntity(ServerPlayerEntity player, @Nullable ItemStack stack, int speed, int timer) { GrenadeEntity grenadeEntity = new GrenadeEntity(player, stack, timer, 0.5f, speed, explosionPower, repulsionPower, isIncendiary, isFragmentation, flashBangDuration, stunDuration, smokeTicks, 8, smokeCount); - player.getServerWorld().spawnEntity(grenadeEntity); - player.getServerWorld().playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.UI_BUTTON_CLICK.value(), SoundCategory.PLAYERS, 1.0f, 2.0f); + player.getWorld().spawnEntity(grenadeEntity); + player.getWorld().playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.UI_BUTTON_CLICK.value(), SoundCategory.PLAYERS, 1.0f, 2.0f); } public void turnIntoEntity(Entity entity, @Nullable ItemStack stack, int speed, int timer) { - GrenadeEntity grenadeEntity = new GrenadeEntity(entity.getEntityWorld(), entity.getPos(), stack, timer, 1f, explosionPower, repulsionPower, isIncendiary, isFragmentation, flashBangDuration, stunDuration, smokeTicks, 8, smokeCount); - entity.getEntityWorld().spawnEntity(grenadeEntity); - entity.getEntityWorld().playSound(null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.UI_BUTTON_CLICK.value(), SoundCategory.PLAYERS, 1.0f, 2.0f); + GrenadeEntity grenadeEntity = new GrenadeEntity(entity.getWorld(), entity.getPos(), stack, timer, 1f, explosionPower, repulsionPower, isIncendiary, isFragmentation, flashBangDuration, stunDuration, smokeTicks, 8, smokeCount); + entity.getWorld().spawnEntity(grenadeEntity); + entity.getWorld().playSound(null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.UI_BUTTON_CLICK.value(), SoundCategory.PLAYERS, 1.0f, 2.0f); } public void checkExplosions(ServerWorld world, PlayerEntity playerEntity, ItemStack stackInSlot) { diff --git a/src/main/java/systems/brn/plasticgun/guns/Gun.java b/src/main/java/systems/brn/plasticgun/guns/Gun.java index 8fe1b56..e6d0645 100644 --- a/src/main/java/systems/brn/plasticgun/guns/Gun.java +++ b/src/main/java/systems/brn/plasticgun/guns/Gun.java @@ -79,12 +79,12 @@ public class Gun extends SimpleItem implements PolymerItem { .maxDamage(clipSize + 1) , id(path), Items.WOODEN_SWORD ); - this.verticalRecoilMin = verticalRecoilMin / 10f; - this.verticalRecoilMax = verticalRecoilMax / 10f; + this.verticalRecoilMin = verticalRecoilMin / 100f; + this.verticalRecoilMax = verticalRecoilMax / 100f; this.velocityRecoilMin = velocityRecoilMin; this.velocityRecoilMax = velocityRecoilMax; - this.horizontalRecoilMin = horizontalRecoilMin / 10f; - this.horizontalRecoilMax = horizontalRecoilMax / 10f; + this.horizontalRecoilMin = horizontalRecoilMin / 100f; + this.horizontalRecoilMax = horizontalRecoilMax / 100f; if (verticalRecoilMin > verticalRecoilMax) { logger.error("verticalRecoilMin > verticalRecoilMax for {}", path); } @@ -255,7 +255,7 @@ public class Gun extends SimpleItem implements PolymerItem { } public int doRecoil(LivingEntity entity) { - if (entity.getEntityWorld() instanceof ServerWorld serverWorld) { + if (entity.getWorld() instanceof ServerWorld serverWorld) { Random rng = entity.getWorld().getRandom(); // Get the entity's current position and yaw Vec3d pos = entity.getPos(); diff --git a/src/main/java/systems/brn/plasticgun/guns/WeaponShootGoal.java b/src/main/java/systems/brn/plasticgun/guns/WeaponShootGoal.java index 04d304a..3099153 100644 --- a/src/main/java/systems/brn/plasticgun/guns/WeaponShootGoal.java +++ b/src/main/java/systems/brn/plasticgun/guns/WeaponShootGoal.java @@ -147,7 +147,7 @@ public class WeaponShootGoal extends if (itemGunMap.containsKey(gunStack.getItem())) { Gun gun = itemGunMap.get(gunStack.getItem()); // Handle item usage - gun.reload(this.actor.getEntityWorld(), this.actor, gunHand, this.actor.getRandom(), this.actor.getWorld().getLocalDifficulty(this.actor.getBlockPos())); + gun.reload(this.actor.getWorld(), this.actor, gunHand, this.actor.getRandom(), this.actor.getWorld().getLocalDifficulty(this.actor.getBlockPos())); if (!canSeeTarget && this.targetSeeingTicker < -60) { this.actor.clearActiveItem(); } else if (canSeeTarget) { @@ -156,7 +156,7 @@ public class WeaponShootGoal extends int currentCooldown = gunStack.getOrDefault(GUN_COOLDOWN_COMPONENT, 1); ItemStack chamber = gunStack.getOrDefault(GUN_AMMO_COMPONENT, ItemStack.EMPTY).copy(); if (!chamber.isEmpty() && currentReload == 1 && currentCooldown == 0 && lockedTicks >= 10) { - if (this.actor.getEntityWorld() instanceof ServerWorld serverWorld) { + if (this.actor.getWorld() instanceof ServerWorld serverWorld) { this.targetSeeingTicker -= gun.shoot(serverWorld, this.actor, gunHand); } } diff --git a/src/main/java/systems/brn/plasticgun/lib/EventHandler.java b/src/main/java/systems/brn/plasticgun/lib/EventHandler.java index 9dfce21..878d95f 100644 --- a/src/main/java/systems/brn/plasticgun/lib/EventHandler.java +++ b/src/main/java/systems/brn/plasticgun/lib/EventHandler.java @@ -38,7 +38,7 @@ public class EventHandler { } public static void rightClickWithItem(ServerPlayerEntity serverPlayerEntity, Hand hand) { - if (serverPlayerEntity.getEntityWorld() instanceof ServerWorld world) { + if (serverPlayerEntity.getWorld() instanceof ServerWorld world) { Item stackInHand = serverPlayerEntity.getStackInHand(hand).getItem(); if (itemGunMap.containsKey(stackInHand)) { itemGunMap.get(stackInHand).reload(world, serverPlayerEntity, hand); @@ -54,7 +54,7 @@ public class EventHandler { } public static void leftClickWithItem(ServerPlayerEntity serverPlayerEntity, Hand hand) { - if (serverPlayerEntity.getEntityWorld() instanceof ServerWorld world) { + if (serverPlayerEntity.getWorld() instanceof ServerWorld world) { ItemStack stackInHand = serverPlayerEntity.getStackInHand(hand); Item itemInHand = stackInHand.getItem(); if (itemGrenadeItemMap.containsKey(itemInHand)) { @@ -68,7 +68,7 @@ public class EventHandler { } public static void tickItemUpdate(ServerPlayerEntity serverPlayerEntity) { - if (serverPlayerEntity.getEntityWorld() instanceof ServerWorld world) { + if (serverPlayerEntity.getWorld() instanceof ServerWorld world) { Hand hand = serverPlayerEntity.getActiveHand(); ItemStack stackInHand = serverPlayerEntity.getStackInHand(hand); Item itemInHand = stackInHand.getItem(); diff --git a/src/main/java/systems/brn/plasticgun/lib/Util.java b/src/main/java/systems/brn/plasticgun/lib/Util.java index 510a650..92cc5aa 100644 --- a/src/main/java/systems/brn/plasticgun/lib/Util.java +++ b/src/main/java/systems/brn/plasticgun/lib/Util.java @@ -135,7 +135,7 @@ public class Util { int minZ = MathHelper.floor(pos.z - radius - 1.0); int maxZ = MathHelper.floor(pos.z + radius + 1.0); Box box = new Box(minX, minY, minZ, maxX, maxY, maxZ); - return entity.getEntityWorld().getOtherEntities(entity, box); + return entity.getWorld().getOtherEntities(entity, box); } public static void setProjectileData(List> data, boolean initial, float scale, ItemStack itemStack) { @@ -261,7 +261,13 @@ public class Util { } public static void entityHitParticles(LivingEntity livingEntity, double damage) { - if (livingEntity.getEntityWorld() instanceof ServerWorld world) { + if (livingEntity.getWorld() instanceof ServerWorld world) { + if (livingEntity instanceof ServerPlayerEntity) { + ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) livingEntity; + if (serverPlayerEntity.isCreative()) { + return; + } + } Vec3d pos = livingEntity.getPos(); int particleCount = (int) damage * 4; // Number of particles double radius = livingEntity.getWidth() / 2 + 0.5; // Radius of the circle diff --git a/src/main/java/systems/brn/plasticgun/throwables/ThrowableProjectile.java b/src/main/java/systems/brn/plasticgun/throwables/ThrowableProjectile.java index 2f12001..768d5cd 100644 --- a/src/main/java/systems/brn/plasticgun/throwables/ThrowableProjectile.java +++ b/src/main/java/systems/brn/plasticgun/throwables/ThrowableProjectile.java @@ -37,7 +37,7 @@ public class ThrowableProjectile extends PersistentProjectileEntity implements P } public ThrowableProjectile(EntityType entityType, ServerPlayerEntity player, ItemStack itemStack, float scale, float speed, double damage, PickupPermission pickupPermission, byte penetration) { - super(entityType, player.getPos().x, player.getPos().y + 1.5d, player.getPos().z, player.getServerWorld(), itemStack, itemStack); + super(entityType, player.getPos().x, player.getPos().y + 1.5d, player.getPos().z, player.getWorld(), itemStack, itemStack); this.setOwner(player); this.setVelocity(player, player.getPitch(), player.getYaw(), 0.0F, speed, 0); this.pickupType = pickupPermission;