-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
1 parent
ca7abd4
commit d2864bc
Showing
15 changed files
with
271 additions
and
0 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
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
7 changes: 7 additions & 0 deletions
7
shared/src/generated/resources/assets/waystones/blockstates/landing_stone.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 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "waystones:block/landing_stone" | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
shared/src/generated/resources/assets/waystones/models/item/landing_stone.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": "waystones:block/landing_stone" | ||
} |
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
67 changes: 67 additions & 0 deletions
67
shared/src/generated/resources/data/waystones/loot_tables/blocks/landing_stone.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,67 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "waystones:landing_stone" | ||
} | ||
], | ||
"functions": [ | ||
{ | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:match_tool", | ||
"predicate": { | ||
"enchantments": [ | ||
{ | ||
"enchantment": "minecraft:silk_touch", | ||
"levels": { | ||
"min": 1 | ||
} | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"function": "minecraft:copy_nbt", | ||
"ops": [ | ||
{ | ||
"op": "replace", | ||
"source": "UUID", | ||
"target": "UUID" | ||
} | ||
], | ||
"source": "block_entity" | ||
}, | ||
{ | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:match_tool", | ||
"predicate": { | ||
"enchantments": [ | ||
{ | ||
"enchantment": "minecraft:silk_touch", | ||
"levels": { | ||
"min": 1 | ||
} | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"function": "minecraft:copy_name", | ||
"source": "block_entity" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
] | ||
} |
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
60 changes: 60 additions & 0 deletions
60
shared/src/main/java/net/blay09/mods/waystones/block/LandingStoneBlock.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,60 @@ | ||
package net.blay09.mods.waystones.block; | ||
|
||
import net.blay09.mods.balm.api.Balm; | ||
import net.blay09.mods.waystones.api.IWaystone; | ||
import net.blay09.mods.waystones.block.entity.LandingStoneBlockEntity; | ||
import net.blay09.mods.waystones.block.entity.WarpPlateBlockEntity; | ||
import net.blay09.mods.waystones.block.entity.WaystoneBlockEntityBase; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.InteractionResult; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.entity.BlockEntity; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.phys.shapes.CollisionContext; | ||
import net.minecraft.world.phys.shapes.Shapes; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class LandingStoneBlock extends WaystoneBlockBase { | ||
private static final VoxelShape SHAPE = Shapes.or( | ||
box(0.0, 0.0, 0.0, 16.0, 1.0, 16.0), | ||
box(3.0, 1.0, 3.0, 13.0, 2.0, 13.0) | ||
).optimize(); | ||
|
||
public LandingStoneBlock(Properties properties) { | ||
super(properties); | ||
registerDefaultState(this.stateDefinition.any() | ||
.setValue(WATERLOGGED, false)); | ||
} | ||
|
||
@Override | ||
protected boolean canSilkTouch() { | ||
return true; | ||
} | ||
|
||
|
||
@Override | ||
public VoxelShape getShape(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, CollisionContext collisionContext) { | ||
return SHAPE; | ||
} | ||
|
||
|
||
@Nullable | ||
@Override | ||
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { | ||
return new LandingStoneBlockEntity(pos, state); | ||
} | ||
|
||
@Override | ||
protected InteractionResult handleActivation(Level world, BlockPos pos, Player player, WaystoneBlockEntityBase tileEntity, IWaystone waystone) { | ||
if (!world.isClientSide) { | ||
Balm.getNetworking().openGui(player, tileEntity.getMenuProvider()); | ||
return InteractionResult.SUCCESS; | ||
} | ||
|
||
return InteractionResult.SUCCESS; | ||
} | ||
|
||
} |
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
56 changes: 56 additions & 0 deletions
56
shared/src/main/java/net/blay09/mods/waystones/block/entity/LandingStoneBlockEntity.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,56 @@ | ||
package net.blay09.mods.waystones.block.entity; | ||
|
||
import net.blay09.mods.balm.api.menu.BalmMenuProvider; | ||
import net.blay09.mods.waystones.api.WaystoneTypes; | ||
import net.blay09.mods.waystones.core.Waystone; | ||
import net.blay09.mods.waystones.menu.ModMenus; | ||
import net.blay09.mods.waystones.menu.WaystoneSettingsMenu; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.network.FriendlyByteBuf; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.MenuProvider; | ||
import net.minecraft.world.entity.player.Inventory; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.inventory.AbstractContainerMenu; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class LandingStoneBlockEntity extends WaystoneBlockEntityBase { | ||
|
||
public LandingStoneBlockEntity(BlockPos worldPosition, BlockState state) { | ||
super(ModBlockEntities.landingStone.get(), worldPosition, state); | ||
} | ||
|
||
@Override | ||
protected ResourceLocation getWaystoneType() { | ||
return WaystoneTypes.LANDING_STONE; | ||
} | ||
|
||
@Override | ||
public MenuProvider getMenuProvider() { | ||
return new BalmMenuProvider() { | ||
@Override | ||
public Component getDisplayName() { | ||
return Component.translatable("container.waystones.waystone_settings"); | ||
} | ||
|
||
@Override | ||
public AbstractContainerMenu createMenu(int i, Inventory playerInventory, Player playerEntity) { | ||
return new WaystoneSettingsMenu(ModMenus.waystoneSettings.get(), getWaystone(), i); | ||
} | ||
|
||
@Override | ||
public void writeScreenOpeningData(ServerPlayer player, FriendlyByteBuf buf) { | ||
Waystone.write(buf, getWaystone()); | ||
} | ||
}; | ||
} | ||
|
||
@Override | ||
public @Nullable MenuProvider getSettingsMenuProvider() { | ||
return getMenuProvider(); | ||
} | ||
|
||
} |
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
66 changes: 66 additions & 0 deletions
66
shared/src/main/resources/assets/waystones/models/block/landing_stone.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,66 @@ | ||
{ | ||
"parent": "block/block", | ||
"credit": "Made with Blockbench", | ||
"textures": { | ||
"texture": "waystones:block/warp_plate", | ||
"particle": "waystones:block/warp_plate", | ||
"inner": "waystones:block/warp_plate_inner", | ||
"base": "waystones:block/warp_plate_base" | ||
}, | ||
"elements": [ | ||
{ | ||
"name": "diag", | ||
"from": [2.5, 1, 2.5], | ||
"to": [13.5, 1.5, 13.5], | ||
"rotation": {"angle": -45, "axis": "y", "origin": [8, 0, 8]}, | ||
"faces": { | ||
"north": {"uv": [0, 0, 10, 0.5], "texture": "#texture"}, | ||
"east": {"uv": [0, 0, 10, 1], "texture": "#texture"}, | ||
"south": {"uv": [0, 0, 10, 0.5], "texture": "#texture"}, | ||
"west": {"uv": [0, 0, 10, 0.5], "texture": "#texture"}, | ||
"up": {"uv": [0, 0, 10, 10], "rotation": 270, "texture": "#texture"}, | ||
"down": {"uv": [0, 0, 10, 10], "rotation": 90, "texture": "#texture"} | ||
} | ||
}, | ||
{ | ||
"name": "bordersouth", | ||
"from": [3, 1, 3], | ||
"to": [13, 2, 13], | ||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, | ||
"faces": { | ||
"north": {"uv": [0, 0, 10, 1], "texture": "#texture"}, | ||
"east": {"uv": [0, 9, 10, 10], "texture": "#texture"}, | ||
"south": {"uv": [0, 9, 10, 10], "texture": "#texture"}, | ||
"west": {"uv": [0, 0, 10, 1], "texture": "#texture"}, | ||
"up": {"uv": [0, 0, 10, 10], "texture": "#texture"}, | ||
"down": {"uv": [0, 0, 10, 10], "texture": "#texture"} | ||
} | ||
}, | ||
{ | ||
"name": "inner", | ||
"from": [5, 2, 5], | ||
"to": [11, 2.01, 11], | ||
"faces": { | ||
"north": {"uv": [0, 0, 6, 0.01], "texture": "#inner"}, | ||
"east": {"uv": [0, 0, 6, 0.01], "texture": "#inner"}, | ||
"south": {"uv": [0, 0, 6, 0.01], "texture": "#inner"}, | ||
"west": {"uv": [0, 0, 6, 0.01], "texture": "#inner"}, | ||
"up": {"uv": [0, 0, 16, 16], "texture": "#inner"}, | ||
"down": {"uv": [0, 0, 6, 6], "texture": "#inner"} | ||
} | ||
}, | ||
{ | ||
"name": "base", | ||
"from": [0, 0, 0], | ||
"to": [16, 1, 16], | ||
"faces": { | ||
"north": {"uv": [0, 0, 16, 0.25], "texture": "#base"}, | ||
"east": {"uv": [0, 0, 16, 0.25], "texture": "#base"}, | ||
"south": {"uv": [0, 0, 16, 0.25], "texture": "#base"}, | ||
"west": {"uv": [0, 0, 16, 0.25], "texture": "#base"}, | ||
"up": {"uv": [0, 0, 16, 16], "texture": "#base"}, | ||
"down": {"uv": [0, 0, 16, 16], "texture": "#base"} | ||
} | ||
} | ||
] | ||
} |