generated from NeoForgeMDKs/MDK-1.21-ModDevGradle
-
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.
it doesn't do anything yet, no, but it's exciting! isn't it?
- Loading branch information
1 parent
291675a
commit a740774
Showing
12 changed files
with
199 additions
and
8 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
57 changes: 57 additions & 0 deletions
57
src/main/java/io/github/afamiliarquiet/familiar_magic/block/SummoningTableBlock.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,57 @@ | ||
package io.github.afamiliarquiet.familiar_magic.block; | ||
|
||
import com.mojang.serialization.MapCodec; | ||
import io.github.afamiliarquiet.familiar_magic.block.entity.SummoningTableBlockEntity; | ||
import net.minecraft.MethodsReturnNonnullByDefault; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.BaseEntityBlock; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.RenderShape; | ||
import net.minecraft.world.level.block.entity.BlockEntity; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.pathfinder.PathComputationType; | ||
import net.minecraft.world.phys.shapes.CollisionContext; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
@MethodsReturnNonnullByDefault | ||
@ParametersAreNonnullByDefault | ||
public class SummoningTableBlock extends BaseEntityBlock { | ||
public static final MapCodec<SummoningTableBlock> CODEC = simpleCodec(SummoningTableBlock::new); | ||
protected static final VoxelShape SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 12.0, 16.0); | ||
|
||
@Override | ||
protected MapCodec<? extends BaseEntityBlock> codec() { | ||
return CODEC; | ||
} | ||
|
||
public SummoningTableBlock(Properties properties) { | ||
super(properties); | ||
} | ||
|
||
protected boolean useShapeForLightOcclusion(BlockState state) { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { | ||
return SHAPE; | ||
} | ||
|
||
@Override | ||
protected RenderShape getRenderShape(BlockState state) { | ||
return RenderShape.MODEL; | ||
} | ||
|
||
@Override | ||
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { | ||
return new SummoningTableBlockEntity(pos, state); | ||
} | ||
|
||
@Override | ||
protected boolean isPathfindable(BlockState state, PathComputationType pathComputationType) { | ||
return false; | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
.../java/io/github/afamiliarquiet/familiar_magic/block/entity/SummoningTableBlockEntity.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,72 @@ | ||
package io.github.afamiliarquiet.familiar_magic.block.entity; | ||
|
||
import io.github.afamiliarquiet.familiar_magic.block.FamiliarBlocks; | ||
import net.minecraft.MethodsReturnNonnullByDefault; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.core.component.DataComponentMap; | ||
import net.minecraft.core.component.DataComponents; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.Nameable; | ||
import net.minecraft.world.level.block.entity.BlockEntity; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
import javax.annotation.Nullable; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
@MethodsReturnNonnullByDefault | ||
@ParametersAreNonnullByDefault | ||
public class SummoningTableBlockEntity extends BlockEntity implements Nameable { | ||
@Nullable | ||
private Component name; | ||
|
||
public SummoningTableBlockEntity(BlockPos pos, BlockState blockState) { | ||
super(FamiliarBlocks.SUMMONING_TABLE_BLOCK_ENTITY.get(), pos, blockState); | ||
} | ||
|
||
@Override | ||
protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { | ||
super.saveAdditional(tag, registries); | ||
if (this.name != null) { | ||
tag.putString("CustomName", Component.Serializer.toJson(this.name, registries)); | ||
} | ||
} | ||
|
||
@Override | ||
protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { | ||
super.loadAdditional(tag, registries); | ||
if (tag.contains("CustomName", 8)) { | ||
this.name = parseCustomNameSafe(tag.getString("CustomName"), registries); | ||
} | ||
} | ||
|
||
@Override | ||
public Component getName() { | ||
return name != null ? name : Component.translatable("container.familiar_magic.summon"); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public Component getCustomName() { | ||
return this.name; | ||
} | ||
|
||
@Override | ||
protected void applyImplicitComponents(BlockEntity.DataComponentInput componentInput) { | ||
super.applyImplicitComponents(componentInput); | ||
this.name = componentInput.get(DataComponents.CUSTOM_NAME); | ||
} | ||
|
||
@Override | ||
protected void collectImplicitComponents(DataComponentMap.Builder components) { | ||
super.collectImplicitComponents(components); | ||
components.set(DataComponents.CUSTOM_NAME, this.name); | ||
} | ||
|
||
@SuppressWarnings("deprecation") // i mean yeah but also. it's still used in another method so idk | ||
@Override | ||
public void removeComponentsFromTag(CompoundTag tag) { | ||
tag.remove("CustomName"); | ||
} | ||
} |
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
src/main/resources/assets/familiar_magic/blockstates/summoning_table.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": "familiar_magic:block/summoning_table" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"block.familiar_magic.enchanted_candle": "Enchanted Candle" | ||
"block.familiar_magic.enchanted_candle": "Enchanted Candle", | ||
"block.familiar_magic.summoning_table": "Summoning Table", | ||
"container.familiar_magic.summon": "Summon" | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/resources/assets/familiar_magic/models/block/summoning_table.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,22 @@ | ||
{ | ||
"parent": "minecraft:block/block", | ||
"textures": { | ||
"particle": "familiar_magic:block/summoning_table_bottom", | ||
"bottom": "familiar_magic:block/summoning_table_bottom", | ||
"top": "familiar_magic:block/summoning_table_top", | ||
"side": "familiar_magic:block/summoning_table_side" | ||
}, | ||
"elements": [ | ||
{ "from": [ 0, 0, 0 ], | ||
"to": [ 16, 12, 16 ], | ||
"faces": { | ||
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" }, | ||
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top" }, | ||
"north": { "uv": [ 0, 4, 16, 16 ], "texture": "#side", "cullface": "north" }, | ||
"south": { "uv": [ 0, 4, 16, 16 ], "texture": "#side", "cullface": "south" }, | ||
"west": { "uv": [ 0, 4, 16, 16 ], "texture": "#side", "cullface": "west" }, | ||
"east": { "uv": [ 0, 4, 16, 16 ], "texture": "#side", "cullface": "east" } | ||
} | ||
} | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
src/main/resources/assets/familiar_magic/models/item/summoning_table.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": "familiar_magic:block/summoning_table" | ||
} |
Binary file added
BIN
+395 Bytes
src/main/resources/assets/familiar_magic/textures/block/summoning_table_bottom.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
+411 Bytes
src/main/resources/assets/familiar_magic/textures/block/summoning_table_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
+331 Bytes
src/main/resources/assets/familiar_magic/textures/block/summoning_table_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.