Skip to content

Commit 76c62b9

Browse files
committed
v0.0.2
1 parent 94538b8 commit 76c62b9

File tree

166 files changed

+7145
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+7145
-75
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '1.8-SNAPSHOT'
2+
id 'fabric-loom' version '1.9-SNAPSHOT'
33
id 'maven-publish'
44
}
55

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ org.gradle.parallel=true
44

55
# Fabric Properties
66
# check these on https://fabricmc.net/develop
7-
minecraft_version=1.21.3
8-
yarn_mappings=1.21.3+build.2
7+
minecraft_version=1.21.4
8+
yarn_mappings=1.21.4+build.1
99
loader_version=0.16.9
1010

1111
# Mod Properties
@@ -14,4 +14,4 @@ maven_group=net.db64.homelawnsecurity
1414
archives_base_name=homelawnsecurity
1515

1616
# Dependencies
17-
fabric_version=0.107.0+1.21.3
17+
fabric_version=0.110.5+1.21.4

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package net.db64.homelawnsecurity;
2+
3+
import net.db64.homelawnsecurity.block.ModBlocks;
4+
import net.db64.homelawnsecurity.component.ModDataComponentTypes;
5+
import net.db64.homelawnsecurity.entity.ModDamageTypes;
6+
import net.db64.homelawnsecurity.entity.ModEntities;
7+
import net.db64.homelawnsecurity.entity.custom.other.LawnMowerEntity;
8+
import net.db64.homelawnsecurity.entity.custom.plant.PeashooterEntity;
9+
import net.db64.homelawnsecurity.entity.custom.zombie.BasicZombieEntity;
10+
import net.db64.homelawnsecurity.entity.custom.zombie.ConeheadZombieEntity;
11+
import net.db64.homelawnsecurity.item.ModItemGroups;
12+
import net.db64.homelawnsecurity.item.ModItems;
13+
import net.db64.homelawnsecurity.particle.ModParticles;
14+
import net.fabricmc.api.ModInitializer;
15+
16+
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
17+
import org.slf4j.Logger;
18+
import org.slf4j.LoggerFactory;
19+
20+
public class HomeLawnSecurity implements ModInitializer {
21+
public static final String MOD_ID = "homelawnsecurity";
22+
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
23+
24+
@Override
25+
public void onInitialize() {
26+
LOGGER.info("if you see this read sunny side skies");
27+
28+
ModItemGroups.registerItemGroups();
29+
30+
ModItems.registerModItems();
31+
ModBlocks.registerModBlocks();
32+
ModDataComponentTypes.registerDataComponentTypes();
33+
ModDamageTypes.registerModDamageTypes();
34+
35+
ModParticles.registerParticles();
36+
37+
registerOther();
38+
registerPlants();
39+
registerZombies();
40+
}
41+
42+
private void registerOther() {
43+
FabricDefaultAttributeRegistry.register(ModEntities.Other.LAWN_MOWER, LawnMowerEntity.createAttributes());
44+
}
45+
46+
private void registerPlants() {
47+
FabricDefaultAttributeRegistry.register(ModEntities.Plant.PEASHOOTER, PeashooterEntity.createAttributes());
48+
}
49+
50+
private void registerZombies() {
51+
FabricDefaultAttributeRegistry.register(ModEntities.Zombie.BASIC_ZOMBIE, BasicZombieEntity.createAttributes());
52+
53+
FabricDefaultAttributeRegistry.register(ModEntities.Zombie.CONEHEAD_ZOMBIE, ConeheadZombieEntity.createAttributes());
54+
}
55+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package net.db64.homelawnsecurity;
2+
3+
import net.db64.homelawnsecurity.entity.ModEntities;
4+
import net.db64.homelawnsecurity.entity.client.other.CurrencyRenderer;
5+
import net.db64.homelawnsecurity.entity.client.ModModelLayers;
6+
import net.db64.homelawnsecurity.entity.client.other.LawnMowerModel;
7+
import net.db64.homelawnsecurity.entity.client.other.LawnMowerRenderer;
8+
import net.db64.homelawnsecurity.entity.client.plant.PeashooterModel;
9+
import net.db64.homelawnsecurity.entity.client.plant.PeashooterRenderer;
10+
import net.db64.homelawnsecurity.entity.client.projectile.PeaModel;
11+
import net.db64.homelawnsecurity.entity.client.projectile.PeaRenderer;
12+
import net.db64.homelawnsecurity.entity.client.zombie.BasicZombieModel;
13+
import net.db64.homelawnsecurity.entity.client.zombie.BasicZombieRenderer;
14+
import net.db64.homelawnsecurity.entity.client.zombie.ConeheadZombieModel;
15+
import net.db64.homelawnsecurity.entity.client.zombie.ConeheadZombieRenderer;
16+
import net.db64.homelawnsecurity.particle.ModParticles;
17+
import net.db64.homelawnsecurity.particle.custom.MarkerParticle;
18+
import net.fabricmc.api.ClientModInitializer;
19+
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
20+
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
21+
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
22+
23+
public class HomeLawnSecurityClient implements ClientModInitializer {
24+
@Override
25+
public void onInitializeClient() {
26+
/*Item[] otherMarkers = ClientWorld.BLOCK_MARKER_ITEMS.toArray(new Item[0]);
27+
Item[] modMarkers = {
28+
ModBlocks.GARDEN_MARKER.asItem(),
29+
ModBlocks.LAWN_MARKER.asItem(),
30+
ModBlocks.FERTILE_PATH_MARKER_1.asItem(),
31+
ModBlocks.FERTILE_PATH_MARKER_2.asItem(),
32+
ModBlocks.FERTILE_PATH_MARKER_CROSS.asItem(),
33+
ModBlocks.ZOMBIE_PATH_MARKER_1.asItem(),
34+
ModBlocks.ZOMBIE_PATH_MARKER_2.asItem(),
35+
ModBlocks.ZOMBIE_PATH_MARKER_CROSS.asItem(),
36+
ModBlocks.UNSODDED_LAWN_MARKER.asItem()
37+
};
38+
ClientWorld.BLOCK_MARKER_ITEMS = Set.of(ArrayUtils.addAll(otherMarkers, modMarkers));*/
39+
40+
ParticleFactoryRegistry.getInstance().register(ModParticles.MARKER, new MarkerParticle.Factory());
41+
42+
registerOther();
43+
registerProjectiles();
44+
registerPlants();
45+
registerZombies();
46+
}
47+
48+
private void registerOther() {
49+
EntityRendererRegistry.register(ModEntities.Other.CURRENCY, CurrencyRenderer::new);
50+
51+
EntityRendererRegistry.register(ModEntities.Other.LAWN_MOWER, LawnMowerRenderer::new);
52+
EntityModelLayerRegistry.registerModelLayer(ModModelLayers.Other.LAWN_MOWER, LawnMowerModel::getTexturedModelData);
53+
}
54+
55+
private void registerProjectiles() {
56+
EntityRendererRegistry.register(ModEntities.Projectile.PEA, PeaRenderer::new);
57+
EntityModelLayerRegistry.registerModelLayer(ModModelLayers.Projectile.PEA, PeaModel::getTexturedModelData);
58+
}
59+
60+
private void registerPlants() {
61+
EntityRendererRegistry.register(ModEntities.Plant.PEASHOOTER, PeashooterRenderer::new);
62+
EntityModelLayerRegistry.registerModelLayer(ModModelLayers.Plant.PEASHOOTER, PeashooterModel::getTexturedModelData);
63+
}
64+
65+
private void registerZombies() {
66+
EntityRendererRegistry.register(ModEntities.Zombie.BASIC_ZOMBIE, BasicZombieRenderer::new);
67+
EntityModelLayerRegistry.registerModelLayer(ModModelLayers.Zombie.BASIC_ZOMBIE, BasicZombieModel::getTexturedModelData);
68+
69+
EntityRendererRegistry.register(ModEntities.Zombie.CONEHEAD_ZOMBIE, ConeheadZombieRenderer::new);
70+
EntityModelLayerRegistry.registerModelLayer(ModModelLayers.Zombie.CONEHEAD_ZOMBIE, ConeheadZombieModel::getTexturedModelData);
71+
}
72+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package net.db64.homelawnsecurity;
2+
3+
import net.db64.homelawnsecurity.datagen.*;
4+
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
5+
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
6+
7+
public class HomeLawnSecurityDataGenerator implements DataGeneratorEntrypoint {
8+
@Override
9+
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
10+
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
11+
12+
pack.addProvider(ModBiomeTagProvider::new);
13+
pack.addProvider(ModBlockTagProvider::new);
14+
pack.addProvider(ModItemTagProvider::new);
15+
pack.addProvider(ModBlockLootTableProvider::new);
16+
pack.addProvider(ModModelProvider::new);
17+
pack.addProvider(ModRecipeProvider::new);
18+
pack.addProvider(ModWorldProvider::new);
19+
}
20+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
package net.db64.homelawnsecurity.block;
2+
3+
import net.db64.homelawnsecurity.HomeLawnSecurity;
4+
import net.db64.homelawnsecurity.block.custom.CurrencySpawnerBlock;
5+
import net.db64.homelawnsecurity.block.custom.MarkerBlock;
6+
import net.db64.homelawnsecurity.item.ModItems;
7+
import net.minecraft.block.*;
8+
import net.minecraft.item.ItemStack;
9+
import net.minecraft.item.Items;
10+
import net.minecraft.registry.RegistryKey;
11+
import net.minecraft.registry.RegistryKeys;
12+
import net.minecraft.sound.BlockSoundGroup;
13+
import net.minecraft.util.Identifier;
14+
15+
import java.util.function.Function;
16+
17+
public class ModBlocks {
18+
public static final Block GARDEN_BLOCK = register("garden_block", settings ->
19+
new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.MOSS_BLOCK));
20+
public static final Block GRAVEYARD_BLOCK = register("graveyard_block", settings ->
21+
new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.MOSS_BLOCK));
22+
23+
public static final Block LAWN_BLOCK = register("lawn_block", settings ->
24+
new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.WART_BLOCK));
25+
26+
public static final Block FERTILE_PATH_BLOCK_1 = register("fertile_path_block_1", settings ->
27+
new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.MUDDY_MANGROVE_ROOTS));
28+
public static final Block FERTILE_PATH_BLOCK_2 = register("fertile_path_block_2", settings ->
29+
new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.MUDDY_MANGROVE_ROOTS));
30+
public static final Block FERTILE_PATH_BLOCK_CROSS = register("fertile_path_block_cross", settings ->
31+
new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.MUDDY_MANGROVE_ROOTS));
32+
33+
public static final Block ZOMBIE_PATH_BLOCK_1 = register("zombie_path_block_1", settings ->
34+
new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.ROOTED_DIRT));
35+
public static final Block ZOMBIE_PATH_BLOCK_2 = register("zombie_path_block_2", settings ->
36+
new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.ROOTED_DIRT));
37+
public static final Block ZOMBIE_PATH_BLOCK_CROSS = register("zombie_path_block_cross", settings ->
38+
new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.ROOTED_DIRT));
39+
40+
public static final Block UNSODDED_LAWN_BLOCK = register("unsodded_lawn_block", settings ->
41+
new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.DIRT).sounds(BlockSoundGroup.GRAVEL));
42+
43+
public static final Block GARDEN_MARKER = register("garden_marker", settings ->
44+
new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.MOSS_BLOCK).strength(-1.0f, 3600000.8f).nonOpaque());
45+
public static final Block GRAVEYARD_MARKER = register("graveyard_marker", settings ->
46+
new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.MOSS_BLOCK).strength(-1.0f, 3600000.8f).nonOpaque());
47+
48+
public static final Block LAWN_MARKER = register("lawn_marker", settings ->
49+
new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.NETHER_SPROUTS).strength(-1.0f, 3600000.8f).nonOpaque());
50+
51+
public static final Block FERTILE_PATH_MARKER_1 = register("fertile_path_marker_1", settings ->
52+
new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque());
53+
public static final Block FERTILE_PATH_MARKER_2 = register("fertile_path_marker_2", settings ->
54+
new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque());
55+
public static final Block FERTILE_PATH_MARKER_CROSS = register("fertile_path_marker_cross", settings ->
56+
new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque());
57+
58+
public static final Block ZOMBIE_PATH_MARKER_1 = register("zombie_path_marker_1", settings ->
59+
new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque());
60+
public static final Block ZOMBIE_PATH_MARKER_2 = register("zombie_path_marker_2", settings ->
61+
new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque());
62+
public static final Block ZOMBIE_PATH_MARKER_CROSS = register("zombie_path_marker_cross", settings ->
63+
new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque());
64+
65+
public static final Block UNSODDED_LAWN_MARKER = register("unsodded_lawn_marker", settings ->
66+
new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.MUD).strength(-1.0f, 3600000.8f).nonOpaque());
67+
68+
public static final Block SUN_SPAWNER = register("sun_spawner", settings ->
69+
new CurrencySpawnerBlock(settings, new ItemStack(ModItems.SUN)), AbstractBlock.Settings.copyShallow(Blocks.STONE).sounds(BlockSoundGroup.HEAVY_CORE).ticksRandomly());
70+
public static final Block BRAINPOWER_BEACON = register("brainpower_beacon", settings ->
71+
new CurrencySpawnerBlock(settings, new ItemStack(ModItems.BRAINPOWER)), AbstractBlock.Settings.copyShallow(Blocks.STONE).sounds(BlockSoundGroup.HEAVY_CORE).ticksRandomly());
72+
73+
private static Block register(String id, Function<AbstractBlock.Settings, Block> factory, AbstractBlock.Settings settings, boolean obtainable)
74+
{
75+
Block block = Blocks.register(keyOf(id), factory, settings);
76+
if (obtainable)
77+
Items.register(block);
78+
return block;
79+
}
80+
81+
private static Block register(String id, Function<AbstractBlock.Settings, Block> factory, AbstractBlock.Settings settings) {
82+
return register(id, factory, settings, true);
83+
}
84+
85+
/*private static Item registerBlockItem(String name, Block block) {
86+
return Registry.register(Registries.ITEM, RegistryKey.of(RegistryKeys.ITEM, Identifier.of(HomeLawnSecurity.MOD_ID, name)),
87+
new BlockItem(block, new Item.Settings()));
88+
}*/
89+
90+
private static RegistryKey<Block> keyOf(String id) {
91+
return RegistryKey.of(RegistryKeys.BLOCK, Identifier.of(HomeLawnSecurity.MOD_ID, id));
92+
}
93+
94+
public static void registerModBlocks() {
95+
HomeLawnSecurity.LOGGER.debug("Registering blocks for " + HomeLawnSecurity.MOD_ID);
96+
}
97+
98+
public static class BlockSetTypes {
99+
//public static BlockSetType RUBBER_WOOD = new BlockSetType("rubber_wood", true, true, true, BlockSetType.ActivationRule.EVERYTHING, ModSounds.BlockSoundGroups.RUBBER_WOOD, ModSounds.RUBBERWOOD_DOOR_CLOSE, ModSounds.RUBBERWOOD_DOOR_OPEN, ModSounds.RUBBERWOOD_TRAPDOOR_CLOSE, ModSounds.RUBBERWOOD_TRAPDOOR_OPEN, ModSounds.RUBBERWOOD_PRESSURE_PLATE_CLICK_OFF, ModSounds.RUBBERWOOD_PRESSURE_PLATE_CLICK_ON, ModSounds.RUBBERWOOD_BUTTON_CLICK_OFF, ModSounds.RUBBERWOOD_BUTTON_CLICK_ON);
100+
}
101+
102+
public static class WoodTypes {
103+
//public static WoodType RUBBER_WOOD = new WoodType("rubber_wood", BlockSetTypes.RUBBER_WOOD, ModSounds.BlockSoundGroups.RUBBER_WOOD, BlockSoundGroup.CHERRY_WOOD_HANGING_SIGN, ModSounds.RUBBERWOOD_FENCE_GATE_CLOSE, ModSounds.RUBBERWOOD_FENCE_GATE_OPEN);
104+
}
105+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package net.db64.homelawnsecurity.block.custom;
2+
3+
import net.db64.homelawnsecurity.entity.custom.other.CurrencyEntity;
4+
import net.db64.homelawnsecurity.item.ModItems;
5+
import net.db64.homelawnsecurity.util.ModTags;
6+
import net.minecraft.block.Block;
7+
import net.minecraft.block.BlockState;
8+
import net.minecraft.item.ItemStack;
9+
import net.minecraft.server.world.ServerWorld;
10+
import net.minecraft.util.math.BlockPos;
11+
import net.minecraft.util.math.random.Random;
12+
13+
public class CurrencySpawnerBlock extends Block {
14+
public final ItemStack stack;
15+
private static final float SPAWN_CHANCE = 0.05f;
16+
private static final int SPAWN_DISTANCE = 10;
17+
18+
public CurrencySpawnerBlock(Settings settings, ItemStack stack) {
19+
super(settings);
20+
this.stack = stack;
21+
}
22+
23+
public ItemStack getDefaultItemStack() {
24+
return new ItemStack(ModItems.SUN);
25+
}
26+
27+
@Override
28+
protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
29+
super.randomTick(state, world, pos, random);
30+
31+
if (random.nextFloat() < SPAWN_CHANCE) {
32+
spawnCurrency(world, pos, random);
33+
}
34+
}
35+
36+
/*@Override
37+
protected boolean hasRandomTicks(BlockState state) {
38+
return true;
39+
}*/
40+
41+
public void spawnCurrency(ServerWorld world, BlockPos pos, Random random) {
42+
Iterable<BlockPos> iterable = BlockPos.iterateRandomly(random, 30, pos, SPAWN_DISTANCE);
43+
44+
for (BlockPos pos2 : iterable) {
45+
if (isValidSpawnLocation(world, pos)) {
46+
world.spawnEntity(new CurrencyEntity(pos2.getX(), pos2.getY() + 16, pos.getZ(), world, stack.copy()));
47+
}
48+
}
49+
}
50+
51+
public boolean isValidSpawnLocation(ServerWorld world, BlockPos pos) {
52+
BlockState state = world.getBlockState(pos);
53+
BlockState markerState = world.getBlockState(pos.up());
54+
55+
if (markerState.isIn(ModTags.Blocks.MARKERS)) {
56+
return markerState.isIn(ModTags.Blocks.PLANT_PLACEABLE_LAWN_MARKERS);
57+
}
58+
return state.isIn(ModTags.Blocks.PLANT_PLACEABLE_LAWN);
59+
}
60+
}

0 commit comments

Comments
 (0)