All GUI compile errors fixed, switched to excludes over includes in gradle build and lots, LOTS of more fixes.

This commit is contained in:
Sebastian Hartte
2020-06-06 21:16:05 +02:00
parent bb453b0d35
commit ff042a394b
209 changed files with 4527 additions and 4479 deletions
@@ -18,8 +18,12 @@
package appeng.block.crafting;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerCraftingCPU;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.state.BooleanProperty;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.StateContainer;
@@ -83,7 +87,7 @@ public abstract class AbstractCraftingUnitBlock<T extends TileCraftingTile> exte
{
if ( !w.isRemote() )
{
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CRAFTING_CPU );
ContainerOpener.openContainer(ContainerCraftingCPU.TYPE, p, ContainerLocator.forTileEntitySide(tg, hit.getFace()));
}
return ActionResultType.SUCCESS;
@@ -20,6 +20,10 @@ package appeng.block.crafting;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerInscriber;
import appeng.container.implementations.ContainerMAC;
import appeng.tile.crafting.TileMolecularAssembler;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@@ -69,7 +73,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock<TileMolecularAssemb
if( tg != null && !p.isCrouching() )
{
if (!tg.isRemote()) {
// FIXME Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_MAC);
ContainerOpener.openContainer(ContainerMAC.TYPE, p, ContainerLocator.forTileEntitySide(tg, hit.getFace()));
}
return ActionResultType.SUCCESS;
}
@@ -20,6 +20,8 @@ package appeng.block.grindstone;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerGrinder;
import appeng.tile.grindstone.TileGrinder;
import net.minecraft.entity.player.PlayerEntity;
@@ -48,7 +50,7 @@ public class BlockGrinder extends AEBaseTileBlock<TileGrinder>
if( tg != null && !p.isCrouching() )
{
if (p instanceof ServerPlayerEntity) {
ContainerGrinder.open((ServerPlayerEntity) p, tg, getNameTextComponent());
ContainerOpener.openContainer(ContainerGrinder.TYPE, p, ContainerLocator.forTileEntitySide(tg, hit.getFace()));
}
return ActionResultType.SUCCESS;
}
@@ -21,6 +21,8 @@ package appeng.block.misc;
import javax.annotation.Nullable;
import appeng.container.ContainerLocator;
import appeng.container.implementations.ContainerCellWorkbench;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -30,7 +32,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.tile.misc.TileCellWorkbench;
@@ -58,7 +59,7 @@ public class BlockCellWorkbench extends AEBaseTileBlock<TileCellWorkbench>
{
if( Platform.isServer() )
{
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_CELL_WORKBENCH );
ContainerCellWorkbench.open(p, ContainerLocator.forTileEntity(tg));
}
return ActionResultType.SUCCESS;
}
@@ -21,6 +21,10 @@ package appeng.block.misc;
import javax.annotation.Nullable;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerCondenser;
import appeng.container.implementations.ContainerDrive;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -58,7 +62,7 @@ public class BlockCondenser extends AEBaseTileBlock<TileCondenser>
final TileCondenser tc = this.getTileEntity( w, pos );
if( tc != null && !player.isCrouching() )
{
// FIXME Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CONDENSER );
ContainerOpener.openContainer(ContainerCondenser.TYPE, player, ContainerLocator.forTileEntitySide(tc, hit.getFace()));
return ActionResultType.SUCCESS;
}
}
@@ -20,6 +20,11 @@ package appeng.block.misc;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerInscriber;
import appeng.container.implementations.ContainerInterface;
import appeng.fluids.container.ContainerFluidLevelEmitter;
import appeng.tile.misc.TileInscriber;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
@@ -50,7 +55,7 @@ public class BlockInscriber extends AEBaseTileBlock<TileInscriber> {
final TileInscriber tg = this.getTileEntity(w, pos);
if (tg != null) {
if (!tg.isRemote()) {
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_INSCRIBER );
ContainerOpener.openContainer(ContainerInscriber.TYPE, p, ContainerLocator.forTileEntitySide(tg, hit.getFace()));
}
return ActionResultType.SUCCESS;
}
@@ -21,6 +21,10 @@ package appeng.block.misc;
import appeng.api.util.IOrientable;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerDrive;
import appeng.container.implementations.ContainerInterface;
import appeng.tile.misc.TileInterface;
import appeng.util.Platform;
import net.minecraft.block.Block;
@@ -83,7 +87,7 @@ public class BlockInterface extends AEBaseTileBlock<TileInterface>
{
if( Platform.isServer() )
{
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_INTERFACE );
ContainerOpener.openContainer(ContainerInterface.TYPE, p, ContainerLocator.forTileEntitySide(tg, hit.getFace()));
}
return ActionResultType.SUCCESS;
}
@@ -21,6 +21,10 @@ package appeng.block.misc;
import javax.annotation.Nullable;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerFormationPlane;
import appeng.container.implementations.ContainerSecurityStation;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -92,7 +96,7 @@ public class BlockSecurityStation extends AEBaseTileBlock<TileSecurityStation>
return ActionResultType.SUCCESS;
}
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SECURITY );
ContainerOpener.openContainer(ContainerSecurityStation.TYPE, p, ContainerLocator.forTileEntitySide(tg, hit.getFace()));
return ActionResultType.SUCCESS;
}
return ActionResultType.PASS;
@@ -20,6 +20,10 @@ package appeng.block.misc;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerDrive;
import appeng.container.implementations.ContainerVibrationChamber;
import appeng.core.AEConfig;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileVibrationChamber;
@@ -85,7 +89,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock<TileVibrationCh
final TileVibrationChamber tc = this.getTileEntity( w, pos );
if( tc != null && !player.isCrouching() )
{
// FIXME Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_VIBRATION_CHAMBER );
ContainerOpener.openContainer(ContainerVibrationChamber.TYPE, player, ContainerLocator.forTileEntitySide(tc, hit.getFace()));
return ActionResultType.SUCCESS;
}
}
@@ -20,6 +20,9 @@ package appeng.block.networking;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerWireless;
import appeng.helpers.AEGlassMaterial;
import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
@@ -104,7 +107,7 @@ public class BlockWireless extends AEBaseTileBlock<TileWireless>
{
if( Platform.isServer() )
{
// FIXME Platform.openGUI( player, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_WIRELESS );
ContainerOpener.openContainer(ContainerWireless.TYPE, player, ContainerLocator.forTileEntitySide(tg, hit.getFace()));
}
return ActionResultType.SUCCESS;
}
@@ -1,45 +0,0 @@
package appeng.block.paint;
import java.util.Collection;
import java.util.Collections;
import java.util.function.Function;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;
class PaintModel implements IModel
{
@Override
public Collection<ResourceLocation> getDependencies()
{
return Collections.emptyList();
}
@Override
public Collection<ResourceLocation> getTextures()
{
return PaintBakedModel.getRequiredTextures();
}
@Override
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
{
return new PaintBakedModel( format, bakedTextureGetter );
}
@Override
public IModelState getDefaultState()
{
return TRSRTransformation.identity();
}
}
@@ -5,26 +5,31 @@ package appeng.block.paint;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.function.Function;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import appeng.tile.misc.TilePaint;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.property.IExtendedBlockState;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.core.AppEng;
import appeng.helpers.Splotch;
import net.minecraftforge.client.model.data.IDynamicBakedModel;
import net.minecraftforge.client.model.data.IModelData;
/**
@@ -32,20 +37,17 @@ import appeng.helpers.Splotch;
* a
* matter cannon with paint balls.
*/
class PaintBakedModel implements IBakedModel
class PaintSplotchesBakedModel implements IDynamicBakedModel
{
private static final ResourceLocation TEXTURE_PAINT1 = new ResourceLocation( AppEng.MOD_ID, "blocks/paint1" );
private static final ResourceLocation TEXTURE_PAINT2 = new ResourceLocation( AppEng.MOD_ID, "blocks/paint2" );
private static final ResourceLocation TEXTURE_PAINT3 = new ResourceLocation( AppEng.MOD_ID, "blocks/paint3" );
private final VertexFormat vertexFormat;
private static final Material TEXTURE_PAINT1 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(AppEng.MOD_ID, "blocks/paint1" ));
private static final Material TEXTURE_PAINT2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/paint2" ));
private static final Material TEXTURE_PAINT3 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/paint3" ));
private final TextureAtlasSprite[] textures;
PaintBakedModel( VertexFormat vertexFormat, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
PaintSplotchesBakedModel(Function<Material, TextureAtlasSprite> bakedTextureGetter )
{
this.vertexFormat = vertexFormat;
this.textures = new TextureAtlasSprite[] {
bakedTextureGetter.apply( TEXTURE_PAINT1 ),
bakedTextureGetter.apply( TEXTURE_PAINT2 ),
@@ -53,35 +55,30 @@ class PaintBakedModel implements IBakedModel
};
}
@Nonnull
@Override
public List<BakedQuad> getQuads( @Nullable BlockState state, @Nullable Direction side, long rand )
{
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) {
if( side != null )
{
return Collections.emptyList();
}
if( !( state instanceof IExtendedBlockState ) )
PaintSplotches splotchesState = extraData.getData(TilePaint.SPLOTCHES);
if( splotchesState == null )
{
// This is the inventory model which should usually not be used other than in special cases
List<BakedQuad> quads = new ArrayList<>( 1 );
CubeBuilder builder = new CubeBuilder( this.vertexFormat, quads );
CubeBuilder builder = new CubeBuilder( quads );
builder.setTexture( this.textures[0] );
builder.addCube( 0, 0, 0, 16, 16, 16 );
return quads;
}
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
PaintSplotches splotchesState = extendedBlockState.getValue( BlockPaint.SPLOTCHES );
if( splotchesState == null )
{
return Collections.emptyList();
}
List<Splotch> splotches = splotchesState.getSplotches();
CubeBuilder builder = new CubeBuilder( this.vertexFormat );
CubeBuilder builder = new CubeBuilder( );
float offsetConstant = 0.001f;
for( final Splotch s : splotches )
@@ -179,19 +176,18 @@ class PaintBakedModel implements IBakedModel
return this.textures[0];
}
@Override
public ItemCameraTransforms getItemCameraTransforms()
{
return ItemCameraTransforms.DEFAULT;
}
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.EMPTY;
}
static List<ResourceLocation> getRequiredTextures()
@Override
public boolean func_230044_c_() {
return false;
}
static List<Material> getRequiredTextures()
{
return ImmutableList.of(
TEXTURE_PAINT1, TEXTURE_PAINT2, TEXTURE_PAINT3 );
@@ -0,0 +1,30 @@
package appeng.block.paint;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelConfiguration;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import java.util.Collection;
import java.util.Set;
import java.util.function.Function;
public class PaintSplotchesModel implements IModelGeometry<PaintSplotchesModel>
{
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) {
return new PaintSplotchesBakedModel( spriteGetter );
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
return PaintSplotchesBakedModel.getRequiredTextures();
}
}
@@ -25,6 +25,9 @@ import java.util.Random;
import javax.annotation.Nullable;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerQNB;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
@@ -94,7 +97,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
{
if( Platform.isServer() )
{
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_QNB );
ContainerOpener.openContainer(ContainerQNB.TYPE, p, ContainerLocator.forTileEntity(tg));
}
return ActionResultType.SUCCESS;
}
@@ -2,41 +2,37 @@
package appeng.block.qnb;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import javax.annotation.Nullable;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.tile.qnb.TileQuantumBridge;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.client.model.data.IDynamicBakedModel;
import net.minecraftforge.client.model.data.IModelData;
import appeng.api.AEApi;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.core.AppEng;
import javax.annotation.Nullable;
import java.util.*;
import java.util.function.Function;
class QnbFormedBakedModel implements IBakedModel
class QnbFormedBakedModel implements IDynamicBakedModel
{
private static final ResourceLocation TEXTURE_LINK = new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_link" );
private static final ResourceLocation TEXTURE_RING = new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring" );
private static final ResourceLocation TEXTURE_RING_LIGHT = new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring_light" );
private static final ResourceLocation TEXTURE_RING_LIGHT_CORNER = new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring_light_corner" );
private static final ResourceLocation TEXTURE_CABLE_GLASS = new ResourceLocation( AppEng.MOD_ID, "parts/cable/glass/transparent" );
private static final ResourceLocation TEXTURE_COVERED_CABLE = new ResourceLocation( AppEng.MOD_ID, "parts/cable/covered/transparent" );
private static final Material TEXTURE_LINK = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(AppEng.MOD_ID, "blocks/quantum_link" ));
private static final Material TEXTURE_RING = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring" ));
private static final Material TEXTURE_RING_LIGHT = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring_light" ));
private static final Material TEXTURE_RING_LIGHT_CORNER = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring_light_corner" ));
private static final Material TEXTURE_CABLE_GLASS = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "parts/cable/glass/transparent" ));
private static final Material TEXTURE_COVERED_CABLE = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "parts/cable/covered/transparent" ));
private static final float DEFAULT_RENDER_MIN = 2.0f;
private static final float DEFAULT_RENDER_MAX = 14.0f;
@@ -47,8 +43,6 @@ class QnbFormedBakedModel implements IBakedModel
private static final float CENTER_POWERED_RENDER_MIN = -0.01f;
private static final float CENTER_POWERED_RENDER_MAX = 16.01f;
private final VertexFormat vertexFormat;
private final IBakedModel baseModel;
private final Block linkBlock;
@@ -60,9 +54,8 @@ class QnbFormedBakedModel implements IBakedModel
private final TextureAtlasSprite lightTexture;
private final TextureAtlasSprite lightCornerTexture;
public QnbFormedBakedModel( VertexFormat vertexFormat, IBakedModel baseModel, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
public QnbFormedBakedModel( IBakedModel baseModel, Function<Material, TextureAtlasSprite> bakedTextureGetter )
{
this.vertexFormat = vertexFormat;
this.baseModel = baseModel;
this.linkTexture = bakedTextureGetter.apply( TEXTURE_LINK );
this.ringTexture = bakedTextureGetter.apply( TEXTURE_RING );
@@ -74,23 +67,25 @@ class QnbFormedBakedModel implements IBakedModel
}
@Override
public List<BakedQuad> getQuads( @Nullable BlockState state, @Nullable Direction side, long rand )
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData modelData)
{
// Get the correct base model
if( !( state instanceof IExtendedBlockState ) )
QnbFormedState formedState = modelData.getData(TileQuantumBridge.FORMED_STATE);
if( formedState == null )
{
return this.baseModel.getQuads( state, side, rand );
}
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
QnbFormedState formedState = extendedBlockState.getValue( BlockQuantumBase.FORMED_STATE );
if (side != null) {
return Collections.emptyList();
}
return this.getQuads( formedState, state, side, rand );
return this.getQuads( formedState, state );
}
private List<BakedQuad> getQuads( QnbFormedState formedState, BlockState state, Direction side, long rand )
private List<BakedQuad> getQuads( QnbFormedState formedState, BlockState state )
{
CubeBuilder builder = new CubeBuilder( this.vertexFormat );
CubeBuilder builder = new CubeBuilder( );
if( state.getBlock() == this.linkBlock )
{
@@ -212,6 +207,11 @@ class QnbFormedBakedModel implements IBakedModel
return true;
}
@Override
public boolean func_230044_c_() {
return false;
}
@Override
public boolean isBuiltInRenderer()
{
@@ -224,19 +224,13 @@ class QnbFormedBakedModel implements IBakedModel
return this.baseModel.getParticleTexture();
}
@Override
public ItemCameraTransforms getItemCameraTransforms()
{
return this.baseModel.getItemCameraTransforms();
}
@Override
public ItemOverrideList getOverrides()
{
return this.baseModel.getOverrides();
}
public static List<ResourceLocation> getRequiredTextures()
public static List<Material> getRequiredTextures()
{
return ImmutableList.of(
TEXTURE_LINK, TEXTURE_RING, TEXTURE_CABLE_GLASS, TEXTURE_COVERED_CABLE, TEXTURE_RING_LIGHT, TEXTURE_RING_LIGHT_CORNER );
@@ -2,63 +2,33 @@
package appeng.block.qnb;
import appeng.core.AppEng;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelConfiguration;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import java.util.Collection;
import java.util.Set;
import java.util.function.Function;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;
import appeng.core.AppEng;
public class QnbFormedModel implements IModel
public class QnbFormedModel implements IModelGeometry<QnbFormedModel>
{
private static final ResourceLocation MODEL_RING = new ResourceLocation( AppEng.MOD_ID, "block/qnb/ring" );
@Override
public Collection<ResourceLocation> getDependencies()
{
return ImmutableList.of( MODEL_RING );
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) {
IBakedModel ringModel = bakery.getBakedModel(MODEL_RING, modelTransform, spriteGetter);
return new QnbFormedBakedModel( ringModel, spriteGetter );
}
@Override
public Collection<ResourceLocation> getTextures()
{
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
return QnbFormedBakedModel.getRequiredTextures();
}
@Override
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
{
IBakedModel ringModel = this.getBaseModel( MODEL_RING, state, format, bakedTextureGetter );
return new QnbFormedBakedModel( format, ringModel, bakedTextureGetter );
}
@Override
public IModelState getDefaultState()
{
return TRSRTransformation.identity();
}
private IBakedModel getBaseModel( ResourceLocation model, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
{
// Load the base model
try
{
return ModelLoaderRegistry.getModel( model ).bake( state, format, bakedTextureGetter );
}
catch( Exception e )
{
throw new RuntimeException( e );
}
}
}
@@ -21,6 +21,10 @@ package appeng.block.spatial;
import javax.annotation.Nullable;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerSpatialIOPort;
import appeng.fluids.container.ContainerFluidLevelEmitter;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.BlockState;
@@ -70,7 +74,7 @@ public class BlockSpatialIOPort extends AEBaseTileBlock<TileSpatialIOPort>
{
if( Platform.isServer() )
{
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SPATIAL_IO_PORT );
ContainerOpener.openContainer(ContainerSpatialIOPort.TYPE, p, ContainerLocator.forTileEntitySide(tg, hit.getFace()));
}
return ActionResultType.SUCCESS;
}
@@ -20,6 +20,10 @@ package appeng.block.storage;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerChest;
import appeng.container.implementations.ContainerQNB;
import appeng.core.localization.PlayerMessages;
import appeng.tile.storage.TileChest;
import appeng.util.Platform;
@@ -94,7 +98,7 @@ public class BlockChest extends AEBaseTileBlock<TileChest>
if( hit.getFace() != tg.getUp() )
{
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CHEST );
ContainerOpener.openContainer(ContainerChest.TYPE, p, ContainerLocator.forTileEntitySide(tg, hit.getFace()));
}
else
{
@@ -20,6 +20,10 @@ package appeng.block.storage;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerDrive;
import appeng.container.implementations.ContainerQuartzKnife;
import appeng.tile.storage.TileDrive;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
@@ -55,7 +59,7 @@ public class BlockDrive extends AEBaseTileBlock<TileDrive>
{
if( Platform.isServer() )
{
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_DRIVE );
ContainerOpener.openContainer(ContainerDrive.TYPE, p, ContainerLocator.forTileEntity(tg));
}
return ActionResultType.SUCCESS;
}
@@ -20,6 +20,10 @@ package appeng.block.storage;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerIOPort;
import appeng.fluids.container.ContainerFluidInterface;
import appeng.tile.storage.TileIOPort;
import appeng.util.Platform;
import net.minecraft.block.Block;
@@ -67,7 +71,7 @@ public class BlockIOPort extends AEBaseTileBlock<TileIOPort>
{
if( Platform.isServer() )
{
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_IOPORT );
ContainerOpener.openContainer(ContainerIOPort.TYPE, p, ContainerLocator.forTileEntitySide(tg, hit.getFace()));
}
return ActionResultType.SUCCESS;
}
@@ -20,6 +20,8 @@ package appeng.block.storage;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ContainerSkyChest;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
@@ -83,7 +85,7 @@ public class BlockSkyChest extends AEBaseTileBlock<TileSkyChest>
return ActionResultType.PASS;
}
ContainerSkyChest.open((ServerPlayerEntity) player, tile, getNameTextComponent());
ContainerOpener.openContainer(ContainerSkyChest.TYPE, player, ContainerLocator.forTileEntity(tile));
}
return ActionResultType.SUCCESS;