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.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
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.event.AddReloadListenerEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.RegistryObject;
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.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
@ -90,6 +93,8 @@ public class ActuallyAdditions {
public static boolean commonCapsLoaded;
public ActuallyAdditions() {
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, CommonConfig.COMMON_CONFIG);
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
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?
//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));
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));
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));
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));
public static final AABlockReg<BlockGreenhouseGlass, AABlockItem, ?> GREENHOUSE_GLASS = new AABlockReg<>("greenhouse_glass", BlockGreenhouseGlass::new,
(b) -> new AABlockItem(b, defaultBlockItemProperties));

View file

@ -31,23 +31,21 @@ import net.minecraftforge.common.PlantType;
import net.minecraftforge.items.ItemHandlerHelper;
import java.util.List;
// CROP BLOCK DEFAULTS TO 7 YEARS OF AGE.
import net.minecraft.block.AbstractBlock.Properties;
import java.util.function.Supplier;
public class BlockPlant extends CropsBlock {
public Item seedItem;
public Supplier<Item> seedItem;
// Stolen from potato for now
// 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));
this.seedItem = seedItem;
}
// Remove
@Deprecated
public void doStuff(Item seedItem, Item returnItem, int returnMeta) {
public void doStuff(Supplier<Item> seedItem, Item returnItem, int returnMeta) {
this.seedItem = seedItem;
// this.returnItem = returnItem;
// this.returnMeta = returnMeta;
@ -95,7 +93,7 @@ public class BlockPlant extends CropsBlock {
@Override
protected IItemProvider getBaseSeedId() {
return this.seedItem;
return this.seedItem.get();
}
// @Override

View file

@ -6,15 +6,8 @@ public class CommonConfig {
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
public static ForgeConfigSpec COMMON_CONFIG;
static {
OTHER.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.ListNBT;
import net.minecraft.nbt.StringNBT;
import net.minecraft.world.server.ServerWorld;
import java.util.ArrayList;
import java.util.List;
@ -24,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap;
public final class PlayerData {
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;
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 net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.storage.WorldSavedData;
@ -37,13 +36,13 @@ public class WorldData extends WorldSavedData {
super(SAVE_NAME);
}
public static WorldData get(World world) {
WorldData storage = ((ServerWorld) world).getDataStorage().get(WorldData::new, SAVE_NAME);
public static WorldData get(ServerWorld world) {
WorldData storage = world.getDataStorage().get(WorldData::new, SAVE_NAME);
if (storage == null) {
storage = new WorldData();
storage.setDirty();
((ServerWorld) world).getDataStorage().set(storage);
world.getDataStorage().set(storage);
}
return storage;

View file

@ -46,7 +46,7 @@ public class FluidAA implements Supplier<Fluid> {
source = InitFluids.FLUIDS.register(name, () -> new ForgeFlowingFluid.Source(props));
flowing = InitFluids.FLUIDS.register(name + "_flowing", () -> new ForgeFlowingFluid.Flowing(props));
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) {

View file

@ -10,6 +10,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;
@ -166,7 +167,7 @@ public class ItemDrill extends ItemEnergy {
@Override
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) {
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;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import net.minecraft.entity.ai.attributes.Attribute;
@ -33,7 +34,7 @@ public class ItemKnife extends ItemBase {
@Override
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) {
// TODO: [port] validate
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.lens.Lens;
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.ConfigStringListValues;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.NetherrackBlock;
@ -90,25 +88,26 @@ public class LensMining extends Lens {
ActuallyAdditionsAPI.addMiningLensNetherOre("oreCobalt", 50);
ActuallyAdditionsAPI.addMiningLensNetherOre("oreArdite", 50);
for (String conf : ConfigStringListValues.MINING_LENS_EXTRA_WHITELIST.getValue()) {
if (conf.contains("@")) {
try {
String[] split = conf.split("@");
String ore = split[0];
int weight = Integer.parseInt(split[1]);
String dim = split[2];
if ("n".equals(dim)) {
ActuallyAdditionsAPI.addMiningLensNetherOre(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!");
}
}
}
// TODO: fix me
// for (String conf : ConfigStringListValues.MINING_LENS_EXTRA_WHITELIST.getValue()) {
// if (conf.contains("@")) {
// try {
// String[] split = conf.split("@");
//
// String ore = split[0];
// int weight = Integer.parseInt(split[1]);
// String dim = split[2];
//
// if ("n".equals(dim)) {
// ActuallyAdditionsAPI.addMiningLensNetherOre(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!");
// }
// }
// }
}
@Override

View file

@ -46,7 +46,8 @@ public class SpecialRenderInit {
meta = 0;
}
ResourceLocation resLoc = new ResourceLocation(itemName);
// TODO: remove tolowercase hack
ResourceLocation resLoc = new ResourceLocation(itemName.toLowerCase());
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

View file

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

View file

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