uj
This commit is contained in:
67
src/main/java/dev/tggamesyt/szar/Joint.java
Normal file
67
src/main/java/dev/tggamesyt/szar/Joint.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package dev.tggamesyt.szar.items;
|
||||
|
||||
import dev.tggamesyt.szar.Szar;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.SpyglassItem;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.stat.Stats;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.UseAction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Joint extends SpyglassItem {
|
||||
|
||||
public Joint(Settings settings) {
|
||||
super(settings.maxDamage(64)); // max durability
|
||||
}
|
||||
|
||||
@Override
|
||||
public UseAction getUseAction(ItemStack stack) {
|
||||
return UseAction.SPYGLASS; // keeps spyglass hold animation
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxUseTime(ItemStack stack) {
|
||||
return 40; // shorter “smoking” duration
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||
// play custom smoke sound
|
||||
user.playSound(SoundEvents.ITEM_HONEY_BOTTLE_DRINK, 1.0F, 1.0F);
|
||||
user.incrementStat(Stats.USED.getOrCreateStat(this));
|
||||
user.setCurrentHand(hand); // start using
|
||||
return TypedActionResult.consume(user.getStackInHand(hand));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) {
|
||||
// Only do server/client side durability and effect
|
||||
if (!world.isClient) return;
|
||||
|
||||
// Consume 1 durability
|
||||
stack.damage(1, user, p -> p.sendToolBreakStatus(user.getActiveHand()));
|
||||
|
||||
// Increase drug effect
|
||||
int amplifier = 0;
|
||||
if (user.hasStatusEffect(Szar.DROG_EFFECT)) {
|
||||
amplifier = Math.min(user.getStatusEffect(Szar.DROG_EFFECT).getAmplifier() + 1, 9); // max 10 levels
|
||||
}
|
||||
|
||||
// Apply the effect (10 seconds, invisible particles)
|
||||
user.addStatusEffect(new net.minecraft.entity.effect.StatusEffectInstance(
|
||||
Szar.DROG_EFFECT,
|
||||
6000,
|
||||
amplifier,
|
||||
false, // ambient
|
||||
false, // show particles
|
||||
true // show icon
|
||||
));
|
||||
|
||||
// Optional: play inhale / stop sound
|
||||
user.playSound(SoundEvents.ITEM_HONEY_BOTTLE_DRINK, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package dev.tggamesyt.szar;
|
||||
|
||||
import dev.tggamesyt.szar.items.Joint;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
|
||||
import net.fabricmc.fabric.api.message.v1.ServerMessageDecoratorEvent;
|
||||
@@ -38,7 +39,7 @@ public class Szar implements ModInitializer {
|
||||
new Identifier(MOD_ID, "nwordpacket");
|
||||
public static final ItemGroup SZAR_GROUP = Registry.register(
|
||||
Registries.ITEM_GROUP,
|
||||
new Identifier("modid", "szar_group"),
|
||||
new Identifier(MOD_ID, "szar_group"),
|
||||
FabricItemGroup.builder()
|
||||
.displayName(Text.translatable("itemgroup.szar_group"))
|
||||
.icon(() -> new ItemStack(Szar.CIGANYBLOCK)) // icon item
|
||||
@@ -49,6 +50,7 @@ public class Szar implements ModInitializer {
|
||||
entries.add(Szar.NIGGER_SPAWNEGG);
|
||||
entries.add(Szar.CANNABIS_ITEM);
|
||||
entries.add(Szar.WEED_ITEM);
|
||||
entries.add(Szar.WEED_JOINT_ITEM);
|
||||
})
|
||||
.build()
|
||||
);
|
||||
@@ -103,6 +105,11 @@ public class Szar implements ModInitializer {
|
||||
new Identifier(MOD_ID, "weed"),
|
||||
new Item(new Item.Settings())
|
||||
);
|
||||
public static final Item WEED_JOINT_ITEM = Registry.register(
|
||||
Registries.ITEM,
|
||||
new Identifier(MOD_ID, "weed_joint"),
|
||||
new Joint(new Item.Settings())
|
||||
);
|
||||
public static final Item CIGANYBLOCK = Registry.register(
|
||||
Registries.ITEM,
|
||||
new Identifier(MOD_ID, "cigany"),
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
"itemgroup.szar_group": "Szar",
|
||||
"block.szar.cannabis": "Cannabis",
|
||||
"item.szar.weed": "Weed",
|
||||
"effect.szar.drog": "Drog"
|
||||
"effect.szar.drog": "Drog",
|
||||
"item.szar.weed_joint": "Weed Joint"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"format_version": "1.9.0",
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "szar:item/joint3d",
|
||||
"particle": "szar:item/joint3d"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [7, 0, 7],
|
||||
"to": [9, 12, 9],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 7]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 2, 12], "texture": "#0"},
|
||||
"east": {"uv": [2, 0, 4, 12], "texture": "#0"},
|
||||
"south": {"uv": [4, 0, 6, 12], "texture": "#0"},
|
||||
"west": {"uv": [6, 0, 8, 12], "texture": "#0"},
|
||||
"up": {"uv": [10, 2, 8, 0], "texture": "#0"},
|
||||
"down": {"uv": [10, 2, 8, 4], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [90, 0, 0],
|
||||
"translation": [-6, -1.5, 0]
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/main/resources/assets/szar/models/item/weed_joint.json
Normal file
16
src/main/resources/assets/szar/models/item/weed_joint.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "szar:item/weed_joint"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": { "held": 1 },
|
||||
"model": "szar:item/weed_join_3d"
|
||||
},
|
||||
{
|
||||
"predicate": { "using": 1 },
|
||||
"model": "szar:item/weed_joint_held"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"format_version": "1.9.0",
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "szar:item/joint3d",
|
||||
"particle": "szar:item/joint3d"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [7, 0, 7],
|
||||
"to": [9, 12, 9],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 7]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 2, 12], "texture": "#0"},
|
||||
"east": {"uv": [2, 0, 4, 12], "texture": "#0"},
|
||||
"south": {"uv": [4, 0, 6, 12], "texture": "#0"},
|
||||
"west": {"uv": [6, 0, 8, 12], "texture": "#0"},
|
||||
"up": {"uv": [10, 2, 8, 0], "texture": "#0"},
|
||||
"down": {"uv": [10, 2, 8, 4], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"using": 1
|
||||
},
|
||||
"model": "szar:item/weed_joint_held"
|
||||
}
|
||||
],
|
||||
"display": {}
|
||||
}
|
||||
BIN
src/main/resources/assets/szar/textures/item/joint3d.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/joint3d.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 177 B |
BIN
src/main/resources/assets/szar/textures/item/weed_joint.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/weed_joint.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 344 B |
BIN
src/main/resources/assets/szar/textures/item/weed_joint1.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/weed_joint1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 326 B |
BIN
src/main/resources/assets/szar/textures/mob_effect/drog.png
Normal file
BIN
src/main/resources/assets/szar/textures/mob_effect/drog.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 344 B |
20
src/main/resources/data/szar/recipes/weed_joint.json
Normal file
20
src/main/resources/data/szar/recipes/weed_joint.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"WP ",
|
||||
"PWP",
|
||||
" PW"
|
||||
],
|
||||
"key": {
|
||||
"W": {
|
||||
"item": "szar:weed"
|
||||
},
|
||||
"P": {
|
||||
"item": "minecraft:paper"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "szar:weed_joint",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
"license": "All-Rights-Reserved",
|
||||
"icon": "assets/szar/icon.png",
|
||||
"environment": "*",
|
||||
"accessWidener" : "szar.accesswidener",
|
||||
"entrypoints": {
|
||||
"fabric-datagen": [
|
||||
"dev.tggamesyt.szar.client.SzarDataGenerator"
|
||||
|
||||
3
src/main/resources/szar.accesswidener
Normal file
3
src/main/resources/szar.accesswidener
Normal file
@@ -0,0 +1,3 @@
|
||||
accessWidener v2 named
|
||||
|
||||
accessible field net/minecraft/client/gui/hud/InGameHud spyglassScale F
|
||||
Reference in New Issue
Block a user