Compare commits

..

11 Commits

Author SHA1 Message Date
ce0f8643e7 Update to 1.21.8 2025-07-20 23:18:21 +02:00
977050276c Update to 1.21.5 2025-04-16 22:14:08 +02:00
6fc5738e38 Update 2024-12-23 08:49:36 +01:00
8afe0c0063 Update to 1.21.4 2024-12-05 14:46:33 +01:00
b7fc022f90 Try some stuff 2024-11-01 23:38:18 +01:00
78633a1338 Try some stuff 2024-11-01 23:35:39 +01:00
2395fa83ff Add loot tables 2024-09-17 08:56:31 +02:00
3487a054cc Fix recipe 2024-08-20 09:44:13 +02:00
2e4a221528 Fix recipe 2024-08-20 09:44:01 +02:00
8205348228 Fix recipe 2024-08-19 22:48:12 +02:00
0366fe425a Fix recipe 2024-08-18 11:49:20 +02:00
247 changed files with 1329 additions and 657 deletions

View File

@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'fabric-loom' version '1.11-SNAPSHOT'
id 'maven-publish'
}
@@ -35,6 +35,7 @@ dependencies {
modImplementation include("eu.pb4:polymer-virtual-entity:${project.polymer_version}")
modImplementation include("eu.pb4:polymer-blocks:${project.polymer_version}")
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}"
@@ -54,8 +55,8 @@ processResources {
filesMatching("fabric.mod.json") {
expand "version": project.version,
"minecraft_version": project.minecraft_version,
"loader_version": project.loader_version,
"trinkets_version": project.trinkets_version
"trinkets_version": project.trinkets_version,
"loader_version": project.loader_version
}
}

View File

@@ -2,17 +2,17 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21
yarn_mappings=1.21+build.9
loader_version=0.16.0
minecraft_version=1.21.8
yarn_mappings=1.21.8+build.1
loader_version=0.16.14
# Mod Properties
mod_version=1.9.1
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.100.8+1.21
fabric_version=0.129.0+1.21.8
polymer_version=0.9.8+1.21
server_translations_api_version=2.3.1+1.21-pre2
trinkets_version=3.10.0+polymerport.2
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

View File

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

View File

@@ -14,8 +14,11 @@ import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.item.Item;
import net.minecraft.loot.LootTables;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.server.network.ServerPlayerEntity;
import org.slf4j.Logger;
@@ -32,8 +35,6 @@ import systems.brn.plasticgun.lib.CraftingItem;
import systems.brn.plasticgun.lib.EventHandler;
import systems.brn.plasticgun.lib.ItemGroups;
import systems.brn.plasticgun.packets.ModDetect;
import systems.brn.plasticgun.packets.Reload;
import systems.brn.plasticgun.packets.Shoot;
import systems.brn.plasticgun.shurikens.ShurikenEntity;
import systems.brn.plasticgun.shurikens.ShurikenItem;
import systems.brn.plasticgun.testing.DamageTester;
@@ -57,6 +58,8 @@ public class PlasticGun implements ModInitializer {
public static final ArrayList<CraftingItem> craftingItems = new ArrayList<>();
public static final ArrayList<WeaponArmor> weaponArmors = new ArrayList<>();
public static Map<Item, Gun> itemGunMap;
public static Map<Item, BulletItem> itemBulletItemMap;
public static Map<Item, GrenadeItem> itemGrenadeItemMap;
@@ -65,27 +68,25 @@ public class PlasticGun implements ModInitializer {
public static final EntityType<BulletEntity> BULLET_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("bullet"),
EntityType.Builder.<BulletEntity>create(BulletEntity::new, SpawnGroup.MISC).build()
EntityType.Builder.<BulletEntity>create(BulletEntity::new, SpawnGroup.MISC).build(RegistryKey.of(RegistryKeys.ENTITY_TYPE, id("bullet")))
);
public static final EntityType<GrenadeEntity> GRENADE_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("grenade"),
EntityType.Builder.<GrenadeEntity>create(GrenadeEntity::new, SpawnGroup.MISC).build()
EntityType.Builder.<GrenadeEntity>create(GrenadeEntity::new, SpawnGroup.MISC).build(RegistryKey.of(RegistryKeys.ENTITY_TYPE, id("grenade")))
);
public static final ArrayList<WeaponArmor> weaponArmors = new ArrayList<>();
public static final EntityType<ShurikenEntity> SHURIKEN_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("shuriken"),
EntityType.Builder.<ShurikenEntity>create(ShurikenEntity::new, SpawnGroup.MISC).build()
EntityType.Builder.<ShurikenEntity>create(ShurikenEntity::new, SpawnGroup.MISC).build(RegistryKey.of(RegistryKeys.ENTITY_TYPE, id("shuriken")))
);
public static final EntityType<DamageTester> DAMAGE_TESTER_ENTITY_TYPE = Registry.register(
Registries.ENTITY_TYPE,
id("damagetester"),
EntityType.Builder.create(DamageTester::new, SpawnGroup.MISC).build()
EntityType.Builder.create(DamageTester::new, SpawnGroup.MISC).build(RegistryKey.of(RegistryKeys.ENTITY_TYPE, id("damagetester")))
);
public static final Logger logger = LoggerFactory.getLogger(MOD_ID);
@@ -121,17 +122,17 @@ public class PlasticGun implements ModInitializer {
bullets.add(new BulletItem("force_container", 99, 0, 888, false, 0, 1));
// Guns
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("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("colt_45", 0.4, 9, 5, 7, 48, 45, 10, 0, 0, 1.5f, 2, 0.15f, 0.4f, -1, 1)); // 3.6
guns.add(new Gun("snub_nosed_revolver", 0.4, 7, 3, 5, 36, 38, 20, 0, 0, 1f, 2, 0.2f, 0.45f, -1, 1)); // 2.8
guns.add(new Gun("colt_peacemaker", 0.6, 8, 5, 6, 43, 45, 10, 0, 0, 0.9f, 2, 0.2f, 0.5f, -1, 1)); // 4.8
guns.add(new Gun("tokarev_tt_33", 0.7, 10, 5, 8, 45, 762, 10, 0, 0, 1.5f, 2.5f, 0.25f, 0.5f, -1, 1)); // 7
guns.add(new Gun("357_revolver", 1, 8, 5, 6, 45, 357, 20, 0, 0, 2, 4, 0.2f, 0.5f, -1, 1)); // 8
guns.add(new Gun("awp", 1, 4, 20, 1, 75, 762, 40, 0, 0, 2f, 8, 0.3f, 0.6f, -1, 1)); // 4
guns.add(new Gun("rpg9", 2, 4, 20, 1, 10, 999, 20, 20, 0, 3f, 0.5f, 1, 2, -1, 1)); // 8
guns.add(new Gun("forcegun", 0, 4, 5, 10, 10, 888, 5, 0, 10, 0f, 0f, 0f, 1f, 0, 0)); // 0
guns.add(new Gun("p2022", 0.2, 12, 5, 10, 41, 9, 10, 0, 0, 0f, 0.7f, 0.1f, 0.25f, -0.2, 0.2)); // 1.8
guns.add(new Gun("colt_1903", 0.3, 10, 5, 8, 38, 32, 10, 0, 0, 0, 0.5f, 0.1f, 0.3f, -0.2, 0.2)); // 3
guns.add(new Gun("ak_47", 0.2, 4, 5, 30, 45, 762, 0, 0, 0, 0.1f, 0.3f, 0.2f, 0.3f, -0.2, 0.2)); // 9
guns.add(new Gun("colt_45", 0.4, 9, 5, 7, 48, 45, 10, 0, 0, 0, 0.5f, 0.15f, 0.4f, -0.2, 0.2)); // 3.6
guns.add(new Gun("snub_nosed_revolver", 0.4, 7, 3, 5, 36, 38, 20, 0, 0, 0f, 0.4f, 0.2f, 0.45f, -0.2, 0.2)); // 2.8
guns.add(new Gun("colt_peacemaker", 0.6, 8, 5, 6, 43, 45, 10, 0, 0, 0, 1, 0.2f, 0.5f, -0.2, 0.2)); // 4.8
guns.add(new Gun("tokarev_tt_33", 0.7, 10, 5, 8, 45, 762, 10, 0, 0, 0, 2f, 0.25f, 0.5f, -0.2, 0.2)); // 7
guns.add(new Gun("357_revolver", 1, 8, 5, 6, 45, 357, 20, 0, 0, 2, 3, 0.2f, 0.5f, -0.2, 0.2)); // 8
guns.add(new Gun("awp", 1, 4, 20, 1, 75, 762, 40, 0, 0, 4f, 6f, 0.3f, 0.6f, -2, 2)); // 4
guns.add(new Gun("rpg9", 2, 4, 20, 1, 10, 999, 20, 10, 0, 2f, 4f, 1, 2, -1, 1)); // 8
grenades.add(new GrenadeItem("grenade_m18", 1, 0.1f, 0.2f, 50, false, false, 0, 0, 100, 15, 30)); // 0.02
@@ -183,6 +184,129 @@ public class PlasticGun implements ModInitializer {
craftingItems.add(new CraftingItem("titanium_alloy"));
craftingItems.add(new CraftingItem("trigger_mechanism"));
for (Item craftingItem : craftingItems) {
addItemToLootTable(LootTables.ABANDONED_MINESHAFT_CHEST, craftingItem, 2);
addItemToLootTable(LootTables.ANCIENT_CITY_CHEST, craftingItem, 6);
addItemToLootTable(LootTables.ANCIENT_CITY_ICE_BOX_CHEST, craftingItem, 6);
addItemToLootTable(LootTables.END_CITY_TREASURE_CHEST, craftingItem, 5);
addItemToLootTable(LootTables.BASTION_BRIDGE_CHEST, craftingItem, 4);
addItemToLootTable(LootTables.BASTION_HOGLIN_STABLE_CHEST, craftingItem, 4);
addItemToLootTable(LootTables.BASTION_OTHER_CHEST, craftingItem, 4);
addItemToLootTable(LootTables.BASTION_TREASURE_CHEST, craftingItem, 4);
addItemToLootTable(LootTables.BURIED_TREASURE_CHEST, craftingItem, 2);
addItemToLootTable(LootTables.HERO_OF_THE_VILLAGE_ARMORER_GIFT_GAMEPLAY, craftingItem, 1);
addItemToLootTable(LootTables.HERO_OF_THE_VILLAGE_WEAPONSMITH_GIFT_GAMEPLAY, craftingItem, 2);
addItemToLootTable(LootTables.VILLAGE_WEAPONSMITH_CHEST, craftingItem, 10);
addItemToLootTable(LootTables.VILLAGE_ARMORER_CHEST, craftingItem, 4);
addItemToLootTable(LootTables.DESERT_PYRAMID_CHEST, craftingItem, 4);
addItemToLootTable(LootTables.WOODLAND_MANSION_CHEST, craftingItem, 4);
addItemToLootTable(LootTables.TRIAL_CHAMBERS_REWARD_CHEST, craftingItem, 4);
}
int i = 0;
for (Item shuriken : shurikens) {
float weightCoeff = (float) i / shurikens.size();
addItemToLootTable(LootTables.ABANDONED_MINESHAFT_CHEST, shuriken, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.ANCIENT_CITY_CHEST, shuriken, getAfterWeight(weightCoeff, 6));
addItemToLootTable(LootTables.ANCIENT_CITY_ICE_BOX_CHEST, shuriken, getAfterWeight(weightCoeff, 6));
addItemToLootTable(LootTables.END_CITY_TREASURE_CHEST, shuriken, getAfterWeight(weightCoeff, 5));
addItemToLootTable(LootTables.BASTION_BRIDGE_CHEST, shuriken, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_HOGLIN_STABLE_CHEST, shuriken, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_OTHER_CHEST, shuriken, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_TREASURE_CHEST, shuriken, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BURIED_TREASURE_CHEST, shuriken, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.HERO_OF_THE_VILLAGE_WEAPONSMITH_GIFT_GAMEPLAY, shuriken, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.VILLAGE_WEAPONSMITH_CHEST, shuriken, getAfterWeight(weightCoeff, 10));
addItemToLootTable(LootTables.VILLAGE_ARMORER_CHEST, shuriken, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.DESERT_PYRAMID_CHEST, shuriken, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.WOODLAND_MANSION_CHEST, shuriken, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.TRIAL_CHAMBERS_REWARD_CHEST, shuriken, getAfterWeight(weightCoeff, 4));
i++;
}
for (Item weaponArmor : weaponArmors) {
addItemToLootTable(LootTables.ABANDONED_MINESHAFT_CHEST, weaponArmor, 4);
addItemToLootTable(LootTables.ANCIENT_CITY_CHEST, weaponArmor, 12);
addItemToLootTable(LootTables.ANCIENT_CITY_ICE_BOX_CHEST, weaponArmor, 12);
addItemToLootTable(LootTables.END_CITY_TREASURE_CHEST, weaponArmor, 10);
addItemToLootTable(LootTables.BASTION_BRIDGE_CHEST, weaponArmor, 8);
addItemToLootTable(LootTables.BASTION_HOGLIN_STABLE_CHEST, weaponArmor, 2);
addItemToLootTable(LootTables.BASTION_OTHER_CHEST, weaponArmor, 4);
addItemToLootTable(LootTables.BASTION_TREASURE_CHEST, weaponArmor, 4);
addItemToLootTable(LootTables.BURIED_TREASURE_CHEST, weaponArmor, 2);
addItemToLootTable(LootTables.HERO_OF_THE_VILLAGE_ARMORER_GIFT_GAMEPLAY, weaponArmor, 10);
addItemToLootTable(LootTables.HERO_OF_THE_VILLAGE_WEAPONSMITH_GIFT_GAMEPLAY, weaponArmor, 2);
addItemToLootTable(LootTables.VILLAGE_WEAPONSMITH_CHEST, weaponArmor, 10);
addItemToLootTable(LootTables.VILLAGE_ARMORER_CHEST, weaponArmor, 20);
addItemToLootTable(LootTables.DESERT_PYRAMID_CHEST, weaponArmor, 4);
addItemToLootTable(LootTables.WOODLAND_MANSION_CHEST, weaponArmor, 4);
addItemToLootTable(LootTables.TRIAL_CHAMBERS_REWARD_CHEST, weaponArmor, 4);
}
i = 0;
for (Item gun : guns) {
float weightCoeff = (float) i / guns.size();
weightCoeff *= 5;
addItemToLootTable(LootTables.ABANDONED_MINESHAFT_CHEST, gun, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.ANCIENT_CITY_CHEST, gun, getAfterWeight(weightCoeff, 6));
addItemToLootTable(LootTables.ANCIENT_CITY_ICE_BOX_CHEST, gun, getAfterWeight(weightCoeff, 6));
addItemToLootTable(LootTables.END_CITY_TREASURE_CHEST, gun, getAfterWeight(weightCoeff, 5));
addItemToLootTable(LootTables.BASTION_BRIDGE_CHEST, gun, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_HOGLIN_STABLE_CHEST, gun, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_OTHER_CHEST, gun, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_TREASURE_CHEST, gun, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BURIED_TREASURE_CHEST, gun, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.HERO_OF_THE_VILLAGE_WEAPONSMITH_GIFT_GAMEPLAY, gun, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.VILLAGE_WEAPONSMITH_CHEST, gun, getAfterWeight(weightCoeff, 10));
addItemToLootTable(LootTables.DESERT_PYRAMID_CHEST, gun, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.WOODLAND_MANSION_CHEST, gun, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.TRIAL_CHAMBERS_REWARD_CHEST, gun, getAfterWeight(weightCoeff, 4));
i++;
}
i = 0;
for (Item grenade : grenades) {
float weightCoeff = (float) i / grenades.size();
weightCoeff *= 6;
addItemToLootTable(LootTables.ABANDONED_MINESHAFT_CHEST, grenade, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.ANCIENT_CITY_CHEST, grenade, getAfterWeight(weightCoeff, 6));
addItemToLootTable(LootTables.ANCIENT_CITY_ICE_BOX_CHEST, grenade, getAfterWeight(weightCoeff, 6));
addItemToLootTable(LootTables.END_CITY_TREASURE_CHEST, grenade, getAfterWeight(weightCoeff, 5));
addItemToLootTable(LootTables.BASTION_BRIDGE_CHEST, grenade, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_HOGLIN_STABLE_CHEST, grenade, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_OTHER_CHEST, grenade, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_TREASURE_CHEST, grenade, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BURIED_TREASURE_CHEST, grenade, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.HERO_OF_THE_VILLAGE_WEAPONSMITH_GIFT_GAMEPLAY, grenade, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.VILLAGE_WEAPONSMITH_CHEST, grenade, getAfterWeight(weightCoeff, 10));
addItemToLootTable(LootTables.DESERT_PYRAMID_CHEST, grenade, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.WOODLAND_MANSION_CHEST, grenade, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.TRIAL_CHAMBERS_REWARD_CHEST, grenade, getAfterWeight(weightCoeff, 4));
i++;
}
i = 0;
for (Item bullet : bullets) {
float weightCoeff = (float) i / bullets.size();
weightCoeff *= 8;
addItemToLootTable(LootTables.ABANDONED_MINESHAFT_CHEST, bullet, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.ANCIENT_CITY_CHEST, bullet, getAfterWeight(weightCoeff, 6));
addItemToLootTable(LootTables.ANCIENT_CITY_ICE_BOX_CHEST, bullet, getAfterWeight(weightCoeff, 6));
addItemToLootTable(LootTables.END_CITY_TREASURE_CHEST, bullet, getAfterWeight(weightCoeff, 5));
addItemToLootTable(LootTables.BASTION_BRIDGE_CHEST, bullet, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_HOGLIN_STABLE_CHEST, bullet, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_OTHER_CHEST, bullet, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BASTION_TREASURE_CHEST, bullet, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.BURIED_TREASURE_CHEST, bullet, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.HERO_OF_THE_VILLAGE_WEAPONSMITH_GIFT_GAMEPLAY, bullet, getAfterWeight(weightCoeff, 2));
addItemToLootTable(LootTables.VILLAGE_WEAPONSMITH_CHEST, bullet, getAfterWeight(weightCoeff, 10));
addItemToLootTable(LootTables.DESERT_PYRAMID_CHEST, bullet, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.WOODLAND_MANSION_CHEST, bullet, getAfterWeight(weightCoeff, 4));
addItemToLootTable(LootTables.TRIAL_CHAMBERS_REWARD_CHEST, bullet, getAfterWeight(weightCoeff, 4));
i++;
}
itemGunMap = generateItemMap(guns);
itemBulletItemMap = generateItemMap(bullets);
itemGrenadeItemMap = generateItemMap(grenades);
@@ -197,8 +321,8 @@ public class PlasticGun implements ModInitializer {
PolymerEntityUtils.registerType(SHURIKEN_ENTITY_TYPE);
FabricDefaultAttributeRegistry.register(DAMAGE_TESTER_ENTITY_TYPE, DamageTester.createDamageTesterAttributes());
PolymerEntityUtils.registerType(DAMAGE_TESTER_ENTITY_TYPE);
FabricDefaultAttributeRegistry.register(DAMAGE_TESTER_ENTITY_TYPE, DamageTester.createDamageTesterAttributes());
// Detect item use
@@ -215,13 +339,9 @@ public class PlasticGun implements ModInitializer {
ItemGroups.register();
PayloadTypeRegistry.playC2S().register(ModDetect.PACKET_ID, ModDetect.PACKET_CODEC);
PayloadTypeRegistry.playC2S().register(Reload.PACKET_ID, Reload.PACKET_CODEC);
PayloadTypeRegistry.playC2S().register(Shoot.PACKET_ID, Shoot.PACKET_CODEC);
// Register the global receiver
ServerPlayNetworking.registerGlobalReceiver(ModDetect.PACKET_ID, EventHandler::onClientConfirm);
ServerPlayNetworking.registerGlobalReceiver(Reload.PACKET_ID, EventHandler::onClientReload);
ServerPlayNetworking.registerGlobalReceiver(Shoot.PACKET_ID, EventHandler::onClientShoot);
PolymerResourcePackUtils.addModAssets(MOD_ID);
PolymerResourcePackUtils.markAsRequired();

View File

@@ -19,6 +19,7 @@ import net.minecraft.world.World;
import systems.brn.plasticgun.grenades.GrenadeExplosionBehavior;
import systems.brn.plasticgun.guns.Gun;
import systems.brn.plasticgun.lib.WeaponDamageType;
import xyz.nucleoid.packettweaker.PacketContext;
import java.lang.reflect.Method;
import java.util.List;
@@ -35,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;
@@ -87,7 +88,7 @@ public class BulletEntity extends PersistentProjectileEntity implements PolymerE
}
@Override
public EntityType<?> getPolymerEntityType(ServerPlayerEntity player) {
public EntityType<?> getPolymerEntityType(PacketContext packetContext) {
return EntityType.ITEM_DISPLAY;
}
@@ -96,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);
@@ -117,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

@@ -5,6 +5,8 @@ import net.minecraft.component.type.LoreComponent;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.Text;
import systems.brn.plasticgun.lib.SimpleItem;
@@ -28,8 +30,8 @@ public class BulletItem extends SimpleItem {
Text.translatable("gun.description.explosion_coefficient", explosionPowerCoefficient),
Text.translatable("gun.description.repulsion_efficient", repulsionPowerCoefficient),
Text.translatable(isIncendiary ? "gun.description.incendiary_yes" : "gun.description.incendiary_no")
))
)
)))
.registryKey(RegistryKey.of(RegistryKeys.ITEM, id(path)))
,
id(path),
Items.STICK);

View File

@@ -1,6 +1,5 @@
package systems.brn.plasticgun.companion;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
@@ -8,30 +7,11 @@ import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.util.math.ColorHelper;
import systems.brn.plasticgun.packets.ModDetect;
import systems.brn.plasticgun.packets.Reload;
import systems.brn.plasticgun.packets.Shoot;
import java.util.UUID;
import static systems.brn.plasticgun.PlasticGun.flashbangEffect;
import static systems.brn.plasticgun.lib.Util.shouldSendClickEvents;
public class ClientEvents {
public static void tick(MinecraftClient minecraftClient) {
if (minecraftClient.options.useKey.isPressed() && minecraftClient.player != null) {
if (shouldSendClickEvents(minecraftClient.player)) {
UUID reloadUUID = UUID.randomUUID();
ClientPlayNetworking.send(new Reload(reloadUUID));
}
}
if (minecraftClient.options.attackKey.isPressed() && minecraftClient.player != null) {
if (shouldSendClickEvents(minecraftClient.player)) {
UUID shootUUID = UUID.randomUUID();
ClientPlayNetworking.send(new Shoot(shootUUID));
}
}
}
public static void join(ClientPlayNetworkHandler clientPlayNetworkHandler, PacketSender packetSender, MinecraftClient minecraftClient) {
UUID joinUUID = UUID.randomUUID();
packetSender.sendPacket(new ModDetect(joinUUID));
@@ -42,7 +22,7 @@ public class ClientEvents {
if (MinecraftClient.getInstance().player.hasStatusEffect(flashbangEffect)) {
int width = drawContext.getScaledWindowWidth();
int height = drawContext.getScaledWindowHeight();
drawContext.fill(0, 0, width, height, ColorHelper.Argb.fromFloats(1, 1, 1, 1));
drawContext.fill(0, 0, width, height, ColorHelper.fromFloats(1, 1, 1, 1));
}
}
}

View File

@@ -1,14 +1,12 @@
package systems.brn.plasticgun.companion;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
public class PlasticGunClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
ClientTickEvents.END_CLIENT_TICK.register(ClientEvents::tick);
ClientPlayConnectionEvents.JOIN.register(ClientEvents::join);
HudRenderCallback.EVENT.register(ClientEvents::HUDDraw);
}

View File

@@ -1,11 +1,14 @@
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;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.Text;
import systems.brn.plasticgun.lib.TrinketPolymerItem;
import systems.brn.plasticgun.lib.WeaponDamageType;
@@ -15,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) {
@@ -25,7 +28,7 @@ public class WeaponArmor extends TrinketPolymerItem {
Text.translatable("gun.description.armor.grenade", (int) ((1 - grenadeDamageCoefficient) * 100)),
Text.translatable("gun.description.armor.fragmentation_grenade", (int) ((1 - fragmentationDamageCoefficient) * 100)),
Text.translatable("gun.description.armor.shuriken", (int) ((1 - shurikenDamageCoefficient) * 100))
)))
))).registryKey(RegistryKey.of(RegistryKeys.ITEM, id(name)))
, name)
;
Registry.register(Registries.ITEM, id(name), this);

View File

@@ -5,10 +5,12 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
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() {
@@ -26,14 +28,13 @@ public class FlashbangEffect extends StatusEffect implements PolymerStatusEffect
// Called when the effect is applied.
@Override
public boolean applyUpdateEffect(LivingEntity entity, int amplifier) {
return super.applyUpdateEffect(entity, amplifier);
public boolean applyUpdateEffect(ServerWorld world, LivingEntity entity, int amplifier) {
return super.applyUpdateEffect(world, entity, amplifier);
}
@Override
public StatusEffect getPolymerReplacement(ServerPlayerEntity player){
if (PlasticGun.clientsWithMod.contains(player)){
return flashbangEffect.value();
public StatusEffect getPolymerReplacement(StatusEffect potion, PacketContext packetContext) {
if (PlasticGun.clientsWithMod.contains(packetContext.getPlayer())){
return stunEffect.value();
}
return StatusEffects.BLINDNESS.value();
}

View File

@@ -6,8 +6,9 @@ import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import systems.brn.plasticgun.PlasticGun;
import xyz.nucleoid.packettweaker.PacketContext;
import static systems.brn.plasticgun.PlasticGun.stunEffect;
@@ -34,16 +35,16 @@ public class StunEffect extends StatusEffect implements PolymerStatusEffect {
// Called when the effect is applied.
@Override
public boolean applyUpdateEffect(LivingEntity entity, int amplifier) {
public boolean applyUpdateEffect(ServerWorld world, LivingEntity entity, int amplifier) {
applied = true;
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, stunDuration, 255, true, false));
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.JUMP_BOOST, stunDuration, 255, true, false));
return super.applyUpdateEffect(entity, amplifier);
return super.applyUpdateEffect(world, entity, amplifier);
}
@Override
public StatusEffect getPolymerReplacement(ServerPlayerEntity player) {
if (PlasticGun.clientsWithMod.contains(player)){
public StatusEffect getPolymerReplacement(StatusEffect potion, PacketContext packetContext) {
if (PlasticGun.clientsWithMod.contains(packetContext.getPlayer())){
return stunEffect.value();
}
return null;

View File

@@ -63,8 +63,8 @@ public class FragmentationExplosionBehavior extends ExplosionBehavior {
}
@Override
public float calculateDamage(Explosion explosion, Entity entity) {
float original = super.calculateDamage(explosion, entity);
public float calculateDamage(Explosion explosion, Entity entity, float amount) {
float original = super.calculateDamage(explosion, entity, amount);
if (entity instanceof LivingEntity livingEntity) {
original = (float) getFinalDamage(livingEntity, WeaponDamageType.FRAGMENTATION_GRENADE, original);
if (original > 0) {

View File

@@ -13,8 +13,8 @@ public class GrenadeExplosionBehavior extends ExplosionBehavior {
@Override
public float calculateDamage(Explosion explosion, Entity entity) {
float original = super.calculateDamage(explosion, entity);
public float calculateDamage(Explosion explosion, Entity entity, float amount) {
float original = super.calculateDamage(explosion, entity, amount);
if (entity instanceof LivingEntity livingEntity) {
original = (float) getFinalDamage(livingEntity, WeaponDamageType.GRENADE, original);
if (original > 0) {

View File

@@ -8,6 +8,8 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
@@ -57,6 +59,7 @@ public class GrenadeItem extends SimpleItem implements PolymerItem {
Text.translatable("gun.description.effect_radius", effectRadius),
Text.translatable("gun.description.particle_count", smokeCount)
)))
.registryKey(RegistryKey.of(RegistryKeys.ITEM, id(path)))
.maxDamage(explosionTarget + 1)
, id(path), Items.STICK
);
@@ -114,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) {

View File

@@ -10,6 +10,8 @@ import net.minecraft.item.*;
import net.minecraft.network.packet.s2c.play.PositionFlag;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
@@ -28,8 +30,8 @@ import systems.brn.plasticgun.lib.SimpleItem;
import java.util.ArrayList;
import java.util.List;
import static systems.brn.plasticgun.PlasticGun.bullets;
import static systems.brn.plasticgun.PlasticGun.itemBulletItemMap;
import static java.lang.Math.*;
import static systems.brn.plasticgun.PlasticGun.*;
import static systems.brn.plasticgun.lib.GunComponents.*;
import static systems.brn.plasticgun.lib.Util.*;
@@ -73,15 +75,25 @@ public class Gun extends SimpleItem implements PolymerItem {
Text.translatable("gun.description.explosion_power", explosionPowerGun),
Text.translatable("gun.description.repulsion_power", repulsionPowerGun)
)))
.registryKey(RegistryKey.of(RegistryKeys.ITEM, id(path)))
.maxDamage(clipSize + 1)
, id(path), Items.WOODEN_SWORD
);
this.verticalRecoilMin = verticalRecoilMin;
this.verticalRecoilMax = verticalRecoilMax;
this.verticalRecoilMin = verticalRecoilMin / 100f;
this.verticalRecoilMax = verticalRecoilMax / 100f;
this.velocityRecoilMin = velocityRecoilMin;
this.velocityRecoilMax = velocityRecoilMax;
this.horizontalRecoilMin = horizontalRecoilMin;
this.horizontalRecoilMax = horizontalRecoilMax;
this.horizontalRecoilMin = horizontalRecoilMin / 100f;
this.horizontalRecoilMax = horizontalRecoilMax / 100f;
if (verticalRecoilMin > verticalRecoilMax) {
logger.error("verticalRecoilMin > verticalRecoilMax for {}", path);
}
if (horizontalRecoilMin > horizontalRecoilMax) {
logger.error("horizontalRecoilMin > horizontalRecoilMax for {}", path);
}
if (velocityRecoilMin > velocityRecoilMax) {
logger.error("velocityRecoilMin > velocityRecoilMax for {}", path);
}
Registry.register(Registries.ITEM, id(path), this);
this.damage = damage;
this.reloadCount = reloadCount;
@@ -242,27 +254,30 @@ public class Gun extends SimpleItem implements PolymerItem {
stack.set(DataComponentTypes.LORE, newLore);
}
public void doRecoil(LivingEntity entity) {
if (entity.getEntityWorld() instanceof ServerWorld serverWorld) {
public int doRecoil(LivingEntity entity) {
if (entity.getWorld() instanceof ServerWorld serverWorld) {
Random rng = entity.getWorld().getRandom();
// Get the entity's current position and yaw
Vec3d pos = entity.getPos();
float yaw = entity.getYaw();
float newPitch = entity.getPitch();
Vec3d currentLook = entity.getRotationVector().multiply(-1);
newPitch -= verticalRecoilMin + rng.nextFloat() * (verticalRecoilMax - verticalRecoilMin);
yaw -= (float) (horizontalRecoilMin + rng.nextFloat() * (horizontalRecoilMax - horizontalRecoilMin));
entity.teleport(serverWorld, pos.x, pos.y, pos.z, PositionFlag.ROT, yaw, newPitch);
float yawChange = verticalRecoilMin + rng.nextFloat() * (verticalRecoilMax - verticalRecoilMin);
float pitchChange = (float) (horizontalRecoilMin + rng.nextFloat() * (horizontalRecoilMax - horizontalRecoilMin));
newPitch -= yawChange;
yaw -= pitchChange;
entity.teleport(serverWorld, pos.x, pos.y, pos.z, PositionFlag.ROT, yaw, newPitch, true);
double velocityRecoil = rng.nextDouble() * (velocityRecoilMax - velocityRecoilMin);
if (velocityRecoil > 0) {
entity.setVelocity(currentLook.multiply(velocityRecoil));
}
return (int) ((abs(yawChange) + abs(pitchChange) + abs(velocityRecoil) + max(abs(yawChange), max(abs(pitchChange), abs(velocityRecoil)))) / 4f) * 40;
}
return 0;
}
public void shoot(ServerWorld world, LivingEntity user, Hand hand) {
public int shoot(ServerWorld world, LivingEntity user, Hand hand) {
int stunLen = 0;
if (!world.isClient()) {
ItemStack stack = user.getStackInHand(hand);
int currentReload = stack.getOrDefault(GUN_LOADING_COMPONENT, 1);
@@ -280,7 +295,7 @@ public class Gun extends SimpleItem implements PolymerItem {
world.playSound(null, user.getX(), user.getY(), user.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE.value(), SoundCategory.PLAYERS, 0.1f, 1.2f);
chamber.decrement(1);
stack.set(GUN_COOLDOWN_COMPONENT, cooldownTarget);
doRecoil(user);
stunLen = doRecoil(user);
if (chamber.isEmpty()) {
stack.remove(GUN_AMMO_COMPONENT);
} else {
@@ -291,6 +306,7 @@ public class Gun extends SimpleItem implements PolymerItem {
}
updateDamage(stack);
}
return stunLen;
}
private @NotNull BulletEntity getBulletEntity(LivingEntity entity, Hand hand, BulletItem bullet, ItemStack chamber) {

View File

@@ -147,7 +147,7 @@ public class WeaponShootGoal<T extends HostileEntity & RangedAttackMob> 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,8 +156,8 @@ public class WeaponShootGoal<T extends HostileEntity & RangedAttackMob> 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) {
gun.shoot(serverWorld, this.actor, gunHand);
if (this.actor.getWorld() instanceof ServerWorld serverWorld) {
this.targetSeeingTicker -= gun.shoot(serverWorld, this.actor, gunHand);
}
}
}

View File

@@ -3,13 +3,15 @@ package systems.brn.plasticgun.lib;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import static systems.brn.plasticgun.lib.Util.id;
public class CraftingItem extends SimpleItem{
public CraftingItem(String name) {
super(new Settings(), id(name), Items.STICK);
super(new Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, id(name))), id(name), Items.STICK);
Registry.register(Registries.ITEM, id(name), this);
}
}

View File

@@ -15,14 +15,12 @@ import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import systems.brn.plasticgun.grenades.GrenadeEntity;
import systems.brn.plasticgun.grenades.GrenadeItem;
import systems.brn.plasticgun.packets.ModDetect;
import systems.brn.plasticgun.packets.Reload;
import systems.brn.plasticgun.packets.Shoot;
import java.util.function.Predicate;
@@ -30,18 +28,17 @@ import static systems.brn.plasticgun.PlasticGun.*;
import static systems.brn.plasticgun.lib.GunComponents.*;
public class EventHandler {
public static TypedActionResult<ItemStack> onItemUse(PlayerEntity playerEntity, World world, Hand hand) {
ItemStack stack = playerEntity.getStackInHand(hand);
public static ActionResult onItemUse(PlayerEntity playerEntity, World world, Hand hand) {
if (playerEntity instanceof ServerPlayerEntity serverPlayerEntity) {
if (!world.isClient && !clientsWithMod.contains(serverPlayerEntity)) {
if (!world.isClient) {
rightClickWithItem(serverPlayerEntity, hand);
}
}
return TypedActionResult.pass(stack);
return ActionResult.PASS;
}
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);
@@ -57,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)) {
@@ -71,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();
@@ -81,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);
@@ -98,25 +95,22 @@ 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);
}
}
}
}
public static void onServerWorldTick(ServerWorld world) {
// Iterate through all players to detect hand swings or item interactions
if (!world.isClient) {
for (ServerPlayerEntity player : world.getPlayers()) {
Hand hand = player.getActiveHand();
if (!clientsWithMod.contains(player)) {
if (player.handSwinging && player.handSwingTicks == -1) {
leftClickWithItem(player, hand);
}
}
tickItemUpdate(player);
}
mobTickUpdate(world);
@@ -161,16 +155,4 @@ public class EventHandler {
}
}
public static void onClientReload(Reload reload, ServerPlayNetworking.Context context) {
ServerPlayerEntity player = context.player();
Hand hand = player.getActiveHand();
rightClickWithItem(player, hand);
}
public static void onClientShoot(Shoot shoot, ServerPlayNetworking.Context context) {
ServerPlayerEntity player = context.player();
Hand hand = player.getActiveHand();
leftClickWithItem(player, hand);
}
}

View File

@@ -2,35 +2,29 @@ package systems.brn.plasticgun.lib;
import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.core.api.item.SimplePolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import eu.pb4.polymer.resourcepack.extras.api.ResourcePackExtras;
import net.minecraft.item.*;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import systems.brn.plasticgun.PlasticGun;
import xyz.nucleoid.packettweaker.PacketContext;
public abstract class SimpleItem extends SimplePolymerItem implements PolymerItem {
private final PolymerModelData polymerModel;
private final Identifier polymerModel;
protected final Identifier identifier;
public SimpleItem(Settings settings, Identifier identifier, Item replacement) {
super(settings, replacement);
this.identifier = identifier;
this.polymerModel = PolymerResourcePackUtils.requestModel(replacement, identifier.withPath("item/" + identifier.getPath()));
this.polymerModel = identifier;
}
@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
if(PlasticGun.clientsWithMod.contains(player)){
return this;
}
return this.polymerModel.item();
public Identifier getPolymerItemModel(ItemStack stack, PacketContext context) {
return this.polymerModel;
}
@Override
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.value();
public Item getPolymerItem(ItemStack itemStack, PacketContext player) {
return Items.STICK;
}
}

View File

@@ -1,36 +1,30 @@
package systems.brn.plasticgun.lib;
import dev.emi.trinkets.TrinketSlot;
import dev.emi.trinkets.api.*;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import net.minecraft.world.event.GameEvent;
import java.util.Map;
import java.util.Optional;
import static systems.brn.plasticgun.lib.Util.id;
public class TrinketPolymerItem extends SimpleItem implements Trinket {
public class TrinketPolymerItem extends SimpleItem {
public TrinketPolymerItem(Item.Settings settings, String name) {
super(settings, id(name), Items.STICK);
TrinketsApi.registerTrinket(this, this);
super(settings.equippable(EquipmentSlot.CHEST), id(name), Items.STICK);
}
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
public ActionResult use(World world, PlayerEntity user, Hand hand) {
ItemStack stack = user.getStackInHand(hand);
if (equipItem(user, stack)) {
return TypedActionResult.success(stack, world.isClient());
return ActionResult.SUCCESS;
}
return super.use(world, user, hand);
}
@@ -40,31 +34,8 @@ public class TrinketPolymerItem extends SimpleItem implements Trinket {
}
public static boolean equipItem(LivingEntity user, ItemStack stack) {
Optional<TrinketComponent> optional = TrinketsApi.getTrinketComponent(user);
if (optional.isPresent()) {
TrinketComponent comp = optional.get();
for (Map<String, TrinketInventory> group : comp.getInventory().values()) {
for (TrinketInventory inv : group.values()) {
for (int i = 0; i < inv.size(); i++) {
if (inv.getStack(i).isEmpty()) {
SlotReference ref = new SlotReference(inv, i);
if (TrinketSlot.canInsert(stack, ref, user)) {
ItemStack newStack = stack.copy();
inv.setStack(i, newStack);
Trinket trinket = TrinketsApi.getTrinket(stack.getItem());
RegistryEntry<SoundEvent> soundEvent = trinket.getEquipSound(stack, ref, user);
if (!stack.isEmpty() && soundEvent != null) {
user.emitGameEvent(GameEvent.EQUIP);
user.playSound(soundEvent.value(), 1.0F, 1.0F);
}
stack.setCount(0);
return true;
}
}
}
}
}
}
user.equipStack(EquipmentSlot.CHEST, stack);
user.playSound(SoundEvents.ITEM_ARMOR_EQUIP_CHAIN.value());
return false;
}
}

View File

@@ -1,14 +1,11 @@
package systems.brn.plasticgun.lib;
import dev.emi.trinkets.api.SlotReference;
import dev.emi.trinkets.api.TrinketComponent;
import dev.emi.trinkets.api.TrinketInventory;
import dev.emi.trinkets.api.TrinketsApi;
import eu.pb4.polymer.virtualentity.api.tracker.DisplayTrackedData;
import net.fabricmc.fabric.api.loot.v3.LootTableEvents;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.data.DataTracker;
import net.minecraft.entity.decoration.DisplayEntity;
@@ -17,13 +14,15 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.particle.BlockStateParticleEffect;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.RegistryKey;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;
import net.minecraft.util.Pair;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
@@ -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 {
@@ -136,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<DataTracker.SerializedEntry<?>> data, boolean initial, float scale, ItemStack itemStack) {
@@ -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()));
}
}
@@ -161,18 +159,12 @@ public class Util {
}
public static double getFinalDamage(LivingEntity livingEntity, WeaponDamageType damageType, double damage) {
Optional<TrinketComponent> trinketComponentTemp = TrinketsApi.getTrinketComponent(livingEntity);
if (trinketComponentTemp.isPresent()) {
TrinketComponent trinketComponent = trinketComponentTemp.get();
for (WeaponArmor weaponArmor : weaponArmors) {
if (weaponArmor.resistances.containsKey(damageType)) {
List<Pair<SlotReference, ItemStack>> vestsComponents = trinketComponent.getEquipped(weaponArmor);
if (!vestsComponents.isEmpty()) {
Pair<SlotReference, ItemStack> vestComponent = vestsComponents.getFirst();
TrinketInventory trinketInventory = vestComponent.getLeft().inventory();
int currentDamage = vestComponent.getRight().getDamage();
int maxDamage = vestComponent.getRight().getMaxDamage();
ItemStack chestStack = livingEntity.getEquippedStack(EquipmentSlot.CHEST);
int currentDamage = chestStack.getDamage();
int maxDamage = chestStack.getMaxDamage();
double reducedDamage = 0;
if (currentDamage < maxDamage) {
double coefficient = weaponArmor.resistances.get(damageType);
@@ -181,16 +173,12 @@ public class Util {
}
int nextDamage = currentDamage + (int) reducedDamage;
int inventoryIndex = vestComponent.getLeft().index();
ItemStack vestStack = trinketInventory.getStack(inventoryIndex);
if (nextDamage >= maxDamage) {
vestStack.setCount(0);
chestStack.setCount(0);
} else {
vestStack.setDamage(nextDamage);
}
trinketInventory.setStack(inventoryIndex, vestStack);
}
chestStack.setDamage(nextDamage);
}
livingEntity.equipStack(EquipmentSlot.CHEST, chestStack);
}
}
return damage;
@@ -273,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
@@ -300,4 +294,16 @@ public class Util {
}
}
}
public static void addItemToLootTable(RegistryKey<LootTable> tableId, Item item, Integer weight) {
LootTableEvents.MODIFY.register((key, tableBuilder, source, wrapperLookup) -> {
if (source.isBuiltin() && tableId.equals(key)) {
tableBuilder.modifyPools(poolBuilder -> poolBuilder.with(ItemEntry.builder(item).weight(weight)));
}
});
}
public static int getAfterWeight(float coeff, int weight) {
return (int) Math.ceil(coeff * weight);
}
}

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

@@ -1,19 +0,0 @@
package systems.brn.plasticgun.packets;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Uuids;
import java.util.UUID;
public record Reload(UUID slapped) implements CustomPayload {
public static final Id<Reload> PACKET_ID = new Id<>(CustomPayload.id("reload").id());
public static final PacketCodec<RegistryByteBuf, Reload> PACKET_CODEC = Uuids.PACKET_CODEC.xmap(Reload::new, Reload::slapped).cast();
@Override
public Id<? extends CustomPayload> getId() {
return PACKET_ID;
}
}

View File

@@ -1,19 +0,0 @@
package systems.brn.plasticgun.packets;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Uuids;
import java.util.UUID;
public record Shoot(UUID slapped) implements CustomPayload {
public static final Id<Shoot> PACKET_ID = new Id<>(CustomPayload.id("shoot").id());
public static final PacketCodec<RegistryByteBuf, Shoot> PACKET_CODEC = Uuids.PACKET_CODEC.xmap(Shoot::new, Shoot::slapped).cast();
@Override
public Id<? extends CustomPayload> getId() {
return PACKET_ID;
}
}

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

@@ -8,6 +8,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
@@ -35,6 +37,7 @@ public class ShurikenItem extends SimpleItem implements PolymerItem {
Text.translatable("gun.description.speed", speed),
Text.translatable("gun.description.damage_with_coefficient_max_speed", speed, speed * damage)
)))
.registryKey(RegistryKey.of(RegistryKeys.ITEM, id(path)))
, id(path), Items.WOODEN_PICKAXE
);
Registry.register(Registries.ITEM, id(path), this);

View File

@@ -10,11 +10,12 @@ import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
import net.minecraft.util.Arm;
import eu.pb4.polymer.core.api.entity.PolymerEntity;
import net.minecraft.world.World;
import xyz.nucleoid.packettweaker.PacketContext;
import java.util.Collections;
@@ -25,10 +26,10 @@ public class DamageTester extends LivingEntity implements PolymerEntity {
}
@Override
public boolean damage(DamageSource source, float amount) {
public boolean damage(ServerWorld world, DamageSource source, float amount) {
Entity attacker = source.getAttacker();
if (attacker instanceof PlayerEntity player) {
player.sendMessage(Text.literal("You damaged by " + amount));
player.sendMessage(Text.literal("You damaged by " + amount), false);
if (player.isSneaking()) {
this.remove(RemovalReason.KILLED);
}
@@ -39,18 +40,8 @@ public class DamageTester extends LivingEntity implements PolymerEntity {
public static DefaultAttributeContainer.Builder createDamageTesterAttributes() {
return LivingEntity.createLivingAttributes()
.add(EntityAttributes.GENERIC_MAX_HEALTH, 1.0)
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 0.0);
}
@Override
public EntityType<?> getPolymerEntityType(ServerPlayerEntity player) {
return EntityType.ZOMBIE;
}
@Override
public Iterable<ItemStack> getArmorItems() {
return Collections.emptyList();
.add(EntityAttributes.MAX_HEALTH, 1.0)
.add(EntityAttributes.ATTACK_DAMAGE, 0.0);
}
@Override
@@ -67,4 +58,9 @@ public class DamageTester extends LivingEntity implements PolymerEntity {
public Arm getMainArm() {
return Arm.RIGHT;
}
@Override
public EntityType<?> getPolymerEntityType(PacketContext context) {
return EntityType.ZOMBIE;
}
}

View File

@@ -9,6 +9,7 @@ import net.minecraft.item.Items;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import xyz.nucleoid.packettweaker.PacketContext;
import java.lang.reflect.Method;
import java.util.List;
@@ -20,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;
@@ -32,7 +37,7 @@ public class ThrowableProjectile extends PersistentProjectileEntity implements P
}
public ThrowableProjectile(EntityType<? extends PersistentProjectileEntity> 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;
@@ -45,6 +50,11 @@ public class ThrowableProjectile extends PersistentProjectileEntity implements P
}
@Override
public EntityType<?> getPolymerEntityType(PacketContext context) {
return EntityType.ITEM_DISPLAY;
}
@Override
public void modifyRawTrackedData(List<DataTracker.SerializedEntry<?>> data, ServerPlayerEntity player, boolean initial) {
setProjectileData(data, initial, scale, this.itemStack);
@@ -73,10 +83,5 @@ public class ThrowableProjectile extends PersistentProjectileEntity implements P
return this.itemStack();
}
@Override
public EntityType<?> getPolymerEntityType(ServerPlayerEntity player) {
return EntityType.ITEM_DISPLAY;
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/32_acp"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/32_acp_high_velocity"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/357_magnum"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/357_revolver"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/357_standard"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/38_special"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/38_special_p"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/45_acp"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/45_acp_hollow_point"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/762_tokarev"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/762_tokarev_ap"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/9mm_jhp"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/9mm_parabellum"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/advanced_circuit"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/ak_47"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/alloy_wheel"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/awp"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/ceramic_mixture"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/ceramic_plate"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/colt_1903"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/colt_45"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/colt_peacemaker"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/composite_frame"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/composite_resin"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/copper_wiring"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/diamond_shuriken"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/enhanced_gunpowder"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/explosive_powder"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/flak_vest"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/force_container"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/forcegun"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/golden_shuriken"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/graphene_sheet"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_an_m14"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_f1"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_k417"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_m18"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_m34"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_m67"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_m7a3"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_m84"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_mk3a2"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_no_69"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_rgd_5"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_rgo"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/grenade_thermite"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/hardened_steel"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/hyperalloy"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/iron_shuriken"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/kevlar_sheet"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/kevlar_vest"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/magnetic_coil"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/microchip"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/nano_tubes"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/netherite_shuriken"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/p2022"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/plasma_core"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/power_cell"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/precision_gear"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/reinforced_fiber"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/rpg9"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/rpg_shell"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/rpg_shell_incendiary"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/silicon_mixture"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/silicon_wafer"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/snub_nosed_revolver"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/stone_shuriken"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/titanium_alloy"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/tokarev_tt_33"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/trigger_mechanism"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "plasticgun:item/wooden_shuriken"
}
}

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",

Some files were not shown because too many files have changed in this diff Show More