From 7576d3682021c8863587387aeb26416fdfe89caf Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 26 Sep 2024 17:16:16 +0200 Subject: [PATCH] finish up todos --- .../de/ellpeck/naturesaura/blocks/BlockDimensionRail.java | 3 --- .../blocks/tiles/BlockEntityPotionGenerator.java | 1 - .../ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java | 5 ++++- .../java/de/ellpeck/naturesaura/items/ItemCaveFinder.java | 8 ++------ .../de/ellpeck/naturesaura/items/tools/ItemPickaxe.java | 1 - .../java/de/ellpeck/naturesaura/proxy/ClientProxy.java | 2 -- .../java/de/ellpeck/naturesaura/recipes/ModRecipes.java | 1 - 7 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java index 3e45f570..b1a749e9 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java @@ -19,9 +19,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.ItemInteractionResult; -import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.AbstractMinecart; import net.minecraft.world.item.ItemStack; @@ -93,7 +91,6 @@ public class BlockDimensionRail extends BaseRailBlock implements IModItem, ICust PacketHandler.sendToAllAround(level, pos, 32, new PacketParticles((float) box.minX, (float) box.minY, (float) box.minZ, PacketParticles.Type.DIMENSION_RAIL, (int) ((box.maxX - box.minX) * 100F), (int) ((box.maxY - box.minY) * 100F), (int) ((box.maxZ - box.minZ) * 100F))); level.playSound(null, pos, SoundEvents.ENDERMAN_TELEPORT, SoundSource.BLOCKS, 1F, 1F); - // TODO test if this new dimension change works! var goalCoords = this.getGoalCoords(level, pos).getCenter(); cart.changeDimension(new DimensionTransition(level.getServer().getLevel(this.goalDim), goalCoords, cart.getDeltaMovement(), cart.getYRot(), cart.getXRot(), DimensionTransition.PLAY_PORTAL_SOUND)); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityPotionGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityPotionGenerator.java index 539ef669..432c3b29 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityPotionGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityPotionGenerator.java @@ -35,7 +35,6 @@ public class BlockEntityPotionGenerator extends BlockEntityImpl implements ITick if (!addedOne) { PotionContents type; try { - // TODO check if this new private value getter works type = (PotionContents) BlockEntityPotionGenerator.POTION_CONTENTS_FIELD.get(cloud); } catch (IllegalAccessException e) { NaturesAura.LOGGER.fatal("Couldn't reflect furnace field", e); diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java index d2a61dc5..6c95f737 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java @@ -118,7 +118,10 @@ public class OreSpawnEffect implements IDrainSpotEffect { var tag = TagKey.create(Registries.BLOCK, ore.tag); if (tag == null) continue; - for (var toPlaceHolder : BuiltInRegistries.BLOCK.getTag(tag).orElseThrow()) { + var values = BuiltInRegistries.BLOCK.getTag(tag); + if (values.isEmpty()) + continue; + for (var toPlaceHolder : values.get()) { if (toPlaceHolder == null) continue; var toPlace = toPlaceHolder.value(); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemCaveFinder.java b/src/main/java/de/ellpeck/naturesaura/items/ItemCaveFinder.java index 0e62fba7..8ede6a23 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemCaveFinder.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemCaveFinder.java @@ -1,6 +1,7 @@ package de.ellpeck.naturesaura.items; import de.ellpeck.naturesaura.api.NaturesAuraAPI; +import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; @@ -32,13 +33,8 @@ public class ItemCaveFinder extends ItemImpl { for (var z = -range; z <= range; z++) { var offset = pos.offset(x, y, z); var state = levelIn.getBlockState(offset); - // TODO figure out an entity-independent way of checking if a block is a valid spawn (just checking for air & ground below?) -/* try { - if (!state.getBlock().isValidSpawn(state, levelIn, offset, SpawnPlacements.Type.ON_GROUND, null)) - continue; - } catch (Exception e) { + if (!state.isFaceSturdy(levelIn, offset, Direction.UP)) continue; - }*/ var offUp = offset.above(); var stateUp = levelIn.getBlockState(offUp); diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxe.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxe.java index 65154926..a7ca8ad6 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxe.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxe.java @@ -87,7 +87,6 @@ public class ItemPickaxe extends PickaxeItem implements IModItem, ICustomItemMod @Override public boolean mineBlock(ItemStack stack, Level level, BlockState state, BlockPos pos, LivingEntity miningEntity) { - // TODO test depth pickaxe vein mining if (stack.getItem() == ModItems.DEPTH_PICKAXE && Helper.isToolEnabled(stack) && level.getBlockState(pos).is(Tags.Blocks.ORES)) Helper.mineRecursively(level, pos, pos, stack, 5, 5, s -> s.is(Tags.Blocks.ORES)); return super.mineBlock(stack, level, state, pos, miningEntity); diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java index 95ceb70a..02aa3e0d 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java @@ -89,7 +89,6 @@ public class ClientProxy implements IProxy { @Override @SuppressWarnings("removal") public void postInit(FMLCommonSetupEvent event) { - // TODO this uses a vanilla model so we can't just add the json entry to it ItemBlockRenderTypes.setRenderLayer(ModBlocks.GOLD_POWDER, RenderType.cutoutMipped()); } @@ -120,7 +119,6 @@ public class ClientProxy implements IProxy { var colors = Minecraft.getInstance().getItemColors(); var color = item.getItemColor(); - // TODO use event if (item instanceof Item) { colors.register(color, (Item) item); } else if (item instanceof Block) { diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java index f2a4f9eb..16db0011 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java @@ -42,7 +42,6 @@ public final class ModRecipes { Blocks.STONE_BRICK_WALL.defaultBlockState(), Blocks.MOSSY_STONE_BRICK_WALL.defaultBlockState()); - // TODO test if these ores still work! ModRecipes.ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/coal", 5000); ModRecipes.ore(NaturesAuraAPI.NETHER_ORES, "ores/nether/coal", 5000); ModRecipes.ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/iron", 3000);