advancements and kebab
This commit is contained in:
@@ -59,8 +59,8 @@ import static dev.tggamesyt.szar.client.ClientCosmetics.loadTextureFromURL;
|
|||||||
|
|
||||||
public class SzarClient implements ClientModInitializer {
|
public class SzarClient implements ClientModInitializer {
|
||||||
// add this field to your client init class
|
// add this field to your client init class
|
||||||
public static final int april = 4;
|
public static final int april = Szar.april;
|
||||||
public static final int fools = 1;
|
public static final int fools = Szar.fools;
|
||||||
private float drogOverlayProgress = 0.0F;
|
private float drogOverlayProgress = 0.0F;
|
||||||
private long lastTime = 0;
|
private long lastTime = 0;
|
||||||
private static final Map<KeyBinding, KeyBinding> activeScramble = new HashMap<>();
|
private static final Map<KeyBinding, KeyBinding> activeScramble = new HashMap<>();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import net.minecraft.entity.attribute.EntityAttributes;
|
|||||||
import net.minecraft.entity.effect.StatusEffect;
|
import net.minecraft.entity.effect.StatusEffect;
|
||||||
import net.minecraft.entity.effect.StatusEffectCategory;
|
import net.minecraft.entity.effect.StatusEffectCategory;
|
||||||
import net.minecraft.entity.mob.MobEntity;
|
import net.minecraft.entity.mob.MobEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ public class ArrestedEffect extends StatusEffect {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onApplied(LivingEntity entity, AttributeContainer attributes, int amplifier) {
|
public void onApplied(LivingEntity entity, AttributeContainer attributes, int amplifier) {
|
||||||
|
if (entity instanceof PlayerEntity player) {Szar.grantAdvancement(player, "arrested");}
|
||||||
var speed = entity.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED);
|
var speed = entity.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED);
|
||||||
if (speed == null) return;
|
if (speed == null) return;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class EpsteinFile extends Item {
|
|||||||
@Override
|
@Override
|
||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
|
||||||
if (!world.isClient && player instanceof ServerPlayerEntity serverPlayer) {
|
if (!world.isClient && player instanceof ServerPlayerEntity serverPlayer) {
|
||||||
|
Szar.grantAdvancement(player, "files");
|
||||||
PacketByteBuf buf = PacketByteBufs.create();
|
PacketByteBuf buf = PacketByteBufs.create();
|
||||||
|
|
||||||
ServerPlayNetworking.send(serverPlayer, Szar.OPEN_URL, buf);
|
ServerPlayNetworking.send(serverPlayer, Szar.OPEN_URL, buf);
|
||||||
|
|||||||
211
src/main/java/dev/tggamesyt/szar/FartManager.java
Normal file
211
src/main/java/dev/tggamesyt/szar/FartManager.java
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
package dev.tggamesyt.szar;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||||
|
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||||
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
|
import net.minecraft.entity.damage.DamageType;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.registry.RegistryKey;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvent;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.explosion.Explosion;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static dev.tggamesyt.szar.Szar.MOD_ID;
|
||||||
|
|
||||||
|
public class FartManager {
|
||||||
|
public static final net.minecraft.sound.SoundEvent FART_SOUND = Registry.register(
|
||||||
|
Registries.SOUND_EVENT,
|
||||||
|
new Identifier(MOD_ID, "fart"),
|
||||||
|
net.minecraft.sound.SoundEvent.of(new Identifier(MOD_ID, "fart"))
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final net.minecraft.sound.SoundEvent FART1_SOUND = Registry.register(
|
||||||
|
Registries.SOUND_EVENT,
|
||||||
|
new Identifier(MOD_ID, "fart1"),
|
||||||
|
net.minecraft.sound.SoundEvent.of(new Identifier(MOD_ID, "fart1"))
|
||||||
|
);
|
||||||
|
// Ticks since player joined
|
||||||
|
private static final Map<UUID, Long> tickCounter = new HashMap<>();
|
||||||
|
// How many damage increments have been applied (max 10)
|
||||||
|
private static final Map<UUID, Integer> damageLevel = new HashMap<>();
|
||||||
|
private static final java.util.Set<UUID> wasSneaking = new java.util.HashSet<>();
|
||||||
|
public static final RegistryKey<DamageType> FART_DAMAGE_TYPE =
|
||||||
|
RegistryKey.of(RegistryKeys.DAMAGE_TYPE,
|
||||||
|
new Identifier(MOD_ID, "fart"));
|
||||||
|
private static final long FIRST_FART_DELAY = 36000; // first fart after 30 min
|
||||||
|
private static final long FART_INTERVAL = 12000; // every 10 min after
|
||||||
|
private static final int MAX_DAMAGE_LEVEL = 10; // max 10 half-hearts extra
|
||||||
|
private static final float EXPLOSION_THRESHOLD = 8.0f; // 8 hearts = explosion
|
||||||
|
private static final float MAX_RANGE = 5.0f;
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
ServerTickEvents.END_SERVER_TICK.register(FartManager::tick);
|
||||||
|
|
||||||
|
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
|
||||||
|
UUID uuid = handler.player.getUuid();
|
||||||
|
tickCounter.put(uuid, 0L);
|
||||||
|
damageLevel.put(uuid, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> {
|
||||||
|
UUID uuid = handler.player.getUuid();
|
||||||
|
tickCounter.remove(uuid);
|
||||||
|
damageLevel.remove(uuid);
|
||||||
|
wasSneaking.remove(uuid);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void tick(MinecraftServer server) {
|
||||||
|
for (ServerWorld world : server.getWorlds()) {
|
||||||
|
for (ServerPlayerEntity player : world.getPlayers()) {
|
||||||
|
UUID uuid = player.getUuid();
|
||||||
|
|
||||||
|
if (!tickCounter.containsKey(uuid)) {
|
||||||
|
tickCounter.put(uuid, 0L);
|
||||||
|
damageLevel.put(uuid, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.isSneaking()) {
|
||||||
|
if (!wasSneaking.contains(uuid)) {
|
||||||
|
// First tick of sneaking — trigger fart
|
||||||
|
wasSneaking.add(uuid);
|
||||||
|
int level = damageLevel.getOrDefault(uuid, 0);
|
||||||
|
if (level > 0 || world.random.nextInt(10) == 0) {
|
||||||
|
releaseFart(world, player, level);
|
||||||
|
tickCounter.put(uuid, 0L);
|
||||||
|
damageLevel.put(uuid, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
// Player stopped sneaking — clear the flag
|
||||||
|
wasSneaking.remove(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
long ticks = tickCounter.get(uuid) + 1;
|
||||||
|
tickCounter.put(uuid, ticks);
|
||||||
|
|
||||||
|
if (ticks % FART_INTERVAL == 0) {
|
||||||
|
// Damage only starts increasing after FIRST_FART_DELAY
|
||||||
|
if (ticks >= FIRST_FART_DELAY) {
|
||||||
|
int level = damageLevel.getOrDefault(uuid, 0);
|
||||||
|
if (level < MAX_DAMAGE_LEVEL) {
|
||||||
|
level++;
|
||||||
|
damageLevel.put(uuid, level);
|
||||||
|
}
|
||||||
|
damageLevel.put(uuid, Math.min(level, MAX_DAMAGE_LEVEL));
|
||||||
|
}
|
||||||
|
releaseFart(world, player, damageLevel.getOrDefault(uuid, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void releaseFart(ServerWorld world, ServerPlayerEntity farter, int level) {
|
||||||
|
// Calculate damage: level * 0.5 hearts = level * 1.0 damage points
|
||||||
|
float damage = level * 1.0f;
|
||||||
|
|
||||||
|
// Play fart sound to everyone nearby
|
||||||
|
playfartSound(world, farter);
|
||||||
|
|
||||||
|
// Damage nearby players
|
||||||
|
Vec3d fartPos = farter.getPos();
|
||||||
|
for (ServerPlayerEntity victim : world.getPlayers()) {
|
||||||
|
if (victim == farter) continue;
|
||||||
|
double dist = victim.getPos().distanceTo(fartPos);
|
||||||
|
if (dist > MAX_RANGE) continue;
|
||||||
|
|
||||||
|
// Damage falls off linearly: 1 block = 100%, 5 blocks = 20%
|
||||||
|
float multiplier = 1.0f - ((float)(dist - 1.0) / (MAX_RANGE - 1.0f));
|
||||||
|
multiplier = Math.max(0.2f, Math.min(1.0f, multiplier));
|
||||||
|
float victimDamage = damage * multiplier;
|
||||||
|
|
||||||
|
victim.damage(new DamageSource(
|
||||||
|
world.getRegistryManager()
|
||||||
|
.get(RegistryKeys.DAMAGE_TYPE)
|
||||||
|
.entryOf(FART_DAMAGE_TYPE),
|
||||||
|
farter
|
||||||
|
), victimDamage);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Farter takes 50% of full damage
|
||||||
|
farter.damage(new DamageSource(
|
||||||
|
world.getRegistryManager()
|
||||||
|
.get(RegistryKeys.DAMAGE_TYPE)
|
||||||
|
.entryOf(FART_DAMAGE_TYPE),
|
||||||
|
farter
|
||||||
|
), damage * 0.5f);
|
||||||
|
|
||||||
|
// Explosion if damage exceeds 8 hearts (16 damage points)
|
||||||
|
if (damage > EXPLOSION_THRESHOLD) {
|
||||||
|
world.createExplosion(
|
||||||
|
farter,
|
||||||
|
fartPos.x, fartPos.y, fartPos.z,
|
||||||
|
2.5f,
|
||||||
|
false,
|
||||||
|
World.ExplosionSourceType.NONE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void playfartSound(ServerWorld world, ServerPlayerEntity farter) {
|
||||||
|
// Pick random fart sound
|
||||||
|
boolean useFart1 = world.random.nextBoolean();
|
||||||
|
SoundEvent sound = useFart1 ? FART1_SOUND : FART_SOUND;
|
||||||
|
|
||||||
|
// Send to all players in range
|
||||||
|
for (ServerPlayerEntity listener : world.getPlayers()) {
|
||||||
|
if (listener.getPos().distanceTo(farter.getPos()) > 16) continue;
|
||||||
|
listener.networkHandler.sendPacket(new PlaySoundS2CPacket(
|
||||||
|
world.getRegistryManager()
|
||||||
|
.get(net.minecraft.registry.RegistryKeys.SOUND_EVENT)
|
||||||
|
.getEntry(sound),
|
||||||
|
SoundCategory.PLAYERS,
|
||||||
|
farter.getX(), farter.getY(), farter.getZ(),
|
||||||
|
1.0f + world.random.nextFloat() * 0.2f,
|
||||||
|
0.8f + world.random.nextFloat() * 0.4f,
|
||||||
|
world.random.nextLong()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when crouching resets — also called externally if needed
|
||||||
|
public static void resetPlayer(UUID uuid) {
|
||||||
|
tickCounter.put(uuid, 0L);
|
||||||
|
damageLevel.put(uuid, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getTicksForPlayer(UUID uuid) {
|
||||||
|
return tickCounter.getOrDefault(uuid, 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getDamageLevelForPlayer(UUID uuid) {
|
||||||
|
return damageLevel.getOrDefault(uuid, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setTicksForPlayer(UUID uuid, long ticks) {
|
||||||
|
tickCounter.put(uuid, ticks);
|
||||||
|
// Recalculate damage level based on new tick value
|
||||||
|
int level = 0;
|
||||||
|
if (ticks >= FIRST_FART_DELAY) {
|
||||||
|
long ticksSinceFirst = ticks - FIRST_FART_DELAY;
|
||||||
|
level = (int) Math.min(ticksSinceFirst / FART_INTERVAL, MAX_DAMAGE_LEVEL);
|
||||||
|
}
|
||||||
|
damageLevel.put(uuid, level);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ public class FirtanaItem extends Item {
|
|||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||||
|
|
||||||
if (!world.isClient) {
|
if (!world.isClient) {
|
||||||
|
Szar.grantAdvancement(user, "oi");
|
||||||
for (ServerPlayerEntity player : ((ServerWorld) world).getPlayers()) {
|
for (ServerPlayerEntity player : ((ServerWorld) world).getPlayers()) {
|
||||||
PacketByteBuf buf = PacketByteBufs.create();
|
PacketByteBuf buf = PacketByteBufs.create();
|
||||||
buf.writeString(user.getUuidAsString());
|
buf.writeString(user.getUuidAsString());
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public class Joint extends SpyglassItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||||
|
Szar.grantAdvancement(user, "high");
|
||||||
// play custom smoke sound
|
// play custom smoke sound
|
||||||
user.playSound(Szar.BESZIV, 1.0F, 1.0F);
|
user.playSound(Szar.BESZIV, 1.0F, 1.0F);
|
||||||
user.incrementStat(Stats.USED.getOrCreateStat(this));
|
user.incrementStat(Stats.USED.getOrCreateStat(this));
|
||||||
|
|||||||
@@ -77,6 +77,13 @@ public class NyanEntity extends PathAwareEntity {
|
|||||||
|
|
||||||
this.getNavigation().startMovingTo(this.getX() + dx * 5, this.getY(), this.getZ() + dz * 5, speed);
|
this.getNavigation().startMovingTo(this.getX() + dx * 5, this.getY(), this.getZ() + dz * 5, speed);
|
||||||
}
|
}
|
||||||
|
if (!this.getWorld().isClient && this.age % 20 == 0) {
|
||||||
|
this.getWorld().getEntitiesByClass(
|
||||||
|
net.minecraft.entity.player.PlayerEntity.class,
|
||||||
|
this.getBoundingBox().expand(128), // ~8 chunks, reasonable render distance
|
||||||
|
p -> true
|
||||||
|
).forEach(p -> Szar.grantAdvancement(p, "nyan"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,12 @@ public class OverworldPortalFeature extends Feature<DefaultFeatureConfig> {
|
|||||||
BlockPos trackerPos = new BlockPos(origin.getX(), surfaceY, origin.getZ());
|
BlockPos trackerPos = new BlockPos(origin.getX(), surfaceY, origin.getZ());
|
||||||
BlockPos portalPos = trackerPos.down(4);
|
BlockPos portalPos = trackerPos.down(4);
|
||||||
|
|
||||||
|
// Don't spawn on or in water
|
||||||
|
if (world.getBlockState(trackerPos).isOf(Blocks.WATER)) return false;
|
||||||
|
if (world.getBlockState(trackerPos.down()).isOf(Blocks.WATER)) return false;
|
||||||
|
if (world.getFluidState(trackerPos).isStill()) return false;
|
||||||
|
if (world.getFluidState(portalPos).isStill()) return false;
|
||||||
|
|
||||||
BlockState original = world.getBlockState(portalPos);
|
BlockState original = world.getBlockState(portalPos);
|
||||||
|
|
||||||
world.setBlockState(trackerPos, Szar.TRACKER_BLOCK.getDefaultState(),
|
world.setBlockState(trackerPos, Szar.TRACKER_BLOCK.getDefaultState(),
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class RouletteBlock extends Block implements BlockEntityProvider {
|
|||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
}
|
}
|
||||||
if (hand != Hand.MAIN_HAND) return ActionResult.PASS;
|
if (hand != Hand.MAIN_HAND) return ActionResult.PASS;
|
||||||
|
Szar.grantAdvancement(player, "gamble");
|
||||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
if (!(blockEntity instanceof RouletteBlockEntity)) {
|
if (!(blockEntity instanceof RouletteBlockEntity)) {
|
||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class SlotMachineBlock extends Block implements BlockEntityProvider {
|
|||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
}
|
}
|
||||||
if (hand != Hand.MAIN_HAND) return ActionResult.PASS;
|
if (hand != Hand.MAIN_HAND) return ActionResult.PASS;
|
||||||
|
Szar.grantAdvancement(player, "gamble");
|
||||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
if (!(blockEntity instanceof SlotMachineBlockEntity)) {
|
if (!(blockEntity instanceof SlotMachineBlockEntity)) {
|
||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ public class Szar implements ModInitializer {
|
|||||||
public static final String MOD_ID = "szar";
|
public static final String MOD_ID = "szar";
|
||||||
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
|
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
|
||||||
public static MinecraftServer SERVER;
|
public static MinecraftServer SERVER;
|
||||||
|
public static int april = 4;
|
||||||
|
public static int fools = 1;
|
||||||
public static final Identifier DRUNK_TYPE_PACKET = new Identifier(MOD_ID, "drunk_type");
|
public static final Identifier DRUNK_TYPE_PACKET = new Identifier(MOD_ID, "drunk_type");
|
||||||
public static final Identifier OPEN_DETONATOR_SCREEN = new Identifier(MOD_ID, "open_coord_screen");
|
public static final Identifier OPEN_DETONATOR_SCREEN = new Identifier(MOD_ID, "open_coord_screen");
|
||||||
public static final Identifier DETONATOR_INPUT = new Identifier(MOD_ID, "coord_input");
|
public static final Identifier DETONATOR_INPUT = new Identifier(MOD_ID, "coord_input");
|
||||||
@@ -377,6 +379,7 @@ public class Szar implements ModInitializer {
|
|||||||
entries.add(Szar.BEAN);
|
entries.add(Szar.BEAN);
|
||||||
entries.add(Szar.CAN_OF_BEANS);
|
entries.add(Szar.CAN_OF_BEANS);
|
||||||
entries.add(Szar.ALMOND_WATER);
|
entries.add(Szar.ALMOND_WATER);
|
||||||
|
entries.add(Szar.KEBAB);
|
||||||
// crazy weponary
|
// crazy weponary
|
||||||
entries.add(Szar.BULLET_ITEM);
|
entries.add(Szar.BULLET_ITEM);
|
||||||
entries.add(Szar.AK47);
|
entries.add(Szar.AK47);
|
||||||
@@ -929,9 +932,16 @@ public class Szar implements ModInitializer {
|
|||||||
1.0F,
|
1.0F,
|
||||||
1.0F
|
1.0F
|
||||||
);
|
);
|
||||||
|
Szar.grantAdvancement(player, "dontknow");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
|
||||||
|
java.time.LocalDate today = java.time.LocalDate.now();
|
||||||
|
if (today.getMonthValue() == april && today.getDayOfMonth() == fools) {
|
||||||
|
Szar.grantAdvancement(handler.player, "april");
|
||||||
|
}
|
||||||
|
});
|
||||||
ServerTickEvents.END_SERVER_TICK.register(server -> {
|
ServerTickEvents.END_SERVER_TICK.register(server -> {
|
||||||
for (ServerPlayerEntity player : server.getPlayerManager().getPlayerList()) {
|
for (ServerPlayerEntity player : server.getPlayerManager().getPlayerList()) {
|
||||||
if (player.isSleeping()) {
|
if (player.isSleeping()) {
|
||||||
@@ -1082,6 +1092,47 @@ public class Szar implements ModInitializer {
|
|||||||
DrunkEffect.DrunkType.PARANOID)))
|
DrunkEffect.DrunkType.PARANOID)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
.then(CommandManager.literal("fart")
|
||||||
|
.then(CommandManager.literal("get")
|
||||||
|
.then(CommandManager.argument("target",
|
||||||
|
net.minecraft.command.argument.EntityArgumentType.player())
|
||||||
|
.executes(context -> {
|
||||||
|
ServerCommandSource source = context.getSource();
|
||||||
|
ServerPlayerEntity target = net.minecraft.command.argument
|
||||||
|
.EntityArgumentType.getPlayer(context, "target");
|
||||||
|
long ticks = FartManager.getTicksForPlayer(target.getUuid());
|
||||||
|
int level = FartManager.getDamageLevelForPlayer(target.getUuid());
|
||||||
|
source.sendMessage(Text.literal(
|
||||||
|
"§e" + target.getName().getString() + "§r fart timer: §a"
|
||||||
|
+ ticks + "§r ticks, damage level: §c" + level + "§r/10"
|
||||||
|
));
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.then(CommandManager.literal("set")
|
||||||
|
.then(CommandManager.argument("target",
|
||||||
|
net.minecraft.command.argument.EntityArgumentType.player())
|
||||||
|
.then(CommandManager.argument("ticks",
|
||||||
|
com.mojang.brigadier.arguments.LongArgumentType.longArg(0))
|
||||||
|
.executes(context -> {
|
||||||
|
ServerCommandSource source = context.getSource();
|
||||||
|
ServerPlayerEntity target = net.minecraft.command.argument
|
||||||
|
.EntityArgumentType.getPlayer(context, "target");
|
||||||
|
long ticks = com.mojang.brigadier.arguments.LongArgumentType
|
||||||
|
.getLong(context, "ticks");
|
||||||
|
FartManager.setTicksForPlayer(target.getUuid(), ticks);
|
||||||
|
source.sendMessage(Text.literal(
|
||||||
|
"§aSet §e" + target.getName().getString()
|
||||||
|
+ "§a's fart timer to §e" + ticks + "§a ticks"
|
||||||
|
));
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
Registry.register(
|
Registry.register(
|
||||||
@@ -1226,6 +1277,7 @@ public class Szar implements ModInitializer {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
ServerTickEvents.END_SERVER_TICK.register(DrunkEffect::tick);
|
ServerTickEvents.END_SERVER_TICK.register(DrunkEffect::tick);
|
||||||
|
FartManager.register();
|
||||||
}
|
}
|
||||||
// Blocks
|
// Blocks
|
||||||
public static final TrackerBlock TRACKER_BLOCK = Registry.register(
|
public static final TrackerBlock TRACKER_BLOCK = Registry.register(
|
||||||
@@ -1841,7 +1893,15 @@ public class Szar implements ModInitializer {
|
|||||||
hunger((Math.random() < 0.5) ? 6 : 7) // SIX OR SEVEN
|
hunger((Math.random() < 0.5) ? 6 : 7) // SIX OR SEVEN
|
||||||
.build()), 217)
|
.build()), 217)
|
||||||
);
|
);
|
||||||
|
public static final Item KEBAB = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
new Identifier(MOD_ID, "kebab"),
|
||||||
|
new Item(new Item.Settings()
|
||||||
|
.food(new FoodComponent.Builder()
|
||||||
|
.saturationModifier(1.2f)
|
||||||
|
.hunger(14)
|
||||||
|
.build()))
|
||||||
|
);
|
||||||
public static final Item BEAN = Registry.register(
|
public static final Item BEAN = Registry.register(
|
||||||
Registries.ITEM,
|
Registries.ITEM,
|
||||||
new Identifier(MOD_ID, "bean"),
|
new Identifier(MOD_ID, "bean"),
|
||||||
@@ -1900,7 +1960,11 @@ public class Szar implements ModInitializer {
|
|||||||
new Identifier(MOD_ID, "beer"),
|
new Identifier(MOD_ID, "beer"),
|
||||||
new BeerItem(new Item.Settings().maxCount(16))
|
new BeerItem(new Item.Settings().maxCount(16))
|
||||||
);
|
);
|
||||||
|
public static final Item APRIL = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
new Identifier(MOD_ID, "april"),
|
||||||
|
new Item(new Item.Settings())
|
||||||
|
);
|
||||||
public static final SoundEvent BAITER =
|
public static final SoundEvent BAITER =
|
||||||
SoundEvent.of(new Identifier(MOD_ID, "baiter"));
|
SoundEvent.of(new Identifier(MOD_ID, "baiter"));
|
||||||
public static final Item BAITER_DISC = Registry.register(
|
public static final Item BAITER_DISC = Registry.register(
|
||||||
@@ -2307,5 +2371,23 @@ public class Szar implements ModInitializer {
|
|||||||
}
|
}
|
||||||
return players.size();
|
return players.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void grantAdvancement(PlayerEntity player, String advancement) {
|
||||||
|
if (!(player instanceof ServerPlayerEntity serverPlayer)) return;
|
||||||
|
MinecraftServer server = serverPlayer.getServer();
|
||||||
|
if (server == null) return;
|
||||||
|
|
||||||
|
var entry = server.getAdvancementLoader().get(new Identifier(Szar.MOD_ID, advancement));
|
||||||
|
if (entry == null) return;
|
||||||
|
|
||||||
|
net.minecraft.advancement.AdvancementProgress progress =
|
||||||
|
serverPlayer.getAdvancementTracker().getProgress(entry);
|
||||||
|
|
||||||
|
if (!progress.isDone()) {
|
||||||
|
for (String criterion : progress.getUnobtainedCriteria()) {
|
||||||
|
serverPlayer.getAdvancementTracker().grantCriterion(entry, criterion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
37
src/main/java/dev/tggamesyt/szar/mixin/JukeboxMixin.java
Normal file
37
src/main/java/dev/tggamesyt/szar/mixin/JukeboxMixin.java
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package dev.tggamesyt.szar.mixin;
|
||||||
|
|
||||||
|
import dev.tggamesyt.szar.Szar;
|
||||||
|
import net.minecraft.block.entity.JukeboxBlockEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(JukeboxBlockEntity.class)
|
||||||
|
public class JukeboxMixin {
|
||||||
|
|
||||||
|
@Inject(method = "startPlaying", at = @At("HEAD"))
|
||||||
|
private void szar_onDiscPlayed(CallbackInfo ci) {
|
||||||
|
JukeboxBlockEntity self =
|
||||||
|
(JukeboxBlockEntity)(Object)this;
|
||||||
|
|
||||||
|
if (self.getWorld() == null || self.getWorld().isClient) return;
|
||||||
|
|
||||||
|
ItemStack stack = self.getStack(0);
|
||||||
|
if (stack.isEmpty()) return;
|
||||||
|
|
||||||
|
// Check if the disc's identifier contains "szar"
|
||||||
|
Identifier id = Registries.ITEM.getId(stack.getItem());
|
||||||
|
if (!id.getNamespace().equals("szar")) return;
|
||||||
|
|
||||||
|
// Grant advancement to all nearby players
|
||||||
|
self.getWorld().getEntitiesByClass(
|
||||||
|
net.minecraft.entity.player.PlayerEntity.class,
|
||||||
|
new net.minecraft.util.math.Box(self.getPos()).expand(64),
|
||||||
|
p -> true
|
||||||
|
).forEach(p -> Szar.grantAdvancement(p, "crazy"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -152,5 +152,35 @@
|
|||||||
"block.szar.backrooms_light": "Light",
|
"block.szar.backrooms_light": "Light",
|
||||||
"entity.szar.smiler": "Smiler",
|
"entity.szar.smiler": "Smiler",
|
||||||
"item.szar.beer": "Beer",
|
"item.szar.beer": "Beer",
|
||||||
"effect.szar.drunk": "Drunk"
|
"effect.szar.drunk": "Drunk",
|
||||||
|
|
||||||
|
"item.szar.kebab": "Kebab",
|
||||||
|
"death.attack.fart": "%1$s was farted on by %2$s",
|
||||||
|
|
||||||
|
"advancement.szar.high.title": "Did I always have no hands?",
|
||||||
|
"advancement.szar.high.description": "Get high using weed.",
|
||||||
|
|
||||||
|
"advancement.szar.arrested.title": "Officer, I swear I didn't do anything!",
|
||||||
|
"advancement.szar.arrested.description": "Get arrested",
|
||||||
|
|
||||||
|
"advancement.szar.files.title": "I wonder if I'm in the files..",
|
||||||
|
"advancement.szar.files.description": "Read the Epstein files.",
|
||||||
|
|
||||||
|
"advancement.szar.nyan.title": "You are starting to annoy me!",
|
||||||
|
"advancement.szar.nyan.description": "Get near a Nyan Cat",
|
||||||
|
|
||||||
|
"advancement.szar.oi.title": "DO THE THING",
|
||||||
|
"advancement.szar.oi.description": "Play Firtana's sound",
|
||||||
|
|
||||||
|
"advancement.szar.crazy.title": "Crazy",
|
||||||
|
"advancement.szar.crazy.description": "Play a crazy music disc from the Szar Mod",
|
||||||
|
|
||||||
|
"advancement.szar.gamble.title": "Let's go gambling!",
|
||||||
|
"advancement.szar.gamble.description": "Gamble in a gambling machine.",
|
||||||
|
|
||||||
|
"advancement.szar.april.title": "I think you were used to be the other way, no?",
|
||||||
|
"advancement.szar.april.description": "Play the game on April 1st",
|
||||||
|
|
||||||
|
"advancement.szar.dontknow.title": "I think she doesn't know",
|
||||||
|
"advancement.szar.dontknow.description": "Ask a question from Merl"
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/main/resources/assets/szar/models/item/april.json
Normal file
6
src/main/resources/assets/szar/models/item/april.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "szar:item/april"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/main/resources/assets/szar/models/item/kebab.json
Normal file
6
src/main/resources/assets/szar/models/item/kebab.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "szar:item/kebab"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -226,5 +226,21 @@
|
|||||||
"stream": true
|
"stream": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"fart1": {
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "szar:fart1",
|
||||||
|
"stream": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"fart": {
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "szar:fart",
|
||||||
|
"stream": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
src/main/resources/assets/szar/sounds/fart.ogg
Normal file
BIN
src/main/resources/assets/szar/sounds/fart.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/szar/sounds/fart1.ogg
Normal file
BIN
src/main/resources/assets/szar/sounds/fart1.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/szar/textures/item/april.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/april.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 160 KiB |
BIN
src/main/resources/assets/szar/textures/item/kebab.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/kebab.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
15
src/main/resources/data/szar/advancements/april.json
Normal file
15
src/main/resources/data/szar/advancements/april.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "szar:april"
|
||||||
|
},
|
||||||
|
"title": {"translate": "advancement.szar.april.title"},
|
||||||
|
"description": {"translate": "advancement.szar.april.description"},
|
||||||
|
"show_toast": false
|
||||||
|
},
|
||||||
|
"criteria": {
|
||||||
|
"used_item": {
|
||||||
|
"trigger": "minecraft:impossible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/resources/data/szar/advancements/arrested.json
Normal file
15
src/main/resources/data/szar/advancements/arrested.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "szar:police_handcuff"
|
||||||
|
},
|
||||||
|
"title": {"translate": "advancement.szar.arrested.title"},
|
||||||
|
"description": {"translate": "advancement.szar.arrested.description"},
|
||||||
|
"show_toast": false
|
||||||
|
},
|
||||||
|
"criteria": {
|
||||||
|
"used_item": {
|
||||||
|
"trigger": "minecraft:impossible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/resources/data/szar/advancements/crazy.json
Normal file
15
src/main/resources/data/szar/advancements/crazy.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "szar:baiter"
|
||||||
|
},
|
||||||
|
"title": {"translate": "advancement.szar.crazy.title"},
|
||||||
|
"description": {"translate": "advancement.szar.crazy.description"},
|
||||||
|
"show_toast": true
|
||||||
|
},
|
||||||
|
"criteria": {
|
||||||
|
"used_item": {
|
||||||
|
"trigger": "minecraft:impossible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/resources/data/szar/advancements/dontknow.json
Normal file
15
src/main/resources/data/szar/advancements/dontknow.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "szar:merl_spawn_egg"
|
||||||
|
},
|
||||||
|
"title": {"translate": "advancement.szar.dontknow.title"},
|
||||||
|
"description": {"translate": "advancement.szar.dontknow.description"},
|
||||||
|
"show_toast": false
|
||||||
|
},
|
||||||
|
"criteria": {
|
||||||
|
"used_item": {
|
||||||
|
"trigger": "minecraft:impossible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/resources/data/szar/advancements/files.json
Normal file
15
src/main/resources/data/szar/advancements/files.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "szar:epstein_files"
|
||||||
|
},
|
||||||
|
"title": {"translate": "advancement.szar.files.title"},
|
||||||
|
"description": {"translate": "advancement.szar.files.description"},
|
||||||
|
"show_toast": true
|
||||||
|
},
|
||||||
|
"criteria": {
|
||||||
|
"used_item": {
|
||||||
|
"trigger": "minecraft:impossible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/resources/data/szar/advancements/gamble.json
Normal file
15
src/main/resources/data/szar/advancements/gamble.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "szar:slot_machine"
|
||||||
|
},
|
||||||
|
"title": {"translate": "advancement.szar.gamble.title"},
|
||||||
|
"description": {"translate": "advancement.szar.gamble.description"},
|
||||||
|
"show_toast": true
|
||||||
|
},
|
||||||
|
"criteria": {
|
||||||
|
"used_item": {
|
||||||
|
"trigger": "minecraft:impossible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/resources/data/szar/advancements/high.json
Normal file
15
src/main/resources/data/szar/advancements/high.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "szar:weed_joint"
|
||||||
|
},
|
||||||
|
"title": {"translate": "advancement.szar.high.title"},
|
||||||
|
"description": {"translate": "advancement.szar.high.description"},
|
||||||
|
"show_toast": true
|
||||||
|
},
|
||||||
|
"criteria": {
|
||||||
|
"used_item": {
|
||||||
|
"trigger": "minecraft:impossible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/resources/data/szar/advancements/nyan.json
Normal file
15
src/main/resources/data/szar/advancements/nyan.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "szar:pop_tart"
|
||||||
|
},
|
||||||
|
"title": {"translate": "advancement.szar.nyan.title"},
|
||||||
|
"description": {"translate": "advancement.szar.nyan.description"},
|
||||||
|
"show_toast": true
|
||||||
|
},
|
||||||
|
"criteria": {
|
||||||
|
"used_item": {
|
||||||
|
"trigger": "minecraft:impossible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/resources/data/szar/advancements/oi.json
Normal file
15
src/main/resources/data/szar/advancements/oi.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "szar:firtana"
|
||||||
|
},
|
||||||
|
"title": {"translate": "advancement.szar.oi.title"},
|
||||||
|
"description": {"translate": "advancement.szar.oi.description"},
|
||||||
|
"show_toast": false
|
||||||
|
},
|
||||||
|
"criteria": {
|
||||||
|
"used_item": {
|
||||||
|
"trigger": "minecraft:impossible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/main/resources/data/szar/damage_type/fart.json
Normal file
5
src/main/resources/data/szar/damage_type/fart.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"message_id": "fart",
|
||||||
|
"scaling": "never",
|
||||||
|
"exhaustion": 0.0
|
||||||
|
}
|
||||||
23
src/main/resources/data/szar/recipes/kebab.json
Normal file
23
src/main/resources/data/szar/recipes/kebab.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
" KB",
|
||||||
|
" BK",
|
||||||
|
"S "
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"S": {
|
||||||
|
"item": "minecraft:stick"
|
||||||
|
},
|
||||||
|
"B": {
|
||||||
|
"tag": "szar:cooked_meat"
|
||||||
|
},
|
||||||
|
"K": {
|
||||||
|
"item": "minecraft:kelp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"item": "szar:kebab",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/main/resources/data/szar/tags/items/cooked_meat.json
Normal file
12
src/main/resources/data/szar/tags/items/cooked_meat.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"minecraft:cooked_beef",
|
||||||
|
"minecraft:cooked_porkchop",
|
||||||
|
"minecraft:cooked_chicken",
|
||||||
|
"minecraft:cooked_mutton",
|
||||||
|
"minecraft:cooked_rabbit",
|
||||||
|
"minecraft:cooked_cod",
|
||||||
|
"minecraft:cooked_salmon"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
"mixins": [
|
"mixins": [
|
||||||
"CraftingScreenHandlerMixin",
|
"CraftingScreenHandlerMixin",
|
||||||
"CraftingScreenHandlerMixin2",
|
"CraftingScreenHandlerMixin2",
|
||||||
|
"JukeboxMixin",
|
||||||
"LevelSummaryMixin",
|
"LevelSummaryMixin",
|
||||||
"LivingEntityFallDamageMixin",
|
"LivingEntityFallDamageMixin",
|
||||||
"NoClipMixin",
|
"NoClipMixin",
|
||||||
|
|||||||
Reference in New Issue
Block a user