Added dummy accelerator controller

This commit is contained in:
LemADEC 2017-07-15 11:02:50 +02:00
parent 76ab0d4ee1
commit 155491a0ea
2 changed files with 134 additions and 0 deletions

View file

@ -0,0 +1,70 @@
package cr0s.warpdrive.block.atomic;
import cr0s.warpdrive.Commons;
import cr0s.warpdrive.block.BlockAbstractContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockAcceleratorController extends BlockAbstractContainer {
@SideOnly(Side.CLIENT)
private IIcon[] icons;
public BlockAcceleratorController() {
super(Material.iron);
isRotating = true;
setBlockName("warpdrive.atomic.accelerator_controller");
setBlockTextureName("warpdrive:atomic/accelerator_controller");
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
icons = new IIcon[2];
icons[0] = iconRegister.registerIcon(getTextureName() + "-off");
icons[1] = iconRegister.registerIcon(getTextureName() + "-on");
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int side, int metadata) {
return icons[metadata % 2];
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
if (world.isRemote) {
return false;
}
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (!(tileEntity instanceof TileEntityAcceleratorController)) {
return false;
}
TileEntityAcceleratorController tileEntityAcceleratorController = (TileEntityAcceleratorController) tileEntity;
ItemStack itemStackHeld = entityPlayer.getHeldItem();
if (itemStackHeld == null) {// no sneaking and no item in hand => show status
Commons.addChatMessage(entityPlayer, tileEntityAcceleratorController.getStatus());
return true;
}
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileEntityAcceleratorController();
}
}

View file

@ -0,0 +1,64 @@
package cr0s.warpdrive.block.atomic;
import cr0s.warpdrive.api.IStarMapRegistryTileEntity;
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
import cr0s.warpdrive.data.StarMapRegistryItem.EnumStarMapEntryType;
import cr0s.warpdrive.data.VectorI;
import java.util.UUID;
import net.minecraft.block.Block;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityAcceleratorController extends TileEntityAbstractEnergy implements IStarMapRegistryTileEntity {
public TileEntityAcceleratorController() {
super();
}
@Override
public void updateEntity() {
super.updateEntity();
}
// IStarMapRegistryTileEntity overrides
@Override
public String getStarMapType() {
return EnumStarMapEntryType.ACCELERATOR.getName();
}
@Override
public UUID getUUID() {
return null;
}
@Override
public AxisAlignedBB getStarMapArea() {
return null;
}
@Override
public int getMass() {
return 0;
}
@Override
public double getIsolationRate() {
return 0.0;
}
@Override
public String getStarMapName() {
return null;
}
@Override
public void onBlockUpdatedInArea(final VectorI vector, final Block block, final int metadata) {
}
@Override
public String toString() {
return String.format("%s @ \'%s\' (%d %d %d)", getClass().getSimpleName(),
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(), xCoord, yCoord, zCoord);
}
}