epstein added and nyan cat updated
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=26.2.7
|
mod_version=26.2.8
|
||||||
maven_group=dev.tggamesyt
|
maven_group=dev.tggamesyt
|
||||||
archives_base_name=szar
|
archives_base_name=szar
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package dev.tggamesyt.szar.client;
|
||||||
|
|
||||||
|
import dev.tggamesyt.szar.EpsteinEntity;
|
||||||
|
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.feature.HeldItemFeatureRenderer;
|
||||||
|
import net.minecraft.client.render.entity.model.EntityModelLayers;
|
||||||
|
import net.minecraft.client.render.entity.model.PlayerEntityModel;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
public class EpsteinEntityRenderer
|
||||||
|
extends MobEntityRenderer<EpsteinEntity, PlayerEntityModel<EpsteinEntity>> {
|
||||||
|
|
||||||
|
public EpsteinEntityRenderer(EntityRendererFactory.Context context) {
|
||||||
|
super(
|
||||||
|
context,
|
||||||
|
new PlayerEntityModel<>(context.getPart(EntityModelLayers.PLAYER), false),
|
||||||
|
0.5F
|
||||||
|
);
|
||||||
|
|
||||||
|
this.addFeature(new HeldItemFeatureRenderer<>(
|
||||||
|
this,
|
||||||
|
context.getHeldItemRenderer()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier getTexture(EpsteinEntity entity) {
|
||||||
|
return new Identifier("szar", "textures/entity/epstein.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@ import net.minecraft.client.option.KeyBinding;
|
|||||||
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
|
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
|
||||||
import net.minecraft.client.render.entity.animation.Animation;
|
import net.minecraft.client.render.entity.animation.Animation;
|
||||||
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
||||||
|
import net.minecraft.client.sound.EntityTrackingSoundInstance;
|
||||||
import net.minecraft.client.sound.PositionedSoundInstance;
|
import net.minecraft.client.sound.PositionedSoundInstance;
|
||||||
import net.minecraft.client.sound.SoundInstance;
|
import net.minecraft.client.sound.SoundInstance;
|
||||||
import net.minecraft.client.sound.SoundManager;
|
import net.minecraft.client.sound.SoundManager;
|
||||||
@@ -31,6 +32,7 @@ import net.minecraft.sound.SoundEvent;
|
|||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.Box;
|
import net.minecraft.util.math.Box;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.util.math.random.Random;
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -52,69 +54,67 @@ public class SzarClient implements ClientModInitializer {
|
|||||||
"main"
|
"main"
|
||||||
);
|
);
|
||||||
// Outside of your tick handler
|
// Outside of your tick handler
|
||||||
private final Map<NyanEntity, PositionedSoundInstance> activeSounds = new HashMap<>();
|
private final Map<NyanEntity, EntityTrackingSoundInstance> activeSounds = new HashMap<>();
|
||||||
private static final SoundEvent NYAN_LOOP = SoundEvent.of(new Identifier("szar", "nyan_cat_loop"));
|
private static final SoundEvent NYAN_LOOP = SoundEvent.of(new Identifier("szar", "nyan_cat_loop"));
|
||||||
private static final SoundEvent NYAN_START = SoundEvent.of(new Identifier("szar", "nyan_cat_first_loop"));
|
private static final SoundEvent NYAN_START = SoundEvent.of(new Identifier("szar", "nyan_cat_first_loop"));
|
||||||
int startOffset = 10; // first tick when start sound plays
|
int startOffset = 10;
|
||||||
int startLength = 39; // length of one start sound
|
int startLength = 596;
|
||||||
int loopLength = 542; // ticks per loop
|
int loopLength = 541;
|
||||||
|
int loopStart = startOffset + startLength;
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
if (client.world == null) return;
|
if (client.world == null) return;
|
||||||
|
|
||||||
SoundManager soundManager = client.getSoundManager();
|
Box box = new Box(
|
||||||
Box box = new Box(client.player.getX()-128, client.player.getY()-128, client.player.getZ()-128,
|
client.player.getX() - 128, client.player.getY() - 128, client.player.getZ() - 128,
|
||||||
client.player.getX()+128, client.player.getY()+128, client.player.getZ()+128);
|
client.player.getX() + 128, client.player.getY() + 128, client.player.getZ() + 128
|
||||||
|
);
|
||||||
|
|
||||||
for (NyanEntity nyan : client.world.getEntitiesByClass(NyanEntity.class, box, e -> true)) {
|
for (NyanEntity nyan : client.world.getEntitiesByClass(NyanEntity.class, box, e -> true)) {
|
||||||
// Skip dead ones (just in case)
|
|
||||||
if (!nyan.isAlive()) continue;
|
if (!nyan.isAlive()) continue;
|
||||||
|
|
||||||
int age = nyan.age;
|
int age = nyan.age;
|
||||||
|
|
||||||
// Play first start
|
// ---- PLAY START ONCE ----
|
||||||
if (age == 10) {
|
if (age >= startOffset && !activeSounds.containsKey(nyan)) {
|
||||||
PositionedSoundInstance start1 = PositionedSoundInstance.ambient(
|
EntityTrackingSoundInstance startSound = new EntityTrackingSoundInstance(
|
||||||
NYAN_START, Random.create(),
|
NYAN_START,
|
||||||
nyan.getX(), nyan.getY(), nyan.getZ()
|
SoundCategory.NEUTRAL,
|
||||||
|
1.0f,
|
||||||
|
1.0f,
|
||||||
|
nyan,
|
||||||
|
nyan.getId() // seed can be entity ID for stable pitch
|
||||||
);
|
);
|
||||||
client.getSoundManager().play(start1);
|
client.getSoundManager().play(startSound);
|
||||||
activeSounds.put(nyan, start1);
|
activeSounds.put(nyan, startSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play second start
|
// ---- LOOP AFTER START FINISHES ----
|
||||||
if (age == 49) {
|
if (age >= loopStart && (age - loopStart) % loopLength == 0) {
|
||||||
PositionedSoundInstance start2 = PositionedSoundInstance.ambient(
|
EntityTrackingSoundInstance loopSound = new EntityTrackingSoundInstance(
|
||||||
NYAN_START, Random.create(),
|
NYAN_LOOP,
|
||||||
nyan.getX(), nyan.getY(), nyan.getZ()
|
SoundCategory.NEUTRAL,
|
||||||
|
1.0f,
|
||||||
|
1.0f,
|
||||||
|
nyan,
|
||||||
|
nyan.getId() // seed
|
||||||
);
|
);
|
||||||
client.getSoundManager().play(start2);
|
client.getSoundManager().play(loopSound);
|
||||||
activeSounds.put(nyan, start2);
|
activeSounds.put(nyan, loopSound);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play looping
|
// Stop sounds for dead entities
|
||||||
if (age >= 88 && (age - 88) % 542 == 0) {
|
Iterator<Map.Entry<NyanEntity, EntityTrackingSoundInstance>> it = activeSounds.entrySet().iterator();
|
||||||
PositionedSoundInstance loop = PositionedSoundInstance.ambient(
|
|
||||||
NYAN_LOOP, Random.create(),
|
|
||||||
nyan.getX(), nyan.getY(), nyan.getZ()
|
|
||||||
);
|
|
||||||
client.getSoundManager().play(loop);
|
|
||||||
activeSounds.put(nyan, loop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Iterator<Map.Entry<NyanEntity, PositionedSoundInstance>> it = activeSounds.entrySet().iterator();
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<NyanEntity, PositionedSoundInstance> entry = it.next();
|
Map.Entry<NyanEntity, EntityTrackingSoundInstance> entry = it.next();
|
||||||
NyanEntity nyan = entry.getKey();
|
if (!entry.getKey().isAlive()) {
|
||||||
if (!nyan.isAlive()) {
|
client.getSoundManager().stop(entry.getValue());
|
||||||
client.getSoundManager().stop(entry.getValue()); // stop the sound immediately
|
it.remove();
|
||||||
it.remove(); // remove from map
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ClientPlayNetworking.registerGlobalReceiver(
|
ClientPlayNetworking.registerGlobalReceiver(
|
||||||
PLANE_ANIM_PACKET,
|
PLANE_ANIM_PACKET,
|
||||||
(client, handler, buf, sender) -> {
|
(client, handler, buf, sender) -> {
|
||||||
@@ -166,7 +166,10 @@ public class SzarClient implements ClientModInitializer {
|
|||||||
Szar.BULLET,
|
Szar.BULLET,
|
||||||
ctx -> new FlyingItemEntityRenderer<>(ctx)
|
ctx -> new FlyingItemEntityRenderer<>(ctx)
|
||||||
);
|
);
|
||||||
|
EntityRendererRegistry.register(
|
||||||
|
Szar.EpsteinEntityType,
|
||||||
|
EpsteinEntityRenderer::new
|
||||||
|
);
|
||||||
|
|
||||||
EntityRendererRegistry.register(
|
EntityRendererRegistry.register(
|
||||||
Szar.PoliceEntityType,
|
Szar.PoliceEntityType,
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package dev.tggamesyt.szar.client;
|
package dev.tggamesyt.szar.client;
|
||||||
|
|
||||||
|
import dev.tggamesyt.szar.ModItemTagProvider;
|
||||||
import dev.tggamesyt.szar.ModPoiTagProvider;
|
import dev.tggamesyt.szar.ModPoiTagProvider;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
|
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
||||||
|
import net.minecraft.registry.RegistryWrapper;
|
||||||
|
|
||||||
public class SzarDataGenerator implements DataGeneratorEntrypoint {
|
public class SzarDataGenerator implements DataGeneratorEntrypoint {
|
||||||
|
|
||||||
@@ -11,5 +13,6 @@ public class SzarDataGenerator implements DataGeneratorEntrypoint {
|
|||||||
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
|
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
|
||||||
|
|
||||||
pack.addProvider(ModPoiTagProvider::new);
|
pack.addProvider(ModPoiTagProvider::new);
|
||||||
|
pack.addProvider(ModItemTagProvider::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// 1.20.1 2026-01-26T11:11:39.1328713 szar/Tags for minecraft:point_of_interest_type
|
// 1.20.1 2026-02-08T13:35:45.6214131 szar/Tags for minecraft:point_of_interest_type
|
||||||
eba137b51c50a7143a3668876f41adaa1447b1d1 data\minecraft\tags\point_of_interest_type\acquirable_job_site.json
|
eba137b51c50a7143a3668876f41adaa1447b1d1 data\minecraft\tags\point_of_interest_type\acquirable_job_site.json
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
// 1.20.1 2026-02-08T13:35:45.6204179 szar/Tags for minecraft:item
|
||||||
|
6995bcff12c66325bf8878f8f536d542b4b8776e data\minecraft\tags\items\music_discs.json
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"szar:pop_tart"
|
||||||
|
]
|
||||||
|
}
|
||||||
103
src/main/java/dev/tggamesyt/szar/EpsteinEntity.java
Normal file
103
src/main/java/dev/tggamesyt/szar/EpsteinEntity.java
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
package dev.tggamesyt.szar;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.ai.goal.Goal;
|
||||||
|
import net.minecraft.entity.ai.goal.LookAroundGoal;
|
||||||
|
import net.minecraft.entity.ai.goal.MeleeAttackGoal;
|
||||||
|
import net.minecraft.entity.ai.goal.WanderAroundFarGoal;
|
||||||
|
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
||||||
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
|
import net.minecraft.entity.mob.MobEntity;
|
||||||
|
import net.minecraft.entity.mob.PathAwareEntity;
|
||||||
|
import net.minecraft.entity.passive.VillagerEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class EpsteinEntity extends PathAwareEntity implements Arrestable {
|
||||||
|
|
||||||
|
public static boolean arrestable = true;
|
||||||
|
|
||||||
|
public EpsteinEntity(EntityType<? extends PathAwareEntity> type, World world) {
|
||||||
|
super(type, world);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initGoals() {
|
||||||
|
this.goalSelector.add(0, new MeleeAttackGoal(this, 1.2D, true));
|
||||||
|
this.goalSelector.add(2, new WanderAroundFarGoal(this, 1.0D));
|
||||||
|
this.goalSelector.add(3, new LookAroundGoal(this));
|
||||||
|
this.targetSelector.add(1, new AttackNearbyBabiesGoal(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DefaultAttributeContainer.Builder createAttributes() {
|
||||||
|
return MobEntity.createMobAttributes()
|
||||||
|
.add(EntityAttributes.GENERIC_MAX_HEALTH, 20.0)
|
||||||
|
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.25)
|
||||||
|
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 4.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dropLoot(DamageSource source, boolean causedByPlayer) {
|
||||||
|
this.dropItem(Szar.EPSTEIN_FILES);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isArrestable() {
|
||||||
|
return arrestable;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom goal class
|
||||||
|
static class AttackNearbyBabiesGoal extends Goal {
|
||||||
|
private final PathAwareEntity mob;
|
||||||
|
private LivingEntity target;
|
||||||
|
|
||||||
|
public AttackNearbyBabiesGoal(PathAwareEntity mob) {
|
||||||
|
this.mob = mob;
|
||||||
|
this.setControls(EnumSet.of(Control.TARGET));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canStart() {
|
||||||
|
List<LivingEntity> entities = mob.getWorld().getEntitiesByClass(
|
||||||
|
LivingEntity.class,
|
||||||
|
mob.getBoundingBox().expand(8.0D), // 8-block radius
|
||||||
|
e -> (e.isBaby()) && !e.isDead() && e.isAlive()
|
||||||
|
);
|
||||||
|
if (!entities.isEmpty()) {
|
||||||
|
target = entities.get(0); // pick the first one
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
if (target != null) {
|
||||||
|
mob.getNavigation().startMovingTo(target, 1.2D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
if (target != null && target.isAlive()) {
|
||||||
|
mob.getLookControl().lookAt(target);
|
||||||
|
mob.getNavigation().startMovingTo(target, 1.2D);
|
||||||
|
|
||||||
|
// Attack if in range
|
||||||
|
if (mob.squaredDistanceTo(target) <= 2.0D) {
|
||||||
|
mob.tryAttack(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldContinue() {
|
||||||
|
return target != null && target.isAlive();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
src/main/java/dev/tggamesyt/szar/ModItemTagProvider.java
Normal file
28
src/main/java/dev/tggamesyt/szar/ModItemTagProvider.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package dev.tggamesyt.szar;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
|
||||||
|
import net.minecraft.data.DataOutput;
|
||||||
|
import net.minecraft.data.server.tag.TagProvider;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.registry.RegistryKey;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.registry.RegistryWrapper;
|
||||||
|
import net.minecraft.registry.tag.ItemTags;
|
||||||
|
import net.minecraft.registry.tag.PointOfInterestTypeTags;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.world.poi.PointOfInterestType;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
public class ModItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
|
public ModItemTagProvider(FabricDataOutput output,
|
||||||
|
CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
|
||||||
|
super(output, completableFuture);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(RegistryWrapper.WrapperLookup lookup) {
|
||||||
|
getOrCreateTagBuilder(ItemTags.MUSIC_DISCS).add(Szar.POPTART);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import net.minecraft.registry.Registry;
|
|||||||
import net.minecraft.registry.RegistryKey;
|
import net.minecraft.registry.RegistryKey;
|
||||||
import net.minecraft.registry.RegistryKeys;
|
import net.minecraft.registry.RegistryKeys;
|
||||||
import net.minecraft.registry.RegistryWrapper;
|
import net.minecraft.registry.RegistryWrapper;
|
||||||
|
import net.minecraft.registry.tag.ItemTags;
|
||||||
import net.minecraft.registry.tag.PointOfInterestTypeTags;
|
import net.minecraft.registry.tag.PointOfInterestTypeTags;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.world.poi.PointOfInterestType;
|
import net.minecraft.world.poi.PointOfInterestType;
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ public class NaziEntity extends PathAwareEntity implements Arrestable{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dropLoot(DamageSource source, boolean causedByPlayer) {
|
protected void dropLoot(DamageSource source, boolean causedByPlayer) {
|
||||||
|
var rand = this.getRandom();
|
||||||
|
if (rand.nextFloat() < 0.01F) {
|
||||||
|
this.dropItem(Szar.AK47);
|
||||||
|
}
|
||||||
|
if (rand.nextFloat() < 0.01F) {
|
||||||
ItemStack book = new ItemStack(Items.WRITTEN_BOOK);
|
ItemStack book = new ItemStack(Items.WRITTEN_BOOK);
|
||||||
|
|
||||||
NbtCompound nbt = book.getOrCreateNbt();
|
NbtCompound nbt = book.getOrCreateNbt();
|
||||||
@@ -60,6 +65,12 @@ public class NaziEntity extends PathAwareEntity implements Arrestable{
|
|||||||
this.dropStack(book);
|
this.dropStack(book);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int count = rand.nextInt(17);
|
||||||
|
if (count > 0) {
|
||||||
|
this.dropStack(new ItemStack(Szar.AK_AMMO, count));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isArrestable() {
|
public boolean isArrestable() {
|
||||||
return arrestable;
|
return arrestable;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package dev.tggamesyt.szar;
|
package dev.tggamesyt.szar;
|
||||||
|
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.SpawnReason;
|
||||||
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;
|
||||||
@@ -13,6 +14,7 @@ import net.minecraft.sound.SoundCategory;
|
|||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
|
||||||
public class NyanEntity extends PathAwareEntity {
|
public class NyanEntity extends PathAwareEntity {
|
||||||
|
|
||||||
@@ -33,6 +35,49 @@ public class NyanEntity extends PathAwareEntity {
|
|||||||
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.25)
|
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.25)
|
||||||
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 2);
|
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 2);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public boolean canSpawn(WorldAccess world, SpawnReason spawnReason) {
|
||||||
|
// Only above ground
|
||||||
|
boolean aboveGround = this.getY() >= world.getBottomY() + 1 && this.getY() <= world.getTopY();
|
||||||
|
|
||||||
|
// Only allow 5% of spawn attempts to succeed
|
||||||
|
boolean rareChance = this.random.nextFloat() < 0.05f;
|
||||||
|
|
||||||
|
// Standard mob spawn rules + above ground + rare chance
|
||||||
|
return super.canSpawn(world, spawnReason) && aboveGround && rareChance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean damage(DamageSource source, float amount) {
|
||||||
|
boolean result = super.damage(source, amount);
|
||||||
|
if (result) {
|
||||||
|
// Trigger panic
|
||||||
|
this.setPanic(200); // panic for 100 ticks (5 seconds)
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int panicTicks = 0;
|
||||||
|
|
||||||
|
private void setPanic(int ticks) {
|
||||||
|
this.panicTicks = ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
super.tick();
|
||||||
|
|
||||||
|
if (panicTicks > 0) {
|
||||||
|
panicTicks--;
|
||||||
|
|
||||||
|
// Move in a random direction away from attacker
|
||||||
|
double speed = 1.5D;
|
||||||
|
double dx = (this.random.nextDouble() - 0.5) * 2;
|
||||||
|
double dz = (this.random.nextDouble() - 0.5) * 2;
|
||||||
|
|
||||||
|
this.getNavigation().startMovingTo(this.getX() + dx * 5, this.getY(), this.getZ() + dz * 5, speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -129,6 +129,15 @@ public class Szar implements ModInitializer {
|
|||||||
.dimensions(EntityDimensions.fixed(0.6F, 1.8F)) // player-sized
|
.dimensions(EntityDimensions.fixed(0.6F, 1.8F)) // player-sized
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
public static final EntityType<EpsteinEntity> EpsteinEntityType =
|
||||||
|
Registry.register(
|
||||||
|
Registries.ENTITY_TYPE,
|
||||||
|
new Identifier(MOD_ID, "epstein"),
|
||||||
|
FabricEntityTypeBuilder
|
||||||
|
.create(SpawnGroup.CREATURE, EpsteinEntity::new)
|
||||||
|
.dimensions(EntityDimensions.fixed(0.6F, 1.8F)) // player-sized
|
||||||
|
.build()
|
||||||
|
);
|
||||||
public static final EntityType<HitterEntity> HitterEntityType =
|
public static final EntityType<HitterEntity> HitterEntityType =
|
||||||
Registry.register(
|
Registry.register(
|
||||||
Registries.ENTITY_TYPE,
|
Registries.ENTITY_TYPE,
|
||||||
@@ -220,6 +229,8 @@ public class Szar implements ModInitializer {
|
|||||||
entries.add(Szar.AK47);
|
entries.add(Szar.AK47);
|
||||||
entries.add(Szar.POPTART);
|
entries.add(Szar.POPTART);
|
||||||
entries.add(Szar.NYAN_SPAWNEGG);
|
entries.add(Szar.NYAN_SPAWNEGG);
|
||||||
|
entries.add(Szar.EPSTEIN_FILES);
|
||||||
|
entries.add(Szar.EPSTEIN_SPAWNEGG);
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
@@ -370,6 +381,10 @@ public class Szar implements ModInitializer {
|
|||||||
NiggerEntityType,
|
NiggerEntityType,
|
||||||
NiggerEntity.createAttributes()
|
NiggerEntity.createAttributes()
|
||||||
);
|
);
|
||||||
|
FabricDefaultAttributeRegistry.register(
|
||||||
|
EpsteinEntityType,
|
||||||
|
NiggerEntity.createAttributes()
|
||||||
|
);
|
||||||
FabricDefaultAttributeRegistry.register(
|
FabricDefaultAttributeRegistry.register(
|
||||||
NyanEntityType,
|
NyanEntityType,
|
||||||
NyanEntity.createAttributes()
|
NyanEntity.createAttributes()
|
||||||
@@ -410,9 +425,9 @@ public class Szar implements ModInitializer {
|
|||||||
),
|
),
|
||||||
SpawnGroup.MONSTER,
|
SpawnGroup.MONSTER,
|
||||||
TERRORIST_ENTITY_TYPE,
|
TERRORIST_ENTITY_TYPE,
|
||||||
20, // weight (lower = rarer)
|
10, // weight (lower = rarer)
|
||||||
1, // min group size
|
1, // min group size
|
||||||
1 // max group size
|
2 // max group size
|
||||||
);
|
);
|
||||||
BiomeModifications.addSpawn(
|
BiomeModifications.addSpawn(
|
||||||
BiomeSelectors.includeByKey(
|
BiomeSelectors.includeByKey(
|
||||||
@@ -422,30 +437,37 @@ public class Szar implements ModInitializer {
|
|||||||
),
|
),
|
||||||
SpawnGroup.MONSTER,
|
SpawnGroup.MONSTER,
|
||||||
NiggerEntityType,
|
NiggerEntityType,
|
||||||
20, // weight (lower = rarer)
|
5, // weight (lower = rarer)
|
||||||
1, // min group size
|
1, // min group size
|
||||||
2 // max group size
|
2 // max group size
|
||||||
);
|
);
|
||||||
// 1. Allow entity A to spawn naturally in your biomes
|
|
||||||
BiomeModifications.addSpawn(
|
BiomeModifications.addSpawn(
|
||||||
BiomeSelectors.includeByKey(BiomeKeys.FOREST, BiomeKeys.FLOWER_FOREST),
|
BiomeSelectors.includeByKey(BiomeKeys.WINDSWEPT_HILLS, BiomeKeys.WINDSWEPT_GRAVELLY_HILLS, BiomeKeys.STONY_PEAKS),
|
||||||
SpawnGroup.MONSTER,
|
SpawnGroup.MONSTER,
|
||||||
HitterEntityType,
|
HitterEntityType,
|
||||||
5, 1, 1
|
1, 1, 1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
BiomeModifications.addSpawn(
|
BiomeModifications.addSpawn(
|
||||||
BiomeSelectors.includeByKey(
|
BiomeSelectors.includeByKey(BiomeKeys.JUNGLE, BiomeKeys.BAMBOO_JUNGLE, BiomeKeys.SPARSE_JUNGLE),
|
||||||
BiomeKeys.JUNGLE,
|
|
||||||
BiomeKeys.BAMBOO_JUNGLE,
|
|
||||||
BiomeKeys.SPARSE_JUNGLE
|
|
||||||
),
|
|
||||||
SpawnGroup.MONSTER,
|
SpawnGroup.MONSTER,
|
||||||
GYPSY_ENTITY_TYPE,
|
GYPSY_ENTITY_TYPE,
|
||||||
20, // weight (lower = rarer)
|
5, 1, 5
|
||||||
1, // min group size
|
);
|
||||||
5 // max group size
|
|
||||||
|
BiomeModifications.addSpawn(
|
||||||
|
BiomeSelectors.includeByKey(BiomeKeys.FOREST, BiomeKeys.FLOWER_FOREST),
|
||||||
|
SpawnGroup.AMBIENT,
|
||||||
|
NyanEntityType,
|
||||||
|
1, 1, 1
|
||||||
|
);
|
||||||
|
BiomeModifications.addSpawn(
|
||||||
|
BiomeSelectors.includeByKey(BiomeKeys.FOREST, BiomeKeys.FLOWER_FOREST),
|
||||||
|
SpawnGroup.MONSTER,
|
||||||
|
EpsteinEntityType,
|
||||||
|
1, 1, 1
|
||||||
);
|
);
|
||||||
BiomeModifications.addFeature(
|
BiomeModifications.addFeature(
|
||||||
BiomeSelectors.tag(BiomeTags.IS_JUNGLE),
|
BiomeSelectors.tag(BiomeTags.IS_JUNGLE),
|
||||||
@@ -563,6 +585,11 @@ public class Szar implements ModInitializer {
|
|||||||
new Identifier(MOD_ID, "police_key"),
|
new Identifier(MOD_ID, "police_key"),
|
||||||
new KeyItem(new Item.Settings())
|
new KeyItem(new Item.Settings())
|
||||||
);
|
);
|
||||||
|
public static final Item EPSTEIN_FILES = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
new Identifier(MOD_ID, "epstein_files"),
|
||||||
|
new Item(new Item.Settings())
|
||||||
|
);
|
||||||
public static final Item HANDCUFF_ITEM = Registry.register(
|
public static final Item HANDCUFF_ITEM = Registry.register(
|
||||||
Registries.ITEM,
|
Registries.ITEM,
|
||||||
new Identifier(MOD_ID, "police_handcuff"),
|
new Identifier(MOD_ID, "police_handcuff"),
|
||||||
@@ -684,14 +711,16 @@ public class Szar implements ModInitializer {
|
|||||||
new Identifier(MOD_ID, "fasz"),
|
new Identifier(MOD_ID, "fasz"),
|
||||||
new FaszItem(FASZ_BLOCK, new Item.Settings())
|
new FaszItem(FASZ_BLOCK, new Item.Settings())
|
||||||
);
|
);
|
||||||
|
public static final SoundEvent NYAN_MUSIC =
|
||||||
|
SoundEvent.of(new Identifier("szar", "nyan_music"));
|
||||||
public static final Item POPTART = Registry.register(
|
public static final Item POPTART = Registry.register(
|
||||||
Registries.ITEM,
|
Registries.ITEM,
|
||||||
new Identifier(MOD_ID, "pop_tart"),
|
new Identifier(MOD_ID, "pop_tart"),
|
||||||
new Item(new Item.Settings()
|
new MusicDiscItem(13, NYAN_MUSIC, new Item.Settings()
|
||||||
.food(new FoodComponent.Builder()
|
.food(new FoodComponent.Builder()
|
||||||
.saturationModifier(0.6f).
|
.saturationModifier(0.6f).
|
||||||
hunger((Math.random() < 0.5) ? 6 : 7) // SIX OR SEVEN
|
hunger((Math.random() < 0.5) ? 6 : 7) // SIX OR SEVEN
|
||||||
.build()))
|
.build()), 217)
|
||||||
);
|
);
|
||||||
public static final Item NWORD_PASS = Registry.register(
|
public static final Item NWORD_PASS = Registry.register(
|
||||||
Registries.ITEM,
|
Registries.ITEM,
|
||||||
@@ -748,6 +777,16 @@ public class Szar implements ModInitializer {
|
|||||||
new Item.Settings()
|
new Item.Settings()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
public static final Item EPSTEIN_SPAWNEGG = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
new Identifier(MOD_ID, "epstein_spawn_egg"),
|
||||||
|
new SpawnEggItem(
|
||||||
|
EpsteinEntityType,
|
||||||
|
0xB47459,
|
||||||
|
0x151D2D,
|
||||||
|
new Item.Settings()
|
||||||
|
)
|
||||||
|
);
|
||||||
public static final Item GYPSY_SPAWNEGG = Registry.register(
|
public static final Item GYPSY_SPAWNEGG = Registry.register(
|
||||||
Registries.ITEM,
|
Registries.ITEM,
|
||||||
new Identifier(MOD_ID, "gypsy_spawn_egg"),
|
new Identifier(MOD_ID, "gypsy_spawn_egg"),
|
||||||
|
|||||||
@@ -47,5 +47,11 @@
|
|||||||
|
|
||||||
"item.szar.pop_tart": "Pop Tart",
|
"item.szar.pop_tart": "Pop Tart",
|
||||||
"entity.szar.nyan_cat": "Nyan Cat",
|
"entity.szar.nyan_cat": "Nyan Cat",
|
||||||
"item.szar.nyan_cat_spawn_egg": "Nyan Cat Spawn Egg"
|
"item.szar.nyan_cat_spawn_egg": "Nyan Cat Spawn Egg",
|
||||||
|
"item.szar.pop_tart.desc": "daniwellP - Nyanyanyanyanyanyanya!",
|
||||||
|
"szar.nyan_cat_performs": "Nyan Cat Performs",
|
||||||
|
"szar.nyan_cat_start": "Nyan Cat Starts Performing",
|
||||||
|
"item.szar.epstein_files": "Epstein Files",
|
||||||
|
"entity.szar.epstein": "Epstein",
|
||||||
|
"item.szar.epstein_spawn_egg": "Epstein Spawn Egg"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "szar:item/epstein_files"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/template_spawn_egg"
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"nyan_cat_first_loop": {
|
"nyan_cat_first_loop_old": {
|
||||||
|
"subtitle": "szar.nyan_cat_start",
|
||||||
"sounds": [
|
"sounds": [
|
||||||
{
|
{
|
||||||
"name": "szar:nyan_cat_first_loop",
|
"name": "szar:nyan_cat_first_loop",
|
||||||
@@ -7,12 +8,39 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"nyan_cat_loop": {
|
"nyan_cat_loop_old": {
|
||||||
|
"subtitle": "szar.nyan_cat_performs",
|
||||||
"sounds": [
|
"sounds": [
|
||||||
{
|
{
|
||||||
"name": "szar:nyan_cat_loop",
|
"name": "szar:nyan_cat_loop",
|
||||||
"stream": true
|
"stream": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"nyan_cat_first_loop": {
|
||||||
|
"subtitle": "szar.nyan_cat_start",
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "szar:nyan_cat_start",
|
||||||
|
"stream": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nyan_cat_loop": {
|
||||||
|
"subtitle": "szar.nyan_cat_performs",
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "szar:nyan_cat",
|
||||||
|
"stream": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nyan_music": {
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "szar:nyan_music",
|
||||||
|
"stream": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
src/main/resources/assets/szar/sounds/nyan_cat.ogg
Normal file
BIN
src/main/resources/assets/szar/sounds/nyan_cat.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/szar/sounds/nyan_cat_start.ogg
Normal file
BIN
src/main/resources/assets/szar/sounds/nyan_cat_start.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/szar/sounds/nyan_music.ogg
Normal file
BIN
src/main/resources/assets/szar/sounds/nyan_music.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/szar/textures/entity/epstein.png
Normal file
BIN
src/main/resources/assets/szar/textures/entity/epstein.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src/main/resources/assets/szar/textures/item/epstein_files.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/epstein_files.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
33
src/main/resources/data/szar/recipes/ak47.json
Normal file
33
src/main/resources/data/szar/recipes/ak47.json
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"ingredients": [
|
||||||
|
{
|
||||||
|
"item": "minecraft:gunpowder"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"item": "minecraft:iron_nugget"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pattern": [
|
||||||
|
"PPP",
|
||||||
|
"BBB",
|
||||||
|
"LRB"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"P": {
|
||||||
|
"tag": "minecraft:planks"
|
||||||
|
},
|
||||||
|
"B": {
|
||||||
|
"item": "minecraft:iron_block"
|
||||||
|
},
|
||||||
|
"L": {
|
||||||
|
"item": "minecraft:leather"
|
||||||
|
},
|
||||||
|
"R": {
|
||||||
|
"item": "minecraft:redstone"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"item": "szar:ak47"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +1,14 @@
|
|||||||
{
|
{
|
||||||
"type": "minecraft:crafting_shaped",
|
"type": "minecraft:crafting_shapeless",
|
||||||
"pattern": [
|
"ingredients": [
|
||||||
" M ",
|
{
|
||||||
" B ",
|
"item": "minecraft:gunpowder"
|
||||||
"B B"
|
},
|
||||||
|
{
|
||||||
|
"item": "minecraft:iron_nugget"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"key": {
|
|
||||||
"M": {
|
|
||||||
"item": "minecraft:milk_bucket"
|
|
||||||
},
|
|
||||||
"B": {
|
|
||||||
"item": "minecraft:beef"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"result": {
|
"result": {
|
||||||
"item": "szar:bullet",
|
"item": "szar:bullet"
|
||||||
"count": 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user