Update to 1.21.5

This commit is contained in:
2025-04-16 22:14:08 +02:00
parent 6fc5738e38
commit 977050276c
19 changed files with 62 additions and 43 deletions

View File

@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'fabric-loom' version '1.10-SNAPSHOT'
id 'maven-publish'
}
@@ -37,6 +37,7 @@ dependencies {
modImplementation include("eu.pb4:polymer-resource-pack:${project.polymer_version}")
modImplementation include("eu.pb4:polymer-resource-pack-extras:${project.polymer_version}")
modImplementation include("eu.pb4:polymer-autohost:${project.polymer_version}")
modImplementation "eu.pb4.polyport:trinkets:${project.trinkets_version}"
modImplementation include("xyz.nucleoid:server-translations-api:${project.server_translations_api_version}")
@@ -48,11 +49,13 @@ processResources {
inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version
inputs.property "loader_version", project.loader_version
inputs.property "trinkets_version", project.trinkets_version
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
expand "version": project.version,
"minecraft_version": project.minecraft_version,
"trinkets_version": project.trinkets_version,
"loader_version": project.loader_version
}
}

View File

@@ -2,16 +2,17 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.2
loader_version=0.16.9
minecraft_version=1.21.5
yarn_mappings=1.21.5+build.1
loader_version=0.16.13
# Mod Properties
mod_version=2.0.0
mod_version=2.0.2
maven_group=systems.brn
archives_base_name=plasticgun
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.111.0+1.21.4
fabric_version=0.120.0+1.21.5
polymer_version=0.11.1+1.21.4
server_translations_api_version=2.4.0+1.21.2-rc1
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

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View File

@@ -97,7 +97,7 @@ public class BulletEntity extends PersistentProjectileEntity implements PolymerE
this.setPosition(blockHitResult.getPos());
if (blockHitResult.getType() == HitResult.Type.BLOCK) {
BlockState block = this.getWorld().getBlockState(blockHitResult.getBlockPos());
blockHitParticles(this.getPos(), block, this.getWorld(), this.getDamage() * this.getVelocity().length());
blockHitParticles(this.getPos(), block, this.getWorld(), this.damage * this.getVelocity().length());
SoundEvent soundEvent = block.getSoundGroup().getHitSound();
setSilent(false);
playSound(soundEvent, 4.0F, 1.0F);
@@ -118,8 +118,8 @@ public class BulletEntity extends PersistentProjectileEntity implements PolymerE
setSilent(true);
if (entityHitResult.getEntity() instanceof LivingEntity livingEntity) {
this.setDamage(getFinalDamage(livingEntity, WeaponDamageType.BULLET, this.getDamage()));
entityHitParticles(livingEntity, this.getDamage() * this.getVelocity().length());
this.setDamage(getFinalDamage(livingEntity, WeaponDamageType.BULLET, this.damage));
entityHitParticles(livingEntity, this.damage * this.getVelocity().length());
}
super.onEntityHit(entityHitResult);

View File

@@ -1,5 +1,7 @@
package systems.brn.plasticgun.defence;
import dev.emi.trinkets.api.Trinket;
import dev.emi.trinkets.api.TrinketsApi;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.LoreComponent;
import net.minecraft.item.Item;
@@ -16,7 +18,7 @@ import java.util.List;
import static systems.brn.plasticgun.lib.Util.id;
public class WeaponArmor extends TrinketPolymerItem {
public class WeaponArmor extends TrinketPolymerItem implements Trinket {
public final HashMap<WeaponDamageType, Double> resistances = new HashMap<>();
public WeaponArmor(String name, int durability, double grenadeDamageCoefficient, double fragmentationDamageCoefficient, double bulletDamageCoefficient, double shurikenDamageCoefficient) {
@@ -30,6 +32,7 @@ public class WeaponArmor extends TrinketPolymerItem {
, name)
;
Registry.register(Registries.ITEM, id(name), this);
TrinketsApi.registerTrinket(this, this);
resistances.put(WeaponDamageType.BULLET, bulletDamageCoefficient);
resistances.put(WeaponDamageType.FRAGMENTATION_GRENADE, fragmentationDamageCoefficient);
resistances.put(WeaponDamageType.GRENADE, grenadeDamageCoefficient);

View File

@@ -10,6 +10,7 @@ import systems.brn.plasticgun.PlasticGun;
import xyz.nucleoid.packettweaker.PacketContext;
import static systems.brn.plasticgun.PlasticGun.flashbangEffect;
import static systems.brn.plasticgun.PlasticGun.stunEffect;
public class FlashbangEffect extends StatusEffect implements PolymerStatusEffect {
public FlashbangEffect() {
@@ -30,11 +31,10 @@ public class FlashbangEffect extends StatusEffect implements PolymerStatusEffect
public boolean applyUpdateEffect(ServerWorld world, LivingEntity entity, int amplifier) {
return super.applyUpdateEffect(world, entity, amplifier);
}
@Override
public StatusEffect getPolymerReplacement(PacketContext packetContext){
public StatusEffect getPolymerReplacement(StatusEffect potion, PacketContext packetContext) {
if (PlasticGun.clientsWithMod.contains(packetContext.getPlayer())){
return flashbangEffect.value();
return stunEffect.value();
}
return StatusEffects.BLINDNESS.value();
}

View File

@@ -43,7 +43,7 @@ public class StunEffect extends StatusEffect implements PolymerStatusEffect {
}
@Override
public StatusEffect getPolymerReplacement(PacketContext packetContext) {
public StatusEffect getPolymerReplacement(StatusEffect potion, PacketContext packetContext) {
if (PlasticGun.clientsWithMod.contains(packetContext.getPlayer())){
return stunEffect.value();
}

View File

@@ -78,8 +78,8 @@ public class EventHandler {
}
PlayerInventory playerInventory = serverPlayerEntity.getInventory();
for (int i = 1; i < playerInventory.main.size(); i++) {
ItemStack stackInSlot = playerInventory.main.get(i);
for (int i = 1; i < playerInventory.getMainStacks().size(); i++) {
ItemStack stackInSlot = playerInventory.getMainStacks().get(i);
Item itemInSlot = stackInSlot.getItem();
if (itemGrenadeItemMap.containsKey(itemInSlot)) {
decrementComponent(GRENADE_TIMER_COMPONENT, stackInSlot);
@@ -95,12 +95,11 @@ public class EventHandler {
public static void mobTickUpdate(ServerWorld world) {
Predicate<Entity> allEntities = entity -> true;
for (SkeletonEntity skeletonEntity : world.getEntitiesByType(EntityType.SKELETON, allEntities)) {
for (ItemStack itemStack : skeletonEntity.getEquippedItems()) {
ItemStack itemStack = skeletonEntity.getActiveItem();
if (itemGunMap.containsKey(itemStack.getItem())) {
decrementComponent(GUN_COOLDOWN_COMPONENT, itemStack);
decrementComponent(GUN_RELOAD_COOLDOWN_COMPONENT, itemStack);
}
}
}
}

View File

@@ -14,7 +14,6 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ModelTransformationMode;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.particle.BlockStateParticleEffect;
@@ -52,7 +51,7 @@ public class Util {
if (bulletItem == null || bulletItem.isEmpty()) {
return ItemStack.EMPTY;
}
for (ItemStack itemStack : player.getInventory().main) {
for (ItemStack itemStack : player.getInventory().getMainStacks()) {
for (Item item : bulletItem) {
if (item == itemStack.getItem()) {
return itemStack;
@@ -68,8 +67,8 @@ public class Util {
if (inventory instanceof PlayerInventory playerInventory) {
// Iterate through the slots in the player's inventory
for (int i = 0; i < playerInventory.main.size(); i++) {
ItemStack slotStack = playerInventory.main.get(i);
for (int i = 0; i < playerInventory.getMainStacks().size(); i++) {
ItemStack slotStack = playerInventory.getMainStacks().get(i);
maxInsert = canInsertToStack(slotStack, itemStack, maxInsert);
}
} else {
@@ -145,7 +144,6 @@ public class Util {
data.add(DataTracker.SerializedEntry.of(DisplayTrackedData.SCALE, new Vector3f(scale)));
data.add(DataTracker.SerializedEntry.of(DisplayTrackedData.BILLBOARD, (byte) DisplayEntity.BillboardMode.CENTER.ordinal()));
data.add(DataTracker.SerializedEntry.of(DisplayTrackedData.Item.ITEM, itemStack));
data.add(DataTracker.SerializedEntry.of(DisplayTrackedData.Item.ITEM_DISPLAY, ModelTransformationMode.FIXED.getIndex()));
}
}

View File

@@ -52,7 +52,9 @@ public abstract class ZombieGrenadeMixin extends MobEntity {
} else if (i < 14) {
int grenadeIndex = selectWeaponIndex(random, localDifficulty, grenades.size());
stackToEquip = new ItemStack(grenades.get(grenadeIndex));
Arrays.fill(this.handDropChances, 0F);
for (EquipmentSlot slot : EquipmentSlot.values()) {
this.setEquipmentDropChance(slot, 0f);
}
} else {
stackToEquip = new ItemStack(Items.IRON_SHOVEL);
}

View File

@@ -33,7 +33,7 @@ public class ShurikenEntity extends ThrowableProjectile implements PolymerEntity
if (blockHitResult.getType() == HitResult.Type.BLOCK) {
BlockState block = this.getWorld().getBlockState(blockHitResult.getBlockPos());
blockHitParticles(this.getPos(), block, this.getWorld(), this.getDamage() * this.getVelocity().length());
blockHitParticles(this.getPos(), block, this.getWorld(), this.damage * this.getVelocity().length());
SoundEvent soundEvent = block.getSoundGroup().getHitSound();
setSilent(false);
playSound(soundEvent, 4.0F, 1.0F);
@@ -54,8 +54,8 @@ public class ShurikenEntity extends ThrowableProjectile implements PolymerEntity
@Override
protected void onEntityHit(EntityHitResult entityHitResult) {
if (entityHitResult.getEntity() instanceof LivingEntity livingEntity) {
this.setDamage(getFinalDamage(livingEntity, WeaponDamageType.SHURIKEN, this.getDamage()));
entityHitParticles(livingEntity, this.getDamage());
this.setDamage(getFinalDamage(livingEntity, WeaponDamageType.SHURIKEN, this.damage));
entityHitParticles(livingEntity, this.damage);
}
super.onEntityHit(entityHitResult);

View File

@@ -44,11 +44,6 @@ public class DamageTester extends LivingEntity implements PolymerEntity {
.add(EntityAttributes.ATTACK_DAMAGE, 0.0);
}
@Override
public Iterable<ItemStack> getArmorItems() {
return Collections.emptyList();
}
@Override
public ItemStack getEquippedStack(EquipmentSlot slot) {
return Items.WITHER_SKELETON_SKULL.getDefaultStack();

View File

@@ -21,6 +21,10 @@ public class ThrowableProjectile extends PersistentProjectileEntity implements P
public final EntityType<? extends PersistentProjectileEntity> entityType;
private final float scale;
public double prevX;
public double prevY;
public double prevZ;
public ThrowableProjectile(EntityType<? extends ThrowableProjectile> entityType, World world, Vec3d pos, ItemStack itemStack, float scale, double damage, PickupPermission pickupPermission, byte penetration) {
super(entityType, pos.getX(), pos.getY() + 1.5d, pos.getZ(), world, itemStack, null);
this.pickupType = pickupPermission;

View File

@@ -50,9 +50,7 @@
"item.plasticgun.rpg_shell": "RPG Shell",
"item.plasticgun.force_container": "Force Container",
"item.plasticgun.grenade": "Grenade",
"item.plasticgun.grenade_incendiary": "Incendiary Grenade",
"item.plasticgun.shuriken": "Shuriken",
"item.plasticgun.grenade_m67": "M67 Fragmentation Grenade",
"item.plasticgun.grenade_mk2": "Mk 2 Fragmentation Grenade",
"item.plasticgun.grenade_an_m14": "AN-M14 Incendiary Grenade",
"item.plasticgun.grenade_m34": "M34 White Phosphorus Incendiary Fragmentation Grenade",

View File

@@ -1,6 +0,0 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "plasticgun:item/grenade_m67"
}
}

View File

@@ -0,0 +1,8 @@
{
"entities": [
"player"
],
"slots": [
"chest/vest"
]
}

View File

@@ -0,0 +1,6 @@
{
"replace": false,
"amount": 1,
"order": 0,
"icon": "plasticgun:gui/slots/vest_slot"
}

View File

@@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"plasticgun:kevlar_vest",
"plasticgun:flak_vest"
]
}

View File

@@ -2,4 +2,5 @@ accessWidener v2 named
accessible field net/minecraft/entity/mob/MobEntity goalSelector Lnet/minecraft/entity/ai/goal/GoalSelector;
accessible field net/minecraft/entity/mob/AbstractSkeletonEntity bowAttackGoal Lnet/minecraft/entity/ai/goal/BowAttackGoal;
accessible field net/minecraft/entity/mob/AbstractSkeletonEntity meleeAttackGoal Lnet/minecraft/entity/ai/goal/MeleeAttackGoal;
accessible field net/minecraft/entity/projectile/PersistentProjectileEntity damage D
accessible method net/minecraft/entity/mob/MobEntity initEquipment (Lnet/minecraft/util/math/random/Random;Lnet/minecraft/world/LocalDifficulty;)V