Started work on the player detector.
This commit is contained in:
parent
08cbe33f00
commit
2c31b9211c
7 changed files with 88 additions and 0 deletions
src/main
java/techreborn
resources/assets/techreborn
lang
textures/blocks/machine
69
src/main/java/techreborn/blocks/BlockPlayerDetector.java
Normal file
69
src/main/java/techreborn/blocks/BlockPlayerDetector.java
Normal file
|
@ -0,0 +1,69 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPlayerDetector extends BlockMachineBase {
|
||||
|
||||
public BlockPlayerDetector() {
|
||||
super(Material.rock);
|
||||
setBlockName("techreborn.playerDetector");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{"all", "others", "you"};
|
||||
|
||||
private IIcon[] textures;
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par2) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metaData) {
|
||||
return metaData;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.textures = new IIcon[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:"
|
||||
+ "machine/player_detector_" + types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData) {
|
||||
return textures[MathHelper.clamp_int(metaData, 0, types.length - 1)];
|
||||
}
|
||||
|
||||
}
|
|
@ -63,6 +63,7 @@ public class ModBlocks {
|
|||
public static Block heatGenerator;
|
||||
public static Block industrialSawmill;
|
||||
public static Block chargeBench;
|
||||
public static Block playerDetector;
|
||||
|
||||
public static Block ore;
|
||||
public static Block storage;
|
||||
|
@ -122,6 +123,9 @@ public class ModBlocks {
|
|||
GameRegistry.registerBlock(chargeBench, "chargebench");
|
||||
GameRegistry.registerTileEntity(TileChargeBench.class, "TileChargeBench");
|
||||
|
||||
playerDetector = new BlockPlayerDetector();
|
||||
GameRegistry.registerBlock(playerDetector, ItemBlockPlayerDetector.class, "playerDetector");
|
||||
|
||||
MachineCasing = new BlockMachineCasing(Material.rock);
|
||||
GameRegistry.registerBlock(MachineCasing, ItemBlockMachineCasing.class, "machinecasing");
|
||||
GameRegistry.registerTileEntity(TileMachineCasing.class, "TileMachineCasingTR");
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package techreborn.itemblocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import reborncore.common.itemblock.ItemBlockBase;
|
||||
import techreborn.blocks.BlockPlayerDetector;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class ItemBlockPlayerDetector extends ItemBlockBase {
|
||||
public ItemBlockPlayerDetector(Block block) {
|
||||
super(ModBlocks.playerDetector, ModBlocks.playerDetector, BlockPlayerDetector.types);
|
||||
}
|
||||
}
|
|
@ -50,6 +50,9 @@ tile.techreborn.machineFrame.steel.name=Steel Machine Hull
|
|||
tile.techreborn.machineFrame.titanium.name=Titanium Machine Hull
|
||||
tile.techreborn.industrialsawmill.name=Saw Mill
|
||||
tile.techreborn.chargebench.name=Charge Bench
|
||||
tile.techreborn.playerDetector.all.name=Player Detector (All)
|
||||
tile.techreborn.playerDetector.others.name=Player Detector (Others)
|
||||
tile.techreborn.playerDetector.you.name=Player Detector (You)
|
||||
|
||||
#Ores
|
||||
tile.techreborn.ore.Galena.name=Galena Ore
|
||||
|
|
Binary file not shown.
After ![]() (image error) Size: 15 KiB |
Binary file not shown.
After ![]() (image error) Size: 15 KiB |
Binary file not shown.
After ![]() (image error) Size: 15 KiB |
Loading…
Add table
Reference in a new issue