This commit is contained in:
Bruno Rybársky 2024-08-02 20:05:56 +02:00
parent ed1bfb65d4
commit 8a53f20f77
16 changed files with 4 additions and 66 deletions

@ -94,24 +94,6 @@ jar {
} }
} }
// configure the maven publication
publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
loom { loom {
accessWidenerPath = file("src/main/resources/plasticgun.accesswidener") accessWidenerPath = file("src/main/resources/plasticgun.accesswidener")
} }

@ -3,7 +3,6 @@ package systems.brn.plasticgun;
import eu.pb4.polymer.core.api.entity.PolymerEntityUtils; import eu.pb4.polymer.core.api.entity.PolymerEntityUtils;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils; import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerEntityEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerEntityEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.player.UseItemCallback; import net.fabricmc.fabric.api.event.player.UseItemCallback;
@ -19,7 +18,6 @@ import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import systems.brn.plasticgun.bullets.BulletEntity; import systems.brn.plasticgun.bullets.BulletEntity;
@ -64,13 +62,13 @@ public class PlasticGun implements ModInitializer {
public static Map<Item, GrenadeItem> itemGrenadeItemMap; public static Map<Item, GrenadeItem> itemGrenadeItemMap;
public static Map<Item, ShurikenItem> itemShurikenItemMap; public static Map<Item, ShurikenItem> itemShurikenItemMap;
public static EntityType<BulletEntity> BULLET_ENTITY_TYPE = Registry.register( public static final EntityType<BulletEntity> BULLET_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE, Registries.ENTITY_TYPE,
id("bullet"), id("bullet"),
EntityType.Builder.<BulletEntity>create(BulletEntity::new, SpawnGroup.MISC).build() EntityType.Builder.<BulletEntity>create(BulletEntity::new, SpawnGroup.MISC).build()
); );
public static EntityType<GrenadeEntity> GRENADE_ENTITY_TYPE = Registry.register( public static final EntityType<GrenadeEntity> GRENADE_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE, Registries.ENTITY_TYPE,
id("grenade"), id("grenade"),
EntityType.Builder.<GrenadeEntity>create(GrenadeEntity::new, SpawnGroup.MISC).build() EntityType.Builder.<GrenadeEntity>create(GrenadeEntity::new, SpawnGroup.MISC).build()
@ -78,13 +76,13 @@ public class PlasticGun implements ModInitializer {
public static final ArrayList<WeaponArmor> weaponArmors = new ArrayList<>(); public static final ArrayList<WeaponArmor> weaponArmors = new ArrayList<>();
public static EntityType<ShurikenEntity> SHURIKEN_ENTITY_TYPE = Registry.register( public static final EntityType<ShurikenEntity> SHURIKEN_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE, Registries.ENTITY_TYPE,
id("shuriken"), id("shuriken"),
EntityType.Builder.<ShurikenEntity>create(ShurikenEntity::new, SpawnGroup.MISC).build() EntityType.Builder.<ShurikenEntity>create(ShurikenEntity::new, SpawnGroup.MISC).build()
); );
public static EntityType<DamageTester> DAMAGE_TESTER_ENTITY_TYPE = Registry.register( public static final EntityType<DamageTester> DAMAGE_TESTER_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE, Registries.ENTITY_TYPE,
id("damagetester"), id("damagetester"),
EntityType.Builder.create(DamageTester::new, SpawnGroup.MISC).build() EntityType.Builder.create(DamageTester::new, SpawnGroup.MISC).build()

@ -16,7 +16,6 @@ import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult; import net.minecraft.util.hit.HitResult;
import eu.pb4.polymer.core.api.entity.PolymerEntity; import eu.pb4.polymer.core.api.entity.PolymerEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import systems.brn.plasticgun.PlasticGun;
import systems.brn.plasticgun.grenades.GrenadeExplosionBehavior; import systems.brn.plasticgun.grenades.GrenadeExplosionBehavior;
import systems.brn.plasticgun.guns.Gun; import systems.brn.plasticgun.guns.Gun;
import systems.brn.plasticgun.lib.WeaponDamageType; import systems.brn.plasticgun.lib.WeaponDamageType;

@ -6,7 +6,6 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.render.RenderTickCounter; import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.ColorHelper; import net.minecraft.util.math.ColorHelper;
import systems.brn.plasticgun.packets.ModDetect; import systems.brn.plasticgun.packets.ModDetect;
import systems.brn.plasticgun.packets.Reload; import systems.brn.plasticgun.packets.Reload;

@ -9,7 +9,6 @@ import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import systems.brn.plasticgun.PlasticGun; import systems.brn.plasticgun.PlasticGun;
import static systems.brn.plasticgun.PlasticGun.flashbangEffect;
import static systems.brn.plasticgun.PlasticGun.stunEffect; import static systems.brn.plasticgun.PlasticGun.stunEffect;
public class StunEffect extends StatusEffect implements PolymerStatusEffect { public class StunEffect extends StatusEffect implements PolymerStatusEffect {

@ -6,7 +6,6 @@ import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MovementType; import net.minecraft.entity.MovementType;
import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
@ -14,7 +13,6 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.random.Random; import net.minecraft.util.math.random.Random;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import systems.brn.plasticgun.effects.FlashbangEffect;
import systems.brn.plasticgun.throwables.ThrowableProjectile; import systems.brn.plasticgun.throwables.ThrowableProjectile;
import java.util.List; import java.util.List;

@ -3,7 +3,6 @@ package systems.brn.plasticgun.guns;
import eu.pb4.polymer.core.api.item.PolymerItem; import eu.pb4.polymer.core.api.item.PolymerItem;
import net.minecraft.component.DataComponentTypes; import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.LoreComponent; import net.minecraft.component.type.LoreComponent;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;

@ -12,16 +12,11 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.RangedAttackMob; import net.minecraft.entity.ai.RangedAttackMob;
import net.minecraft.entity.ai.goal.Goal; import net.minecraft.entity.ai.goal.Goal;
import net.minecraft.entity.mob.HostileEntity; import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.item.BowItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import static systems.brn.plasticgun.PlasticGun.guns;
import static systems.brn.plasticgun.PlasticGun.itemGunMap; import static systems.brn.plasticgun.PlasticGun.itemGunMap;
import static systems.brn.plasticgun.lib.GunComponents.*; import static systems.brn.plasticgun.lib.GunComponents.*;

@ -20,11 +20,9 @@ import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World; import net.minecraft.world.World;
import systems.brn.plasticgun.grenades.GrenadeEntity; import systems.brn.plasticgun.grenades.GrenadeEntity;
import systems.brn.plasticgun.grenades.GrenadeItem; import systems.brn.plasticgun.grenades.GrenadeItem;
import systems.brn.plasticgun.guns.Gun;
import systems.brn.plasticgun.packets.ModDetect; import systems.brn.plasticgun.packets.ModDetect;
import systems.brn.plasticgun.packets.Reload; import systems.brn.plasticgun.packets.Reload;
import systems.brn.plasticgun.packets.Shoot; import systems.brn.plasticgun.packets.Shoot;
import systems.brn.plasticgun.shurikens.ShurikenItem;
import java.util.function.Predicate; import java.util.function.Predicate;

@ -3,7 +3,6 @@ package systems.brn.plasticgun.lib;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import eu.pb4.polymer.core.api.other.PolymerComponent; import eu.pb4.polymer.core.api.other.PolymerComponent;
import net.minecraft.component.ComponentType; import net.minecraft.component.ComponentType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;

@ -5,15 +5,11 @@ import dev.emi.trinkets.api.TrinketComponent;
import dev.emi.trinkets.api.TrinketInventory; import dev.emi.trinkets.api.TrinketInventory;
import dev.emi.trinkets.api.TrinketsApi; import dev.emi.trinkets.api.TrinketsApi;
import eu.pb4.polymer.virtualentity.api.tracker.DisplayTrackedData; import eu.pb4.polymer.virtualentity.api.tracker.DisplayTrackedData;
import net.fabricmc.loader.impl.lib.sat4j.core.Vec;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.client.particle.BlockDustParticle;
import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.data.DataTracker;
import net.minecraft.entity.decoration.DisplayEntity; import net.minecraft.entity.decoration.DisplayEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -22,11 +18,7 @@ import net.minecraft.inventory.Inventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.particle.BlockStateParticleEffect; import net.minecraft.particle.BlockStateParticleEffect;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.particle.ParticleType;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.Registries;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
@ -44,14 +36,10 @@ import net.minecraft.world.explosion.Explosion;
import net.minecraft.world.explosion.ExplosionBehavior; import net.minecraft.world.explosion.ExplosionBehavior;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.joml.Vector3f; import org.joml.Vector3f;
import systems.brn.plasticgun.PlasticGun;
import systems.brn.plasticgun.defence.WeaponArmor; import systems.brn.plasticgun.defence.WeaponArmor;
import java.util.*; import java.util.*;
import java.util.function.Function;
import static net.minecraft.entity.projectile.AbstractWindChargeEntity.EXPLOSION_BEHAVIOR;
import static net.minecraft.world.explosion.Explosion.getExposure;
import static systems.brn.plasticgun.PlasticGun.*; import static systems.brn.plasticgun.PlasticGun.*;
public class Util { public class Util {
@ -236,7 +224,6 @@ public class Util {
case EASY -> 1; case EASY -> 1;
case NORMAL -> 2; case NORMAL -> 2;
case HARD -> 3; case HARD -> 3;
default -> 1;
}; };
// Determine the chance to equip a gun // Determine the chance to equip a gun

@ -2,29 +2,22 @@ package systems.brn.plasticgun.mixins;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.ai.goal.BowAttackGoal; import net.minecraft.entity.ai.goal.BowAttackGoal;
import net.minecraft.entity.ai.goal.GoalSelector;
import net.minecraft.entity.ai.goal.MeleeAttackGoal; import net.minecraft.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.entity.mob.AbstractSkeletonEntity; import net.minecraft.entity.mob.AbstractSkeletonEntity;
import net.minecraft.entity.projectile.ProjectileUtil; import net.minecraft.entity.projectile.ProjectileUtil;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.RangedWeaponItem; import net.minecraft.item.RangedWeaponItem;
import net.minecraft.util.Hand;
import net.minecraft.util.math.random.Random; import net.minecraft.util.math.random.Random;
import net.minecraft.world.Difficulty; import net.minecraft.world.Difficulty;
import net.minecraft.world.LocalDifficulty; import net.minecraft.world.LocalDifficulty;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import systems.brn.plasticgun.PlasticGun;
import systems.brn.plasticgun.guns.Gun;
import systems.brn.plasticgun.guns.WeaponShootGoal; import systems.brn.plasticgun.guns.WeaponShootGoal;
import static systems.brn.plasticgun.PlasticGun.guns; import static systems.brn.plasticgun.PlasticGun.guns;

@ -5,12 +5,10 @@ import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.mob.ZombieEntity; import net.minecraft.entity.mob.ZombieEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.random.Random; import net.minecraft.util.math.random.Random;
import net.minecraft.world.Difficulty;
import net.minecraft.world.LocalDifficulty; import net.minecraft.world.LocalDifficulty;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@ -18,7 +16,6 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import systems.brn.plasticgun.PlasticGun;
import systems.brn.plasticgun.grenades.GrenadeItem; import systems.brn.plasticgun.grenades.GrenadeItem;
import java.util.Arrays; import java.util.Arrays;

@ -1,11 +1,9 @@
package systems.brn.plasticgun.packets; package systems.brn.plasticgun.packets;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.RegistryByteBuf; import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec; import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload; import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;
import net.minecraft.util.Uuids; import net.minecraft.util.Uuids;
import java.util.UUID; import java.util.UUID;

@ -14,7 +14,6 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.world.World;
import systems.brn.plasticgun.lib.SimpleItem; import systems.brn.plasticgun.lib.SimpleItem;
import java.util.List; import java.util.List;

@ -13,8 +13,6 @@ import net.minecraft.world.World;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.List; import java.util.List;
import static systems.brn.plasticgun.PlasticGun.BULLET_ENTITY_TYPE;
import static systems.brn.plasticgun.PlasticGun.clientsWithMod;
import static systems.brn.plasticgun.lib.Util.setProjectileData; import static systems.brn.plasticgun.lib.Util.setProjectileData;
public class ThrowableProjectile extends PersistentProjectileEntity implements PolymerEntity { public class ThrowableProjectile extends PersistentProjectileEntity implements PolymerEntity {