port to 1.21.8, and make it no longer only serverside

This commit is contained in:
Soph :3 2025-10-02 17:50:47 +03:00
parent ba0a6793de
commit d8c4281053
45 changed files with 297 additions and 443 deletions

View file

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'fabric-loom' version '1.11-SNAPSHOT'
id 'maven-publish'
}
@ -45,15 +45,6 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation include("eu.pb4:polymer-core:0.9.14+1.21.1")
modImplementation include("eu.pb4:polymer-resource-pack:0.9.14+1.21.1")
modImplementation include("eu.pb4:polymer-blocks:0.9.14+1.21.1")
modImplementation include("eu.pb4:polymer-virtual-entity:0.9.14+1.21.1")
modImplementation include("eu.pb4:factorytools:0.3.2+1.21")
modCompileOnly "maven.modrinth:polydex:1.2.3+1.21"
}
processResources {

View file

@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.5
minecraft_version=1.21.8
yarn_mappings=1.21.8+build.1
loader_version=0.17.2
# Mod Properties
mod_version=1.0-SNAPSHOT
mod_version=1.1
maven_group=sad.ovh
archives_base_name=weed
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.104.0+1.21.1
fabric_version=0.133.4+1.21.8

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View file

@ -0,0 +1,17 @@
package sad.ovh.weed;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.BlockRenderLayerMap;
import net.minecraft.client.render.BlockRenderLayer;
import net.minecraft.client.render.RenderLayer;
@Environment(EnvType.CLIENT)
public class ClientWeed implements ClientModInitializer {
public void onInitializeClient() {
BlockRenderLayerMap.putBlock(WeedBlocks.WEED_SEEDS_BLOCK, BlockRenderLayer.CUTOUT);
BlockRenderLayerMap.putBlock(WeedBlocks.ROLLING_PAPER_BLOCK, BlockRenderLayer.CUTOUT);
BlockRenderLayerMap.putBlock(WeedBlocks.TRAY_BLOCK, BlockRenderLayer.CUTOUT);
}
}

View file

@ -3,23 +3,14 @@ package sad.ovh.weed;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import eu.pb4.polymer.core.api.item.PolymerItemGroupUtils;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.fabricmc.api.ModInitializer;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.Items;
import net.minecraft.registry.RegistryKey;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import sad.ovh.weed.block.UVLampBlock;
public class Weed implements ModInitializer {
public static final String MOD_ID = "weed";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static final ItemGroup group = PolymerItemGroupUtils.builder().displayName(Text.literal("Weed Mod's Group"))
.icon(() -> Items.DIAMOND.getDefaultStack()).build();
public static RegistryKey<ItemGroup> groupKey;
@Override
public void onInitialize() {
String weedAscii = """
@ -51,11 +42,7 @@ public class Weed implements ModInitializer {
LOGGER.info("weed fabric mod");
LOGGER.info("by @fucksophie - est. Sept 11 2024");
PolymerResourcePackUtils.addModAssets(MOD_ID);
PolymerResourcePackUtils.markAsRequired();
PolymerItemGroupUtils.registerPolymerItemGroup(Identifier.of("weed"), group);
Weed.groupKey = PolymerItemGroupUtils.getKey(group);
// Register all blocks and items
WeedBlocks.register();
WeedItems.register();
}

View file

@ -2,7 +2,6 @@ package sad.ovh.weed;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.AbstractBlock.Settings;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.MapColor;
@ -10,8 +9,10 @@ import net.minecraft.block.enums.NoteBlockInstrument;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import sad.ovh.weed.block.RollingPaperBlock;
@ -33,31 +34,80 @@ public class WeedBlocks {
public static BlockItem UV_LAMP_ITEM;
public static BlockItem WEED_SEEDS_ITEM;
private static RegistryKey<Block> key(String name) {
return RegistryKey.of(Registries.BLOCK.getKey(), Identifier.of(Weed.MOD_ID, name));
}
private static RegistryKey<Item> itemKey(String name) {
return RegistryKey.of(Registries.ITEM.getKey(), Identifier.of(Weed.MOD_ID, name));
}
public static void register() {
ROLLING_PAPER_BLOCK = Registry.register(Registries.BLOCK, Identifier.of(Weed.MOD_ID, "rolling_paper"),
new RollingPaperBlock(AbstractBlock.Settings.copy(Blocks.GLASS).nonOpaque()));
TRAY_BLOCK = Registry.register(Registries.BLOCK, Identifier.of(Weed.MOD_ID, "tray"),
new TrayBlock(AbstractBlock.Settings.copy(Blocks.GLASS).nonOpaque()));
UV_LAMP_BLOCK = Registry.register(Registries.BLOCK, Identifier.of(Weed.MOD_ID, "uv_lamp"),
new UVLampBlock(Settings.create().breakInstantly().mapColor(MapColor.LAPIS_BLUE)
.instrument(NoteBlockInstrument.IRON_XYLOPHONE)
.sounds(BlockSoundGroup.GLASS).luminance((state) -> {
return 15;
}).noCollision()
.pistonBehavior(PistonBehavior.DESTROY)));
WEED_SEEDS_BLOCK = Registry.register(Registries.BLOCK, Identifier.of(Weed.MOD_ID, "weed_seeds"),
new WeedSeedsBlock(AbstractBlock.Settings.copy(Blocks.WHEAT)));
// Blocks
ROLLING_PAPER_BLOCK = Registry.register(
Registries.BLOCK,
key("rolling_paper"),
new RollingPaperBlock(AbstractBlock.Settings.copy(Blocks.GLASS)
.nonOpaque()
.registryKey(key("rolling_paper")))
);
ROLLING_PAPER_ITEM = Registry.register(Registries.ITEM, Identifier.of(Weed.MOD_ID, "rolling_paper"),
new RollingPaperBlockItem(new Item.Settings(), ROLLING_PAPER_BLOCK, "item/rolling_paper"));
TRAY_ITEM = Registry.register(Registries.ITEM, Identifier.of(Weed.MOD_ID, "tray"),
new TrayBlockItem(new Item.Settings(), TRAY_BLOCK, "item/tray"));
UV_LAMP_ITEM = Registry.register(Registries.ITEM, Identifier.of(Weed.MOD_ID, "uv_lamp"),
new UVLampBlockItem(new Item.Settings(), UV_LAMP_BLOCK, "item/uv_lamp"));
WEED_SEEDS_ITEM = Registry.register(Registries.ITEM, Identifier.of(Weed.MOD_ID, "weed_seeds"),
new WeedSeedsBlockItem(new Item.Settings(), WEED_SEEDS_BLOCK, "item/weed_seeds"));
TRAY_BLOCK = Registry.register(
Registries.BLOCK,
key("tray"),
new TrayBlock(AbstractBlock.Settings.copy(Blocks.GLASS)
.nonOpaque()
.registryKey(key("tray")))
);
ItemGroupEvents.modifyEntriesEvent(Weed.groupKey).register(content -> {
UV_LAMP_BLOCK = Registry.register(
Registries.BLOCK,
key("uv_lamp"),
new UVLampBlock(AbstractBlock.Settings.create()
.breakInstantly()
.mapColor(MapColor.LAPIS_BLUE)
.instrument(NoteBlockInstrument.IRON_XYLOPHONE)
.sounds(BlockSoundGroup.GLASS)
.luminance(state -> 15)
.noCollision()
.pistonBehavior(PistonBehavior.DESTROY)
.registryKey(key("uv_lamp")))
);
WEED_SEEDS_BLOCK = Registry.register(
Registries.BLOCK,
key("weed_seeds"),
new WeedSeedsBlock(AbstractBlock.Settings.copy(Blocks.WHEAT)
.registryKey(key("weed_seeds")))
);
// Items
ROLLING_PAPER_ITEM = Registry.register(
Registries.ITEM,
itemKey("rolling_paper"),
new RollingPaperBlockItem(ROLLING_PAPER_BLOCK, new Item.Settings().registryKey(itemKey("rolling_paper")))
);
TRAY_ITEM = Registry.register(
Registries.ITEM,
itemKey("tray"),
new TrayBlockItem(TRAY_BLOCK, new Item.Settings().registryKey(itemKey("tray")))
);
UV_LAMP_ITEM = Registry.register(
Registries.ITEM,
itemKey("uv_lamp"),
new UVLampBlockItem(UV_LAMP_BLOCK, new Item.Settings().registryKey(itemKey("uv_lamp")))
);
WEED_SEEDS_ITEM = Registry.register(
Registries.ITEM,
itemKey("weed_seeds"),
new WeedSeedsBlockItem(WEED_SEEDS_BLOCK, new Item.Settings().registryKey(itemKey("weed_seeds")))
);
// Add to creative tab
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK).register(content -> {
content.add(ROLLING_PAPER_ITEM);
content.add(TRAY_ITEM);
content.add(UV_LAMP_ITEM);

View file

@ -1,51 +1,61 @@
package sad.ovh.weed;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.component.type.ConsumableComponent;
import net.minecraft.component.type.ConsumableComponents;
import net.minecraft.component.type.FoodComponent;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.Item;
import net.minecraft.item.Item.Settings;
import net.minecraft.item.ItemGroups;
import net.minecraft.item.consume.ApplyEffectsConsumeEffect;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
import sad.ovh.weed.item.FilterItem;
import sad.ovh.weed.item.JointItem;
import sad.ovh.weed.item.WeedItem;
import java.util.function.Function;
public class WeedItems {
public static Item FILTER;
public static Item JOINT;
public static Item WEED;
public static void register() {
FoodComponent JointFoodComponent = new FoodComponent.Builder()
.alwaysEdible()
.statusEffect(new StatusEffectInstance(StatusEffects.HUNGER, 10 * 20, 2, false, true, true), 100)
.statusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 60 * 20, 1, false, true, true), 75)
.statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 10 * 20, 1, false, true, true), 75)
.statusEffect(new StatusEffectInstance(StatusEffects.HASTE, 5 * 20, 3, false, true, true), 40)
.build();
FILTER = Registry.register(Registries.ITEM, Identifier.of(Weed.MOD_ID, "filter"),
new FilterItem(new Settings()));
JOINT = Registry.register(Registries.ITEM, Identifier.of(Weed.MOD_ID, "joint"),
new JointItem(new Settings()
.rarity(Rarity.EPIC)
.food(JointFoodComponent)));
WEED = Registry.register(Registries.ITEM, Identifier.of(Weed.MOD_ID, "weed"),
new WeedItem(new Settings()));
ItemGroupEvents.modifyEntriesEvent(Weed.groupKey).register(
content -> {
content.add(FILTER);
content.add(JOINT);
content.add(WEED);
});
// 1.21+ helper
private static Item register(String name, Function<Settings, Item> itemFactory, Settings settings) {
RegistryKey<Item> itemKey = RegistryKey.of(Registries.ITEM.getKey(), Identifier.of(Weed.MOD_ID, name));
Item item = itemFactory.apply(settings.registryKey(itemKey));
return Registry.register(Registries.ITEM, itemKey, item);
}
}
public static void register() {
FoodComponent jointFood = new FoodComponent.Builder()
.alwaysEdible()
.build();
ConsumableComponent jointConsumable = ConsumableComponents.food()
.consumeEffect(new ApplyEffectsConsumeEffect(new StatusEffectInstance(StatusEffects.HUNGER, 10 * 20, 2), 1.0f))
.consumeEffect(new ApplyEffectsConsumeEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 60 * 20, 1), 0.75f))
.consumeEffect(new ApplyEffectsConsumeEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 10 * 20, 1), 0.75f))
.consumeEffect(new ApplyEffectsConsumeEffect(new StatusEffectInstance(StatusEffects.HASTE, 5 * 20, 3), 0.40f))
.build();
FILTER = register("filter", FilterItem::new, new Settings());
JOINT = register("joint", JointItem::new, new Settings()
.rarity(Rarity.EPIC)
.food(jointFood, jointConsumable));
WEED = register("weed", WeedItem::new, new Settings());
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK).register(content -> {
content.add(FILTER);
content.add(JOINT);
content.add(WEED);
});
}
}

View file

@ -1,14 +1,5 @@
package sad.ovh.weed.block;
import java.util.ArrayList;
import java.util.List;
import org.jetbrains.annotations.ApiStatus.OverrideOnly;
import eu.pb4.polymer.blocks.api.BlockModelType;
import eu.pb4.polymer.blocks.api.PolymerBlockModel;
import eu.pb4.polymer.blocks.api.PolymerBlockResourceUtils;
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
@ -16,57 +7,49 @@ import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.ItemActionResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.GameMode;
import net.minecraft.world.World;
import sad.ovh.weed.Weed;
import sad.ovh.weed.WeedBlocks;
public class RollingPaperBlock extends Block implements PolymerTexturedBlock {
private final List<BlockState> polymerBlockState = new ArrayList<BlockState>();
public class RollingPaperBlock extends Block {
public static final IntProperty PAPERS = IntProperty.of("papers", 1, 5);
public RollingPaperBlock(Settings settings) {
super(settings);
for (int i = 1; i <= 5; i++) {
this.polymerBlockState.add(PolymerBlockResourceUtils.requestBlock(BlockModelType.TRANSPARENT_BLOCK,
PolymerBlockModel.of(Identifier.of(Weed.MOD_ID, "block/papers_" + i))));
}
setDefaultState(getDefaultState().with(PAPERS, 1));
}
@OverrideOnly
protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos,
PlayerEntity player_fake,
Hand hand, BlockHitResult hit) {
ServerPlayerEntity player = (ServerPlayerEntity) player_fake;
@Override
protected ActionResult onUseWithItem(
ItemStack stack, BlockState state, World world, BlockPos pos,
PlayerEntity playerFake, Hand hand, BlockHitResult hit) {
if (!(playerFake instanceof ServerPlayerEntity player)) {
return ActionResult.PASS;
}
if (stack.getItem().equals(WeedBlocks.ROLLING_PAPER_ITEM)) {
Integer papers = state.get(PAPERS);
Integer papersIfAdded = papers + 1;
int papers = state.get(PAPERS);
int papersIfAdded = papers + 1;
if (papersIfAdded <= 5) {
world.setBlockState(pos, state.with(PAPERS, papersIfAdded));
if(player.interactionManager.getGameMode().equals(GameMode.SURVIVAL)) {
if (player.interactionManager.getGameMode().equals(GameMode.SURVIVAL)) {
stack.decrement(1);
player.setStackInHand(hand, stack);
}
return ItemActionResult.SUCCESS;
return ActionResult.SUCCESS;
}
}
return ItemActionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
return ActionResult.PASS;
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(PAPERS);
}
@Override
public BlockState getPolymerBlockState(BlockState state) {
return this.polymerBlockState.get(state.get(PAPERS) - 1);
}
}
}

View file

@ -1,25 +1,9 @@
package sad.ovh.weed.block;
import eu.pb4.polymer.blocks.api.BlockModelType;
import eu.pb4.polymer.blocks.api.PolymerBlockModel;
import eu.pb4.polymer.blocks.api.PolymerBlockResourceUtils;
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.util.Identifier;
import sad.ovh.weed.Weed;
public class TrayBlock extends Block implements PolymerTexturedBlock {
private final BlockState polymerBlockState;
public class TrayBlock extends Block {
public TrayBlock(Settings settings) {
super(settings);
this.polymerBlockState = PolymerBlockResourceUtils.requestBlock(BlockModelType.TRANSPARENT_BLOCK,
PolymerBlockModel.of(Identifier.of(Weed.MOD_ID, "block/tray")));
}
@Override
public BlockState getPolymerBlockState(BlockState state) {
return this.polymerBlockState;
}
}

View file

@ -1,51 +1,21 @@
package sad.ovh.weed.block;
import eu.pb4.polymer.blocks.api.BlockModelType;
import eu.pb4.polymer.blocks.api.PolymerBlockModel;
import eu.pb4.polymer.blocks.api.PolymerBlockResourceUtils;
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.MapColor;
import net.minecraft.block.enums.NoteBlockInstrument;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import sad.ovh.weed.Weed;
import sad.ovh.weed.block.items.UVLampBlockItem;
public class UVLampBlock extends Block implements PolymerTexturedBlock {
private final BlockState polymerBlockState;
public class UVLampBlock extends Block {
public UVLampBlock(Settings settings) {
super(settings);
this.polymerBlockState = PolymerBlockResourceUtils.requestBlock(BlockModelType.TRANSPARENT_BLOCK,
PolymerBlockModel.of(Identifier.of(Weed.MOD_ID, "block/uv_lamp")));
}
@Override
public BlockState getPolymerBlockState(BlockState state) {
return this.polymerBlockState;
}
public static void register() {
Identifier modId = Identifier.of(Weed.MOD_ID, "uv_lamp");
var block = Registry.register(Registries.BLOCK, modId,
new UVLampBlock(Settings.create().breakInstantly().mapColor(MapColor.LAPIS_BLUE)
.instrument(NoteBlockInstrument.IRON_XYLOPHONE)
.sounds(BlockSoundGroup.GLASS).luminance((state) -> {
return 15;
}).noCollision()
.pistonBehavior(PistonBehavior.DESTROY)));
Item item = Registry.register(Registries.ITEM, modId,
new UVLampBlockItem(new Item.Settings(), block, "item/uv_lamp"));
ItemGroupEvents.modifyEntriesEvent(Weed.groupKey).register(content -> content.add(item));
}
}
}

View file

@ -1,67 +1,48 @@
package sad.ovh.weed.block;
import java.util.ArrayList;
import java.util.List;
import eu.pb4.polymer.blocks.api.BlockModelType;
import eu.pb4.polymer.blocks.api.PolymerBlockModel;
import eu.pb4.polymer.blocks.api.PolymerBlockResourceUtils;
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.CropBlock;
import net.minecraft.item.ItemConvertible;
import net.minecraft.state.property.IntProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import sad.ovh.weed.Weed;
import sad.ovh.weed.WeedItems;
public class WeedSeedsBlock extends CropBlock implements PolymerTexturedBlock {
private final List<BlockState> polymerBlockState = new ArrayList<BlockState>();
public static final IntProperty AGE = Properties.AGE_1;
public class WeedSeedsBlock extends CropBlock {
// Use AGE_7 (07) for smoother crop stages instead of AGE_1
public static final IntProperty AGE = Properties.AGE_7;
public WeedSeedsBlock(Settings settings) {
super(settings);
for (int i = 1; i <= 3; i++) {
this.polymerBlockState.add(PolymerBlockResourceUtils.requestBlock(BlockModelType.PLANT_BLOCK,
PolymerBlockModel.of(Identifier.of(Weed.MOD_ID, "block/weed_seeds_" + i))));
}
setDefaultState(getDefaultState().with(AGE, 0));
}
@Override
public void applyGrowth(World world, BlockPos pos, BlockState state) {
if (world.getBaseLightLevel(pos, 0) < 9)
if (world.getBaseLightLevel(pos, 0) < 9) {
return;
}
int i = this.getAge(state) + this.getGrowthAmount(world);
int j = this.getMaxAge();
if (i > j) {
i = j;
}
world.setBlockState(pos, this.withAge(i), 2);
}
@Override
public BlockState getPolymerBlockState(BlockState state) {
Integer fakeAge = this.getAge(state);
Integer realAge = 0;
switch (fakeAge) {
case 0, 1, 2:
realAge = 0;
break;
case 3, 4, 5:
realAge = 1;
break;
case 6, 7:
realAge = 2;
break;
}
return this.polymerBlockState.get(realAge);
public IntProperty getAgeProperty() {
return AGE;
}
@Override
protected ItemConvertible getSeedsItem() {
return this;
public int getMaxAge() {
return 7; // AGE_7 has 8 stages (07)
}
}
@Override
protected ItemConvertible getSeedsItem() {
return this.asItem(); // returns the blocks item as seeds
}
}

View file

@ -1,35 +1,10 @@
package sad.ovh.weed.block.items;
import org.jetbrains.annotations.Nullable;
import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import sad.ovh.weed.Weed;
public class RollingPaperBlockItem extends BlockItem implements PolymerItem {
private final PolymerModelData polymerModel;
public RollingPaperBlockItem(Settings settings, Block block, String modelId) {
public class RollingPaperBlockItem extends BlockItem {
public RollingPaperBlockItem(Block block, Settings settings) {
super(block, settings);
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.PAPER,
Identifier.of(Weed.MOD_ID, "item/rolling_paper"));
}
@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.item();
}
@Override
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.value();
}
}

View file

@ -1,34 +1,10 @@
package sad.ovh.weed.block.items;
import org.jetbrains.annotations.Nullable;
import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import sad.ovh.weed.Weed;
public class TrayBlockItem extends BlockItem implements PolymerItem {
private final PolymerModelData polymerModel;
public TrayBlockItem(Settings settings, Block block, String modelId) {
public class TrayBlockItem extends BlockItem {
public TrayBlockItem(Block block, Settings settings) {
super(block, settings);
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.GLASS, Identifier.of(Weed.MOD_ID, "item/tray"));
}
@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.item();
}
@Override
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.value();
}
}

View file

@ -1,35 +1,10 @@
package sad.ovh.weed.block.items;
import org.jetbrains.annotations.Nullable;
import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import sad.ovh.weed.Weed;
public class UVLampBlockItem extends BlockItem implements PolymerItem {
private final PolymerModelData polymerModel;
public UVLampBlockItem(Settings settings, Block block, String modelId) {
public class UVLampBlockItem extends BlockItem {
public UVLampBlockItem(Block block, Settings settings) {
super(block, settings);
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.GLOWSTONE,
Identifier.of(Weed.MOD_ID, "item/uv_lamp"));
}
@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.item();
}
@Override
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.value();
}
}

View file

@ -1,35 +1,10 @@
package sad.ovh.weed.block.items;
import org.jetbrains.annotations.Nullable;
import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import sad.ovh.weed.Weed;
public class WeedSeedsBlockItem extends BlockItem implements PolymerItem {
private final PolymerModelData polymerModel;
public WeedSeedsBlockItem(Settings settings, Block block, String modelId) {
public class WeedSeedsBlockItem extends BlockItem {
public WeedSeedsBlockItem(Block block, Settings settings) {
super(block, settings);
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.WHEAT_SEEDS,
Identifier.of(Weed.MOD_ID, "item/weed_seeds"));
}
@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.item();
}
@Override
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.value();
}
}

View file

@ -1,33 +1,9 @@
package sad.ovh.weed.item;
import org.jetbrains.annotations.Nullable;
import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import sad.ovh.weed.Weed;
public class FilterItem extends Item implements PolymerItem {
private final PolymerModelData polymerModel;
public class FilterItem extends Item {
public FilterItem(Settings settings) {
super(settings);
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.BARRIER,
Identifier.of(Weed.MOD_ID, "item/filter"));
}
@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.item();
}
@Override
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.value();
}
}

View file

@ -1,33 +1,9 @@
package sad.ovh.weed.item;
import org.jetbrains.annotations.Nullable;
import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import sad.ovh.weed.Weed;
public class JointItem extends Item implements PolymerItem {
private final PolymerModelData polymerModel;
public class JointItem extends Item {
public JointItem(Settings settings) {
super(settings);
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.BARRIER,
Identifier.of(Weed.MOD_ID, "item/joint"));
}
@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.item();
}
@Override
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.value();
}
}
}

View file

@ -1,33 +1,9 @@
package sad.ovh.weed.item;
import org.jetbrains.annotations.Nullable;
import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import sad.ovh.weed.Weed;
public class WeedItem extends Item implements PolymerItem {
private final PolymerModelData polymerModel;
public class WeedItem extends Item {
public WeedItem(Settings settings) {
super(settings);
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.BARRIER,
Identifier.of(Weed.MOD_ID, "item/weed"));
}
@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.item();
}
@Override
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.polymerModel.value();
}
}
}

View file

@ -0,0 +1,9 @@
{
"variants": {
"papers=1": { "model": "weed:block/rolling_paper_1" },
"papers=2": { "model": "weed:block/rolling_paper_2" },
"papers=3": { "model": "weed:block/rolling_paper_3" },
"papers=4": { "model": "weed:block/rolling_paper_4" },
"papers=5": { "model": "weed:block/rolling_paper_5" }
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "weed:block/tray"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "weed:block/uv_lamp"
}
}
}

View file

@ -0,0 +1,12 @@
{
"variants": {
"age=0": { "model": "weed:block/weed_seeds_1" },
"age=1": { "model": "weed:block/weed_seeds_1" },
"age=2": { "model": "weed:block/weed_seeds_2" },
"age=3": { "model": "weed:block/weed_seeds_2" },
"age=4": { "model": "weed:block/weed_seeds_3" },
"age=5": { "model": "weed:block/weed_seeds_3" },
"age=6": { "model": "weed:block/weed_seeds_3" },
"age=7": { "model": "weed:block/weed_seeds_3" }
}
}

View file

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "weed:item/filter"
}
}

View file

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "weed:item/joint"
}
}

View file

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "weed:item/rolling_paper"
}
}

View file

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "weed:item/tray"
}
}

View file

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "weed:item/uv_lamp"
}
}

View file

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "weed:item/weed"
}
}

View file

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "weed:item/weed_seeds"
}
}

View file

@ -1,9 +1,9 @@
{
"item.weed.weed": "Weed",
"block.weed.weed_seeds": "Weed Seeds",
"block.weed.uv_lamp": "UV Grow Lamp",
"item.weed.weed_seeds": "Weed Seeds",
"item.weed.uv_lamp": "UV Grow Lamp",
"item.weed.joint": "Legendary J",
"item.weed.filter": "Filter",
"block.weed.tray": "Tray",
"block.weed.rolling_paper": "Rolling Paper"
"item.weed.tray": "Tray",
"item.weed.rolling_paper": "Rolling Paper"
}

View file

@ -1,6 +1,6 @@
{
"parent": "minecraft:block/crop",
"parent": "minecraft:block/cross",
"textures": {
"crop": "weed:block/weed_seeds_1"
"cross": "weed:block/weed_seeds_1"
}
}

View file

@ -1,6 +1,6 @@
{
"parent": "minecraft:block/crop",
"parent": "minecraft:block/cross",
"textures": {
"crop": "weed:block/weed_seeds_2"
"cross": "weed:block/weed_seeds_2"
}
}

View file

@ -1,6 +1,6 @@
{
"parent": "minecraft:block/crop",
"parent": "minecraft:block/cross",
"textures": {
"crop": "weed:block/weed_seeds_3"
"cross": "weed:block/weed_seeds_3"
}
}

View file

@ -6,15 +6,9 @@
"STS"
],
"key": {
"P": {
"item": "minecraft:paper"
},
"S": {
"item": "minecraft:sugar_cane"
},
"T": {
"item": "minecraft:string"
}
"P": "minecraft:paper",
"S": "minecraft:sugar_cane",
"T": "minecraft:string"
},
"result": {
"id": "weed:filter",

View file

@ -6,15 +6,9 @@
"PPP"
],
"key": {
"P": {
"item": "minecraft:paper"
},
"F": {
"item": "weed:filter"
},
"W": {
"item": "weed:weed"
}
"P": "minecraft:paper",
"F": "weed:filter",
"W": "weed:weed"
},
"result": {
"id": "weed:joint",

View file

@ -6,9 +6,7 @@
"PPP"
],
"key": {
"P": {
"item": "minecraft:paper"
}
"P": "minecraft:paper"
},
"result": {
"id": "weed:rolling_paper",

View file

@ -6,12 +6,8 @@
"GGG"
],
"key": {
"G": {
"item": "minecraft:glass"
},
"W": {
"item": "weed:weed"
}
"G": "minecraft:glass",
"W": "weed:weed"
},
"result": {
"id": "weed:tray",

View file

@ -6,15 +6,9 @@
"LEL"
],
"key": {
"D": {
"item": "minecraft:diamond"
},
"L": {
"item": "minecraft:lapis_block"
},
"E": {
"item": "minecraft:emerald"
}
"D": "minecraft:diamond",
"L": "minecraft:lapis_block",
"E": "minecraft:emerald"
},
"result": {
"id": "weed:uv_lamp",

View file

@ -6,12 +6,8 @@
"CSC"
],
"key": {
"C": {
"item": "minecraft:sugar_cane"
},
"S": {
"item": "minecraft:torchflower_seeds"
}
"C": "minecraft:sugar_cane",
"S": "minecraft:torchflower_seeds"
},
"result": {
"id": "weed:weed_seeds",

View file

@ -8,11 +8,14 @@
"contact": {},
"license": "GPL-3.0",
"icon": "assets/weed/icon.png",
"environment": "server",
"environment": "*",
"entrypoints": {
"main": [
"sad.ovh.weed.Weed"
]
],
"client": [
"sad.ovh.weed.ClientWeed"
]
},
"mixins": [
"weed.mixins.json",