This commit is contained in:
2026-02-09 11:29:40 +01:00
parent 97278ed841
commit 05f4c936e0
12 changed files with 311 additions and 13 deletions

View File

@@ -6,7 +6,7 @@ minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.18.3
# Mod Properties
mod_version=26.2.8.1
mod_version=26.2.9
maven_group=dev.tggamesyt
archives_base_name=szar
# Dependencies

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,52 @@
package dev.tggamesyt.szar.client;
import dev.tggamesyt.szar.AtomEntity;
import net.minecraft.client.model.*;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.util.math.MatrixStack;
// Made with Blockbench 5.0.7
// Exported for Minecraft version 1.17+ for Yarn
// Paste this class into your mod and generate all required imports
public class Atom extends EntityModel<AtomEntity> {
private final ModelPart bb_main;
public Atom(ModelPart root) {
this.bb_main = root.getChild("bb_main");
}
public static TexturedModelData getTexturedModelData() {
ModelData modelData = new ModelData();
ModelPartData modelPartData = modelData.getRoot();
ModelPartData bb_main = modelPartData.addChild("bb_main", ModelPartBuilder.create().uv(32, 15).cuboid(-2.0F, -4.0F, -2.0F, 4.0F, 2.0F, 4.0F, new Dilation(0.0F))
.uv(0, 30).cuboid(-3.0F, -6.0F, -3.0F, 6.0F, 2.0F, 6.0F, new Dilation(0.0F))
.uv(0, 15).cuboid(-4.0F, -13.0F, -4.0F, 8.0F, 7.0F, 8.0F, new Dilation(0.0F))
.uv(36, 41).cuboid(-1.0F, -2.0F, -1.0F, 2.0F, 1.0F, 2.0F, new Dilation(0.0F))
.uv(24, 30).cuboid(-3.0F, -15.0F, -3.0F, 6.0F, 2.0F, 6.0F, new Dilation(0.0F))
.uv(32, 21).cuboid(-2.0F, -17.0F, -2.0F, 4.0F, 2.0F, 4.0F, new Dilation(0.0F))
.uv(42, 27).cuboid(-1.0F, -18.0F, -1.0F, 2.0F, 1.0F, 2.0F, new Dilation(0.0F))
.uv(0, 43).cuboid(2.0F, -19.0F, -3.0F, 1.0F, 4.0F, 1.0F, new Dilation(0.0F))
.uv(4, 43).cuboid(-3.0F, -19.0F, -3.0F, 1.0F, 4.0F, 1.0F, new Dilation(0.0F))
.uv(8, 43).cuboid(-3.0F, -19.0F, 2.0F, 1.0F, 4.0F, 1.0F, new Dilation(0.0F))
.uv(12, 43).cuboid(2.0F, -19.0F, 2.0F, 1.0F, 4.0F, 1.0F, new Dilation(0.0F))
.uv(0, 0).cuboid(-6.0F, -22.0F, -6.0F, 12.0F, 3.0F, 12.0F, new Dilation(0.0F))
.uv(0, 38).cuboid(-2.0F, -19.0F, -2.0F, 4.0F, 1.0F, 4.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 24.0F, 0.0F));
ModelPartData cube_r1 = bb_main.addChild("cube_r1", ModelPartBuilder.create().uv(26, 38).cuboid(-1.0F, -2.0F, -2.0F, 1.0F, 2.0F, 4.0F, new Dilation(0.0F)), ModelTransform.of(3.0F, -15.0F, 0.0F, 0.0F, 0.0F, -0.3927F));
ModelPartData cube_r2 = bb_main.addChild("cube_r2", ModelPartBuilder.create().uv(36, 38).cuboid(-2.0F, -2.0F, 0.0F, 4.0F, 2.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -15.0F, -3.0F, -0.3927F, 0.0F, 0.0F));
ModelPartData cube_r3 = bb_main.addChild("cube_r3", ModelPartBuilder.create().uv(16, 38).cuboid(0.0F, -2.0F, -2.0F, 1.0F, 2.0F, 4.0F, new Dilation(0.0F)), ModelTransform.of(-3.0F, -15.0F, 0.0F, 0.0F, 0.0F, 0.3927F));
ModelPartData cube_r4 = bb_main.addChild("cube_r4", ModelPartBuilder.create().uv(32, 27).cuboid(-2.0F, -2.0F, -1.0F, 4.0F, 2.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -15.0F, 3.0F, 0.3927F, 0.0F, 0.0F));
return TexturedModelData.of(modelData, 64, 64);
}
@Override
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
bb_main.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
}
@Override
public void setAngles(AtomEntity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {
}
}

View File

@@ -0,0 +1,57 @@
package dev.tggamesyt.szar.client;
import dev.tggamesyt.szar.AtomEntity;
import dev.tggamesyt.szar.Szar;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.RotationAxis;
public class AtomEntityRenderer extends EntityRenderer<AtomEntity> {
public static final EntityModelLayer ATOM_LAYER =
new EntityModelLayer(new Identifier(Szar.MOD_ID, "atom"), "main");
private static final Identifier TEXTURE =
new Identifier(Szar.MOD_ID, "textures/entity/nuke.png");
private final Atom model;
public AtomEntityRenderer(EntityRendererFactory.Context context) {
super(context);
this.model = new Atom(context.getPart(ATOM_LAYER));
this.shadowRadius = 1.5F;
}
@Override
public void render(
AtomEntity entity,
float yaw,
float tickDelta,
MatrixStack matrices,
VertexConsumerProvider vertexConsumers,
int light
) {
matrices.push();
model.render(
matrices,
vertexConsumers.getBuffer(model.getLayer(TEXTURE)),
light,
OverlayTexture.DEFAULT_UV,
1.0F, 1.0F, 1.0F, 1.0F
);
matrices.pop();
super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light);
}
@Override
public Identifier getTexture(AtomEntity entity) {
return TEXTURE;
}
}

View File

@@ -38,8 +38,7 @@ import net.minecraft.util.math.random.Random;
import java.util.*;
import static dev.tggamesyt.szar.Szar.HitterEntityType;
import static dev.tggamesyt.szar.Szar.PLANE_ANIM_PACKET;
import static dev.tggamesyt.szar.Szar.*;
import static javax.swing.text.html.HTML.Attribute.ID;
public class SzarClient implements ClientModInitializer {
@@ -54,6 +53,11 @@ public class SzarClient implements ClientModInitializer {
new Identifier(Szar.MOD_ID, "nyan_cat"),
"main"
);
public static final EntityModelLayer ATOM =
new EntityModelLayer(
new Identifier(Szar.MOD_ID, "atom"),
"main"
);
// Outside of your tick handler
private final Map<NyanEntity, EntityTrackingSoundInstance> activeSounds = new HashMap<>();
private static final SoundEvent NYAN_LOOP = SoundEvent.of(new Identifier("szar", "nyan_cat_loop"));
@@ -165,6 +169,14 @@ public class SzarClient implements ClientModInitializer {
Szar.NiggerEntityType,
NiggerEntityRenderer::new
);
EntityRendererRegistry.register(
Szar.AtomEntityType,
AtomEntityRenderer::new
);
EntityModelLayerRegistry.registerModelLayer(
ATOM,
Atom::getTexturedModelData
);
EntityRendererRegistry.register(
Szar.HitterEntityType,
HitterEntityRenderer::new

View File

@@ -0,0 +1,84 @@
package dev.tggamesyt.szar;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.MovementType;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
public class AtomEntity extends Entity {
private static final int NUKE_RADIUS = 100;
public AtomEntity(EntityType<?> type, World world) {
super(type, world);
}
@Override
protected void initDataTracker() {}
@Override
public void tick() {
super.tick();
if (!this.hasNoGravity()) {
this.setVelocity(this.getVelocity().add(0, -0.08, 0));
}
this.move(MovementType.SELF, this.getVelocity());
if (!getWorld().isClient && this.isOnGround()) {
explode();
this.discard();
}
}
private void explode() {
ServerWorld world = (ServerWorld) this.getWorld();
// Visual / sound explosion only
world.createExplosion(
this,
getX(),
getY(),
getZ(),
50.0F, // just visuals
World.ExplosionSourceType.TNT
);
clearSphere(world, this.getBlockPos(), NUKE_RADIUS);
}
private void clearSphere(ServerWorld world, BlockPos center, int radius) {
int rSquared = radius * radius;
BlockPos.Mutable mutable = new BlockPos.Mutable();
for (int x = -radius; x <= radius; x++) {
for (int y = -radius; y <= radius; y++) {
for (int z = -radius; z <= radius; z++) {
if (x * x + y * y + z * z > rSquared) continue;
mutable.set(
center.getX() + x,
center.getY() + y,
center.getZ() + z
);
// Skip void / out of world
if (!world.isInBuildLimit(mutable)) continue;
world.setBlockState(mutable, net.minecraft.block.Blocks.AIR.getDefaultState(), 3);
}
}
}
}
@Override
protected void readCustomDataFromNbt(NbtCompound nbt) {}
@Override
protected void writeCustomDataToNbt(NbtCompound nbt) {}
}

View File

@@ -0,0 +1,66 @@
package dev.tggamesyt.szar;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.*;
import net.minecraft.world.RaycastContext;
import net.minecraft.world.World;
public class AtomSummonerItem extends Item {
private static final int COOLDOWN_TICKS = 20 * 60; // 10 minutes
private static final double RAY_DISTANCE = 500.0D;
public AtomSummonerItem(Settings settings) {
super(settings.maxDamage(2));
}
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
if (world.isClient()) {
return TypedActionResult.success(player.getStackInHand(hand));
}
ServerWorld serverWorld = (ServerWorld) world;
ItemStack stack = player.getStackInHand(hand);
// Raycast from eyes
Vec3d start = player.getCameraPosVec(1.0F);
Vec3d direction = player.getRotationVec(1.0F);
Vec3d end = start.add(direction.multiply(RAY_DISTANCE));
BlockHitResult hit = serverWorld.raycast(new RaycastContext(
start,
end,
RaycastContext.ShapeType.OUTLINE,
RaycastContext.FluidHandling.NONE,
player
));
// If player is looking into nothing, abort
if (hit.getType() == HitResult.Type.MISS) {
return TypedActionResult.fail(stack);
}
BlockPos hitPos = hit.getBlockPos();
Vec3d spawnPos = Vec3d.ofCenter(hitPos).add(0, 100, 0);
AtomEntity atom = new AtomEntity(Szar.AtomEntityType, serverWorld);
atom.setPosition(spawnPos.x, spawnPos.y, spawnPos.z);
serverWorld.spawnEntity(atom);
// Cooldown + durability
player.getItemCooldownManager().set(this, COOLDOWN_TICKS);
stack.damage(1, player, p -> p.sendToolBreakStatus(hand));
return TypedActionResult.success(stack);
}
}

View File

@@ -76,7 +76,7 @@ public class Szar implements ModInitializer {
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
public static MinecraftServer SERVER;
public static final Identifier PLANE_ANIM_PACKET =
new Identifier("szar", "plane_anim");
new Identifier(MOD_ID, "plane_anim");
public static final Identifier OPEN_URL = new Identifier(MOD_ID, "epsteinfiles");
public static final Block SZAR_BLOCK =
@@ -99,7 +99,7 @@ public class Szar implements ModInitializer {
public static final RegistryKey<DamageType> BULLET_DAMAGE =
RegistryKey.of(
RegistryKeys.DAMAGE_TYPE,
new Identifier("szar", "bullet")
new Identifier(MOD_ID, "bullet")
);
public static VillagerProfession DROG_DEALER = Registry.register(
Registries.VILLAGER_PROFESSION,
@@ -233,6 +233,7 @@ public class Szar implements ModInitializer {
entries.add(Szar.NYAN_SPAWNEGG);
entries.add(Szar.EPSTEIN_FILES);
entries.add(Szar.EPSTEIN_SPAWNEGG);
entries.add(Szar.ATOM_DETONATOR);
})
.build()
);
@@ -476,7 +477,7 @@ public class Szar implements ModInitializer {
GenerationStep.Feature.VEGETAL_DECORATION,
RegistryKey.of(
RegistryKeys.PLACED_FEATURE,
new Identifier("szar", "cannabis_patch")
new Identifier(MOD_ID, "cannabis_patch")
)
);
AttackEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> {
@@ -522,7 +523,7 @@ public class Szar implements ModInitializer {
public static final Feature<CannabisPatchFeatureConfig> CANNABIS_PATCH =
Registry.register(
Registries.FEATURE,
new Identifier("szar", "cannabis_patch"),
new Identifier(MOD_ID, "cannabis_patch"),
new CannabisPatchFeature(CannabisPatchFeatureConfig.CODEC)
);
public static final Map<UUID, Integer> PLAYER_JOINT_LEVEL = new HashMap<>();
@@ -532,25 +533,36 @@ public class Szar implements ModInitializer {
new Identifier(MOD_ID, "drog"),
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(MOD_ID, "arrested"), new ArrestedEffect());
public static final Item AK_AMMO = Registry.register(
Registries.ITEM,
new Identifier("szar", "bullet"),
new Identifier(MOD_ID, "bullet"),
new Item(new Item.Settings())
);
public static final EntityType<BulletEntity> BULLET =
Registry.register(
Registries.ENTITY_TYPE,
new Identifier("szar", "bullet"),
new Identifier(MOD_ID, "bullet"),
FabricEntityTypeBuilder.<BulletEntity>create(SpawnGroup.MISC, BulletEntity::new)
.dimensions(EntityDimensions.fixed(0.25F, 0.25F))
.trackRangeBlocks(64)
.trackedUpdateRate(20)
.build()
);
public static final EntityType<AtomEntity> AtomEntityType =
Registry.register(
Registries.ENTITY_TYPE,
new Identifier(MOD_ID, "atom"),
FabricEntityTypeBuilder.create()
.entityFactory(AtomEntity::new)
.dimensions(EntityDimensions.fixed(2.0F, 6.0F))
.trackRangeBlocks(256)
.trackedUpdateRate(1)
.build()
);
public static final Item AK47 = Registry.register(
Registries.ITEM,
new Identifier("szar", "ak47"),
new Identifier(MOD_ID, "ak47"),
new AK47Item(new Item.Settings().maxCount(1))
);
@@ -714,7 +726,7 @@ public class Szar implements ModInitializer {
new FaszItem(FASZ_BLOCK, new Item.Settings())
);
public static final SoundEvent NYAN_MUSIC =
SoundEvent.of(new Identifier("szar", "nyan_music"));
SoundEvent.of(new Identifier(MOD_ID, "nyan_music"));
public static final Item POPTART = Registry.register(
Registries.ITEM,
new Identifier(MOD_ID, "pop_tart"),
@@ -724,6 +736,11 @@ public class Szar implements ModInitializer {
hunger((Math.random() < 0.5) ? 6 : 7) // SIX OR SEVEN
.build()), 217)
);
public static final Item ATOM_DETONATOR = Registry.register(
Registries.ITEM,
new Identifier(MOD_ID, "detonator"),
new AtomSummonerItem(new Item.Settings())
);
public static final Item NWORD_PASS = Registry.register(
Registries.ITEM,
new Identifier(MOD_ID, "nwordpass"),

View File

@@ -53,5 +53,8 @@
"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"
"item.szar.epstein_spawn_egg": "Epstein Spawn Egg",
"item.szar.detonator": "Detonator",
"entity.szar.atom": "Atom"
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "szar:item/detonator"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B