generated from QuiltMC/quilt-template-mod
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get minimal version of arch-ex 4.0 working
- Loading branch information
1 parent
be9ed4c
commit 5378442
Showing
28 changed files
with
258 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/gay/debuggy/architecture_extensions/ArchExItemGroups.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package gay.debuggy.architecture_extensions; | ||
|
||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; | ||
import net.minecraft.block.Blocks; | ||
import net.minecraft.item.ItemGroup; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.RegistryKey; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.Identifier; | ||
|
||
import static gay.debuggy.architecture_extensions.ArchitectureExtensions.MOD_ID; | ||
import static gay.debuggy.architecture_extensions.ArchitectureExtensionsBlocks.BIRCH_BEAM; | ||
|
||
public class ArchExItemGroups { | ||
public static RegistryKey<ItemGroup> makeItemGroupKey(String mod_id, String itemGroupPath) { | ||
return RegistryKey.of(Registries.ITEM_GROUP.getKey(), new Identifier(mod_id, itemGroupPath)); | ||
} | ||
|
||
public static final RegistryKey<ItemGroup> ARCH_EX_JSON_BLOCKS_KEY = makeItemGroupKey(MOD_ID, "json_blocks"); | ||
public static final RegistryKey<ItemGroup> ARCH_EX_GLTF_BLOCKS_KEY = makeItemGroupKey(MOD_ID, "gltf_blocks"); | ||
|
||
public static final ItemGroup ARCH_EX_JSON_BLOCKS = FabricItemGroup.builder() | ||
.icon(() -> new ItemStack(BIRCH_BEAM)) | ||
.name(Text.of("Arch-Ex Building Blocks")) | ||
.build(); | ||
|
||
public static final ItemGroup ARCH_EX_GLTF_BLOCKS = FabricItemGroup.builder() | ||
.icon(() -> new ItemStack(Blocks.ACACIA_LEAVES)) | ||
.name(Text.of("Arch-Ex Building Blocks")) | ||
.build(); | ||
|
||
public static void init() {} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/gay/debuggy/architecture_extensions/ArchitectureExtensions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package gay.debuggy.architecture_extensions; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
|
||
import static gay.debuggy.architecture_extensions.ArchitectureExtensionsBlocks.BIRCH_BEAM; | ||
|
||
public class ArchitectureExtensions implements ModInitializer { | ||
public static final String MOD_ID = "architecture_extensions"; | ||
|
||
@Override | ||
public void onInitialize() { | ||
Registry.register(Registries.ITEM_GROUP, ArchExItemGroups.ARCH_EX_JSON_BLOCKS_KEY, ArchExItemGroups.ARCH_EX_JSON_BLOCKS); | ||
Registry.register(Registries.ITEM_GROUP, ArchExItemGroups.ARCH_EX_GLTF_BLOCKS_KEY, ArchExItemGroups.ARCH_EX_GLTF_BLOCKS); | ||
|
||
ItemGroupEvents.modifyEntriesEvent(ArchExItemGroups.ARCH_EX_JSON_BLOCKS_KEY).register(itemGroup -> { | ||
itemGroup.addItem(BIRCH_BEAM); | ||
}); | ||
|
||
ItemGroupEvents.modifyEntriesEvent(ArchExItemGroups.ARCH_EX_GLTF_BLOCKS_KEY).register(itemGroup -> { | ||
itemGroup.addItem(BIRCH_BEAM); | ||
}); | ||
|
||
ArchitectureExtensionsBlocks.init(); | ||
ArchExItemGroups.init(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/gay/debuggy/architecture_extensions/ArchitectureExtensionsBlocks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package gay.debuggy.architecture_extensions; | ||
|
||
import gay.debuggy.architecture_extensions.blocks.BeamBlock; | ||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.Blocks; | ||
import net.minecraft.item.BlockItem; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class ArchitectureExtensionsBlocks { | ||
private static <T extends Block> T registerBlock(String path, T block) { | ||
Registry.register(Registries.BLOCK, new Identifier(ArchitectureExtensions.MOD_ID, path), block); | ||
Registry.register(Registries.ITEM, new Identifier(ArchitectureExtensions.MOD_ID, path), new BlockItem(block, new Item.Settings())); | ||
return block; | ||
} | ||
|
||
public static final BeamBlock BIRCH_BEAM = registerBlock("birch_beam", new BeamBlock(FabricBlockSettings.copyOf(Blocks.BIRCH_LOG))); | ||
|
||
public static void init() {} | ||
} |
89 changes: 89 additions & 0 deletions
89
src/main/java/gay/debuggy/architecture_extensions/blocks/BeamBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package gay.debuggy.architecture_extensions.blocks; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.PillarBlock; | ||
import net.minecraft.block.ShapeContext; | ||
import net.minecraft.block.Waterloggable; | ||
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.Properties; | ||
import net.minecraft.state.property.Property; | ||
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 org.joml.Vector3d; | ||
|
||
public class BeamBlock extends PillarBlock implements Waterloggable { | ||
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; | ||
|
||
protected static final VoxelShape X_AXIS_BOX = Block.createCuboidShape(0.0, 2.0, 2.0, 16.0, 14.0, 14.0); | ||
protected static final VoxelShape Y_AXIS_BOX = Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 16.0, 14.0); | ||
protected static final VoxelShape Z_AXIS_BOX = Block.createCuboidShape(2.0, 2.0, 0.0, 14.0, 14.0, 16.0); | ||
|
||
public BeamBlock(Settings settings) { | ||
super(settings); | ||
setDefaultState(this.stateManager.getDefaultState().with(AXIS, Direction.Axis.Y)); | ||
this.setDefaultState(this.getDefaultState().with(WATERLOGGED, false)); // Thanks LambdAurora! | ||
} | ||
|
||
// The following deals with block rotation | ||
@Override | ||
public BlockState rotate(BlockState state, BlockRotation rotation) { | ||
return changeRotation(state, rotation); | ||
} | ||
|
||
public static BlockState changeRotation(BlockState state, BlockRotation rotation) { | ||
return switch (rotation) { | ||
case COUNTERCLOCKWISE_90, CLOCKWISE_90 -> switch (state.get(AXIS)) { | ||
case X -> state.with(AXIS, Direction.Axis.Z); | ||
case Z -> state.with(AXIS, Direction.Axis.X); | ||
default -> state; | ||
}; | ||
default -> state; | ||
}; | ||
} | ||
|
||
// Both of the following blocks of code below deals with block collision. | ||
@Override | ||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { | ||
Direction.Axis cardinalDir = state.get(AXIS); | ||
return switch (cardinalDir) { | ||
case X -> X_AXIS_BOX; | ||
case Y -> Y_AXIS_BOX; | ||
case Z -> Z_AXIS_BOX; | ||
}; | ||
} | ||
|
||
// Deals with placing the block properly in accordance to direction. | ||
@Override | ||
public BlockState getPlacementState(ItemPlacementContext context) { | ||
return this.getDefaultState().with(AXIS, context.getSide().getAxis()).with(WATERLOGGED, context.getWorld().getFluidState(context.getBlockPos()).getFluid() == Fluids.WATER); | ||
} | ||
|
||
// Deals with block waterlogging. Thanks acikek! | ||
@Override | ||
public FluidState getFluidState(BlockState state) { | ||
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); | ||
} | ||
|
||
@Override | ||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { | ||
if (state.get(WATERLOGGED)) { | ||
world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); | ||
} | ||
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); | ||
} | ||
|
||
// Appending block properties | ||
@Override | ||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) { | ||
stateManager.add(new Property[]{AXIS, WATERLOGGED}); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/resources/assets/architecture_extensions/blockstates/birch_beam.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"variants": { | ||
"axis=x": { | ||
"model": "architecture_extensions:block/birch_beam", | ||
"x": 90, | ||
"y": 90 | ||
}, | ||
"axis=y": { | ||
"model": "architecture_extensions:block/birch_beam" | ||
}, | ||
"axis=z": { | ||
"model": "architecture_extensions:block/birch_beam", | ||
"x": 90 | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/architecture_extensions/models/block/birch_beam.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"parent": "architecture_extensions:block/template_beam", | ||
"textures": { | ||
"texture_side": "minecraft:block/stripped_birch_log", | ||
"texture_up": "minecraft:block/stripped_birch_log_top" | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/main/resources/assets/architecture_extensions/models/block/template_beam.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"credit": "Made with Blockbench", | ||
"textures": { | ||
"particle": "#texture_side" | ||
}, | ||
"elements": [ | ||
{ | ||
"from": [2, 0, 2], | ||
"to": [14, 16, 14], | ||
"faces": { | ||
"north": {"uv": [2, 0, 14, 16], "texture": "#texture_side"}, | ||
"east": {"uv": [2, 0, 14, 16], "texture": "#texture_side"}, | ||
"south": {"uv": [2, 0, 14, 16], "texture": "#texture_side"}, | ||
"west": {"uv": [2, 0, 14, 16], "texture": "#texture_side"}, | ||
"up": {"uv": [2, 2, 14, 14], "texture": "#texture_up", "cullface": "up"}, | ||
"down": {"uv": [2, 2, 14, 14], "texture": "#texture_up", "cullface": "down"} | ||
} | ||
} | ||
], | ||
"display": { | ||
"thirdperson_righthand": { | ||
"rotation": [75, 45, 0], | ||
"translation": [0, 2.5, 0], | ||
"scale": [0.375, 0.375, 0.375] | ||
}, | ||
"thirdperson_lefthand": { | ||
"rotation": [75, 45, 0], | ||
"translation": [0, 2.5, 0], | ||
"scale": [0.375, 0.375, 0.375] | ||
}, | ||
"firstperson_righthand": { | ||
"rotation": [0, 45, 0], | ||
"scale": [0.4, 0.4, 0.4] | ||
}, | ||
"firstperson_lefthand": { | ||
"rotation": [0, 225, 0], | ||
"scale": [0.4, 0.4, 0.4] | ||
}, | ||
"ground": { | ||
"translation": [0, 3, 0], | ||
"scale": [0.25, 0.25, 0.25] | ||
}, | ||
"gui": { | ||
"rotation": [30, 225, 0], | ||
"scale": [0.625, 0.625, 0.625] | ||
}, | ||
"fixed": { | ||
"scale": [0.5, 0.5, 0.5] | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/main/resources/assets/architecture_extensions/models/item/birch_beam.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"parent": "architecture_extensions:block/birch_beam" | ||
} |
38 changes: 0 additions & 38 deletions
38
src/main/resources/data/architecture_extensions/recipes/debuggy_block.json
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/main/resources/data/architecture_extensions/recipes/end_rod_with_nub.json
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/main/resources/data/architecture_extensions/recipes/end_rod_without_nub.json
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
src/main/resources/data/architecture_extensions/recipes/fake_end_portal_block.json
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
src/main/resources/data/architecture_extensions/templates/recipe/bamboo_rod.json
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
src/main/resources/data/architecture_extensions/templates/recipe/copper_rod.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.