Skip to content

Commit

Permalink
Misc. fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BrokenK3yboard committed Jan 4, 2025
1 parent 5bdad28 commit d64d8e9
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 46 deletions.
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,15 @@ tasks.withType(GenerateModuleMetadata) {

enabled = false
}

allprojects {
repositories {
jcenter()
}

gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "5000"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

public class PipeRenderer implements BlockEntityRenderer<PipeBlockEntity> {

private static final ModelResourceLocation LOCATION_MODEL = new ModelResourceLocation(new ResourceLocation(Quark.MOD_ID, "extra/pipe_flare"), "inventory");
private static final ModelResourceLocation LOCATION_MODEL = new ModelResourceLocation(ResourceLocation.fromNamespaceAndPath(Quark.MOD_ID, "extra/pipe_flare"), "inventory");

private final Random random = new Random();

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/violetmoon/quark/base/Quark.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.fml.common.Mod;
import net.neoforged.fml.common.Mod;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.MixinEnvironment;
Expand Down Expand Up @@ -58,7 +58,7 @@ public Quark() {
}

public static ResourceLocation asResource(String name) {
return new ResourceLocation(MOD_ID, name);
return ResourceLocation.fromNamespaceAndPath(MOD_ID, name);
}

public static <T> ResourceKey<T> asResourceKey(ResourceKey<? extends Registry<T>> base, String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public class SocialButton extends Button {

public static final ResourceLocation SOCIAL_ICONS = new ResourceLocation(Quark.MOD_ID, "textures/gui/social_icons.png");
public static final ResourceLocation SOCIAL_ICONS = ResourceLocation.fromNamespaceAndPath(Quark.MOD_ID, "textures/gui/social_icons.png");

private final int textColor;
private final int socialId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
import net.minecraft.world.level.block.entity.BannerPattern;
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.client.event.RenderItemInFrameEvent;
import net.minecraftforge.common.MinecraftForge;

import org.jetbrains.annotations.NotNull;

Expand All @@ -56,7 +54,7 @@

public class GlassItemFrameRenderer extends EntityRenderer<GlassItemFrame> {

private static final ModelResourceLocation LOCATION_MODEL = new ModelResourceLocation(new ResourceLocation(Quark.MOD_ID, "extra/glass_item_frame"), "inventory");
private static final ModelResourceLocation LOCATION_MODEL = new ModelResourceLocation(ResourceLocation.fromNamespaceAndPath(Quark.MOD_ID, "extra/glass_item_frame"), "inventory");

private static final List<Direction> SIGN_DIRECTIONS = List.of(Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.List;
import java.util.Optional;

import net.neoforged.neoforge.common.ItemAbilities;
import org.apache.commons.lang3.tuple.Pair;
import org.violetmoon.quark.base.Quark;
import org.violetmoon.quark.content.building.block.QuarkVerticalSlabBlock;
Expand Down Expand Up @@ -32,7 +33,6 @@
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraftforge.common.ToolActions;

@ZetaLoadModule(category = "building")
public class VerticalSlabsModule extends ZetaModule {
Expand Down Expand Up @@ -92,7 +92,7 @@ public void postRegister(ZRegister.Post e) {
WeatheringCopperVerticalSlabBlock current = copperVerticalSlabs.get(i);
WeatheringCopperVerticalSlabBlock next = i < max - 1 ? copperVerticalSlabs.get(i + 1) : null;
if(prev != null) {
ToolInteractionHandler.registerInteraction(ToolActions.AXE_SCRAPE, current, prev);
ToolInteractionHandler.registerInteraction(ItemAbilities.AXE_SCRAPE, current, prev);
current.prev = prev;
}
if(next != null)
Expand All @@ -110,7 +110,7 @@ public void postRegister(ZRegister.Post e) {

@LoadEvent
public final void setup(ZCommonSetup event) {
verticalSlabTag = BlockTags.create(new ResourceLocation(Quark.MOD_ID, "vertical_slabs"));
verticalSlabTag = BlockTags.create(ResourceLocation.fromNamespaceAndPath(Quark.MOD_ID, "vertical_slabs"));
}

@LoadEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public LootItemFunctionType getType() {
@NotNull
public ItemStack run(@NotNull ItemStack stack, LootContext context) {
Enchantment enchantment = validEnchants.get(context.getRandom().nextInt(validEnchants.size()));
EnchantedBookItem.addEnchantment(stack, new EnchantmentInstance(enchantment, enchantment.getMaxLevel()));
EnchantedBookItem.createForEnchantment(stack, new EnchantmentInstance(enchantment, enchantment.getMaxLevel()));
return stack;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
@ZetaLoadModule(category = "tweaks")
public class ReacharoundPlacingModule extends ZetaModule {

public static final ResourceLocation OVERLAY_HORIZONTAL = new ResourceLocation(Quark.MOD_ID, "textures/gui/reacharound_overlay_horizontal.png");
public static final ResourceLocation OVERLAY_VERTICAL = new ResourceLocation(Quark.MOD_ID, "textures/gui/reacharound_overlay_vertical.png");
public static final ResourceLocation OVERLAY_HORIZONTAL = ResourceLocation.fromNamespaceAndPath(Quark.MOD_ID, "textures/gui/reacharound_overlay_horizontal.png");
public static final ResourceLocation OVERLAY_VERTICAL = ResourceLocation.fromNamespaceAndPath(Quark.MOD_ID, "textures/gui/reacharound_overlay_vertical.png");

@Config
@Config.Min(0)
Expand All @@ -69,7 +69,7 @@ public class ReacharoundPlacingModule extends ZetaModule {

@LoadEvent
public final void setup(ZCommonSetup event) {
reacharoundTag = ItemTags.create(new ResourceLocation(Quark.MOD_ID, "reacharound_able"));
reacharoundTag = ItemTags.create(ResourceLocation.fromNamespaceAndPath(Quark.MOD_ID, "reacharound_able"));
}

@PlayEvent
Expand All @@ -82,8 +82,10 @@ public void onRightClick(ZRightClickItem event) {
if(!player.mayUseItemAt(target.pos, target.dir, stack) || !player.level().mayInteract(player, target.pos))
return;

/* TODO: Fix/remove, dependency not available for 1.21.1
if(!Quark.FLAN_INTEGRATION.canPlace(player, target.pos))
return;
*/

int count = stack.getCount();
InteractionHand hand = event.getHand();
Expand Down Expand Up @@ -234,7 +236,7 @@ public void onRender(ZRenderGuiOverlay.Crosshair.Post event) {
}

@PlayEvent
public void clientTick(ZClientTick.End event) {
public void clientTick(ZClientTick event) {

currentTarget = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.Tags;
import net.minecraftforge.items.ItemHandlerHelper;

import net.neoforged.neoforge.common.Tags;
import org.violetmoon.zeta.event.bus.PlayEvent;
import org.violetmoon.zeta.event.play.entity.player.ZRightClickBlock;
import org.violetmoon.zeta.module.ZetaLoadModule;
Expand Down Expand Up @@ -82,7 +81,6 @@ public void callFedEnd(ZRightClickBlock event) {
}

ItemNBTHelper.setCompound(newShulkerBox, "BlockEntityTag", shulkerBoxData.saveWithFullMetadata());

ItemHandlerHelper.giveItemToPlayer(player, newShulkerBox, player.getInventory().selected);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.LevelEvent;
import net.minecraftforge.event.ForgeEventFactory;

import net.neoforged.neoforge.event.EventHooks;
import org.violetmoon.zeta.event.bus.PlayEvent;
import org.violetmoon.zeta.event.play.entity.living.ZLivingConversion;
import org.violetmoon.zeta.module.ZetaLoadModule;
Expand All @@ -29,13 +29,13 @@ public void onConversion(ZLivingConversion.Pre event) {

if (zombievillager == null) return;

zombievillager.finalizeSpawn(serverLevel, level.getCurrentDifficultyAt(zombievillager.blockPosition()), MobSpawnType.CONVERSION, new Zombie.ZombieGroupData(false, true), null);
zombievillager.finalizeSpawn(serverLevel, level.getCurrentDifficultyAt(zombievillager.blockPosition()), MobSpawnType.CONVERSION, new Zombie.ZombieGroupData(false, true));
zombievillager.setVillagerData(villager.getVillagerData());
zombievillager.setGossips(villager.getGossips().store(NbtOps.INSTANCE));
zombievillager.setTradeOffers(villager.getOffers().createTag());
zombievillager.setVillagerXp(villager.getVillagerXp());

ForgeEventFactory.onLivingConvert(villager, zombievillager);
EventHooks.onLivingConvert(villager, zombievillager);
level.levelEvent(null, LevelEvent.SOUND_ZOMBIE_INFECTED, villager.blockPosition(), 0);

event.setCanceled(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
package org.violetmoon.quark.content.world.gen;

import java.util.List;

import org.violetmoon.quark.content.world.module.FairyRingsModule;
import org.violetmoon.zeta.config.type.DimensionConfig;
import org.violetmoon.zeta.util.BlockUtils;
import org.violetmoon.zeta.world.generator.Generator;

import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Holder;
Expand All @@ -16,14 +9,20 @@
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.AbstractGlassBlock;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.TransparentBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraftforge.common.Tags;
import net.neoforged.neoforge.common.Tags;
import org.violetmoon.quark.content.world.module.FairyRingsModule;
import org.violetmoon.zeta.config.type.DimensionConfig;
import org.violetmoon.zeta.util.BlockUtils;
import org.violetmoon.zeta.world.generator.Generator;

import java.util.List;

public class FairyRingGenerator extends Generator {

Expand Down Expand Up @@ -82,7 +81,7 @@ public static void spawnFairyRing(WorldGenLevel world, ChunkGenerator generator,
BlockPos fpos = pos.offset(i, k, j);
BlockPos fposUp = fpos.above();
BlockState state = world.getBlockState(fpos);
if(state.getBlock() instanceof AbstractGlassBlock && world.isEmptyBlock(fposUp)) {
if(state.getBlock() instanceof TransparentBlock && world.isEmptyBlock(fposUp)) {
if(flowerState == null) {
holder.value().place(world, generator, rand, fposUp);
flowerState = world.getBlockState(fposUp);
Expand All @@ -97,13 +96,13 @@ public static void spawnFairyRing(WorldGenLevel world, ChunkGenerator generator,
BlockPos orePos = pos.below(rand.nextInt(10) + 25);
BlockState stoneState = world.getBlockState(orePos);
int down = 0;
while(!stoneState.is(Tags.Blocks.STONE) && down < 10) {
while(!stoneState.is(Tags.Blocks.STONES) && down < 10) {
orePos = orePos.below();
stoneState = world.getBlockState(orePos);
down++;
}

if(stoneState.is(Tags.Blocks.STONE)) {
if(stoneState.is(Tags.Blocks.STONES)) {
BlockState ore = FairyRingsModule.ores.get(rand.nextInt(FairyRingsModule.ores.size()));
world.setBlock(orePos, ore, 2);
for(Direction face : Direction.values())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
import net.minecraftforge.common.Tags;
import net.neoforged.neoforge.common.Tags;
import org.violetmoon.quark.base.util.QuarkWorldGenWeights;
import org.violetmoon.quark.content.world.config.AirStoneClusterConfig;
import org.violetmoon.quark.content.world.config.BigStoneClusterConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import net.minecraft.resources.ResourceKey;
import net.minecraft.tags.BiomeTags;
import net.minecraft.world.level.block.ComposterBlock;
import net.minecraft.world.level.block.grower.AbstractTreeGrower;
import net.minecraft.world.level.block.grower.TreeGrower;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.material.MapColor;
import net.minecraftforge.common.Tags;
import net.neoforged.neoforge.common.Tags;
import org.violetmoon.quark.base.Quark;
import org.violetmoon.quark.base.handler.WoodSetHandler;
import org.violetmoon.quark.base.handler.WoodSetHandler.WoodSet;
Expand All @@ -27,7 +27,6 @@
import org.violetmoon.zeta.event.play.loading.ZGatherHints;
import org.violetmoon.zeta.module.ZetaLoadModule;
import org.violetmoon.zeta.module.ZetaModule;
import org.violetmoon.zeta.world.PassthroughTreeGrower;
import org.violetmoon.zeta.world.WorldGenHandler;

import java.util.ArrayList;
Expand Down Expand Up @@ -67,7 +66,7 @@ public static class BlossomTree {
public BlossomLeavesBlock leaves;

public ResourceKey<ConfiguredFeature<?, ?>> configuredFeatureKey;
public AbstractTreeGrower grower;
public TreeGrower grower;
public ZetaSaplingBlock sapling;
}

Expand All @@ -90,7 +89,7 @@ private BlossomTree make(ZRegister event, String regname, MapColor color, Blosso
tree.leaves = new BlossomLeavesBlock(regname, this, color);

tree.configuredFeatureKey = configuredFeatureKey;
tree.grower = new PassthroughTreeGrower(configuredFeatureKey);
tree.grower = new TreeGrower(configuredFeatureKey);
tree.sapling = new ZetaSaplingBlock(regname, this, tree.grower);

event.getVariantRegistry().addFlowerPot(tree.sapling, zeta.registry.getRegistryName(tree.sapling, BuiltInRegistries.BLOCK).getPath(), Functions.identity()); //sure
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.violetmoon.quark.integration.claim;

/* TODO: Wait for Neoforge Flan or remove
import io.github.flemmli97.flan.api.permission.BuiltinPermission;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
Expand Down Expand Up @@ -86,3 +87,4 @@ public boolean canInteract(@NotNull Player player, @NotNull BlockPos targetPos)
}
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,19 @@
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

import noobanidus.mods.lootr.block.entities.LootrChestBlockEntity;
import noobanidus.mods.lootr.common.api.LootrTags;
import noobanidus.mods.lootr.common.block.entity.LootrChestBlockEntity;
import noobanidus.mods.lootr.neoforge.config.ConfigManager;
import noobanidus.mods.lootr.util.ChestUtil;
import org.jetbrains.annotations.Nullable;

import org.violetmoon.quark.content.building.block.VariantChestBlock;
import org.violetmoon.zeta.item.ZetaBlockItem;
import org.violetmoon.zeta.module.ZetaModule;
import org.violetmoon.zeta.registry.IZetaBlockItemProvider;

import java.util.function.Supplier;

import noobanidus.mods.lootr.LootrTags;
import noobanidus.mods.lootr.block.entities.LootrChestBlockEntity;
import noobanidus.mods.lootr.config.ConfigManager;
import noobanidus.mods.lootr.util.ChestUtil;

/**
* Copy of
* https://github.com/noobanidus/Lootr/blob/ded29b761ebf271f53a1b976cf859e0f4bfc8d60/src/main/java/noobanidus/mods/lootr/block/LootrChestBlock.java
Expand Down

0 comments on commit d64d8e9

Please sign in to comment.