Added spotless back and reformatted

This commit is contained in:
Sebastian Hartte
2020-07-27 20:07:27 +02:00
parent 49296915c9
commit 780f68952b
593 changed files with 4192 additions and 3969 deletions
@@ -18,9 +18,10 @@
package appeng.items.contents;
import alexiil.mc.lib.attributes.item.FixedItemInvView;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.item.FixedItemInvView;
import appeng.tile.inventory.AppEngInternalInventory;
public class CellConfig extends AppEngInternalInventory {
@@ -18,9 +18,10 @@
package appeng.items.contents;
import alexiil.mc.lib.attributes.item.FixedItemInvView;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.item.FixedItemInvView;
import appeng.parts.automation.StackUpgradeInventory;
public final class CellUpgrades extends StackUpgradeInventory {
@@ -18,9 +18,10 @@
package appeng.items.contents;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.implementations.guiobjects.INetworkTool;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.networking.IGridHost;
@@ -53,7 +54,7 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory {
@Override
public void onChangeInventory(FixedItemInv inv, int slot, InvOperation mc, ItemStack removedStack,
ItemStack newStack) {
ItemStack newStack) {
}
@Override
@@ -20,22 +20,22 @@ package appeng.items.materials;
import java.util.List;
import appeng.hooks.AEToolItem;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.Upgrades;
@@ -45,6 +45,7 @@ import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.implementations.tiles.ISegmentedInventory;
import appeng.api.parts.IPartHost;
import appeng.api.parts.SelectedPart;
import appeng.hooks.AEToolItem;
import appeng.items.AEBaseItem;
import appeng.util.InventoryAdaptor;
import appeng.util.inv.AdaptorFixedInv;
@@ -22,7 +22,6 @@ import java.util.List;
import javax.annotation.Nullable;
import appeng.core.AppEng;
import com.google.common.base.Preconditions;
import net.fabricmc.api.EnvType;
@@ -37,13 +36,14 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.MathHelper;
import net.minecraft.text.Text;
import net.minecraft.world.World;
import appeng.api.implementations.items.IGrowableCrystal;
import appeng.core.AppEng;
import appeng.core.localization.ButtonToolTips;
import appeng.entity.GrowingCrystalEntity;
import appeng.items.AEBaseItem;
@@ -73,11 +73,8 @@ public class CrystalSeedItem extends AEBaseItem implements IGrowableCrystal {
super(properties);
this.grownItem = Preconditions.checkNotNull(grownItem);
// Expose the growth of the seed to the model system
FabricModelPredicateProviderRegistry.register(
this,
new Identifier(AppEng.MOD_ID, "growth"),
(is, w, p) -> getGrowthTicks(is) / (float) GROWTH_TICKS_REQUIRED
);
FabricModelPredicateProviderRegistry.register(this, new Identifier(AppEng.MOD_ID, "growth"),
(is, w, p) -> getGrowthTicks(is) / (float) GROWTH_TICKS_REQUIRED);
}
@Nullable
@@ -24,12 +24,12 @@ import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import appeng.core.Api;
import appeng.hooks.AEToolItem;
import net.fabricmc.fabric.api.util.NbtType;
import net.minecraft.client.item.TooltipContext;
import com.google.common.base.Preconditions;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.util.NbtType;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
@@ -39,17 +39,17 @@ import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.text.LiteralText;
import net.minecraft.text.MutableText;
import net.minecraft.util.*;
import net.minecraft.text.Text;
import net.minecraft.util.*;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.helpers.InvalidPatternHelper;
import appeng.hooks.AEToolItem;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
@@ -117,10 +117,9 @@ public class EncodedPatternItem extends AEBaseItem implements AEToolItem {
InvalidPatternHelper invalid = new InvalidPatternHelper(stack);
final Text label = (invalid.isCraftable() ? GuiText.Crafts.text()
: GuiText.Creates.text()).copy().append(": ");
final Text and = new LiteralText(" ").append(GuiText.And.text())
.append(" ");
final Text label = (invalid.isCraftable() ? GuiText.Crafts.text() : GuiText.Creates.text()).copy()
.append(": ");
final Text and = new LiteralText(" ").append(GuiText.And.text()).append(" ");
final Text with = GuiText.With.text().copy().append(": ");
boolean first = true;
@@ -137,8 +136,7 @@ public class EncodedPatternItem extends AEBaseItem implements AEToolItem {
if (invalid.isCraftable()) {
final MutableText substitutionLabel = GuiText.Substitute.text().copy().append(" ");
final Text canSubstitute = invalid.canSubstitute() ? GuiText.Yes.text()
: GuiText.No.text();
final Text canSubstitute = invalid.canSubstitute() ? GuiText.Yes.text() : GuiText.No.text();
lines.add(substitutionLabel.append(canSubstitute));
}
@@ -156,10 +154,8 @@ public class EncodedPatternItem extends AEBaseItem implements AEToolItem {
final Collection<IAEItemStack> in = details.getInputs();
final Collection<IAEItemStack> out = details.getOutputs();
final Text label = (isCrafting ? GuiText.Crafts.text() : GuiText.Creates.text())
.copy().append(": ");
final Text and = new LiteralText(" ").append(GuiText.And.text())
.append(" ");
final Text label = (isCrafting ? GuiText.Crafts.text() : GuiText.Creates.text()).copy().append(": ");
final Text and = new LiteralText(" ").append(GuiText.And.text()).append(" ");
final Text with = GuiText.With.text().copy().append(": ");
boolean first = true;
@@ -219,9 +215,7 @@ public class EncodedPatternItem extends AEBaseItem implements AEToolItem {
final CompoundTag tag = itemStack.getTag();
Preconditions.checkArgument(tag != null, "itemStack missing a NBT tag");
return tag.contains(NBT_RECIPE_ID, NbtType.STRING)
? new Identifier(tag.getString(NBT_RECIPE_ID))
: null;
return tag.contains(NBT_RECIPE_ID, NbtType.STRING) ? new Identifier(tag.getString(NBT_RECIPE_ID)) : null;
}
public List<IAEItemStack> getIngredients(ItemStack itemStack) {
@@ -280,8 +274,8 @@ public class EncodedPatternItem extends AEBaseItem implements AEToolItem {
/**
* Use the public API instead {@link appeng.core.api.ApiCrafting}
*/
public static void encodeCraftingPattern(ItemStack stack, ItemStack[] in, ItemStack[] out,
Identifier recipeId, boolean allowSubstitutes) {
public static void encodeCraftingPattern(ItemStack stack, ItemStack[] in, ItemStack[] out, Identifier recipeId,
boolean allowSubstitutes) {
CompoundTag encodedValue = encodeInputsAndOutputs(in, out);
encodedValue.putString(EncodedPatternItem.NBT_RECIPE_ID, recipeId.toString());
encodedValue.putBoolean(EncodedPatternItem.NBT_SUBSITUTE, allowSubstitutes);
@@ -18,7 +18,6 @@
package appeng.items.parts;
import appeng.hooks.AEToolItem;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.api.EnvironmentInterface;
@@ -32,12 +31,12 @@ import net.minecraft.item.*;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tag.BlockTags;
import net.minecraft.tag.Tag;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.text.Text;
import net.minecraft.world.EmptyBlockView;
import appeng.api.exceptions.MissingDefinitionException;
@@ -49,9 +48,10 @@ import appeng.core.Api;
import appeng.core.AppEng;
import appeng.facade.FacadePart;
import appeng.facade.IFacadeItem;
import appeng.hooks.AEToolItem;
import appeng.items.AEBaseItem;
@EnvironmentInterface(value = EnvType.CLIENT, itf=IAlphaPassItem.class)
@EnvironmentInterface(value = EnvType.CLIENT, itf = IAlphaPassItem.class)
public class FacadeItem extends AEBaseItem implements IFacadeItem, IAlphaPassItem, AEToolItem {
/**
@@ -67,8 +67,8 @@ public class FacadeItem extends AEBaseItem implements IFacadeItem, IAlphaPassIte
@Override
public ActionResult onItemUseFirst(ItemStack stack, ItemUsageContext context) {
return Api.instance().partHelper().placeBus(stack, context.getBlockPos(), context.getSide(), context.getPlayer(),
context.getHand(), context.getWorld());
return Api.instance().partHelper().placeBus(stack, context.getBlockPos(), context.getSide(),
context.getPlayer(), context.getHand(), context.getWorld());
}
@Override
@@ -70,8 +70,7 @@ public class PartModelsHelper {
// Make sure we can handle the return type
Class<?> returnType = method.getReturnType();
if (!Identifier.class.isAssignableFrom(returnType)
&& !Collection.class.isAssignableFrom(returnType)) {
if (!Identifier.class.isAssignableFrom(returnType) && !Collection.class.isAssignableFrom(returnType)) {
AELog.error(
"The @PartModels annotation can only be used on static methods that return a ResourceLocation or Collection of "
+ "ResourceLocations. Was seen on: " + method);
@@ -20,20 +20,20 @@ package appeng.items.storage;
import java.util.List;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.hooks.AEToolItem;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.util.TypedActionResult;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.text.Text;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import net.fabricmc.api.Environment;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.FuzzyMode;
import appeng.api.exceptions.MissingDefinitionException;
@@ -46,6 +46,7 @@ import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.hooks.AEToolItem;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
@@ -58,7 +59,8 @@ import appeng.util.Platform;
* @version rv6 - 2018-01-17
* @since rv6 2018-01-17
*/
public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseItem implements IStorageCell<T>, AEToolItem {
public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseItem
implements IStorageCell<T>, AEToolItem {
protected final MaterialType component;
protected final int totalBytes;
@@ -20,7 +20,6 @@ package appeng.items.storage;
import java.util.List;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.item.TooltipContext;
@@ -28,6 +27,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.world.World;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.cells.ICellInventoryHandler;
@@ -21,19 +21,19 @@ package appeng.items.storage;
import java.util.List;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.text.Text;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
import net.fabricmc.api.Environment;
import appeng.api.implementations.TransitionResult;
import appeng.api.implementations.items.ISpatialStorageCell;
@@ -18,9 +18,10 @@
package appeng.items.storage;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Upgrades;
import appeng.api.implementations.items.IUpgradeModule;
@@ -23,6 +23,8 @@ import java.util.List;
import com.mojang.authlib.GameProfile;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
@@ -30,14 +32,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.Hand;
import net.minecraft.text.Text;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import appeng.api.config.SecurityPermissions;
import appeng.api.features.IPlayerRegistry;
@@ -62,7 +62,8 @@ public class BiometricCardItem extends AEBaseItem implements IBiometricCard {
return TypedActionResult.pass(p.getStackInHand(hand));
}
// FIXME FABRIC: Validate that this actually works about as well as the forge hook does
// FIXME FABRIC: Validate that this actually works about as well as the forge
// hook does
@Override
public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity target, Hand hand) {
if (target instanceof PlayerEntity && !user.isInSneakingPose()) {
@@ -79,8 +80,7 @@ public class BiometricCardItem extends AEBaseItem implements IBiometricCard {
@Override
public Text getName(final ItemStack is) {
final GameProfile username = this.getProfile(is);
return username != null ? super.getName(is).copy().append(" - " + username.getName())
: super.getName(is);
return username != null ? super.getName(is).copy().append(" - " + username.getName()) : super.getName(is);
}
private void encode(final ItemStack is, final PlayerEntity p) {
@@ -20,27 +20,27 @@ package appeng.items.tools;
import java.util.List;
import appeng.block.AEBaseTileBlock;
import appeng.hooks.AEToolItem;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.*;
import net.minecraft.text.Text;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.world.World;
import net.fabricmc.api.Environment;
import appeng.api.implementations.items.IMemoryCard;
import appeng.api.implementations.items.MemoryCardMessages;
import appeng.api.util.AEColor;
import appeng.block.AEBaseTileBlock;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.hooks.AEToolItem;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
@@ -168,7 +168,8 @@ public class MemoryCardItem extends AEBaseItem implements AEToolItem, IMemoryCar
if (!context.getPlayer().world.isClient) {
BlockState state = context.getWorld().getBlockState(context.getBlockPos());
ActionResult useResult = state.onUse(context.getWorld(), context.getPlayer(), context.getHand(),
new BlockHitResult(context.getHitPos(), context.getSide(), context.getBlockPos(), context.hitsInsideBlock()));
new BlockHitResult(context.getHitPos(), context.getSide(), context.getBlockPos(),
context.hitsInsideBlock()));
if (!useResult.isAccepted()) {
clearCard(context.getPlayer(), context.getWorld(), context.getHand());
}
@@ -18,7 +18,6 @@
package appeng.items.tools;
import appeng.hooks.AEToolItem;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlockEntity;
@@ -27,9 +26,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.util.*;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import appeng.api.implementations.guiobjects.IGuiItem;
@@ -48,6 +47,7 @@ import appeng.container.implementations.NetworkToolContainer;
import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ClickPacket;
import appeng.hooks.AEToolItem;
import appeng.items.AEBaseItem;
import appeng.items.contents.NetworkToolViewer;
import appeng.util.Platform;
@@ -83,8 +83,8 @@ public class NetworkToolItem extends AEBaseItem implements IGuiItem, IAEWrench,
@Override
public ActionResult onItemUseFirst(ItemStack stack, ItemUsageContext context) {
final BlockHitResult mop = new BlockHitResult(context.getHitPos(), context.getSide(),
context.getBlockPos(), context.hitsInsideBlock());
final BlockHitResult mop = new BlockHitResult(context.getHitPos(), context.getSide(), context.getBlockPos(),
context.hitsInsideBlock());
final BlockEntity te = context.getWorld().getBlockEntity(context.getBlockPos());
if (te instanceof IPartHost) {
@@ -19,9 +19,9 @@
package appeng.items.tools.powered;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.util.math.Box;
import appeng.api.config.Actionable;
@@ -18,37 +18,12 @@
package appeng.items.tools.powered;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.core.Api;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.block.networking.CableBusBlock;
import appeng.block.paint.PaintSplotchesBlock;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import appeng.helpers.IMouseWheelItem;
import appeng.hooks.IBlockTool;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.items.misc.PaintBallItem;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
import appeng.me.helpers.BaseActionSource;
import appeng.tile.misc.PaintSplotchesBlockEntity;
import appeng.util.FakePlayer;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import java.util.*;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableMap;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
@@ -74,37 +49,58 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.*;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.block.networking.CableBusBlock;
import appeng.block.paint.PaintSplotchesBlock;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import appeng.helpers.IMouseWheelItem;
import appeng.hooks.IBlockTool;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.items.misc.PaintBallItem;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
import appeng.me.helpers.BaseActionSource;
import appeng.tile.misc.PaintSplotchesBlockEntity;
import appeng.util.FakePlayer;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
public class ColorApplicatorItem extends AEBasePoweredItem
implements IStorageCell<IAEItemStack>, IBlockTool, IMouseWheelItem {
private static final Map<Identifier, AEColor> TAG_TO_COLOR = ImmutableMap.<Identifier, AEColor>builder()
.put(new Identifier("c:black_dyes"), AEColor.BLACK)
.put(new Identifier("c:blue_dyes"), AEColor.BLUE)
.put(new Identifier("c:brown_dyes"), AEColor.BROWN)
.put(new Identifier("c:cyan_dyes"), AEColor.CYAN)
.put(new Identifier("c:gray_dyes"), AEColor.GRAY)
.put(new Identifier("c:green_dyes"), AEColor.GREEN)
.put(new Identifier("c:black_dyes"), AEColor.BLACK).put(new Identifier("c:blue_dyes"), AEColor.BLUE)
.put(new Identifier("c:brown_dyes"), AEColor.BROWN).put(new Identifier("c:cyan_dyes"), AEColor.CYAN)
.put(new Identifier("c:gray_dyes"), AEColor.GRAY).put(new Identifier("c:green_dyes"), AEColor.GREEN)
.put(new Identifier("c:light_blue_dyes"), AEColor.LIGHT_BLUE)
.put(new Identifier("c:light_gray_dyes"), AEColor.LIGHT_GRAY)
.put(new Identifier("c:lime_dyes"), AEColor.LIME)
.put(new Identifier("c:magenta_dyes"), AEColor.MAGENTA)
.put(new Identifier("c:orange_dyes"), AEColor.ORANGE)
.put(new Identifier("c:pink_dyes"), AEColor.PINK)
.put(new Identifier("c:purple_dyes"), AEColor.PURPLE)
.put(new Identifier("c:red_dyes"), AEColor.RED)
.put(new Identifier("c:white_dyes"), AEColor.WHITE)
.put(new Identifier("c:yellow_dyes"), AEColor.YELLOW).build();
.put(new Identifier("c:lime_dyes"), AEColor.LIME).put(new Identifier("c:magenta_dyes"), AEColor.MAGENTA)
.put(new Identifier("c:orange_dyes"), AEColor.ORANGE).put(new Identifier("c:pink_dyes"), AEColor.PINK)
.put(new Identifier("c:purple_dyes"), AEColor.PURPLE).put(new Identifier("c:red_dyes"), AEColor.RED)
.put(new Identifier("c:white_dyes"), AEColor.WHITE).put(new Identifier("c:yellow_dyes"), AEColor.YELLOW)
.build();
private static final String TAG_COLOR = "color";
public ColorApplicatorItem(Item.Settings props) {
super(AEConfig.instance().getColorApplicatorBattery(), props);
FabricModelPredicateProviderRegistry.register(
this,
new Identifier(AppEng.MOD_ID, "colored"),
FabricModelPredicateProviderRegistry.register(this, new Identifier(AppEng.MOD_ID, "colored"),
(itemStack, world, entity) -> {
// If the stack has no color, don't use the colored model since the impact of
// calling getColor for every quad is extremely high, if the stack tries to
@@ -112,8 +108,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
// inventory for a new paintball everytime
AEColor col = getActiveColor(itemStack);
return (col != null) ? 1 : 0;
}
);
});
}
@Override
@@ -25,8 +25,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import appeng.mixins.TntAccessor;
import appeng.util.FakePlayer;
import net.minecraft.block.*;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
@@ -34,9 +32,10 @@ import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.*;
import net.minecraft.recipe.RecipeType;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.recipe.RecipeType;
import net.minecraft.recipe.SmeltingRecipe;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.property.Properties;
@@ -44,12 +43,11 @@ import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.RayTraceContext;
import net.minecraft.util.hit.HitResult;
import net.minecraft.world.World;
import net.minecraft.server.world.ServerWorld;
import appeng.api.config.Actionable;
import appeng.api.util.DimensionalCoord;
@@ -58,6 +56,8 @@ import appeng.container.ContainerNull;
import appeng.core.AEConfig;
import appeng.hooks.IBlockTool;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
import appeng.mixins.TntAccessor;
import appeng.util.FakePlayer;
import appeng.util.InWorldToolOperationResult;
import appeng.util.Platform;
@@ -287,7 +287,8 @@ public class EntropyManipulatorItem extends AEBasePoweredItem implements IBlockT
for (final ItemStack i : stack) {
CraftingInventory tempInv = new CraftingInventory(new ContainerNull(), 1, 1);
tempInv.setStack(0, i);
Optional<SmeltingRecipe> recipe = w.getRecipeManager().getFirstMatch(RecipeType.SMELTING, tempInv, w);
Optional<SmeltingRecipe> recipe = w.getRecipeManager().getFirstMatch(RecipeType.SMELTING, tempInv,
w);
if (recipe.isPresent()) {
ItemStack result = recipe.get().craft(tempInv);
@@ -22,35 +22,36 @@ import java.util.List;
import javax.annotation.Nullable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.damage.EntityDamageSource;
import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.TypedActionResult;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.Util;
import net.minecraft.util.hit.BlockHitResult;
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.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.world.RayTraceContext;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.text.Text;
import net.minecraft.world.RayTraceContext;
import net.minecraft.world.World;
import net.fabricmc.api.Environment;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@@ -116,7 +117,8 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
}
final ICellInventoryHandler<IAEItemStack> inv = Api.instance().registries().cell().getCellInventory(
p.getStackInHand(hand), null, Api.instance().storage().getStorageChannel(IItemStorageChannel.class));
p.getStackInHand(hand), null,
Api.instance().storage().getStorageChannel(IItemStorageChannel.class));
if (inv != null) {
final IItemList<IAEItemStack> itemList = inv.getAvailableItems(
Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
@@ -177,9 +179,9 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
private void shootPaintBalls(final ItemStack type, final World w, final PlayerEntity p, final Vec3d Vec3d,
final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2) {
final Box bb = new Box(Math.min(Vec3d.x, Vec3d1.x), Math.min(Vec3d.y, Vec3d1.y),
Math.min(Vec3d.z, Vec3d1.z), Math.max(Vec3d.x, Vec3d1.x), Math.max(Vec3d.y, Vec3d1.y),
Math.max(Vec3d.z, Vec3d1.z)).expand(16, 16, 16);
final Box bb = new Box(Math.min(Vec3d.x, Vec3d1.x), Math.min(Vec3d.y, Vec3d1.y), Math.min(Vec3d.z, Vec3d1.z),
Math.max(Vec3d.x, Vec3d1.x), Math.max(Vec3d.y, Vec3d1.y), Math.max(Vec3d.z, Vec3d1.z)).expand(16, 16,
16);
Entity entity = null;
Vec3d entityIntersection = null;
@@ -217,18 +219,16 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
HitResult pos = w.rayTrace(rayTraceContext);
final Vec3d vec = new Vec3d(d0, d1, d2);
if (entity != null && pos.getType() != HitResult.Type.MISS
&& pos.getPos().squaredDistanceTo(vec) > closest) {
if (entity != null && pos.getType() != HitResult.Type.MISS && pos.getPos().squaredDistanceTo(vec) > closest) {
pos = new EntityHitResult(entity, entityIntersection);
} else if (entity != null && pos.getType() == HitResult.Type.MISS) {
pos = new EntityHitResult(entity, entityIntersection);
}
try {
AppEng.instance().sendToAllNearExcept(null, d0, d1, d2, 128, w,
new MatterCannonPacket(d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z,
(byte) (pos.getType() == HitResult.Type.MISS ? 32
: pos.getPos().squaredDistanceTo(vec) + 1)));
AppEng.instance().sendToAllNearExcept(null, d0, d1, d2, 128, w, new MatterCannonPacket(d0, d1, d2,
(float) direction.x, (float) direction.y, (float) direction.z,
(byte) (pos.getType() == HitResult.Type.MISS ? 32 : pos.getPos().squaredDistanceTo(vec) + 1)));
} catch (final Exception err) {
AELog.debug(err);
}
@@ -334,10 +334,9 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
}
try {
AppEng.instance().sendToAllNearExcept(null, d0, d1, d2, 128, w,
new MatterCannonPacket(d0, d1, d2, (float) direction.x, (float) direction.y,
(float) direction.z, (byte) (pos.getType() == HitResult.Type.MISS ? 32
: pos.getPos().squaredDistanceTo(vec) + 1)));
AppEng.instance().sendToAllNearExcept(null, d0, d1, d2, 128, w, new MatterCannonPacket(d0, d1, d2,
(float) direction.x, (float) direction.y, (float) direction.z,
(byte) (pos.getType() == HitResult.Type.MISS ? 32 : pos.getPos().squaredDistanceTo(vec) + 1)));
} catch (final Exception err) {
AELog.debug(err);
}
@@ -20,18 +20,19 @@ package appeng.items.tools.powered;
import java.util.List;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.TypedActionResult;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.text.Text;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.FuzzyMode;
@@ -20,7 +20,6 @@ package appeng.items.tools.powered;
import java.util.List;
import appeng.api.config.*;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.item.TooltipContext;
@@ -28,14 +27,14 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.text.Text;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import appeng.core.Api;
import appeng.api.config.*;
import appeng.api.config.Actionable;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
@@ -22,16 +22,16 @@ import java.text.MessageFormat;
import java.util.List;
import java.util.function.DoubleSupplier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.text.Text;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
@@ -18,24 +18,24 @@
package appeng.items.tools.quartz;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.QuartzKnifeContainer;
import appeng.items.contents.QuartzKnifeObj;
import appeng.mixins.RemainderSetter;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.api.features.AEFeature;
import appeng.api.implementations.guiobjects.IGuiItem;
import appeng.api.implementations.guiobjects.IGuiItemObject;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.QuartzKnifeContainer;
import appeng.items.AEBaseItem;
import appeng.items.contents.QuartzKnifeObj;
import appeng.mixins.RemainderSetter;
import appeng.util.Platform;
public class QuartzCuttingKnifeItem extends AEBaseItem implements IGuiItem {
@@ -45,13 +45,13 @@ public class QuartzCuttingKnifeItem extends AEBaseItem implements IGuiItem {
super(props);
this.type = type;
// See below for reasoning
((RemainderSetter)this).setRecipeRemainder(this);
((RemainderSetter) this).setRecipeRemainder(this);
}
@Override
public TypedActionResult<ItemStack> use(final World w, final PlayerEntity p, final Hand hand) {
if (Platform.isServer()) {
ContainerOpener.openContainer(QuartzKnifeContainer.TYPE, p, ContainerLocator.forHand(p, hand));
ContainerOpener.openContainer(QuartzKnifeContainer.TYPE, p, ContainerLocator.forHand(p, hand));
}
p.swingHand(hand);
return new TypedActionResult<>(ActionResult.SUCCESS, p.getStackInHand(hand));
@@ -20,8 +20,8 @@ package appeng.items.tools.quartz;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterials;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterials;
import appeng.api.features.AEFeature;
import appeng.util.Platform;
@@ -20,8 +20,8 @@ package appeng.items.tools.quartz;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterials;
import net.minecraft.item.ShovelItem;
import net.minecraft.item.ToolMaterials;
import appeng.api.features.AEFeature;
import appeng.util.Platform;
@@ -20,8 +20,8 @@ package appeng.items.tools.quartz;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterials;
import net.minecraft.item.SwordItem;
import net.minecraft.item.ToolMaterials;
import appeng.api.features.AEFeature;
import appeng.util.Platform;
@@ -18,7 +18,6 @@
package appeng.items.tools.quartz;
import appeng.hooks.AEToolItem;
import net.minecraft.block.Block;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
@@ -30,6 +29,7 @@ import net.minecraft.util.math.BlockPos;
import appeng.api.implementations.items.IAEWrench;
import appeng.api.util.DimensionalCoord;
import appeng.block.AEBaseBlock;
import appeng.hooks.AEToolItem;
import appeng.items.AEBaseItem;
import appeng.util.Platform;