Reformatted, and ported back some enhancements from the Forge version.

This commit is contained in:
Sebastian Hartte
2020-08-15 02:51:03 +02:00
parent 0a2f03aa92
commit 6c544f2211
358 changed files with 1124 additions and 1831 deletions
-13
View File
@@ -4,25 +4,12 @@ import java.util.Objects;
import java.util.UUID;
import java.util.WeakHashMap;
import javax.annotation.Nullable;
import com.mojang.authlib.GameProfile;
import io.netty.util.concurrent.CompleteFuture;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import io.netty.util.concurrent.SucceededFuture;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.NetworkSide;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.c2s.play.ClientSettingsC2SPacket;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.network.ServerPlayerInteractionManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
public class FakePlayer extends ServerPlayerEntity {
@@ -33,11 +33,10 @@ public interface ISlimReadableNumberConverter {
* Converts a number into a human readable form. It will not round the number,
* but down it. Will try to cut the number down 1 decimal later, but rarely
* because of the 3 width limitation. Can only handle non negative numbers
*
* <p>
* Example: 10000L -> 10K 9999L -> 9K, not 9.9K cause 4 width
*
* @param number to be converted number
*
* @return String in SI format cut down as far as possible
*/
String toSlimReadableForm(@Nonnegative long number);
@@ -32,11 +32,10 @@ public interface IWideReadableNumberConverter {
* Converts a number into a human readable form. It will not round the number,
* but down it. Will try to cut the number down 1 decimal later if width can be
* below 4. Can only handle non negative numbers
*
* <p>
* Example: 10000L -> 10K 9999L -> 9999
*
* @param number to be converted number
*
* @return String in SI format cut down as far as possible
*/
String toWideReadableForm(@Nonnegative long number);
@@ -40,9 +40,7 @@ public interface IWorldCallable<T> {
* @param world this param is given to not hold a reference to the world but let
* the caller handle it. Do not expect a world here thus can be
* <tt>null</tt>.
*
* @return result of call on the world. Can be <tt>null</tt>.
*
* @throws Exception if the call fails
* @see Callable#call()
*/
+7 -23
View File
@@ -19,11 +19,7 @@
package appeng.util;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.*;
import javax.annotation.Nullable;
@@ -46,7 +42,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.recipe.Recipe;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
@@ -56,24 +51,14 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.*;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.RayTraceContext;
import net.minecraft.world.World;
import alexiil.mc.lib.attributes.fluid.volume.FluidVolume;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.PowerUnits;
import appeng.api.config.SearchBoxMode;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.SortOrder;
import appeng.api.config.*;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IMaterials;
import appeng.api.features.AEFeature;
@@ -157,7 +142,6 @@ public class Platform {
*
* @param n to be formatted long value
* @param isRate if true it adds a /t to the formatted string
*
* @return formatted long value
*/
public static String formatPowerLong(final long n, final boolean isRate) {
@@ -1060,10 +1044,10 @@ public class Platform {
for (final IAEItemStack x : items) {
final ItemStack sh = x.getDefinition();
if ((Platform.itemComparisons().isEqualItemType(providedTemplate,
sh) /* FIXME || ae_req.sameOre( x ) */ ) && !ItemStack.areItemsEqual(sh, output)) { // Platform.isSameItemType(
// sh,
// providedTemplate
// )
sh) /* FIXME || ae_req.sameOre( x ) */) && !ItemStack.areItemsEqual(sh, output)) { // Platform.isSameItemType(
// sh,
// providedTemplate
// )
final ItemStack cp = sh.copy();
cp.setCount(1);
ci.setStack(slot, cp);
@@ -69,7 +69,6 @@ public enum ReadableNumberConverter implements ISlimReadableNumberConverter, IWi
*
* @param number to be formatted number
* @param width width limitation of the resulting number
*
* @return formatted number restricted by the width limitation
*/
private String toReadableFormRestrictedByWidth(final long number, final int width) {
@@ -39,7 +39,6 @@ public final class UUIDMatcher {
* applying a regular expression on it.
*
* @param potential to be checked potential {@link java.util.UUID}
*
* @return true, if the potential {@link java.util.UUID} is indeed an
* {@link java.util.UUID}
*/
@@ -28,17 +28,16 @@ import appeng.api.config.FuzzyMode;
/**
* A helper class for comparing {@link Item}, {@link ItemStack} or NBT
*
*/
public class ItemComparisonHelper {
/**
* Compare the two {@link ItemStack}s based on the same {@link Item} and damage
* value.
*
* <p>
* In case of the item being damageable, only the {@link Item} will be
* considered. If not it will also compare both damage values.
*
* <p>
* Ignores NBT.
*
* @return true, if both are equal.
@@ -49,7 +48,7 @@ public class ItemComparisonHelper {
/**
* Compares two {@link ItemStack} and their NBT tag for equality.
*
* <p>
* Use this when a precise check is required and the same item is required. Not
* just something with different NBT tags.
*
@@ -18,11 +18,7 @@
package appeng.util.item;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.NavigableMap;
import java.util.TreeMap;
import java.util.*;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.data.IAEItemStack;
+1 -6
View File
@@ -18,12 +18,7 @@
package appeng.util.item;
import java.util.Collection;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.*;
import net.minecraft.item.Item;