This commit is contained in:
Bruno Rybársky 2024-08-02 20:02:46 +02:00
parent ec90a2e292
commit ed1bfb65d4
7 changed files with 39 additions and 34 deletions

@ -6,13 +6,13 @@ minecraft_version=1.21
yarn_mappings=1.21+build.9 yarn_mappings=1.21+build.9
loader_version=0.16.0 loader_version=0.16.0
# Mod Properties # Mod Properties
mod_version=1.9 mod_version=1.9.1
maven_group=systems.brn maven_group=systems.brn
archives_base_name=plasticgun archives_base_name=plasticgun
# Dependencies # Dependencies
# check this on https://modmuss50.me/fabric.html # check this on https://modmuss50.me/fabric.html
fabric_version=0.100.7+1.21 fabric_version=0.100.8+1.21
polymer_version=0.9.4+1.21 polymer_version=0.9.8+1.21
server_translations_api_version=2.3.1+1.21-pre2 server_translations_api_version=2.3.1+1.21-pre2
trinkets_version=3.10.0+polymerport.2 trinkets_version=3.10.0+polymerport.2

@ -64,15 +64,31 @@ 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; public static EntityType<BulletEntity> BULLET_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("bullet"),
EntityType.Builder.<BulletEntity>create(BulletEntity::new, SpawnGroup.MISC).build()
);
public static EntityType<GrenadeEntity> GRENADE_ENTITY_TYPE; public static EntityType<GrenadeEntity> GRENADE_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("grenade"),
EntityType.Builder.<GrenadeEntity>create(GrenadeEntity::new, SpawnGroup.MISC).build()
);
public static final ArrayList<WeaponArmor> weaponArmors = new ArrayList<>(); public static final ArrayList<WeaponArmor> weaponArmors = new ArrayList<>();
public static EntityType<ShurikenEntity> SHURIKEN_ENTITY_TYPE; public static EntityType<ShurikenEntity> SHURIKEN_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("shuriken"),
EntityType.Builder.<ShurikenEntity>create(ShurikenEntity::new, SpawnGroup.MISC).build()
);
public static EntityType<DamageTester> DAMAGE_TESTER_ENTITY_TYPE; public static EntityType<DamageTester> DAMAGE_TESTER_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("damagetester"),
EntityType.Builder.create(DamageTester::new, SpawnGroup.MISC).build()
);
public static final Logger logger = LoggerFactory.getLogger(MOD_ID); public static final Logger logger = LoggerFactory.getLogger(MOD_ID);
@ -80,8 +96,8 @@ public class PlasticGun implements ModInitializer {
public static final ArrayList<Item> clickEventItems = new ArrayList<>(); public static final ArrayList<Item> clickEventItems = new ArrayList<>();
public static final RegistryEntry.Reference<StatusEffect> flashbangEffect = Registry.registerReference(Registries.STATUS_EFFECT, id("flashbang"), new FlashbangEffect()); public static final RegistryEntry.Reference<StatusEffect> flashbangEffect = Registry.registerReference(Registries.STATUS_EFFECT, id("flashbang"), new FlashbangEffect());
public static final RegistryEntry.Reference<StatusEffect> stunEffect = Registry.registerReference(Registries.STATUS_EFFECT, id("stun"), new StunEffect()); public static final RegistryEntry.Reference<StatusEffect> stunEffect = Registry.registerReference(Registries.STATUS_EFFECT, id("stun"), new StunEffect());
@Override @Override
public void onInitialize() { public void onInitialize() {
@ -107,7 +123,7 @@ public class PlasticGun implements ModInitializer {
bullets.add(new BulletItem("force_container", 99, 0, 888, false, 0, 1)); bullets.add(new BulletItem("force_container", 99, 0, 888, false, 0, 1));
// Guns // Guns
guns.add(new Gun("forcegun", 0, 4, 5, 10, 10, 888, 5, 0, 2, 0f, 0f, 5f, 10f, 0, 0)); // 0 guns.add(new Gun("forcegun", 0, 4, 5, 10, 10, 888, 5, 0, 4, 0f, 0f, 5f, 10f, 0, 0)); // 0
guns.add(new Gun("p2022", 0.2, 12, 5, 10, 41, 9, 10, 0, 0, 1f, 4, 0.1f, 0.25f, -1, 1)); // 1.8 guns.add(new Gun("p2022", 0.2, 12, 5, 10, 41, 9, 10, 0, 0, 1f, 4, 0.1f, 0.25f, -1, 1)); // 1.8
guns.add(new Gun("colt_1903", 0.3, 10, 5, 8, 38, 32, 10, 0, 0, 1, 3, 0.1f, 0.3f, -1, 1)); // 3 guns.add(new Gun("colt_1903", 0.3, 10, 5, 8, 38, 32, 10, 0, 0, 1, 3, 0.1f, 0.3f, -1, 1)); // 3
guns.add(new Gun("ak_47", 0.2, 4, 5, 30, 45, 762, 0, 0, 0, 1f, 2, 0.2f, 0.4f, -1, 1)); // 9 guns.add(new Gun("ak_47", 0.2, 4, 5, 30, 45, 762, 0, 0, 0, 1f, 2, 0.2f, 0.4f, -1, 1)); // 9
@ -178,32 +194,11 @@ public class PlasticGun implements ModInitializer {
registerIntoClickEvents(grenades); registerIntoClickEvents(grenades);
registerIntoClickEvents(shurikens); registerIntoClickEvents(shurikens);
GRENADE_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("grenade"),
EntityType.Builder.<GrenadeEntity>create(GrenadeEntity::new, SpawnGroup.MISC).build()
);
PolymerEntityUtils.registerType(GRENADE_ENTITY_TYPE); PolymerEntityUtils.registerType(GRENADE_ENTITY_TYPE);
BULLET_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("bullet"),
EntityType.Builder.<BulletEntity>create(BulletEntity::new, SpawnGroup.MISC).build()
);
PolymerEntityUtils.registerType(BULLET_ENTITY_TYPE); PolymerEntityUtils.registerType(BULLET_ENTITY_TYPE);
SHURIKEN_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("shuriken"),
EntityType.Builder.<ShurikenEntity>create(ShurikenEntity::new, SpawnGroup.MISC).build()
);
PolymerEntityUtils.registerType(SHURIKEN_ENTITY_TYPE); PolymerEntityUtils.registerType(SHURIKEN_ENTITY_TYPE);
DAMAGE_TESTER_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("damagetester"),
EntityType.Builder.create(DamageTester::new, SpawnGroup.MISC).build()
);
FabricDefaultAttributeRegistry.register(DAMAGE_TESTER_ENTITY_TYPE, DamageTester.createDamageTesterAttributes()); FabricDefaultAttributeRegistry.register(DAMAGE_TESTER_ENTITY_TYPE, DamageTester.createDamageTesterAttributes());
PolymerEntityUtils.registerType(DAMAGE_TESTER_ENTITY_TYPE); PolymerEntityUtils.registerType(DAMAGE_TESTER_ENTITY_TYPE);

@ -16,6 +16,7 @@ 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;

@ -23,10 +23,10 @@ public class BulletItem extends SimpleItem {
new Settings() new Settings()
.maxCount(maxCount) .maxCount(maxCount)
.component(DataComponentTypes.LORE, new LoreComponent(List.of( .component(DataComponentTypes.LORE, new LoreComponent(List.of(
Text.translatable("gun.description.caliber", caliber),
Text.translatable("gun.description.speed", damageCoefficient), Text.translatable("gun.description.speed", damageCoefficient),
Text.translatable("gun.description.explosion_coefficient", explosionPowerCoefficient), Text.translatable("gun.description.explosion_coefficient", explosionPowerCoefficient),
Text.translatable("gun.description.repulsion_efficient", repulsionPowerCoefficient), Text.translatable("gun.description.repulsion_efficient", repulsionPowerCoefficient),
Text.translatable("gun.description.repulsion_efficient", repulsionPowerCoefficient),
Text.translatable(isIncendiary ? "gun.description.incendiary_yes" : "gun.description.incendiary_no") Text.translatable(isIncendiary ? "gun.description.incendiary_yes" : "gun.description.incendiary_no")
)) ))
) )

@ -22,7 +22,7 @@ public abstract class SimpleItem extends SimplePolymerItem implements PolymerIte
@Override @Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) { public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
if (PlasticGun.clientsWithMod.contains(player)) { if(PlasticGun.clientsWithMod.contains(player)){
return this; return this;
} }
return this.polymerModel.item(); return this.polymerModel.item();

@ -13,10 +13,13 @@ 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 {
private ItemStack itemStack = Items.ARROW.getDefaultStack(); private ItemStack itemStack = Items.ARROW.getDefaultStack();
public final EntityType<? extends PersistentProjectileEntity> entityType;
private final float scale; private final float scale;
public ThrowableProjectile(EntityType<? extends ThrowableProjectile> entityType, World world, Vec3d pos, ItemStack itemStack, float scale, double damage, PickupPermission pickupPermission, byte penetration) { public ThrowableProjectile(EntityType<? extends ThrowableProjectile> entityType, World world, Vec3d pos, ItemStack itemStack, float scale, double damage, PickupPermission pickupPermission, byte penetration) {
@ -25,6 +28,7 @@ public class ThrowableProjectile extends PersistentProjectileEntity implements P
this.setDamage(damage); this.setDamage(damage);
this.setSilent(true); this.setSilent(true);
this.scale = scale; this.scale = scale;
this.entityType = entityType;
this.setCustomPierceLevel(penetration); this.setCustomPierceLevel(penetration);
this.setItemStack(itemStack.copy()); this.setItemStack(itemStack.copy());
} }
@ -37,6 +41,7 @@ public class ThrowableProjectile extends PersistentProjectileEntity implements P
this.setDamage(damage); this.setDamage(damage);
this.setSilent(true); this.setSilent(true);
this.scale = scale; this.scale = scale;
this.entityType = entityType;
this.setCustomPierceLevel(penetration); this.setCustomPierceLevel(penetration);
this.setItemStack(itemStack); this.setItemStack(itemStack);
} }

@ -79,6 +79,10 @@
"effect.plasticgun.flashbang": "Flashbang", "effect.plasticgun.flashbang": "Flashbang",
"trinkets.slot.chest.vest": "Vest", "trinkets.slot.chest.vest": "Vest",
"tag.item.trinkets.chest.vest": "Vest slot compatible", "tag.item.trinkets.chest.vest": "Vest slot compatible",
"entity.plasticgun.bullet": "Bullet",
"entity.plasticgun.grenade": "Grenade",
"entity.plasticgun.shuriken": "Shuriken",
"entity.plasticgun.damagetester": "Damage testing dummy",
"gun.description.damage_coefficient": "Damage coefficient: %d", "gun.description.damage_coefficient": "Damage coefficient: %d",
"gun.description.explosion_coefficient": "Explosion coefficient: %d", "gun.description.explosion_coefficient": "Explosion coefficient: %d",
"gun.description.repulsion_efficient": "Repulsion coefficient: %d", "gun.description.repulsion_efficient": "Repulsion coefficient: %d",