Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ bin/
# fabric

run/
src/main/generated/.cache
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

![icon](https://i.imgur.com/BiDGRe9.png)
![icon.png](https://i.imgur.com/BiDGRe9.png)
## license
This project is licensed under [ARR](LICENSE). If you would like clarification or explicit permission, contact me on Discord.
22 changes: 7 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'maven-publish'
}

base {
archivesName = project.archives_base_name
}

version = project.mod_version
group = project.maven_group

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}

loom {
Expand Down Expand Up @@ -49,11 +48,8 @@ dependencies {

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
}

base {
archivesName = project.archives_base_name
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
}

processResources {
Expand All @@ -65,14 +61,10 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
it.options.release = 21
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx2G

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.5
loader_version=0.14.21
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.7

# Mod Properties
mod_version = 3.1.0
mod_version = 4.0.0
maven_group = com.ninni
archives_base_name = twigs

# Dependencies
fabric_version=0.84.0+1.20.1
fabric_version=0.106.0+1.21.1
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ pluginManagement {
gradlePluginPortal()
}
}

rootProject.name = 'twigs'
11 changes: 0 additions & 11 deletions src/main/generated/.cache/992030af1166d80cd522100e1ae5b945fa70818d

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
"vertical_range": 3,
"xz_radius": {
"type": "minecraft:uniform",
"value": {
"max_inclusive": 4,
"min_inclusive": 2
}
"max_inclusive": 4,
"min_inclusive": 2
}
}
}
13 changes: 1 addition & 12 deletions src/main/java/com/ninni/twigs/Twigs.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.ninni.twigs;

import com.google.common.reflect.Reflection;
import com.ninni.twigs.entity.Pebble;
import com.ninni.twigs.registry.TwigsBiomeModifier;
import com.ninni.twigs.registry.TwigsBlockEntityType;
import com.ninni.twigs.registry.TwigsBlocks;
Expand All @@ -18,11 +17,6 @@
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.registry.OxidizableBlocksRegistry;
import net.minecraft.Util;
import net.minecraft.core.Position;
import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.DispenserBlock;

Expand Down Expand Up @@ -50,12 +44,7 @@ public void onInitialize() {
TwigsStructurePieceTypes.class
);

DispenserBlock.registerBehavior(TwigsItems.PEBBLE, new AbstractProjectileDispenseBehavior() {
@Override
protected Projectile getProjectile(Level world, Position position, ItemStack stack) {
return Util.make(new Pebble(world, position.x(), position.y(), position.z()), entity -> entity.setItem(stack));
}
});
DispenserBlock.registerProjectileBehavior(TwigsItems.PEBBLE);

Util.make(new LinkedHashMap<Block, Block>(), pairs -> {
pairs.put(TwigsBlocks.COPPER_PILLAR, TwigsBlocks.WAXED_COPPER_PILLAR);
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/ninni/twigs/TwigsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.ThrownItemRenderer;
import net.minecraft.client.renderer.item.ItemProperties;
import net.minecraft.resources.ResourceLocation;

@SuppressWarnings("deprecation")
@Environment(EnvType.CLIENT)
public class TwigsClient implements ClientModInitializer {

Expand All @@ -42,7 +41,7 @@ public void onInitializeClient() {
TwigsBlocks.BAMBOO_THATCH_SLAB
);

FabricModelPredicateProviderRegistry.register(TwigsItems.BRONZED_SEASHELL, new ResourceLocation("playing"), (itemStack, clientWorld, livingEntity, var) -> {
ItemProperties.register(TwigsItems.BRONZED_SEASHELL, ResourceLocation.fromNamespaceAndPath(Twigs.MOD_ID, "playing"), (itemStack, clientWorld, livingEntity, var) -> {
if (livingEntity == null) return 0.0F;

return livingEntity.isUsingItem() && livingEntity.getUseItem() == itemStack ? 1.0F : 0.0F;
Expand Down
46 changes: 23 additions & 23 deletions src/main/java/com/ninni/twigs/TwigsTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,32 @@
public interface TwigsTags {

//item tags
TagKey<Item> SCHIST_ITEM = TagKey.create(Registries.ITEM, new ResourceLocation(MOD_ID, "schist"));
TagKey<Item> RHYOLITE_ITEM = TagKey.create(Registries.ITEM, new ResourceLocation(MOD_ID, "rhyolite"));
TagKey<Item> BLOODSTONE_ITEM = TagKey.create(Registries.ITEM, new ResourceLocation(MOD_ID, "bloodstone"));
TagKey<Item> PACKED_SILT_ITEM = TagKey.create(Registries.ITEM, new ResourceLocation(MOD_ID, "packed_silt"));
TagKey<Item> PACKED_SILT_FULL_BLOCKS = TagKey.create(Registries.ITEM, new ResourceLocation(MOD_ID, "packed_silt_full_blocks"));
TagKey<Item> SILT_POTS_ITEM = TagKey.create(Registries.ITEM, new ResourceLocation(MOD_ID, "silt_pots"));
TagKey<Item> SEASHELLS = TagKey.create(Registries.ITEM, new ResourceLocation(MOD_ID, "seashells"));
TagKey<Item> TABLES_ITEM = TagKey.create(Registries.ITEM, new ResourceLocation(MOD_ID, "tables"));
TagKey<Item> SCHIST_ITEM = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MOD_ID, "schist"));
TagKey<Item> RHYOLITE_ITEM = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MOD_ID, "rhyolite"));
TagKey<Item> BLOODSTONE_ITEM = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MOD_ID, "bloodstone"));
TagKey<Item> PACKED_SILT_ITEM = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MOD_ID, "packed_silt"));
TagKey<Item> PACKED_SILT_FULL_BLOCKS = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MOD_ID, "packed_silt_full_blocks"));
TagKey<Item> SILT_POTS_ITEM = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MOD_ID, "silt_pots"));
TagKey<Item> SEASHELLS = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MOD_ID, "seashells"));
TagKey<Item> TABLES_ITEM = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MOD_ID, "tables"));

//block tags
TagKey<Block> SCHIST_BLOCK = TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, "schist"));
TagKey<Block> RHYOLITE_BLOCK = TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, "rhyolite"));
TagKey<Block> BLOODSTONE_BLOCK = TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, "bloodstone"));
TagKey<Block> PACKED_SILT_BLOCK = TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, "packed_silt"));
TagKey<Block> SILT_POTS_BLOCK = TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, "silt_pots"));
TagKey<Block> OFFSET_REMOVER = TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, "offset_remover"));
TagKey<Block> TABLES_BLOCK = TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, "tables"));
TagKey<Block> SCHIST_BLOCK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MOD_ID, "schist"));
TagKey<Block> RHYOLITE_BLOCK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MOD_ID, "rhyolite"));
TagKey<Block> BLOODSTONE_BLOCK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MOD_ID, "bloodstone"));
TagKey<Block> PACKED_SILT_BLOCK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MOD_ID, "packed_silt"));
TagKey<Block> SILT_POTS_BLOCK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MOD_ID, "silt_pots"));
TagKey<Block> OFFSET_REMOVER = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MOD_ID, "offset_remover"));
TagKey<Block> TABLES_BLOCK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MOD_ID, "tables"));

//biome tags
TagKey<Biome> BLOODSTONE_GENERATES = TagKey.create(Registries.BIOME, new ResourceLocation(MOD_ID, "bloodstone_generates"));
TagKey<Biome> SCHIST_GENERATES = TagKey.create(Registries.BIOME, new ResourceLocation(MOD_ID, "schist_generates"));
TagKey<Biome> SILT_GENERATES = TagKey.create(Registries.BIOME, new ResourceLocation(MOD_ID, "silt_generates"));
TagKey<Biome> AZALEA_FLOWERS_GENERATE = TagKey.create(Registries.BIOME, new ResourceLocation(MOD_ID, "azalea_flowers_generate"));
TagKey<Biome> SPAWNS_TWIG = TagKey.create(Registries.BIOME, new ResourceLocation(MOD_ID, "spawns_twig"));
TagKey<Biome> SPAWNS_PEBBLE = TagKey.create(Registries.BIOME, new ResourceLocation(MOD_ID, "spawns_pebble"));
TagKey<Biome> SPAWNS_SEA_SHELL = TagKey.create(Registries.BIOME, new ResourceLocation(MOD_ID, "spawns_sea_shell"));
TagKey<Biome> BLOODSTONE_GENERATES = TagKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(MOD_ID, "bloodstone_generates"));
TagKey<Biome> SCHIST_GENERATES = TagKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(MOD_ID, "schist_generates"));
TagKey<Biome> SILT_GENERATES = TagKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(MOD_ID, "silt_generates"));
TagKey<Biome> AZALEA_FLOWERS_GENERATE = TagKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(MOD_ID, "azalea_flowers_generate"));
TagKey<Biome> SPAWNS_TWIG = TagKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(MOD_ID, "spawns_twig"));
TagKey<Biome> SPAWNS_PEBBLE = TagKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(MOD_ID, "spawns_pebble"));
TagKey<Biome> SPAWNS_SEA_SHELL = TagKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(MOD_ID, "spawns_sea_shell"));

TagKey<EntityType<?>> BAMBOO_LEAVES_SLOW_IMMUNE = TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(MOD_ID, "bamboo_leaves_slow_immune"));
TagKey<EntityType<?>> BAMBOO_LEAVES_SLOW_IMMUNE = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(MOD_ID, "bamboo_leaves_slow_immune"));
}
8 changes: 7 additions & 1 deletion src/main/java/com/ninni/twigs/block/AzaleaFlowersBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ninni.twigs.block;

import com.mojang.serialization.MapCodec;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
Expand All @@ -20,12 +21,18 @@
public class AzaleaFlowersBlock extends MultifaceBlock implements SimpleWaterloggedBlock {
private static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
private final MultifaceSpreader spreader = new MultifaceSpreader(this);
private static final MapCodec<AzaleaFlowersBlock> CODEC = simpleCodec(AzaleaFlowersBlock::new);

public AzaleaFlowersBlock(BlockBehaviour.Properties properties) {
super(properties);
this.registerDefaultState(this.defaultBlockState().setValue(WATERLOGGED, false));
}

@Override
protected MapCodec<? extends MultifaceBlock> codec() {
return CODEC;
}

protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
builder.add(WATERLOGGED);
Expand All @@ -42,7 +49,6 @@ public boolean canBeReplaced(BlockState blockState, BlockPlaceContext blockPlace
return !blockPlaceContext.getItemInHand().is(this.asItem()) || super.canBeReplaced(blockState, blockPlaceContext);
}

@SuppressWarnings("deprecation")
public FluidState getFluidState(BlockState blockState) {
return blockState.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(blockState);
}
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/com/ninni/twigs/block/BambooLeavesBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ninni.twigs.block;

import com.mojang.serialization.MapCodec;
import com.ninni.twigs.TwigsProperties;
import com.ninni.twigs.TwigsTags;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -27,7 +28,6 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;

@SuppressWarnings("deprecation")
public class BambooLeavesBlock extends BushBlock implements SimpleWaterloggedBlock {
private static final IntegerProperty LAYERS = TwigsProperties.LAYERS_1_4;
private static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
Expand All @@ -36,18 +36,25 @@ public class BambooLeavesBlock extends BushBlock implements SimpleWaterloggedBlo
public static final VoxelShape SHAPE_THREE = box(0, 0, 0, 16, 3, 16);
public static final VoxelShape SHAPE_FOUR = box(0, 0, 0, 16, 5, 16);

private static final MapCodec<BambooLeavesBlock> CODEC = simpleCodec(BambooLeavesBlock::new);

public BambooLeavesBlock(Properties properties) {
super(properties);
this.registerDefaultState(this.stateDefinition.any().setValue(LAYERS, 1).setValue(WATERLOGGED, false));
}

@Override
protected MapCodec<? extends BushBlock> codec() {
return CODEC;
}

@Override
public VoxelShape getShape(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, CollisionContext collisionContext) {
return switch (blockState.getValue(LAYERS)) {
default -> SHAPE_ONE;
case 2 -> SHAPE_TWO;
case 3 -> SHAPE_THREE;
case 4 -> SHAPE_FOUR;
default -> SHAPE_ONE;
};
}

Expand Down
6 changes: 2 additions & 4 deletions src/main/java/com/ninni/twigs/block/BambooMatBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;

@SuppressWarnings("deprecation")
public class BambooMatBlock extends Block implements SimpleWaterloggedBlock {
protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
private static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
Expand Down Expand Up @@ -57,8 +56,7 @@ public FluidState getFluidState(BlockState blockState) {
}

@Override
public boolean isPathfindable(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, PathComputationType pathComputationType) {
protected boolean isPathfindable(BlockState blockState, PathComputationType pathComputationType) {
return true;
}

}
}
9 changes: 7 additions & 2 deletions src/main/java/com/ninni/twigs/block/BrickTrailBlock.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.ninni.twigs.block;

import com.mojang.serialization.MapCodec;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelAccessor;
Expand All @@ -22,17 +22,22 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;

@SuppressWarnings("deprecation")
public class BrickTrailBlock extends HorizontalDirectionalBlock implements SimpleWaterloggedBlock {
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
private static final VoxelShape SHAPE = box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D);
private static final MapCodec<BrickTrailBlock> CODEC = simpleCodec(BrickTrailBlock::new);

public BrickTrailBlock(Properties properties) {
super(properties);
this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false));
}

@Override
protected MapCodec<? extends HorizontalDirectionalBlock> codec() {
return CODEC;
}

@Override
public boolean canSurvive(BlockState blockState, LevelReader levelReader, BlockPos blockPos) {
BlockPos belowPos = blockPos.below();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/ninni/twigs/block/ColumnBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;

@SuppressWarnings("deprecation")
public class ColumnBlock extends Block {
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public static final EnumProperty<TwigsColumnShape> SHAPE = TwigsProperties.SHAPE;
Expand Down Expand Up @@ -62,7 +61,7 @@ public VoxelShape getShape(BlockState state, BlockGetter blockGetter, BlockPos b
}

@Override
public boolean isPathfindable(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, PathComputationType pathComputationType) {
public boolean isPathfindable(BlockState blockState, PathComputationType pathComputationType) {
return false;
}

Expand Down
Loading