finish up todos

This commit is contained in:
Ell 2024-09-26 17:16:16 +02:00
parent ea6ab5aa78
commit 7576d36820
7 changed files with 6 additions and 15 deletions

View file

@ -19,9 +19,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.vehicle.AbstractMinecart; import net.minecraft.world.entity.vehicle.AbstractMinecart;
import net.minecraft.world.item.ItemStack; 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))); 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); 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(); 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)); cart.changeDimension(new DimensionTransition(level.getServer().getLevel(this.goalDim), goalCoords, cart.getDeltaMovement(), cart.getYRot(), cart.getXRot(), DimensionTransition.PLAY_PORTAL_SOUND));

View file

@ -35,7 +35,6 @@ public class BlockEntityPotionGenerator extends BlockEntityImpl implements ITick
if (!addedOne) { if (!addedOne) {
PotionContents type; PotionContents type;
try { try {
// TODO check if this new private value getter works
type = (PotionContents) BlockEntityPotionGenerator.POTION_CONTENTS_FIELD.get(cloud); type = (PotionContents) BlockEntityPotionGenerator.POTION_CONTENTS_FIELD.get(cloud);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
NaturesAura.LOGGER.fatal("Couldn't reflect furnace field", e); NaturesAura.LOGGER.fatal("Couldn't reflect furnace field", e);

View file

@ -118,7 +118,10 @@ public class OreSpawnEffect implements IDrainSpotEffect {
var tag = TagKey.create(Registries.BLOCK, ore.tag); var tag = TagKey.create(Registries.BLOCK, ore.tag);
if (tag == null) if (tag == null)
continue; 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) if (toPlaceHolder == null)
continue; continue;
var toPlace = toPlaceHolder.value(); var toPlace = toPlaceHolder.value();

View file

@ -1,6 +1,7 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.InteractionResultHolder;
@ -32,13 +33,8 @@ public class ItemCaveFinder extends ItemImpl {
for (var z = -range; z <= range; z++) { for (var z = -range; z <= range; z++) {
var offset = pos.offset(x, y, z); var offset = pos.offset(x, y, z);
var state = levelIn.getBlockState(offset); 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?) if (!state.isFaceSturdy(levelIn, offset, Direction.UP))
/* try {
if (!state.getBlock().isValidSpawn(state, levelIn, offset, SpawnPlacements.Type.ON_GROUND, null))
continue; continue;
} catch (Exception e) {
continue;
}*/
var offUp = offset.above(); var offUp = offset.above();
var stateUp = levelIn.getBlockState(offUp); var stateUp = levelIn.getBlockState(offUp);

View file

@ -87,7 +87,6 @@ public class ItemPickaxe extends PickaxeItem implements IModItem, ICustomItemMod
@Override @Override
public boolean mineBlock(ItemStack stack, Level level, BlockState state, BlockPos pos, LivingEntity miningEntity) { 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)) 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)); Helper.mineRecursively(level, pos, pos, stack, 5, 5, s -> s.is(Tags.Blocks.ORES));
return super.mineBlock(stack, level, state, pos, miningEntity); return super.mineBlock(stack, level, state, pos, miningEntity);

View file

@ -89,7 +89,6 @@ public class ClientProxy implements IProxy {
@Override @Override
@SuppressWarnings("removal") @SuppressWarnings("removal")
public void postInit(FMLCommonSetupEvent event) { 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()); ItemBlockRenderTypes.setRenderLayer(ModBlocks.GOLD_POWDER, RenderType.cutoutMipped());
} }
@ -120,7 +119,6 @@ public class ClientProxy implements IProxy {
var colors = Minecraft.getInstance().getItemColors(); var colors = Minecraft.getInstance().getItemColors();
var color = item.getItemColor(); var color = item.getItemColor();
// TODO use event
if (item instanceof Item) { if (item instanceof Item) {
colors.register(color, (Item) item); colors.register(color, (Item) item);
} else if (item instanceof Block) { } else if (item instanceof Block) {

View file

@ -42,7 +42,6 @@ public final class ModRecipes {
Blocks.STONE_BRICK_WALL.defaultBlockState(), Blocks.STONE_BRICK_WALL.defaultBlockState(),
Blocks.MOSSY_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.OVERWORLD_ORES, "ores/coal", 5000);
ModRecipes.ore(NaturesAuraAPI.NETHER_ORES, "ores/nether/coal", 5000); ModRecipes.ore(NaturesAuraAPI.NETHER_ORES, "ores/nether/coal", 5000);
ModRecipes.ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/iron", 3000); ModRecipes.ore(NaturesAuraAPI.OVERWORLD_ORES, "ores/iron", 3000);