feat: add legacy wireless access point
This commit is contained in:
parent
6eebb86acb
commit
ed0cc5f181
|
@ -1,5 +1,7 @@
|
|||
package appeng.block.legacy;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
|
@ -10,26 +12,34 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
public class BlockTerminal extends AEBaseTileBlock {
|
||||
|
||||
public BlockTerminal() {
|
||||
super(Material.iron);
|
||||
this.setTileEntity(TileTerminal.class);
|
||||
this.setFeature( EnumSet.of(AEFeature.Legacy) );
|
||||
this.setFeature(EnumSet.of(AEFeature.Legacy));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onActivated(
|
||||
World w,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer player,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
final TileTerminal tile = this.getTileEntity(w, x, y, z);
|
||||
if( tile != null && !player.isSneaking() ) {
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
if (tile != null && !player.isSneaking()) {
|
||||
if (Platform.isClient()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI(player, tile, ForgeDirection.getOrientation(side), GuiBridge.GUI_ME);
|
||||
Platform.openGUI(
|
||||
player, tile, ForgeDirection.getOrientation(side), GuiBridge.GUI_ME
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package appeng.block.legacy;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockWirelessAccessPoint extends AEBaseTileBlock {
|
||||
public BlockWirelessAccessPoint() {
|
||||
super(Material.iron);
|
||||
this.isOpaque = true;
|
||||
this.setTileEntity(TileWireless.class);
|
||||
this.setFeature(EnumSet.of(AEFeature.Legacy));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
World w,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer p,
|
||||
int side,
|
||||
// useless parameters
|
||||
float alec1,
|
||||
float alec2,
|
||||
float alec3
|
||||
) {
|
||||
TileEntity tileEntity = w.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && !p.isSneaking()) {
|
||||
Platform.openGUI(
|
||||
p, tileEntity, ForgeDirection.getOrientation(side), GuiBridge.GUI_WIRELESS
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +1,8 @@
|
|||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.block.networking;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.blocks.RenderBlockWireless;
|
||||
|
@ -35,172 +20,183 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision {
|
||||
public BlockWireless() {
|
||||
super(AEGlassMaterial.INSTANCE);
|
||||
this.setTileEntity(TileWireless.class);
|
||||
this.setLightOpacity(0);
|
||||
this.isFullSize = false;
|
||||
this.isOpaque = false;
|
||||
this.setFeature(EnumSet.of(AEFeature.Core, AEFeature.WirelessAccessTerminal));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected RenderBlockWireless getRenderer() {
|
||||
return new RenderBlockWireless();
|
||||
}
|
||||
|
||||
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
final World w,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final EntityPlayer p,
|
||||
final int side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ
|
||||
) {
|
||||
final TileWireless tg = this.getTileEntity(w, x, y, z);
|
||||
|
||||
public BlockWireless()
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
this.setTileEntity( TileWireless.class );
|
||||
this.setLightOpacity( 0 );
|
||||
this.isFullSize = false;
|
||||
this.isOpaque = false;
|
||||
this.setFeature( EnumSet.of( AEFeature.Core, AEFeature.WirelessAccessTerminal ) );
|
||||
}
|
||||
if (tg != null && !p.isSneaking()) {
|
||||
if (Platform.isServer()) {
|
||||
Platform.openGUI(
|
||||
p, tg, ForgeDirection.getOrientation(side), GuiBridge.GUI_WIRELESS
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
protected RenderBlockWireless getRenderer()
|
||||
{
|
||||
return new RenderBlockWireless();
|
||||
}
|
||||
return super.onBlockActivated(w, x, y, z, p, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated( final World w, final int x, final int y, final int z, final EntityPlayer p, final int side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
final TileWireless tg = this.getTileEntity( w, x, y, z );
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(
|
||||
final World w,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final Entity e,
|
||||
final boolean isVisual
|
||||
) {
|
||||
final TileWireless tile = this.getTileEntity(w, x, y, z);
|
||||
if (tile != null) {
|
||||
final ForgeDirection forward = tile.getForward();
|
||||
|
||||
if( tg != null && !p.isSneaking() )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_WIRELESS );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
double minX = 0;
|
||||
double minY = 0;
|
||||
double minZ = 0;
|
||||
double maxX = 1;
|
||||
double maxY = 1;
|
||||
double maxZ = 1;
|
||||
|
||||
return super.onBlockActivated( w, x, y, z, p, side, hitX, hitY, hitZ );
|
||||
}
|
||||
switch (forward) {
|
||||
case DOWN:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 1.0;
|
||||
minY = 5.0 / 16.0;
|
||||
break;
|
||||
case EAST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 11.0 / 16.0;
|
||||
minX = 0.0;
|
||||
break;
|
||||
case NORTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 1.0;
|
||||
minZ = 5.0 / 16.0;
|
||||
break;
|
||||
case SOUTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 11.0 / 16.0;
|
||||
minZ = 0.0;
|
||||
break;
|
||||
case UP:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 11.0 / 16.0;
|
||||
minY = 0.0;
|
||||
break;
|
||||
case WEST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 1.0;
|
||||
minX = 5.0 / 16.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final int x, final int y, final int z, final Entity e, final boolean isVisual )
|
||||
{
|
||||
final TileWireless tile = this.getTileEntity( w, x, y, z );
|
||||
if( tile != null )
|
||||
{
|
||||
final ForgeDirection forward = tile.getForward();
|
||||
return Collections.singletonList(
|
||||
AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ)
|
||||
);
|
||||
}
|
||||
return Collections.singletonList(
|
||||
AxisAlignedBB.getBoundingBox(0.0, 0, 0.0, 1.0, 1.0, 1.0)
|
||||
);
|
||||
}
|
||||
|
||||
double minX = 0;
|
||||
double minY = 0;
|
||||
double minZ = 0;
|
||||
double maxX = 1;
|
||||
double maxY = 1;
|
||||
double maxZ = 1;
|
||||
@Override
|
||||
public void addCollidingBlockToList(
|
||||
final World w,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final AxisAlignedBB bb,
|
||||
final List<AxisAlignedBB> out,
|
||||
final Entity e
|
||||
) {
|
||||
final TileWireless tile = this.getTileEntity(w, x, y, z);
|
||||
if (tile != null) {
|
||||
final ForgeDirection forward = tile.getForward();
|
||||
|
||||
switch( forward )
|
||||
{
|
||||
case DOWN:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 1.0;
|
||||
minY = 5.0 / 16.0;
|
||||
break;
|
||||
case EAST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 11.0 / 16.0;
|
||||
minX = 0.0;
|
||||
break;
|
||||
case NORTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 1.0;
|
||||
minZ = 5.0 / 16.0;
|
||||
break;
|
||||
case SOUTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 11.0 / 16.0;
|
||||
minZ = 0.0;
|
||||
break;
|
||||
case UP:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 11.0 / 16.0;
|
||||
minY = 0.0;
|
||||
break;
|
||||
case WEST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 1.0;
|
||||
minX = 5.0 / 16.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
double minX = 0;
|
||||
double minY = 0;
|
||||
double minZ = 0;
|
||||
double maxX = 1;
|
||||
double maxY = 1;
|
||||
double maxZ = 1;
|
||||
|
||||
return Collections.singletonList( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||
}
|
||||
return Collections.singletonList( AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
}
|
||||
switch (forward) {
|
||||
case DOWN:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 1.0;
|
||||
minY = 5.0 / 16.0;
|
||||
break;
|
||||
case EAST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 11.0 / 16.0;
|
||||
minX = 0.0;
|
||||
break;
|
||||
case NORTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 1.0;
|
||||
minZ = 5.0 / 16.0;
|
||||
break;
|
||||
case SOUTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 11.0 / 16.0;
|
||||
minZ = 0.0;
|
||||
break;
|
||||
case UP:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 11.0 / 16.0;
|
||||
minY = 0.0;
|
||||
break;
|
||||
case WEST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 1.0;
|
||||
minX = 5.0 / 16.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList( final World w, final int x, final int y, final int z, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||
{
|
||||
final TileWireless tile = this.getTileEntity( w, x, y, z );
|
||||
if( tile != null )
|
||||
{
|
||||
final ForgeDirection forward = tile.getForward();
|
||||
|
||||
double minX = 0;
|
||||
double minY = 0;
|
||||
double minZ = 0;
|
||||
double maxX = 1;
|
||||
double maxY = 1;
|
||||
double maxZ = 1;
|
||||
|
||||
switch( forward )
|
||||
{
|
||||
case DOWN:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 1.0;
|
||||
minY = 5.0 / 16.0;
|
||||
break;
|
||||
case EAST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 11.0 / 16.0;
|
||||
minX = 0.0;
|
||||
break;
|
||||
case NORTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 1.0;
|
||||
minZ = 5.0 / 16.0;
|
||||
break;
|
||||
case SOUTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 11.0 / 16.0;
|
||||
minZ = 0.0;
|
||||
break;
|
||||
case UP:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 11.0 / 16.0;
|
||||
minY = 0.0;
|
||||
break;
|
||||
case WEST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 1.0;
|
||||
minX = 5.0 / 16.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
out.add( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
out.add( AxisAlignedBB.getBoundingBox( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
}
|
||||
}
|
||||
out.add(AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ));
|
||||
} else {
|
||||
out.add(AxisAlignedBB.getBoundingBox(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import appeng.block.legacy.BlockCraftMonitor;
|
|||
import appeng.block.legacy.BlockCraftTerminal;
|
||||
import appeng.block.legacy.BlockLegacyController;
|
||||
import appeng.block.legacy.BlockTerminal;
|
||||
import appeng.block.legacy.BlockWirelessAccessPoint;
|
||||
import appeng.block.misc.*;
|
||||
import appeng.block.networking.*;
|
||||
import appeng.block.qnb.BlockQuantumLinkChamber;
|
||||
|
@ -133,11 +134,12 @@ public final class ApiBlocks implements IBlocks
|
|||
|
||||
private final Set<IOrientableBlock> orientables;
|
||||
|
||||
//Legacy
|
||||
// Legacy
|
||||
private final ITileDefinition terminal;
|
||||
private final ITileDefinition craftTerminal;
|
||||
private final ITileDefinition craftMonitor;
|
||||
private final ITileDefinition legacyController;
|
||||
private final ITileDefinition legacyWirelessAccessPoint;
|
||||
|
||||
public ApiBlocks( final DefinitionConstructor constructor )
|
||||
{
|
||||
|
@ -228,12 +230,12 @@ public final class ApiBlocks implements IBlocks
|
|||
this.phantomNode = constructor.registerBlockDefinition( new BlockPhantomNode() );
|
||||
this.cubeGenerator = constructor.registerBlockDefinition( new BlockCubeGenerator() );
|
||||
|
||||
//Legacy
|
||||
// Legacy
|
||||
this.terminal = constructor.registerTileDefinition( new BlockTerminal() );
|
||||
this.craftTerminal = constructor.registerTileDefinition( new BlockCraftTerminal() );
|
||||
this.craftMonitor = constructor.registerTileDefinition( new BlockCraftMonitor() );
|
||||
this.legacyController = constructor.registerTileDefinition( new BlockLegacyController() );
|
||||
|
||||
this.legacyWirelessAccessPoint = constructor.registerTileDefinition(new BlockWirelessAccessPoint());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,6 +29,7 @@ import appeng.api.networking.events.MENetworkEventSubscribe;
|
|||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.block.legacy.BlockWirelessAccessPoint;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.TileEvent;
|
||||
|
@ -66,7 +67,11 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
|
|||
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
if (this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord) instanceof BlockWirelessAccessPoint) {
|
||||
this.getProxy().setValidSides( EnumSet.allOf(ForgeDirection.class) );
|
||||
} else {
|
||||
this.getProxy().setValidSides( EnumSet.of( this.getForward().getOpposite() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
|
|
|
@ -51,11 +51,12 @@ tile.appliedenergistics2.BlockCraftingAccelerator.name=Crafting Co-Processing Un
|
|||
tile.appliedenergistics2.BlockCraftingUnit.name=Crafting Unit
|
||||
tile.appliedenergistics2.BlockMolecularAssembler.name=Molecular Assembler
|
||||
|
||||
#Legacy
|
||||
# Legacy
|
||||
tile.appliedenergistics2.BlockTerminal.name=ME Access Terminal
|
||||
tile.appliedenergistics2.BlockCraftTerminal.name=ME Crafting Terminal
|
||||
tile.appliedenergistics2.BlockCraftMonitor.name=ME Crafting Monitor
|
||||
tile.appliedenergistics2.BlockLegacyController.name=ME Controller (W.I.P)
|
||||
tile.appliedenergistics2.BlockWirelessAccessPoint.name=Wireless Access Point
|
||||
|
||||
item.appliedenergistics2.ItemMaterial.ConversionMatrix.name=Conversion Matrix
|
||||
|
||||
|
|
|
@ -33,3 +33,9 @@ shaped=
|
|||
fluixCrystal ae2:ItemMaterial.EngProcessor fluixCrystal,
|
||||
oredictionary:ingotIron fluixCrystal oredictionary:ingotIron
|
||||
-> ae2:BlockLegacyController
|
||||
|
||||
shaped=
|
||||
oredictionary:ingotIron glass oredictionary:ingotIron,
|
||||
ae2:CableGlass.Fluix ae2:ItemMaterial.Wireless glass,
|
||||
oredictionary:ingotIron glass oredictionary:ingotIron,
|
||||
-> ae2:BlockWirelessAccessPoint
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 450 B |
Loading…
Reference in New Issue