port to 1.21.8, and make it no longer only serverside
This commit is contained in:
parent
ba0a6793de
commit
d8c4281053
45 changed files with 297 additions and 443 deletions
11
build.gradle
11
build.gradle
|
|
@ -1,5 +1,5 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.7-SNAPSHOT'
|
id 'fabric-loom' version '1.11-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,15 +45,6 @@ dependencies {
|
||||||
|
|
||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
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 {
|
processResources {
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.21.1
|
minecraft_version=1.21.8
|
||||||
yarn_mappings=1.21.1+build.3
|
yarn_mappings=1.21.8+build.1
|
||||||
loader_version=0.16.5
|
loader_version=0.17.2
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.0-SNAPSHOT
|
mod_version=1.1
|
||||||
maven_group=sad.ovh
|
maven_group=sad.ovh
|
||||||
archives_base_name=weed
|
archives_base_name=weed
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# check this on https://modmuss50.me/fabric.html
|
# check this on https://modmuss50.me/fabric.html
|
||||||
fabric_version=0.104.0+1.21.1
|
fabric_version=0.133.4+1.21.8
|
||||||
|
|
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
|
||||||
17
src/client/java/sad/ovh/weed/ClientWeed.java
Normal file
17
src/client/java/sad/ovh/weed/ClientWeed.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,23 +3,14 @@ package sad.ovh.weed;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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.fabricmc.api.ModInitializer;
|
||||||
import net.minecraft.item.ItemGroup;
|
import sad.ovh.weed.block.UVLampBlock;
|
||||||
import net.minecraft.item.Items;
|
|
||||||
import net.minecraft.registry.RegistryKey;
|
|
||||||
import net.minecraft.text.Text;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
|
|
||||||
public class Weed implements ModInitializer {
|
public class Weed implements ModInitializer {
|
||||||
|
|
||||||
public static final String MOD_ID = "weed";
|
public static final String MOD_ID = "weed";
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
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
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
String weedAscii = """
|
String weedAscii = """
|
||||||
|
|
@ -51,11 +42,7 @@ public class Weed implements ModInitializer {
|
||||||
LOGGER.info("weed fabric mod");
|
LOGGER.info("weed fabric mod");
|
||||||
LOGGER.info("by @fucksophie - est. Sept 11 2024");
|
LOGGER.info("by @fucksophie - est. Sept 11 2024");
|
||||||
|
|
||||||
PolymerResourcePackUtils.addModAssets(MOD_ID);
|
// Register all blocks and items
|
||||||
PolymerResourcePackUtils.markAsRequired();
|
|
||||||
PolymerItemGroupUtils.registerPolymerItemGroup(Identifier.of("weed"), group);
|
|
||||||
Weed.groupKey = PolymerItemGroupUtils.getKey(group);
|
|
||||||
|
|
||||||
WeedBlocks.register();
|
WeedBlocks.register();
|
||||||
WeedItems.register();
|
WeedItems.register();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package sad.ovh.weed;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||||
import net.minecraft.block.AbstractBlock;
|
import net.minecraft.block.AbstractBlock;
|
||||||
import net.minecraft.block.AbstractBlock.Settings;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.MapColor;
|
import net.minecraft.block.MapColor;
|
||||||
|
|
@ -10,8 +9,10 @@ import net.minecraft.block.enums.NoteBlockInstrument;
|
||||||
import net.minecraft.block.piston.PistonBehavior;
|
import net.minecraft.block.piston.PistonBehavior;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemGroups;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.registry.RegistryKey;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import sad.ovh.weed.block.RollingPaperBlock;
|
import sad.ovh.weed.block.RollingPaperBlock;
|
||||||
|
|
@ -33,31 +34,80 @@ public class WeedBlocks {
|
||||||
public static BlockItem UV_LAMP_ITEM;
|
public static BlockItem UV_LAMP_ITEM;
|
||||||
public static BlockItem WEED_SEEDS_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() {
|
public static void register() {
|
||||||
ROLLING_PAPER_BLOCK = Registry.register(Registries.BLOCK, Identifier.of(Weed.MOD_ID, "rolling_paper"),
|
// Blocks
|
||||||
new RollingPaperBlock(AbstractBlock.Settings.copy(Blocks.GLASS).nonOpaque()));
|
ROLLING_PAPER_BLOCK = Registry.register(
|
||||||
TRAY_BLOCK = Registry.register(Registries.BLOCK, Identifier.of(Weed.MOD_ID, "tray"),
|
Registries.BLOCK,
|
||||||
new TrayBlock(AbstractBlock.Settings.copy(Blocks.GLASS).nonOpaque()));
|
key("rolling_paper"),
|
||||||
UV_LAMP_BLOCK = Registry.register(Registries.BLOCK, Identifier.of(Weed.MOD_ID, "uv_lamp"),
|
new RollingPaperBlock(AbstractBlock.Settings.copy(Blocks.GLASS)
|
||||||
new UVLampBlock(Settings.create().breakInstantly().mapColor(MapColor.LAPIS_BLUE)
|
.nonOpaque()
|
||||||
.instrument(NoteBlockInstrument.IRON_XYLOPHONE)
|
.registryKey(key("rolling_paper")))
|
||||||
.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)));
|
|
||||||
|
|
||||||
ROLLING_PAPER_ITEM = Registry.register(Registries.ITEM, Identifier.of(Weed.MOD_ID, "rolling_paper"),
|
TRAY_BLOCK = Registry.register(
|
||||||
new RollingPaperBlockItem(new Item.Settings(), ROLLING_PAPER_BLOCK, "item/rolling_paper"));
|
Registries.BLOCK,
|
||||||
TRAY_ITEM = Registry.register(Registries.ITEM, Identifier.of(Weed.MOD_ID, "tray"),
|
key("tray"),
|
||||||
new TrayBlockItem(new Item.Settings(), TRAY_BLOCK, "item/tray"));
|
new TrayBlock(AbstractBlock.Settings.copy(Blocks.GLASS)
|
||||||
UV_LAMP_ITEM = Registry.register(Registries.ITEM, Identifier.of(Weed.MOD_ID, "uv_lamp"),
|
.nonOpaque()
|
||||||
new UVLampBlockItem(new Item.Settings(), UV_LAMP_BLOCK, "item/uv_lamp"));
|
.registryKey(key("tray")))
|
||||||
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"));
|
|
||||||
|
|
||||||
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(ROLLING_PAPER_ITEM);
|
||||||
content.add(TRAY_ITEM);
|
content.add(TRAY_ITEM);
|
||||||
content.add(UV_LAMP_ITEM);
|
content.add(UV_LAMP_ITEM);
|
||||||
|
|
|
||||||
|
|
@ -1,51 +1,61 @@
|
||||||
package sad.ovh.weed;
|
package sad.ovh.weed;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
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.component.type.FoodComponent;
|
||||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||||
import net.minecraft.entity.effect.StatusEffects;
|
import net.minecraft.entity.effect.StatusEffects;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.Item.Settings;
|
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.Registries;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.registry.RegistryKey;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.Rarity;
|
import net.minecraft.util.Rarity;
|
||||||
import sad.ovh.weed.item.FilterItem;
|
import sad.ovh.weed.item.FilterItem;
|
||||||
import sad.ovh.weed.item.JointItem;
|
import sad.ovh.weed.item.JointItem;
|
||||||
import sad.ovh.weed.item.WeedItem;
|
import sad.ovh.weed.item.WeedItem;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class WeedItems {
|
public class WeedItems {
|
||||||
|
|
||||||
public static Item FILTER;
|
public static Item FILTER;
|
||||||
public static Item JOINT;
|
public static Item JOINT;
|
||||||
public static Item WEED;
|
public static Item WEED;
|
||||||
|
|
||||||
public static void register() {
|
// 1.21+ helper
|
||||||
FoodComponent JointFoodComponent = new FoodComponent.Builder()
|
private static Item register(String name, Function<Settings, Item> itemFactory, Settings settings) {
|
||||||
.alwaysEdible()
|
RegistryKey<Item> itemKey = RegistryKey.of(Registries.ITEM.getKey(), Identifier.of(Weed.MOD_ID, name));
|
||||||
.statusEffect(new StatusEffectInstance(StatusEffects.HUNGER, 10 * 20, 2, false, true, true), 100)
|
Item item = itemFactory.apply(settings.registryKey(itemKey));
|
||||||
.statusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 60 * 20, 1, false, true, true), 75)
|
return Registry.register(Registries.ITEM, itemKey, item);
|
||||||
.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);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,14 +1,5 @@
|
||||||
package sad.ovh.weed.block;
|
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.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
|
@ -16,57 +7,49 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.state.property.IntProperty;
|
import net.minecraft.state.property.IntProperty;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
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.hit.BlockHitResult;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.GameMode;
|
import net.minecraft.world.GameMode;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import sad.ovh.weed.Weed;
|
|
||||||
import sad.ovh.weed.WeedBlocks;
|
import sad.ovh.weed.WeedBlocks;
|
||||||
|
|
||||||
public class RollingPaperBlock extends Block implements PolymerTexturedBlock {
|
public class RollingPaperBlock extends Block {
|
||||||
private final List<BlockState> polymerBlockState = new ArrayList<BlockState>();
|
|
||||||
public static final IntProperty PAPERS = IntProperty.of("papers", 1, 5);
|
public static final IntProperty PAPERS = IntProperty.of("papers", 1, 5);
|
||||||
|
|
||||||
public RollingPaperBlock(Settings settings) {
|
public RollingPaperBlock(Settings settings) {
|
||||||
super(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));
|
setDefaultState(getDefaultState().with(PAPERS, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@OverrideOnly
|
@Override
|
||||||
protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos,
|
protected ActionResult onUseWithItem(
|
||||||
PlayerEntity player_fake,
|
ItemStack stack, BlockState state, World world, BlockPos pos,
|
||||||
Hand hand, BlockHitResult hit) {
|
PlayerEntity playerFake, Hand hand, BlockHitResult hit) {
|
||||||
ServerPlayerEntity player = (ServerPlayerEntity) player_fake;
|
|
||||||
|
if (!(playerFake instanceof ServerPlayerEntity player)) {
|
||||||
|
return ActionResult.PASS;
|
||||||
|
}
|
||||||
|
|
||||||
if (stack.getItem().equals(WeedBlocks.ROLLING_PAPER_ITEM)) {
|
if (stack.getItem().equals(WeedBlocks.ROLLING_PAPER_ITEM)) {
|
||||||
Integer papers = state.get(PAPERS);
|
int papers = state.get(PAPERS);
|
||||||
Integer papersIfAdded = papers + 1;
|
int papersIfAdded = papers + 1;
|
||||||
|
|
||||||
if (papersIfAdded <= 5) {
|
if (papersIfAdded <= 5) {
|
||||||
world.setBlockState(pos, state.with(PAPERS, papersIfAdded));
|
world.setBlockState(pos, state.with(PAPERS, papersIfAdded));
|
||||||
if(player.interactionManager.getGameMode().equals(GameMode.SURVIVAL)) {
|
if (player.interactionManager.getGameMode().equals(GameMode.SURVIVAL)) {
|
||||||
stack.decrement(1);
|
stack.decrement(1);
|
||||||
player.setStackInHand(hand, stack);
|
player.setStackInHand(hand, stack);
|
||||||
}
|
}
|
||||||
return ItemActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ItemActionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
return ActionResult.PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||||
builder.add(PAPERS);
|
builder.add(PAPERS);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public BlockState getPolymerBlockState(BlockState state) {
|
|
||||||
return this.polymerBlockState.get(state.get(PAPERS) - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +1,9 @@
|
||||||
package sad.ovh.weed.block;
|
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.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) {
|
public TrayBlock(Settings settings) {
|
||||||
super(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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,51 +1,21 @@
|
||||||
package sad.ovh.weed.block;
|
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.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.block.MapColor;
|
import net.minecraft.block.MapColor;
|
||||||
import net.minecraft.block.enums.NoteBlockInstrument;
|
import net.minecraft.block.enums.NoteBlockInstrument;
|
||||||
import net.minecraft.block.piston.PistonBehavior;
|
import net.minecraft.block.piston.PistonBehavior;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemGroups;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import sad.ovh.weed.Weed;
|
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) {
|
public UVLampBlock(Settings settings) {
|
||||||
super(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));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,67 +1,48 @@
|
||||||
package sad.ovh.weed.block;
|
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.BlockState;
|
||||||
import net.minecraft.block.CropBlock;
|
import net.minecraft.block.CropBlock;
|
||||||
import net.minecraft.item.ItemConvertible;
|
import net.minecraft.item.ItemConvertible;
|
||||||
import net.minecraft.state.property.IntProperty;
|
import net.minecraft.state.property.IntProperty;
|
||||||
import net.minecraft.state.property.Properties;
|
import net.minecraft.state.property.Properties;
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import sad.ovh.weed.Weed;
|
import sad.ovh.weed.WeedItems;
|
||||||
|
|
||||||
public class WeedSeedsBlock extends CropBlock implements PolymerTexturedBlock {
|
public class WeedSeedsBlock extends CropBlock {
|
||||||
private final List<BlockState> polymerBlockState = new ArrayList<BlockState>();
|
// Use AGE_7 (0–7) for smoother crop stages instead of AGE_1
|
||||||
public static final IntProperty AGE = Properties.AGE_1;
|
public static final IntProperty AGE = Properties.AGE_7;
|
||||||
|
|
||||||
public WeedSeedsBlock(Settings settings) {
|
public WeedSeedsBlock(Settings settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
for (int i = 1; i <= 3; i++) {
|
setDefaultState(getDefaultState().with(AGE, 0));
|
||||||
this.polymerBlockState.add(PolymerBlockResourceUtils.requestBlock(BlockModelType.PLANT_BLOCK,
|
|
||||||
PolymerBlockModel.of(Identifier.of(Weed.MOD_ID, "block/weed_seeds_" + i))));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyGrowth(World world, BlockPos pos, BlockState state) {
|
public void applyGrowth(World world, BlockPos pos, BlockState state) {
|
||||||
if (world.getBaseLightLevel(pos, 0) < 9)
|
if (world.getBaseLightLevel(pos, 0) < 9) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int i = this.getAge(state) + this.getGrowthAmount(world);
|
int i = this.getAge(state) + this.getGrowthAmount(world);
|
||||||
int j = this.getMaxAge();
|
int j = this.getMaxAge();
|
||||||
if (i > j) {
|
if (i > j) {
|
||||||
i = j;
|
i = j;
|
||||||
}
|
}
|
||||||
|
|
||||||
world.setBlockState(pos, this.withAge(i), 2);
|
world.setBlockState(pos, this.withAge(i), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getPolymerBlockState(BlockState state) {
|
public IntProperty getAgeProperty() {
|
||||||
Integer fakeAge = this.getAge(state);
|
return AGE;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemConvertible getSeedsItem() {
|
public int getMaxAge() {
|
||||||
return this;
|
return 7; // AGE_7 has 8 stages (0–7)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
protected ItemConvertible getSeedsItem() {
|
||||||
|
return this.asItem(); // returns the block’s item as seeds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,35 +1,10 @@
|
||||||
package sad.ovh.weed.block.items;
|
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.block.Block;
|
||||||
import net.minecraft.item.BlockItem;
|
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 {
|
public class RollingPaperBlockItem extends BlockItem {
|
||||||
private final PolymerModelData polymerModel;
|
public RollingPaperBlockItem(Block block, Settings settings) {
|
||||||
|
|
||||||
public RollingPaperBlockItem(Settings settings, Block block, String modelId) {
|
|
||||||
super(block, 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,10 @@
|
||||||
package sad.ovh.weed.block.items;
|
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.block.Block;
|
||||||
import net.minecraft.item.BlockItem;
|
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 {
|
public class TrayBlockItem extends BlockItem {
|
||||||
private final PolymerModelData polymerModel;
|
public TrayBlockItem(Block block, Settings settings) {
|
||||||
|
|
||||||
public TrayBlockItem(Settings settings, Block block, String modelId) {
|
|
||||||
super(block, 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,10 @@
|
||||||
package sad.ovh.weed.block.items;
|
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.block.Block;
|
||||||
import net.minecraft.item.BlockItem;
|
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 {
|
public class UVLampBlockItem extends BlockItem {
|
||||||
private final PolymerModelData polymerModel;
|
public UVLampBlockItem(Block block, Settings settings) {
|
||||||
|
|
||||||
public UVLampBlockItem(Settings settings, Block block, String modelId) {
|
|
||||||
super(block, 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,10 @@
|
||||||
package sad.ovh.weed.block.items;
|
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.block.Block;
|
||||||
import net.minecraft.item.BlockItem;
|
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 {
|
public class WeedSeedsBlockItem extends BlockItem {
|
||||||
private final PolymerModelData polymerModel;
|
public WeedSeedsBlockItem(Block block, Settings settings) {
|
||||||
|
|
||||||
public WeedSeedsBlockItem(Settings settings, Block block, String modelId) {
|
|
||||||
super(block, 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,9 @@
|
||||||
package sad.ovh.weed.item;
|
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.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) {
|
public FilterItem(Settings settings) {
|
||||||
super(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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,33 +1,9 @@
|
||||||
package sad.ovh.weed.item;
|
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.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) {
|
public JointItem(Settings settings) {
|
||||||
super(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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,9 @@
|
||||||
package sad.ovh.weed.item;
|
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.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) {
|
public WeedItem(Settings settings) {
|
||||||
super(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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -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" }
|
||||||
|
}
|
||||||
|
}
|
||||||
7
src/main/resources/assets/weed/blockstates/tray.json
Normal file
7
src/main/resources/assets/weed/blockstates/tray.json
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "weed:block/tray"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
src/main/resources/assets/weed/blockstates/uv_lamp.json
Normal file
7
src/main/resources/assets/weed/blockstates/uv_lamp.json
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "weed:block/uv_lamp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/main/resources/assets/weed/blockstates/weed_seeds.json
Normal file
12
src/main/resources/assets/weed/blockstates/weed_seeds.json
Normal 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" }
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/main/resources/assets/weed/items/filter.json
Normal file
6
src/main/resources/assets/weed/items/filter.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "weed:item/filter"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/main/resources/assets/weed/items/joint.json
Normal file
6
src/main/resources/assets/weed/items/joint.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "weed:item/joint"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/main/resources/assets/weed/items/rolling_paper.json
Normal file
6
src/main/resources/assets/weed/items/rolling_paper.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "weed:item/rolling_paper"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/main/resources/assets/weed/items/tray.json
Normal file
6
src/main/resources/assets/weed/items/tray.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "weed:item/tray"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/main/resources/assets/weed/items/uv_lamp.json
Normal file
6
src/main/resources/assets/weed/items/uv_lamp.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "weed:item/uv_lamp"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/main/resources/assets/weed/items/weed.json
Normal file
6
src/main/resources/assets/weed/items/weed.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "weed:item/weed"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/main/resources/assets/weed/items/weed_seeds.json
Normal file
6
src/main/resources/assets/weed/items/weed_seeds.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "weed:item/weed_seeds"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"item.weed.weed": "Weed",
|
"item.weed.weed": "Weed",
|
||||||
"block.weed.weed_seeds": "Weed Seeds",
|
"item.weed.weed_seeds": "Weed Seeds",
|
||||||
"block.weed.uv_lamp": "UV Grow Lamp",
|
"item.weed.uv_lamp": "UV Grow Lamp",
|
||||||
"item.weed.joint": "Legendary J",
|
"item.weed.joint": "Legendary J",
|
||||||
"item.weed.filter": "Filter",
|
"item.weed.filter": "Filter",
|
||||||
"block.weed.tray": "Tray",
|
"item.weed.tray": "Tray",
|
||||||
"block.weed.rolling_paper": "Rolling Paper"
|
"item.weed.rolling_paper": "Rolling Paper"
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/crop",
|
"parent": "minecraft:block/cross",
|
||||||
"textures": {
|
"textures": {
|
||||||
"crop": "weed:block/weed_seeds_1"
|
"cross": "weed:block/weed_seeds_1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/crop",
|
"parent": "minecraft:block/cross",
|
||||||
"textures": {
|
"textures": {
|
||||||
"crop": "weed:block/weed_seeds_2"
|
"cross": "weed:block/weed_seeds_2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/crop",
|
"parent": "minecraft:block/cross",
|
||||||
"textures": {
|
"textures": {
|
||||||
"crop": "weed:block/weed_seeds_3"
|
"cross": "weed:block/weed_seeds_3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6,15 +6,9 @@
|
||||||
"STS"
|
"STS"
|
||||||
],
|
],
|
||||||
"key": {
|
"key": {
|
||||||
"P": {
|
"P": "minecraft:paper",
|
||||||
"item": "minecraft:paper"
|
"S": "minecraft:sugar_cane",
|
||||||
},
|
"T": "minecraft:string"
|
||||||
"S": {
|
|
||||||
"item": "minecraft:sugar_cane"
|
|
||||||
},
|
|
||||||
"T": {
|
|
||||||
"item": "minecraft:string"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
"id": "weed:filter",
|
"id": "weed:filter",
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,9 @@
|
||||||
"PPP"
|
"PPP"
|
||||||
],
|
],
|
||||||
"key": {
|
"key": {
|
||||||
"P": {
|
"P": "minecraft:paper",
|
||||||
"item": "minecraft:paper"
|
"F": "weed:filter",
|
||||||
},
|
"W": "weed:weed"
|
||||||
"F": {
|
|
||||||
"item": "weed:filter"
|
|
||||||
},
|
|
||||||
"W": {
|
|
||||||
"item": "weed:weed"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
"id": "weed:joint",
|
"id": "weed:joint",
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,7 @@
|
||||||
"PPP"
|
"PPP"
|
||||||
],
|
],
|
||||||
"key": {
|
"key": {
|
||||||
"P": {
|
"P": "minecraft:paper"
|
||||||
"item": "minecraft:paper"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
"id": "weed:rolling_paper",
|
"id": "weed:rolling_paper",
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,8 @@
|
||||||
"GGG"
|
"GGG"
|
||||||
],
|
],
|
||||||
"key": {
|
"key": {
|
||||||
"G": {
|
"G": "minecraft:glass",
|
||||||
"item": "minecraft:glass"
|
"W": "weed:weed"
|
||||||
},
|
|
||||||
"W": {
|
|
||||||
"item": "weed:weed"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
"id": "weed:tray",
|
"id": "weed:tray",
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,9 @@
|
||||||
"LEL"
|
"LEL"
|
||||||
],
|
],
|
||||||
"key": {
|
"key": {
|
||||||
"D": {
|
"D": "minecraft:diamond",
|
||||||
"item": "minecraft:diamond"
|
"L": "minecraft:lapis_block",
|
||||||
},
|
"E": "minecraft:emerald"
|
||||||
"L": {
|
|
||||||
"item": "minecraft:lapis_block"
|
|
||||||
},
|
|
||||||
"E": {
|
|
||||||
"item": "minecraft:emerald"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
"id": "weed:uv_lamp",
|
"id": "weed:uv_lamp",
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,8 @@
|
||||||
"CSC"
|
"CSC"
|
||||||
],
|
],
|
||||||
"key": {
|
"key": {
|
||||||
"C": {
|
"C": "minecraft:sugar_cane",
|
||||||
"item": "minecraft:sugar_cane"
|
"S": "minecraft:torchflower_seeds"
|
||||||
},
|
|
||||||
"S": {
|
|
||||||
"item": "minecraft:torchflower_seeds"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
"id": "weed:weed_seeds",
|
"id": "weed:weed_seeds",
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,14 @@
|
||||||
"contact": {},
|
"contact": {},
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"icon": "assets/weed/icon.png",
|
"icon": "assets/weed/icon.png",
|
||||||
"environment": "server",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": [
|
"main": [
|
||||||
"sad.ovh.weed.Weed"
|
"sad.ovh.weed.Weed"
|
||||||
]
|
],
|
||||||
|
"client": [
|
||||||
|
"sad.ovh.weed.ClientWeed"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"weed.mixins.json",
|
"weed.mixins.json",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue