Added radar block for searching other warp-cores
This commit is contained in:
parent
881fbf0388
commit
95bc6cf0d9
7 changed files with 450 additions and 44 deletions
|
@ -1,11 +1,8 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ITickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -15,7 +12,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockProtocol extends BlockContainer implements ITickHandler {
|
||||
public class BlockProtocol extends BlockContainer {
|
||||
private Icon[] iconBuffer;
|
||||
|
||||
private final int ICON_INACTIVE_SIDE = 0, ICON_BOTTOM = 1, ICON_TOP = 2, ICON_SIDE_ACTIVATED = 3;
|
||||
|
@ -104,28 +101,5 @@ public class BlockProtocol extends BlockContainer implements ITickHandler {
|
|||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void tickStart(EnumSet<TickType> type, Object... tickData) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void tickEnd(EnumSet<TickType> type, Object... tickData) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumSet<TickType> ticks() {
|
||||
return EnumSet.of(TickType.CLIENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return null;
|
||||
}
|
||||
}
|
102
src/cr0s/WarpDrive/BlockRadar.java
Normal file
102
src/cr0s/WarpDrive/BlockRadar.java
Normal file
|
@ -0,0 +1,102 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockRadar extends BlockContainer {
|
||||
private Icon[] iconBuffer;
|
||||
|
||||
private final int ICON_INACTIVE_SIDE = 0, ICON_BOTTOM = 1, ICON_TOP = 2, ICON_SIDE_ACTIVATED = 3, ICON_SIDE_ACTIVATED_SCAN = 4;
|
||||
|
||||
private ArrayList<TileEntityReactor> searchResults;
|
||||
|
||||
public BlockRadar(int id, int texture, Material material) {
|
||||
super(id, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
iconBuffer = new Icon[5];
|
||||
|
||||
iconBuffer[ICON_INACTIVE_SIDE] = par1IconRegister.registerIcon("warpdrive:radarSideInactive");
|
||||
iconBuffer[ICON_BOTTOM] = par1IconRegister.registerIcon("warpdrive:contBottom");
|
||||
iconBuffer[ICON_TOP] = par1IconRegister.registerIcon("warpdrive:contTop");
|
||||
|
||||
iconBuffer[ICON_SIDE_ACTIVATED] = par1IconRegister.registerIcon("warpdrive:radarSideActive");
|
||||
iconBuffer[ICON_SIDE_ACTIVATED_SCAN] = par1IconRegister.registerIcon("warpdrive:radarSideActiveScan");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int side, int metadata)
|
||||
{
|
||||
if (side == 0) {
|
||||
return iconBuffer[ICON_BOTTOM];
|
||||
} else
|
||||
if (side == 1) {
|
||||
return iconBuffer[ICON_TOP];
|
||||
}
|
||||
|
||||
if (metadata == 0) // Inactive state
|
||||
{
|
||||
return iconBuffer[ICON_INACTIVE_SIDE];
|
||||
} else if (metadata == 1) { // Attached state
|
||||
return iconBuffer[ICON_SIDE_ACTIVATED];
|
||||
} else if (metadata == 2) { // Scanning state
|
||||
return iconBuffer[ICON_SIDE_ACTIVATED_SCAN];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1) {
|
||||
return new TileEntityRadar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
||||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return this.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.SERVER)
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
TileEntityRadar radar = (TileEntityRadar)par1World.getBlockTileEntity(par2, par3, par4);
|
||||
|
||||
if (radar != null){
|
||||
par5EntityPlayer.sendChatToPlayer("[Radar] Energy level: " + radar.getCurrentEnergyValue() + " Eu");
|
||||
}
|
||||
}
|
||||
|
||||
WarpDrive.instance.registry.printRegistry();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -7,14 +7,13 @@ package cr0s.WarpDrive;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
import dan200.computer.api.IPeripheral;
|
||||
|
||||
/**
|
||||
* Protocol block tile entity
|
||||
* @author Cr0s
|
||||
|
@ -49,7 +48,8 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral {
|
|||
"get_attached_players", "summon", "summon_all", // 7, 8, 9
|
||||
"get_x", "get_y", "get_z", // 10, 11, 12
|
||||
"get_energy_level", "do_jump", "get_ship_size", // 13, 14, 15
|
||||
"set_beacon_frequency", "get_dx", "get_dz" // 16, 17, 18
|
||||
"set_beacon_frequency", "get_dx", "get_dz", // 16, 17, 18
|
||||
"set_core_frequency", // 19
|
||||
};
|
||||
|
||||
private int ticks = 0;
|
||||
|
@ -81,7 +81,7 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral {
|
|||
}
|
||||
|
||||
private void setMode(int mode) {
|
||||
System.out.println("Setting mode: " + mode);
|
||||
// System.out.println("Setting mode: " + mode);
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
|
@ -437,19 +437,19 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral {
|
|||
|
||||
case 10: // get_x
|
||||
if (core == null) {
|
||||
break;
|
||||
return null;
|
||||
}
|
||||
return new Object[] { (Integer)core.xCoord };
|
||||
|
||||
case 11: // get_y
|
||||
if (core == null) {
|
||||
break;
|
||||
return null;
|
||||
}
|
||||
return new Object[] { (Integer)core.yCoord };
|
||||
|
||||
case 12: // get_z
|
||||
if (core == null) {
|
||||
break;
|
||||
return null;
|
||||
}
|
||||
return new Object[] { (Integer)core.zCoord };
|
||||
|
||||
|
@ -458,7 +458,8 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral {
|
|||
{
|
||||
return new Object[] { (Integer)((TileEntityReactor)core).currentEnergyValue };
|
||||
}
|
||||
break;
|
||||
|
||||
return null;
|
||||
|
||||
case 14: // do_jump
|
||||
doJump();
|
||||
|
@ -489,7 +490,14 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral {
|
|||
if (core != null && core instanceof TileEntityReactor) {
|
||||
return new Object[] { (Integer)(((TileEntityReactor)core).dz) };
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 19: // set_core_frequency
|
||||
if (arguments.length == 1 && (core != null && core instanceof TileEntityReactor))
|
||||
{
|
||||
((TileEntityReactor)core).coreFrequency = ((String)arguments[0]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return new Integer[] { 0 };
|
||||
|
@ -535,7 +543,7 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral {
|
|||
* @param beaconFrequency the beaconFrequency to set
|
||||
*/
|
||||
public void setBeaconFrequency(String beaconFrequency) {
|
||||
System.out.println("Setting beacon freqency: " + beaconFrequency);
|
||||
//System.out.println("Setting beacon freqency: " + beaconFrequency);
|
||||
this.beaconFrequency = beaconFrequency;
|
||||
}
|
||||
|
||||
|
|
196
src/cr0s/WarpDrive/TileEntityRadar.java
Normal file
196
src/cr0s/WarpDrive/TileEntityRadar.java
Normal file
|
@ -0,0 +1,196 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
import ic2.api.Direction;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
|
||||
public class TileEntityRadar extends TileEntity implements IPeripheral, IEnergySink {
|
||||
|
||||
private final int MAX_ENERGY_VALUE = 100 * (1000 * 1000); // 100 000 000 Eu
|
||||
private int currentEnergyValue = 0;
|
||||
|
||||
private String[] methodsArray = {
|
||||
"scanRay", // 0
|
||||
"scanRadiusW", // 1
|
||||
"getResultsCountW", // 2
|
||||
"getResultW", // 3
|
||||
"getEnergyLevel" // 4
|
||||
};
|
||||
|
||||
private ArrayList<TileEntityReactor> results;
|
||||
|
||||
private int scanRadius = 0;
|
||||
private int cooldownTime = 0;
|
||||
|
||||
private boolean isEnergyEnoughForScanRadiusW(int radius) {
|
||||
int needEnergy = (radius * radius);
|
||||
|
||||
return ((getCurrentEnergyValue() - needEnergy) > 0);
|
||||
}
|
||||
|
||||
@SideOnly(Side.SERVER)
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 2) {
|
||||
if (cooldownTime++ > (20 * ((scanRadius / 1000) + 1))) {
|
||||
//System.out.println("Scanning...");
|
||||
results = WarpDrive.instance.registry.searchWarpCoresInRadius(xCoord, yCoord, zCoord, scanRadius);
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 + 2);
|
||||
|
||||
cooldownTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
|
||||
this.currentEnergyValue = tag.getInteger("energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
|
||||
tag.setInteger("energy", this.getCurrentEnergyValue());
|
||||
}
|
||||
|
||||
// IPeripheral methods implementation
|
||||
@Override
|
||||
public String getType() {
|
||||
return "radar";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return methodsArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] callMethod(IComputerAccess computer, int method, Object[] arguments) throws Exception {
|
||||
switch (method) {
|
||||
case 0: // scanRay (toX, toY, toZ)
|
||||
return new Object[] { -1 };
|
||||
|
||||
case 1: // scanRadiusW (radius)
|
||||
if (arguments.length == 1) {
|
||||
int radius;
|
||||
|
||||
try {
|
||||
radius = ((Double)arguments[0]).intValue();
|
||||
} catch (Exception e) { radius = 0; }
|
||||
|
||||
if (radius != 0 && isEnergyEnoughForScanRadiusW(radius)) {
|
||||
// Consume energy
|
||||
this.currentEnergyValue -= radius * radius;
|
||||
|
||||
//System.out.println("Start scanning...");
|
||||
// Begin searching
|
||||
scanRadius = radius;
|
||||
cooldownTime = 0;
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 2, 1 + 2);
|
||||
} else {
|
||||
results = null;
|
||||
System.out.println("Radius: " + radius + " | Enough energy: " + isEnergyEnoughForScanRadiusW(radius));
|
||||
}
|
||||
}
|
||||
|
||||
return new Object[] { 0 };
|
||||
|
||||
case 2: // getResultsCountW
|
||||
if (results != null) {
|
||||
return new Integer[] { results.size() };
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3: // getResultW
|
||||
if (arguments.length == 1 && (results != null)) {
|
||||
int index;
|
||||
|
||||
try {
|
||||
index = ((Double)arguments[0]).intValue();
|
||||
} catch (Exception e) { index = -1; }
|
||||
|
||||
if (index > -1 && index < results.size()) {
|
||||
|
||||
TileEntityReactor res = results.get(index);
|
||||
|
||||
return new Object[] { ((String)res.coreFrequency), ((Integer)res.xCoord), ((Integer)res.yCoord), ((Integer)res.zCoord) };
|
||||
}
|
||||
}
|
||||
|
||||
case 4:
|
||||
return new Integer[] { this.getCurrentEnergyValue()};
|
||||
|
||||
}
|
||||
|
||||
return new Object[] { 0 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttachToSide(int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attach(IComputerAccess computer) {
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 + 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach(IComputerAccess computer) {
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 1 + 2);
|
||||
}
|
||||
|
||||
// IEnergySink methods implementation
|
||||
@Override
|
||||
public int demandsEnergy() {
|
||||
return (MAX_ENERGY_VALUE - this.getCurrentEnergyValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int injectEnergy(Direction directionFrom, int amount) {
|
||||
// Избыток энергии
|
||||
int leftover = 0;
|
||||
|
||||
currentEnergyValue += amount;
|
||||
if (getCurrentEnergyValue() > MAX_ENERGY_VALUE) {
|
||||
leftover = (getCurrentEnergyValue() - MAX_ENERGY_VALUE);
|
||||
currentEnergyValue = MAX_ENERGY_VALUE;
|
||||
}
|
||||
|
||||
return leftover;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSafeInput() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsEnergyFrom(TileEntity emitter, Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAddedToEnergyNet() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the currentEnergyValue
|
||||
*/
|
||||
public int getCurrentEnergyValue() {
|
||||
return currentEnergyValue;
|
||||
}
|
||||
|
||||
}
|
|
@ -81,6 +81,11 @@ public class TileEntityReactor extends TileEntity implements IEnergySink {
|
|||
int cooldownTime = 0;
|
||||
private final int COOLDOWN_INTERVAL_SECONDS = 5;
|
||||
|
||||
private final int CORES_REGISTRY_UPDATE_INTERVAL_SECONDS = 10;
|
||||
private int registryUpdateTicks = 0;
|
||||
|
||||
public String coreFrequency = "default";
|
||||
|
||||
// = Привязка игроков =
|
||||
|
||||
public String coreState = "";
|
||||
|
@ -89,7 +94,15 @@ public class TileEntityReactor extends TileEntity implements IEnergySink {
|
|||
|
||||
@SideOnly(Side.SERVER)
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
public void updateEntity() {
|
||||
// Update warp core in cores registry
|
||||
if (registryUpdateTicks++ > CORES_REGISTRY_UPDATE_INTERVAL_SECONDS * 20) {
|
||||
registryUpdateTicks = 0;
|
||||
|
||||
WarpDrive.instance.registry.addToRegistry(this);
|
||||
}
|
||||
|
||||
|
||||
TileEntity c = findControllerBlock();
|
||||
|
||||
if (c != null) {
|
||||
|
@ -717,11 +730,30 @@ public class TileEntityReactor extends TileEntity implements IEnergySink {
|
|||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
currentEnergyValue = tag.getInteger("energy");
|
||||
coreFrequency = tag.getString("corefrequency");
|
||||
|
||||
WarpDrive.instance.registry.addToRegistry(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
tag.setInteger("energy", currentEnergyValue);
|
||||
|
||||
tag.setString("corefrequency", coreFrequency);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
WarpDrive.instance.registry.removeFromRegistry(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
|
||||
WarpDrive.instance.registry.addToRegistry(this);
|
||||
}
|
||||
}
|
||||
|
|
79
src/cr0s/WarpDrive/WarpCoresRegistry.java
Normal file
79
src/cr0s/WarpDrive/WarpCoresRegistry.java
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package cr0s.WarpDrive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author user
|
||||
*/
|
||||
public class WarpCoresRegistry {
|
||||
private ArrayList<TileEntityReactor> registry;
|
||||
public WarpCoresRegistry() {
|
||||
registry = new ArrayList<TileEntityReactor>();
|
||||
}
|
||||
|
||||
public int searchCoreInRegistry(TileEntityReactor core) {
|
||||
int res = -1;
|
||||
|
||||
for (int i = 0; i < registry.size(); i++) {
|
||||
TileEntityReactor c = registry.get(i);
|
||||
|
||||
if (c.xCoord == core.xCoord && c.yCoord == core.yCoord && c.zCoord == core.zCoord) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public boolean isCoreInRegistry(TileEntityReactor core) {
|
||||
return (searchCoreInRegistry(core) != -1);
|
||||
}
|
||||
|
||||
public void addToRegistry(TileEntityReactor core) {
|
||||
if (!isCoreInRegistry(core)) {
|
||||
registry.add(core);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFromRegistry(TileEntityReactor core) {
|
||||
int idx;
|
||||
|
||||
if ((idx = searchCoreInRegistry(core)) != -1) {
|
||||
registry.remove(idx);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<TileEntityReactor> searchWarpCoresInRadius(int x, int y, int z, int radius) {
|
||||
ArrayList<TileEntityReactor> res = new ArrayList<TileEntityReactor>();
|
||||
|
||||
for (TileEntityReactor c : registry) {
|
||||
double d3 = c.xCoord - x;
|
||||
double d4 = c.yCoord - y;
|
||||
double d5 = c.zCoord - z;
|
||||
|
||||
double distance = MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
|
||||
if (distance <= radius)
|
||||
{
|
||||
System.out.println("Scan: " + MathHelper.floor_double(distance) + " <= " + radius);
|
||||
res.add(c);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public void printRegistry() {
|
||||
System.out.println("WarpCores registry:");
|
||||
|
||||
for (TileEntityReactor c : registry) {
|
||||
System.out.println(c.coreFrequency + " (" + c.xCoord + "; " + c.yCoord + "; " + c.zCoord + ")");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,15 +31,19 @@ public class WarpDrive {
|
|||
|
||||
public final static int WARP_CORE_BLOCKID = 500;
|
||||
public final static int PROTOCOL_BLOCK_BLOCKID = 501;
|
||||
public final static int RADAR_BLOCK_BLOCKID = 502;
|
||||
|
||||
public final static Block warpCore = new BlockReactor(WARP_CORE_BLOCKID, 0, Material.rock)
|
||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone);
|
||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Warp Core");
|
||||
|
||||
public final static Block protocolBlock = new BlockProtocol(PROTOCOL_BLOCK_BLOCKID, 0, Material.rock)
|
||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone);
|
||||
|
||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Warp Controller");
|
||||
|
||||
public final static Block radarBlock = new BlockRadar(RADAR_BLOCK_BLOCKID, 0, Material.rock)
|
||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("W-Radar");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -52,6 +56,8 @@ public class WarpDrive {
|
|||
public static WarpDrive instance;
|
||||
@SidedProxy(clientSide = "cr0s.WarpDrive.client.ClientProxy", serverSide = "cr0s.WarpDrive.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public WarpCoresRegistry registry;
|
||||
|
||||
@PreInit
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
@ -61,14 +67,18 @@ public class WarpDrive {
|
|||
@Init
|
||||
public void load(FMLInitializationEvent event) {
|
||||
|
||||
LanguageRegistry.addName(warpCore, "Warp-drive Reactor Core");
|
||||
LanguageRegistry.addName(warpCore, "Warp Core");
|
||||
GameRegistry.registerBlock(warpCore, "warpCore");
|
||||
GameRegistry.registerTileEntity(TileEntityReactor.class, "warpCore");
|
||||
|
||||
LanguageRegistry.addName(protocolBlock, "Warp core controller block");
|
||||
LanguageRegistry.addName(protocolBlock, "Warp Controller");
|
||||
GameRegistry.registerBlock(protocolBlock, "protocolBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityProtocol.class, "protocolBlock");
|
||||
|
||||
LanguageRegistry.addName(radarBlock, "W-Radar");
|
||||
GameRegistry.registerBlock(radarBlock, "radarBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityRadar.class, "radarBlock");
|
||||
|
||||
proxy.registerRenderers();
|
||||
|
||||
EntityRegistry.registerModEntity(EntitySphereGen.class, "EntitySphereGenerator", 1, WarpDrive.instance, 100, 1, false);
|
||||
|
@ -90,7 +100,12 @@ public class WarpDrive {
|
|||
'i', Items.getItem("iridiumPlate"), 'm', Items.getItem("advancedMachine"), 'c', Items.getItem("advancedCircuit"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(protocolBlock), "iic", "imi", "cii",
|
||||
'i', Items.getItem("iridiumPlate"), 'm', Items.getItem("advancedMachine"), 'c', Items.getItem("advancedCircuit"));
|
||||
'i', Items.getItem("iridiumPlate"), 'm', Items.getItem("advancedMachine"), 'c', Items.getItem("advancedCircuit"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(radarBlock), "ifi", "imi", "imi",
|
||||
'i', Items.getItem("iridiumPlate"), 'm', Items.getItem("advancedMachine"), 'f', Items.getItem("frequencyTransmitter"));
|
||||
|
||||
registry = new WarpCoresRegistry();
|
||||
}
|
||||
|
||||
//@SideOnly(Side.SERVER)
|
||||
|
|
Loading…
Reference in a new issue