fix: all the issues!

This commit is contained in:
Michael Hillcox 2021-11-21 21:03:07 +00:00
parent 654a001990
commit 295a46626d
13 changed files with 52 additions and 56 deletions

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes; import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting; import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
import de.ellpeck.actuallyadditions.mod.crafting.TargetNBTIngredient; import de.ellpeck.actuallyadditions.mod.crafting.TargetNBTIngredient;
@ -42,8 +43,10 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.event.AddReloadListenerEvent; import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.server.FMLServerStartedEvent; import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
@ -90,6 +93,8 @@ public class ActuallyAdditions {
public static boolean commonCapsLoaded; public static boolean commonCapsLoaded;
public ActuallyAdditions() { public ActuallyAdditions() {
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, CommonConfig.COMMON_CONFIG);
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
ActuallyBlocks.init(eventBus); ActuallyBlocks.init(eventBus);

View file

@ -261,13 +261,13 @@ public final class ActuallyBlocks {
//public static final AABlockReg<> WILD_PLANT = new AABlockReg<>("wild", BlockWildPlant::new); //TODO: what is this? //public static final AABlockReg<> WILD_PLANT = new AABlockReg<>("wild", BlockWildPlant::new); //TODO: what is this?
//TODO: Are plants normal blocks / blockitems? i have no idea... news at 11... //TODO: Are plants normal blocks / blockitems? i have no idea... news at 11...
public static final AABlockReg<BlockPlant, AABlockItem, ?> RICE = new AABlockReg<>("rice", () -> new BlockPlant(ActuallyItems.RICE_SEED.get()), public static final AABlockReg<BlockPlant, AABlockItem, ?> RICE = new AABlockReg<>("rice", () -> new BlockPlant(ActuallyItems.RICE_SEED),
(b) -> new AABlockItem(b, defaultBlockItemProperties)); (b) -> new AABlockItem(b, defaultBlockItemProperties));
public static final AABlockReg<BlockPlant, AABlockItem, ?> CANOLA = new AABlockReg<>("canola", () -> new BlockPlant(ActuallyItems.CANOLA_SEED.get()), public static final AABlockReg<BlockPlant, AABlockItem, ?> CANOLA = new AABlockReg<>("canola", () -> new BlockPlant(ActuallyItems.CANOLA_SEED),
(b) -> new AABlockItem(b, defaultBlockItemProperties)); (b) -> new AABlockItem(b, defaultBlockItemProperties));
public static final AABlockReg<BlockPlant, AABlockItem, ?> FLAX = new AABlockReg<>("flax", () -> new BlockPlant(ActuallyItems.FLAX_SEED.get()), public static final AABlockReg<BlockPlant, AABlockItem, ?> FLAX = new AABlockReg<>("flax", () -> new BlockPlant(ActuallyItems.FLAX_SEED),
(b) -> new AABlockItem(b, defaultBlockItemProperties)); (b) -> new AABlockItem(b, defaultBlockItemProperties));
public static final AABlockReg<BlockPlant, AABlockItem, ?> COFFEE = new AABlockReg<>("coffee", () -> new BlockPlant(ActuallyItems.COFFEE_SEED.get()), public static final AABlockReg<BlockPlant, AABlockItem, ?> COFFEE = new AABlockReg<>("coffee", () -> new BlockPlant(ActuallyItems.COFFEE_SEED),
(b) -> new AABlockItem(b, defaultBlockItemProperties)); (b) -> new AABlockItem(b, defaultBlockItemProperties));
public static final AABlockReg<BlockGreenhouseGlass, AABlockItem, ?> GREENHOUSE_GLASS = new AABlockReg<>("greenhouse_glass", BlockGreenhouseGlass::new, public static final AABlockReg<BlockGreenhouseGlass, AABlockItem, ?> GREENHOUSE_GLASS = new AABlockReg<>("greenhouse_glass", BlockGreenhouseGlass::new,
(b) -> new AABlockItem(b, defaultBlockItemProperties)); (b) -> new AABlockItem(b, defaultBlockItemProperties));

View file

@ -31,23 +31,21 @@ import net.minecraftforge.common.PlantType;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import java.util.List; import java.util.List;
import java.util.function.Supplier;
// CROP BLOCK DEFAULTS TO 7 YEARS OF AGE.
import net.minecraft.block.AbstractBlock.Properties;
public class BlockPlant extends CropsBlock { public class BlockPlant extends CropsBlock {
public Item seedItem; public Supplier<Item> seedItem;
// Stolen from potato for now // Stolen from potato for now
// PotatoBlock(AbstractBlock.Properties.create(Material.PLANTS).doesNotBlockMovement().tickRandomly().zeroHardnessAndResistance().sound(SoundType.CROP))); // PotatoBlock(AbstractBlock.Properties.create(Material.PLANTS).doesNotBlockMovement().tickRandomly().zeroHardnessAndResistance().sound(SoundType.CROP)));
public BlockPlant(Item seedItem) { public BlockPlant(Supplier<Item> seedItem) {
super(Properties.of(Material.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP)); super(Properties.of(Material.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP));
this.seedItem = seedItem; this.seedItem = seedItem;
} }
// Remove // Remove
@Deprecated @Deprecated
public void doStuff(Item seedItem, Item returnItem, int returnMeta) { public void doStuff(Supplier<Item> seedItem, Item returnItem, int returnMeta) {
this.seedItem = seedItem; this.seedItem = seedItem;
// this.returnItem = returnItem; // this.returnItem = returnItem;
// this.returnMeta = returnMeta; // this.returnMeta = returnMeta;
@ -95,7 +93,7 @@ public class BlockPlant extends CropsBlock {
@Override @Override
protected IItemProvider getBaseSeedId() { protected IItemProvider getBaseSeedId() {
return this.seedItem; return this.seedItem.get();
} }
// @Override // @Override

View file

@ -6,15 +6,8 @@ public class CommonConfig {
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
public static ForgeConfigSpec COMMON_CONFIG; public static ForgeConfigSpec COMMON_CONFIG;
static { static {
OTHER.build(); OTHER.build();
COMMON_CONFIG = BUILDER.build(); COMMON_CONFIG = BUILDER.build();
} }

View file

@ -15,6 +15,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.StringNBT; import net.minecraft.nbt.StringNBT;
import net.minecraft.world.server.ServerWorld;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -24,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap;
public final class PlayerData { public final class PlayerData {
public static PlayerSave getDataFromPlayer(PlayerEntity player) { public static PlayerSave getDataFromPlayer(PlayerEntity player) {
WorldData worldData = WorldData.get(player.getCommandSenderWorld()); WorldData worldData = WorldData.get((ServerWorld) player.getCommandSenderWorld());
ConcurrentHashMap<UUID, PlayerSave> data = worldData.playerSaveData; ConcurrentHashMap<UUID, PlayerSave> data = worldData.playerSaveData;
UUID id = player.getUUID(); UUID id = player.getUUID();

View file

@ -17,7 +17,6 @@ import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler
import io.netty.util.internal.ConcurrentSet; import io.netty.util.internal.ConcurrentSet;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.storage.WorldSavedData; import net.minecraft.world.storage.WorldSavedData;
@ -37,13 +36,13 @@ public class WorldData extends WorldSavedData {
super(SAVE_NAME); super(SAVE_NAME);
} }
public static WorldData get(World world) { public static WorldData get(ServerWorld world) {
WorldData storage = ((ServerWorld) world).getDataStorage().get(WorldData::new, SAVE_NAME); WorldData storage = world.getDataStorage().get(WorldData::new, SAVE_NAME);
if (storage == null) { if (storage == null) {
storage = new WorldData(); storage = new WorldData();
storage.setDirty(); storage.setDirty();
((ServerWorld) world).getDataStorage().set(storage); world.getDataStorage().set(storage);
} }
return storage; return storage;

View file

@ -46,7 +46,7 @@ public class FluidAA implements Supplier<Fluid> {
source = InitFluids.FLUIDS.register(name, () -> new ForgeFlowingFluid.Source(props)); source = InitFluids.FLUIDS.register(name, () -> new ForgeFlowingFluid.Source(props));
flowing = InitFluids.FLUIDS.register(name + "_flowing", () -> new ForgeFlowingFluid.Flowing(props)); flowing = InitFluids.FLUIDS.register(name + "_flowing", () -> new ForgeFlowingFluid.Flowing(props));
fluidBlock = ActuallyBlocks.BLOCKS.register(name, () -> new FlowingFluidBlock(source, AbstractBlock.Properties.of(Material.WATER))); fluidBlock = ActuallyBlocks.BLOCKS.register(name, () -> new FlowingFluidBlock(source, AbstractBlock.Properties.of(Material.WATER)));
bucket = ActuallyItems.ITEMS.register(name + "_bucket", () -> new BucketItem(source.get(), new Item.Properties().craftRemainder(Items.BUCKET).tab(ActuallyAdditions.GROUP).stacksTo(1))); bucket = ActuallyItems.ITEMS.register(name + "_bucket", () -> new BucketItem(source, new Item.Properties().craftRemainder(Items.BUCKET).tab(ActuallyAdditions.GROUP).stacksTo(1)));
} }
public static ForgeFlowingFluid.Properties makeProperties(String texture, Supplier<FlowingFluidBlock> blockSupplier, Supplier<ForgeFlowingFluid> stillSupplier, Supplier<ForgeFlowingFluid> flowingSupplier, Supplier<Item> bucketSupplier) { public static ForgeFlowingFluid.Properties makeProperties(String texture, Supplier<FlowingFluidBlock> blockSupplier, Supplier<ForgeFlowingFluid> stillSupplier, Supplier<ForgeFlowingFluid> flowingSupplier, Supplier<Item> bucketSupplier) {

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
@ -166,7 +167,7 @@ public class ItemDrill extends ItemEnergy {
@Override @Override
public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack) { public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack) {
Multimap<Attribute, AttributeModifier> map = super.getAttributeModifiers(slot, stack); Multimap<Attribute, AttributeModifier> map = ArrayListMultimap.create();
if (slot == EquipmentSlotType.MAINHAND) { if (slot == EquipmentSlotType.MAINHAND) {
map.put(Attributes.ATTACK_DAMAGE, new AttributeModifier("Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE map.put(Attributes.ATTACK_DAMAGE, new AttributeModifier("Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import net.minecraft.entity.ai.attributes.Attribute; import net.minecraft.entity.ai.attributes.Attribute;
@ -33,7 +34,7 @@ public class ItemKnife extends ItemBase {
@Override @Override
public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack) { public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack) {
Multimap<Attribute, AttributeModifier> map = super.getAttributeModifiers(slot, stack); Multimap<Attribute, AttributeModifier> map = ArrayListMultimap.create();
if (slot == EquipmentSlotType.MAINHAND) { if (slot == EquipmentSlotType.MAINHAND) {
// TODO: [port] validate // TODO: [port] validate
map.put(Attributes.ATTACK_DAMAGE, new AttributeModifier("Knife Modifier", 3, AttributeModifier.Operation.ADDITION)); map.put(Attributes.ATTACK_DAMAGE, new AttributeModifier("Knife Modifier", 3, AttributeModifier.Operation.ADDITION));

View file

@ -14,9 +14,7 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre; import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.NetherrackBlock; import net.minecraft.block.NetherrackBlock;
@ -90,25 +88,26 @@ public class LensMining extends Lens {
ActuallyAdditionsAPI.addMiningLensNetherOre("oreCobalt", 50); ActuallyAdditionsAPI.addMiningLensNetherOre("oreCobalt", 50);
ActuallyAdditionsAPI.addMiningLensNetherOre("oreArdite", 50); ActuallyAdditionsAPI.addMiningLensNetherOre("oreArdite", 50);
for (String conf : ConfigStringListValues.MINING_LENS_EXTRA_WHITELIST.getValue()) { // TODO: fix me
if (conf.contains("@")) { // for (String conf : ConfigStringListValues.MINING_LENS_EXTRA_WHITELIST.getValue()) {
try { // if (conf.contains("@")) {
String[] split = conf.split("@"); // try {
// String[] split = conf.split("@");
String ore = split[0]; //
int weight = Integer.parseInt(split[1]); // String ore = split[0];
String dim = split[2]; // int weight = Integer.parseInt(split[1]);
// String dim = split[2];
if ("n".equals(dim)) { //
ActuallyAdditionsAPI.addMiningLensNetherOre(ore, weight); // if ("n".equals(dim)) {
} else if ("s".equals(dim)) { // ActuallyAdditionsAPI.addMiningLensNetherOre(ore, weight);
ActuallyAdditionsAPI.addMiningLensStoneOre(ore, weight); // } else if ("s".equals(dim)) {
} // ActuallyAdditionsAPI.addMiningLensStoneOre(ore, weight);
} catch (Exception e) { // }
ActuallyAdditions.LOGGER.warn("A config option appears to be incorrect: The entry " + conf + " can't be parsed!"); // } catch (Exception e) {
} // ActuallyAdditions.LOGGER.warn("A config option appears to be incorrect: The entry " + conf + " can't be parsed!");
} // }
} // }
// }
} }
@Override @Override

View file

@ -46,7 +46,8 @@ public class SpecialRenderInit {
meta = 0; meta = 0;
} }
ResourceLocation resLoc = new ResourceLocation(itemName); // TODO: remove tolowercase hack
ResourceLocation resLoc = new ResourceLocation(itemName.toLowerCase());
ItemStack stack = findItem(resLoc); ItemStack stack = findItem(resLoc);
//TODO Remove this block once the transition to 1.11 is done and the special people stuff file has been converted to snake_case //TODO Remove this block once the transition to 1.11 is done and the special people stuff file has been converted to snake_case

View file

@ -11,9 +11,7 @@
package de.ellpeck.actuallyadditions.mod.update; package de.ellpeck.actuallyadditions.mod.update;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
@ -34,11 +32,11 @@ public class UpdateChecker {
public static boolean threadFinished = false; public static boolean threadFinished = false;
public UpdateChecker() { public UpdateChecker() {
if (CommonConfig.OTHER.DO_UPDATE_CHECK.get() && !Util.isDevVersion()) { // if (CommonConfig.OTHER.DO_UPDATE_CHECK.get() && !Util.isDevVersion()) {
ActuallyAdditions.LOGGER.info("Initializing Update Checker..."); // ActuallyAdditions.LOGGER.info("Initializing Update Checker...");
new ThreadUpdateChecker(); // new ThreadUpdateChecker();
MinecraftForge.EVENT_BUS.register(this); // MinecraftForge.EVENT_BUS.register(this);
} // }
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)

View file

@ -6,7 +6,7 @@ license="MIT"
modId="actuallyadditions" modId="actuallyadditions"
version="${file.jarVersion}" version="${file.jarVersion}"
displayName="Actually Additions" displayName="Actually Additions"
logoFile="assets/actuallyadditions/textures/logo.png" #logoFile="logo.png"
credits="Author: Ellpeck; Textures and Models: BootyToast, GlenthorLP, canitzp" credits="Author: Ellpeck; Textures and Models: BootyToast, GlenthorLP, canitzp"
authors="Ellpeck" authors="Ellpeck"
description=''' description='''