This repository has been archived by the owner on Aug 6, 2024. It is now read-only.
generated from miners-online/base-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
320 additions
and
8 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/uk/minersonline/RealisticComputers/ModBlocks.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,31 @@ | ||
package uk.minersonline.RealisticComputers; | ||
|
||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings; | ||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; | ||
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.entity.BlockEntityType; | ||
import net.minecraft.item.BlockItem; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.util.Identifier; | ||
import uk.minersonline.RealisticComputers.block.VNCTerminal; | ||
import uk.minersonline.RealisticComputers.block.VNCTerminalBlockEntity; | ||
|
||
import static uk.minersonline.RealisticComputers.RealisticComputers.MOD_ID; | ||
|
||
public class ModBlocks { | ||
public static final Block VNC_TERMINAL = new VNCTerminal(FabricBlockSettings.create().strength(4.0f).nonOpaque()); | ||
public static final BlockItem VNC_TERMINAL_ITEM = new BlockItem(VNC_TERMINAL, new FabricItemSettings()); | ||
|
||
public static final BlockEntityType<VNCTerminalBlockEntity> VNC_TERMINAL_BLOCK_ENTITY = Registry.register( | ||
Registries.BLOCK_ENTITY_TYPE, | ||
new Identifier(MOD_ID, "vnc_terminal"), | ||
FabricBlockEntityTypeBuilder.create(VNCTerminalBlockEntity::new, VNC_TERMINAL).build() | ||
); | ||
|
||
public static void init() { | ||
Registry.register(Registries.BLOCK, new Identifier(MOD_ID, "vnc_terminal"), VNC_TERMINAL); | ||
Registry.register(Registries.ITEM, new Identifier(MOD_ID, "vnc_terminal"), VNC_TERMINAL_ITEM); | ||
} | ||
} |
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
51 changes: 51 additions & 0 deletions
51
src/main/java/uk/minersonline/RealisticComputers/block/VNCTerminal.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,51 @@ | ||
package uk.minersonline.RealisticComputers.block; | ||
|
||
import net.minecraft.block.*; | ||
import net.minecraft.block.entity.BlockEntity; | ||
import net.minecraft.item.ItemPlacementContext; | ||
import net.minecraft.state.StateManager; | ||
import net.minecraft.state.property.Properties; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.util.shape.VoxelShape; | ||
import net.minecraft.util.shape.VoxelShapes; | ||
import net.minecraft.world.BlockView; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class VNCTerminal extends HorizontalFacingBlock implements BlockEntityProvider { | ||
public VNCTerminal(Settings settings) { | ||
super(settings); | ||
setDefaultState(getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH)); | ||
} | ||
|
||
@Override | ||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) { | ||
builder.add(Properties.HORIZONTAL_FACING); | ||
} | ||
|
||
@SuppressWarnings("deprecation") | ||
@Override | ||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { | ||
Direction dir = state.get(FACING); | ||
return switch (dir) { | ||
case NORTH -> VoxelShapes.cuboid(0.0f, 0.0f, 0.5f, 1.0f, 1.0f, 1.0f); | ||
case SOUTH -> VoxelShapes.cuboid(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.5f); | ||
case EAST -> VoxelShapes.cuboid(0.0f, 0.0f, 0.0f, 0.5f, 1.0f, 1.0f); | ||
case WEST -> VoxelShapes.cuboid(0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f); | ||
default -> VoxelShapes.fullCube(); | ||
}; | ||
} | ||
|
||
@SuppressWarnings("DataFlowIssue") | ||
@Override | ||
public BlockState getPlacementState(ItemPlacementContext ctx) { | ||
return super.getPlacementState(ctx).with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); | ||
} | ||
|
||
|
||
@Nullable | ||
@Override | ||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { | ||
return new VNCTerminalBlockEntity(pos, state); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/uk/minersonline/RealisticComputers/block/VNCTerminalBlockEntity.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,12 @@ | ||
package uk.minersonline.RealisticComputers.block; | ||
|
||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.entity.BlockEntity; | ||
import net.minecraft.util.math.BlockPos; | ||
import uk.minersonline.RealisticComputers.ModBlocks; | ||
|
||
public class VNCTerminalBlockEntity extends BlockEntity { | ||
public VNCTerminalBlockEntity(BlockPos pos, BlockState state) { | ||
super(ModBlocks.VNC_TERMINAL_BLOCK_ENTITY, pos, state); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/resources/assets/realistic_computers/blockstates/vnc_terminal.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,9 @@ | ||
{ | ||
"variants": { | ||
"facing=north": { "model": "realistic_computers:block/vnc_terminal" }, | ||
"facing=east": { "model": "realistic_computers:block/vnc_terminal", "y": 90 }, | ||
"facing=south": { "model": "realistic_computers:block/vnc_terminal", "y": 180 }, | ||
"facing=west": { "model": "realistic_computers:block/vnc_terminal", "y": 270 } | ||
} | ||
} | ||
|
4 changes: 4 additions & 0 deletions
4
src/main/resources/assets/realistic_computers/lang/en_us.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,4 @@ | ||
{ | ||
"realistic_computers.main_group": "Realistic Computers", | ||
"block.realistic_computers.vnc_terminal": "VNC Terminal" | ||
} |
172 changes: 172 additions & 0 deletions
172
src/main/resources/assets/realistic_computers/models/block/vnc_terminal.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,172 @@ | ||
{ | ||
"credit": "Made with Blockbench", | ||
"parent": "block/block", | ||
"texture_size": [32, 32], | ||
"textures": { | ||
"0": "realistic_computers:block/vnc_terminal/keyboard", | ||
"1": "realistic_computers:block/vnc_terminal/mouse", | ||
"2": "realistic_computers:block/vnc_terminal/stand", | ||
"3": "realistic_computers:block/vnc_terminal/stand2", | ||
"4": "realistic_computers:block/vnc_terminal/frame_long", | ||
"5": "realistic_computers:block/vnc_terminal/frame_back", | ||
"6": "realistic_computers:block/vnc_terminal/frame_side", | ||
"7": "realistic_computers:block/vnc_terminal/screen", | ||
"particle": "realistic_computers:block/vnc_terminal/keyboard" | ||
}, | ||
"elements": [ | ||
{ | ||
"from": [0, 5, 12], | ||
"to": [16, 6, 14], | ||
"faces": { | ||
"north": {"uv": [0, 4, 16, 5], "texture": "#4", "cullface": "north"}, | ||
"east": {"uv": [0, 6, 2, 7], "texture": "#4", "cullface": "east"}, | ||
"south": {"uv": [0, 5, 16, 6], "texture": "#4", "cullface": "south"}, | ||
"west": {"uv": [2, 6, 4, 7], "texture": "#4", "cullface": "west"}, | ||
"up": {"uv": [16, 2, 0, 0], "texture": "#4", "cullface": "up"}, | ||
"down": {"uv": [16, 2, 0, 4], "texture": "#4", "cullface": "down"} | ||
} | ||
}, | ||
{ | ||
"from": [0, 14, 12], | ||
"to": [16, 15, 14], | ||
"faces": { | ||
"north": {"uv": [0, 0, 16, 1], "texture": "#4", "cullface": "north"}, | ||
"east": {"uv": [0, 0, 2, 1], "texture": "#4", "cullface": "east"}, | ||
"south": {"uv": [0, 0, 16, 1], "texture": "#4", "cullface": "south"}, | ||
"west": {"uv": [0, 0, 2, 1], "texture": "#4", "cullface": "west"}, | ||
"up": {"uv": [0, 0, 16, 2], "texture": "#4", "cullface": "up"}, | ||
"down": {"uv": [0, 0, 16, 2], "texture": "#4", "cullface": "down"} | ||
} | ||
}, | ||
{ | ||
"from": [1, 6, 13], | ||
"to": [15, 14, 14], | ||
"faces": { | ||
"north": {"uv": [0, 0, 7, 4], "texture": "#5", "cullface": "north"}, | ||
"east": {"uv": [7, 1, 7.5, 5], "texture": "#5", "cullface": "east"}, | ||
"south": {"uv": [0, 4, 7, 8], "texture": "#5", "cullface": "south"}, | ||
"west": {"uv": [7, 5, 7.5, 9], "texture": "#5", "cullface": "west"}, | ||
"up": {"uv": [14, 0.5, 7, 0], "texture": "#5", "cullface": "up"}, | ||
"down": {"uv": [14, 0.5, 7, 1], "texture": "#5", "cullface": "down"} | ||
} | ||
}, | ||
{ | ||
"name": "screen", | ||
"from": [1, 6, 12], | ||
"to": [15, 14, 13], | ||
"faces": { | ||
"north": {"uv": [0, 0, 7, 4], "texture": "#7", "cullface": "north"}, | ||
"east": {"uv": [7, 1, 7.5, 5], "texture": "#7", "cullface": "east"}, | ||
"south": {"uv": [0, 4, 7, 8], "texture": "#7", "cullface": "south"}, | ||
"west": {"uv": [7, 5, 7.5, 9], "texture": "#7", "cullface": "west"}, | ||
"up": {"uv": [14, 0.5, 7, 0], "texture": "#7", "cullface": "up"}, | ||
"down": {"uv": [14, 0.5, 7, 1], "texture": "#7", "cullface": "down"} | ||
} | ||
}, | ||
{ | ||
"from": [15, 6, 12], | ||
"to": [16, 14, 14], | ||
"faces": { | ||
"north": {"uv": [8, 0, 10, 16], "texture": "#6", "cullface": "north"}, | ||
"east": {"uv": [0, 0, 4, 16], "texture": "#6", "cullface": "east"}, | ||
"south": {"uv": [10, 0, 12, 16], "texture": "#6", "cullface": "south"}, | ||
"west": {"uv": [4, 0, 8, 16], "texture": "#6", "cullface": "west"}, | ||
"up": {"uv": [14, 4, 12, 0], "texture": "#6", "cullface": "up"}, | ||
"down": {"uv": [14, 4, 12, 8], "texture": "#6", "cullface": "down"} | ||
} | ||
}, | ||
{ | ||
"from": [0, 6, 12], | ||
"to": [1, 14, 14], | ||
"faces": { | ||
"north": {"uv": [0, 0, 0.5, 4], "texture": "#6", "cullface": "north"}, | ||
"east": {"uv": [0, 0, 1, 4], "texture": "#6", "cullface": "east"}, | ||
"south": {"uv": [0, 0, 0.5, 4], "texture": "#6", "cullface": "south"}, | ||
"west": {"uv": [0, 0, 1, 4], "texture": "#6", "cullface": "west"}, | ||
"up": {"uv": [0, 0, 0.5, 1], "texture": "#6", "cullface": "up"}, | ||
"down": {"uv": [0, 0, 0.5, 1], "texture": "#6", "cullface": "down"} | ||
} | ||
}, | ||
{ | ||
"name": "stand1", | ||
"from": [5, 0, 12], | ||
"to": [11, 2, 14], | ||
"faces": { | ||
"north": {"uv": [0, 0, 12, 4], "texture": "#2","cullface": "north"}, | ||
"east": {"uv": [12, 0, 16, 4], "texture": "#2", "cullface": "east"}, | ||
"south": {"uv": [0, 4, 12, 8], "texture": "#2", "cullface": "south"}, | ||
"west": {"uv": [12, 4, 16, 8], "texture": "#2", "cullface": "west"}, | ||
"up": {"uv": [12, 12, 0, 8], "texture": "#2", "cullface": "up"}, | ||
"down": {"uv": [12, 12, 0, 16], "texture": "#2", "cullface": "down"} | ||
} | ||
}, | ||
{ | ||
"name": "stand2", | ||
"from": [7, 2, 12], | ||
"to": [9, 5, 14], | ||
"faces": { | ||
"north": {"uv": [0, 0, 4, 6], "texture": "#3", "cullface": "north"}, | ||
"east": {"uv": [4, 0, 8, 6], "texture": "#3", "cullface": "east"}, | ||
"south": {"uv": [0, 6, 4, 12], "texture": "#3", "cullface": "south"}, | ||
"west": {"uv": [4, 6, 8, 12], "texture": "#3", "cullface": "west"}, | ||
"up": {"uv": [12, 4, 8, 0], "texture": "#3", "cullface": "up"}, | ||
"down": {"uv": [12, 4, 8, 8], "texture": "#3", "cullface": "down"} | ||
} | ||
}, | ||
{ | ||
"name": "keyboard", | ||
"from": [4, 0, 2], | ||
"to": [16, 1, 8], | ||
"faces": { | ||
"north": {"uv": [0, 6, 6, 6.5], "texture": "#0", "cullface": "north"}, | ||
"east": {"uv": [6, 0.5, 9, 1], "texture": "#0", "cullface": "east"}, | ||
"south": {"uv": [6, 0, 12, 0.5], "texture": "#0", "cullface": "south"}, | ||
"west": {"uv": [6, 1, 9, 1.5], "texture": "#0", "cullface": "west"}, | ||
"up": {"uv": [6, 3, 0, 0], "texture": "#0", "cullface": "up"}, | ||
"down": {"uv": [6, 3, 0, 6], "texture": "#0", "cullface": "down"} | ||
} | ||
}, | ||
{ | ||
"name": "mouse", | ||
"from": [0, 0, 2], | ||
"to": [3, 1, 6], | ||
"faces": { | ||
"north": {"uv": [0, 10, 6, 12], "texture": "#1", "cullface": "north"}, | ||
"east": {"uv": [0, 8, 8, 10], "texture": "#1", "cullface": "east"}, | ||
"south": {"uv": [6, 10, 12, 12], "texture": "#1", "cullface": "south"}, | ||
"west": {"uv": [8, 8, 16, 10], "texture": "#1", "cullface": "west"}, | ||
"up": {"uv": [6, 8, 0, 0], "texture": "#1", "cullface": "up"}, | ||
"down": {"uv": [12, 0, 6, 8], "texture": "#1", "cullface": "down"} | ||
} | ||
} | ||
], | ||
"groups": [ | ||
{ | ||
"name": "monitor", | ||
"origin": [8, 8, 8], | ||
"color": 0, | ||
"children": [ | ||
{ | ||
"name": "screen_frame", | ||
"origin": [0, 0, 0], | ||
"color": 0, | ||
"children": [0, 1, 2, 3, 4, 5] | ||
}, | ||
{ | ||
"name": "stand", | ||
"origin": [0, 0, 0], | ||
"color": 0, | ||
"children": [6, 7] | ||
} | ||
] | ||
}, | ||
8, | ||
{ | ||
"name": "group", | ||
"origin": [0, 0, 0], | ||
"color": 0, | ||
"children": [] | ||
}, | ||
9 | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
src/main/resources/assets/realistic_computers/models/item/vnc_terminal.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": "realistic_computers:block/vnc_terminal" | ||
} |
Binary file added
BIN
+317 Bytes
...resources/assets/realistic_computers/textures/block/vnc_terminal/frame_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+129 Bytes
...resources/assets/realistic_computers/textures/block/vnc_terminal/frame_long.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+101 Bytes
...resources/assets/realistic_computers/textures/block/vnc_terminal/frame_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+373 Bytes
...n/resources/assets/realistic_computers/textures/block/vnc_terminal/keyboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+133 Bytes
...main/resources/assets/realistic_computers/textures/block/vnc_terminal/mouse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+292 Bytes
...ain/resources/assets/realistic_computers/textures/block/vnc_terminal/screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+97 Bytes
...main/resources/assets/realistic_computers/textures/block/vnc_terminal/stand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+110 Bytes
...ain/resources/assets/realistic_computers/textures/block/vnc_terminal/stand2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions
19
src/main/resources/data/realistic_computers/blocks/vnc_terminal.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,19 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"rolls": 1, | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "realistic_computers:vnc_terminal" | ||
} | ||
], | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
] | ||
} | ||
] | ||
} |