Compare commits

..

No commits in common. "b0c1e8e8cc409993e4af9c6ab4cf984e93bf5591" and "ec2606f470b5bff6d3d00c4f79affe60e8014b40" have entirely different histories.

19 changed files with 52 additions and 54 deletions

View file

@ -7,7 +7,7 @@ mod_version=1.1.52
# Forge
game_version=1.16.5
forge_version=36.2.30
forge_version=36.2.22
# 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,6 +15,7 @@ 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;
@ -72,7 +73,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,39 +2,20 @@ 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();
ItemSettings.build();
OTHER.build();
MACHINES.build();
COMMON_CONFIG = BUILDER.build();
}
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 class MACHINES {
public static ForgeConfigSpec.IntValue FARMER_AREA;
public static ForgeConfigSpec.IntValue RECONSTRUCTOR_POWER;
@ -48,7 +29,8 @@ 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,7 +49,11 @@ 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.CommonConfig;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
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 : CommonConfig.ItemSettings.DRILL_EXTRA_MINING_WHITELIST.get()) {
for (String s : ConfigStringListValues.DRILL_EXTRA_MINING_WHITELIST.getValue()) {
if (s != null && s.equals(name)) {
return true;
}

View file

@ -19,6 +19,7 @@ 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;
@ -41,9 +42,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,6 +23,7 @@ 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;
@ -69,7 +70,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

@ -18,9 +18,10 @@ import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3i;
import net.minecraft.world.World;
public class ItemTeleStaff extends ItemEnergy {
@ -33,14 +34,14 @@ public class ItemTeleStaff extends ItemEnergy {
public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
ItemStack stack = player.getItemInHand(hand);
if (!world.isClientSide) {
RayTraceResult rayTraceResult = player.pick(100,1F,false);
if (rayTraceResult.getType() == RayTraceResult.Type.BLOCK || player.xRot >= -5) {
Vector3d location = rayTraceResult.getLocation();
Vector3d pos = Vector3d.atBottomCenterOf(new Vector3i(location.x, location.y, location.z));
RayTraceResult rayTraceResult = player.pick(100,0,false);
if (rayTraceResult != null && (rayTraceResult.getType() == RayTraceResult.Type.BLOCK || player.xRot >= -5)) {
BlockRayTraceResult res = (BlockRayTraceResult)rayTraceResult;
BlockPos pos = res.getBlockPos().relative(res.getDirection());
int baseUse = 200;
int use = baseUse + (int) (baseUse * player.blockPosition().distSqr(new Vector3i(pos.x, pos.y, pos.z)));
int use = baseUse + (int) (baseUse * rayTraceResult.getLocation().distanceTo(new Vector3d(player.getX(), player.getY() + (player.getEyeHeight() - player.getEyeHeight()), player.getZ())));
if (this.getEnergyStored(stack) >= use) {
((ServerPlayerEntity) player).connection.teleport(pos.x, pos.y + 1F, pos.z, player.yRot, player.xRot);
((ServerPlayerEntity) player).connection.teleport(pos.getX(), pos.getY(), pos.getY(), player.yRot, player.xRot);
player.removeVehicle();
world.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F);
if (!player.isCreative()) {

View file

@ -31,6 +31,7 @@ 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;
@ -45,7 +46,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) {
@ -125,7 +126,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,6 +23,7 @@ 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;
@ -67,7 +68,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,9 +16,11 @@ 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;
@ -31,6 +33,8 @@ 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;
@ -44,7 +48,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,6 +16,7 @@ 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;
@ -32,6 +33,7 @@ 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;
@ -93,7 +95,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);