weed
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
10
src/main/java/dev/tggamesyt/szar/DrogEffect.java
Normal file
10
src/main/java/dev/tggamesyt/szar/DrogEffect.java
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -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,7 +77,42 @@ public class Szar implements ModInitializer {
|
||||
NiggerEntity.createAttributes()
|
||||
);
|
||||
}
|
||||
public static final Item NWORD_PASS = Registry.register(
|
||||
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())
|
||||
@@ -81,16 +120,30 @@ public static final Item NWORD_PASS = Registry.register(
|
||||
public static final EntityType<NiggerEntity> NiggerEntityType =
|
||||
Registry.register(
|
||||
Registries.ENTITY_TYPE,
|
||||
new Identifier("szar", "nigger"),
|
||||
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<String> 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;
|
||||
|
||||
|
||||
6
src/main/resources/assets/szar/blockstates/cannabis.json
Normal file
6
src/main/resources/assets/szar/blockstates/cannabis.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"variants": {
|
||||
"half=lower": { "model": "szar:block/cannabis_bottom" },
|
||||
"half=upper": { "model": "szar:block/cannabis" }
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:block/cross",
|
||||
"textures": {
|
||||
"cross": "szar:block/cannabis"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:block/cross",
|
||||
"textures": {
|
||||
"cross": "szar:block/cannabis_bottom"
|
||||
}
|
||||
}
|
||||
6
src/main/resources/assets/szar/models/item/cannabis.json
Normal file
6
src/main/resources/assets/szar/models/item/cannabis.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "szar:block/cannabis"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "minecraft:item/template_spawn_egg"
|
||||
}
|
||||
6
src/main/resources/assets/szar/models/item/weed.json
Normal file
6
src/main/resources/assets/szar/models/item/weed.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "szar:item/weed"
|
||||
}
|
||||
}
|
||||
BIN
src/main/resources/assets/szar/textures/block/cannabis.png
Normal file
BIN
src/main/resources/assets/szar/textures/block/cannabis.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 453 B |
Binary file not shown.
|
After Width: | Height: | Size: 508 B |
BIN
src/main/resources/assets/szar/textures/item/weed.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/weed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 295 B |
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
9
src/main/resources/data/szar/recipes/weed.json
Normal file
9
src/main/resources/data/szar/recipes/weed.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"type": "minecraft:smelting",
|
||||
"ingredient": {
|
||||
"item": "szar:cannabis"
|
||||
},
|
||||
"result": "szar:weed",
|
||||
"experience": 0.67,
|
||||
"cookingtime": 100
|
||||
}
|
||||
Reference in New Issue
Block a user