ak
This commit is contained in:
@@ -6,7 +6,7 @@ minecraft_version=1.20.1
|
|||||||
yarn_mappings=1.20.1+build.10
|
yarn_mappings=1.20.1+build.10
|
||||||
loader_version=0.18.3
|
loader_version=0.18.3
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.0.12
|
mod_version=26.2.5
|
||||||
maven_group=dev.tggamesyt
|
maven_group=dev.tggamesyt
|
||||||
archives_base_name=szar
|
archives_base_name=szar
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|||||||
1
src/blockbench_models/PlaneEntity.bbmodel
Normal file
1
src/blockbench_models/PlaneEntity.bbmodel
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,39 @@
|
|||||||
|
package dev.tggamesyt.szar.client;
|
||||||
|
|
||||||
|
import dev.tggamesyt.szar.BulletEntity;
|
||||||
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
|
import net.minecraft.client.render.entity.EntityRenderer;
|
||||||
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
public class BulletRenderer extends EntityRenderer<BulletEntity> {
|
||||||
|
|
||||||
|
private static final Identifier TEXTURE =
|
||||||
|
new Identifier("szar", "textures/entity/bullet.png");
|
||||||
|
|
||||||
|
public BulletRenderer(EntityRendererFactory.Context ctx) {
|
||||||
|
super(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(
|
||||||
|
BulletEntity entity,
|
||||||
|
float yaw,
|
||||||
|
float tickDelta,
|
||||||
|
MatrixStack matrices,
|
||||||
|
VertexConsumerProvider vertices,
|
||||||
|
int light
|
||||||
|
) {
|
||||||
|
matrices.push();
|
||||||
|
matrices.scale(0.25F, 0.25F, 0.25F);
|
||||||
|
matrices.multiply(this.dispatcher.getRotation());
|
||||||
|
matrices.pop();
|
||||||
|
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier getTexture(BulletEntity entity) {
|
||||||
|
return TEXTURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package dev.tggamesyt.szar.client;
|
||||||
|
|
||||||
|
import dev.tggamesyt.szar.NaziEntity;
|
||||||
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
|
import net.minecraft.client.render.entity.MobEntityRenderer;
|
||||||
|
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||||
|
import net.minecraft.client.render.entity.model.EntityModelLayers;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
public class NaziEntityRenderer
|
||||||
|
extends MobEntityRenderer<NaziEntity, BipedEntityModel<NaziEntity>> {
|
||||||
|
|
||||||
|
public NaziEntityRenderer(EntityRendererFactory.Context context) {
|
||||||
|
super(
|
||||||
|
context,
|
||||||
|
new BipedEntityModel<>(context.getPart(EntityModelLayers.PLAYER)),
|
||||||
|
0.5F
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier getTexture(NaziEntity entity) {
|
||||||
|
return new Identifier("szar", "textures/entity/nazi.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -85,6 +85,15 @@ public class SzarClient implements ClientModInitializer {
|
|||||||
Szar.HitterEntityType,
|
Szar.HitterEntityType,
|
||||||
HitterEntityRenderer::new
|
HitterEntityRenderer::new
|
||||||
);
|
);
|
||||||
|
EntityRendererRegistry.register(
|
||||||
|
Szar.NaziEntityType,
|
||||||
|
NaziEntityRenderer::new
|
||||||
|
);
|
||||||
|
EntityRendererRegistry.register(
|
||||||
|
Szar.BULLET,
|
||||||
|
BulletRenderer::new
|
||||||
|
);
|
||||||
|
|
||||||
EntityRendererRegistry.register(
|
EntityRendererRegistry.register(
|
||||||
Szar.PoliceEntityType,
|
Szar.PoliceEntityType,
|
||||||
PoliceEntityRenderer::new
|
PoliceEntityRenderer::new
|
||||||
|
|||||||
69
src/main/java/dev/tggamesyt/szar/AK47Item.java
Normal file
69
src/main/java/dev/tggamesyt/szar/AK47Item.java
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
package dev.tggamesyt.szar;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.TypedActionResult;
|
||||||
|
import net.minecraft.util.UseAction;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class AK47Item extends Item {
|
||||||
|
|
||||||
|
public AK47Item(Settings settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
|
||||||
|
if (!(entity instanceof PlayerEntity player)) return;
|
||||||
|
if (!selected) return;
|
||||||
|
if (!player.isUsingItem()) return;
|
||||||
|
if (world.isClient) return;
|
||||||
|
|
||||||
|
if (!consumeAmmo(player)) return;
|
||||||
|
|
||||||
|
BulletEntity bullet = new BulletEntity(world, player);
|
||||||
|
bullet.setVelocity(
|
||||||
|
player,
|
||||||
|
player.getPitch(),
|
||||||
|
player.getYaw(),
|
||||||
|
0.0F,
|
||||||
|
4.5F, // speed
|
||||||
|
1.0F // spread
|
||||||
|
);
|
||||||
|
|
||||||
|
world.spawnEntity(bullet);
|
||||||
|
player.getItemCooldownManager().set(this, 2); // fire rate
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean consumeAmmo(PlayerEntity player) {
|
||||||
|
if (player.getAbilities().creativeMode) return true;
|
||||||
|
|
||||||
|
for (int i = 0; i < player.getInventory().size(); i++) {
|
||||||
|
ItemStack stack = player.getInventory().getStack(i);
|
||||||
|
if (stack.isOf(Szar.AK_AMMO)) {
|
||||||
|
stack.decrement(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UseAction getUseAction(ItemStack stack) {
|
||||||
|
return UseAction.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxUseTime(ItemStack stack) {
|
||||||
|
return 72000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||||
|
user.setCurrentHand(hand);
|
||||||
|
return TypedActionResult.consume(user.getStackInHand(hand));
|
||||||
|
}
|
||||||
|
}
|
||||||
65
src/main/java/dev/tggamesyt/szar/BulletEntity.java
Normal file
65
src/main/java/dev/tggamesyt/szar/BulletEntity.java
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package dev.tggamesyt.szar;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
|
import net.minecraft.entity.projectile.ProjectileUtil;
|
||||||
|
import net.minecraft.util.hit.EntityHitResult;
|
||||||
|
import net.minecraft.util.hit.HitResult;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class BulletEntity extends ProjectileEntity {
|
||||||
|
|
||||||
|
public BulletEntity(EntityType<? extends BulletEntity> type, World world) {
|
||||||
|
super(type, world);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BulletEntity(World world, LivingEntity owner) {
|
||||||
|
super(Szar.BULLET, world);
|
||||||
|
this.setOwner(owner);
|
||||||
|
this.setPosition(
|
||||||
|
owner.getX(),
|
||||||
|
owner.getEyeY() - 0.1,
|
||||||
|
owner.getZ()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initDataTracker() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
super.tick();
|
||||||
|
|
||||||
|
Vec3d velocity = this.getVelocity();
|
||||||
|
this.setVelocity(velocity.multiply(1.02)); // fast
|
||||||
|
|
||||||
|
HitResult hit = ProjectileUtil.getCollision(this, this::canHit);
|
||||||
|
if (hit.getType() != HitResult.Type.MISS) {
|
||||||
|
onCollision(hit);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.age > 60) discard();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onEntityHit(EntityHitResult hit) {
|
||||||
|
Entity target = hit.getEntity();
|
||||||
|
Entity owner = getOwner();
|
||||||
|
|
||||||
|
target.damage(
|
||||||
|
getWorld().getDamageSources().playerAttack((PlayerEntity) owner),
|
||||||
|
6.0F
|
||||||
|
);
|
||||||
|
|
||||||
|
discard();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCollision(HitResult hit) {
|
||||||
|
if (!getWorld().isClient) discard();
|
||||||
|
}
|
||||||
|
}
|
||||||
43
src/main/java/dev/tggamesyt/szar/FollowLeaderWanderGoal.java
Normal file
43
src/main/java/dev/tggamesyt/szar/FollowLeaderWanderGoal.java
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package dev.tggamesyt.szar;
|
||||||
|
|
||||||
|
import net.minecraft.entity.ai.goal.Goal;
|
||||||
|
import net.minecraft.entity.mob.PathAwareEntity;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
|
public class FollowLeaderWanderGoal extends Goal {
|
||||||
|
private final PathAwareEntity mob;
|
||||||
|
private final double speed;
|
||||||
|
private final float radius;
|
||||||
|
|
||||||
|
public FollowLeaderWanderGoal(PathAwareEntity mob, double speed, float radius) {
|
||||||
|
this.mob = mob;
|
||||||
|
this.speed = speed;
|
||||||
|
this.radius = radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canStart() {
|
||||||
|
if (!(mob instanceof NaziEntity nazi)) return false;
|
||||||
|
HitterEntity leader = nazi.getLeader();
|
||||||
|
return leader != null && leader.isAlive();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
NaziEntity nazi = (NaziEntity) mob;
|
||||||
|
HitterEntity leader = nazi.getLeader();
|
||||||
|
if (leader == null) return;
|
||||||
|
|
||||||
|
Random random = mob.getRandom();
|
||||||
|
|
||||||
|
double offsetX = (random.nextDouble() - 0.5) * radius * 2;
|
||||||
|
double offsetZ = (random.nextDouble() - 0.5) * radius * 2;
|
||||||
|
|
||||||
|
mob.getNavigation().startMovingTo(
|
||||||
|
leader.getX() + offsetX,
|
||||||
|
leader.getY(),
|
||||||
|
leader.getZ() + offsetZ,
|
||||||
|
speed
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
package dev.tggamesyt.szar;
|
package dev.tggamesyt.szar;
|
||||||
|
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.*;
|
||||||
import net.minecraft.entity.ai.goal.LookAroundGoal;
|
import net.minecraft.entity.ai.goal.LookAroundGoal;
|
||||||
import net.minecraft.entity.ai.goal.MeleeAttackGoal;
|
import net.minecraft.entity.ai.goal.MeleeAttackGoal;
|
||||||
import net.minecraft.entity.ai.goal.WanderAroundFarGoal;
|
import net.minecraft.entity.ai.goal.WanderAroundFarGoal;
|
||||||
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
||||||
|
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||||
import net.minecraft.entity.attribute.EntityAttributes;
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.entity.mob.MobEntity;
|
import net.minecraft.entity.mob.MobEntity;
|
||||||
@@ -12,11 +13,18 @@ import net.minecraft.entity.mob.PathAwareEntity;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.nbt.*;
|
import net.minecraft.nbt.*;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
import net.minecraft.world.LocalDifficulty;
|
||||||
|
import net.minecraft.world.ServerWorldAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static dev.tggamesyt.szar.Szar.NaziEntityType;
|
||||||
|
|
||||||
public class HitterEntity extends PathAwareEntity implements Arrestable{
|
public class HitterEntity extends PathAwareEntity implements Arrestable{
|
||||||
|
|
||||||
public static boolean arrestable = true;
|
public static boolean arrestable = true;
|
||||||
@@ -66,4 +74,77 @@ public class HitterEntity extends PathAwareEntity implements Arrestable{
|
|||||||
public boolean isArrestable() {
|
public boolean isArrestable() {
|
||||||
return arrestable;
|
return arrestable;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public EntityData initialize(
|
||||||
|
ServerWorldAccess world,
|
||||||
|
LocalDifficulty difficulty,
|
||||||
|
SpawnReason spawnReason,
|
||||||
|
@Nullable EntityData entityData,
|
||||||
|
@Nullable NbtCompound entityNbt
|
||||||
|
) {
|
||||||
|
// Always call super
|
||||||
|
EntityData data = super.initialize(world, difficulty, spawnReason, entityData, entityNbt);
|
||||||
|
|
||||||
|
Random random = world.getRandom();
|
||||||
|
|
||||||
|
this.getAttributeInstance(EntityAttributes.GENERIC_FOLLOW_RANGE)
|
||||||
|
.addPersistentModifier(
|
||||||
|
new EntityAttributeModifier(
|
||||||
|
"Random spawn bonus",
|
||||||
|
random.nextTriangular(0.0D, 0.11485D),
|
||||||
|
EntityAttributeModifier.Operation.MULTIPLY_BASE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.setLeftHanded(random.nextFloat() < 0.05F);
|
||||||
|
|
||||||
|
// 🔥 SPAWN GROUP HERE
|
||||||
|
if (spawnReason == SpawnReason.NATURAL && world instanceof ServerWorld serverWorld) {
|
||||||
|
|
||||||
|
int groupSize = 4 + serverWorld.random.nextInt(7); // 4–10 Bs
|
||||||
|
|
||||||
|
for (int i = 0; i < groupSize; i++) {
|
||||||
|
Entity entityB = NaziEntityType.create(serverWorld);
|
||||||
|
if (entityB != null) {
|
||||||
|
double offsetX = (serverWorld.random.nextDouble() - 0.5) * 6;
|
||||||
|
double offsetZ = (serverWorld.random.nextDouble() - 0.5) * 6;
|
||||||
|
|
||||||
|
entityB.refreshPositionAndAngles(
|
||||||
|
this.getX() + offsetX,
|
||||||
|
this.getY(),
|
||||||
|
this.getZ() + offsetZ,
|
||||||
|
serverWorld.random.nextFloat() * 360F,
|
||||||
|
0F
|
||||||
|
);
|
||||||
|
|
||||||
|
serverWorld.spawnEntity(entityB);
|
||||||
|
if (entityB instanceof NaziEntity nazi) {
|
||||||
|
nazi.setLeader(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAttacker(@Nullable LivingEntity attacker) {
|
||||||
|
super.setAttacker(attacker);
|
||||||
|
|
||||||
|
if (attacker == null || this.getWorld().isClient) return;
|
||||||
|
|
||||||
|
List<NaziEntity> allies = this.getWorld().getEntitiesByClass(
|
||||||
|
NaziEntity.class,
|
||||||
|
this.getBoundingBox().expand(16),
|
||||||
|
nazi -> nazi.getLeader() == this && nazi.isAlive()
|
||||||
|
);
|
||||||
|
|
||||||
|
for (NaziEntity nazi : allies) {
|
||||||
|
nazi.setTarget(attacker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,22 +15,22 @@ import net.minecraft.nbt.NbtCompound;
|
|||||||
import net.minecraft.nbt.NbtList;
|
import net.minecraft.nbt.NbtList;
|
||||||
import net.minecraft.nbt.NbtString;
|
import net.minecraft.nbt.NbtString;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class NaziEntity extends PathAwareEntity implements Arrestable{
|
public class NaziEntity extends PathAwareEntity implements Arrestable{
|
||||||
|
|
||||||
public static boolean arrestable = true;
|
public static boolean arrestable = false;
|
||||||
|
@Nullable
|
||||||
|
private HitterEntity leader;
|
||||||
public NaziEntity(EntityType<? extends PathAwareEntity> type, World world) {
|
public NaziEntity(EntityType<? extends PathAwareEntity> type, World world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initGoals() {
|
protected void initGoals() {
|
||||||
this.goalSelector.add(0, new MeleeAttackGoal(this, 1.2D, true));
|
this.goalSelector.add(2, new FollowLeaderWanderGoal(this, 1.0D, 6.0F));
|
||||||
this.goalSelector.add(2, new WanderAroundFarGoal(this, 1.0D));
|
this.goalSelector.add(3, new WanderAroundFarGoal(this, 0.8D));
|
||||||
this.goalSelector.add(3, new LookAroundGoal(this));
|
this.goalSelector.add(1, new MeleeAttackGoal(this, 1.2D, true));
|
||||||
|
|
||||||
this.targetSelector.add(1, new AggroOnHitRevengeGoal(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -62,4 +62,14 @@ public class NaziEntity extends PathAwareEntity implements Arrestable{
|
|||||||
public boolean isArrestable() {
|
public boolean isArrestable() {
|
||||||
return arrestable;
|
return arrestable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLeader(HitterEntity leader) {
|
||||||
|
this.leader = leader;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public HitterEntity getLeader() {
|
||||||
|
return this.leader;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import net.minecraft.util.ActionResult;
|
|||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.collection.DataPool;
|
import net.minecraft.util.collection.DataPool;
|
||||||
|
import net.minecraft.util.math.Box;
|
||||||
import net.minecraft.village.TradeOffer;
|
import net.minecraft.village.TradeOffer;
|
||||||
import net.minecraft.village.VillagerProfession;
|
import net.minecraft.village.VillagerProfession;
|
||||||
import net.minecraft.world.Heightmap;
|
import net.minecraft.world.Heightmap;
|
||||||
@@ -175,6 +176,8 @@ public class Szar implements ModInitializer {
|
|||||||
entries.add(Szar.CIGANYBLOCK);
|
entries.add(Szar.CIGANYBLOCK);
|
||||||
entries.add(Szar.FASZITEM);
|
entries.add(Szar.FASZITEM);
|
||||||
entries.add(Szar.NWORD_PASS);
|
entries.add(Szar.NWORD_PASS);
|
||||||
|
entries.add(Szar.HITTER_SPAWNEGG);
|
||||||
|
entries.add(Szar.NAZI_SPAWNEGG);
|
||||||
entries.add(Szar.NIGGER_SPAWNEGG);
|
entries.add(Szar.NIGGER_SPAWNEGG);
|
||||||
entries.add(Szar.GYPSY_SPAWNEGG);
|
entries.add(Szar.GYPSY_SPAWNEGG);
|
||||||
entries.add(Szar.TERRORIST_SPAWNEGG);
|
entries.add(Szar.TERRORIST_SPAWNEGG);
|
||||||
@@ -196,6 +199,8 @@ public class Szar implements ModInitializer {
|
|||||||
entries.add(Szar.NIGGERITE_BOOTS);
|
entries.add(Szar.NIGGERITE_BOOTS);
|
||||||
entries.add(Szar.NIGGERITE_BLOCK);
|
entries.add(Szar.NIGGERITE_BLOCK);
|
||||||
entries.add(Szar.CHEMICAL_WORKBENCH_ITEM);
|
entries.add(Szar.CHEMICAL_WORKBENCH_ITEM);
|
||||||
|
entries.add(Szar.AK_AMMO);
|
||||||
|
entries.add(Szar.AK47);
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
@@ -346,6 +351,10 @@ public class Szar implements ModInitializer {
|
|||||||
NiggerEntityType,
|
NiggerEntityType,
|
||||||
NiggerEntity.createAttributes()
|
NiggerEntity.createAttributes()
|
||||||
);
|
);
|
||||||
|
FabricDefaultAttributeRegistry.register(
|
||||||
|
NaziEntityType,
|
||||||
|
NaziEntity.createAttributes()
|
||||||
|
);
|
||||||
FabricDefaultAttributeRegistry.register(
|
FabricDefaultAttributeRegistry.register(
|
||||||
HitterEntityType,
|
HitterEntityType,
|
||||||
HitterEntity.createAttributes()
|
HitterEntity.createAttributes()
|
||||||
@@ -402,37 +411,6 @@ public class Szar implements ModInitializer {
|
|||||||
5, 1, 1
|
5, 1, 1
|
||||||
);
|
);
|
||||||
|
|
||||||
ServerTickEvents.END_WORLD_TICK.register(world -> {
|
|
||||||
if (world.isClient) return;
|
|
||||||
|
|
||||||
if (world.random.nextInt(200) != 0) return;
|
|
||||||
|
|
||||||
world.getEntitiesByClass(
|
|
||||||
HitterEntity.class, // <-- your A entity class
|
|
||||||
entityA -> entityA.isAlive() && !entityA.hasTag("b_group_spawned")
|
|
||||||
).forEach(entityA -> {
|
|
||||||
if (entityA.isAlive() && !entityA.getCommandTags().contains("b_group_spawned")) return;
|
|
||||||
entityA.addCommandTag("b_group_spawned");
|
|
||||||
|
|
||||||
int groupSize = 2 + world.random.nextInt(9); // 2–10 Bs
|
|
||||||
for (int i = 0; i < groupSize; i++) {
|
|
||||||
Entity entityB = NaziEntityType.create(world);
|
|
||||||
if (entityB != null) {
|
|
||||||
double offsetX = (world.random.nextDouble() - 0.5) * 4;
|
|
||||||
double offsetZ = (world.random.nextDouble() - 0.5) * 4;
|
|
||||||
entityB.refreshPositionAndAngles(
|
|
||||||
entityA.getX() + offsetX,
|
|
||||||
entityA.getY(),
|
|
||||||
entityA.getZ() + offsetZ,
|
|
||||||
world.random.nextFloat() * 360,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
world.spawnEntity(entityB);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
BiomeModifications.addSpawn(
|
BiomeModifications.addSpawn(
|
||||||
BiomeSelectors.includeByKey(
|
BiomeSelectors.includeByKey(
|
||||||
@@ -509,6 +487,27 @@ public class Szar implements ModInitializer {
|
|||||||
new DrogEffect()
|
new DrogEffect()
|
||||||
);
|
);
|
||||||
public static final StatusEffect ARRESTED = Registry.register(Registries.STATUS_EFFECT, new Identifier("szar", "arrested"), new ArrestedEffect());
|
public static final StatusEffect ARRESTED = Registry.register(Registries.STATUS_EFFECT, new Identifier("szar", "arrested"), new ArrestedEffect());
|
||||||
|
public static final Item AK_AMMO = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
new Identifier("szar", "bullet"),
|
||||||
|
new Item(new Item.Settings())
|
||||||
|
);
|
||||||
|
public static final EntityType<BulletEntity> BULLET =
|
||||||
|
Registry.register(
|
||||||
|
Registries.ENTITY_TYPE,
|
||||||
|
new Identifier("szar", "bullet"),
|
||||||
|
FabricEntityTypeBuilder.<BulletEntity>create(SpawnGroup.MISC, BulletEntity::new)
|
||||||
|
.dimensions(EntityDimensions.fixed(0.25F, 0.25F))
|
||||||
|
.trackRangeBlocks(64)
|
||||||
|
.trackedUpdateRate(20)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
public static final Item AK47 = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
new Identifier("szar", "ak47"),
|
||||||
|
new AK47Item(new Item.Settings().maxCount(1))
|
||||||
|
);
|
||||||
|
|
||||||
public static final Item CHEMICAL_WORKBENCH_ITEM = Registry.register(
|
public static final Item CHEMICAL_WORKBENCH_ITEM = Registry.register(
|
||||||
Registries.ITEM,
|
Registries.ITEM,
|
||||||
new Identifier(MOD_ID, "chemical_workbench"),
|
new Identifier(MOD_ID, "chemical_workbench"),
|
||||||
@@ -683,17 +682,17 @@ public class Szar implements ModInitializer {
|
|||||||
new Identifier(MOD_ID, "hitler_spawn_egg"),
|
new Identifier(MOD_ID, "hitler_spawn_egg"),
|
||||||
new SpawnEggItem(
|
new SpawnEggItem(
|
||||||
HitterEntityType,
|
HitterEntityType,
|
||||||
0x000000,
|
0xC4A484,
|
||||||
0xFF0000,
|
0xFF0000,
|
||||||
new Item.Settings()
|
new Item.Settings()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
public static final Item NAZI_SPAWNEGG = Registry.register(
|
public static final Item NAZI_SPAWNEGG = Registry.register(
|
||||||
Registries.ITEM,
|
Registries.ITEM,
|
||||||
new Identifier(MOD_ID, "hitler_spawn_egg"),
|
new Identifier(MOD_ID, "nazi_spawn_egg"),
|
||||||
new SpawnEggItem(
|
new SpawnEggItem(
|
||||||
NaziEntityType,
|
NaziEntityType,
|
||||||
0x000000,
|
0x654321,
|
||||||
0xFF0000,
|
0xFF0000,
|
||||||
new Item.Settings()
|
new Item.Settings()
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -35,5 +35,10 @@
|
|||||||
"entity.szar.gypsy": "Cigány",
|
"entity.szar.gypsy": "Cigány",
|
||||||
"entity.szar.plane": "Plane",
|
"entity.szar.plane": "Plane",
|
||||||
"entity.szar.hitler": "Hitler",
|
"entity.szar.hitler": "Hitler",
|
||||||
"item.szar.hitler_spawn_egg":"Hitler Spawn Egg"
|
"item.szar.hitler_spawn_egg":"Hitler Spawn Egg",
|
||||||
|
"entity.szar.nazi": "Nazi",
|
||||||
|
"item.szar.nazi_spawn_egg":"Nazi Spawn Egg",
|
||||||
|
"item.szar.bullet": "Bullet",
|
||||||
|
"item.szar.ak47": "AK47",
|
||||||
|
"entity.szar.bullet": "Bullet"
|
||||||
}
|
}
|
||||||
|
|||||||
89
src/main/resources/assets/szar/models/item/AK47.json
Normal file
89
src/main/resources/assets/szar/models/item/AK47.json
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
"format_version": "1.9.0",
|
||||||
|
"credit": "Made with Blockbench",
|
||||||
|
"textures": {
|
||||||
|
"0": "szar:item/ak47",
|
||||||
|
"particle": "szar:item/ak47"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"from": [7, 0, 7],
|
||||||
|
"to": [9, 7, 9],
|
||||||
|
"rotation": {"angle": 22.5, "axis": "x", "origin": [8, 0, 9]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [4, 4, 6, 11], "texture": "#0"},
|
||||||
|
"east": {"uv": [6, 4, 8, 11], "texture": "#0"},
|
||||||
|
"south": {"uv": [8, 4, 10, 11], "texture": "#0"},
|
||||||
|
"west": {"uv": [10, 0, 12, 7], "texture": "#0"},
|
||||||
|
"up": {"uv": [12, 15, 10, 13], "texture": "#0"},
|
||||||
|
"down": {"uv": [14, 13, 12, 15], "texture": "#0"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [7, 6, 3],
|
||||||
|
"to": [9, 8, 13],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 10]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [0, 14, 2, 16], "texture": "#0"},
|
||||||
|
"east": {"uv": [0, 0, 10, 2], "texture": "#0"},
|
||||||
|
"south": {"uv": [2, 14, 4, 16], "texture": "#0"},
|
||||||
|
"west": {"uv": [0, 2, 10, 4], "texture": "#0"},
|
||||||
|
"up": {"uv": [2, 14, 0, 4], "texture": "#0"},
|
||||||
|
"down": {"uv": [4, 4, 2, 14], "texture": "#0"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [7, 4, 13],
|
||||||
|
"to": [9, 8, 15],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 10]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [10, 7, 12, 11], "texture": "#0"},
|
||||||
|
"east": {"uv": [4, 11, 6, 15], "texture": "#0"},
|
||||||
|
"south": {"uv": [6, 11, 8, 15], "texture": "#0"},
|
||||||
|
"west": {"uv": [8, 11, 10, 15], "texture": "#0"},
|
||||||
|
"up": {"uv": [16, 4, 14, 2], "texture": "#0"},
|
||||||
|
"down": {"uv": [16, 4, 14, 6], "texture": "#0"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [7, 5, 15],
|
||||||
|
"to": [9, 7, 19],
|
||||||
|
"rotation": {"angle": 22.5, "axis": "x", "origin": [8, 7, 15]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [14, 6, 16, 8], "texture": "#0"},
|
||||||
|
"east": {"uv": [10, 11, 14, 13], "texture": "#0"},
|
||||||
|
"south": {"uv": [14, 8, 16, 10], "texture": "#0"},
|
||||||
|
"west": {"uv": [12, 0, 16, 2], "texture": "#0"},
|
||||||
|
"up": {"uv": [14, 6, 12, 2], "texture": "#0"},
|
||||||
|
"down": {"uv": [14, 6, 12, 10], "texture": "#0"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"display": {
|
||||||
|
"thirdperson_righthand": {
|
||||||
|
"translation": [0, 4, -2.5]
|
||||||
|
},
|
||||||
|
"firstperson_righthand": {
|
||||||
|
"translation": [0, 5.5, -1.75]
|
||||||
|
},
|
||||||
|
"firstperson_lefthand": {
|
||||||
|
"translation": [0, 5.5, -1.75]
|
||||||
|
},
|
||||||
|
"ground": {
|
||||||
|
"rotation": [66, 180, 0],
|
||||||
|
"translation": [0, -4, 4],
|
||||||
|
"scale": [0.67, 0.67, 0.67]
|
||||||
|
},
|
||||||
|
"gui": {
|
||||||
|
"rotation": [0, 90, 0],
|
||||||
|
"translation": [-2.5, 3, 0]
|
||||||
|
},
|
||||||
|
"head": {
|
||||||
|
"translation": [0, 9.75, -9.25]
|
||||||
|
},
|
||||||
|
"fixed": {
|
||||||
|
"rotation": [0, -90, 0],
|
||||||
|
"translation": [2.25, 2.75, -0.25]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/main/resources/assets/szar/models/item/bullet.json
Normal file
6
src/main/resources/assets/szar/models/item/bullet.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "szar:entity/bullet"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/template_spawn_egg"
|
||||||
|
}
|
||||||
BIN
src/main/resources/assets/szar/textures/entity/bullet.png
Normal file
BIN
src/main/resources/assets/szar/textures/entity/bullet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 202 B |
BIN
src/main/resources/assets/szar/textures/entity/nazi.png
Normal file
BIN
src/main/resources/assets/szar/textures/entity/nazi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 793 B |
BIN
src/main/resources/assets/szar/textures/item/ak47.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/ak47.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 214 B |
Reference in New Issue
Block a user