Update to 1.21.5
This commit is contained in:
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user