This commit is contained in:
2026-01-06 09:34:15 +01:00
parent eb234ed4d4
commit f92fa58b70
15 changed files with 235 additions and 33 deletions

View File

@@ -1,15 +1,22 @@
package dev.tggamesyt.szar.client; package dev.tggamesyt.szar.client;
import com.mojang.blaze3d.systems.RenderSystem;
import dev.tggamesyt.szar.NiggerEntity; import dev.tggamesyt.szar.NiggerEntity;
import dev.tggamesyt.szar.Szar; import dev.tggamesyt.szar.Szar;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.render.*;
import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.render.entity.model.EntityModelLayers; import net.minecraft.client.render.entity.model.EntityModelLayers;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
public class SzarClient implements ClientModInitializer { public class SzarClient implements ClientModInitializer {
@@ -31,5 +38,48 @@ public class SzarClient implements ClientModInitializer {
Szar.NiggerEntityType, Szar.NiggerEntityType,
NiggerEntityRenderer::new NiggerEntityRenderer::new
); );
BlockRenderLayerMap.INSTANCE.putBlock(
Szar.CANNABIS_BLOCK,
RenderLayer.getCutout()
);
WorldRenderEvents.AFTER_TRANSLUCENT.register(context -> {
MinecraftClient client = MinecraftClient.getInstance();
if (client.player != null && client.player.hasStatusEffect(Szar.DROG_EFFECT)) {
float time = client.player.age + client.getTickDelta();
float hue = (time * 0.01f) % 1f;
int rgb = MathHelper.hsvToRgb(hue, 1f, 1f);
float alpha = 0.25f;
float r = ((rgb >> 16) & 0xFF) / 255f;
float g = ((rgb >> 8) & 0xFF) / 255f;
float b = (rgb & 0xFF) / 255f;
int width = client.getWindow().getFramebufferWidth();
int height = client.getWindow().getFramebufferHeight();
RenderSystem.disableDepthTest();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
// ✅ Correct shader for 1.20.1 colored quads
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
buffer.vertex(0, height, 0).color(r, g, b, alpha).next();
buffer.vertex(width, height, 0).color(r, g, b, alpha).next();
buffer.vertex(width, 0, 0).color(r, g, b, alpha).next();
buffer.vertex(0, 0, 0).color(r, g, b, alpha).next();
Tessellator.getInstance().draw();
RenderSystem.disableBlend();
RenderSystem.enableDepthTest();
}
});
} }
} }

View File

@@ -0,0 +1,10 @@
package dev.tggamesyt.szar;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
public class DrogEffect extends StatusEffect {
public DrogEffect() {
super(StatusEffectCategory.HARMFUL, 0x5C4033); // white as default color
}
}

View File

@@ -1,17 +1,20 @@
package dev.tggamesyt.szar; package dev.tggamesyt.szar;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.fabricmc.fabric.api.message.v1.ServerMessageDecoratorEvent; import net.fabricmc.fabric.api.message.v1.ServerMessageDecoratorEvent;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
import net.minecraft.advancement.Advancement; import net.minecraft.advancement.Advancement;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.TallPlantBlock;
import net.minecraft.entity.EntityDimensions; import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.SpawnGroup;
import net.minecraft.item.BlockItem; import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.item.Item; import net.minecraft.item.*;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
@@ -32,8 +35,22 @@ public class Szar implements ModInitializer {
public static final Block FASZ_BLOCK = public static final Block FASZ_BLOCK =
new FaszBlock(); new FaszBlock();
public static final Identifier NWORDPACKET = public static final Identifier NWORDPACKET =
new Identifier("szar", "nwordpacket"); new Identifier(MOD_ID, "nwordpacket");
public static final ItemGroup SZAR_GROUP = Registry.register(
Registries.ITEM_GROUP,
new Identifier("modid", "szar_group"),
FabricItemGroup.builder()
.displayName(Text.translatable("itemgroup.szar_group"))
.icon(() -> new ItemStack(Szar.CIGANYBLOCK)) // icon item
.entries((displayContext, entries) -> {
entries.add(Szar.CIGANYBLOCK);
entries.add(Szar.FASZITEM);
entries.add(Szar.NWORD_PASS);
entries.add(Szar.NIGGER_SPAWNEGG);
entries.add(Szar.CANNABIS_ITEM);
})
.build()
);
@Override @Override
public void onInitialize() { public void onInitialize() {
@@ -44,12 +61,6 @@ public class Szar implements ModInitializer {
SZAR_BLOCK SZAR_BLOCK
); );
// register item so you can hold it
Registry.register(
Registries.ITEM,
new Identifier(MOD_ID, "cigany"),
new BlockItem(SZAR_BLOCK, new Item.Settings())
);
Registry.register( Registry.register(
Registries.BLOCK, Registries.BLOCK,
@@ -57,13 +68,6 @@ public class Szar implements ModInitializer {
FASZ_BLOCK FASZ_BLOCK
); );
// register item so you can hold it
Registry.register(
Registries.ITEM,
new Identifier(MOD_ID, "fasz"),
new FaszItem(FASZ_BLOCK, new Item.Settings())
);
ServerMessageDecoratorEvent.EVENT.register((player, message) -> CompletableFuture.completedFuture( ServerMessageDecoratorEvent.EVENT.register((player, message) -> CompletableFuture.completedFuture(
filterMessage(player, message) filterMessage(player, message)
)); ));
@@ -73,6 +77,41 @@ public class Szar implements ModInitializer {
NiggerEntity.createAttributes() NiggerEntity.createAttributes()
); );
} }
public static final StatusEffect DROG_EFFECT = Registry.register(
Registries.STATUS_EFFECT,
new Identifier(MOD_ID, "drog"),
new DrogEffect()
);
public static final Block CANNABIS_BLOCK = Registry.register(
Registries.BLOCK,
new Identifier(MOD_ID, "cannabis"),
new TallPlantBlock(
FabricBlockSettings.copyOf(Blocks.LARGE_FERN)
)
);
public static final Item CANNABIS_ITEM = Registry.register(
Registries.ITEM,
new Identifier(MOD_ID, "cannabis"),
new BlockItem(
CANNABIS_BLOCK,
new Item.Settings()
)
);
public static final Item WEED_ITEM = Registry.register(
Registries.ITEM,
new Identifier(MOD_ID, "weed"),
new Item(new Item.Settings())
);
public static final Item CIGANYBLOCK = Registry.register(
Registries.ITEM,
new Identifier(MOD_ID, "cigany"),
new BlockItem(SZAR_BLOCK, new Item.Settings())
);
public static final Item FASZITEM = Registry.register(
Registries.ITEM,
new Identifier(MOD_ID, "fasz"),
new FaszItem(FASZ_BLOCK, new Item.Settings())
);
public static final Item NWORD_PASS = Registry.register( public static final Item NWORD_PASS = Registry.register(
Registries.ITEM, Registries.ITEM,
new Identifier(MOD_ID, "nwordpass"), new Identifier(MOD_ID, "nwordpass"),
@@ -81,16 +120,30 @@ public static final Item NWORD_PASS = Registry.register(
public static final EntityType<NiggerEntity> NiggerEntityType = public static final EntityType<NiggerEntity> NiggerEntityType =
Registry.register( Registry.register(
Registries.ENTITY_TYPE, Registries.ENTITY_TYPE,
new Identifier("szar", "nigger"), new Identifier(MOD_ID, "nigger"),
FabricEntityTypeBuilder FabricEntityTypeBuilder
.create(SpawnGroup.CREATURE, NiggerEntity::new) .create(SpawnGroup.CREATURE, NiggerEntity::new)
.dimensions(EntityDimensions.fixed(0.6F, 1.8F)) // player-sized .dimensions(EntityDimensions.fixed(0.6F, 1.8F)) // player-sized
.build() .build()
); );
public static final Item NIGGER_SPAWNEGG = Registry.register(
Registries.ITEM,
new Identifier(MOD_ID, "nigger_spawn_egg"),
new SpawnEggItem(
NiggerEntityType,
0x964B00,
0x654321,
new Item.Settings()
)
);
private static final List<String> FORBIDDEN_WORDS = List.of( private static final List<String> FORBIDDEN_WORDS = List.of(
"nigger", "nigger",
"niger", "niger",
"niga" "niga",
"nigga",
"neger",
"néger"
); );
private static Text filterMessage(ServerPlayerEntity player, Text original) { private static Text filterMessage(ServerPlayerEntity player, Text original) {
@@ -134,7 +187,7 @@ public static final Item NWORD_PASS = Registry.register(
Advancement advancement = player Advancement advancement = player
.getServer() .getServer()
.getAdvancementLoader() .getAdvancementLoader()
.get(new Identifier("szar", "nwordpass")); .get(new Identifier(MOD_ID, "nwordpass"));
if (advancement == null) return false; if (advancement == null) return false;

View File

@@ -0,0 +1,6 @@
{
"variants": {
"half=lower": { "model": "szar:block/cannabis_bottom" },
"half=upper": { "model": "szar:block/cannabis" }
}
}

View File

@@ -2,5 +2,10 @@
"block.szar.cigany": "Cigány Block", "block.szar.cigany": "Cigány Block",
"block.szar.fasz": "Fasz", "block.szar.fasz": "Fasz",
"item.szar.nwordpass": "N-Word Pass", "item.szar.nwordpass": "N-Word Pass",
"entity.szar.nigger": "Nigger" "entity.szar.nigger": "Nigger",
"item.szar.nigger_spawn_egg":"Nigger Spawn Egg",
"itemgroup.szar_group": "Szar",
"block.szar.cannabis": "Cannabis",
"item.szar.weed": "Weed",
"effect.szar.drog": "Drog"
} }

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cross",
"textures": {
"cross": "szar:block/cannabis"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cross",
"textures": {
"cross": "szar:block/cannabis_bottom"
}
}

View File

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

View File

@@ -0,0 +1,3 @@
{
"parent": "minecraft:item/template_spawn_egg"
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

View File

@@ -0,0 +1,42 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "szar:cannabis"
}
],
"conditions": [
{
"condition": "minecraft:any_of",
"terms": [
{
"condition": "minecraft:match_tool",
"predicate": {
"items": ["minecraft:shears"]
}
},
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": { "min": 1 }
}
]
}
},
{
"condition": "minecraft:random_chance",
"chance": 0.5
}
]
}
]
}
]
}

View File

@@ -0,0 +1,9 @@
{
"type": "minecraft:smelting",
"ingredient": {
"item": "szar:cannabis"
},
"result": "szar:weed",
"experience": 0.67,
"cookingtime": 100
}