Changed AEGlassMaterial to Materials
Preparation in case we need more to support custom non solid, non opaque, or similar blocks. Removed custom fullSize/opaque blocks in favour of Material
This commit is contained in:
@@ -18,22 +18,14 @@
|
||||
|
||||
package appeng.block;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.material.MaterialColor;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
@@ -41,13 +33,11 @@ import net.minecraftforge.common.ToolType;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class AEBaseBlock extends Block {
|
||||
|
||||
private boolean isOpaque = true;
|
||||
private boolean isFullSize = true;
|
||||
private boolean isInventory = false;
|
||||
|
||||
protected AEBaseBlock(final Block.Properties props) {
|
||||
@@ -74,7 +64,7 @@ public abstract class AEBaseBlock extends Block {
|
||||
}
|
||||
|
||||
private static SoundType getDefaultSoundByMaterial(Material mat) {
|
||||
if (mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS) {
|
||||
if (mat == AEMaterials.GLASS || mat == Material.GLASS) {
|
||||
return SoundType.GLASS;
|
||||
} else if (mat == Material.ROCK) {
|
||||
return SoundType.STONE;
|
||||
@@ -85,11 +75,6 @@ public abstract class AEBaseBlock extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||
return this.isFullSize() && this.isOpaque();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(BlockState state) {
|
||||
return this.isInventory();
|
||||
@@ -214,24 +199,6 @@ public abstract class AEBaseBlock extends Block {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean isOpaque() {
|
||||
return this.isOpaque;
|
||||
}
|
||||
|
||||
protected boolean setOpaque(final boolean isOpaque) {
|
||||
this.isOpaque = isOpaque;
|
||||
return isOpaque;
|
||||
}
|
||||
|
||||
protected boolean isFullSize() {
|
||||
return this.isFullSize;
|
||||
}
|
||||
|
||||
protected boolean setFullSize(final boolean isFullSize) {
|
||||
this.isFullSize = isFullSize;
|
||||
return isFullSize;
|
||||
}
|
||||
|
||||
protected boolean isInventory() {
|
||||
return this.isInventory;
|
||||
}
|
||||
|
||||
@@ -64,8 +64,6 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerTileEntity> {
|
||||
|
||||
public ChargerBlock() {
|
||||
super(defaultProps(Material.IRON).notSolid());
|
||||
|
||||
this.setFullSize(this.setOpaque(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -81,7 +81,7 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
|
||||
|
||||
public QuartzFixtureBlock() {
|
||||
super(defaultProps(Material.MISCELLANEOUS).doesNotBlockMovement().hardnessAndResistance(0).lightValue(14)
|
||||
.sound(SoundType.GLASS));
|
||||
.sound(SoundType.GLASS).notSolid());
|
||||
|
||||
this.setDefaultState(getDefaultState().with(FACING, Direction.UP).with(ODD, false));
|
||||
}
|
||||
@@ -199,9 +199,4 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
|
||||
return new MetaRotation(w, pos, FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,10 +18,9 @@
|
||||
|
||||
package appeng.block.misc;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -52,8 +51,7 @@ public class TinyTNTBlock extends AEBaseBlock {
|
||||
.create(new AxisAlignedBB(0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f));
|
||||
|
||||
public TinyTNTBlock(Block.Properties props) {
|
||||
super(props);
|
||||
setFullSize(setOpaque(false));
|
||||
super(defaultProps(Material.TNT).notSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,7 +68,7 @@ import appeng.client.render.cablebus.CableBusBreakingParticle;
|
||||
import appeng.client.render.cablebus.CableBusRenderState;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.ClickPacket;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.integration.abstraction.IAEFacade;
|
||||
import appeng.parts.ICableBusContainer;
|
||||
import appeng.parts.NullCableBusContainer;
|
||||
@@ -81,7 +81,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusTileEntity> implement
|
||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||
|
||||
public CableBusBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE).notSolid().noDrops().variableOpacity());
|
||||
super(defaultProps(AEMaterials.GLASS).notSolid().noDrops().variableOpacity());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.tile.networking.CreativeEnergyCellTileEntity;
|
||||
|
||||
public class CreativeEnergyCellBlock extends AEBaseTileBlock<CreativeEnergyCellTileEntity> {
|
||||
|
||||
public CreativeEnergyCellBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE));
|
||||
super(defaultProps(AEMaterials.GLASS));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.tile.networking.EnergyCellTileEntity;
|
||||
|
||||
public class EnergyCellBlock extends AEBaseTileBlock<EnergyCellTileEntity> {
|
||||
@@ -38,7 +38,7 @@ public class EnergyCellBlock extends AEBaseTileBlock<EnergyCellTileEntity> {
|
||||
public static final IntegerProperty ENERGY_STORAGE = IntegerProperty.create("fullness", 0, 7);
|
||||
|
||||
public EnergyCellBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE));
|
||||
super(defaultProps(AEMaterials.GLASS));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,7 @@ import appeng.block.AEBaseTileBlock;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.WirelessContainer;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.tile.networking.WirelessTileEntity;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -58,9 +58,7 @@ public class WirelessBlock extends AEBaseTileBlock<WirelessTileEntity> {
|
||||
public static final EnumProperty<State> STATE = EnumProperty.create("state", State.class);
|
||||
|
||||
public WirelessBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE).notSolid());
|
||||
this.setFullSize(false);
|
||||
this.setOpaque(false);
|
||||
super(defaultProps(AEMaterials.GLASS).notSolid());
|
||||
this.setDefaultState(this.getDefaultState().with(STATE, State.OFF));
|
||||
}
|
||||
|
||||
|
||||
@@ -42,9 +42,7 @@ import appeng.util.Platform;
|
||||
|
||||
public class PaintSplotchesBlock extends AEBaseTileBlock<PaintSplotchesTileEntity> {
|
||||
public PaintSplotchesBlock() {
|
||||
super(defaultProps(Material.WATER, MaterialColor.AIR));
|
||||
this.setFullSize(false);
|
||||
this.setOpaque(false);
|
||||
super(defaultProps(Material.WATER, MaterialColor.AIR).notSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,7 +46,6 @@ public abstract class QuantumBaseBlock extends AEBaseTileBlock<QuantumBridgeTile
|
||||
|
||||
public QuantumBaseBlock(Block.Properties props) {
|
||||
super(props);
|
||||
this.setFullSize(this.setOpaque(false));
|
||||
this.setDefaultState(this.getDefaultState().with(FORMED, false));
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.QNBContainer;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.tile.qnb.QuantumBridgeTileEntity;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class QuantumLinkChamberBlock extends QuantumBaseBlock {
|
||||
}
|
||||
|
||||
public QuantumLinkChamberBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE));
|
||||
super(defaultProps(AEMaterials.GLASS));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,13 +25,13 @@ import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.tile.spatial.SpatialPylonTileEntity;
|
||||
|
||||
public class SpatialPylonBlock extends AEBaseTileBlock<SpatialPylonTileEntity> {
|
||||
|
||||
public SpatialPylonBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE));
|
||||
super(defaultProps(AEMaterials.GLASS));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
|
||||
public class QuartzGlassBlock extends AbstractGlassBlock {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class QuartzGlassBlock extends AbstractGlassBlock {
|
||||
@Override
|
||||
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
|
||||
final Material mat = adjacentBlockState.getMaterial();
|
||||
if (mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE) {
|
||||
if (mat == Material.GLASS || mat == AEMaterials.GLASS) {
|
||||
if (adjacentBlockState.getRenderType() == state.getRenderType()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+24
-3
@@ -22,9 +22,30 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.material.MaterialColor;
|
||||
import net.minecraft.block.material.PushReaction;
|
||||
|
||||
public class AEGlassMaterial {
|
||||
public class AEMaterials {
|
||||
|
||||
public static final Material INSTANCE = new Material(MaterialColor.AIR, false, false, true, false, true, false,
|
||||
false, PushReaction.NORMAL);
|
||||
public static final Material GLASS = make(MaterialColor.AIR, false, false, true, false, true, false, false,
|
||||
PushReaction.NORMAL);
|
||||
|
||||
/**
|
||||
* Small factory helper with named parameters.
|
||||
*
|
||||
* @param color
|
||||
* @param isLiquid
|
||||
* @param isSolid
|
||||
* @param blocksMovement
|
||||
* @param isOpaque
|
||||
* @param requiresNoTool
|
||||
* @param flammable
|
||||
* @param replaceable
|
||||
* @param pushReaction
|
||||
* @return
|
||||
*/
|
||||
private static Material make(MaterialColor color, boolean isLiquid, boolean isSolid, boolean blocksMovement,
|
||||
boolean isOpaque, boolean requiresNoTool, boolean flammable, boolean replaceable,
|
||||
PushReaction pushReaction) {
|
||||
return new Material(color, isLiquid, isSolid, blocksMovement, isOpaque, requiresNoTool, flammable, replaceable,
|
||||
pushReaction);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user