Added spotless back and reformatted
This commit is contained in:
@@ -25,26 +25,27 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.crash.CrashReportSection;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.crash.CrashReportSection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class BusCollisionHelper implements IPartCollisionHelper {
|
||||
private final boolean isVisual;
|
||||
|
||||
public BusCollisionHelper(final List<Box> boxes, final Direction x, final Direction y, final Direction z,
|
||||
final boolean visual) {
|
||||
final boolean visual) {
|
||||
this.boxes = boxes;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
@@ -38,10 +38,10 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
@@ -845,8 +845,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
|
||||
String defKey = "def:" + side.ordinal();
|
||||
String extraKey = "extra:" + side.ordinal();
|
||||
if (data.contains(defKey, NbtType.COMPOUND)
|
||||
&& data.contains(extraKey, NbtType.COMPOUND)) {
|
||||
if (data.contains(defKey, NbtType.COMPOUND) && data.contains(extraKey, NbtType.COMPOUND)) {
|
||||
final CompoundTag def = data.getCompound(defKey);
|
||||
final CompoundTag extra = data.getCompound(extraKey);
|
||||
IPart p = this.getPart(side);
|
||||
|
||||
@@ -21,16 +21,16 @@ package appeng.parts;
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.util.AEColor;
|
||||
|
||||
@@ -23,9 +23,9 @@ import java.util.Random;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -18,18 +18,9 @@
|
||||
|
||||
package appeng.parts;
|
||||
|
||||
import appeng.core.Api;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.parts.*;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PartPlacementPacket;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.util.LookDirection;
|
||||
import appeng.util.Platform;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -49,8 +40,17 @@ import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.RayTraceContext;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.parts.*;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PartPlacementPacket;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.util.LookDirection;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class PartPlacement {
|
||||
|
||||
@@ -58,14 +58,14 @@ public class PartPlacement {
|
||||
private static final ThreadLocal<Object> placing = new ThreadLocal<>();
|
||||
private static boolean wasCanceled = false;
|
||||
|
||||
static {
|
||||
static {
|
||||
|
||||
UseBlockCallback.EVENT.register(PartPlacement::onPlayerUseBlock);
|
||||
|
||||
}
|
||||
|
||||
public static ActionResult place(final ItemStack held, final BlockPos pos, Direction side,
|
||||
final PlayerEntity player, final Hand hand, final World world, PlaceType pass, final int depth) {
|
||||
final PlayerEntity player, final Hand hand, final World world, PlaceType pass, final int depth) {
|
||||
if (depth > 3) {
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
@@ -150,8 +150,7 @@ public class PartPlacement {
|
||||
if (!player.isCreative()) {
|
||||
held.increment(-1);
|
||||
if (held.getCount() == 0) {
|
||||
player.inventory.main.set(player.inventory.selectedSlot,
|
||||
ItemStack.EMPTY);
|
||||
player.inventory.main.set(player.inventory.selectedSlot, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
return ActionResult.CONSUME;
|
||||
@@ -171,8 +170,7 @@ public class PartPlacement {
|
||||
if (held.isEmpty()) {
|
||||
if (host != null && player.isInSneakingPose() && world.isAir(pos)) {
|
||||
if (mop.getType() == HitResult.Type.BLOCK) {
|
||||
Vec3d hitVec = mop.getPos().add(-mop.getPos().getX(), -mop.getPos().getY(),
|
||||
-mop.getPos().getZ());
|
||||
Vec3d hitVec = mop.getPos().add(-mop.getPos().getX(), -mop.getPos().getY(), -mop.getPos().getZ());
|
||||
final SelectedPart sPart = selectPart(player, host, hitVec);
|
||||
if (sPart != null && sPart.part != null) {
|
||||
if (sPart.part.onShiftActivate(player, hand, hitVec)) {
|
||||
@@ -228,8 +226,7 @@ public class PartPlacement {
|
||||
|
||||
// FIXME: This is super-fishy and all needs to be re-checked. what does this
|
||||
// even do???
|
||||
if (hostIsNotPresent && canMultiPartBePlaced
|
||||
&& multiPartBlockItem.place(mpUseCtx).isAccepted()) {
|
||||
if (hostIsNotPresent && canMultiPartBePlaced && multiPartBlockItem.place(mpUseCtx).isAccepted()) {
|
||||
if (!world.isClient) {
|
||||
tile = world.getBlockEntity(te_pos);
|
||||
|
||||
@@ -351,8 +348,8 @@ public class PartPlacement {
|
||||
placing.set(true);
|
||||
|
||||
final ItemStack held = player.getStackInHand(hand);
|
||||
if (place(held, hit.getBlockPos(), hit.getSide(), player, hand,
|
||||
player.world, PlaceType.INTERACT_FIRST_PASS, 0) == ActionResult.SUCCESS) {
|
||||
if (place(held, hit.getBlockPos(), hit.getSide(), player, hand, player.world, PlaceType.INTERACT_FIRST_PASS,
|
||||
0) == ActionResult.SUCCESS) {
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
|
||||
package appeng.parts.automation;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.util.FakePlayer;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -38,16 +37,16 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ToolMaterials;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.tag.ItemTags;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
@@ -79,14 +78,14 @@ import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.helpers.MachineSource;
|
||||
import appeng.parts.BasicStatePart;
|
||||
import appeng.util.FakePlayer;
|
||||
import appeng.util.IWorldCallable;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public class AnnihilationPlanePart extends BasicStatePart implements IGridTickable, IWorldCallable<TickRateModulation> {
|
||||
|
||||
public static final Identifier TAG_BLACKLIST = new Identifier(AppEng.MOD_ID,
|
||||
"blacklisted/annihilation_plane");
|
||||
public static final Identifier TAG_BLACKLIST = new Identifier(AppEng.MOD_ID, "blacklisted/annihilation_plane");
|
||||
|
||||
private static final PlaneModels MODELS = new PlaneModels("part/annihilation_plane", "part/annihilation_plane_on");
|
||||
|
||||
@@ -258,8 +257,7 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
|
||||
if (entity.getX() > pos.getX() && entity.getX() < pos.getX() + 1) {
|
||||
if (posYMiddle > pos.getY() && posYMiddle < pos.getY() + 1) {
|
||||
if ((entity.getZ() > pos.getZ() + 0.9 && this.getSide() == AEPartLocation.SOUTH)
|
||||
|| (entity.getZ() < pos.getZ() + 0.1
|
||||
&& this.getSide() == AEPartLocation.NORTH)) {
|
||||
|| (entity.getZ() < pos.getZ() + 0.1 && this.getSide() == AEPartLocation.NORTH)) {
|
||||
capture = true;
|
||||
}
|
||||
}
|
||||
@@ -286,8 +284,8 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
|
||||
|
||||
if (changed) {
|
||||
AppEng.instance().sendToAllNearExcept(null, pos.getX(), pos.getY(), pos.getZ(), 64,
|
||||
this.getTile().getWorld(), new ItemTransitionEffectPacket(entity.getX(),
|
||||
entity.getY(), entity.getZ(), this.getSide().getOpposite()));
|
||||
this.getTile().getWorld(), new ItemTransitionEffectPacket(entity.getX(), entity.getY(),
|
||||
entity.getZ(), this.getSide().getOpposite()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -598,11 +596,8 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
|
||||
return getConnections();
|
||||
}
|
||||
|
||||
private static final Item[] SUPPORTED_HARVEST_TOOLS = {
|
||||
Items.DIAMOND_AXE,
|
||||
Items.DIAMOND_PICKAXE,
|
||||
Items.DIAMOND_SHOVEL,
|
||||
};
|
||||
private static final Item[] SUPPORTED_HARVEST_TOOLS = { Items.DIAMOND_AXE, Items.DIAMOND_PICKAXE,
|
||||
Items.DIAMOND_SHOVEL, };
|
||||
|
||||
/**
|
||||
* Creates the fake (and temporary) tool that will be used to calculate the loot
|
||||
|
||||
@@ -18,7 +18,31 @@
|
||||
|
||||
package appeng.parts.automation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.networking.events.MENetworkCellArrayUpdate;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
@@ -47,27 +71,6 @@ import appeng.util.Platform;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import appeng.util.prioritylist.FuzzyPriorityList;
|
||||
import appeng.util.prioritylist.PrecisePriorityList;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack> {
|
||||
|
||||
@@ -124,7 +127,7 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
super.onChangeInventory(inv, slot, mc, removedStack, newStack);
|
||||
|
||||
if (inv == this.Config) {
|
||||
@@ -205,8 +208,8 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
|
||||
final BlockPos placePos = te.getPos().offset(side.getFacing());
|
||||
|
||||
if (w.getBlockState(placePos).getMaterial().isReplaceable()) {
|
||||
if (placeBlock == YesNo.YES && (i instanceof BlockItem
|
||||
|| i instanceof FireworkChargeItem || i instanceof FireworkItem || i instanceof IPartItem)) {
|
||||
if (placeBlock == YesNo.YES && (i instanceof BlockItem || i instanceof FireworkChargeItem
|
||||
|| i instanceof FireworkItem || i instanceof IPartItem)) {
|
||||
final PlayerEntity player = FakePlayer.getOrCreate((ServerWorld) w);
|
||||
Platform.configurePlayer(player, side, this.getTile());
|
||||
Hand hand = player.getActiveHand();
|
||||
@@ -225,8 +228,9 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
|
||||
|
||||
// Up or Down, Attempt 1??
|
||||
if (side.xOffset == 0 && side.zOffset == 0) {
|
||||
Worked = i.useOnBlock(new AutomaticItemPlacementContext(w, placePos.offset(side.getFacing()),
|
||||
lookDirection, is, side.getFacing())) == ActionResult.SUCCESS;
|
||||
Worked = i
|
||||
.useOnBlock(new AutomaticItemPlacementContext(w, placePos.offset(side.getFacing()),
|
||||
lookDirection, is, side.getFacing())) == ActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
// Up or Down, Attempt 2??
|
||||
@@ -282,12 +286,12 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
|
||||
|
||||
// FIXME FABRIC No custom item entity support
|
||||
// FIXME FABRIC if (is.getItem().hasCustomEntity(is)) {
|
||||
// FIXME FABRIC result = is.getItem().createEntity(w, ei, is);
|
||||
// FIXME FABRIC if (result != null) {
|
||||
// FIXME FABRIC ei.remove();
|
||||
// FIXME FABRIC } else {
|
||||
// FIXME FABRIC result = ei;
|
||||
// FIXME FABRIC }
|
||||
// FIXME FABRIC result = is.getItem().createEntity(w, ei, is);
|
||||
// FIXME FABRIC if (result != null) {
|
||||
// FIXME FABRIC ei.remove();
|
||||
// FIXME FABRIC } else {
|
||||
// FIXME FABRIC result = ei;
|
||||
// FIXME FABRIC }
|
||||
// FIXME FABRIC }
|
||||
|
||||
if (!w.spawnEntity(result)) {
|
||||
|
||||
@@ -29,9 +29,8 @@ import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
|
||||
@@ -48,7 +48,6 @@ import appeng.container.implementations.UpgradeableContainer;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.settings.TickRates;
|
||||
|
||||
import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.helpers.MachineSource;
|
||||
@@ -75,7 +74,6 @@ public class ImportBusPart extends SharedItemBusPart implements IInventoryDestin
|
||||
private int itemsToSend; // used in tickingRequest
|
||||
private boolean worked; // used in tickingRequest
|
||||
|
||||
|
||||
public ImportBusPart(final ItemStack is) {
|
||||
super(is);
|
||||
|
||||
|
||||
@@ -21,19 +21,20 @@ package appeng.parts.automation;
|
||||
import java.util.Collection;
|
||||
import java.util.Random;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.particle.DustParticleEffect;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.LevelType;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
@@ -85,17 +86,13 @@ public class LevelEmitterPart extends UpgradeablePart implements IEnergyWatcherH
|
||||
ICraftingWatcherHost, IMEMonitorHandlerReceiver<IAEItemStack>, ICraftingProvider {
|
||||
|
||||
@PartModels
|
||||
public static final Identifier MODEL_BASE_OFF = new Identifier(AppEng.MOD_ID,
|
||||
"part/level_emitter_base_off");
|
||||
public static final Identifier MODEL_BASE_OFF = new Identifier(AppEng.MOD_ID, "part/level_emitter_base_off");
|
||||
@PartModels
|
||||
public static final Identifier MODEL_BASE_ON = new Identifier(AppEng.MOD_ID,
|
||||
"part/level_emitter_base_on");
|
||||
public static final Identifier MODEL_BASE_ON = new Identifier(AppEng.MOD_ID, "part/level_emitter_base_on");
|
||||
@PartModels
|
||||
public static final Identifier MODEL_STATUS_OFF = new Identifier(AppEng.MOD_ID,
|
||||
"part/level_emitter_status_off");
|
||||
public static final Identifier MODEL_STATUS_OFF = new Identifier(AppEng.MOD_ID, "part/level_emitter_status_off");
|
||||
@PartModels
|
||||
public static final Identifier MODEL_STATUS_ON = new Identifier(AppEng.MOD_ID,
|
||||
"part/level_emitter_status_on");
|
||||
public static final Identifier MODEL_STATUS_ON = new Identifier(AppEng.MOD_ID, "part/level_emitter_status_on");
|
||||
@PartModels
|
||||
public static final Identifier MODEL_STATUS_HAS_CHANNEL = new Identifier(AppEng.MOD_ID,
|
||||
"part/level_emitter_status_has_channel");
|
||||
@@ -416,7 +413,7 @@ public class LevelEmitterPart extends UpgradeablePart implements IEnergyWatcherH
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
if (inv == this.config) {
|
||||
this.configureWatchers();
|
||||
}
|
||||
|
||||
@@ -18,8 +18,15 @@
|
||||
|
||||
package appeng.parts.automation;
|
||||
|
||||
import appeng.api.parts.IDynamicPartBakedModel;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
@@ -35,13 +42,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.api.parts.IDynamicPartBakedModel;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
|
||||
/**
|
||||
* Built-in model for annihilation planes that supports connected textures.
|
||||
@@ -84,7 +86,8 @@ public class PlaneBakedModel implements BakedModel, IDynamicPartBakedModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context, Direction partSide, @Nullable Object modelData) {
|
||||
public void emitQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier,
|
||||
RenderContext context, Direction partSide, @Nullable Object modelData) {
|
||||
PlaneConnections connections = DEFAULT_PERMUTATION;
|
||||
|
||||
if (modelData instanceof PlaneConnections) {
|
||||
|
||||
@@ -18,7 +18,11 @@
|
||||
|
||||
package appeng.parts.automation;
|
||||
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
@@ -27,9 +31,7 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
|
||||
/**
|
||||
* Built-in model for annihilation planes that supports connected textures.
|
||||
@@ -48,7 +50,8 @@ public class PlaneModel implements BasicUnbakedModel {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter,
|
||||
ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
Sprite frontSprite = textureGetter.apply(this.frontTexture);
|
||||
Sprite sidesSprite = textureGetter.apply(this.sidesTexture);
|
||||
Sprite backSprite = textureGetter.apply(this.backTexture);
|
||||
|
||||
@@ -34,10 +34,8 @@ import appeng.parts.PartModel;
|
||||
*/
|
||||
public class PlaneModels {
|
||||
|
||||
public static final Identifier MODEL_CHASSIS_OFF = new Identifier(AppEng.MOD_ID,
|
||||
"part/transition_plane_off");
|
||||
public static final Identifier MODEL_CHASSIS_ON = new Identifier(AppEng.MOD_ID,
|
||||
"part/transition_plane_on");
|
||||
public static final Identifier MODEL_CHASSIS_OFF = new Identifier(AppEng.MOD_ID, "part/transition_plane_off");
|
||||
public static final Identifier MODEL_CHASSIS_ON = new Identifier(AppEng.MOD_ID, "part/transition_plane_on");
|
||||
public static final Identifier MODEL_CHASSIS_HAS_CHANNEL = new Identifier(AppEng.MOD_ID,
|
||||
"part/transition_plane_has_channel");
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.RedstoneMode;
|
||||
|
||||
@@ -18,12 +18,13 @@
|
||||
|
||||
package appeng.parts.automation;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
@@ -137,7 +138,7 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
this.cached = false;
|
||||
if (this.parent != null && Platform.isServer()) {
|
||||
this.parent.onChangeInventory(inv, slot, mc, removedStack, newStack);
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.parts.automation;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.RedstoneMode;
|
||||
@@ -54,7 +55,7 @@ public abstract class UpgradeablePart extends BasicStatePart implements IAEAppEn
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
if (inv == this.upgrades) {
|
||||
this.upgradesChanged();
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@@ -21,21 +21,22 @@ package appeng.parts.misc;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -190,7 +191,7 @@ public class InterfacePart extends BasicStatePart implements IGridTickable, ISto
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
this.duality.onChangeInventory(inv, slot, mc, removedStack, newStack);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,7 @@ import appeng.parts.PartModel;
|
||||
|
||||
public class InvertedToggleBusPart extends ToggleBusPart {
|
||||
@PartModels
|
||||
public static final Identifier MODEL_BASE = new Identifier(AppEng.MOD_ID,
|
||||
"part/inverted_toggle_bus_base");
|
||||
public static final Identifier MODEL_BASE = new Identifier(AppEng.MOD_ID, "part/inverted_toggle_bus_base");
|
||||
|
||||
public static final PartModel MODELS_OFF = new PartModel(MODEL_BASE, MODEL_STATUS_OFF);
|
||||
public static final PartModel MODELS_ON = new PartModel(MODEL_BASE, MODEL_STATUS_ON);
|
||||
|
||||
@@ -25,9 +25,10 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
@@ -74,7 +75,8 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
// This uses a brute force approach and tries to jam it in every slot the
|
||||
// inventory exposes.
|
||||
for (int i = 0; i < slotCount && !remaining.isEmpty(); i++) {
|
||||
remaining = this.itemHandler.getSlot(i).attemptInsertion(remaining, simulate ? Simulation.SIMULATE : Simulation.ACTION);
|
||||
remaining = this.itemHandler.getSlot(i).attemptInsertion(remaining,
|
||||
simulate ? Simulation.SIMULATE : Simulation.ACTION);
|
||||
}
|
||||
|
||||
// At this point, we still have some items left...
|
||||
@@ -94,7 +96,8 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
return AEItemStack.fromItemStack(remaining);
|
||||
}
|
||||
|
||||
// FIXME FABRIC: this really needs to be rewritten to use the other interface types and not do slot iterations
|
||||
// FIXME FABRIC: this really needs to be rewritten to use the other interface
|
||||
// types and not do slot iterations
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, IActionSource src) {
|
||||
|
||||
@@ -122,7 +125,8 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
// maxSize, even if we request more. So even if it returns a valid stack, it
|
||||
// might have more stuff.
|
||||
do {
|
||||
extracted = this.itemHandler.getSlot(i).attemptAnyExtraction(remainingCurrentSlot, simulate ? Simulation.SIMULATE : Simulation.ACTION);
|
||||
extracted = this.itemHandler.getSlot(i).attemptAnyExtraction(remainingCurrentSlot,
|
||||
simulate ? Simulation.SIMULATE : Simulation.ACTION);
|
||||
if (!extracted.isEmpty()) {
|
||||
if (extracted.getCount() > remainingCurrentSlot) {
|
||||
// Something broke. It should never return more than we requested...
|
||||
|
||||
@@ -22,22 +22,22 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import alexiil.mc.lib.attributes.Attributes;
|
||||
import alexiil.mc.lib.attributes.item.ItemAttributes;
|
||||
import appeng.attributes.MEAttributes;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
import alexiil.mc.lib.attributes.Attributes;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import alexiil.mc.lib.attributes.item.ItemAttributes;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
@@ -73,6 +73,7 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.attributes.MEAttributes;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.StorageBusContainer;
|
||||
@@ -167,7 +168,7 @@ public class StorageBusPart extends UpgradeablePart
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
super.onChangeInventory(inv, slot, mc, removedStack, newStack);
|
||||
|
||||
if (inv == this.Config) {
|
||||
|
||||
@@ -20,10 +20,10 @@ package appeng.parts.misc;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -50,11 +50,9 @@ public class ToggleBusPart extends BasicStatePart {
|
||||
@PartModels
|
||||
public static final Identifier MODEL_BASE = new Identifier(AppEng.MOD_ID, "part/toggle_bus_base");
|
||||
@PartModels
|
||||
public static final Identifier MODEL_STATUS_OFF = new Identifier(AppEng.MOD_ID,
|
||||
"part/toggle_bus_status_off");
|
||||
public static final Identifier MODEL_STATUS_OFF = new Identifier(AppEng.MOD_ID, "part/toggle_bus_status_off");
|
||||
@PartModels
|
||||
public static final Identifier MODEL_STATUS_ON = new Identifier(AppEng.MOD_ID,
|
||||
"part/toggle_bus_status_on");
|
||||
public static final Identifier MODEL_STATUS_ON = new Identifier(AppEng.MOD_ID, "part/toggle_bus_status_on");
|
||||
@PartModels
|
||||
public static final Identifier MODEL_STATUS_HAS_CHANNEL = new Identifier(AppEng.MOD_ID,
|
||||
"part/toggle_bus_status_has_channel");
|
||||
|
||||
@@ -22,10 +22,10 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
|
||||
package appeng.parts.p2p;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import alexiil.mc.lib.attributes.fluid.FluidAttributes;
|
||||
@@ -26,14 +32,10 @@ import alexiil.mc.lib.attributes.fluid.FluidVolumeUtil;
|
||||
import alexiil.mc.lib.attributes.fluid.amount.FluidAmount;
|
||||
import alexiil.mc.lib.attributes.fluid.volume.FluidKey;
|
||||
import alexiil.mc.lib.attributes.fluid.volume.FluidVolume;
|
||||
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class FluidP2PTunnelPart extends P2PTunnelPart<FluidP2PTunnelPart> implements FluidInsertable {
|
||||
|
||||
@@ -141,16 +143,15 @@ public class FluidP2PTunnelPart extends P2PTunnelPart<FluidP2PTunnelPart> implem
|
||||
while (i.hasNext() && !remaining.isZero()) {
|
||||
final FluidP2PTunnelPart l = i.next();
|
||||
|
||||
FluidVolume insert = fluid.withAmount(
|
||||
fluid.amount().div(list.size())
|
||||
);
|
||||
FluidVolume insert = fluid.withAmount(fluid.amount().div(list.size()));
|
||||
if (insert.amount().isGreaterThan(remaining)) {
|
||||
insert = insert.withAmount(remaining);
|
||||
}
|
||||
|
||||
FluidInsertable tank = l.getTarget();
|
||||
if (tank != null) {
|
||||
remaining = remaining.sub(insert.amount().sub(tank.attemptInsertion(insert, Simulation.ACTION).amount()));
|
||||
remaining = remaining
|
||||
.sub(insert.amount().sub(tank.attemptInsertion(insert, Simulation.ACTION).amount()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +199,8 @@ public class FluidP2PTunnelPart extends P2PTunnelPart<FluidP2PTunnelPart> implem
|
||||
return this.cachedTank;
|
||||
}
|
||||
|
||||
return this.cachedTank = FluidAttributes.INSERTABLE.getFirstOrNullFromNeighbour(this.getTile(), this.getSide().getFacing());
|
||||
return this.cachedTank = FluidAttributes.INSERTABLE.getFirstOrNullFromNeighbour(this.getTile(),
|
||||
this.getSide().getFacing());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,11 +18,20 @@
|
||||
|
||||
package appeng.parts.p2p;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import alexiil.mc.lib.attributes.CacheInfo;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import alexiil.mc.lib.attributes.item.ItemAttributes;
|
||||
import alexiil.mc.lib.attributes.item.impl.CombinedFixedItemInv;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.events.MENetworkBootingStatusChange;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
@@ -37,13 +46,6 @@ import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.helpers.TunnelCollection;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemP2PTunnelPart extends P2PTunnelPart<ItemP2PTunnelPart> implements IGridTickable {
|
||||
private static final float POWER_DRAIN = 2.0f;
|
||||
@@ -111,10 +113,7 @@ public class ItemP2PTunnelPart extends P2PTunnelPart<ItemP2PTunnelPart> implemen
|
||||
this.partVisited = true;
|
||||
if (this.getProxy().isActive()) {
|
||||
final Direction facing = this.getSide().getFacing();
|
||||
ret = ItemAttributes.FIXED_INV.getFirstOrNullFromNeighbour(
|
||||
this.getTile(),
|
||||
facing
|
||||
);
|
||||
ret = ItemAttributes.FIXED_INV.getFirstOrNullFromNeighbour(this.getTile(), facing);
|
||||
}
|
||||
this.partVisited = false;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ package appeng.parts.p2p;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -23,10 +23,10 @@ import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
import appeng.api.exceptions.FailedConnectionException;
|
||||
|
||||
@@ -32,14 +32,11 @@ import appeng.parts.PartModel;
|
||||
*/
|
||||
class P2PModels {
|
||||
|
||||
public static final Identifier MODEL_STATUS_OFF = new Identifier(AppEng.MOD_ID,
|
||||
"part/p2p/p2p_tunnel_status_off");
|
||||
public static final Identifier MODEL_STATUS_ON = new Identifier(AppEng.MOD_ID,
|
||||
"part/p2p/p2p_tunnel_status_on");
|
||||
public static final Identifier MODEL_STATUS_OFF = new Identifier(AppEng.MOD_ID, "part/p2p/p2p_tunnel_status_off");
|
||||
public static final Identifier MODEL_STATUS_ON = new Identifier(AppEng.MOD_ID, "part/p2p/p2p_tunnel_status_on");
|
||||
public static final Identifier MODEL_STATUS_HAS_CHANNEL = new Identifier(AppEng.MOD_ID,
|
||||
"part/p2p/p2p_tunnel_status_has_channel");
|
||||
public static final Identifier MODEL_FREQUENCY = new Identifier(AppEng.MOD_ID,
|
||||
"part/p2p/p2p_tunnel_frequency");
|
||||
public static final Identifier MODEL_FREQUENCY = new Identifier(AppEng.MOD_ID, "part/p2p/p2p_tunnel_frequency");
|
||||
|
||||
private final IPartModel modelsOff;
|
||||
private final IPartModel modelsOn;
|
||||
|
||||
@@ -30,7 +30,6 @@ import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.PowerUnits;
|
||||
|
||||
@@ -25,8 +25,8 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.RedstoneWireBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -141,7 +141,8 @@ public class RedstoneP2PTunnelPart extends P2PTunnelPart<RedstoneP2PTunnelPart>
|
||||
}
|
||||
|
||||
this.power = b.getWeakRedstonePower(state, this.getTile().getWorld(), target, srcSide);
|
||||
this.power = Math.max(this.power, b.getWeakRedstonePower(state, this.getTile().getWorld(), target, srcSide));
|
||||
this.power = Math.max(this.power,
|
||||
b.getWeakRedstonePower(state, this.getTile().getWorld(), target, srcSide));
|
||||
this.sendToOutput(this.power);
|
||||
} else {
|
||||
this.sendToOutput(0);
|
||||
|
||||
@@ -44,11 +44,9 @@ public abstract class AbstractDisplayPart extends AbstractReportingPart {
|
||||
|
||||
// Models that contain the status indicator light
|
||||
@PartModels
|
||||
protected static final Identifier MODEL_STATUS_OFF = new Identifier(AppEng.MOD_ID,
|
||||
"part/display_status_off");
|
||||
protected static final Identifier MODEL_STATUS_OFF = new Identifier(AppEng.MOD_ID, "part/display_status_off");
|
||||
@PartModels
|
||||
protected static final Identifier MODEL_STATUS_ON = new Identifier(AppEng.MOD_ID,
|
||||
"part/display_status_on");
|
||||
protected static final Identifier MODEL_STATUS_ON = new Identifier(AppEng.MOD_ID, "part/display_status_on");
|
||||
@PartModels
|
||||
protected static final Identifier MODEL_STATUS_HAS_CHANNEL = new Identifier(AppEng.MOD_ID,
|
||||
"part/display_status_has_channel");
|
||||
|
||||
@@ -20,20 +20,19 @@ package appeng.parts.reporting;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.implementations.parts.IStorageMonitorPart;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
@@ -49,7 +48,6 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.render.TesrRenderHelper;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.util.IWideReadableNumberConverter;
|
||||
import appeng.util.Platform;
|
||||
@@ -77,7 +75,6 @@ public abstract class AbstractMonitorPart extends AbstractDisplayPart
|
||||
private boolean isLocked;
|
||||
private IStackWatcher myWatcher;
|
||||
|
||||
|
||||
public AbstractMonitorPart(final ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
@@ -179,7 +176,8 @@ public abstract class AbstractMonitorPart extends AbstractDisplayPart
|
||||
|
||||
if (player.getStackInHand(hand).isEmpty()) {
|
||||
this.isLocked = !this.isLocked;
|
||||
player.sendSystemMessage((this.isLocked ? PlayerMessages.isNowLocked : PlayerMessages.isNowUnlocked).get(), Util.NIL_UUID);
|
||||
player.sendSystemMessage((this.isLocked ? PlayerMessages.isNowLocked : PlayerMessages.isNowUnlocked).get(),
|
||||
Util.NIL_UUID);
|
||||
this.getHost().markForSave();
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ package appeng.parts.reporting;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
@@ -20,12 +20,14 @@ package appeng.parts.reporting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortDir;
|
||||
@@ -46,7 +48,6 @@ import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
/**
|
||||
* Anything resembling an network terminal with view cells can reuse this.
|
||||
@@ -139,7 +140,7 @@ public abstract class AbstractTerminalPart extends AbstractDisplayPart
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
this.getHost().markForSave();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,16 +21,17 @@ package appeng.parts.reporting;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import alexiil.mc.lib.attributes.item.SingleItemSlot;
|
||||
import alexiil.mc.lib.attributes.item.compat.FixedInventoryVanillaWrapper;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import alexiil.mc.lib.attributes.item.SingleItemSlot;
|
||||
import alexiil.mc.lib.attributes.item.compat.FixedInventoryVanillaWrapper;
|
||||
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.parts.IPartModel;
|
||||
@@ -57,8 +58,7 @@ public class ConversionMonitorPart extends AbstractMonitorPart {
|
||||
public static final Identifier MODEL_LOCKED_OFF = new Identifier(AppEng.MOD_ID,
|
||||
"part/conversion_monitor_locked_off");
|
||||
@PartModels
|
||||
public static final Identifier MODEL_LOCKED_ON = new Identifier(AppEng.MOD_ID,
|
||||
"part/conversion_monitor_locked_on");
|
||||
public static final Identifier MODEL_LOCKED_ON = new Identifier(AppEng.MOD_ID, "part/conversion_monitor_locked_on");
|
||||
|
||||
public static final IPartModel MODELS_OFF = new PartModel(MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF);
|
||||
public static final IPartModel MODELS_ON = new PartModel(MODEL_BASE, MODEL_ON, MODEL_STATUS_ON);
|
||||
@@ -68,7 +68,6 @@ public class ConversionMonitorPart extends AbstractMonitorPart {
|
||||
public static final IPartModel MODELS_LOCKED_HAS_CHANNEL = new PartModel(MODEL_BASE, MODEL_LOCKED_ON,
|
||||
MODEL_STATUS_HAS_CHANNEL);
|
||||
|
||||
|
||||
public ConversionMonitorPart(final ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
@@ -164,7 +163,8 @@ public class ConversionMonitorPart extends AbstractMonitorPart {
|
||||
final ItemStack targetStack = inv.getInvStack(x);
|
||||
if (input.equals(targetStack)) {
|
||||
SingleItemSlot slot = inv.getSlot(x);
|
||||
final ItemStack canExtract = slot.attemptAnyExtraction(targetStack.getCount(), Simulation.SIMULATE);
|
||||
final ItemStack canExtract = slot.attemptAnyExtraction(targetStack.getCount(),
|
||||
Simulation.SIMULATE);
|
||||
if (!canExtract.isEmpty()) {
|
||||
input.setStackSize(canExtract.getCount());
|
||||
final IAEItemStack failedToInsert = Platform.poweredInsert(energy, cell, input,
|
||||
@@ -179,7 +179,8 @@ public class ConversionMonitorPart extends AbstractMonitorPart {
|
||||
final IAEItemStack input = AEItemStack.fromItemStack(player.getStackInHand(hand));
|
||||
final IAEItemStack failedToInsert = Platform.poweredInsert(energy, cell, input,
|
||||
new PlayerSource(player, this));
|
||||
player.setStackInHand(hand, failedToInsert == null ? ItemStack.EMPTY : failedToInsert.createItemStack());
|
||||
player.setStackInHand(hand,
|
||||
failedToInsert == null ? ItemStack.EMPTY : failedToInsert.createItemStack());
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
|
||||
@@ -20,13 +20,14 @@ package appeng.parts.reporting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.container.implementations.CraftingTermContainer;
|
||||
|
||||
@@ -21,10 +21,11 @@ package appeng.parts.reporting;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
@@ -102,7 +103,7 @@ public class PatternTerminalPart extends AbstractTerminalPart {
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final FixedItemInv inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
if (inv == this.pattern && slot == 1) {
|
||||
final ItemStack is = this.pattern.getInvStack(1);
|
||||
final ICraftingPatternDetails details = Api.instance().crafting().decodePattern(is,
|
||||
|
||||
@@ -23,7 +23,6 @@ import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
import appeng.items.parts.PartModels;
|
||||
import appeng.parts.PartModel;
|
||||
|
||||
@@ -40,11 +39,9 @@ public class StorageMonitorPart extends AbstractMonitorPart {
|
||||
@PartModels
|
||||
public static final Identifier MODEL_ON = new Identifier(AppEng.MOD_ID, "part/storage_monitor_on");
|
||||
@PartModels
|
||||
public static final Identifier MODEL_LOCKED_OFF = new Identifier(AppEng.MOD_ID,
|
||||
"part/storage_monitor_locked_off");
|
||||
public static final Identifier MODEL_LOCKED_OFF = new Identifier(AppEng.MOD_ID, "part/storage_monitor_locked_off");
|
||||
@PartModels
|
||||
public static final Identifier MODEL_LOCKED_ON = new Identifier(AppEng.MOD_ID,
|
||||
"part/storage_monitor_locked_on");
|
||||
public static final Identifier MODEL_LOCKED_ON = new Identifier(AppEng.MOD_ID, "part/storage_monitor_locked_on");
|
||||
|
||||
public static final IPartModel MODELS_OFF = new PartModel(MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF);
|
||||
public static final IPartModel MODELS_ON = new PartModel(MODEL_BASE, MODEL_ON, MODEL_STATUS_ON);
|
||||
@@ -55,7 +52,6 @@ public class StorageMonitorPart extends AbstractMonitorPart {
|
||||
public static final IPartModel MODELS_LOCKED_HAS_CHANNEL = new PartModel(MODEL_BASE, MODEL_LOCKED_ON,
|
||||
MODEL_STATUS_HAS_CHANNEL);
|
||||
|
||||
|
||||
public StorageMonitorPart(final ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user