fix: name of config classes (bad flanks), fixed drill crashing

This commit is contained in:
Michael Hillcox 2022-03-13 19:29:06 +00:00
parent ec2606f470
commit fdda08b593
18 changed files with 47 additions and 44 deletions

View file

@ -7,7 +7,7 @@ mod_version=1.1.52
# Forge
game_version=1.16.5
forge_version=36.2.22
forge_version=36.2.30
# Parchment (Mappings)
parchment_version=2021.10.17

View file

@ -141,10 +141,10 @@ public class ActuallyAdditions {
}
private void onConfigReload(ModConfig.ModConfigEvent event) {
Item item1 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.OTHER.REDSTONECONFIGURATOR.get()));
Item item2 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.OTHER.RELAYCONFIGURATOR.get()));
CommonConfig.OTHER.redstoneConfigureItem = item1 != null?item1: Items.AIR;
CommonConfig.OTHER.relayConfigureItem = item2 != null?item2: Items.AIR;
Item item1 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.Other.REDSTONECONFIGURATOR.get()));
Item item2 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.Other.RELAYCONFIGURATOR.get()));
CommonConfig.Other.redstoneConfigureItem = item1 != null?item1: Items.AIR;
CommonConfig.Other.relayConfigureItem = item2 != null?item2: Items.AIR;
}
private void clientSetup(FMLClientSetupEvent event) {

View file

@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.api.lens.ILensItem;
import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.Lang;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
@ -73,7 +72,7 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
player.inventory.removeItem(player.inventory.selected, 1);
}
//Shush, don't tell anyone!
else if (CommonConfig.OTHER.ELEVEN.get() == 11 && item == Items.MUSIC_DISC_11) {
else if (CommonConfig.Other.ELEVEN.get() == 11 && item == Items.MUSIC_DISC_11) {
reconstructor.counter++;
reconstructor.setChanged();
}

View file

@ -188,7 +188,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
if (compass) {
expl = relay.getCompassDisplayString();
} else {
expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", StringUtil.localize(CommonConfig.OTHER.relayConfigureItem.getDescriptionId() + ".name"));
expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", StringUtil.localize(CommonConfig.Other.relayConfigureItem.getDescriptionId() + ".name"));
}
StringUtil.drawSplitString(minecraft.font, expl, resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 15, Integer.MAX_VALUE, StringUtil.DECIMAL_COLOR_WHITE, true);

View file

@ -2,20 +2,39 @@ package de.ellpeck.actuallyadditions.mod.config;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeConfigSpec;
import java.util.ArrayList;
import java.util.List;
public class CommonConfig {
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
public static ForgeConfigSpec COMMON_CONFIG;
static {
OTHER.build();
MACHINES.build();
Other.build();
Machines.build();
ItemSettings.build();
COMMON_CONFIG = BUILDER.build();
}
public static class MACHINES {
public static class ItemSettings {
public static ForgeConfigSpec.ConfigValue<List<String>> DRILL_EXTRA_MINING_WHITELIST;
public static void build() {
BUILDER.comment("Item settings").push("itemsSettings");
DRILL_EXTRA_MINING_WHITELIST = BUILDER
.comment("By default, the Drill can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.")
.define("Drill Extra Whitelist", new ArrayList<String>() {{
add("TConstruct:GravelOre");
}});
BUILDER.pop();
}
}
public static class Machines {
public static ForgeConfigSpec.IntValue FARMER_AREA;
public static ForgeConfigSpec.IntValue RECONSTRUCTOR_POWER;
@ -29,8 +48,7 @@ public class CommonConfig {
}
}
public static class OTHER {
public static class Other {
public static ForgeConfigSpec.BooleanValue SOLID_XP_ALWAYS_ORBS;
public static ForgeConfigSpec.BooleanValue DO_UPDATE_CHECK;
public static ForgeConfigSpec.BooleanValue UPDATE_CHECK_VERSION_SPECIFIC;

View file

@ -49,11 +49,7 @@ public enum ConfigStringListValues {
ConfigCategories.TOOL_VALUES,
new String[] { "TConstruct:GravelOre" },
"By default, the AIOT can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
DRILL_EXTRA_MINING_WHITELIST(
"Drill Extra Whitelist",
ConfigCategories.TOOL_VALUES,
new String[] { "TConstruct:GravelOre" },
"By default, the Drill can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
MINER_EXTRA_WHITELIST(
"Vertical Digger Extra Whitelist",
ConfigCategories.MACHINE_VALUES,

View file

@ -104,7 +104,7 @@ public class EntityWorm extends Entity {
}
}
int dieTime = CommonConfig.OTHER.WORMS_DIE_TIME.get();
int dieTime = CommonConfig.Other.WORMS_DIE_TIME.get();
if (dieTime > 0 && this.timer >= dieTime) {
this.removeAfterChangingDimensions();
}

View file

@ -200,7 +200,7 @@ public class ClientEvents {
if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) {
expl = TextFormatting.GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode.validItem");
} else {
expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", StringUtil.localize(CommonConfig.OTHER.redstoneConfigureItem.getDescriptionId() + ".name"));
expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", StringUtil.localize(CommonConfig.Other.redstoneConfigureItem.getDescriptionId() + ".name"));
}
font.drawShadow(event.getMatrixStack(), expl, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 15, StringUtil.DECIMAL_COLOR_WHITE);
}

View file

@ -166,7 +166,7 @@ public class CommonEvents {
public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event) {
//checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING);
if (CommonConfig.OTHER.GIVE_BOOKLET_ON_FIRST_CRAFT.get()) {
if (CommonConfig.Other.GIVE_BOOKLET_ON_FIRST_CRAFT.get()) {
if (!event.getPlayer().level.isClientSide && StackUtil.isValid(event.getCrafting()) && event.getCrafting().getItem() != ActuallyItems.ITEM_BOOKLET.get()) {
String name = event.getCrafting().getItem().getRegistryName().toString();

View file

@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
@ -458,7 +458,7 @@ public class DrillItem extends ItemEnergy {
if (location != null) {
String name = location.toString();
if (name != null) {
for (String s : ConfigStringListValues.DRILL_EXTRA_MINING_WHITELIST.getValue()) {
for (String s : CommonConfig.ItemSettings.DRILL_EXTRA_MINING_WHITELIST.get()) {
if (s != null && s.equals(name)) {
return true;
}

View file

@ -19,7 +19,6 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -42,9 +41,9 @@ public class ItemHairBall extends ItemBase {
@SubscribeEvent
public void livingUpdateEvent(LivingEvent.LivingUpdateEvent event) {
//Ocelots dropping Hair Balls
if (CommonConfig.OTHER.DO_CAT_DROPS.get() && event.getEntityLiving() != null && event.getEntityLiving().level != null && !event.getEntityLiving().level.isClientSide) {
if (CommonConfig.Other.DO_CAT_DROPS.get() && event.getEntityLiving() != null && event.getEntityLiving().level != null && !event.getEntityLiving().level.isClientSide) {
if (event.getEntityLiving() instanceof OcelotEntity && catIsTamedReflection((OcelotEntity) event.getEntityLiving()) || event.getEntityLiving() instanceof PlayerEntity && event.getEntityLiving().getUUID().equals(this.KittyVanCatUUID)) {
if (event.getEntityLiving().level.random.nextInt(CommonConfig.OTHER.FUR_CHANCE.get()) == 0) {
if (event.getEntityLiving().level.random.nextInt(CommonConfig.Other.FUR_CHANCE.get()) == 0) {
ItemEntity item = new ItemEntity(event.getEntityLiving().level, event.getEntityLiving().getX() + 0.5, event.getEntityLiving().getY() + 0.5, event.getEntityLiving().getZ() + 0.5, new ItemStack(ActuallyItems.HAIRY_BALL.get()));
event.getEntityLiving().level.addFreshEntity(item);
}

View file

@ -23,7 +23,6 @@ import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.world.GameRules;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -70,7 +69,7 @@ public class ItemSolidifiedExperience extends ItemBase {
}
}
if (CommonConfig.OTHER.SOLID_XP_ALWAYS_ORBS.get() || player instanceof FakePlayer) {
if (CommonConfig.Other.SOLID_XP_ALWAYS_ORBS.get() || player instanceof FakePlayer) {
ExperienceOrbEntity orb = new ExperienceOrbEntity(world, player.getX() + 0.5, player.getY() + 0.5, player.getZ() + 0.5, amount);
orb.getPersistentData().putBoolean(ActuallyAdditions.MODID + "FromSolidified", true);
world.addFreshEntity(orb);

View file

@ -31,7 +31,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -46,7 +45,7 @@ public class ItemWaterBowl extends ItemBase {
@SubscribeEvent
public void onPlayerInteractEvent(PlayerInteractEvent.RightClickItem event) {
if (event.getWorld() != null) {
if (CommonConfig.OTHER.WATER_BOWL.get()) {
if (CommonConfig.Other.WATER_BOWL.get()) {
if (StackUtil.isValid(event.getItemStack()) && event.getItemStack().getItem() == Items.BOWL) {
RayTraceResult rayTrace = WorldUtil.getNearestBlockWithDefaultReachDistance(event.getWorld(), event.getPlayer(), true, false, false);
if (rayTrace.getType() != RayTraceResult.Type.BLOCK) {
@ -126,7 +125,7 @@ public class ItemWaterBowl extends ItemBase {
@Override
public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
if (!world.isClientSide) {
if (CommonConfig.OTHER.WATER_BOWL_LOSS.get()) {
if (CommonConfig.Other.WATER_BOWL_LOSS.get()) {
if (world.getGameTime() % 10 == 0 && world.random.nextFloat() >= 0.5F) {
int lastX = 0;
int lastY = 0;

View file

@ -23,7 +23,6 @@ import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.UseHoeEvent;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.eventbus.api.EventPriority;
@ -68,7 +67,7 @@ public class ItemWorm extends ItemBase {
@SubscribeEvent(priority = EventPriority.LOW)
public void onHoe(UseHoeEvent event) {
if (CommonConfig.OTHER.WORMS.get() && event.getResult() != Event.Result.DENY) {
if (CommonConfig.Other.WORMS.get() && event.getResult() != Event.Result.DENY) {
World world = event.getEntity().level;
if (!world.isClientSide) {
BlockPos pos = event.getContext().getClickedPos();

View file

@ -35,7 +35,7 @@ public class LensDisruption extends Lens {
@Override
public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
if (CommonConfig.OTHER.ELEVEN.get() == 11 && tile.getEnergy() >= ENERGY_USE && hitBlock != null && !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock)) {
if (CommonConfig.Other.ELEVEN.get() == 11 && tile.getEnergy() >= ENERGY_USE && hitBlock != null && !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock)) {
int range = 2;
ArrayList<ItemEntity> items = (ArrayList<ItemEntity>) tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(hitBlock.getX() - range, hitBlock.getY() - range, hitBlock.getZ() - range, hitBlock.getX() + range, hitBlock.getY() + range, hitBlock.getZ() + range));
for (ItemEntity item : items) {

View file

@ -16,11 +16,9 @@ import de.ellpeck.actuallyadditions.api.lens.ILensItem;
import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
@ -33,8 +31,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyDisplay, IAtomicReconstructor {
public static final int ENERGY_USE = 1000;
@ -48,7 +44,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
public TileEntityAtomicReconstructor() {
super(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getTileEntityType(), 1);
int power = CommonConfig.MACHINES.RECONSTRUCTOR_POWER.get();
int power = CommonConfig.Machines.RECONSTRUCTOR_POWER.get();
int recieve = MathHelper.ceil(power * 0.016666F);
this.storage = new CustomEnergyStorage(power, recieve, 0);
this.lazyEnergy = LazyOptional.of(() -> this.storage);

View file

@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
@ -33,7 +32,6 @@ import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
@ -95,7 +93,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
this.waitTime--;
if (this.waitTime <= 0) {
int area = CommonConfig.MACHINES.FARMER_AREA.get();
int area = CommonConfig.Machines.FARMER_AREA.get();
if (area % 2 == 0) {
area++;
}

View file

@ -35,7 +35,7 @@ public class ThreadUpdateChecker extends Thread {
updateProperties.load(new InputStreamReader(newestURL.openStream()));
String currentMcVersion = Util.getMcVersion();
if (CommonConfig.OTHER.UPDATE_CHECK_VERSION_SPECIFIC.get()) {
if (CommonConfig.Other.UPDATE_CHECK_VERSION_SPECIFIC.get()) {
String newestVersionProp = updateProperties.getProperty(currentMcVersion);
UpdateChecker.updateVersionInt = Integer.parseInt(newestVersionProp);