feat: initial very glitchy transition plane implementation
This commit is contained in:
parent
f67fb6a129
commit
ce2277c8ec
|
@ -15,6 +15,7 @@
|
|||
!LICENSE
|
||||
!CONTRIBUTING.md
|
||||
!CHANGELOG.md
|
||||
!austri3Fix.md
|
||||
|
||||
# include sourcecode
|
||||
!src/
|
||||
|
@ -30,4 +31,4 @@
|
|||
!codeformat/
|
||||
|
||||
# exclude vim files
|
||||
*.swp
|
||||
*.swp
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
- we demultiblocked the transition plane
|
||||
- transition plane doesn't collect items
|
|
@ -0,0 +1,59 @@
|
|||
package appeng.block.legacy;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.legacy.TileTransitionPlane;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockTransitionPlane extends AEBaseTileBlock {
|
||||
public BlockTransitionPlane() {
|
||||
super(Material.iron);
|
||||
this.isOpaque = true;
|
||||
this.setTileEntity(TileTransitionPlane.class);
|
||||
this.setFeature(EnumSet.of(AEFeature.Legacy));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World w, int x, int y, int z, Entity entitiy) {
|
||||
if (entitiy instanceof EntityItem) {
|
||||
TileEntity te = w.getTileEntity(x, y, z);
|
||||
if (te instanceof TileTransitionPlane) {
|
||||
// TODO: WTF
|
||||
//((TileTransitionPlane) te).addItem((EntityItem) entitiy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
Block neighbor
|
||||
) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileTransitionPlane) {
|
||||
((TileTransitionPlane)te).reqEat();
|
||||
}
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public IIcon getIcon(int side, int meta) {
|
||||
// if (side == 0) {
|
||||
// return AppEngTextureRegistry.Blocks.GenericBottom.get();
|
||||
// } else if (side == 1) {
|
||||
// return AppEngTextureRegistry.Blocks.GenericTop.get();
|
||||
// } else {
|
||||
// return side == 2 ? AppEngTextureRegistry.Blocks.BlockTransPlane.get()
|
||||
// : AppEngTextureRegistry.Blocks.GenericSide.get();
|
||||
// }
|
||||
//}
|
||||
}
|
|
@ -580,7 +580,7 @@ public class GuiImgButton extends GuiButton implements ITooltip {
|
|||
}
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(
|
||||
ExtraBlockTextures.GuiTexture("guis/states.png")
|
||||
ExtraBlockTextures.guiTexture("guis/states.png")
|
||||
);
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
|
@ -602,7 +602,7 @@ public class GuiImgButton extends GuiButton implements ITooltip {
|
|||
}
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(
|
||||
ExtraBlockTextures.GuiTexture("guis/states.png")
|
||||
ExtraBlockTextures.guiTexture("guis/states.png")
|
||||
);
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
|
|
|
@ -80,7 +80,7 @@ public class GuiTabButton extends GuiButton implements ITooltip {
|
|||
if (this.visible) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
minecraft.renderEngine.bindTexture(
|
||||
ExtraBlockTextures.GuiTexture("guis/states.png")
|
||||
ExtraBlockTextures.guiTexture("guis/states.png")
|
||||
);
|
||||
this.field_146123_n = x >= this.xPosition && y >= this.yPosition
|
||||
&& x < this.xPosition + this.width && y < this.yPosition + this.height;
|
||||
|
|
|
@ -68,7 +68,7 @@ public class GuiToggleButton extends GuiButton implements ITooltip {
|
|||
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
par1Minecraft.renderEngine.bindTexture(
|
||||
ExtraBlockTextures.GuiTexture("guis/states.png")
|
||||
ExtraBlockTextures.guiTexture("guis/states.png")
|
||||
);
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
|
|
|
@ -1,26 +1,7 @@
|
|||
/*
|
||||
* 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.client.texture;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import jdk.nashorn.internal.ir.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
@ -153,7 +134,7 @@ public enum ExtraBlockTextures {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public static ResourceLocation GuiTexture(final String string) {
|
||||
public static ResourceLocation guiTexture(final String string) {
|
||||
return new ResourceLocation("appliedenergistics2", "textures/" + string);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,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.BlockTransitionPlane;
|
||||
import appeng.block.legacy.BlockWirelessAccessPoint;
|
||||
import appeng.block.misc.*;
|
||||
import appeng.block.networking.*;
|
||||
|
@ -137,6 +138,7 @@ public final class ApiBlocks implements IBlocks {
|
|||
private final ITileDefinition craftMonitor;
|
||||
private final ITileDefinition legacyController;
|
||||
private final ITileDefinition legacyWirelessAccessPoint;
|
||||
private final ITileDefinition transitionPlane;
|
||||
|
||||
public ApiBlocks(final DefinitionConstructor constructor) {
|
||||
final BlockLightDetector lightDetector = new BlockLightDetector();
|
||||
|
@ -312,6 +314,8 @@ public final class ApiBlocks implements IBlocks {
|
|||
= constructor.registerTileDefinition(new BlockLegacyController());
|
||||
this.legacyWirelessAccessPoint
|
||||
= constructor.registerTileDefinition(new BlockWirelessAccessPoint());
|
||||
this.transitionPlane
|
||||
= constructor.registerTileDefinition(new BlockTransitionPlane());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,827 @@
|
|||
package appeng.tile.legacy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.sync.packets.PacketTransitionEffect;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.server.ServerHelper;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileTransitionPlane extends AENetworkTile {
|
||||
List<IAEItemStack> buffer = new ArrayList<>();
|
||||
int delay = 0;
|
||||
int trys = 0;
|
||||
boolean wasPulse = false;
|
||||
static Set<Block> unbreakables = new HashSet<>();
|
||||
private final BaseActionSource mySrc = new MachineSource(this);
|
||||
|
||||
public TileTransitionPlane() {
|
||||
// TODO: WTF
|
||||
//super.hasPower = false;
|
||||
this.getProxy().setValidSides(EnumSet.allOf(ForgeDirection.class));
|
||||
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
this.getProxy().setIdlePowerUsage(1.0);
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//public void setOrientationBySide(
|
||||
// EntityPlayer player, int side, float hitX, float hitY, float hitZ
|
||||
//) {
|
||||
// super.setOrientationBySide(player, side, hitX, hitY, hitZ);
|
||||
// ForgeDirection getForward() = ForgeDirection.getOrientation(side);
|
||||
// WorldCoord pos
|
||||
// = new WorldCoord(this.xCoord, this.yCoord, this.zCoord);
|
||||
// pos.add(getForward(), -1);
|
||||
// this.worldObj.getTileEntity(pos.x, pos.y, pos.z);
|
||||
// MinecraftForge.EVENT_BUS.post(
|
||||
// new GridTileConnectivityEvent(this, this.worldObj, this.getLocation())
|
||||
// );
|
||||
//}
|
||||
|
||||
// TODO: WTF
|
||||
//public boolean syncStyle(IAppEngNetworkTile.SyncTime st) {
|
||||
// return true;
|
||||
//}
|
||||
|
||||
@TileEvent(TileEventType.TICK)
|
||||
public void updateTileEntity() {
|
||||
if (this.getProxy().isActive() && this.delay++ > 320) {
|
||||
if (this.eatBlock()) {
|
||||
this.delay = 0;
|
||||
}
|
||||
|
||||
try {
|
||||
IGrid gi = this.getProxy().getGrid();
|
||||
|
||||
if (gi != null) {
|
||||
while (!this.buffer.isEmpty()) {
|
||||
IAEItemStack aeitem = this.buffer.get(0);
|
||||
this.buffer.remove(0);
|
||||
IStorageGrid storage = this.getProxy().getStorage();
|
||||
IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
IAEItemStack overflow = Platform.poweredInsert(
|
||||
energy, storage.getItemInventory(), aeitem, this.mySrc
|
||||
);
|
||||
if (overflow != null) {
|
||||
this.buffer.add(overflow);
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.buffer.isEmpty()) {
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
if (this.buffer.isEmpty()) {
|
||||
this.reqEat();
|
||||
}
|
||||
}
|
||||
} catch (GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//public void ddItem(EntityItem entitiy) {
|
||||
// if (this.isAccepting()) {
|
||||
// ItemStack is = entitiy.getEntityItem();
|
||||
// if (this.Buffer.isEmpty() && this.getProxy().isActive() &&
|
||||
// Platform.isServer()
|
||||
// && is != null) {
|
||||
// IGrid gi = this.getProxy().getGrid();
|
||||
// if (gi != null && !entitiy.isDead) {
|
||||
// int howMany = gi.usePowerForAddition(is.stackSize, 1);
|
||||
// if (howMany > 0) {
|
||||
// IMEInventory ca = gi.getCellArray();
|
||||
// if (ca != null) {
|
||||
// ItemStack toAdd = is.splitStack(howMany);
|
||||
// toAdd = Platform.refundEnergy(
|
||||
// gi, Platform.addItems(ca, toAdd), "Transiton Plane"
|
||||
// );
|
||||
// if (toAdd != null) {
|
||||
// is.stackSize += toAdd.stackSize;
|
||||
// }
|
||||
|
||||
// try {
|
||||
// float var10009 = (float) entitiy.posX;
|
||||
// AppEng.getInstance().SideProxy.sendToAllNearExcept(
|
||||
// (EntityPlayer) null,
|
||||
// entitiy.posX,
|
||||
// entitiy.posY,
|
||||
// entitiy.posZ,
|
||||
// 64.0,
|
||||
// this.field_70331_k,
|
||||
// (new PacketTransitionPlane(
|
||||
// var10009,
|
||||
// (float) entitiy.posY,
|
||||
// (float) entitiy.posZ,
|
||||
// this.getForward(),
|
||||
// false
|
||||
// ))
|
||||
// .getPacket()
|
||||
// );
|
||||
// } catch (IOException var8) {}
|
||||
|
||||
// if (is.stackSize > 0) {
|
||||
// this.Buffer.add(is.copy());
|
||||
// this.markForUpdate();
|
||||
// }
|
||||
|
||||
// entitiy.setDead();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
public boolean isAccepting() {
|
||||
this.wasPulse = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//public static void blacklist(int itemID, int damageValue) {
|
||||
// unbreakables.add(damageValue << 16 | itemID);
|
||||
//}
|
||||
|
||||
public boolean notUnbreakable(Block block, int damageValue) {
|
||||
if (block != Blocks.air && block.getMaterial() != Material.air
|
||||
&& block.getMaterial() != Material.lava
|
||||
&& block.getMaterial() != Material.water) {
|
||||
return !unbreakables.contains(block);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean eatBlock() {
|
||||
if (this.isAccepting() && this.getProxy().isActive() && Platform.isServer()
|
||||
// TODO: WTF
|
||||
/*&& this.isValid()*/) {
|
||||
int x = this.xCoord + this.getForward().offsetX;
|
||||
int y = this.yCoord + this.getForward().offsetY;
|
||||
int z = this.zCoord + this.getForward().offsetZ;
|
||||
Block bid = this.worldObj.getBlock(x, y, z);
|
||||
int meta = this.worldObj.getBlockMetadata(x, y, z);
|
||||
if (!this.worldObj.isAirBlock(x, y, z) && this.worldObj.blockExists(x, y, z)
|
||||
&& this.buffer.isEmpty() && bid != Blocks.air
|
||||
&& this.notUnbreakable(bid, meta) && bid != Blocks.bedrock
|
||||
&& this.worldObj.canMineBlock(
|
||||
FakePlayerFactory.getMinecraft((WorldServer) this.worldObj), x, y, z
|
||||
)) {
|
||||
float hardness = bid.getBlockHardness(this.worldObj, x, y, z);
|
||||
if ((double) hardness >= 0.0) {
|
||||
ItemStack[] out = Platform.getBlockDrops(this.worldObj, x, y, z);
|
||||
float total = 1.0F + hardness;
|
||||
ItemStack[] arr$ = out;
|
||||
int len$ = out.length;
|
||||
for (len$ = 0; len$ < len$; ++len$) {
|
||||
ItemStack is = arr$[len$];
|
||||
total += (float) is.stackSize;
|
||||
}
|
||||
|
||||
boolean hasPower = false;
|
||||
try {
|
||||
hasPower = this.getProxy().getEnergy().extractAEPower(
|
||||
total, Actionable.MODULATE, PowerMultiplier.CONFIG
|
||||
)
|
||||
> total - 0.1;
|
||||
} catch (GridAccessException e1) {
|
||||
// :P
|
||||
}
|
||||
if (hasPower) {
|
||||
this.worldObj.setBlockToAir(x, y, z);
|
||||
this.trys = 0;
|
||||
|
||||
ServerHelper.proxy.sendToAllNearExcept(
|
||||
null,
|
||||
this.xCoord,
|
||||
this.yCoord,
|
||||
this.zCoord,
|
||||
64,
|
||||
this.getTile().getWorldObj(),
|
||||
new PacketTransitionEffect(
|
||||
this.xCoord + this.getForward().offsetX + 0.5,
|
||||
this.yCoord + this.getForward().offsetY + 0.5,
|
||||
this.zCoord + this.getForward().offsetZ + 0.5,
|
||||
this.getForward(),
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
arr$ = out;
|
||||
len$ = out.length;
|
||||
|
||||
for (int i$ = 0; i$ < len$; ++i$) {
|
||||
//ItemStack is = arr$[i$];
|
||||
//is = Platform.addItems(ca, is);
|
||||
//if (is != null) {
|
||||
// this.Buffer.add(is);
|
||||
// this.markForUpdate();
|
||||
//}
|
||||
if (arr$[i$] == null)
|
||||
continue;
|
||||
|
||||
this.buffer.add(AEItemStack.create(arr$[i$]));
|
||||
}
|
||||
|
||||
try {
|
||||
IGrid gi = this.getProxy().getGrid();
|
||||
|
||||
if (gi != null) {
|
||||
while (!this.buffer.isEmpty()) {
|
||||
IAEItemStack aeitem = this.buffer.get(0);
|
||||
this.buffer.remove(0);
|
||||
IStorageGrid storage = this.getProxy().getStorage();
|
||||
IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
IAEItemStack overflow = Platform.poweredInsert(
|
||||
energy,
|
||||
storage.getItemInventory(),
|
||||
aeitem,
|
||||
this.mySrc
|
||||
);
|
||||
if (overflow != null) {
|
||||
this.buffer.add(overflow);
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.buffer.isEmpty()) {
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
if (this.buffer.isEmpty()) {
|
||||
this.reqEat();
|
||||
}
|
||||
}
|
||||
} catch (GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void reqEat() {
|
||||
this.delay += 9999;
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//public void onNeighborBlockChange() {
|
||||
// this.reqEat();
|
||||
// this.trys = 0;
|
||||
//}
|
||||
|
||||
//public void setPowerStatus(boolean _hasPower) {
|
||||
// super.setPowerStatus(_hasPower);
|
||||
// this.reqEat();
|
||||
//}
|
||||
|
||||
//public void onUpdateRedstone() {
|
||||
// super.onUpdateRedstone();
|
||||
// this.reqEat();
|
||||
//}
|
||||
|
||||
//public void pulseRedStone() {
|
||||
// super.pulseRedStone();
|
||||
// this.wasPulse = true;
|
||||
// this.reqEat();
|
||||
//}
|
||||
|
||||
// TODO: multiblock
|
||||
//boolean linesUp(int x, int y, int z) {
|
||||
// TileEntity te = this.worldObj.getTileEntity(x, y, z);
|
||||
// if (te instanceof TileTransitionPlane) {
|
||||
// return ((TileTransitionPlane) te).getForward() == this.getForward();
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
|
||||
// TODO: WTF
|
||||
//public void placedBy(EntityLivingBase entityliving) {
|
||||
// byte rotation = (byte
|
||||
// ) (MathHelper.floor_double(
|
||||
// (double) (entityliving.rotationYaw * 4.0F / 360.0F) + 2.5
|
||||
// )
|
||||
// & 3);
|
||||
// if (entityliving.rotationPitch > 65.0F) {
|
||||
// rotation = 4;
|
||||
// } else if (entityliving.rotationPitch < -65.0F) {
|
||||
// rotation = 5;
|
||||
// }
|
||||
|
||||
// //this.getForward() = this.getDirectionFromAERotation(rotation);
|
||||
// this.getForward() = ForgeDirection.getOrientation(rotation);
|
||||
//}
|
||||
|
||||
// TODO: WTF
|
||||
//private Icon defTextures(ForgeDirection side) {
|
||||
// if (side == this.getForward().getOpposite()) {
|
||||
// return AppEngTextureRegistry.Blocks.GenericBottom.get();
|
||||
// } else if (side == ForgeDirection.DOWN) {
|
||||
// return AppEngTextureRegistry.Blocks.GenericTop.get();
|
||||
// } else {
|
||||
// return side == ForgeDirection.UP
|
||||
// ? AppEngTextureRegistry.Blocks.GenericTop.get()
|
||||
// : AppEngTextureRegistry.Blocks.GenericSide.get();
|
||||
// }
|
||||
//}
|
||||
|
||||
//public Icon getBlockTextureFromSide(ForgeDirection side) {
|
||||
// Icon frontFace = this.isMachineActive()
|
||||
// ? AppEngTextureRegistry.Blocks.BlockTransPlane.get()
|
||||
// : AppEngTextureRegistry.Blocks.BlockTransPlaneOff.get();
|
||||
// return this.getForward() == side ? frontFace : this.defTextures(side);
|
||||
//}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.writeToNBT(par1nbtTagCompound);
|
||||
NBTTagList items = new NBTTagList();
|
||||
|
||||
for (int x = 0; x < this.buffer.size(); ++x) {
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
this.buffer.get(x).writeToNBT(item);
|
||||
items.appendTag(item);
|
||||
}
|
||||
|
||||
par1nbtTagCompound.setTag("items", items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.readFromNBT(par1nbtTagCompound);
|
||||
NBTTagList items = par1nbtTagCompound.getTagList("items", 10);
|
||||
|
||||
for (int x = 0; x < items.tagCount(); ++x) {
|
||||
this.buffer.add(AEItemStack.loadItemStackFromNBT(items.getCompoundTagAt(x)));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//@SideOnly(Side.CLIENT)
|
||||
//public void renderTexturedPlate(
|
||||
// float[] offset,
|
||||
// float[] Left,
|
||||
// float[] Up,
|
||||
// float[] texOffset,
|
||||
// float[] texDiff,
|
||||
// Icon icon,
|
||||
// int lightX,
|
||||
// int lightY,
|
||||
// int lightZ,
|
||||
// boolean rev
|
||||
//) {
|
||||
// Tessellator tess = Tessellator.instance;
|
||||
// float[] p1 = new float[5];
|
||||
// float[] p2 = new float[5];
|
||||
// float[] p3 = new float[5];
|
||||
// float[] p4 = new float[5];
|
||||
// p1[0] = offset[0];
|
||||
// p1[1] = offset[1];
|
||||
// p1[2] = offset[2];
|
||||
// p1[3] = icon.getInterpolatedU((double) texOffset[0]);
|
||||
// p1[4] = icon.getInterpolatedV((double) texOffset[1]);
|
||||
// p2[0] = offset[0] + Left[0];
|
||||
// p2[1] = offset[1] + Left[1];
|
||||
// p2[2] = offset[2] + Left[2];
|
||||
// p2[3] = icon.getInterpolatedU((double) (texOffset[0] + texDiff[0]));
|
||||
// p2[4] = icon.getInterpolatedV((double) texOffset[1]);
|
||||
// p3[0] = offset[0] + Left[0] + Up[0];
|
||||
// p3[1] = offset[1] + Left[1] + Up[1];
|
||||
// p3[2] = offset[2] + Left[2] + Up[2];
|
||||
// p3[3] = icon.getInterpolatedU((double) (texOffset[0] + texDiff[0]));
|
||||
// p3[4] = icon.getInterpolatedV((double) (texOffset[1] + texDiff[1]));
|
||||
// p4[0] = offset[0] + Up[0];
|
||||
// p4[1] = offset[1] + Up[1];
|
||||
// p4[2] = offset[2] + Up[2];
|
||||
// p4[3] = icon.getInterpolatedU((double) texOffset[0]);
|
||||
// p4[4] = icon.getInterpolatedV((double) (texOffset[1] + texDiff[1]));
|
||||
// tess.setBrightness(
|
||||
// this.getBlockType().getMixedBrightnessForBlock(this.worldObj, lightX,
|
||||
// lightY, lightZ)
|
||||
// );
|
||||
// if (rev) {
|
||||
// tess.addVertexWithUV(
|
||||
// (double) p4[0],
|
||||
// (double) p4[1],
|
||||
// (double) p4[2],
|
||||
// (double) p4[3],
|
||||
// (double) p4[4]
|
||||
// );
|
||||
// tess.addVertexWithUV(
|
||||
// (double) p3[0],
|
||||
// (double) p3[1],
|
||||
// (double) p3[2],
|
||||
// (double) p3[3],
|
||||
// (double) p3[4]
|
||||
// );
|
||||
// tess.addVertexWithUV(
|
||||
// (double) p2[0],
|
||||
// (double) p2[1],
|
||||
// (double) p2[2],
|
||||
// (double) p2[3],
|
||||
// (double) p2[4]
|
||||
// );
|
||||
// tess.addVertexWithUV(
|
||||
// (double) p1[0],
|
||||
// (double) p1[1],
|
||||
// (double) p1[2],
|
||||
// (double) p1[3],
|
||||
// (double) p1[4]
|
||||
// );
|
||||
// } else {
|
||||
// tess.addVertexWithUV(
|
||||
// (double) p1[0],
|
||||
// (double) p1[1],
|
||||
// (double) p1[2],
|
||||
// (double) p1[3],
|
||||
// (double) p1[4]
|
||||
// );
|
||||
// tess.addVertexWithUV(
|
||||
// (double) p2[0],
|
||||
// (double) p2[1],
|
||||
// (double) p2[2],
|
||||
// (double) p2[3],
|
||||
// (double) p2[4]
|
||||
// );
|
||||
// tess.addVertexWithUV(
|
||||
// (double) p3[0],
|
||||
// (double) p3[1],
|
||||
// (double) p3[2],
|
||||
// (double) p3[3],
|
||||
// (double) p3[4]
|
||||
// );
|
||||
// tess.addVertexWithUV(
|
||||
// (double) p4[0],
|
||||
// (double) p4[1],
|
||||
// (double) p4[2],
|
||||
// (double) p4[3],
|
||||
// (double) p4[4]
|
||||
// );
|
||||
// }
|
||||
//}
|
||||
|
||||
// TODO: WTF
|
||||
//public float[] p(float a, float b, float c) {
|
||||
// float[] t = new float[] { a, b, c };
|
||||
// return t;
|
||||
//}
|
||||
|
||||
//public float[] t(float a, float b) {
|
||||
// float[] t = new float[] { a, b };
|
||||
// return t;
|
||||
//}
|
||||
|
||||
// TODO: WTF
|
||||
//@SideOnly(Side.CLIENT)
|
||||
//public boolean renderWorldBlock(
|
||||
// IBlockAccess world,
|
||||
// int x,
|
||||
// int y,
|
||||
// int z,
|
||||
// Block block,
|
||||
// int modelId,
|
||||
// RenderBlocks renderer
|
||||
//) {
|
||||
// renderer.setRenderBounds(
|
||||
// this.getForward() == ForgeDirection.WEST ? 9.999999747378752E-5 : 0.0,
|
||||
// this.getForward() == ForgeDirection.DOWN ? 9.999999747378752E-5 : 0.0,
|
||||
// this.getForward() == ForgeDirection.NORTH ? 9.999999747378752E-5 : 0.0,
|
||||
// this.getForward() == ForgeDirection.EAST ? 0.9998999834060669 : 1.0,
|
||||
// this.getForward() == ForgeDirection.UP ? 0.9998999834060669 : 1.0,
|
||||
// this.getForward() == ForgeDirection.SOUTH ? 0.9998999834060669 : 1.0
|
||||
// );
|
||||
// renderer.uvRotateTop = 0;
|
||||
// renderer.uvRotateBottom = 3;
|
||||
// renderer.uvRotateEast = 1;
|
||||
// renderer.uvRotateNorth = 2;
|
||||
// renderer.uvRotateSouth = 1;
|
||||
// renderer.uvRotateWest = 2;
|
||||
// renderer.renderStandardBlock(block, x, y, z);
|
||||
// renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth
|
||||
// = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest
|
||||
// = 0;
|
||||
// renderer.setRenderBounds(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
|
||||
// IIcon icon = AppEngTextureRegistry.Blocks.BlockFrame.get();
|
||||
// float offsetPerPixel = 0.0625F;
|
||||
// boolean rev;
|
||||
// float zX;
|
||||
// if (this.getForward() == ForgeDirection.NORTH
|
||||
// || this.getForward() == ForgeDirection.SOUTH) {
|
||||
// rev = this.getForward() == ForgeDirection.NORTH;
|
||||
// zX = 1.0F;
|
||||
// if (rev) {
|
||||
// zX = 0.0F;
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x - 1, y, z)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x, (float) y, (float) z + zX),
|
||||
// this.p(offsetPerPixel, 0.0F, 0.0F),
|
||||
// this.p(0.0F, 1.0F, 0.0F),
|
||||
// this.t(0.0F, 0.0F),
|
||||
// this.t(1.0F, 16.0F),
|
||||
// icon,
|
||||
// x,
|
||||
// y,
|
||||
// z + (rev ? -1 : 1),
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x + 1, y, z)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x + 15.0F * offsetPerPixel, (float) y, (float) z +
|
||||
// zX), this.p(offsetPerPixel, 0.0F, 0.0F), this.p(0.0F, 1.0F, 0.0F),
|
||||
// this.t(15.0F, 0.0F),
|
||||
// this.t(1.0F, 16.0F),
|
||||
// icon,
|
||||
// x,
|
||||
// y,
|
||||
// z + (rev ? -1 : 1),
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x, y - 1, z)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x, (float) y, (float) z + zX),
|
||||
// this.p(1.0F, 0.0F, 0.0F),
|
||||
// this.p(0.0F, offsetPerPixel, 0.0F),
|
||||
// this.t(0.0F, 0.0F),
|
||||
// this.t(16.0F, 1.0F),
|
||||
// icon,
|
||||
// x,
|
||||
// y,
|
||||
// z + (rev ? -1 : 1),
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x, y + 1, z)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x, (float) y + 15.0F * offsetPerPixel, (float) z +
|
||||
// zX), this.p(1.0F, 0.0F, 0.0F), this.p(0.0F, offsetPerPixel, 0.0F),
|
||||
// this.t(0.0F, 15.0F),
|
||||
// this.t(16.0F, 1.0F),
|
||||
// icon,
|
||||
// x,
|
||||
// y,
|
||||
// z + (rev ? -1 : 1),
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (this.getForward() == ForgeDirection.EAST
|
||||
// || this.getForward() == ForgeDirection.WEST) {
|
||||
// rev = this.getForward() == ForgeDirection.EAST;
|
||||
// zX = 0.0F;
|
||||
// if (rev) {
|
||||
// zX = 1.0F;
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x, y, z - 1)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x + zX, (float) y, (float) z),
|
||||
// this.p(0.0F, 0.0F, offsetPerPixel),
|
||||
// this.p(0.0F, 1.0F, 0.0F),
|
||||
// this.t(0.0F, 0.0F),
|
||||
// this.t(1.0F, 16.0F),
|
||||
// icon,
|
||||
// x + (rev ? 1 : -1),
|
||||
// y,
|
||||
// z,
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x, y, z + 1)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x + zX, (float) y, (float) z + 15.0F *
|
||||
// offsetPerPixel), this.p(0.0F, 0.0F, offsetPerPixel),
|
||||
// this.p(0.0F, 1.0F, 0.0F),
|
||||
// this.t(15.0F, 0.0F),
|
||||
// this.t(1.0F, 16.0F),
|
||||
// icon,
|
||||
// x + (rev ? 1 : -1),
|
||||
// y,
|
||||
// z,
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x, y - 1, z)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x + zX, (float) y, (float) z),
|
||||
// this.p(0.0F, 0.0F, 1.0F),
|
||||
// this.p(0.0F, offsetPerPixel, 0.0F),
|
||||
// this.t(0.0F, 0.0F),
|
||||
// this.t(16.0F, 1.0F),
|
||||
// icon,
|
||||
// x + (rev ? 1 : -1),
|
||||
// y,
|
||||
// z,
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x, y + 1, z)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x + zX, (float) y + 15.0F * offsetPerPixel, (float)
|
||||
// z), this.p(0.0F, 0.0F, 1.0F), this.p(0.0F, offsetPerPixel, 0.0F),
|
||||
// this.t(0.0F, 15.0F),
|
||||
// this.t(16.0F, 1.0F),
|
||||
// icon,
|
||||
// x + (rev ? 1 : -1),
|
||||
// y,
|
||||
// z,
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (this.getForward() == ForgeDirection.UP
|
||||
// || this.getForward() == ForgeDirection.DOWN) {
|
||||
// rev = this.getForward() == ForgeDirection.UP;
|
||||
// zX = 1.0F;
|
||||
// if (!rev) {
|
||||
// zX = 0.0F;
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x - 1, y, z)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x, (float) y + zX, (float) z),
|
||||
// this.p(offsetPerPixel, 0.0F, 0.0F),
|
||||
// this.p(0.0F, 0.0F, 1.0F),
|
||||
// this.t(0.0F, 0.0F),
|
||||
// this.t(1.0F, 16.0F),
|
||||
// icon,
|
||||
// x,
|
||||
// y + (rev ? 1 : -1),
|
||||
// z,
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x + 1, y, z)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x + 15.0F * offsetPerPixel, (float) y + zX, (float)
|
||||
// z), this.p(offsetPerPixel, 0.0F, 0.0F), this.p(0.0F, 0.0F, 1.0F),
|
||||
// this.t(15.0F, 0.0F),
|
||||
// this.t(1.0F, 16.0F),
|
||||
// icon,
|
||||
// x,
|
||||
// y + (rev ? 1 : -1),
|
||||
// z,
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x, y, z - 1)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x, (float) y + zX, (float) z),
|
||||
// this.p(1.0F, 0.0F, 0.0F),
|
||||
// this.p(0.0F, 0.0F, offsetPerPixel),
|
||||
// this.t(0.0F, 0.0F),
|
||||
// this.t(16.0F, 1.0F),
|
||||
// icon,
|
||||
// x,
|
||||
// y + (rev ? 1 : -1),
|
||||
// z,
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
|
||||
// if (!this.linesUp(x, y, z + 1)) {
|
||||
// this.renderTexturedPlate(
|
||||
// this.p((float) x, (float) y + zX, (float) z + 15.0F *
|
||||
// offsetPerPixel), this.p(1.0F, 0.0F, 0.0F), this.p(0.0F, 0.0F,
|
||||
// offsetPerPixel), this.t(0.0F, 15.0F), this.t(16.0F, 1.0F), icon, x,
|
||||
// y + (rev ? 1 : -1),
|
||||
// z,
|
||||
// rev
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// return true;
|
||||
//}
|
||||
|
||||
// TODO: WTF
|
||||
//public boolean isBlockNormalCube() {
|
||||
// return true;
|
||||
//}
|
||||
|
||||
//public boolean handleTilePacket(DataInputStream stream) throws IOException {
|
||||
// ForgeDirection oldOrientation = this.getForward();
|
||||
// boolean oldHasPower = super.hasPower;
|
||||
// byte rotation = stream.readByte();
|
||||
// this.getForward() = this.getDirectionFromAERotation(rotation);
|
||||
// byte flags = stream.readByte();
|
||||
// super.hasPower = (flags & 1) == 1;
|
||||
// if ((flags & 2) == 2) {
|
||||
// if (this.Buffer.isEmpty()) {
|
||||
// this.Buffer.add(new ItemStack(Item.field_77669_D));
|
||||
// }
|
||||
// } else {
|
||||
// this.Buffer.clear();
|
||||
// }
|
||||
|
||||
// return oldHasPower != super.hasPower || oldOrientation != this.getForward();
|
||||
//}
|
||||
|
||||
//public void configureTilePacket(DataOutputStream data) throws IOException {
|
||||
// data.writeByte(this.getAERotationFromDirection(this.getForward()));
|
||||
// byte flags = 0;
|
||||
// byte flags = (byte) (flags | (super.hasPower ? 1 : 0));
|
||||
// flags = (byte) (flags | (this.Buffer.isEmpty() ? 0 : 2));
|
||||
// data.writeByte(flags);
|
||||
//}
|
||||
|
||||
// TODO: WTF
|
||||
//public void addCollidingBlockToList(
|
||||
// World world,
|
||||
// int x,
|
||||
// int y,
|
||||
// int z,
|
||||
// AxisAlignedBB axisalignedbb,
|
||||
// List arraylist,
|
||||
// Entity par7Entity
|
||||
//) {
|
||||
// AppEngMultiBlock blk = (AppEngMultiBlock) this.getBlockType();
|
||||
// if (par7Entity instanceof EntityItem && this.isMachineActive()
|
||||
// && this.Buffer.isEmpty()) {
|
||||
// blk.func_71905_a(
|
||||
// this.getForward() == ForgeDirection.WEST ? 0.005F : 0.0F,
|
||||
// this.getForward() == ForgeDirection.DOWN ? 0.005F : 0.0F,
|
||||
// this.getForward() == ForgeDirection.NORTH ? 0.005F : 0.0F,
|
||||
// this.getForward() == ForgeDirection.EAST ? 0.995F : 1.0F,
|
||||
// this.getForward() == ForgeDirection.UP ? 0.995F : 1.0F,
|
||||
// this.getForward() == ForgeDirection.SOUTH ? 0.995F : 1.0F
|
||||
// );
|
||||
// blk.configureCollidingBlockToList(
|
||||
// world, x, y, z, axisalignedbb, arraylist, par7Entity
|
||||
// );
|
||||
// blk.func_71905_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
// } else {
|
||||
// blk.func_71905_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
// blk.configureCollidingBlockToList(
|
||||
// world, x, y, z, axisalignedbb, arraylist, par7Entity
|
||||
// );
|
||||
// }
|
||||
//}
|
||||
|
||||
// TODO: this is to avoid Z-fighting. Put into renderer?
|
||||
//@Override
|
||||
//public AxisAlignedBB[] getSelectedBoundingBoxsFromPool(
|
||||
// World world, int x, int y, int z
|
||||
//) {
|
||||
// return new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox(
|
||||
// this.getForward() == ForgeDirection.WEST ? 0.004999999888241291 : 0.0,
|
||||
// this.getForward() == ForgeDirection.DOWN ? 0.004999999888241291 : 0.0,
|
||||
// this.getForward() == ForgeDirection.NORTH ? 0.004999999888241291 : 0.0,
|
||||
// this.getForward() == ForgeDirection.EAST ? 0.9950000047683716 : 1.0,
|
||||
// this.getForward() == ForgeDirection.UP ? 0.9950000047683716 : 1.0,
|
||||
// this.getForward() == ForgeDirection.SOUTH ? 0.9950000047683716 : 1.0
|
||||
// ) };
|
||||
//}
|
||||
|
||||
//public void setPrimaryOrientation(ForgeDirection s) {
|
||||
// this.orientation = s;
|
||||
// MinecraftForge.EVENT_BUS.post(
|
||||
// new GridTileConnectivityEvent(this, this.getWorld(), this.getLocation())
|
||||
// );
|
||||
//}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 398 B |
Binary file not shown.
After Width: | Height: | Size: 398 B |
Binary file not shown.
After Width: | Height: | Size: 410 B |
Binary file not shown.
After Width: | Height: | Size: 345 B |
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 2,
|
||||
"frames": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15
|
||||
]
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 296 B |
Binary file not shown.
After Width: | Height: | Size: 438 B |
Loading…
Reference in New Issue