diff --git a/src/client/java/dev/tggamesyt/szar/client/SzarClient.java b/src/client/java/dev/tggamesyt/szar/client/SzarClient.java index 04b8b33..9feb993 100644 --- a/src/client/java/dev/tggamesyt/szar/client/SzarClient.java +++ b/src/client/java/dev/tggamesyt/szar/client/SzarClient.java @@ -1,15 +1,22 @@ package dev.tggamesyt.szar.client; +import com.mojang.blaze3d.systems.RenderSystem; import dev.tggamesyt.szar.NiggerEntity; import dev.tggamesyt.szar.Szar; 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.rendering.v1.EntityModelLayerRegistry; 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.gui.screen.Screen; +import net.minecraft.client.render.*; import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.EntityModelLayers; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.MathHelper; public class SzarClient implements ClientModInitializer { @@ -31,5 +38,48 @@ public class SzarClient implements ClientModInitializer { Szar.NiggerEntityType, 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(); + } + }); + + } } diff --git a/src/main/java/dev/tggamesyt/szar/DrogEffect.java b/src/main/java/dev/tggamesyt/szar/DrogEffect.java new file mode 100644 index 0000000..fe00d83 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/DrogEffect.java @@ -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 + } +} diff --git a/src/main/java/dev/tggamesyt/szar/Szar.java b/src/main/java/dev/tggamesyt/szar/Szar.java index 59a187f..bebbb20 100644 --- a/src/main/java/dev/tggamesyt/szar/Szar.java +++ b/src/main/java/dev/tggamesyt/szar/Szar.java @@ -1,17 +1,20 @@ package dev.tggamesyt.szar; 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.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; import net.minecraft.advancement.Advancement; import net.minecraft.block.Block; import net.minecraft.block.Blocks; +import net.minecraft.block.TallPlantBlock; import net.minecraft.entity.EntityDimensions; import net.minecraft.entity.EntityType; import net.minecraft.entity.SpawnGroup; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.item.*; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.server.network.ServerPlayerEntity; @@ -32,8 +35,22 @@ public class Szar implements ModInitializer { public static final Block FASZ_BLOCK = new FaszBlock(); 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 public void onInitialize() { @@ -44,12 +61,6 @@ public class Szar implements ModInitializer { 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( Registries.BLOCK, @@ -57,13 +68,6 @@ public class Szar implements ModInitializer { 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( filterMessage(player, message) )); @@ -73,24 +77,73 @@ public class Szar implements ModInitializer { NiggerEntity.createAttributes() ); } -public static final Item NWORD_PASS = Registry.register( - Registries.ITEM, - new Identifier(MOD_ID, "nwordpass"), - new NwordPassItem(new Item.Settings()) - ); + 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( + Registries.ITEM, + new Identifier(MOD_ID, "nwordpass"), + new NwordPassItem(new Item.Settings()) + ); public static final EntityType NiggerEntityType = - Registry.register( - Registries.ENTITY_TYPE, - new Identifier("szar", "nigger"), - FabricEntityTypeBuilder - .create(SpawnGroup.CREATURE, NiggerEntity::new) - .dimensions(EntityDimensions.fixed(0.6F, 1.8F)) // player-sized - .build() - ); + Registry.register( + Registries.ENTITY_TYPE, + new Identifier(MOD_ID, "nigger"), + FabricEntityTypeBuilder + .create(SpawnGroup.CREATURE, NiggerEntity::new) + .dimensions(EntityDimensions.fixed(0.6F, 1.8F)) // player-sized + .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 FORBIDDEN_WORDS = List.of( "nigger", "niger", - "niga" + "niga", + "nigga", + "neger", + "néger" ); private static Text filterMessage(ServerPlayerEntity player, Text original) { @@ -134,7 +187,7 @@ public static final Item NWORD_PASS = Registry.register( Advancement advancement = player .getServer() .getAdvancementLoader() - .get(new Identifier("szar", "nwordpass")); + .get(new Identifier(MOD_ID, "nwordpass")); if (advancement == null) return false; diff --git a/src/main/resources/assets/szar/blockstates/cannabis.json b/src/main/resources/assets/szar/blockstates/cannabis.json new file mode 100644 index 0000000..a9f2159 --- /dev/null +++ b/src/main/resources/assets/szar/blockstates/cannabis.json @@ -0,0 +1,6 @@ +{ + "variants": { + "half=lower": { "model": "szar:block/cannabis_bottom" }, + "half=upper": { "model": "szar:block/cannabis" } + } +} diff --git a/src/main/resources/assets/szar/lang/en_us.json b/src/main/resources/assets/szar/lang/en_us.json index 56a85d0..208b653 100644 --- a/src/main/resources/assets/szar/lang/en_us.json +++ b/src/main/resources/assets/szar/lang/en_us.json @@ -2,5 +2,10 @@ "block.szar.cigany": "Cigány Block", "block.szar.fasz": "Fasz", "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" } diff --git a/src/main/resources/assets/szar/models/block/cannabis.json b/src/main/resources/assets/szar/models/block/cannabis.json new file mode 100644 index 0000000..3d16f6f --- /dev/null +++ b/src/main/resources/assets/szar/models/block/cannabis.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "szar:block/cannabis" + } +} diff --git a/src/main/resources/assets/szar/models/block/cannabis_bottom.json b/src/main/resources/assets/szar/models/block/cannabis_bottom.json new file mode 100644 index 0000000..67fcdf7 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/cannabis_bottom.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "szar:block/cannabis_bottom" + } +} diff --git a/src/main/resources/assets/szar/models/item/cannabis.json b/src/main/resources/assets/szar/models/item/cannabis.json new file mode 100644 index 0000000..504fdd2 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/cannabis.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "szar:block/cannabis" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/item/nigger_spawn_egg.json b/src/main/resources/assets/szar/models/item/nigger_spawn_egg.json new file mode 100644 index 0000000..ddd1559 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/nigger_spawn_egg.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:item/template_spawn_egg" +} diff --git a/src/main/resources/assets/szar/models/item/weed.json b/src/main/resources/assets/szar/models/item/weed.json new file mode 100644 index 0000000..dd8e73e --- /dev/null +++ b/src/main/resources/assets/szar/models/item/weed.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "szar:item/weed" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/textures/block/cannabis.png b/src/main/resources/assets/szar/textures/block/cannabis.png new file mode 100644 index 0000000..4424dfe Binary files /dev/null and b/src/main/resources/assets/szar/textures/block/cannabis.png differ diff --git a/src/main/resources/assets/szar/textures/block/cannabis_bottom.png b/src/main/resources/assets/szar/textures/block/cannabis_bottom.png new file mode 100644 index 0000000..5367fd9 Binary files /dev/null and b/src/main/resources/assets/szar/textures/block/cannabis_bottom.png differ diff --git a/src/main/resources/assets/szar/textures/item/weed.png b/src/main/resources/assets/szar/textures/item/weed.png new file mode 100644 index 0000000..d222e9f Binary files /dev/null and b/src/main/resources/assets/szar/textures/item/weed.png differ diff --git a/src/main/resources/data/szar/loot_tables/blocks/cannabis.json b/src/main/resources/data/szar/loot_tables/blocks/cannabis.json new file mode 100644 index 0000000..d871b40 --- /dev/null +++ b/src/main/resources/data/szar/loot_tables/blocks/cannabis.json @@ -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 + } + ] + } + ] + } + ] +} diff --git a/src/main/resources/data/szar/recipes/weed.json b/src/main/resources/data/szar/recipes/weed.json new file mode 100644 index 0000000..20b2003 --- /dev/null +++ b/src/main/resources/data/szar/recipes/weed.json @@ -0,0 +1,9 @@ +{ + "type": "minecraft:smelting", + "ingredient": { + "item": "szar:cannabis" + }, + "result": "szar:weed", + "experience": 0.67, + "cookingtime": 100 +}