I dont fckin know
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.26
|
mod_version=26.2.26.1
|
||||||
maven_group=dev.tggamesyt
|
maven_group=dev.tggamesyt
|
||||||
archives_base_name=szar
|
archives_base_name=szar
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|||||||
@@ -1,52 +1,150 @@
|
|||||||
package dev.tggamesyt.szar;
|
package dev.tggamesyt.szar;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
|
import net.minecraft.entity.damage.DamageType;
|
||||||
|
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.ItemUsageContext;
|
||||||
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.particle.BlockStateParticleEffect;
|
import net.minecraft.particle.BlockStateParticleEffect;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.TypedActionResult;
|
import net.minecraft.util.TypedActionResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import static dev.tggamesyt.szar.Szar.*;
|
||||||
|
|
||||||
public class FaszItem extends BlockItem {
|
public class FaszItem extends BlockItem {
|
||||||
|
|
||||||
|
private static final int MAX_CHARGE_CLICKS = 4;
|
||||||
|
private static final int COOLDOWN_TICKS = 1; // 1 tick
|
||||||
|
private static final String BURST_KEY = "BurstCount";
|
||||||
|
private static final Random RANDOM = new Random();
|
||||||
|
private static final ItemStack CNDM = new ItemStack(Szar.CNDM);
|
||||||
|
|
||||||
public FaszItem(Block block, Settings settings) {
|
public FaszItem(Block block, Settings settings) {
|
||||||
super(block, settings);
|
super(block, settings.maxDamage(MAX_CHARGE_CLICKS));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow sneak-place
|
||||||
|
@Override
|
||||||
|
public ActionResult useOnBlock(ItemUsageContext context) {
|
||||||
|
if (context.getPlayer() != null && context.getPlayer().isSneaking()) {
|
||||||
|
return ActionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
return ActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||||
ItemStack stack = user.getStackInHand(hand);
|
ItemStack stack = user.getStackInHand(hand);
|
||||||
|
|
||||||
if (!world.isClient && stack.isOf(this) && new Random().nextInt(5) == 1) {
|
if (hand != Hand.MAIN_HAND) return TypedActionResult.success(stack);
|
||||||
ServerWorld serverWorld = (ServerWorld) world;
|
|
||||||
|
|
||||||
// Get the direction the player's torso is looking
|
if (world.isClient) return TypedActionResult.success(stack);
|
||||||
var lookVec = user.getRotationVec(1.0F); // normalized direction vector
|
|
||||||
|
|
||||||
// Calculate the particle spawn position 2 blocks ahead
|
boolean isCreative = user.isCreative();
|
||||||
double px = user.getX() + lookVec.x * 2;
|
|
||||||
double py = user.getBodyY(0.5); // torso height
|
|
||||||
double pz = user.getZ() + lookVec.z * 2;
|
|
||||||
|
|
||||||
// Spawn block particles
|
int damage = stack.getDamage();
|
||||||
serverWorld.spawnParticles(
|
int maxDamage = stack.getMaxDamage();
|
||||||
new BlockStateParticleEffect(ParticleTypes.BLOCK, Szar.FASZ_BLOCK.getDefaultState()),
|
NbtCompound nbt = stack.getOrCreateNbt();
|
||||||
px, py, pz, // position
|
int burstCount = nbt.getInt(BURST_KEY);
|
||||||
20, // particle count
|
|
||||||
0.3, 0.3, 0.3, // spread in x/y/z
|
// In creative, ignore charging/cooldown
|
||||||
0.05 // velocity
|
if (isCreative) {
|
||||||
);
|
if (user.getOffHandStack().getItem() == Szar.CNDM) {user.getOffHandStack().decrement(1);}
|
||||||
|
spawnParticlesAndDamage((ServerWorld) world, user);
|
||||||
|
return TypedActionResult.success(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TypedActionResult.pass(stack);
|
// Charging phase
|
||||||
|
if (damage < maxDamage) {
|
||||||
|
stack.setDamage(damage + 1);
|
||||||
|
return TypedActionResult.success(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Burst phase (after full charge)
|
||||||
|
int burstClicks = nbt.getInt("BurstClicks"); // NEW NBT counter for burst clicks
|
||||||
|
if (burstClicks < 4) { // do 4 burst clicks
|
||||||
|
spawnParticlesAndDamage((ServerWorld) world, user);
|
||||||
|
|
||||||
|
// Optional: handle offhand special item
|
||||||
|
if (user.getOffHandStack().getItem() == Szar.CNDM) {
|
||||||
|
user.dropStack(new ItemStack(Szar.WHITE_LIQUID));
|
||||||
|
user.getOffHandStack().decrement(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
burstClicks++;
|
||||||
|
nbt.putInt("BurstClicks", burstClicks);
|
||||||
|
|
||||||
|
// After 4 burst clicks → cooldown + reset
|
||||||
|
if (burstClicks >= 4) {
|
||||||
|
user.getItemCooldownManager().set(this, COOLDOWN_TICKS);
|
||||||
|
stack.setDamage(0);
|
||||||
|
nbt.putInt("BurstClicks", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TypedActionResult.success(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TypedActionResult.success(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void spawnParticlesAndDamage(ServerWorld world, PlayerEntity user) {
|
||||||
|
var lookVec = user.getRotationVec(1.0F);
|
||||||
|
double px = user.getX() + lookVec.x * 2;
|
||||||
|
double py = user.getBodyY(0.5);
|
||||||
|
double pz = user.getZ() + lookVec.z * 2;
|
||||||
|
|
||||||
|
// Spawn particles
|
||||||
|
world.spawnParticles(
|
||||||
|
new BlockStateParticleEffect(ParticleTypes.BLOCK, Szar.FASZ_BLOCK.getDefaultState()),
|
||||||
|
px, py, pz,
|
||||||
|
20,
|
||||||
|
0.3, 0.3, 0.3,
|
||||||
|
0.05
|
||||||
|
);
|
||||||
|
|
||||||
|
// Damage ANY entity whose hitbox contains the particle
|
||||||
|
world.getEntitiesByClass(Entity.class, user.getBoundingBox().expand(2), e -> e != user).forEach(e -> {
|
||||||
|
if (e.getBoundingBox().contains(px, py, pz)) {
|
||||||
|
if (e instanceof LivingEntity living) {
|
||||||
|
// Always deal half a heart
|
||||||
|
RegistryEntry<DamageType> radiationEntry = SERVER.getRegistryManager()
|
||||||
|
.get(RegistryKeys.DAMAGE_TYPE)
|
||||||
|
.getEntry(FCK_DAMAGE)
|
||||||
|
.orElseThrow(() -> new IllegalStateException("FCK DamageType not registered!"));
|
||||||
|
living.damage(new DamageSource(radiationEntry, user), 1.0F);
|
||||||
|
|
||||||
|
// If the entity is a player → apply special effect logic
|
||||||
|
if (living instanceof PlayerEntity target) {
|
||||||
|
int chance = 5; // 1/5 default
|
||||||
|
ItemStack offhand = user.getOffHandStack();
|
||||||
|
if (!offhand.isEmpty() && offhand.isOf(CNDM.getItem())) {
|
||||||
|
chance = 100; // 1/100 if special offhand
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RANDOM.nextInt(chance) == 0) {
|
||||||
|
// Apply status effect
|
||||||
|
target.addStatusEffect(new StatusEffectInstance(Szar.PREGNANT, 20 * 60 * 20));
|
||||||
|
// If special offhand → break 1 item
|
||||||
|
if (chance == 100) offhand.decrement(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -287,6 +287,9 @@ public class Szar implements ModInitializer {
|
|||||||
entries.add(Szar.BAITER_DISK);
|
entries.add(Szar.BAITER_DISK);
|
||||||
entries.add(Szar.MERL_SPAWNEGG);
|
entries.add(Szar.MERL_SPAWNEGG);
|
||||||
entries.add(Szar.EFN_DISK);
|
entries.add(Szar.EFN_DISK);
|
||||||
|
entries.add(Szar.CNDM);
|
||||||
|
entries.add(Szar.LATEX);
|
||||||
|
entries.add(Szar.WHITE_LIQUID);
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
@@ -653,6 +656,21 @@ public class Szar implements ModInitializer {
|
|||||||
new BlockItem(OBELISK_CORE, new Item.Settings())
|
new BlockItem(OBELISK_CORE, new Item.Settings())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
public static final Item CNDM = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
new Identifier(MOD_ID, "cndm"),
|
||||||
|
new Item(new Item.Settings())
|
||||||
|
);
|
||||||
|
public static final Item WHITE_LIQUID = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
new Identifier(MOD_ID, "white_liquid"),
|
||||||
|
new Item(new Item.Settings().food(new FoodComponent.Builder().alwaysEdible().hunger(1).build()))
|
||||||
|
);
|
||||||
|
public static final Item LATEX = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
new Identifier(MOD_ID, "latex"),
|
||||||
|
new Item(new Item.Settings())
|
||||||
|
);
|
||||||
public static final StructurePieceType TNT_OBELISK_PIECE =
|
public static final StructurePieceType TNT_OBELISK_PIECE =
|
||||||
Registry.register(
|
Registry.register(
|
||||||
Registries.STRUCTURE_PIECE,
|
Registries.STRUCTURE_PIECE,
|
||||||
@@ -704,6 +722,8 @@ public class Szar implements ModInitializer {
|
|||||||
new PregnantEffect());
|
new PregnantEffect());
|
||||||
public static final RegistryKey<DamageType> RADIATION_DAMAGE =
|
public static final RegistryKey<DamageType> RADIATION_DAMAGE =
|
||||||
RegistryKey.of(RegistryKeys.DAMAGE_TYPE, new Identifier(MOD_ID, "radiation"));
|
RegistryKey.of(RegistryKeys.DAMAGE_TYPE, new Identifier(MOD_ID, "radiation"));
|
||||||
|
public static final RegistryKey<DamageType> FCK_DAMAGE =
|
||||||
|
RegistryKey.of(RegistryKeys.DAMAGE_TYPE, new Identifier(MOD_ID, "fck"));
|
||||||
public static final Item AK_AMMO = Registry.register(
|
public static final Item AK_AMMO = Registry.register(
|
||||||
Registries.ITEM,
|
Registries.ITEM,
|
||||||
new Identifier(MOD_ID, "bullet"),
|
new Identifier(MOD_ID, "bullet"),
|
||||||
@@ -1186,9 +1206,9 @@ public class Szar implements ModInitializer {
|
|||||||
// Determine who is holding the special item
|
// Determine who is holding the special item
|
||||||
if (isHoldingSpecial(sleeper)) {
|
if (isHoldingSpecial(sleeper)) {
|
||||||
// The OTHER player gets the effect
|
// The OTHER player gets the effect
|
||||||
givePregnantEffect(other, sleeper);
|
givePregnantEffect(other, sleeper, sleeper.getOffHandStack().getItem() == CNDM ? 100 : 5);
|
||||||
} else if (isHoldingSpecial(other)) {
|
} else if (isHoldingSpecial(other)) {
|
||||||
givePregnantEffect(sleeper, other);
|
givePregnantEffect(sleeper, other, other.getOffHandStack().getItem() == CNDM ? 100 : 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1199,10 +1219,14 @@ public class Szar implements ModInitializer {
|
|||||||
return p.getMainHandStack().getItem() == FASZITEM;
|
return p.getMainHandStack().getItem() == FASZITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void givePregnantEffect(ServerPlayerEntity player, ServerPlayerEntity partner) {
|
private void givePregnantEffect(ServerPlayerEntity player, ServerPlayerEntity partner, int chance) {
|
||||||
|
if (partner.getOffHandStack().getItem() == Szar.CNDM) {
|
||||||
|
partner.getOffHandStack().decrement(1);
|
||||||
|
partner.dropStack(new ItemStack(WHITE_LIQUID));
|
||||||
|
}
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
System.out.println(r.nextInt());
|
System.out.println(r.nextInt());
|
||||||
if (r.nextInt(10) == 6) {
|
if (r.nextInt(chance) == 0) {
|
||||||
player.addStatusEffect(new StatusEffectInstance(PREGNANT, 20 * 60 * 20, 0, false, false, true));
|
player.addStatusEffect(new StatusEffectInstance(PREGNANT, 20 * 60 * 20, 0, false, false, true));
|
||||||
pregnantPartners.put(player.getUuid(), partner.getUuid());
|
pregnantPartners.put(player.getUuid(), partner.getUuid());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,5 +73,9 @@
|
|||||||
"item.szar.merl_spawn_egg": "Merl Spawn Egg",
|
"item.szar.merl_spawn_egg": "Merl Spawn Egg",
|
||||||
"effect.szar.pregnant": "Pregnant",
|
"effect.szar.pregnant": "Pregnant",
|
||||||
"entity.szar.kid": "Kid",
|
"entity.szar.kid": "Kid",
|
||||||
"block.szar.obelisk_core": "Towers Core Block"
|
"block.szar.obelisk_core": "Towers Core Block",
|
||||||
|
"item.szar.cndm": "Condom",
|
||||||
|
"item.szar.latex": "Latex",
|
||||||
|
"death.attack.fck": "%1$s got fucked too hard by %2$s",
|
||||||
|
"item.szar.white_liquid": "..."
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/main/resources/assets/szar/models/item/cndm.json
Normal file
6
src/main/resources/assets/szar/models/item/cndm.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "szar:item/cndm"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/main/resources/assets/szar/models/item/latex.json
Normal file
6
src/main/resources/assets/szar/models/item/latex.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "szar:item/latex"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "szar:item/white_liquid"
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 636 B |
BIN
src/main/resources/assets/szar/textures/item/cndm.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/cndm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/main/resources/assets/szar/textures/item/latex.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/latex.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 774 B |
BIN
src/main/resources/assets/szar/textures/item/white_liquid.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/white_liquid.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 972 B |
5
src/main/resources/data/szar/damage_type/fck.json
Normal file
5
src/main/resources/data/szar/damage_type/fck.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"message_id": "fck",
|
||||||
|
"exhaustion": 0.1,
|
||||||
|
"scaling": "never"
|
||||||
|
}
|
||||||
14
src/main/resources/data/szar/recipes/cndm.json
Normal file
14
src/main/resources/data/szar/recipes/cndm.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shapeless",
|
||||||
|
"ingredients": [
|
||||||
|
{
|
||||||
|
"item": "szar:latex"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"item": "minecraft:blue_dye"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result": {
|
||||||
|
"item": "szar:cndm"
|
||||||
|
}
|
||||||
|
}
|
||||||
20
src/main/resources/data/szar/recipes/latex.json
Normal file
20
src/main/resources/data/szar/recipes/latex.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"SSS",
|
||||||
|
"SLS",
|
||||||
|
"SSS"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"S": {
|
||||||
|
"item": "minecraft:sugar"
|
||||||
|
},
|
||||||
|
"L": {
|
||||||
|
"item": "minecraft:slime_ball"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"item": "szar:latex",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user