Retexture AE2 machines (#338)

This commit is contained in:
Serenibyss
2023-12-24 21:08:19 -06:00
committed by GitHub
parent ffe1a52456
commit 754ee1ba83
84 changed files with 316 additions and 18 deletions
@@ -26,12 +26,15 @@ import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nullable;
@@ -39,8 +42,11 @@ import javax.annotation.Nullable;
public class BlockSpatialIOPort extends AEBaseTileBlock {
public static final PropertyBool POWERED = PropertyBool.create("powered");
public BlockSpatialIOPort() {
super(Material.IRON);
setDefaultState(getDefaultState().withProperty(POWERED, false));
}
@Override
@@ -51,6 +57,19 @@ public class BlockSpatialIOPort extends AEBaseTileBlock {
}
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileSpatialIOPort te = this.getTileEntity(worldIn, pos);
boolean powered = te != null && te.isActive();
return super.getActualState(state, worldIn, pos)
.withProperty(POWERED, powered);
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED};
}
@Override
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
if (p.isSneaking()) {
@@ -26,12 +26,15 @@ import appeng.tile.storage.TileIOPort;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nullable;
@@ -39,8 +42,25 @@ import javax.annotation.Nullable;
public class BlockIOPort extends AEBaseTileBlock {
public static final PropertyBool POWERED = PropertyBool.create("powered");
public BlockIOPort() {
super(Material.IRON);
setDefaultState(getDefaultState().withProperty(POWERED, false));
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileIOPort te = this.getTileEntity(worldIn, pos);
boolean powred = te != null && te.isActive();
return super.getActualState(state, worldIn, pos)
.withProperty(POWERED, powred);
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED};
}
@Override
@@ -28,12 +28,15 @@ import appeng.api.networking.GridFlags;
import appeng.api.networking.IGrid;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.events.MENetworkEvent;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.events.MENetworkSpatialEvent;
import appeng.api.networking.spatial.ISpatialCache;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.hooks.TickHandler;
import appeng.me.GridAccessException;
import appeng.me.cache.SpatialPylonCache;
import appeng.tile.grid.AENetworkInvTile;
import appeng.tile.inventory.AppEngInternalInventory;
@@ -42,6 +45,7 @@ import appeng.util.Platform;
import appeng.util.inv.InvOperation;
import appeng.util.inv.WrapperFilteredItemHandler;
import appeng.util.inv.filter.IAEItemFilter;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
@@ -49,6 +53,7 @@ import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import javax.annotation.Nonnull;
import java.io.IOException;
public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallable<Void> {
@@ -57,10 +62,17 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
private final IItemHandler invExt = new WrapperFilteredItemHandler(this.inv, new SpatialIOFilter());
private YesNo lastRedstoneState = YesNo.UNDECIDED;
private boolean isActive = false;
public TileSpatialIOPort() {
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
}
@MENetworkEventSubscribe
public void onPower(final MENetworkPowerStatusChange ch) {
this.markForUpdate();
}
@Override
public NBTTagCompound writeToNBT(final NBTTagCompound data) {
super.writeToNBT(data);
@@ -76,6 +88,32 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
}
}
@Override
protected boolean readFromStream(ByteBuf data) throws IOException {
boolean c = super.readFromStream(data);
final boolean oldIsActive = this.isActive;
this.isActive = data.readBoolean();
return oldIsActive != this.isActive || c;
}
@Override
protected void writeToStream(ByteBuf data) throws IOException {
super.writeToStream(data);
data.writeBoolean(this.isActive());
}
public boolean isActive() {
if (Platform.isServer()) {
try {
return this.getProxy().getEnergy().isNetworkPowered();
} catch (final GridAccessException e) {
return false;
}
}
return this.isActive;
}
public boolean getRedstoneState() {
if (this.lastRedstoneState == YesNo.UNDECIDED) {
this.updateRedstoneState();
@@ -25,6 +25,8 @@ import appeng.api.implementations.IUpgradeableHost;
import appeng.api.networking.GridFlags;
import appeng.api.networking.IGridNode;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
@@ -55,6 +57,7 @@ import appeng.util.inv.InvOperation;
import appeng.util.inv.WrapperChainedItemHandler;
import appeng.util.inv.WrapperFilteredItemHandler;
import appeng.util.inv.filter.AEItemFilters;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -63,6 +66,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import java.io.IOException;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
@@ -87,6 +91,8 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
private ItemStack currentCell;
private Map<IStorageChannel<?>, IMEInventory<?>> cachedInventories;
private boolean isActive = false;
public TileIOPort() {
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
this.manager = new ConfigManager(this);
@@ -100,6 +106,11 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
this.upgrades = new BlockUpgradeInventory(ioPortBlock, this, NUMBER_OF_UPGRADE_SLOTS);
}
@MENetworkEventSubscribe
public void onPower(final MENetworkPowerStatusChange ch) {
this.markForUpdate();
}
@Override
public NBTTagCompound writeToNBT(final NBTTagCompound data) {
super.writeToNBT(data);
@@ -119,6 +130,32 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
}
@Override
protected boolean readFromStream(ByteBuf data) throws IOException {
boolean c = super.readFromStream(data);
final boolean oldIsActive = this.isActive;
this.isActive = data.readBoolean();
return oldIsActive != this.isActive || c;
}
@Override
protected void writeToStream(ByteBuf data) throws IOException {
super.writeToStream(data);
data.writeBoolean(this.isActive());
}
public boolean isActive() {
if (Platform.isServer()) {
try {
return this.getProxy().getEnergy().isNetworkPowered();
} catch (GridAccessException e) {
return false;
}
}
return this.isActive;
}
@Override
public AECableType getCableConnectionType(final AEPartLocation dir) {
return AECableType.SMART;
@@ -1,7 +1,10 @@
{
"variants": {
"normal": {
"powered=false": {
"model": "appliedenergistics2:io_port"
},
"powered=true": {
"model": "appliedenergistics2:io_port_on"
}
}
}
@@ -1,7 +1,10 @@
{
"variants": {
"normal": {
"powered=false": {
"model": "appliedenergistics2:spatial_io_port"
},
"powered=true": {
"model": "appliedenergistics2:spatial_io_port_on"
}
}
}
@@ -1,5 +1,4 @@
{
"ambientocclusion": false,
"display": {
"firstperson_righthand": {
"rotation": [
@@ -46,7 +45,6 @@
0,
0
],
"shade": false,
"to": [
16,
16,
@@ -2,7 +2,7 @@
"parent": "appliedenergistics2:block/cube/cube_ae_bottom_top",
"textures": {
"bottom": "appliedenergistics2:blocks/io_port_bottom",
"side": "appliedenergistics2:blocks/io_port_side",
"top": "appliedenergistics2:blocks/io_port"
"side": "appliedenergistics2:blocks/io_port_side_off",
"top": "appliedenergistics2:blocks/io_port_off"
}
}
@@ -0,0 +1,8 @@
{
"parent": "appliedenergistics2:block/cube/cube_ae_bottom_top",
"textures": {
"bottom": "appliedenergistics2:blocks/io_port_bottom",
"side": "appliedenergistics2:blocks/io_port_side",
"top": "appliedenergistics2:blocks/io_port"
}
}
@@ -2,7 +2,7 @@
"parent": "block/cube_bottom_top",
"textures": {
"bottom": "appliedenergistics2:blocks/spatial_io_port_bottom",
"side": "appliedenergistics2:blocks/spatial_io_port_side",
"top": "appliedenergistics2:blocks/spatial_io_port"
"side": "appliedenergistics2:blocks/spatial_io_port_side_off",
"top": "appliedenergistics2:blocks/spatial_io_port_off"
}
}
@@ -0,0 +1,8 @@
{
"parent": "block/cube_bottom_top",
"textures": {
"bottom": "appliedenergistics2:blocks/spatial_io_port_bottom",
"side": "appliedenergistics2:blocks/spatial_io_port_side",
"top": "appliedenergistics2:blocks/spatial_io_port"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 624 B

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 B

After

Width:  |  Height:  |  Size: 2.3 KiB

@@ -0,0 +1,39 @@
{
"animation": {
"interpolate": true,
"frames": [
{
"index": 0,
"time": 90
},
{
"index": 1,
"time": 2
},
{
"index": 2,
"time": 2
},
{
"index": 3,
"time": 2
},
{
"index": 4,
"time": 2
},
{
"index": 5,
"time": 2
},
{
"index": 6,
"time": 2
},
{
"index": 7,
"time": 2
}
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -0,0 +1,39 @@
{
"animation": {
"interpolate": true,
"frames": [
{
"index": 0,
"time": 70
},
{
"index": 1,
"time": 2
},
{
"index": 2,
"time": 2
},
{
"index": 3,
"time": 2
},
{
"index": 4,
"time": 2
},
{
"index": 5,
"time": 2
},
{
"index": 6,
"time": 2
},
{
"index": 7,
"time": 2
}
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -0,0 +1,39 @@
{
"animation": {
"interpolate": true,
"frames": [
{
"index": 0,
"time": 80
},
{
"index": 1,
"time": 2
},
{
"index": 2,
"time": 2
},
{
"index": 3,
"time": 2
},
{
"index": 4,
"time": 2
},
{
"index": 5,
"time": 2
},
{
"index": 6,
"time": 2
},
{
"index": 7,
"time": 2
}
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 2.0 KiB

@@ -0,0 +1,39 @@
{
"animation": {
"interpolate": true,
"frames": [
{
"index": 0,
"time": 100
},
{
"index": 1,
"time": 2
},
{
"index": 2,
"time": 2
},
{
"index": 3,
"time": 2
},
{
"index": 4,
"time": 2
},
{
"index": 5,
"time": 2
},
{
"index": 6,
"time": 2
},
{
"index": 7,
"time": 2
}
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 595 B

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 B

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 977 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 646 B

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -1,11 +1,15 @@
{
"animation": {
"frametime": 4,
"interpolate": true,
"frames": [
0,
1,
2,
3
{
"index": 0,
"time": 25
},
{
"index": 1,
"time": 25
}
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -1,11 +1,15 @@
{
"animation": {
"frametime": 4,
"interpolate": true,
"frames": [
0,
1,
2,
3
{
"index": 0,
"time": 25
},
{
"index": 1,
"time": 25
}
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B