Fabric port in progress
This commit is contained in:
@@ -26,30 +26,30 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
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.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.fluids.container.FluidInterfaceContainer;
|
||||
import appeng.fluids.tile.FluidInterfaceTileEntity;
|
||||
import appeng.fluids.tile.FluidInterfaceBlockEntity;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class FluidInterfaceBlock extends AEBaseTileBlock<FluidInterfaceTileEntity> {
|
||||
public class FluidInterfaceBlock extends AEBaseTileBlock<FluidInterfaceBlockEntity> {
|
||||
public FluidInterfaceBlock() {
|
||||
super(defaultProps(Material.IRON));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand,
|
||||
final @Nullable ItemStack heldItem, final BlockRayTraceResult hit) {
|
||||
if (p.isCrouching()) {
|
||||
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
|
||||
if (p.isInSneakingPose()) {
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
||||
final BlockEntity tg = this.getTileEntity(w, pos);
|
||||
final BlockEntity tg = this.getBlockEntity(w, pos);
|
||||
if (tg != null) {
|
||||
if (Platform.isServer()) {
|
||||
ContainerOpener.openContainer(FluidInterfaceContainer.TYPE, p,
|
||||
|
||||
@@ -170,7 +170,7 @@ public class FluidTerminalScreen extends AEBaseMEScreen<FluidTerminalContainer>
|
||||
|
||||
final List<String> list = new ArrayList<>();
|
||||
|
||||
list.add(fluidStack.getFluidStack().getDisplayName().getFormattedText());
|
||||
list.add(fluidStack.getFluidStack().getName().getFormattedText());
|
||||
list.add(formattedAmount);
|
||||
list.add(modName);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.Collections;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -35,7 +35,7 @@ public class FluidSlotWidget extends CustomSlotWidget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawContent(final Minecraft mc, final int mouseX, final int mouseY, final float partialTicks) {
|
||||
public void drawContent(final MinecraftClient mc, final int mouseX, final int mouseY, final float partialTicks) {
|
||||
final IAEFluidStack fs = this.getFluidStack();
|
||||
if (fs != null) {
|
||||
RenderSystem.disableBlend();
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.fluids.client.gui.widgets;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -62,7 +62,7 @@ public class FluidTankWidget extends Widget implements ITooltip {
|
||||
float blue = (attributes.getColor() & 255) / 255.0F;
|
||||
RenderSystem.color3f(red, green, blue);
|
||||
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
MinecraftClient mc = MinecraftClient.getInstance();
|
||||
mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
final TextureAtlasSprite sprite = mc.getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE)
|
||||
.apply(attributes.getStillTexture(fluidStack.getFluidStack()));
|
||||
@@ -88,7 +88,7 @@ public class FluidTankWidget extends Widget implements ITooltip {
|
||||
public String getMessage() {
|
||||
final IAEFluidStack fluid = this.tank.getFluidInSlot(this.slot);
|
||||
if (fluid != null && fluid.getStackSize() > 0) {
|
||||
String desc = fluid.getFluid().getAttributes().getDisplayName(fluid.getFluidStack()).getFormattedText();
|
||||
String desc = fluid.getFluid().getAttributes().getName(fluid.getFluidStack()).getFormattedText();
|
||||
String amountToText = fluid.getStackSize() + "mB";
|
||||
|
||||
return desc + "\n" + amountToText;
|
||||
|
||||
@@ -26,7 +26,7 @@ import javax.annotation.Nonnull;
|
||||
import alexiil.mc.lib.attributes.fluid.volume.FluidVolume;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.inventory.container.IContainerListener;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -358,7 +358,7 @@ public class FluidTerminalContainer extends AEBaseContainer
|
||||
|
||||
if (used != canFill) {
|
||||
AELog.error("Fluid item [%s] reported a different possible amount than it actually accepted.",
|
||||
held.getDisplayName());
|
||||
held.getName());
|
||||
}
|
||||
|
||||
player.inventory.setItemStack(fh.getContainer());
|
||||
@@ -394,7 +394,7 @@ public class FluidTerminalContainer extends AEBaseContainer
|
||||
|
||||
if (notInserted != null && notInserted.getStackSize() > 0) {
|
||||
AELog.error("Fluid item [%s] reported a different possible amount to drain than it actually provided.",
|
||||
held.getDisplayName());
|
||||
held.getName());
|
||||
}
|
||||
|
||||
player.inventory.setItemStack(fh.getContainer());
|
||||
|
||||
@@ -176,7 +176,7 @@ public class DualityFluidInterface
|
||||
}
|
||||
}
|
||||
|
||||
final BlockEntity te = this.iHost.getTileEntity();
|
||||
final BlockEntity te = this.iHost.getBlockEntity();
|
||||
if (te != null && te.getWorld() != null) {
|
||||
Platform.notifyBlocksOfNeighbors(te.getWorld(), te.getPos());
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public class DualityFluidInterface
|
||||
}
|
||||
|
||||
public DimensionalCoord getLocation() {
|
||||
return new DimensionalCoord(this.iHost.getTileEntity());
|
||||
return new DimensionalCoord(this.iHost.getBlockEntity());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.container.IContainerListener;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface IFluidInterfaceHost extends IActionHost, IGridProxyable, IUpgra
|
||||
|
||||
EnumSet<Direction> getTargets();
|
||||
|
||||
BlockEntity getTileEntity();
|
||||
BlockEntity getBlockEntity();
|
||||
|
||||
void saveChanges();
|
||||
}
|
||||
|
||||
@@ -93,19 +93,19 @@ public class FluidAnnihilationPlanePart extends BasicStatePart implements IGridT
|
||||
final Direction e = bch.getWorldX();
|
||||
final Direction u = bch.getWorldY();
|
||||
|
||||
if (this.isAnnihilationPlane(te.getWorld().getTileEntity(pos.offset(e.getOpposite())), this.getSide())) {
|
||||
if (this.isAnnihilationPlane(te.getWorld().getBlockEntity(pos.offset(e.getOpposite())), this.getSide())) {
|
||||
minX = 0;
|
||||
}
|
||||
|
||||
if (this.isAnnihilationPlane(te.getWorld().getTileEntity(pos.offset(e)), this.getSide())) {
|
||||
if (this.isAnnihilationPlane(te.getWorld().getBlockEntity(pos.offset(e)), this.getSide())) {
|
||||
maxX = 16;
|
||||
}
|
||||
|
||||
if (this.isAnnihilationPlane(te.getWorld().getTileEntity(pos.offset(u.getOpposite())), this.getSide())) {
|
||||
if (this.isAnnihilationPlane(te.getWorld().getBlockEntity(pos.offset(u.getOpposite())), this.getSide())) {
|
||||
minY = 0;
|
||||
}
|
||||
|
||||
if (this.isAnnihilationPlane(te.getWorld().getTileEntity(pos.offset(e)), this.getSide())) {
|
||||
if (this.isAnnihilationPlane(te.getWorld().getBlockEntity(pos.offset(e)), this.getSide())) {
|
||||
maxY = 16;
|
||||
}
|
||||
}
|
||||
@@ -156,21 +156,21 @@ public class FluidAnnihilationPlanePart extends BasicStatePart implements IGridT
|
||||
|
||||
final BlockPos pos = te.getPos();
|
||||
|
||||
if (this.isAnnihilationPlane(te.getWorld().getTileEntity(pos.offset(facingRight.getOpposite())),
|
||||
if (this.isAnnihilationPlane(te.getWorld().getBlockEntity(pos.offset(facingRight.getOpposite())),
|
||||
this.getSide())) {
|
||||
left = true;
|
||||
}
|
||||
|
||||
if (this.isAnnihilationPlane(te.getWorld().getTileEntity(pos.offset(facingRight)), this.getSide())) {
|
||||
if (this.isAnnihilationPlane(te.getWorld().getBlockEntity(pos.offset(facingRight)), this.getSide())) {
|
||||
right = true;
|
||||
}
|
||||
|
||||
if (this.isAnnihilationPlane(te.getWorld().getTileEntity(pos.offset(facingUp.getOpposite())),
|
||||
if (this.isAnnihilationPlane(te.getWorld().getBlockEntity(pos.offset(facingUp.getOpposite())),
|
||||
this.getSide())) {
|
||||
down = true;
|
||||
}
|
||||
|
||||
if (this.isAnnihilationPlane(te.getWorld().getTileEntity(pos.offset(facingUp)), this.getSide())) {
|
||||
if (this.isAnnihilationPlane(te.getWorld().getBlockEntity(pos.offset(facingUp)), this.getSide())) {
|
||||
up = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class FluidInterfacePart extends BasicStatePart
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity getTileEntity() {
|
||||
public BlockEntity getBlockEntity() {
|
||||
return super.getHost().getTile();
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ public class FluidStorageBusPart extends SharedStorageBusPart
|
||||
@Override
|
||||
protected void resetCache(final boolean fullReset) {
|
||||
if (this.getHost() == null || this.getHost().getTile() == null || this.getHost().getTile().getWorld() == null
|
||||
|| this.getHost().getTile().getWorld().isRemote) {
|
||||
|| this.getHost().getTile().getWorld().isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ public class FluidStorageBusPart extends SharedStorageBusPart
|
||||
|
||||
this.cached = true;
|
||||
final BlockEntity self = this.getHost().getTile();
|
||||
final BlockEntity target = self.getWorld().getTileEntity(self.getPos().offset(this.getSide().getFacing()));
|
||||
final BlockEntity target = self.getWorld().getBlockEntity(self.getPos().offset(this.getSide().getFacing()));
|
||||
final int newHandlerHash = this.createHandlerHash(target);
|
||||
|
||||
if (newHandlerHash != 0 && newHandlerHash == this.handlerHash) {
|
||||
@@ -357,10 +357,10 @@ public class FluidStorageBusPart extends SharedStorageBusPart
|
||||
}
|
||||
|
||||
if (achievement != null && achievement.getActionableNode() != null) {
|
||||
// Platform.addStat( achievement.getActionableNode().getPlayerID(),
|
||||
// Platform.increaseStat( achievement.getActionableNode().getPlayerID(),
|
||||
// Achievements.Recursive.getAchievement()
|
||||
// );
|
||||
// Platform.addStat( getActionableNode().getPlayerID(),
|
||||
// Platform.increaseStat( getActionableNode().getPlayerID(),
|
||||
// Achievements.Recursive.getAchievement() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,14 +107,14 @@ public abstract class SharedFluidBusPart extends UpgradeablePart implements IGri
|
||||
|
||||
protected BlockEntity getConnectedTE() {
|
||||
BlockEntity self = this.getHost().getTile();
|
||||
return this.getTileEntity(self, self.getPos().offset(this.getSide().getFacing()));
|
||||
return this.getBlockEntity(self, self.getPos().offset(this.getSide().getFacing()));
|
||||
}
|
||||
|
||||
private BlockEntity getTileEntity(final BlockEntity self, final BlockPos pos) {
|
||||
private BlockEntity getBlockEntity(final BlockEntity self, final BlockPos pos) {
|
||||
final World w = self.getWorld();
|
||||
|
||||
if (w.getChunkProvider().isChunkLoaded(new ChunkPos(pos))) {
|
||||
return w.getTileEntity(pos);
|
||||
return w.getBlockEntity(pos);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
+9
-8
@@ -23,6 +23,7 @@ import java.util.EnumSet;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@@ -49,13 +50,13 @@ import appeng.fluids.container.FluidInterfaceContainer;
|
||||
import appeng.fluids.helper.DualityFluidInterface;
|
||||
import appeng.fluids.helper.IFluidInterfaceHost;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.tile.grid.AENetworkTileEntity;
|
||||
import appeng.tile.grid.AENetworkBlockEntity;
|
||||
|
||||
public class FluidInterfaceTileEntity extends AENetworkTileEntity
|
||||
public class FluidInterfaceBlockEntity extends AENetworkBlockEntity
|
||||
implements IGridTickable, IFluidInterfaceHost, IPriorityHost {
|
||||
private final DualityFluidInterface duality = new DualityFluidInterface(this.getProxy(), this);
|
||||
|
||||
public FluidInterfaceTileEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
public FluidInterfaceBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ public class FluidInterfaceTileEntity extends AENetworkTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity getTileEntity() {
|
||||
public BlockEntity getBlockEntity() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -95,15 +96,15 @@ public class FluidInterfaceTileEntity extends AENetworkTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag write(final CompoundTag data) {
|
||||
super.write(data);
|
||||
public CompoundTag toTag(final CompoundTag data) {
|
||||
super.toTag(data);
|
||||
this.duality.writeToNBT(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(final CompoundTag data) {
|
||||
super.read(data);
|
||||
public void fromTag(BlockState state, final CompoundTag data) {
|
||||
super.fromTag(state, data);
|
||||
this.duality.readFromNBT(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user