Fabric port in progress
This commit is contained in:
@@ -25,6 +25,7 @@ import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.model.AEModelData;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.IStackSrc;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
@@ -35,6 +36,7 @@ import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
||||
import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachmentBlockEntity;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
@@ -56,7 +58,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AEBaseBlockEntity extends BlockEntity implements IOrientable, ICommonTile, ICustomNameObject, BlockEntityClientSerializable {
|
||||
public class AEBaseBlockEntity extends BlockEntity implements IOrientable, ICommonTile, ICustomNameObject, BlockEntityClientSerializable, RenderAttachmentBlockEntity {
|
||||
|
||||
private static final ThreadLocal<WeakReference<AEBaseBlockEntity>> DROP_NO_ITEMS = new ThreadLocal<>();
|
||||
private static final Map<Class<? extends BlockEntity>, IStackSrc> ITEM_STACKS = new HashMap<>();
|
||||
@@ -307,12 +309,12 @@ public class AEBaseBlockEntity extends BlockEntity implements IOrientable, IComm
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the contents of the tile entity, into the world, defaults to dropping
|
||||
* returns the contents of the block entity, into the world, defaults to dropping
|
||||
* everything in the inventory.
|
||||
*
|
||||
* @param w world
|
||||
* @param pos block position
|
||||
* @param drops drops of tile entity
|
||||
* @param drops drops of block entity
|
||||
*/
|
||||
@Override
|
||||
public void getDrops(final World w, final BlockPos pos, final List<ItemStack> drops) {
|
||||
@@ -378,7 +380,7 @@ public class AEBaseBlockEntity extends BlockEntity implements IOrientable, IComm
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this tile entity is remote (we are running on the logical client
|
||||
* Checks if this block entity is remote (we are running on the logical client
|
||||
* side).
|
||||
*/
|
||||
public boolean isClient() {
|
||||
@@ -410,4 +412,9 @@ public class AEBaseBlockEntity extends BlockEntity implements IOrientable, IComm
|
||||
this.customName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getRenderAttachmentData() {
|
||||
return new AEModelData(up, forward);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -331,9 +331,8 @@ public class CraftingBlockEntity extends AENetworkBlockEntity implements IAEMult
|
||||
this.previousState = previousState;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
public Object getRenderAttachmentData() {
|
||||
return new CraftingCubeModelData(getUp(), getForward(), getConnections());
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
@@ -169,7 +169,7 @@ public class CraftingMonitorBlockEntity extends CraftingBlockEntity implements I
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
public CraftingMonitorModelData getRenderAttachmentData() {
|
||||
return new CraftingMonitorModelData(getUp(), getForward(), getConnections(), getColor());
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderState;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -135,7 +135,7 @@ public class MolecularAssemblerRenderer extends BlockEntityRenderer<MolecularAss
|
||||
ms.translate(0, -0.2f, 0);
|
||||
}
|
||||
|
||||
itemRenderer.renderItem(is, ItemCameraTransforms.TransformType.GROUND, combinedLightIn,
|
||||
itemRenderer.renderItem(is, ModelTransformation.TransformType.GROUND, combinedLightIn,
|
||||
OverlayTexture.NO_OVERLAY, ms, bufferIn);
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.LightType;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
@@ -248,10 +248,9 @@ public class PaintSplotchesBlockEntity extends AEBaseBlockEntity {
|
||||
return this.dots;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
// FIXME update trigger
|
||||
return new ModelDataMap.Builder().withInitial(SPLOTCHES, new PaintSplotches(getDots())).build();
|
||||
public Object getRenderAttachmentData() {
|
||||
return new PaintSplotches(getDots());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
@@ -320,7 +320,7 @@ public class CableBusBlockEntity extends AEBaseBlockEntity implements AEMultiTil
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
public CableBusRenderState getRenderAttachmentData() {
|
||||
World world = getWorld();
|
||||
if (world == null) {
|
||||
return EmptyModelData.INSTANCE;
|
||||
|
||||
@@ -33,7 +33,7 @@ import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import alexiil.mc.lib.attributes.item.impl.EmptyFixedItemInv;
|
||||
@@ -298,15 +298,9 @@ public class QuantumBridgeBlockEntity extends AENetworkInvBlockEntity implements
|
||||
return this.corner;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
// FIXME must trigger model data updates
|
||||
|
||||
return new ModelDataMap.Builder()
|
||||
.withInitial(FORMED_STATE, new QnbFormedState(getAdjacentQuantumBridges(), isCorner(), isPowered()))
|
||||
.build();
|
||||
|
||||
public QnbFormedState getRenderAttachmentData() {
|
||||
return new QnbFormedState(getAdjacentQuantumBridges(), isCorner(), isPowered());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import javax.annotation.Nonnull;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
@@ -221,12 +221,9 @@ public class SpatialPylonBlockEntity extends AENetworkBlockEntity implements IAE
|
||||
return this.displayBits;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
// FIXME: Must force model data update on changes, should potentially be moved
|
||||
// to block state (?)
|
||||
return new ModelDataMap.Builder().withInitial(STATE, getDisplayBits()).build();
|
||||
public Object getRenderAttachmentData() {
|
||||
return getDisplayBits();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -438,9 +438,8 @@ public class DriveBlockEntity extends AENetworkInvBlockEntity implements IChestO
|
||||
return AEApi.instance().definitions().blocks().drive().maybeStack(1).orElse(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
public DriveModelData getRenderAttachmentData() {
|
||||
return new DriveModelData(getUp(), getForward(), DriveSlotsState.fromChestOrDrive(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -430,8 +430,8 @@ public class IOPortBlockEntity extends AENetworkInvBlockEntity
|
||||
* Adds the items in the upgrade slots to the drop list.
|
||||
*
|
||||
* @param w world
|
||||
* @param pos pos of tile entity
|
||||
* @param drops drops of tile entity
|
||||
* @param pos pos of block entity
|
||||
* @param drops drops of block entity
|
||||
*/
|
||||
@Override
|
||||
public void getDrops(final World w, final BlockPos pos, final List<ItemStack> drops) {
|
||||
|
||||
Reference in New Issue
Block a user