Skip to content

Commit

Permalink
everyhting should work now
Browse files Browse the repository at this point in the history
  • Loading branch information
RealYusufIsmail committed Nov 25, 2023
1 parent 41d5e5d commit 992d89e
Show file tree
Hide file tree
Showing 29 changed files with 61 additions and 57 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2023-11-25T16:11:13.168808 Tags for minecraft:block mod id temporalsmith
// 1.20.1 2023-11-25T18:19:26.130605 Tags for minecraft:block mod id temporalsmith
82963b29c120fb55c17c40fe37b1c98c60346b84 data/forge/tags/blocks/deepslate_ores/aqumarine_ores.json
edd052247952263e801a8ba38de967b85c9c1dc4 data/forge/tags/blocks/deepslate_ores/graphite_ores.json
fc6b7da8497984df4efddd78ed393469f77e7495 data/forge/tags/blocks/deepslate_ores/imperium_ores.json
Expand All @@ -23,4 +23,4 @@ dcbd959620590264e88e226bd2c40f6552839ec6 data/forge/tags/blocks/storage_blocks/r
118f91ee0e0e87a0393fd90770b0fa4db7c74e3e data/minecraft/tags/blocks/needs_diamond_tool.json
dd9f28c0503a62d38ea0f2332885885ccedae3f1 data/minecraft/tags/blocks/needs_iron_tool.json
cef73fd4903f2919af82514cf812d9da3579a438 data/minecraft/tags/blocks/needs_stone_tool.json
3af5f180777788dd4545245855261ca85d08d9d5 data/temporalsmith/tags/blocks/portal_frame_blocks.json
2a312b5b913bb99f9ecc0630737fc15267ee6baf data/temporalsmith/tags/blocks/portal_maker_blocks.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.event.level.BlockEvent;
import org.jetbrains.annotations.NotNull;

public class EnderitePortalFrame extends Block {

Expand All @@ -72,7 +73,7 @@ public EnderitePortalFrame() {
}

@Override
public VoxelShape getShape(
public @NotNull VoxelShape getShape(
BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
return switch (state.getValue(AXIS)) {
case Z -> Z_AABB;
Expand Down Expand Up @@ -231,7 +232,7 @@ public static class EnderitePortalShape extends PortalShape {
private static final int MIN_HEIGHT = 2;
public static final int MAX_HEIGHT = 21;
private static final BlockBehaviour.StatePredicate FRAME =
(state, getter, pos) -> state.is(TagsInit.BlockTagsInit.PORTAL_FRAME_BLOCKS);
(state, getter, pos) -> state.is(TagsInit.BlockTagsInit.PORTAL_MAKER_BLOCKS);
private final LevelAccessor level;
private final Direction.Axis axis;
private final Direction rightDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ class TemporalSmith {
// entity death event
FORGE_BUS.addListener(ClientEvents::onEntityDeath)

FORGE_BUS.register(this)

ModLoadingContext.get()
.registerConfig(ModConfig.Type.COMMON, TemporalSmithConfig.COMMON_SPEC)

FORGE_BUS.register(this)

logger.info("Temporal Smith is loaded!")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ object TagsInit {

// other
@JvmField
val PORTAL_FRAME_BLOCKS =
ResourceLocation.tryParse("$MOD_ID:portal_frame_blocks")?.let { BlockTags.create(it) }
val PORTAL_MAKER_BLOCKS =
ResourceLocation.tryParse("$MOD_ID:portal_maker_blocks")?.let { BlockTags.create(it) }
?: throw Exception("Failed to create tag")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ class ModBlockTagsProvider(
tag(TagsInit.BlockTagsInit.STORAGE_AQUMARINE).add(BlockInit.AQUMARINE_BLOCK.get())
tag(TagsInit.BlockTagsInit.STORAGE_ENDERITE).add(BlockInit.ENDERITE_BLOCK.get())

// portal frame
tag(TagsInit.BlockTagsInit.PORTAL_FRAME_BLOCKS).add(BlockInit.ENDERITE_PORTAL_FRAME.get())
tag(TagsInit.BlockTagsInit.PORTAL_MAKER_BLOCKS).add(BlockInit.ENDERITE_BLOCK.get())

// use BlockTags.MINEABLE_WITH_PICKAXE
BlockInit.ORE_BLOCKS.forEach { oreBlock ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.2 2023-11-23T20:42:55.761757 Tags for minecraft:block mod id temporalsmith
// 1.20.2 2023-11-25T18:18:52.9352 Tags for minecraft:block mod id temporalsmith
82963b29c120fb55c17c40fe37b1c98c60346b84 data/forge/tags/blocks/deepslate_ores/aqumarine_ores.json
edd052247952263e801a8ba38de967b85c9c1dc4 data/forge/tags/blocks/deepslate_ores/graphite_ores.json
fc6b7da8497984df4efddd78ed393469f77e7495 data/forge/tags/blocks/deepslate_ores/imperium_ores.json
Expand All @@ -19,8 +19,8 @@ c13f34abf2e1ad8aa96bf050df7ef5cc00f4fe1d data/forge/tags/blocks/storage_blocks/g
dcbd959620590264e88e226bd2c40f6552839ec6 data/forge/tags/blocks/storage_blocks/rainbow.json
478f3b90295d8c712528b7b1f7d9ae4daad23121 data/forge/tags/blocks/storage_blocks/ruby.json
0ed63eea01e2600c587763dd7f609c87ae6e53d2 data/forge/tags/blocks/storage_blocks/sapphire.json
0c178d1fce23325e08782b60e8ebb0c56672fd96 data/minecraft/tags/blocks/mineable/pickaxe.json
97b808e7ab9c47286d18528dc564e186166d9830 data/minecraft/tags/blocks/mineable/pickaxe.json
118f91ee0e0e87a0393fd90770b0fa4db7c74e3e data/minecraft/tags/blocks/needs_diamond_tool.json
dd9f28c0503a62d38ea0f2332885885ccedae3f1 data/minecraft/tags/blocks/needs_iron_tool.json
cef73fd4903f2919af82514cf812d9da3579a438 data/minecraft/tags/blocks/needs_stone_tool.json
2a312b5b913bb99f9ecc0630737fc15267ee6baf data/temporalsmith/tags/blocks/portal_frame_blocks.json
2a312b5b913bb99f9ecc0630737fc15267ee6baf data/temporalsmith/tags/blocks/portal_maker_blocks.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.2 2023-11-24T12:32:44.9527068 Languages: en_us
87a9d9770f4e3da681c6a033bbdf0e2bea208279 assets/temporalsmith/lang/en_us.json
// 1.20.2 2023-11-25T18:18:52.936448 Languages: en_us
85bf9089b39c43906813319aa2d32ee543fe60ae assets/temporalsmith/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"block.temporalsmith.deepslate_sapphire_ore": "Deepslate Sapphire Ore",
"block.temporalsmith.enderite_block": "Enderite Block",
"block.temporalsmith.enderite_ore": "Enderite Ore",
"block.temporalsmith.enderite_portal_frame": "Enderite Portal Frame",
"block.temporalsmith.graphite_block": "Graphite Block",
"block.temporalsmith.graphite_ore": "Graphite Ore",
"block.temporalsmith.imperium_ore": "Imperium Ore",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"temporalsmith:custom_armour_crafting_table",
"temporalsmith:custom_tool_crafting_table",
"temporalsmith:ingot_fusion_toll_enhancer",
"temporalsmith:enderite_portal_block",
"temporalsmith:enderite_portal_frame",
"temporalsmith:custom_armour_crafting_table"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"temporalsmith:enderite_block"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.neoforged.neoforge.event.level.BlockEvent;

public class EnderitePortalBlock extends Block {
public class EnderitePortalFrame extends Block {

public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.HORIZONTAL_AXIS;
protected static final VoxelShape X_AABB = Block.box(0.0D, 0.0D, 6.0D, 16.0D, 16.0D, 10.0D);
protected static final VoxelShape Z_AABB = Block.box(6.0D, 0.0D, 0.0D, 10.0D, 16.0D, 16.0D);

public EnderitePortalBlock() {
public EnderitePortalFrame() {
super(
Properties.copy(Blocks.NETHER_PORTAL)
.strength(5.0F, 6.0F)
Expand Down Expand Up @@ -152,7 +152,7 @@ public void entityInside(BlockState state, Level level, BlockPos pos, Entity ent
if (destinationWorld != null
&& minecraftserver.isNetherEnabled()
&& !entity.isPassenger()) {
entity.level().getProfiler().push("undergarden_portal");
entity.level().getProfiler().push("chrono_realm_portal");
entity.setPortalCooldown();
entity.changeDimension(destinationWorld, new ModTeleporter(destinationWorld));
entity.level().getProfiler().pop();
Expand Down Expand Up @@ -233,7 +233,7 @@ public static class EnderitePortalShape extends PortalShape {
private static final int MIN_HEIGHT = 2;
public static final int MAX_HEIGHT = 21;
private static final BlockBehaviour.StatePredicate FRAME =
(state, getter, pos) -> state.is(TagsInit.BlockTagsInit.PORTAL_FRAME_BLOCKS);
(state, getter, pos) -> state.is(TagsInit.BlockTagsInit.PORTAL_MAKER_BLOCKS);
private final LevelAccessor level;
private final Direction.Axis axis;
private final Direction rightDir;
Expand Down Expand Up @@ -345,7 +345,7 @@ private int getDistanceUntilTop(BlockPos.MutableBlockPos pos) {
}

private static boolean isEmpty(BlockState state) {
return state.isAir() || state.is(BlockInit.ENDERITE_PORTAL_BLOCK.get());
return state.isAir() || state.is(BlockInit.ENDERITE_PORTAL_FRAME.get());
}

public boolean isValid() {
Expand All @@ -358,7 +358,7 @@ public boolean isValid() {

public void createPortalBlocks() {
BlockState blockstate =
BlockInit.ENDERITE_PORTAL_BLOCK
BlockInit.ENDERITE_PORTAL_FRAME
.get()
.defaultBlockState()
.setValue(NetherPortalBlock.AXIS, this.axis);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package io.github.realyusufismail.temporalsmith.dimension;

import io.github.realyusufismail.temporalsmith.TemporalSmithConfig;
import io.github.realyusufismail.temporalsmith.blocks.EnderitePortalBlock;
import io.github.realyusufismail.temporalsmith.blocks.EnderitePortalFrame;
import io.github.realyusufismail.temporalsmith.core.init.BlockInit;
import io.github.realyusufismail.temporalsmith.core.init.DimensionsInit;
import io.github.realyusufismail.temporalsmith.core.init.POIInit;
Expand Down Expand Up @@ -80,7 +80,7 @@ public Optional<BlockUtil.FoundRectangle> getExistingPortal(BlockPos pos) {
poiManager
.getInSquare(
(poiType) ->
poiType.is(Objects.requireNonNull(POIInit.ENDERITE_PORTAL_BLOCK.getKey())),
poiType.is(Objects.requireNonNull(POIInit.ENDERITE_PORTAL_FRAME.getKey())),
pos,
64,
PoiManager.Occupancy.ANY)
Expand Down Expand Up @@ -213,10 +213,10 @@ public Optional<BlockUtil.FoundRectangle> makePortal(BlockPos pos, Direction.Axi
}

BlockState blockstate =
BlockInit.ENDERITE_PORTAL_BLOCK
BlockInit.ENDERITE_PORTAL_FRAME
.get()
.defaultBlockState()
.setValue(EnderitePortalBlock.AXIS, axis);
.setValue(EnderitePortalFrame.AXIS, axis);

for (int k2 = 0; k2 < 2; ++k2) {
for (int l2 = 0; l2 < 3; ++l2) {
Expand Down Expand Up @@ -326,7 +326,7 @@ protected Optional<BlockUtil.FoundRectangle> getOrMakePortal(Entity entity, Bloc
Direction.Axis portalAxis =
this.level
.getBlockState(entity.portalEntrancePos)
.getOptionalValue(EnderitePortalBlock.AXIS)
.getOptionalValue(EnderitePortalFrame.AXIS)
.orElse(Direction.Axis.X);
return this.makePortal(pos, portalAxis);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ object ClientEvents {

event.enqueueWork {
ItemBlockRenderTypes.setRenderLayer(
BlockInit.ENDERITE_PORTAL_BLOCK.get(), RenderType.translucent())
BlockInit.ENDERITE_PORTAL_FRAME.get(), RenderType.translucent())
}

event.enqueueWork {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package io.github.realyusufismail.temporalsmith.core.init
import io.github.realyusufismail.temporalsmith.TemporalSmith.TemporalSmith.MOD_ID
import io.github.realyusufismail.temporalsmith.blocks.CustomArmourCraftingTable
import io.github.realyusufismail.temporalsmith.blocks.CustomToolCraftingTable
import io.github.realyusufismail.temporalsmith.blocks.EnderitePortalBlock
import io.github.realyusufismail.temporalsmith.blocks.EnderitePortalFrame
import io.github.realyusufismail.temporalsmith.blocks.IngotFusionTollEnhancer
import io.github.realyusufismail.temporalsmith.blocks.lit.RainbowLitBlock
import io.github.realyusufismail.temporalsmith.blocks.lit.RubyLitBlock
Expand All @@ -33,7 +33,6 @@ import net.minecraft.world.level.block.state.BlockBehaviour
import net.neoforged.neoforge.registries.DeferredBlock
import net.neoforged.neoforge.registries.DeferredItem
import net.neoforged.neoforge.registries.DeferredRegister
import thedarkcolour.kotlinforforge.neoforge.forge.getValue

object BlockInit {
val BLOCKS: DeferredRegister.Blocks = DeferredRegister.createBlocks(MOD_ID)
Expand Down Expand Up @@ -194,7 +193,7 @@ object BlockInit {
registerSpecial("ingot_fusion_toll_enhancer", ::IngotFusionTollEnhancer)

@JvmField
val ENDERITE_PORTAL_BLOCK = registerSpecial("enderite_portal_block", ::EnderitePortalBlock)
val ENDERITE_PORTAL_FRAME = registerSpecial("enderite_portal_frame", ::EnderitePortalFrame)

private fun <T : Block> registerSpecial(
name: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ object CreativeModeTabInit {
.stream()
.map { item: DeferredHolder<Item, out Item> -> item.get().asItem() }
.forEach { pItem: Item ->
if (pItem != BlockInit.ENDERITE_PORTAL_BLOCK.get().asItem())
if (pItem != BlockInit.ENDERITE_PORTAL_FRAME.get().asItem())
output.accept(pItem)
}

BlockInit.BLOCKS.entries
.stream()
.map { item: DeferredHolder<Block, out Block> -> item.get().asItem() }
.forEach { pItem: Item ->
if (pItem != BlockInit.ENDERITE_PORTAL_BLOCK.get().asItem())
if (pItem != BlockInit.ENDERITE_PORTAL_FRAME.get().asItem())
output.accept(pItem)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ object POIInit {
DeferredRegister.create(Registries.POINT_OF_INTEREST_TYPE, TemporalSmith.MOD_ID)

@JvmField
val ENDERITE_PORTAL_BLOCK: DeferredHolder<PoiType, PoiType> =
POI.register("enderite_portal_block") { ->
PoiType(setOf(BlockInit.ENDERITE_PORTAL_BLOCK.get().defaultBlockState()), 0, 1)
val ENDERITE_PORTAL_FRAME: DeferredHolder<PoiType, PoiType> =
POI.register("enderite_portal_frame") { ->
PoiType(setOf(BlockInit.ENDERITE_PORTAL_FRAME.get().defaultBlockState()), 0, 1)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ object TagsInit {

// other blocks
@JvmField
val PORTAL_FRAME_BLOCKS =
ResourceLocation.tryParse("$MOD_ID:portal_frame_blocks")?.let { BlockTags.create(it) }
val PORTAL_MAKER_BLOCKS =
ResourceLocation.tryParse("$MOD_ID:portal_maker_blocks")?.let { BlockTags.create(it) }
?: throw Exception("Failed to create tag")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class ModEnLangProvider(gen: DataGenerator) : ModEnLangProviderSupport(gen, MOD_
addBlock(BlockInit.CUSTOM_TOOL_CRAFTING_TABLE, "Custom Tool Crafting Table")
addBlock(BlockInit.INGOT_FUSION_TOLL_ENHANCER, "Ingot Fusion Toll Enhancer")

// portal frame
addBlock(BlockInit.ENDERITE_PORTAL_FRAME, "Enderite Portal Frame")

// ore ingot
addItem(ItemInit.RUBY, "Ruby")
addItem(ItemInit.SAPPHIRE, "Sapphire")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ModBlockLootTables : BlockLootSubProvider(setOf(), FeatureFlags.REGISTRY.a
.filter { key: ResourceLocation -> key.namespace == MOD_ID }
.isPresent
}
.filter { entry: Block -> entry != BlockInit.ENDERITE_PORTAL_BLOCK.get() }
.filter { entry: Block -> entry != BlockInit.ENDERITE_PORTAL_FRAME.get() }
.collect(Collectors.toSet())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class ModBlockTagsProvider(
tag(TagsInit.BlockTagsInit.STORAGE_AQUMARINE).add(BlockInit.AQUMARINE_BLOCK.get())
tag(TagsInit.BlockTagsInit.STORAGE_ENDERITE).add(BlockInit.ENDERITE_BLOCK.get())

tag(TagsInit.BlockTagsInit.PORTAL_FRAME_BLOCKS).add(BlockInit.ENDERITE_BLOCK.get())
// Needed in order to make the portal frame blocks work
tag(TagsInit.BlockTagsInit.PORTAL_MAKER_BLOCKS).add(BlockInit.ENDERITE_BLOCK.get())

// use BlockTags.MINEABLE_WITH_PICKAXE
BlockInit.ORE_BLOCKS.forEach { oreBlock ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package io.github.realyusufismail.temporalsmith.items.sword

import io.github.realyusufismail.temporalsmith.blocks.EnderitePortalBlock
import io.github.realyusufismail.temporalsmith.blocks.EnderitePortalFrame
import io.github.realyusufismail.temporalsmith.core.init.BlockInit
import io.github.realyusufismail.temporalsmith.core.init.DimensionsInit
import io.github.realyusufismail.temporalsmith.core.material.CustomToolMaterial
Expand All @@ -41,7 +41,7 @@ class EnderiteSword :
context.player!!.level().dimension() === Level.OVERWORLD) {
for (direction in Direction.Plane.VERTICAL) {
val framePos: BlockPos = context.clickedPos.relative(direction)
return if ((BlockInit.ENDERITE_PORTAL_BLOCK.get() as EnderitePortalBlock)
return if ((BlockInit.ENDERITE_PORTAL_FRAME.get() as EnderitePortalFrame)
.trySpawnPortal(context.level, framePos)) {
context.level.playSound(
context.player,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"variants": {
"axis=z": { "model": "temporalsmith:block/enderite_portal_frame_ew" },
"axis=x": { "model": "temporalsmith:block/enderite_portal_frame_ns" }
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"textures": {
"particle": "temporalsmith:block/enderite_portal_block",
"portal": "temporalsmith:block/enderite_portal_block"
"particle": "temporalsmith:block/enderite_portal_frame",
"portal": "temporalsmith:block/enderite_portal_frame"
},
"elements": [
{ "from": [ 6, 0, 0 ],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"textures": {
"particle": "temporalsmith:block/enderite_portal_block",
"portal": "temporalsmith:block/enderite_portal_block"
"particle": "temporalsmith:block/enderite_portal_frame",
"portal": "temporalsmith:block/enderite_portal_frame"
},
"elements": [
{ "from": [ 0, 0, 6 ],
Expand Down

0 comments on commit 992d89e

Please sign in to comment.