Skip to content

Commit

Permalink
Grizzly Plushie
Browse files Browse the repository at this point in the history
  • Loading branch information
rotgruengelb committed Apr 13, 2024
1 parent 1a74212 commit f82e02d
Show file tree
Hide file tree
Showing 13 changed files with 286 additions and 14 deletions.
13 changes: 12 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ base {
}

repositories {
maven {
name = 'GeckoLib'
url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/'
content {
includeGroupByRegex("software\\.bernie.*")
includeGroup("com.eliotlash.mclib")
}
}
maven {
url "https://maven.rotgruengelb.net/releases"
}
Expand All @@ -28,20 +36,23 @@ dependencies {

modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation(annotationProcessor("net.rotgruengelb:nixienaut:${project.nixienaut_version}"))
modImplementation "software.bernie.geckolib:geckolib-fabric-1.20.4:${project.geckolib_version}"
}

processResources {
inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version
inputs.property "loader_version", project.loader_version
inputs.property "nixienaut_version", project.nixienaut_version
inputs.property "geckolib_version", project.geckolib_version
filteringCharset "UTF-8"

filesMatching("fabric.mod.json") {
expand "version": project.version,
"minecraft_version": project.minecraft_version,
"loader_version": project.loader_version,
"nixienaut_version": project.nixienaut_version
"nixienaut_version": project.nixienaut_version,
"geckolib_version": project.geckolib_version
}
}

Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ archives_base_name=forestal

# Dependencies
fabric_version=0.96.4+1.20.4
nixienaut_version=1.4.0
nixienaut_version=1.4.0
geckolib_version=4.4.4
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
public class ForestalClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
// This entrypoint is suitable for setting up client-specific logic, such as rendering.
}
}
15 changes: 5 additions & 10 deletions src/main/java/net/rotgruengelb/forestal/Forestal.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
package net.rotgruengelb.forestal;

import net.fabricmc.api.ModInitializer;

import net.rotgruengelb.forestal.block.ForestalBlocks;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Forestal implements ModInitializer {
// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LoggerFactory.getLogger("forestal");

public static final String MOD_ID = "forestal";
public static final Logger LOGGER = LoggerFactory.getLogger("forestal");

@Override
public void onInitialize() {
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.

LOGGER.info("Hello Fabric world!");
ForestalBlocks.registerModBlocks();
}
}
33 changes: 33 additions & 0 deletions src/main/java/net/rotgruengelb/forestal/block/ForestalBlocks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package net.rotgruengelb.forestal.block;

import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.rotgruengelb.forestal.Forestal;

public class ForestalBlocks {

public static final Block ZONE_BLOCK = registerBlock("grizzly_plushie", new PlushieBlock(FabricBlockSettings.create()
.nonOpaque()));

private static Block registerBlockNoItem(String name, Block block) {
return Registry.register(Registries.BLOCK, new Identifier(Forestal.MOD_ID, name), block);
}

private static Block registerBlock(String name, Block block) {
registerBlockItem(name, new BlockItem(block, new FabricItemSettings()));
return Registry.register(Registries.BLOCK, new Identifier(Forestal.MOD_ID, name), block);
}

private static BlockItem registerBlockItem(String name, BlockItem blockItem) {
return Registry.register(Registries.ITEM, new Identifier(Forestal.MOD_ID, name), blockItem);
}

public static void registerModBlocks() {
Forestal.LOGGER.debug("Registering LandscapeBlocks for " + Forestal.MOD_ID);
}
}
86 changes: 86 additions & 0 deletions src/main/java/net/rotgruengelb/forestal/block/PlushieBlock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package net.rotgruengelb.forestal.block;

import com.mojang.serialization.MapCodec;
import net.minecraft.block.*;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;

public class PlushieBlock extends HorizontalFacingBlock implements Waterloggable {

public static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
protected static final VoxelShape SHAPE = Block.createCuboidShape(4.0, 0.0, 4.0, 12.0, 10.0, 12.0);
protected static final VoxelShape COLLISION_SHAPE = Block.createCuboidShape(4.0, 0.0, 4.0, 12.0, 8.0, 12.0);

public PlushieBlock(AbstractBlock.Settings settings) {
super(settings);
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH)
.with(WATERLOGGED, false));
}

public MapCodec<PlushieBlock> getCodec() {
return null;
}

@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return SHAPE;
}

@Override
public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return COLLISION_SHAPE;
}

@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
return world.getBlockState(pos.down()).isSolid();
}

@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
if (direction == Direction.DOWN && !this.canPlaceAt(state, world, pos)) {
return Blocks.AIR.getDefaultState();
}
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
}

@Override
public BlockState rotate(BlockState state, BlockRotation rotation) {
return state.with(FACING, rotation.rotate(state.get(FACING)));
}

@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
BlockState blockState = this.getDefaultState();
FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos());
blockState = blockState.with(FACING, ctx.getHorizontalPlayerFacing());
return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
}

@Override

public FluidState getFluidState(BlockState state) {
if (state.get(WATERLOGGED).booleanValue()) {
return Fluids.WATER.getStill(false);
}
return super.getFluidState(state);
}

@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING, WATERLOGGED);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"variants": {
"facing=east": {
"model": "forestal:block/grizzly_plushie",
"y": 270
},
"facing=north": {
"model": "forestal:block/grizzly_plushie",
"y": 180
},
"facing=south": {
"model": "forestal:block/grizzly_plushie"
},
"facing=west": {
"model": "forestal:block/grizzly_plushie",
"y": 90
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/assets/forestal/grizzly_plushie.bbmodel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"meta":{"format_version":"4.9","model_format":"java_block","box_uv":true},"name":"grizzly_plushie","parent":"","ambientocclusion":true,"front_gui_light":false,"visible_box":[1,1,0],"variable_placeholders":"","variable_placeholder_buttons":[],"unhandled_root_fields":{},"resolution":{"width":32,"height":32},"elements":[{"name":"cube","box_uv":true,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[4.5,0,6],"to":[11.5,9,11],"autouv":0,"color":0,"origin":[8.5,0,9],"faces":{"north":{"uv":[5,5,12,14],"texture":0},"east":{"uv":[0,5,5,14],"texture":0},"south":{"uv":[17,5,24,14],"texture":0},"west":{"uv":[12,5,17,14],"texture":0},"up":{"uv":[12,5,5,0],"texture":0},"down":{"uv":[19,0,12,5],"texture":0}},"type":"cube","uuid":"087812e8-1690-9738-4f48-af1a1e2dbdf9"},{"name":"cube","box_uv":true,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[9.5,0,5],"to":[12.5,2,6],"autouv":0,"color":6,"rotation":[0,-22.5,0],"origin":[11,1,5.5],"uv_offset":[16,19],"faces":{"north":{"uv":[17,20,20,22],"texture":0},"east":{"uv":[16,20,17,22],"texture":0},"south":{"uv":[21,20,24,22],"texture":0},"west":{"uv":[20,20,21,22],"texture":0},"up":{"uv":[20,20,17,19],"texture":0},"down":{"uv":[23,19,20,20],"texture":0}},"type":"cube","uuid":"8ff96bcb-edab-356d-d1a6-dd59f76a8bf4"},{"name":"cube","box_uv":true,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[3.5,0,5],"to":[6.5,2,6],"autouv":0,"color":6,"rotation":[0,22.5,0],"origin":[5,1,5.5],"uv_offset":[16,22],"faces":{"north":{"uv":[17,23,20,25],"texture":0},"east":{"uv":[16,23,17,25],"texture":0},"south":{"uv":[21,23,24,25],"texture":0},"west":{"uv":[20,23,21,25],"texture":0},"up":{"uv":[20,23,17,22],"texture":0},"down":{"uv":[23,22,20,23],"texture":0}},"type":"cube","uuid":"804c0a8d-4e9e-3f92-b5b4-ac316559d9cc"},{"name":"cube","box_uv":true,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[9.5,8,8],"to":[12.5,10,9],"autouv":0,"color":8,"origin":[8.5,0,9],"uv_offset":[0,19],"faces":{"north":{"uv":[1,20,4,22],"texture":0},"east":{"uv":[0,20,1,22],"texture":0},"south":{"uv":[5,20,8,22],"texture":0},"west":{"uv":[4,20,5,22],"texture":0},"up":{"uv":[4,20,1,19],"texture":0},"down":{"uv":[7,19,4,20],"texture":0}},"type":"cube","uuid":"9bb79ca1-3473-8e2c-8694-5d1c5e4a623a"},{"name":"cube","box_uv":true,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[3.5,8,8],"to":[6.5,10,9],"autouv":0,"color":8,"origin":[8.5,0,9],"uv_offset":[16,14],"faces":{"north":{"uv":[17,15,20,17],"texture":0},"east":{"uv":[16,15,17,17],"texture":0},"south":{"uv":[21,15,24,17],"texture":0},"west":{"uv":[20,15,21,17],"texture":0},"up":{"uv":[20,15,17,14],"texture":0},"down":{"uv":[23,14,20,15],"texture":0}},"type":"cube","uuid":"38dd8ded-45ec-64a9-a6bd-01aca5d3973b"},{"name":"cube","box_uv":true,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[5.5,5,4],"to":[10.5,7,7],"autouv":0,"color":5,"origin":[8.5,0,9],"uv_offset":[0,14],"faces":{"north":{"uv":[3,17,8,19],"texture":0},"east":{"uv":[0,17,3,19],"texture":0},"south":{"uv":[11,17,16,19],"texture":0},"west":{"uv":[8,17,11,19],"texture":0},"up":{"uv":[8,17,3,14],"texture":0},"down":{"uv":[13,14,8,17],"texture":0}},"type":"cube","uuid":"eb134a56-16d4-8aa5-0bb7-849daeab8476"},{"name":"cube","box_uv":true,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[8.89941753585461,-0.574010924528082,8],"to":[9.89941753585461,3.4259890754719198,10],"autouv":0,"color":0,"rotation":[0,0,22.5],"origin":[8,9.5,8],"uv_offset":[6,21],"faces":{"north":{"uv":[8,23,9,27],"texture":0},"east":{"uv":[6,23,8,27],"texture":0},"south":{"uv":[11,23,12,27],"texture":0},"west":{"uv":[9,23,11,27],"texture":0},"up":{"uv":[9,23,8,21],"texture":0},"down":{"uv":[10,21,9,23],"texture":0}},"type":"cube","uuid":"e71f7df3-c91f-31ba-66d8-5c2254c4c3f9"},{"name":"cube","box_uv":true,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[6.1006,-0.5739999999999981,8],"to":[7.1006,3.4259999999999984,10],"autouv":0,"color":0,"rotation":[0,0,-22.5],"origin":[8,9.5,8],"uv_offset":[0,21],"faces":{"north":{"uv":[2,23,3,27],"texture":0},"east":{"uv":[0,23,2,27],"texture":0},"south":{"uv":[5,23,6,27],"texture":0},"west":{"uv":[3,23,5,27],"texture":0},"up":{"uv":[3,23,2,21],"texture":0},"down":{"uv":[4,21,3,23],"texture":0}},"type":"cube","uuid":"34efee8e-3c9f-c2ea-f656-a83ab7a95590"}],"outliner":[{"name":"grizzly_plushie","origin":[8,8,8],"color":0,"uuid":"0d1c5e92-650a-ec54-04c7-966f79fdef5f","export":true,"mirror_uv":false,"isOpen":true,"locked":false,"visibility":true,"autouv":0,"children":["087812e8-1690-9738-4f48-af1a1e2dbdf9","8ff96bcb-edab-356d-d1a6-dd59f76a8bf4","804c0a8d-4e9e-3f92-b5b4-ac316559d9cc","9bb79ca1-3473-8e2c-8694-5d1c5e4a623a","38dd8ded-45ec-64a9-a6bd-01aca5d3973b","eb134a56-16d4-8aa5-0bb7-849daeab8476","e71f7df3-c91f-31ba-66d8-5c2254c4c3f9","34efee8e-3c9f-c2ea-f656-a83ab7a95590"]}],"textures":[{"path":"","name":"texture","folder":"block","namespace":"","id":"0","width":32,"height":32,"uv_width":32,"uv_height":32,"particle":false,"layers_enabled":false,"sync_to_project":"","render_mode":"default","render_sides":"auto","frame_time":1,"frame_order_type":"loop","frame_order":"","frame_interpolate":false,"visible":true,"internal":true,"saved":false,"uuid":"5bc2b7eb-01e1-e8dd-dc3a-f0141b7dd09f","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAl5JREFUWEftVz0vREEUnUew2Y2PyCoEESWRoFNYrVqnoEWiUBF+AaFSSNBS6NRaFDoKoRREFDayiI2PsHJHzubsmPdmXrIUYpq3b97MvWfOPffe2UBZxsRQX0Gm65M16j7/UrLCfOeP2/ungc1e1Jx1gwAQ542par337um1COTXAIABecKpgLrMPoQeqGwMzA736xCAAXgUJn4NAJw3JCpV7vldh0FG2QGw4JhbAQDn0IHJvakHCREGvq3vHkUKMwAAjjmMsAhdzrFf9rBovQAAediJbMqP2sPrvQAA/clVVl3nvlTe2ZzWT64FZzdZPdfSUKe629LfagRSNxYDUDynG+i2xdT2zZYx0M3SzqGfBtiZqYEfFeFIpqtYdlmIZhYwCMTYJwtcxSkQALbTI55cB2xi5CppyxQvALbaKgBMpUf1AdYGr3MCsDmPOwchi+M4zsVPiUIPNuYLyWRK+8/nn0JxDIwvFPeFZRHYc2YBe8n0tGpB8liYGlMABWAMACIOQ+sVAjn5/OqmtpGoqijaen770L8FBDuNG6Ko9ZpKAYBFctrp5TW1MjNZEoYfBYAbkIDgdgv6FkcHNUC0ZLPTiQ7QuM5vH/VZRAOu+GsRhrVj+SiOzKsZmDI7Jb/zbxcIXYhgtLc9rY4vvhoOhgDoaKpVOJn5jdMOjYsbmLMbikGwII6EZqDmeVk3t7VnbSyuEEWKkC8kPuo2T8Txh0bEDsIQBhq+Aq5iEA9ib9Z5eTcBQMBhlxanBriS+TDgMuhjg9cEZvz4Kg5Kec5FaWwAcTeUe33s/3L/AP4cA5/yFogwMtjKLgAAAABJRU5ErkJggg=="}],"display":{}}
Loading

0 comments on commit f82e02d

Please sign in to comment.