initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
603
java/src/game/init/BlockRegistry.java
Executable file
603
java/src/game/init/BlockRegistry.java
Executable file
|
@ -0,0 +1,603 @@
|
|||
package game.init;
|
||||
|
||||
import game.audio.SoundType;
|
||||
import game.block.*;
|
||||
import game.color.DyeColor;
|
||||
import game.init.FluidRegistry.LiquidType;
|
||||
import game.item.CheatTab;
|
||||
import game.material.Material;
|
||||
import game.renderer.ticked.TextureLavaFX;
|
||||
import game.renderer.ticked.TextureLavaFlowFX;
|
||||
import game.renderer.ticked.TextureWaterFX;
|
||||
import game.renderer.ticked.TextureWaterFlowFX;
|
||||
import game.world.State;
|
||||
|
||||
public abstract class BlockRegistry {
|
||||
private static final String AIR_ID = "air";
|
||||
public static final RegistryNamespacedDefaultedByKey<String, Block> REGISTRY = new RegistryNamespacedDefaultedByKey(AIR_ID);
|
||||
public static final ObjectIntIdentityMap<State> STATEMAP = new ObjectIntIdentityMap();
|
||||
|
||||
public static int getIdFromBlock(Block block) {
|
||||
return REGISTRY.getIDForObject(block);
|
||||
}
|
||||
|
||||
public static int getStateId(State state) {
|
||||
Block block = state.getBlock();
|
||||
return getIdFromBlock(block) + (block.getMetaFromState(state) << 12);
|
||||
}
|
||||
|
||||
public static Block getBlockById(int id) {
|
||||
return (Block)REGISTRY.getObjectById(id);
|
||||
}
|
||||
|
||||
public static State getStateById(int id) {
|
||||
int i = id & 4095;
|
||||
int j = id >> 12 & 15;
|
||||
return getBlockById(i).getStateFromMeta(j);
|
||||
}
|
||||
|
||||
public static Block getByNameOrId(String name) {
|
||||
Block block = REGISTRY.getObjectExact(name);
|
||||
if(block == null) {
|
||||
try {
|
||||
return REGISTRY.getObjectExact(Integer.parseInt(name));
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
return block;
|
||||
}
|
||||
|
||||
public static Block getByIdFallback(String name) {
|
||||
// String loc = StringUtils.trimColon(name);
|
||||
if(REGISTRY.containsKey(name)) {
|
||||
return REGISTRY.getObject(name);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
return REGISTRY.getObjectById(Integer.parseInt(name));
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String toIdName(State block) {
|
||||
int meta = block.getBlock().getMetaFromState(block);
|
||||
return REGISTRY.getNameForObject(block.getBlock()).toString() +
|
||||
((meta == block.getBlock().getMetaFromState(block.getBlock().getState())) ? "" : (":" + meta));
|
||||
}
|
||||
|
||||
public static State getFromIdName(String name, State def) {
|
||||
if(name == null) {
|
||||
return def;
|
||||
}
|
||||
String[] tok = name.split(":");
|
||||
if(tok.length < 1 || tok.length > 2) {
|
||||
return def;
|
||||
}
|
||||
Block block = getByNameOrId(tok[0]);
|
||||
// if(block == null) {
|
||||
// try {
|
||||
// block = getBlockById(Integer.parseUnsignedInt(tok[0]));
|
||||
// }
|
||||
// catch(NumberFormatException e) {
|
||||
// }
|
||||
// }
|
||||
if(block == null) {
|
||||
return def;
|
||||
}
|
||||
byte data;
|
||||
if(tok.length == 2) {
|
||||
try {
|
||||
int i = (byte)Integer.parseUnsignedInt(tok[1]);
|
||||
if(i >= 16) {
|
||||
return def;
|
||||
}
|
||||
data = (byte)i;
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
else {
|
||||
data = (byte)block.getMetaFromState(block.getState());
|
||||
}
|
||||
return block.getStateFromMeta(data);
|
||||
}
|
||||
|
||||
public static Block getRegisteredBlock(String name) {
|
||||
return REGISTRY.getObject(name);
|
||||
}
|
||||
|
||||
static void register() {
|
||||
REGISTRY.register(0, BlockRegistry.AIR_ID, (new BlockAir()).setDisplay("Luft"));
|
||||
registerBlocks();
|
||||
REGISTRY.validateKey();
|
||||
|
||||
for(Block block : REGISTRY) {
|
||||
if(block.getMaterial() != Material.air
|
||||
&& ((block instanceof BlockStairs) || /* (block instanceof BlockSlab) || */ (block instanceof BlockSlab)
|
||||
|| (block instanceof BlockFarmland) || block.isTranslucent() || block.getLightOpacity() == 0)) {
|
||||
block.setSumBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
for(Block block : REGISTRY) {
|
||||
for(State state : block.getValidStates()) {
|
||||
STATEMAP.put(state, REGISTRY.getIDForObject(block) << 4 | block.getMetaFromState(state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerBlock(int id, String name, Block block) {
|
||||
BlockRegistry.REGISTRY.register(id, name, block);
|
||||
}
|
||||
|
||||
private static void registerFluid(int idd, int ids, String name, String display, boolean infinite, LiquidType type, boolean opaque,
|
||||
int light, int rate, float radiation, Object still, Object flowing) {
|
||||
BlockDynamicLiquid dy = (BlockDynamicLiquid)(new BlockDynamicLiquid(type.material, infinite, opaque, rate)).setHardness(100.0F)
|
||||
.setLightOpacity(opaque ? 0 : 3).setLightLevel((float)light / 15.0f).setDisplay(display)
|
||||
.setRadiation(radiation);
|
||||
registerBlock(idd, "flowing_" + name, dy);
|
||||
BlockStaticLiquid st = (BlockStaticLiquid)(new BlockStaticLiquid(type.material, opaque, rate)).setHardness(100.0F)
|
||||
.setLightOpacity(opaque ? 0 : 3).setLightLevel((float)light / 15.0f).setDisplay(display)
|
||||
.setRadiation(radiation);
|
||||
registerBlock(ids, name, st);
|
||||
FluidRegistry.registerFluid(st, dy, still, flowing);
|
||||
}
|
||||
|
||||
private static void registerBlocks() {
|
||||
Block stone = (new BlockStone()).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.PISTON).setDisplay("Stein");
|
||||
registerBlock(1, "stone", stone);
|
||||
registerBlock(2, "bedrock", (new BlockBedrock()).setHardness(1000.0F).setResistance(100000.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Grundgestein").setTab(CheatTab.tabNature).setMiningLevel(6));
|
||||
registerBlock(3, "rock",
|
||||
(new BlockRock()).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.PISTON).setDisplay("Felsen"));
|
||||
registerBlock(4, "hellrock", (new BlockHellRock()).setHardness(0.4F).setStepSound(SoundType.PISTON).setDisplay("Höllenstein"));
|
||||
registerBlock(5, "cell_rock", (new Block(Material.clay)).setHardness(1.0F).setResistance(3.0F)
|
||||
.setStepSound(SoundType.SLIME).setDisplay("Zellstein").setTab(CheatTab.tabNature));
|
||||
registerBlock(6, "moon_rock", (new Block(Material.rock)).setHardness(2.5F).setResistance(10.0F)
|
||||
.setStepSound(SoundType.PISTON).setDisplay("Mondgestein").setTab(CheatTab.tabNature));
|
||||
Block cobblestone = (new Block(Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Bruchstein").setTab(CheatTab.tabNature);
|
||||
registerBlock(7, "cobblestone", cobblestone);
|
||||
registerBlock(8, "mossy_cobblestone", (new Block(Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Bemooster Bruchstein").setTab(CheatTab.tabNature));
|
||||
Block sandstone = (new BlockSandStone()).setStepSound(SoundType.PISTON).setHardness(0.8F).setDisplay("Sandstein");
|
||||
registerBlock(9, "sandstone", sandstone);
|
||||
registerBlock(10, "obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Obsidian").setMiningLevel(3));
|
||||
registerBlock(11, "clay",
|
||||
(new BlockClay()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Ton").setShovelHarvestable());
|
||||
registerBlock(12, "hardened_clay",
|
||||
(new BlockHardenedClay()).setHardness(1.25F).setResistance(7.0F).setStepSound(SoundType.PISTON).setDisplay("Gebrannter Ton"));
|
||||
registerBlock(13, "stained_hardened_clay", (new BlockColored(Material.rock)).setHardness(1.25F).setResistance(7.0F)
|
||||
.setStepSound(SoundType.PISTON).setDisplay("gefärbter Ton").setTab(CheatTab.tabNature));
|
||||
registerBlock(14, "coal_block", (new Block(Material.rock)).setHardness(5.0F).setResistance(10.0F)
|
||||
.setStepSound(SoundType.PISTON).setDisplay("Kohleblock").setTab(CheatTab.tabNature));
|
||||
registerBlock(15, "sand", (new BlockSand()).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Sand").setShovelHarvestable());
|
||||
registerBlock(16, "gravel",
|
||||
(new BlockGravel()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Kies").setShovelHarvestable());
|
||||
registerBlock(17, "ash",
|
||||
(new Block(Material.sand)).setHardness(0.2F).setStepSound(SoundType.SAND).setDisplay("Asche")
|
||||
.setTab(CheatTab.tabNature).setShovelHarvestable());
|
||||
registerBlock(18, "snow_layer", (new BlockSnow()).setHardness(0.1F).setStepSound(SoundType.SNOW).setDisplay("Schnee").setLightOpacity(0)
|
||||
.setShovelHarvestable());
|
||||
registerBlock(19, "snow",
|
||||
(new BlockSnowBlock()).setHardness(0.2F).setStepSound(SoundType.SNOW).setDisplay("Schnee").setShovelHarvestable());
|
||||
registerBlock(20, "ice",
|
||||
(new BlockIce()).setHardness(0.5F).setLightOpacity(3).setStepSound(SoundType.GLASS).setDisplay("Eis").setMiningLevel(0));
|
||||
registerBlock(21, "packed_ice",
|
||||
(new BlockPackedIce()).setHardness(0.5F).setStepSound(SoundType.GLASS).setDisplay("Packeis").setMiningLevel(0));
|
||||
registerBlock(22, "soul_sand",
|
||||
(new BlockSoulSand()).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Seelensand").setShovelHarvestable());
|
||||
registerBlock(23, "glowstone", (new BlockGlowstone(Material.glass)).setHardness(0.3F).setStepSound(SoundType.GLASS).setLightLevel(1.0F)
|
||||
.setDisplay("Glowstone"));
|
||||
|
||||
|
||||
registerFluid(32, 33, "water", "Wasser", true, LiquidType.WATER, false, 0, 5, 0.0f, TextureWaterFX.class, TextureWaterFlowFX.class);
|
||||
registerFluid(34, 35, "lava", "Lava", false, LiquidType.LAVA, true, 15, -30, 0.0f, 2, 3);
|
||||
registerFluid(36, 37, "magma", "Magma", false, LiquidType.HOT, true, 15, 40, 0.0f, TextureLavaFX.class, TextureLavaFlowFX.class);
|
||||
registerFluid(38, 39, "mercury", "Quecksilber", false, LiquidType.COLD, true, 0, 40, 0.0f, 8, 4);
|
||||
registerFluid(40, 41, "hydrogen", "Wasserstoff", false, LiquidType.COLD, true, 0, 50, 0.0f, 8, 4);
|
||||
registerFluid(42, 43, "acid", "Säure", false, LiquidType.HOT, false, 0, 5, 0.0f, 1, 1);
|
||||
registerFluid(44, 45, "slime", "Schleim", false, LiquidType.COLD, true, 0, 50, 0.0f, 8, 4);
|
||||
registerFluid(46, 47, "goo", "Klebrige Masse", false, LiquidType.COLD, true, 0, 60, 0.0f, 10, 5);
|
||||
registerFluid(48, 49, "nukage", "Radioaktive Masse", false, LiquidType.COLD, true, 10, 10, 4.0f, 2, 2);
|
||||
registerFluid(50, 51, "blood", "Blut", false, LiquidType.COLD, false, 0, 10, 0.0f, 2, 1);
|
||||
|
||||
|
||||
registerBlock(60, "coal_ore",
|
||||
(new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.PISTON).setDisplay("Steinkohle"));
|
||||
registerBlock(61, "lapis_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Lapislazulierz").setMiningLevel(1));
|
||||
registerBlock(62, "emerald_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Smaragderz").setMiningLevel(2));
|
||||
registerBlock(63, "quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Quarzerz"));
|
||||
registerBlock(64, "black_quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Schwarzes Quarzerz"));
|
||||
|
||||
registerBlock(68, "redstone_ore", (new BlockRedstoneOre(false)).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Redstone-Erz").setTab(CheatTab.tabGems).setMiningLevel(2));
|
||||
registerBlock(69, "lit_redstone_ore", (new BlockRedstoneOre(true)).setLightLevel(0.625F).setHardness(3.0F).setResistance(5.0F)
|
||||
.setStepSound(SoundType.PISTON).setDisplay("Redstone-Erz").setMiningLevel(2));
|
||||
int bid = 70;
|
||||
for(MetalType metal : MetalType.values()) {
|
||||
// String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1);
|
||||
registerBlock(bid++, metal.name + "_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay(metal.display + "erz").setMiningLevel(1).setLightLevel(metal.radioactivity > 0.0F ? 0.25F : 0.0F)
|
||||
.setRadiation(metal.radioactivity * 0.5f));
|
||||
}
|
||||
bid = 110;
|
||||
for(OreType ore : OreType.values()) {
|
||||
// String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1);
|
||||
registerBlock(bid++, ore.name + "_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay(ore.display + "erz").setMiningLevel(ore.material.getHarvestLevel() - 1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
registerBlock(128, "dirt",
|
||||
(new BlockDirt()).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Erde").setShovelHarvestable());
|
||||
registerBlock(129, "grass",
|
||||
(new BlockGrass()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Gras").setShovelHarvestable());
|
||||
registerBlock(130, "mycelium",
|
||||
(new BlockMycelium()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Myzel").setShovelHarvestable());
|
||||
registerBlock(131, "tian", (new Block(Material.rock)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Tian").setTab(CheatTab.tabNature));
|
||||
registerBlock(132, "tian_soil", (new BlockTianSoil()).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Tianerde").setTab(CheatTab.tabNature));
|
||||
registerBlock(133, "moon_cheese", (new BlockTreasure(Material.gourd)).setHardness(1.5F).setResistance(5.0F)
|
||||
.setStepSound(SoundType.CLOTH).setDisplay("Mondkäse").setTab(CheatTab.tabNature));
|
||||
registerBlock(134, "slime_block", (new BlockSlime()).setDisplay("Schleimblock").setStepSound(SoundType.SLIME));
|
||||
|
||||
|
||||
|
||||
|
||||
registerBlock(140, "tallgrass",
|
||||
(new BlockTallGrass()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Gras").setShearsEfficiency(0));
|
||||
registerBlock(141, "deadbush", (new BlockDeadBush()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Toter Busch"));
|
||||
registerBlock(142, "flower", (new BlockBaseFlower()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Blume"));
|
||||
registerBlock(143, "double_plant", new BlockDoublePlant().setDisplay("Pflanze"));
|
||||
registerBlock(144, "cactus", (new BlockCactus()).setHardness(0.4F).setStepSound(SoundType.CLOTH).setDisplay("Kaktus"));
|
||||
registerBlock(145, "reeds", (new BlockReed()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Zuckerrohr"));
|
||||
registerBlock(146, "vine",
|
||||
(new BlockVine()).setHardness(0.2F).setStepSound(SoundType.GRASS).setDisplay("Ranken").setShearsEfficiency(0));
|
||||
registerBlock(147, "waterlily", (new BlockLilyPad()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Seerosenblatt"));
|
||||
registerBlock(148, "cocoa",
|
||||
(new BlockCocoa()).setHardness(0.2F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay("Kakao"));
|
||||
|
||||
|
||||
|
||||
Block brownMushroom = (new BlockMushroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setLightLevel(0.125F)
|
||||
.setDisplay("Pilz");
|
||||
registerBlock(160, "brown_mushroom", brownMushroom);
|
||||
registerBlock(161, "brown_mushroom_block", (new BlockHugeMushroom(Material.wood, brownMushroom)).setHardness(0.2F)
|
||||
.setStepSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.tabPlants));
|
||||
Block redMushrooom = (new BlockMushroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Pilz");
|
||||
registerBlock(162, "red_mushroom", redMushrooom);
|
||||
registerBlock(163, "red_mushroom_block", (new BlockHugeMushroom(Material.wood, redMushrooom)).setHardness(0.2F)
|
||||
.setStepSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.tabPlants));
|
||||
registerBlock(164, "blue_mushroom", (new BlockBlueShroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setLightLevel(0.5F)
|
||||
.setDisplay("Tianpilz"));
|
||||
|
||||
Block pumpkin = (new BlockPumpkin()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Kürbis");
|
||||
registerBlock(170, "pumpkin", pumpkin);
|
||||
registerBlock(172, "pumpkin_stem", (new BlockStem(pumpkin)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Kürbisstamm"));
|
||||
Block melon = (new BlockMelon()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Melone");
|
||||
registerBlock(173, "melon_block", melon);
|
||||
registerBlock(174, "melon_stem", (new BlockStem(melon)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Melonenstamm"));
|
||||
|
||||
|
||||
registerBlock(179, "dry_leaves", (new BlockDryLeaves()).setDisplay("Vertrocknetes Laub"));
|
||||
bid = 180;
|
||||
for(WoodType wood : WoodType.values()) {
|
||||
registerBlock(bid++, wood.getName() + "_log", (new BlockLog()).setDisplay(wood.getDisplay() + "holz"));
|
||||
registerBlock(bid++, wood.getName() + "_leaves", (new BlockLeaves(wood)).setDisplay(wood.getDisplay() + "laub"));
|
||||
registerBlock(bid++, wood.getName() + "_sapling", (new BlockSapling(wood)).setHardness(0.0F).setStepSound(SoundType.GRASS)
|
||||
.setDisplay(wood.getDisplay() + "setzling"));
|
||||
}
|
||||
|
||||
registerBlock(254, "web", (new BlockWeb()).setLightOpacity(1).setHardness(4.0F).setDisplay("Spinnennetz"));
|
||||
registerBlock(255, "fire",
|
||||
(new BlockFire()).setHardness(0.0F).setLightLevel(1.0F).setStepSound(SoundType.CLOTH).setDisplay("Feuer"));
|
||||
|
||||
|
||||
|
||||
registerBlock(256, "lapis_block", (new Block(Material.iron)).setHardness(3.0F).setResistance(5.0F)
|
||||
.setStepSound(SoundType.PISTON).setDisplay("Lapislazuliblock").setTab(CheatTab.tabGems).setMiningLevel(1));
|
||||
registerBlock(257, "emerald_block", (new Block(Material.iron)).setHardness(5.0F).setResistance(10.0F)
|
||||
.setStepSound(SoundType.METAL).setDisplay("Smaragdblock").setTab(CheatTab.tabGems).setMiningLevel(2));
|
||||
registerBlock(258, "redstone_block", (new BlockCompressedPowered(Material.iron)).setHardness(5.0F).setResistance(10.0F)
|
||||
.setStepSound(SoundType.METAL).setDisplay("Redstone-Block").setTab(CheatTab.tabTech));
|
||||
|
||||
registerBlock(270, "glass",
|
||||
(new BlockGlass(Material.glass, false)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glas"));
|
||||
registerBlock(271, "stained_glass",
|
||||
(new BlockStainedGlass(Material.glass)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("gefärbtes Glas"));
|
||||
registerBlock(272, "glass_pane",
|
||||
(new BlockPane(Material.glass, false)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glasscheibe"));
|
||||
registerBlock(273, "stained_glass_pane",
|
||||
(new BlockStainedGlassPane()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("gefärbte Glasscheibe"));
|
||||
|
||||
|
||||
|
||||
registerBlock(280, "wool", (new BlockColored(Material.cloth)).setHardness(0.8F).setStepSound(SoundType.CLOTH).setDisplay("Wolle")
|
||||
.setShearsEfficiency(1));
|
||||
registerBlock(281, "carpet",
|
||||
(new BlockCarpet()).setHardness(0.1F).setStepSound(SoundType.CLOTH).setDisplay("Teppich").setLightOpacity(0));
|
||||
bid = 282;
|
||||
for(DyeColor color : BlockBed.COLORS) {
|
||||
registerBlock(bid++, color.getName() + "_bed", (new BlockBed(color)).setStepSound(SoundType.WOOD).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett"));
|
||||
}
|
||||
|
||||
registerBlock(300, "ladder",
|
||||
(new BlockLadder()).setHardness(0.4F).setStepSound(SoundType.LADDER).setDisplay("Leiter").setAxeHarvestable());
|
||||
registerBlock(301, "torch",
|
||||
(new BlockTorch()).setHardness(0.0F).setLightLevel(0.9375F).setStepSound(SoundType.WOOD).setDisplay("Fackel"));
|
||||
registerBlock(302, "lamp", (new Block(Material.glass)).setHardness(0.3F).setStepSound(SoundType.GLASS).setLightLevel(1.0F)
|
||||
.setDisplay("Lampe").setTab(CheatTab.tabTech));
|
||||
registerBlock(304, "bookshelf", (new BlockBookshelf()).setHardness(1.5F).setStepSound(SoundType.WOOD).setDisplay("Bücherregal"));
|
||||
registerBlock(305, "cake", (new BlockCake()).setHardness(0.5F).setStepSound(SoundType.CLOTH).setDisplay("Kuchen"));
|
||||
registerBlock(306, "dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setStepSound(SoundType.PISTON)
|
||||
.setLightLevel(0.125F).setDisplay("Drachenei").setTab(CheatTab.tabDeco));
|
||||
registerBlock(307, "flower_pot", (new BlockFlowerPot()).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf"));
|
||||
registerBlock(308, "sponge", (new Block(Material.sponge)).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Schwamm")
|
||||
.setTab(CheatTab.tabDeco));
|
||||
registerBlock(309, "skull", (new BlockSkull()).setHardness(1.0F).setStepSound(SoundType.PISTON).setDisplay("Kopf"));
|
||||
registerBlock(310, "lit_pumpkin",
|
||||
(new BlockPumpkin()).setHardness(1.0F).setStepSound(SoundType.WOOD).setLightLevel(1.0F).setDisplay("Kürbislaterne"));
|
||||
registerBlock(311, "hay_block", (new BlockHay()).setHardness(0.5F).setStepSound(SoundType.GRASS).setDisplay("Strohballen")
|
||||
.setTab(CheatTab.tabDeco));
|
||||
registerBlock(312, "sign",
|
||||
(new BlockStandingSign()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Schild"));
|
||||
registerBlock(313, "wall_sign",
|
||||
(new BlockWallSign()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Schild"));
|
||||
registerBlock(314, "banner",
|
||||
(new BlockBanner.BlockBannerStanding()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Banner"));
|
||||
registerBlock(315, "wall_banner",
|
||||
(new BlockBanner.BlockBannerHanging()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Banner"));
|
||||
|
||||
registerBlock(390, "portal",
|
||||
(new BlockPortal()).setHardness(0.0F).setStepSound(SoundType.GLASS).setLightLevel(0.75F).setDisplay("Portal"));
|
||||
registerBlock(391, "floor_portal", (new BlockFloorPortal(Material.portal)).setHardness(0.0F).setDisplay("Portal"));
|
||||
registerBlock(392, "portal_frame", (new BlockPortalFrame()).setStepSound(SoundType.GLASS).setLightLevel(0.125F).setHardness(5.0F)
|
||||
.setDisplay("Portalrahmen").setResistance(2000.0F).setTab(CheatTab.tabTech));
|
||||
|
||||
registerBlock(400, "farmland", (new BlockFarmland()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Ackerboden")
|
||||
.setShovelHarvestable().setTab(CheatTab.tabPlants));
|
||||
registerBlock(401, "wheat", (new BlockCrops()).setDisplay("Getreide"));
|
||||
registerBlock(402, "carrot", (new BlockCarrot()).setDisplay("Karotten"));
|
||||
registerBlock(403, "potato", (new BlockPotato()).setDisplay("Kartoffeln"));
|
||||
registerBlock(404, "soul_wart", (new BlockWart()).setDisplay("Seelenwarze"));
|
||||
|
||||
|
||||
|
||||
|
||||
bid = 500;
|
||||
for(MetalType metal : MetalType.values()) {
|
||||
// String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1);
|
||||
registerBlock(bid++, metal.name + "_block",
|
||||
(new Block(Material.iron)).setHardness(5.0F).setResistance(10.0F).setStepSound(SoundType.METAL)
|
||||
.setDisplay(metal.display + "block").setTab(CheatTab.tabGems).setMiningLevel(1)
|
||||
.setLightLevel(metal.radioactivity > 0.0F ? 0.25F : 0.0F).setRadiation(metal.radioactivity * 2.0f));
|
||||
}
|
||||
bid = 540;
|
||||
for(OreType ore : OreType.values()) {
|
||||
// String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1);
|
||||
registerBlock(bid++, ore.name + "_block",
|
||||
(new Block(Material.iron)).setHardness(5.0F).setResistance(10.0F).setStepSound(SoundType.METAL)
|
||||
.setDisplay(ore.display + "block").setTab(CheatTab.tabGems)
|
||||
.setMiningLevel(ore.material.getHarvestLevel() - 1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
registerBlock(600, "stone_slab",
|
||||
(new BlockSlab(Material.rock, "stone_slab_side", "double_stone_top", "double_stone_top"))
|
||||
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON).setDisplay("Steinstufe"));
|
||||
registerBlock(601, "stone_stairs", (new BlockStairs(stone.getState())).setDisplay("Steintreppe"));
|
||||
|
||||
registerBlock(610, "cobblestone_slab",
|
||||
(new BlockSlab(Material.rock, "cobblestone"))
|
||||
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON).setDisplay("Bruchsteinstufe"));
|
||||
registerBlock(611, "cobblestone_stairs", (new BlockStairs(cobblestone.getState())).setDisplay("Bruchsteintreppe"));
|
||||
registerBlock(612, "cobblestone_wall", (new BlockWall(cobblestone)).setDisplay("Bruchsteinmauer"));
|
||||
|
||||
registerBlock(620, "sandstone_slab",
|
||||
(new BlockSlab(Material.rock, "sandstone_normal", "sandstone_bottom", "sandstone_all"))
|
||||
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON).setDisplay("Sandsteinstufe"));
|
||||
registerBlock(621, "sandstone_stairs",
|
||||
(new BlockStairs(sandstone.getState().withProperty(BlockSandStone.TYPE, BlockSandStone.EnumType.DEFAULT),
|
||||
"sandstone_bottom", "sandstone_all")) // fix type
|
||||
.setDisplay("Sandsteintreppe"));
|
||||
|
||||
Block quartz = (new BlockQuartz("")).setStepSound(SoundType.PISTON).setHardness(0.8F).setDisplay("Quarzblock");
|
||||
registerBlock(630, "quartz_block", quartz);
|
||||
registerBlock(631, "quartz_slab",
|
||||
(new BlockSlab(Material.rock, "quartz_block_side", "quartz_block_bottom", "quartz_top"))
|
||||
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON).setDisplay("Quarzstufe"));
|
||||
registerBlock(632, "quartz_stairs",
|
||||
(new BlockStairs(quartz.getState().withProperty(BlockQuartz.VARIANT, BlockQuartz.EnumType.DEFAULT),
|
||||
"quartz_block_bottom", "quartz_top"))
|
||||
.setDisplay("Quarztreppe"));
|
||||
|
||||
registerBlock(640, "iron_bars", (new BlockPane(Material.iron, true)).setHardness(5.0F).setResistance(10.0F).setStepSound(SoundType.METAL)
|
||||
.setDisplay("Eisengitter"));
|
||||
registerBlock(641, "iron_door",
|
||||
(new BlockDoor(Material.iron)).setHardness(5.0F).setStepSound(SoundType.METAL).setDisplay("Eisentür"));
|
||||
registerBlock(642, "iron_trapdoor",
|
||||
(new BlockTrapDoor(Material.iron)).setHardness(5.0F).setStepSound(SoundType.METAL).setDisplay("Eisenfalltür"));
|
||||
|
||||
Block brick = (new Block(Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Ziegelsteine").setTab(CheatTab.tabBlocks);
|
||||
registerBlock(650, "brick_block", brick);
|
||||
registerBlock(651, "brick_slab",
|
||||
(new BlockSlab(Material.rock, "brick_block"))
|
||||
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON).setDisplay("Ziegelstufe"));
|
||||
registerBlock(652, "brick_stairs", (new BlockStairs(brick.getState())).setDisplay("Ziegeltreppe"));
|
||||
|
||||
Block stonebrick = (new BlockStoneBrick()).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Steinziegel");
|
||||
registerBlock(660, "stonebrick", stonebrick);
|
||||
registerBlock(661, "stonebrick_slab",
|
||||
(new BlockSlab(Material.rock, "stonebrick_default"))
|
||||
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON).setDisplay("Steinziegelstufe"));
|
||||
registerBlock(662, "stonebrick_stairs",
|
||||
(new BlockStairs(stonebrick.getState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.DEFAULT)))
|
||||
.setDisplay("Steinziegeltreppe"));
|
||||
|
||||
|
||||
Block bloodBrick = (new Block(Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Blutrote Ziegel").setTab(CheatTab.tabBlocks);
|
||||
registerBlock(670, "blood_brick", bloodBrick);
|
||||
registerBlock(671, "blood_brick_slab",
|
||||
(new BlockSlab(Material.rock, "blood_brick"))
|
||||
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON).setDisplay("Blutrote Ziegelstufe"));
|
||||
registerBlock(672, "blood_brick_fence", (new BlockFence(Material.rock, "blood_brick")).setHardness(2.0F).setResistance(10.0F)
|
||||
.setStepSound(SoundType.PISTON).setDisplay("Blutroter Ziegelzaun"));
|
||||
registerBlock(673, "blood_brick_stairs", (new BlockStairs(bloodBrick.getState())).setDisplay("Blutrote Ziegeltreppe"));
|
||||
|
||||
|
||||
Block blackBrick = (new Block(Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Schwarze Ziegel").setTab(CheatTab.tabBlocks);
|
||||
registerBlock(680, "black_brick", blackBrick);
|
||||
registerBlock(681, "black_brick_slab",
|
||||
(new BlockSlab(Material.rock, "black_brick"))
|
||||
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON).setDisplay("Schwarze Ziegelstufe"));
|
||||
registerBlock(682, "black_brick_stairs", (new BlockStairs(blackBrick.getState())).setDisplay("Schwarze Ziegeltreppe"));
|
||||
registerBlock(683, "black_brick_fence", (new BlockFence(Material.rock, "black_brick")).setHardness(2.0F).setResistance(10.0F)
|
||||
.setStepSound(SoundType.PISTON).setDisplay("Schwarzer Ziegelzaun"));
|
||||
|
||||
Block bquartz = (new BlockQuartz("black_")).setStepSound(SoundType.PISTON).setHardness(0.8F).setDisplay("Schwarzer Quarzblock");
|
||||
registerBlock(690, "black_quartz_block", bquartz);
|
||||
registerBlock(691, "black_quartz_slab",
|
||||
(new BlockSlab(Material.rock, "black_quartz_block_side", "black_quartz_block_bottom", "black_quartz_top"))
|
||||
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON).setDisplay("Schwarze Quarzstufe"));
|
||||
registerBlock(692, "black_quartz_stairs",
|
||||
(new BlockStairs(bquartz.getState().withProperty(BlockQuartz.VARIANT, BlockQuartz.EnumType.DEFAULT),
|
||||
"black_quartz_block_bottom", "black_quartz_top"))
|
||||
.setDisplay("Schwarze Quarztreppe"));
|
||||
|
||||
bid = 700;
|
||||
for(DecoType deco : DecoType.values()) {
|
||||
registerBlock(bid++, deco.name, (new Block(Material.rock)).setHardness(2.0F).setResistance(10.0F)
|
||||
.setStepSound(SoundType.PISTON).setDisplay(deco.display).setTab(CheatTab.tabBlocks));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
registerBlock(1000, "trapdoor",
|
||||
(new BlockTrapDoor(Material.wood)).setHardness(3.0F).setStepSound(SoundType.WOOD).setDisplay("Holzfalltür"));
|
||||
bid = 1100;
|
||||
for(WoodType wood : WoodType.values()) {
|
||||
Block planks = (new Block(Material.wood)).setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD)
|
||||
.setDisplay(wood.getDisplay() + "holzbretter").setTab(CheatTab.tabWood);
|
||||
registerBlock(bid++, wood.getName() + "_planks", planks);
|
||||
registerBlock(bid++, wood.getName() + "_stairs", (new BlockStairs(planks.getState()))
|
||||
.setDisplay(wood.getDisplay() + "holztreppe"));
|
||||
registerBlock(bid++, wood.getName() + "_slab", (new BlockSlab(Material.wood, wood.getName() + "_planks"))
|
||||
.setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzstufe"));
|
||||
registerBlock(bid++, wood.getName() + "_fence", (new BlockFence(Material.wood, wood.getName() + "_planks"))
|
||||
.setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzaun"));
|
||||
registerBlock(bid++, wood.getName() + "_fence_gate", (new BlockFenceGate(wood)).setHardness(2.0F).setResistance(5.0F)
|
||||
.setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzauntor"));
|
||||
registerBlock(bid++, wood.getName() + "_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(SoundType.WOOD)
|
||||
.setDisplay(wood.getDisplay() + "holztür"));
|
||||
}
|
||||
|
||||
|
||||
registerBlock(2000, "core", new BlockCore().setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Chunk-Lade-Kern"));
|
||||
registerBlock(2001, "mob_spawner",
|
||||
(new BlockMobSpawner()).setHardness(5.0F).setStepSound(SoundType.METAL).setDisplay("Monsterspawner"));
|
||||
registerBlock(2002, "crafting_table", (new BlockWorkbench()).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Werkbank"));
|
||||
registerBlock(2003, "furnace", (new BlockFurnace(false)).setHardness(3.5F).setStepSound(SoundType.PISTON).setDisplay("Ofen")
|
||||
.setTab(CheatTab.tabTech));
|
||||
registerBlock(2004, "lit_furnace", (new BlockFurnace(true)).setHardness(3.5F).setStepSound(SoundType.PISTON).setLightLevel(0.875F)
|
||||
.setDisplay("Ofen (Gefeuert)").setTab(CheatTab.tabTech));
|
||||
registerBlock(2005, "anvil",
|
||||
(new BlockAnvil()).setHardness(5.0F).setStepSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay("Amboss"));
|
||||
registerBlock(2006, "enchanting_table",
|
||||
(new BlockEnchantmentTable()).setHardness(5.0F).setResistance(2000.0F).setDisplay("Zaubertisch"));
|
||||
registerBlock(2007, "brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLightLevel(0.125F).setDisplay("Braustand"));
|
||||
registerBlock(2008, "cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel"));
|
||||
registerBlock(2009, "beacon", (new BlockBeacon()).setDisplay("Leuchtfeuer").setLightLevel(1.0F));
|
||||
registerBlock(2010, "noteblock", (new BlockNote()).setHardness(0.8F).setDisplay("Notenblock"));
|
||||
registerBlock(2011, "jukebox",
|
||||
(new BlockJukebox()).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.PISTON).setDisplay("Plattenspieler"));
|
||||
|
||||
registerBlock(2100, "chest", (new BlockChest(0)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Truhe"));
|
||||
registerBlock(2101, "trapped_chest", (new BlockChest(1)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Redstonetruhe"));
|
||||
registerBlock(2102, "warp_chest", (new BlockWarpChest()).setHardness(22.5F).setResistance(1000.0F).setStepSound(SoundType.PISTON)
|
||||
.setDisplay("Warptruhe").setLightLevel(0.5F));
|
||||
|
||||
registerBlock(2200, "tnt", (new BlockTNT()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("TNT"));
|
||||
registerBlock(2201, "nuke", (new BlockNuke()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("T-17"));
|
||||
|
||||
registerBlock(2300, "piston", (new BlockPistonBase(false)).setDisplay("Kolben"));
|
||||
registerBlock(2301, "sticky_piston", (new BlockPistonBase(true)).setDisplay("Klebriger Kolben"));
|
||||
registerBlock(2302, "piston_head", (new BlockPistonHead()).setDisplay("Kolben"));
|
||||
registerBlock(2303, "piston_extension", new BlockPistonMoving().setDisplay("Kolben"));
|
||||
registerBlock(2304, "dispenser", (new BlockDispenser()).setHardness(3.5F).setStepSound(SoundType.PISTON).setDisplay("Werfer"));
|
||||
registerBlock(2305, "dropper", (new BlockDropper()).setHardness(3.5F).setStepSound(SoundType.PISTON).setDisplay("Spender"));
|
||||
registerBlock(2306, "hopper",
|
||||
(new BlockHopper()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.METAL).setDisplay("Trichter"));
|
||||
registerBlock(2307, "tian_reactor",
|
||||
(new BlockTianReactor()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.METAL).setDisplay("Tianreaktor"));
|
||||
|
||||
registerBlock(2400, "rail", (new BlockRail()).setHardness(0.7F).setStepSound(SoundType.METAL).setDisplay("Schiene").setMiningLevel(0));
|
||||
registerBlock(2401, "golden_rail",
|
||||
(new BlockRailPowered()).setHardness(0.7F).setStepSound(SoundType.METAL).setDisplay("Antriebsschiene").setMiningLevel(0));
|
||||
registerBlock(2402, "detector_rail",
|
||||
(new BlockRailDetector()).setHardness(0.7F).setStepSound(SoundType.METAL).setDisplay("Sensorschiene").setMiningLevel(0));
|
||||
registerBlock(2403, "activator_rail",
|
||||
(new BlockRailPowered()).setHardness(0.7F).setStepSound(SoundType.METAL).setDisplay("Aktivierungsschiene").setMiningLevel(0));
|
||||
|
||||
registerBlock(2500, "lever", (new BlockLever()).setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Hebel"));
|
||||
|
||||
registerBlock(2510, "stone_pressure_plate", (new BlockPressurePlate(Material.rock, BlockPressurePlate.Sensitivity.MOBS)).setHardness(0.5F)
|
||||
.setStepSound(SoundType.PISTON).setDisplay("Steindruckplatte"));
|
||||
registerBlock(2511, "wooden_pressure_plate", (new BlockPressurePlate(Material.wood, BlockPressurePlate.Sensitivity.EVERYTHING))
|
||||
.setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Holzdruckplatte"));
|
||||
registerBlock(2512, "light_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.iron, 15)).setHardness(0.5F)
|
||||
.setStepSound(SoundType.WOOD).setDisplay("Wägeplatte (niedrige Gewichte)"));
|
||||
registerBlock(2513, "heavy_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.iron, 150)).setHardness(0.5F)
|
||||
.setStepSound(SoundType.WOOD).setDisplay("Wägeplatte (hohe Gewichte)"));
|
||||
|
||||
registerBlock(2520, "stone_button", (new BlockButton(false, 20, "stone")).setHardness(0.5F).setStepSound(SoundType.PISTON).setDisplay("Knopf"));
|
||||
registerBlock(2521, "wooden_button", (new BlockButton(true, 30, "oak_planks")).setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Knopf"));
|
||||
registerBlock(2522, "red_button", (new BlockButton(true, 10, "red_button")).setHardness(0.5F).setStepSound(SoundType.PISTON).setDisplay("Knopf"));
|
||||
|
||||
registerBlock(2600, "redstone",
|
||||
(new BlockRedstoneWire()).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Redstone-Staub"));
|
||||
registerBlock(2601, "unlit_redstone_torch",
|
||||
(new BlockRedstoneTorch(false)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Fackel"));
|
||||
registerBlock(2602, "redstone_torch", (new BlockRedstoneTorch(true)).setHardness(0.0F).setLightLevel(0.5F).setStepSound(SoundType.WOOD)
|
||||
.setDisplay("Redstone-Fackel").setTab(CheatTab.tabTech));
|
||||
registerBlock(2603, "repeater",
|
||||
(new BlockRedstoneRepeater(false)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Verstärker"));
|
||||
registerBlock(2604, "powered_repeater",
|
||||
(new BlockRedstoneRepeater(true)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Verstärker"));
|
||||
registerBlock(2605, "comparator",
|
||||
(new BlockRedstoneComparator(false)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Komparator"));
|
||||
registerBlock(2606, "powered_comparator", (new BlockRedstoneComparator(true)).setHardness(0.0F).setLightLevel(0.625F)
|
||||
.setStepSound(SoundType.WOOD).setDisplay("Redstone-Komparator"));
|
||||
registerBlock(2607, "redstone_lamp", (new BlockRedstoneLight(false)).setHardness(0.3F).setStepSound(SoundType.GLASS)
|
||||
.setDisplay("Redstone-Lampe").setTab(CheatTab.tabTech));
|
||||
registerBlock(2608, "lit_redstone_lamp",
|
||||
(new BlockRedstoneLight(true)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Redstone-Lampe"));
|
||||
registerBlock(2609, "daylight_detector", new BlockDaylightDetector(false).setDisplay("Tageslichtsensor"));
|
||||
registerBlock(2610, "daylight_detector_inverted", new BlockDaylightDetector(true).setDisplay("Tageslichtsensor"));
|
||||
registerBlock(2611, "tripwire_hook", (new BlockTripWireHook()).setDisplay("Haken"));
|
||||
registerBlock(2612, "string", (new BlockTripWire()).setDisplay("Stolperdraht").setShearsEfficiency(0));
|
||||
}
|
||||
}
|
351
java/src/game/init/Blocks.java
Executable file
351
java/src/game/init/Blocks.java
Executable file
|
@ -0,0 +1,351 @@
|
|||
package game.init;
|
||||
|
||||
import game.block.Block;
|
||||
import game.block.BlockBeacon;
|
||||
import game.block.BlockBed;
|
||||
import game.block.BlockBush;
|
||||
import game.block.BlockCactus;
|
||||
import game.block.BlockCauldron;
|
||||
import game.block.BlockChest;
|
||||
import game.block.BlockDaylightDetector;
|
||||
import game.block.BlockDeadBush;
|
||||
import game.block.BlockDoublePlant;
|
||||
import game.block.BlockDryLeaves;
|
||||
import game.block.BlockDynamicLiquid;
|
||||
import game.block.BlockFire;
|
||||
import game.block.BlockFlower;
|
||||
import game.block.BlockGrass;
|
||||
import game.block.BlockHopper;
|
||||
import game.block.BlockLeaves;
|
||||
import game.block.BlockMycelium;
|
||||
import game.block.BlockOre;
|
||||
import game.block.BlockPistonBase;
|
||||
import game.block.BlockPistonHead;
|
||||
import game.block.BlockPistonMoving;
|
||||
import game.block.BlockPortal;
|
||||
import game.block.BlockRedstoneComparator;
|
||||
import game.block.BlockRedstoneRepeater;
|
||||
import game.block.BlockRedstoneWire;
|
||||
import game.block.BlockReed;
|
||||
import game.block.BlockSand;
|
||||
import game.block.BlockSkull;
|
||||
import game.block.BlockSlab;
|
||||
import game.block.BlockStainedGlass;
|
||||
import game.block.BlockStainedGlassPane;
|
||||
import game.block.BlockStaticLiquid;
|
||||
import game.block.BlockTallGrass;
|
||||
import game.block.BlockTianReactor;
|
||||
import game.block.BlockTripWireHook;
|
||||
|
||||
|
||||
public abstract class Blocks {
|
||||
public static final Block air = get("air");
|
||||
public static final Block stone = get("stone");
|
||||
public static final BlockGrass grass = (BlockGrass)get("grass");
|
||||
public static final Block dirt = get("dirt");
|
||||
public static final Block cobblestone = get("cobblestone");
|
||||
public static final Block oak_planks = get("oak_planks");
|
||||
public static final Block spruce_planks = get("spruce_planks");
|
||||
public static final Block birch_planks = get("birch_planks");
|
||||
public static final Block maple_planks = get("maple_planks");
|
||||
public static final Block jungle_planks = get("jungle_planks");
|
||||
public static final Block acacia_planks = get("acacia_planks");
|
||||
public static final Block dark_oak_planks = get("dark_oak_planks");
|
||||
public static final Block cherry_planks = get("cherry_planks");
|
||||
public static final Block oak_sapling = get("oak_sapling");
|
||||
public static final Block spruce_sapling = get("spruce_sapling");
|
||||
public static final Block birch_sapling = get("birch_sapling");
|
||||
public static final Block jungle_sapling = get("jungle_sapling");
|
||||
public static final Block acacia_sapling = get("acacia_sapling");
|
||||
public static final Block dark_oak_sapling = get("dark_oak_sapling");
|
||||
public static final Block cherry_sapling = get("cherry_sapling");
|
||||
public static final Block maple_sapling = get("maple_sapling");
|
||||
public static final Block bedrock = get("bedrock");
|
||||
public static final BlockDynamicLiquid flowing_water = (BlockDynamicLiquid)get("flowing_water");
|
||||
public static final BlockStaticLiquid water = (BlockStaticLiquid)get("water");
|
||||
public static final BlockDynamicLiquid flowing_lava = (BlockDynamicLiquid)get("flowing_lava");
|
||||
public static final BlockStaticLiquid lava = (BlockStaticLiquid)get("lava");
|
||||
public static final BlockSand sand = (BlockSand)get("sand");
|
||||
public static final Block gravel = get("gravel");
|
||||
public static final BlockOre gold_ore = (BlockOre)get("gold_ore");
|
||||
public static final BlockOre iron_ore = (BlockOre)get("iron_ore");
|
||||
public static final BlockOre coal_ore = (BlockOre)get("coal_ore");
|
||||
public static final BlockOre lead_ore = (BlockOre)get("lead_ore");
|
||||
public static final BlockOre copper_ore = (BlockOre)get("copper_ore");
|
||||
public static final Block oak_log = get("oak_log");
|
||||
public static final Block spruce_log = get("spruce_log");
|
||||
public static final Block birch_log = get("birch_log");
|
||||
public static final Block jungle_log = get("jungle_log");
|
||||
public static final Block acacia_log = get("acacia_log");
|
||||
public static final Block dark_oak_log = get("dark_oak_log");
|
||||
public static final Block cherry_log = get("cherry_log");
|
||||
public static final Block maple_log = get("maple_log");
|
||||
public static final Block tian_log = get("tian_log");
|
||||
public static final Block oak_slab = get("oak_slab");
|
||||
public static final Block spruce_slab = get("spruce_slab");
|
||||
public static final Block birch_slab = get("birch_slab");
|
||||
public static final Block jungle_slab = get("jungle_slab");
|
||||
public static final Block acacia_slab = get("acacia_slab");
|
||||
public static final Block dark_oak_slab = get("dark_oak_slab");
|
||||
public static final Block cherry_slab = get("cherry_slab");
|
||||
public static final Block maple_slab = get("maple_slab");
|
||||
public static final Block cobblestone_slab = get("cobblestone_slab");
|
||||
public static final Block brick_slab = get("brick_slab");
|
||||
public static final Block blood_brick_slab = get("blood_brick_slab");
|
||||
public static final Block quartz_slab = get("quartz_slab");
|
||||
public static final BlockDryLeaves dry_leaves = (BlockDryLeaves)get("dry_leaves");
|
||||
public static final Block sponge = get("sponge");
|
||||
public static final Block glass = get("glass");
|
||||
public static final BlockOre lapis_ore = (BlockOre)get("lapis_ore");
|
||||
public static final Block lapis_block = get("lapis_block");
|
||||
public static final Block dispenser = get("dispenser");
|
||||
public static final Block sandstone = get("sandstone");
|
||||
public static final Block noteblock = get("noteblock");
|
||||
public static final BlockBed red_bed = (BlockBed)get("red_bed");
|
||||
public static final Block golden_rail = get("golden_rail");
|
||||
public static final Block detector_rail = get("detector_rail");
|
||||
public static final BlockPistonBase sticky_piston = (BlockPistonBase)get("sticky_piston");
|
||||
public static final Block web = get("web");
|
||||
public static final BlockTallGrass tallgrass = (BlockTallGrass)get("tallgrass");
|
||||
public static final BlockDeadBush deadbush = (BlockDeadBush)get("deadbush");
|
||||
public static final BlockPistonBase piston = (BlockPistonBase)get("piston");
|
||||
public static final BlockPistonHead piston_head = (BlockPistonHead)get("piston_head");
|
||||
public static final Block wool = get("wool");
|
||||
public static final BlockPistonMoving piston_extension = (BlockPistonMoving)get("piston_extension");
|
||||
public static final BlockFlower flower = (BlockFlower)get("flower");
|
||||
public static final BlockBush brown_mushroom = (BlockBush)get("brown_mushroom");
|
||||
public static final BlockBush red_mushroom = (BlockBush)get("red_mushroom");
|
||||
public static final Block gold_block = get("gold_block");
|
||||
public static final Block iron_block = get("iron_block");
|
||||
// public static final BlockSlab double_stone_slab = get("double_stone_slab");
|
||||
// public static final BlockSlab stone_slab = get("stone_slab");
|
||||
public static final Block brick_block = get("brick_block");
|
||||
public static final Block tnt = get("tnt");
|
||||
public static final Block bookshelf = get("bookshelf");
|
||||
public static final Block mossy_cobblestone = get("mossy_cobblestone");
|
||||
public static final Block obsidian = get("obsidian");
|
||||
public static final Block torch = get("torch");
|
||||
public static final BlockFire fire = (BlockFire)get("fire");
|
||||
public static final Block mob_spawner = get("mob_spawner");
|
||||
public static final Block oak_stairs = get("oak_stairs");
|
||||
public static final BlockChest chest = (BlockChest)get("chest");
|
||||
public static final BlockRedstoneWire redstone = (BlockRedstoneWire)get("redstone");
|
||||
public static final BlockOre diamond_ore = (BlockOre)get("diamond_ore");
|
||||
public static final Block diamond_block = get("diamond_block");
|
||||
public static final Block crafting_table = get("crafting_table");
|
||||
public static final Block wheat = get("wheat");
|
||||
public static final Block farmland = get("farmland");
|
||||
public static final Block furnace = get("furnace");
|
||||
public static final Block lit_furnace = get("lit_furnace");
|
||||
public static final Block sign = get("sign");
|
||||
public static final Block oak_door = get("oak_door");
|
||||
public static final Block spruce_door = get("spruce_door");
|
||||
public static final Block birch_door = get("birch_door");
|
||||
public static final Block jungle_door = get("jungle_door");
|
||||
public static final Block acacia_door = get("acacia_door");
|
||||
public static final Block dark_oak_door = get("dark_oak_door");
|
||||
public static final Block ladder = get("ladder");
|
||||
public static final Block rail = get("rail");
|
||||
public static final Block cobblestone_stairs = get("cobblestone_stairs");
|
||||
public static final Block wall_sign = get("wall_sign");
|
||||
public static final Block lever = get("lever");
|
||||
public static final Block stone_pressure_plate = get("stone_pressure_plate");
|
||||
public static final Block iron_door = get("iron_door");
|
||||
public static final Block wooden_pressure_plate = get("wooden_pressure_plate");
|
||||
public static final Block redstone_ore = get("redstone_ore");
|
||||
public static final Block lit_redstone_ore = get("lit_redstone_ore");
|
||||
public static final Block unlit_redstone_torch = get("unlit_redstone_torch");
|
||||
public static final Block redstone_torch = get("redstone_torch");
|
||||
public static final Block stone_button = get("stone_button");
|
||||
public static final Block snow_layer = get("snow_layer");
|
||||
public static final Block ice = get("ice");
|
||||
public static final Block snow = get("snow");
|
||||
public static final BlockCactus cactus = (BlockCactus)get("cactus");
|
||||
public static final Block clay = get("clay");
|
||||
public static final BlockReed reeds = (BlockReed)get("reeds");
|
||||
public static final Block jukebox = get("jukebox");
|
||||
public static final Block oak_fence = get("oak_fence");
|
||||
public static final Block spruce_fence = get("spruce_fence");
|
||||
public static final Block birch_fence = get("birch_fence");
|
||||
public static final Block jungle_fence = get("jungle_fence");
|
||||
public static final Block dark_oak_fence = get("dark_oak_fence");
|
||||
public static final Block acacia_fence = get("acacia_fence");
|
||||
public static final Block pumpkin = get("pumpkin");
|
||||
public static final Block hellrock = get("hellrock");
|
||||
public static final Block soul_sand = get("soul_sand");
|
||||
public static final Block glowstone = get("glowstone");
|
||||
public static final BlockPortal portal = (BlockPortal)get("portal");
|
||||
public static final Block lit_pumpkin = get("lit_pumpkin");
|
||||
public static final Block cake = get("cake");
|
||||
public static final BlockRedstoneRepeater repeater = (BlockRedstoneRepeater)get("repeater");
|
||||
public static final BlockRedstoneRepeater powered_repeater = (BlockRedstoneRepeater)get("powered_repeater");
|
||||
public static final Block trapdoor = get("trapdoor");
|
||||
public static final Block stonebrick = get("stonebrick");
|
||||
public static final Block brown_mushroom_block = get("brown_mushroom_block");
|
||||
public static final Block red_mushroom_block = get("red_mushroom_block");
|
||||
public static final Block iron_bars = get("iron_bars");
|
||||
public static final Block glass_pane = get("glass_pane");
|
||||
public static final Block melon_block = get("melon_block");
|
||||
public static final Block pumpkin_stem = get("pumpkin_stem");
|
||||
public static final Block melon_stem = get("melon_stem");
|
||||
public static final Block vine = get("vine");
|
||||
public static final Block oak_fence_gate = get("oak_fence_gate");
|
||||
public static final Block spruce_fence_gate = get("spruce_fence_gate");
|
||||
public static final Block birch_fence_gate = get("birch_fence_gate");
|
||||
public static final Block jungle_fence_gate = get("jungle_fence_gate");
|
||||
public static final Block dark_oak_fence_gate = get("dark_oak_fence_gate");
|
||||
public static final Block acacia_fence_gate = get("acacia_fence_gate");
|
||||
public static final Block brick_stairs = get("brick_stairs");
|
||||
public static final Block stonebrick_stairs = get("stonebrick_stairs");
|
||||
public static final BlockMycelium mycelium = (BlockMycelium)get("mycelium");
|
||||
public static final Block waterlily = get("waterlily");
|
||||
public static final Block blood_brick = get("blood_brick");
|
||||
public static final Block blood_brick_fence = get("blood_brick_fence");
|
||||
public static final Block blood_brick_stairs = get("blood_brick_stairs");
|
||||
public static final Block black_brick = get("black_brick");
|
||||
public static final Block black_brick_fence = get("black_brick_fence");
|
||||
public static final Block black_brick_stairs = get("black_brick_stairs");
|
||||
public static final Block soul_wart = get("soul_wart");
|
||||
public static final Block enchanting_table = get("enchanting_table");
|
||||
public static final Block brewing_stand = get("brewing_stand");
|
||||
public static final BlockCauldron cauldron = (BlockCauldron)get("cauldron");
|
||||
public static final Block floor_portal = get("floor_portal");
|
||||
public static final Block portal_frame = get("portal_frame");
|
||||
public static final Block cell_rock = get("cell_rock");
|
||||
public static final Block dragon_egg = get("dragon_egg");
|
||||
public static final Block redstone_lamp = get("redstone_lamp");
|
||||
public static final Block lit_redstone_lamp = get("lit_redstone_lamp");
|
||||
// public static final BlockSlab double_wooden_slab = get("double_wooden_slab");
|
||||
// public static final BlockSlab wooden_slab = get("wooden_slab");
|
||||
public static final Block cocoa = get("cocoa");
|
||||
public static final Block sandstone_stairs = get("sandstone_stairs");
|
||||
public static final BlockOre emerald_ore = (BlockOre)get("emerald_ore");
|
||||
public static final Block warp_chest = get("warp_chest");
|
||||
public static final BlockTripWireHook tripwire_hook = (BlockTripWireHook)get("tripwire_hook");
|
||||
public static final Block string = get("string");
|
||||
public static final Block emerald_block = get("emerald_block");
|
||||
public static final Block spruce_stairs = get("spruce_stairs");
|
||||
public static final Block birch_stairs = get("birch_stairs");
|
||||
public static final Block jungle_stairs = get("jungle_stairs");
|
||||
public static final BlockBeacon beacon = (BlockBeacon)get("beacon");
|
||||
public static final Block cobblestone_wall = get("cobblestone_wall");
|
||||
public static final Block flower_pot = get("flower_pot");
|
||||
public static final Block carrot = get("carrot");
|
||||
public static final Block potato = get("potato");
|
||||
public static final Block wooden_button = get("wooden_button");
|
||||
public static final BlockSkull skull = (BlockSkull)get("skull");
|
||||
public static final Block anvil = get("anvil");
|
||||
public static final Block trapped_chest = get("trapped_chest");
|
||||
public static final Block light_weighted_pressure_plate = get("light_weighted_pressure_plate");
|
||||
public static final Block heavy_weighted_pressure_plate = get("heavy_weighted_pressure_plate");
|
||||
public static final BlockRedstoneComparator comparator = (BlockRedstoneComparator)get("comparator");
|
||||
public static final BlockRedstoneComparator powered_comparator = (BlockRedstoneComparator)get("powered_comparator");
|
||||
public static final BlockDaylightDetector daylight_detector = (BlockDaylightDetector)get("daylight_detector");
|
||||
public static final BlockDaylightDetector daylight_detector_inverted = (BlockDaylightDetector)get("daylight_detector_inverted");
|
||||
public static final Block redstone_block = get("redstone_block");
|
||||
public static final BlockOre quartz_ore = (BlockOre)get("quartz_ore");
|
||||
public static final BlockHopper hopper = (BlockHopper)get("hopper");
|
||||
public static final Block quartz_block = get("quartz_block");
|
||||
public static final Block black_quartz_block = get("black_quartz_block");
|
||||
public static final Block quartz_stairs = get("quartz_stairs");
|
||||
public static final Block black_quartz_stairs = get("black_quartz_stairs");
|
||||
public static final Block activator_rail = get("activator_rail");
|
||||
public static final Block dropper = get("dropper");
|
||||
public static final Block stained_hardened_clay = get("stained_hardened_clay");
|
||||
public static final Block iron_trapdoor = get("iron_trapdoor");
|
||||
public static final Block hay_block = get("hay_block");
|
||||
public static final Block carpet = get("carpet");
|
||||
public static final Block hardened_clay = get("hardened_clay");
|
||||
public static final Block coal_block = get("coal_block");
|
||||
public static final Block packed_ice = get("packed_ice");
|
||||
public static final Block acacia_stairs = get("acacia_stairs");
|
||||
public static final Block dark_oak_stairs = get("dark_oak_stairs");
|
||||
public static final Block slime_block = get("slime_block");
|
||||
public static final BlockDoublePlant double_plant = (BlockDoublePlant)get("double_plant");
|
||||
public static final BlockStainedGlass stained_glass = (BlockStainedGlass)get("stained_glass");
|
||||
public static final BlockStainedGlassPane stained_glass_pane = (BlockStainedGlassPane)get("stained_glass_pane");
|
||||
public static final Block banner = get("banner");
|
||||
public static final Block wall_banner = get("wall_banner");
|
||||
|
||||
public static final BlockLeaves oak_leaves = (BlockLeaves)get("oak_leaves");
|
||||
public static final BlockLeaves spruce_leaves = (BlockLeaves)get("spruce_leaves");
|
||||
public static final BlockLeaves birch_leaves = (BlockLeaves)get("birch_leaves");
|
||||
public static final BlockLeaves jungle_leaves = (BlockLeaves)get("jungle_leaves");
|
||||
public static final BlockLeaves acacia_leaves = (BlockLeaves)get("acacia_leaves");
|
||||
public static final BlockLeaves dark_oak_leaves = (BlockLeaves)get("dark_oak_leaves");
|
||||
public static final BlockLeaves cherry_leaves = (BlockLeaves)get("cherry_leaves");
|
||||
public static final BlockLeaves maple_leaves = (BlockLeaves)get("maple_leaves");
|
||||
public static final BlockLeaves tian_leaves = (BlockLeaves)get("tian_leaves");
|
||||
public static final Block cherry_stairs = get("cherry_stairs");
|
||||
public static final Block maple_stairs = get("maple_stairs");
|
||||
public static final Block cherry_door = get("cherry_door");
|
||||
public static final Block maple_door = get("maple_door");
|
||||
public static final Block cherry_fence = get("cherry_fence");
|
||||
public static final Block maple_fence = get("maple_fence");
|
||||
public static final Block cherry_fence_gate = get("cherry_fence_gate");
|
||||
public static final Block maple_fence_gate = get("maple_fence_gate");
|
||||
public static final Block nuke = get("nuke");
|
||||
// public static final BlockVerticalSlab stone_vslab = get("stone_vslab");
|
||||
// public static final BlockVerticalSlab stone_vslab2 = get("stone_vslab2");
|
||||
// public static final BlockVerticalSlab wooden_vslab = get("wooden_vslab");
|
||||
// public static final BlockVerticalSlab wooden_vslab2 = get("wooden_vslab2");
|
||||
public static final BlockOre thetium_ore = (BlockOre)get("thetium_ore");
|
||||
public static final BlockOre ardite_ore = (BlockOre)get("ardite_ore");
|
||||
public static final BlockOre gyriyn_ore = (BlockOre)get("gyriyn_ore");
|
||||
public static final BlockOre nichun_ore = (BlockOre)get("nichun_ore");
|
||||
public static final BlockOre ruby_ore = (BlockOre)get("ruby_ore");
|
||||
public static final BlockOre cinnabar_ore = (BlockOre)get("cinnabar_ore");
|
||||
public static final Block lamp = get("lamp");
|
||||
|
||||
public static final Block copper_block = get("copper_block");
|
||||
public static final Block tin_block = get("tin_block");
|
||||
public static final Block aluminium_block = get("aluminium_block");
|
||||
public static final Block lead_block = get("lead_block");
|
||||
|
||||
public static final Block tian = get("tian");
|
||||
public static final Block tian_soil = get("tian_soil");
|
||||
public static final BlockBush blue_mushroom = (BlockBush)get("blue_mushroom");
|
||||
public static final BlockTianReactor tian_reactor = (BlockTianReactor)get("tian_reactor");
|
||||
public static final Block red_button = get("red_button");
|
||||
public static final Block moon_rock = get("moon_rock");
|
||||
public static final Block moon_cheese = get("moon_cheese");
|
||||
public static final Block rock = get("rock");
|
||||
public static final Block ash = get("ash");
|
||||
public static final Block core = get("core");
|
||||
|
||||
public static final BlockSlab stone_slab = (BlockSlab)get("stone_slab");
|
||||
public static final BlockSlab sandstone_slab = (BlockSlab)get("sandstone_slab");
|
||||
public static final BlockSlab stonebrick_slab = (BlockSlab)get("stonebrick_slab");
|
||||
|
||||
public static final BlockDynamicLiquid flowing_blood = (BlockDynamicLiquid)get("flowing_blood");
|
||||
public static final BlockStaticLiquid blood = (BlockStaticLiquid)get("blood");
|
||||
public static final BlockDynamicLiquid flowing_mercury = (BlockDynamicLiquid)get("flowing_mercury");
|
||||
public static final BlockStaticLiquid mercury = (BlockStaticLiquid)get("mercury");
|
||||
public static final BlockDynamicLiquid flowing_magma = (BlockDynamicLiquid)get("flowing_magma");
|
||||
public static final BlockStaticLiquid magma = (BlockStaticLiquid)get("magma");
|
||||
public static final BlockDynamicLiquid flowing_hydrogen = (BlockDynamicLiquid)get("flowing_hydrogen");
|
||||
public static final BlockStaticLiquid hydrogen = (BlockStaticLiquid)get("hydrogen");
|
||||
|
||||
private static Block get(String id) {
|
||||
if(!BlockRegistry.REGISTRY.containsKey(id))
|
||||
throw new RuntimeException("Block " + id + " does not exist!");
|
||||
return BlockRegistry.REGISTRY.getObject(id);
|
||||
}
|
||||
|
||||
// static {
|
||||
// for(Field field : Blocks.class.getDeclaredFields()) {
|
||||
// if(Block.class.isAssignableFrom(field.getType())) {
|
||||
// if(!BlockRegistry.REGISTRY.containsKey(field.getName())) {
|
||||
// throw new RuntimeException("Block " + field.getName() + " does not exist!");
|
||||
// }
|
||||
// Block block = BlockRegistry.REGISTRY.getObject(field.getName());
|
||||
// try {
|
||||
// field.set(null, block);
|
||||
// }
|
||||
// catch(IllegalArgumentException | IllegalAccessException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
517
java/src/game/init/Config.java
Executable file
517
java/src/game/init/Config.java
Executable file
|
@ -0,0 +1,517 @@
|
|||
package game.init;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import game.ExtMath;
|
||||
import game.Server;
|
||||
import game.packet.SPacketWorld;
|
||||
import game.world.World;
|
||||
import game.world.WorldServer;
|
||||
|
||||
public abstract class Config {
|
||||
public static enum ValueType {
|
||||
STRING, BOOLEAN, INTEGER, FLOAT;
|
||||
}
|
||||
|
||||
private static interface Callback {
|
||||
void run(Server server);
|
||||
}
|
||||
|
||||
@Target(FIELD)
|
||||
@Retention(value = RetentionPolicy.RUNTIME)
|
||||
private static @interface Var {
|
||||
String name();
|
||||
Class<? extends Callback> callback() default Callback.class;
|
||||
float min() default (float)Integer.MIN_VALUE;
|
||||
float max() default (float)Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public static class Value {
|
||||
public final ValueType type;
|
||||
public final String def;
|
||||
private final Field field;
|
||||
private final float min;
|
||||
private final float max;
|
||||
private final Callback callback;
|
||||
|
||||
private Value(Field field, Var value) {
|
||||
this.type = field.getType() == int.class ? ValueType.INTEGER : (field.getType() == boolean.class ? ValueType.BOOLEAN :
|
||||
(field.getType() == String.class ? ValueType.STRING : (field.getType() == float.class ? ValueType.FLOAT : null)));
|
||||
if(this.type == null)
|
||||
throw new IllegalArgumentException(value.name() + ": Unbekannter Variablen-Typ - " + field.getType());
|
||||
this.field = field;
|
||||
this.def = this.getValue();
|
||||
// Clamped clamp = this.field.getAnnotation(Clamped.class);
|
||||
this.min = (this.type == ValueType.INTEGER || this.type == ValueType.FLOAT)
|
||||
? value.min() : 0;
|
||||
this.max = (this.type == ValueType.INTEGER || this.type == ValueType.FLOAT)
|
||||
? value.max() : (this.type == ValueType.BOOLEAN ? 1 : 0);
|
||||
// Update update = this.field.getAnnotation(Update.class);
|
||||
if(value.callback() == Callback.class) {
|
||||
this.callback = null;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
this.callback = value.callback().getConstructor().newInstance();
|
||||
}
|
||||
catch(InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
|
||||
| NoSuchMethodException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
this.setValue(this.def);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
try {
|
||||
return "" + this.field.get(null);
|
||||
// switch(this.type) {
|
||||
// case STRING:
|
||||
// default:
|
||||
// return (String)this.field.get(null);
|
||||
// case BOOLEAN:
|
||||
// return "" + this.field.getBoolean(null);
|
||||
// case INTEGER:
|
||||
// return "" + this.field.getInt(null);
|
||||
// case FLOAT:
|
||||
// return "" + this.field.getFloat(null);
|
||||
// }
|
||||
}
|
||||
catch(IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void setValue(String value) {
|
||||
try {
|
||||
switch(this.type) {
|
||||
case STRING:
|
||||
this.field.set(null, value);
|
||||
break;
|
||||
case BOOLEAN:
|
||||
this.field.setBoolean(null, Boolean.parseBoolean(value));
|
||||
break;
|
||||
case INTEGER:
|
||||
int inum = 0;
|
||||
try {
|
||||
inum = Integer.parseInt(value);
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
}
|
||||
this.field.setInt(null, ExtMath.clampi(inum, (int)this.min, (int)this.max));
|
||||
break;
|
||||
case FLOAT:
|
||||
float fnum = 0.0f;
|
||||
try {
|
||||
fnum = Float.parseFloat(value);
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
}
|
||||
fnum = ExtMath.clampf(fnum, this.min, this.max);
|
||||
int round = (int)(fnum * 1000.0f);
|
||||
this.field.setFloat(null, (float)round / 1000.0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final int PROTOCOL = 666;
|
||||
public static final String VERSION = "v2.2.1-alpha";
|
||||
|
||||
public static final Map<String, Config.Value> VARS = new TreeMap();
|
||||
|
||||
@Var(name = "fireTick")
|
||||
public static boolean fire = true;
|
||||
@Var(name = "mobGriefing")
|
||||
public static boolean mobGrief = true;
|
||||
@Var(name = "mobSpawning")
|
||||
public static boolean mobs = true;
|
||||
@Var(name = "tickSpawning")
|
||||
public static boolean tickSpawn = true;
|
||||
@Var(name = "genSpawning")
|
||||
public static boolean genSpawn = true;
|
||||
@Var(name = "spawners")
|
||||
public static boolean spawners = true;
|
||||
@Var(name = "spawnVillagers")
|
||||
public static boolean spawnVillager = true;
|
||||
@Var(name = "spawnCagedVillagers")
|
||||
public static boolean spawnCagedVillager = true;
|
||||
@Var(name = "spawnHutMages")
|
||||
public static boolean spawnHutMage = true;
|
||||
@Var(name = "spawnEggChickens")
|
||||
public static boolean spawnEggChicken = true;
|
||||
@Var(name = "spawnMoreZombies")
|
||||
public static boolean spawnMoreZombie = true;
|
||||
@Var(name = "spawnSplitSlimes")
|
||||
public static boolean spawnSplitSlime = true;
|
||||
@Var(name = "chargeHaunter")
|
||||
public static boolean chargeHaunter = true;
|
||||
@Var(name = "convertVillageZombie")
|
||||
public static boolean convertZombie = true;
|
||||
@Var(name = "dropLoot")
|
||||
public static boolean dropLoot = true;
|
||||
@Var(name = "dropBlockXP")
|
||||
public static boolean blockXP = true;
|
||||
@Var(name = "dropBreedingXP")
|
||||
public static boolean breedingXP = true;
|
||||
@Var(name = "dropSmeltingXP")
|
||||
public static boolean smeltingXP = true;
|
||||
@Var(name = "dropFishingXP")
|
||||
public static boolean fishingXP = true;
|
||||
@Var(name = "dropMobXP")
|
||||
public static boolean mobXP = true;
|
||||
@Var(name = "dropBlocks")
|
||||
public static boolean blockDrop = true;
|
||||
@Var(name = "dropObjects")
|
||||
public static boolean objectDrop = true;
|
||||
@Var(name = "naturalRegeneration")
|
||||
public static boolean regeneration = true;
|
||||
@Var(name = "daylightCycle", callback = WorldCallback.class)
|
||||
public static boolean dayCycle = true;
|
||||
@Var(name = "weatherChanges")
|
||||
public static boolean weather = true;
|
||||
@Var(name = "seasonLeafUpdate")
|
||||
public static boolean seasonLeaves = true;
|
||||
@Var(name = "leavesDecay")
|
||||
public static boolean leavesDecay = true;
|
||||
@Var(name = "repairExperience")
|
||||
public static boolean repairXP = true;
|
||||
@Var(name = "mobTick")
|
||||
public static boolean mobTick = true;
|
||||
@Var(name = "mobAttacks")
|
||||
public static boolean mobAttacks = true;
|
||||
@Var(name = "portals")
|
||||
public static boolean portals = true;
|
||||
@Var(name = "portalVoid")
|
||||
public static boolean voidPortal = true;
|
||||
@Var(name = "dropPlayerSkulls")
|
||||
public static boolean skullDrop = true;
|
||||
@Var(name = "dropPlayerItems")
|
||||
public static boolean playerDrop = true;
|
||||
@Var(name = "blockGravity")
|
||||
public static boolean blockGravity = true;
|
||||
@Var(name = "liquidPhysics")
|
||||
public static boolean liquidPhysics = true;
|
||||
@Var(name = "lavaFire")
|
||||
public static boolean lavaFire = true;
|
||||
@Var(name = "mergeWater")
|
||||
public static boolean mergeWater = true;
|
||||
@Var(name = "mergeInfinite")
|
||||
public static boolean mergeInfinite = true;
|
||||
@Var(name = "infighting")
|
||||
public static boolean infight = true;
|
||||
// @Var(name = "infightSameType")
|
||||
// public static boolean infightSame = true;
|
||||
@Var(name = "damageFall")
|
||||
public static boolean damageFall = true;
|
||||
@Var(name = "damageFire")
|
||||
public static boolean damageFire = true;
|
||||
@Var(name = "damageLava")
|
||||
public static boolean damageLava = true;
|
||||
@Var(name = "damageMolten")
|
||||
public static boolean damageMolten = true;
|
||||
@Var(name = "damageLightning")
|
||||
public static boolean damageLightning = true;
|
||||
@Var(name = "damageSquish")
|
||||
public static boolean damageSquish = true;
|
||||
@Var(name = "damageAcme")
|
||||
public static boolean damageAcme = true;
|
||||
@Var(name = "damageRadiation")
|
||||
public static boolean damageRadiation = true;
|
||||
@Var(name = "damagePoison")
|
||||
public static boolean damagePoison = true;
|
||||
@Var(name = "damagePotion")
|
||||
public static boolean damagePotion = true;
|
||||
@Var(name = "damageFlyingBox")
|
||||
public static boolean damageFlyingBox = true;
|
||||
@Var(name = "damageVoid")
|
||||
public static boolean damageVoid = true;
|
||||
@Var(name = "damageThorns")
|
||||
public static boolean damageThorns = true;
|
||||
@Var(name = "damageFireball")
|
||||
public static boolean damageFireball = true;
|
||||
@Var(name = "damageArrow")
|
||||
public static boolean damageArrow = true;
|
||||
@Var(name = "damageBullet")
|
||||
public static boolean damageBullet = true;
|
||||
@Var(name = "damageMobs")
|
||||
public static boolean damageMobs = true;
|
||||
@Var(name = "damageExplosion")
|
||||
public static boolean damageExplosion = true;
|
||||
@Var(name = "damageWall")
|
||||
public static boolean damageWall = true;
|
||||
@Var(name = "radiation")
|
||||
public static boolean radiation = true;
|
||||
@Var(name = "anvilFallDecay")
|
||||
public static boolean anvilFallDecay = true;
|
||||
@Var(name = "anvilRepairDecay")
|
||||
public static boolean anvilRepairDecay = true;
|
||||
@Var(name = "attacking")
|
||||
public static boolean attack = true;
|
||||
@Var(name = "cactusPrickly")
|
||||
public static boolean cactusDamage = true;
|
||||
@Var(name = "waterMobDrying")
|
||||
public static boolean waterMobDry = true;
|
||||
@Var(name = "itemBurning")
|
||||
public static boolean itemBurn = true;
|
||||
@Var(name = "xpOrbBurning")
|
||||
public static boolean xpOrbBurn = true;
|
||||
@Var(name = "smackingOrb")
|
||||
public static boolean knockOrb = true;
|
||||
@Var(name = "smackingDynamite")
|
||||
public static boolean knockDynamite = true;
|
||||
@Var(name = "smackingEgg")
|
||||
public static boolean knockEgg = true;
|
||||
@Var(name = "smackingSnowball")
|
||||
public static boolean knockSnowball = true;
|
||||
@Var(name = "smackingFishHook")
|
||||
public static boolean knockHook = true;
|
||||
@Var(name = "entityFishing")
|
||||
public static boolean hookEntity = true;
|
||||
@Var(name = "hookingRequiresDamage")
|
||||
public static boolean hookCheckDamage = true;
|
||||
@Var(name = "grassSpread")
|
||||
public static boolean grassSpread = true;
|
||||
@Var(name = "grassDecay")
|
||||
public static boolean grassDecay = true;
|
||||
@Var(name = "grassDrying")
|
||||
public static boolean grassDry = true;
|
||||
@Var(name = "tallgrassDrying")
|
||||
public static boolean tallgrassDry = true;
|
||||
@Var(name = "flowerDrying")
|
||||
public static boolean flowerDry = true;
|
||||
@Var(name = "plantDrying")
|
||||
public static boolean plantDry = true;
|
||||
@Var(name = "leafDrying")
|
||||
public static boolean leafDry = true;
|
||||
@Var(name = "saplingDrying")
|
||||
public static boolean saplingDry = true;
|
||||
@Var(name = "reedDrying")
|
||||
public static boolean reedDry = true;
|
||||
@Var(name = "vineDrying")
|
||||
public static boolean vineDry = true;
|
||||
@Var(name = "myceliumSpread")
|
||||
public static boolean mycelSpread = true;
|
||||
@Var(name = "myceliumDecay")
|
||||
public static boolean mycelDecay = true;
|
||||
@Var(name = "farmlandDecay")
|
||||
public static boolean cropDecay = true;
|
||||
@Var(name = "farmlandDrying")
|
||||
public static boolean cropDrying = true;
|
||||
@Var(name = "farmlandSoaking")
|
||||
public static boolean cropSoaking = true;
|
||||
@Var(name = "farmlandTrampling")
|
||||
public static boolean cropTrampling = true;
|
||||
@Var(name = "iceMelting")
|
||||
public static boolean iceMelt = true;
|
||||
@Var(name = "snowMelting")
|
||||
public static boolean snowMelt = true;
|
||||
@Var(name = "snowBlockMelting")
|
||||
public static boolean snowFullMelt = true;
|
||||
@Var(name = "chestLocking")
|
||||
public static boolean locking = true;
|
||||
@Var(name = "teleFragging")
|
||||
public static boolean telefrag = true;
|
||||
@Var(name = "checkRespawn")
|
||||
public static boolean checkBed = true;
|
||||
@Var(name = "chunkLoaders")
|
||||
public static boolean loaders = true;
|
||||
@Var(name = "fragileItems")
|
||||
public static boolean itemFallDamage = true;
|
||||
@Var(name = "registration")
|
||||
public static boolean register = true;
|
||||
|
||||
@Var(name = "keepInventory")
|
||||
public static boolean keepInventory = false;
|
||||
@Var(name = "cleanCut")
|
||||
public static boolean cleanCut = false;
|
||||
@Var(name = "mergeLava")
|
||||
public static boolean mergeLava = false;
|
||||
@Var(name = "mergeFinite")
|
||||
public static boolean mergeFinite = false;
|
||||
@Var(name = "veryHungryRabbits")
|
||||
public static boolean rabidRabbits = false;
|
||||
@Var(name = "snowStacking")
|
||||
public static boolean snowStack = false;
|
||||
@Var(name = "authentication")
|
||||
public static boolean auth = false;
|
||||
@Var(name = "teleportForAll")
|
||||
public static boolean teleportAllowed = false;
|
||||
|
||||
// @Var(name = "maxPolygonalPoints")
|
||||
// public static int polygonalPoints = -1;
|
||||
// @Var(name = "maxPolyhedronPoints")
|
||||
// public static int polyhedronPoints = -1;
|
||||
// @Var(name = "maxEditRadius")
|
||||
// public static int editRadius = -1;
|
||||
// @Var(name = "maxBrushRadius")
|
||||
// public static int brushRadius = 500;
|
||||
// @Var(name = "historySize")
|
||||
// public static int history = 300;
|
||||
|
||||
@Var(name = "randomTickSpeed")
|
||||
public static int randomTick = 3;
|
||||
@Var(name = "weatherTickSpeed")
|
||||
public static int weatherTick = 1;
|
||||
@Var(name = "lightningChance")
|
||||
public static int boltChance = 100000;
|
||||
@Var(name = "igniteChance")
|
||||
public static int igniteChance = 100;
|
||||
@Var(name = "spawnRadius")
|
||||
public static int spawnRadius = 10;
|
||||
@Var(name = "respawnTime")
|
||||
public static int respawnTime = 0;
|
||||
@Var(name = "hurtCooldown")
|
||||
public static int hurtDelay = 20;
|
||||
@Var(name = "attackCooldown")
|
||||
public static int attackDelay = 0;
|
||||
@Var(name = "spawnGroupCount")
|
||||
public static int spawnGroups = 3;
|
||||
@Var(name = "spawnGroupDistance")
|
||||
public static int spawnGroupDist = 6;
|
||||
@Var(name = "mobSpawnRadius")
|
||||
public static int mobSpawnDist = 8;
|
||||
@Var(name = "mobPlayerDistance")
|
||||
public static int mobPlayerDist = 24;
|
||||
@Var(name = "saveInterval")
|
||||
public static int saveInterval = 900;
|
||||
@Var(name = "maxPlayers")
|
||||
public static int playerLimit = 0;
|
||||
@Var(name = "compressAbove")
|
||||
public static int compression = 256;
|
||||
@Var(name = "pistonPushLimit")
|
||||
public static int pistonLimit = 16;
|
||||
@Var(name = "gravelFlintChance")
|
||||
public static int flintChance = 10;
|
||||
@Var(name = "timeFlow", callback = WorldCallback.class)
|
||||
public static int timeFlow = 1;
|
||||
@Var(name = "emptyTicks")
|
||||
public static int unloadTicks = 1200;
|
||||
@Var(name = "rabbitMateChance")
|
||||
public static int rabbitMateChance = 10;
|
||||
@Var(name = "killerBunnyChance")
|
||||
public static int killerBunnyChance = 1000;
|
||||
@Var(name = "fallPortalHeight")
|
||||
public static int portalHeight = 256;
|
||||
@Var(name = "damageOrb")
|
||||
public static int orbDamageSelf = 5;
|
||||
@Var(name = "vineGrowthChance")
|
||||
public static int vineGrowth = 4;
|
||||
@Var(name = "blueShroomChance")
|
||||
public static int blueShroomGrowth = 25;
|
||||
@Var(name = "mushroomChance")
|
||||
public static int shroomGrowth = 25;
|
||||
@Var(name = "cropGrowthChance")
|
||||
public static int cropGrowth = 26;
|
||||
@Var(name = "stemGrowthChance")
|
||||
public static int stemGrowth = 26;
|
||||
@Var(name = "treeGrowthChance")
|
||||
public static int treeGrowth = 7;
|
||||
@Var(name = "wartGrowthChance")
|
||||
public static int wartGrowth = 10;
|
||||
@Var(name = "cocoaGrowthChance")
|
||||
public static int cocoaGrowth = 5;
|
||||
@Var(name = "reedGrowthHeight")
|
||||
public static int reedHeight = 3;
|
||||
@Var(name = "cactusGrowthHeight")
|
||||
public static int cactusHeight = 3;
|
||||
@Var(name = "orbThorns")
|
||||
public static int orbDamageOther = 0;
|
||||
@Var(name = "weatherChance")
|
||||
public static int weatherChance = 48000;
|
||||
@Var(name = "viewDistance", min = 2, max = 128, callback = DistanceCallback.class)
|
||||
public static int distance = 10;
|
||||
@Var(name = "healChance")
|
||||
public static int healChance = 5;
|
||||
@Var(name = "hopperCooldown", min = 0, max = 160)
|
||||
public static int hopperDelay = 2;
|
||||
@Var(name = "hopperCartCooldown", min = 0, max = 160)
|
||||
public static int hopperCartDelay = 1;
|
||||
@Var(name = "xpCooldown", min = 0, max = 10)
|
||||
public static int xpDelay = 0; // 2
|
||||
@Var(name = "maxSpawns")
|
||||
public static int maxMobs = 120;
|
||||
@Var(name = "eggLayTime")
|
||||
public static int eggTimer = 6000;
|
||||
|
||||
@Var(name = "spawnX", min = -World.MAX_SIZE + 1, max = World.MAX_SIZE - 1)
|
||||
public static int spawnX = 0;
|
||||
@Var(name = "spawnY", min = -1, max = 511)
|
||||
public static int spawnY = 64;
|
||||
@Var(name = "spawnZ", min = -World.MAX_SIZE + 1, max = World.MAX_SIZE - 1)
|
||||
public static int spawnZ = 0;
|
||||
@Var(name = "spawnDim")
|
||||
public static int spawnDim = 0;
|
||||
|
||||
@Var(name = "gravity", callback = WorldCallback.class)
|
||||
public static float gravity = 1.0f;
|
||||
@Var(name = "knockback")
|
||||
public static float knockback = 1.0f;
|
||||
|
||||
@Var(name = "spawnYaw", min = -180.0f, max = 180.0f)
|
||||
public static float spawnYaw = -90.0f;
|
||||
@Var(name = "spawnPitch", min = -89.0f, max = 89.0f)
|
||||
public static float spawnPitch = 0.0f;
|
||||
|
||||
@Var(name = "password")
|
||||
public static String password = "";
|
||||
|
||||
static {
|
||||
for(Field field : Config.class.getDeclaredFields()) {
|
||||
if(field.isAnnotationPresent(Var.class)) {
|
||||
if(!Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers()))
|
||||
throw new IllegalArgumentException("Feld für Variable " + field + " muss statisch und änderbar sein!");
|
||||
Var value = field.getAnnotation(Var.class);
|
||||
if(value.name().isEmpty())
|
||||
throw new IllegalArgumentException("Variablenname von " + field + " kann nicht leer sein!");
|
||||
if(VARS.containsKey(value.name()))
|
||||
throw new IllegalArgumentException("Variable " + value.name() + " existiert bereits!");
|
||||
VARS.put(value.name(), new Config.Value(field, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
for(Config.Value value : VARS.values()) {
|
||||
value.setValue(value.def);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String key, String value, Server server) {
|
||||
Config.Value vl = VARS.get(key);
|
||||
if(vl != null) {
|
||||
vl.setValue(value);
|
||||
if(server != null && vl.callback != null)
|
||||
vl.callback.run(server);
|
||||
}
|
||||
}
|
||||
|
||||
public static class WorldCallback implements Callback {
|
||||
public void run(Server server) {
|
||||
for(WorldServer world : server.getWorlds()) {
|
||||
world.updatePhysics();
|
||||
}
|
||||
server.sendPacket(new SPacketWorld(WorldServer.clampGravity(), Config.dayCycle, Config.timeFlow));
|
||||
}
|
||||
}
|
||||
public static class DistanceCallback implements Callback {
|
||||
public void run(Server server) {
|
||||
for(WorldServer world : server.getWorlds()) {
|
||||
world.updateViewRadius();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1762
java/src/game/init/CraftingRegistry.java
Executable file
1762
java/src/game/init/CraftingRegistry.java
Executable file
File diff suppressed because it is too large
Load diff
17
java/src/game/init/DecoType.java
Executable file
17
java/src/game/init/DecoType.java
Executable file
|
@ -0,0 +1,17 @@
|
|||
package game.init;
|
||||
|
||||
public enum DecoType {
|
||||
FLOOR("floor_tiles", "Schwarz-weiße Bodenfliesen"),
|
||||
FLOOR_RED("floor_tiles_red", "Schwarz-rote Bodenfliesen"),
|
||||
FLOOR_BLACK("floor_tiles_black", "Schwarze Bodenfliesen"),
|
||||
FLOOR_WHITE("floor_tiles_white", "Weiße Bodenfliesen"),
|
||||
PENTAGRAM("pentagram", "Pentagramm-Block");
|
||||
|
||||
public final String name;
|
||||
public final String display;
|
||||
|
||||
private DecoType(String name, String display) {
|
||||
this.name = name;
|
||||
this.display = display;
|
||||
}
|
||||
}
|
514
java/src/game/init/DispenserRegistry.java
Executable file
514
java/src/game/init/DispenserRegistry.java
Executable file
|
@ -0,0 +1,514 @@
|
|||
package game.init;
|
||||
|
||||
import game.ExtMath;
|
||||
import game.block.Block;
|
||||
import game.block.BlockDispenser;
|
||||
import game.block.BlockDynamicLiquid;
|
||||
import game.block.BlockLiquid;
|
||||
import game.block.BlockTNT;
|
||||
import game.color.DyeColor;
|
||||
import game.dispenser.BehaviorDefaultDispenseItem;
|
||||
import game.dispenser.BehaviorProjectileDispense;
|
||||
import game.dispenser.IBehaviorDispenseItem;
|
||||
import game.dispenser.IBlockSource;
|
||||
import game.dispenser.IPosition;
|
||||
import game.entity.Entity;
|
||||
import game.entity.item.EntityBoat;
|
||||
import game.entity.item.EntityFireworks;
|
||||
import game.entity.item.EntityTnt;
|
||||
import game.entity.item.EntityXpBottle;
|
||||
import game.entity.projectile.EntityArrow;
|
||||
import game.entity.projectile.EntityDie;
|
||||
import game.entity.projectile.EntityDynamite;
|
||||
import game.entity.projectile.EntityEgg;
|
||||
import game.entity.projectile.EntityFireCharge;
|
||||
import game.entity.projectile.EntityPotion;
|
||||
import game.entity.projectile.EntitySnowball;
|
||||
import game.entity.types.EntityLiving;
|
||||
import game.entity.types.IProjectile;
|
||||
import game.item.Item;
|
||||
import game.item.ItemBucket;
|
||||
import game.item.ItemDie;
|
||||
import game.item.ItemDye;
|
||||
import game.item.ItemMonsterPlacer;
|
||||
import game.item.ItemPotion;
|
||||
import game.item.ItemStack;
|
||||
import game.material.Material;
|
||||
import game.rng.Random;
|
||||
import game.tileentity.TileEntityDispenser;
|
||||
import game.world.BlockPos;
|
||||
import game.world.Facing;
|
||||
import game.world.State;
|
||||
import game.world.World;
|
||||
|
||||
public abstract class DispenserRegistry {
|
||||
public static final RegistryDefaulted<Item, IBehaviorDispenseItem> REGISTRY = new RegistryDefaulted<Item, IBehaviorDispenseItem>(new BehaviorDefaultDispenseItem());
|
||||
|
||||
static void register() {
|
||||
REGISTRY.putObject(Items.arrow, new BehaviorProjectileDispense()
|
||||
{
|
||||
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
||||
{
|
||||
EntityArrow entityarrow = new EntityArrow(worldIn, position.getX(), position.getY(), position.getZ());
|
||||
entityarrow.canBePickedUp = 1;
|
||||
return entityarrow;
|
||||
}
|
||||
});
|
||||
REGISTRY.putObject(Items.egg, new BehaviorProjectileDispense()
|
||||
{
|
||||
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
||||
{
|
||||
return new EntityEgg(worldIn, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
REGISTRY.putObject(Items.die, new BehaviorProjectileDispense()
|
||||
{
|
||||
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
||||
{
|
||||
return new EntityDie(worldIn, position.getX(), position.getY(), position.getZ(),
|
||||
ItemDie.DIE_SIDES[ExtMath.clampi(item.getMetadata(), 0, ItemDie.DIE_SIDES.length - 1)]);
|
||||
}
|
||||
protected float getInaccuracy()
|
||||
{
|
||||
return super.getInaccuracy() * 5.0F;
|
||||
}
|
||||
protected float getVelocity()
|
||||
{
|
||||
return super.getVelocity() * 0.25F;
|
||||
}
|
||||
});
|
||||
REGISTRY.putObject(Items.dynamite, new BehaviorProjectileDispense()
|
||||
{
|
||||
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
||||
{
|
||||
return new EntityDynamite(worldIn, position.getX(), position.getY(), position.getZ(), item.getMetadata());
|
||||
}
|
||||
});
|
||||
REGISTRY.putObject(Items.snowball, new BehaviorProjectileDispense()
|
||||
{
|
||||
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
||||
{
|
||||
return new EntitySnowball(worldIn, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
REGISTRY.putObject(Items.experience_bottle, new BehaviorProjectileDispense()
|
||||
{
|
||||
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
||||
{
|
||||
return new EntityXpBottle(worldIn, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
protected float getInaccuracy()
|
||||
{
|
||||
return super.getInaccuracy() * 0.5F;
|
||||
}
|
||||
protected float getVelocity()
|
||||
{
|
||||
return super.getVelocity() * 1.25F;
|
||||
}
|
||||
});
|
||||
REGISTRY.putObject(Items.potion, new IBehaviorDispenseItem()
|
||||
{
|
||||
private final BehaviorDefaultDispenseItem field_150843_b = new BehaviorDefaultDispenseItem();
|
||||
public ItemStack dispense(IBlockSource source, final ItemStack stack)
|
||||
{
|
||||
return ItemPotion.isSplash(stack.getMetadata()) ? (new BehaviorProjectileDispense()
|
||||
{
|
||||
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
||||
{
|
||||
return new EntityPotion(worldIn, position.getX(), position.getY(), position.getZ(), stack.copy());
|
||||
}
|
||||
protected float getInaccuracy()
|
||||
{
|
||||
return super.getInaccuracy() * 0.5F;
|
||||
}
|
||||
protected float getVelocity()
|
||||
{
|
||||
return super.getVelocity() * 1.25F;
|
||||
}
|
||||
}).dispense(source, stack): this.field_150843_b.dispense(source, stack);
|
||||
}
|
||||
});
|
||||
IBehaviorDispenseItem disp = new BehaviorDefaultDispenseItem()
|
||||
{
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
{
|
||||
Facing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
|
||||
double d0 = source.getX() + (double)enumfacing.getFrontOffsetX();
|
||||
double d1 = (double)((float)source.getBlockPos().getY() + 0.2F);
|
||||
double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ();
|
||||
Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), ((ItemMonsterPlacer)stack.getItem()).getSpawnedId(),
|
||||
d0, d1, d2);
|
||||
|
||||
if (entity instanceof EntityLiving && stack.hasDisplayName())
|
||||
{
|
||||
((EntityLiving)entity).setCustomNameTag(stack.getDisplayName());
|
||||
}
|
||||
|
||||
stack.splitStack(1);
|
||||
return stack;
|
||||
}
|
||||
};
|
||||
for(EntityEggInfo egg : EntityRegistry.SPAWN_EGGS.values()) {
|
||||
REGISTRY.putObject(ItemRegistry.getRegisteredItem(egg.spawnedID.toLowerCase() + "_spawner"),
|
||||
disp);
|
||||
}
|
||||
REGISTRY.putObject(Items.fireworks, new BehaviorDefaultDispenseItem()
|
||||
{
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
{
|
||||
Facing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
|
||||
double d0 = source.getX() + (double)enumfacing.getFrontOffsetX();
|
||||
double d1 = (double)((float)source.getBlockPos().getY() + 0.2F);
|
||||
double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ();
|
||||
EntityFireworks entityfireworkrocket = new EntityFireworks(source.getWorld(), d0, d1, d2, stack);
|
||||
source.getWorld().spawnEntityInWorld(entityfireworkrocket);
|
||||
stack.splitStack(1);
|
||||
return stack;
|
||||
}
|
||||
protected void playDispenseSound(IBlockSource source)
|
||||
{
|
||||
source.getWorld().playAuxSFX(1002, source.getBlockPos(), 0);
|
||||
}
|
||||
});
|
||||
REGISTRY.putObject(Items.fire_charge, new BehaviorDefaultDispenseItem()
|
||||
{
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
{
|
||||
Facing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
|
||||
IPosition iposition = BlockDispenser.getDispensePosition(source);
|
||||
double d0 = iposition.getX() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
|
||||
double d1 = iposition.getY() + (double)((float)enumfacing.getFrontOffsetY() * 0.3F);
|
||||
double d2 = iposition.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 0.3F);
|
||||
World world = source.getWorld();
|
||||
Random random = world.rand;
|
||||
double d3 = random.gaussian() * 0.05D + (double)enumfacing.getFrontOffsetX();
|
||||
double d4 = random.gaussian() * 0.05D + (double)enumfacing.getFrontOffsetY();
|
||||
double d5 = random.gaussian() * 0.05D + (double)enumfacing.getFrontOffsetZ();
|
||||
world.spawnEntityInWorld(new EntityFireCharge(world, d0, d1, d2, d3, d4, d5));
|
||||
stack.splitStack(1);
|
||||
return stack;
|
||||
}
|
||||
protected void playDispenseSound(IBlockSource source)
|
||||
{
|
||||
source.getWorld().playAuxSFX(1009, source.getBlockPos(), 0);
|
||||
}
|
||||
});
|
||||
REGISTRY.putObject(Items.boat, new BehaviorDefaultDispenseItem()
|
||||
{
|
||||
private final BehaviorDefaultDispenseItem field_150842_b = new BehaviorDefaultDispenseItem();
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
{
|
||||
Facing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
|
||||
World world = source.getWorld();
|
||||
double d0 = source.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
|
||||
double d1 = source.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
|
||||
double d2 = source.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
|
||||
BlockPos blockpos = source.getBlockPos().offset(enumfacing);
|
||||
Material material = world.getState(blockpos).getBlock().getMaterial();
|
||||
double d3;
|
||||
|
||||
if (material.isColdLiquid())
|
||||
{
|
||||
d3 = 1.0D;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Material.air.equals(material) || !world.getState(blockpos.down()).getBlock().getMaterial().isColdLiquid())
|
||||
{
|
||||
return this.field_150842_b.dispense(source, stack);
|
||||
}
|
||||
|
||||
d3 = 0.0D;
|
||||
}
|
||||
|
||||
EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
|
||||
world.spawnEntityInWorld(entityboat);
|
||||
stack.splitStack(1);
|
||||
return stack;
|
||||
}
|
||||
protected void playDispenseSound(IBlockSource source)
|
||||
{
|
||||
source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0);
|
||||
}
|
||||
});
|
||||
IBehaviorDispenseItem ibehaviordispenseitem = new BehaviorDefaultDispenseItem()
|
||||
{
|
||||
private final BehaviorDefaultDispenseItem field_150841_b = new BehaviorDefaultDispenseItem();
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
{
|
||||
ItemBucket itembucket = (ItemBucket)stack.getItem();
|
||||
BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
|
||||
|
||||
if (itembucket.tryPlaceContainedLiquid(source.getWorld(), blockpos))
|
||||
{
|
||||
stack.setItem(Items.bucket);
|
||||
stack.stackSize = 1;
|
||||
return stack;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.field_150841_b.dispense(source, stack);
|
||||
}
|
||||
}
|
||||
};
|
||||
// REGISTRY.putObject(Items.lava_bucket, ibehaviordispenseitem);
|
||||
// REGISTRY.putObject(Items.water_bucket, ibehaviordispenseitem);
|
||||
// REGISTRY.putObject(Items.fluid_bucket, ibehaviordispenseitem);
|
||||
for(int z = 0; z < FluidRegistry.getNumFluids(); z++) {
|
||||
REGISTRY.putObject(ItemRegistry.getRegisteredItem(BlockRegistry.REGISTRY.getNameForObject(FluidRegistry.getStaticBlock(z)) +
|
||||
"_bucket"), ibehaviordispenseitem);
|
||||
}
|
||||
REGISTRY.putObject(Items.bucket, new BehaviorDefaultDispenseItem()
|
||||
{
|
||||
private final BehaviorDefaultDispenseItem field_150840_b = new BehaviorDefaultDispenseItem();
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
{
|
||||
World world = source.getWorld();
|
||||
BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
|
||||
State iblockstate = world.getState(blockpos);
|
||||
Block block = iblockstate.getBlock();
|
||||
Material material = block.getMaterial();
|
||||
Item item;
|
||||
// int meta = 0;
|
||||
|
||||
// if (Material.water.equals(material) && block instanceof BlockLiquid && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
|
||||
// {
|
||||
// item = Items.water_bucket;
|
||||
// }
|
||||
// else if (Material.lava.equals(material) && block instanceof BlockLiquid && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
|
||||
// {
|
||||
// item = Items.lava_bucket;
|
||||
// }
|
||||
// else
|
||||
if (material.isLiquid() && block instanceof BlockLiquid && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
|
||||
{
|
||||
item = ItemRegistry.getRegisteredItem(BlockRegistry.REGISTRY.getNameForObject(block instanceof BlockDynamicLiquid
|
||||
? FluidRegistry.getStaticBlock((BlockDynamicLiquid)block) : block) +
|
||||
"_bucket"); // Items.fluid_bucket;
|
||||
// meta = FluidRegistry.getFluidMeta((BlockLiquid)iblockstate.getBlock());
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (!Material.lava.equals(material) || !(block instanceof BlockLiquid) || ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() != 0)
|
||||
// {
|
||||
return super.dispenseStack(source, stack);
|
||||
// }
|
||||
//
|
||||
// item = Items.lava_bucket;
|
||||
}
|
||||
|
||||
world.setBlockToAir(blockpos);
|
||||
|
||||
if (--stack.stackSize == 0)
|
||||
{
|
||||
stack.setItem(item);
|
||||
stack.stackSize = 1;
|
||||
}
|
||||
else if (((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(new ItemStack(item)) < 0)
|
||||
{
|
||||
this.field_150840_b.dispense(source, new ItemStack(item, 1, 0));
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
});
|
||||
REGISTRY.putObject(Items.flint_and_steel, new BehaviorDefaultDispenseItem()
|
||||
{
|
||||
private boolean field_150839_b = true;
|
||||
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
{
|
||||
World world = source.getWorld();
|
||||
BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
|
||||
|
||||
if (world.isAirBlock(blockpos))
|
||||
{
|
||||
world.setState(blockpos, Blocks.fire.getState());
|
||||
|
||||
if (stack.attemptDamageItem(1, world.rand))
|
||||
{
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
else if (world.getState(blockpos).getBlock() == Blocks.tnt)
|
||||
{
|
||||
Blocks.tnt.onBlockDestroyedByPlayer(world, blockpos, Blocks.tnt.getState().withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true)));
|
||||
world.setBlockToAir(blockpos);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_150839_b = false;
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
protected void playDispenseSound(IBlockSource source)
|
||||
{
|
||||
if (this.field_150839_b)
|
||||
{
|
||||
source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
REGISTRY.putObject(Items.dye, new BehaviorDefaultDispenseItem()
|
||||
{
|
||||
private boolean field_150838_b = true;
|
||||
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
{
|
||||
if (DyeColor.WHITE == DyeColor.byDyeDamage(stack.getMetadata()))
|
||||
{
|
||||
World world = source.getWorld();
|
||||
BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
|
||||
|
||||
if (ItemDye.applyBonemeal(stack, world, blockpos))
|
||||
{
|
||||
if (!world.client)
|
||||
{
|
||||
world.playAuxSFX(2005, blockpos, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_150838_b = false;
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.dispenseStack(source, stack);
|
||||
}
|
||||
}
|
||||
protected void playDispenseSound(IBlockSource source)
|
||||
{
|
||||
if (this.field_150838_b)
|
||||
{
|
||||
source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
REGISTRY.putObject(ItemRegistry.getItemFromBlock(Blocks.tnt), new BehaviorDefaultDispenseItem()
|
||||
{
|
||||
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
{
|
||||
World world = source.getWorld();
|
||||
BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
|
||||
EntityTnt entitytntprimed = new EntityTnt(world, (double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, (EntityLiving)null, stack.getMetadata());
|
||||
world.spawnEntityInWorld(entitytntprimed);
|
||||
world.playSoundAtEntity(entitytntprimed, SoundEvent.FUSE, 1.0F, 1.0F);
|
||||
--stack.stackSize;
|
||||
return stack;
|
||||
}
|
||||
});
|
||||
// REGISTRY.putObject(Items.skull, new BehaviorDefaultDispenseItem()
|
||||
// {
|
||||
// private boolean field_179240_b = true;
|
||||
// protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
// {
|
||||
// World world = source.getWorld();
|
||||
// EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
|
||||
// BlockPos blockpos = source.getBlockPos().offset(enumfacing);
|
||||
// BlockSkull blockskull = Blocks.skull;
|
||||
//
|
||||
// if (world.isAirBlock(blockpos) && blockskull.canDispenserPlace(world, blockpos, stack))
|
||||
// {
|
||||
// if (!world.client)
|
||||
// {
|
||||
// world.setBlockState(blockpos, blockskull.getDefaultState().withProperty(BlockSkull.FACING, EnumFacing.UP), 3);
|
||||
// TileEntity tileentity = world.getTileEntity(blockpos);
|
||||
//
|
||||
// if (tileentity instanceof TileEntitySkull)
|
||||
// {
|
||||
// if (stack.getMetadata() == 3)
|
||||
// {
|
||||
// String user = null;
|
||||
//
|
||||
// if (stack.hasTagCompound())
|
||||
// {
|
||||
// NBTTagCompound nbttagcompound = stack.getTagCompound();
|
||||
//
|
||||
// if (nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0)
|
||||
// {
|
||||
// user = nbttagcompound.getString("SkullOwner");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// ((TileEntitySkull)tileentity).setUser(user);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ((TileEntitySkull)tileentity).setType(stack.getMetadata());
|
||||
// }
|
||||
//
|
||||
// ((TileEntitySkull)tileentity).setSkullRotation(enumfacing.getOpposite().getHorizontalIndex() * 4);
|
||||
//// Blocks.skull.checkWitherSpawn(world, blockpos, (TileEntitySkull)tileentity);
|
||||
// }
|
||||
//
|
||||
// --stack.stackSize;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.field_179240_b = false;
|
||||
// }
|
||||
//
|
||||
// return stack;
|
||||
// }
|
||||
// protected void playDispenseSound(IBlockSource source)
|
||||
// {
|
||||
// if (this.field_179240_b)
|
||||
// {
|
||||
// source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// REGISTRY.putObject(ItemRegistry.getItemFromBlock(Blocks.pumpkin), new BehaviorDefaultDispenseItem()
|
||||
// {
|
||||
// private boolean field_179241_b = true;
|
||||
// protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
// {
|
||||
// World world = source.getWorld();
|
||||
// BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
|
||||
// BlockPumpkin blockpumpkin = (BlockPumpkin)Blocks.pumpkin;
|
||||
//
|
||||
// if (world.isAirBlock(blockpos) && blockpumpkin.canDispenserPlace(world, blockpos))
|
||||
// {
|
||||
// if (!world.client)
|
||||
// {
|
||||
// world.setBlockState(blockpos, blockpumpkin.getDefaultState(), 3);
|
||||
// }
|
||||
//
|
||||
// --stack.stackSize;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.field_179241_b = false;
|
||||
// }
|
||||
//
|
||||
// return stack;
|
||||
// }
|
||||
// protected void playDispenseSound(IBlockSource source)
|
||||
// {
|
||||
// if (this.field_179241_b)
|
||||
// {
|
||||
// source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
22
java/src/game/init/EntityEggInfo.java
Executable file
22
java/src/game/init/EntityEggInfo.java
Executable file
|
@ -0,0 +1,22 @@
|
|||
package game.init;
|
||||
|
||||
public class EntityEggInfo
|
||||
{
|
||||
public final String spawnedID;
|
||||
public final String origin;
|
||||
public final int primaryColor;
|
||||
public final int secondaryColor;
|
||||
// public final StatBase killStat;
|
||||
// public final StatBase killedByStat;
|
||||
|
||||
public EntityEggInfo(String id, String origin, int baseColor, int spotColor)
|
||||
{
|
||||
this.spawnedID = id;
|
||||
this.origin = origin;
|
||||
this.primaryColor = baseColor;
|
||||
this.secondaryColor = spotColor;
|
||||
// this.killStat = new StatBase("stat.killEntity." + this.spawnedID, EntityRegistry.getEntityName(this.spawnedID) + " getötet");
|
||||
// this.killedByStat = new StatBase("stat.entityKilledBy." + this.spawnedID,
|
||||
// "Von " + EntityRegistry.getEntityName(this.spawnedID) + " getötet");
|
||||
}
|
||||
}
|
428
java/src/game/init/EntityRegistry.java
Executable file
428
java/src/game/init/EntityRegistry.java
Executable file
|
@ -0,0 +1,428 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import game.Log;
|
||||
import game.collect.Maps;
|
||||
import game.entity.Entity;
|
||||
import game.entity.animal.EntityBat;
|
||||
import game.entity.animal.EntityChicken;
|
||||
import game.entity.animal.EntityCow;
|
||||
import game.entity.animal.EntityDragon;
|
||||
import game.entity.animal.EntityHorse;
|
||||
import game.entity.animal.EntityMooshroom;
|
||||
import game.entity.animal.EntityMouse;
|
||||
import game.entity.animal.EntityOcelot;
|
||||
import game.entity.animal.EntityPig;
|
||||
import game.entity.animal.EntityRabbit;
|
||||
import game.entity.animal.EntitySheep;
|
||||
import game.entity.animal.EntitySquid;
|
||||
import game.entity.animal.EntityWolf;
|
||||
import game.entity.effect.EntityLightning;
|
||||
import game.entity.item.EntityBoat;
|
||||
import game.entity.item.EntityCart;
|
||||
import game.entity.item.EntityChestCart;
|
||||
import game.entity.item.EntityCrystal;
|
||||
import game.entity.item.EntityExplosion;
|
||||
import game.entity.item.EntityFalling;
|
||||
import game.entity.item.EntityFireworks;
|
||||
import game.entity.item.EntityHopperCart;
|
||||
import game.entity.item.EntityItem;
|
||||
import game.entity.item.EntityLeashKnot;
|
||||
import game.entity.item.EntityMinecart;
|
||||
import game.entity.item.EntityNuke;
|
||||
import game.entity.item.EntityOrb;
|
||||
import game.entity.item.EntityTnt;
|
||||
import game.entity.item.EntityTntCart;
|
||||
import game.entity.item.EntityXp;
|
||||
import game.entity.item.EntityXpBottle;
|
||||
import game.entity.npc.SpeciesInfo;
|
||||
import game.entity.projectile.EntityArrow;
|
||||
import game.entity.projectile.EntityBox;
|
||||
import game.entity.projectile.EntityBullet;
|
||||
import game.entity.projectile.EntityDie;
|
||||
import game.entity.projectile.EntityDynamite;
|
||||
import game.entity.projectile.EntityEgg;
|
||||
import game.entity.projectile.EntityFireCharge;
|
||||
import game.entity.projectile.EntityFireball;
|
||||
import game.entity.projectile.EntityHook;
|
||||
import game.entity.projectile.EntityPotion;
|
||||
import game.entity.projectile.EntitySnowball;
|
||||
import game.entity.types.EntityLiving;
|
||||
import game.entity.types.IObjectData;
|
||||
import game.init.SpeciesRegistry.ModelType;
|
||||
import game.nbt.NBTTagCompound;
|
||||
import game.renderer.entity.Render;
|
||||
import game.renderer.entity.RenderArachnoid;
|
||||
import game.renderer.entity.RenderArrow;
|
||||
import game.renderer.entity.RenderBat;
|
||||
import game.renderer.entity.RenderBlockEntity;
|
||||
import game.renderer.entity.RenderBoat;
|
||||
import game.renderer.entity.RenderBullet;
|
||||
import game.renderer.entity.RenderChicken;
|
||||
import game.renderer.entity.RenderCow;
|
||||
import game.renderer.entity.RenderCrystal;
|
||||
import game.renderer.entity.RenderDie;
|
||||
import game.renderer.entity.RenderDragon;
|
||||
import game.renderer.entity.RenderDynamite;
|
||||
import game.renderer.entity.RenderEntity;
|
||||
import game.renderer.entity.RenderEntityItem;
|
||||
import game.renderer.entity.RenderFallingBlock;
|
||||
import game.renderer.entity.RenderFireball;
|
||||
import game.renderer.entity.RenderFish;
|
||||
import game.renderer.entity.RenderFlyingBox;
|
||||
import game.renderer.entity.RenderHorse;
|
||||
import game.renderer.entity.RenderHumanoid;
|
||||
import game.renderer.entity.RenderItem;
|
||||
import game.renderer.entity.RenderItemEntity;
|
||||
import game.renderer.entity.RenderLeashKnot;
|
||||
import game.renderer.entity.RenderLightning;
|
||||
import game.renderer.entity.RenderManager;
|
||||
import game.renderer.entity.RenderMinecart;
|
||||
import game.renderer.entity.RenderMooshroom;
|
||||
import game.renderer.entity.RenderMouse;
|
||||
import game.renderer.entity.RenderNpc;
|
||||
import game.renderer.entity.RenderOcelot;
|
||||
import game.renderer.entity.RenderPig;
|
||||
import game.renderer.entity.RenderPotion;
|
||||
import game.renderer.entity.RenderRabbit;
|
||||
import game.renderer.entity.RenderSheep;
|
||||
import game.renderer.entity.RenderSlime;
|
||||
import game.renderer.entity.RenderSpaceMarine;
|
||||
import game.renderer.entity.RenderSquid;
|
||||
import game.renderer.entity.RenderTntMinecart;
|
||||
import game.renderer.entity.RenderTntPrimed;
|
||||
import game.renderer.entity.RenderWolf;
|
||||
import game.renderer.entity.RenderXpOrb;
|
||||
import game.renderer.model.ModelChicken;
|
||||
import game.renderer.model.ModelCow;
|
||||
import game.renderer.model.ModelHorse;
|
||||
import game.renderer.model.ModelMouse;
|
||||
import game.renderer.model.ModelOcelot;
|
||||
import game.renderer.model.ModelPig;
|
||||
import game.renderer.model.ModelRabbit;
|
||||
import game.renderer.model.ModelSheep2;
|
||||
import game.renderer.model.ModelSquid;
|
||||
import game.renderer.model.ModelWolf;
|
||||
import game.world.World;
|
||||
|
||||
public abstract class EntityRegistry {
|
||||
private static final Map<String, Class<? extends Entity>> STRING_TO_CLASS = Maps.<String, Class<? extends Entity>>newHashMap();
|
||||
private static final Map<Class<? extends Entity>, String> CLASS_TO_STRING = Maps.<Class<? extends Entity>, String>newHashMap();
|
||||
private static final Map<Integer, Class<? extends Entity>> ID_TO_CLASS = Maps.<Integer, Class<? extends Entity>>newHashMap();
|
||||
private static final Map<Class<? extends Entity>, Integer> CLASS_TO_ID = Maps.<Class<? extends Entity>, Integer>newHashMap();
|
||||
// private static final Map<String, Integer> STRING_TO_ID = Maps.<String, Integer>newHashMap();
|
||||
public static final Map<String, EntityEggInfo> SPAWN_EGGS = Maps.<String, EntityEggInfo>newLinkedHashMap();
|
||||
private static final Map<String, String> STRING_TO_NAME = Maps.<String, String>newHashMap();
|
||||
|
||||
private static boolean register;
|
||||
private static int nextNetId;
|
||||
|
||||
private static int registerEntity(String name, Class<? extends Entity> clazz, String typename) {
|
||||
if(clazz == null)
|
||||
throw new IllegalArgumentException("Kann keine null-Klasse registrieren");
|
||||
// String name = clazz.getSimpleName();
|
||||
// if(!name.startsWith("Entity"))
|
||||
// throw new IllegalArgumentException("Fehlerhafter Klassenname: " + name);
|
||||
// name = name.substring(6);
|
||||
if(STRING_TO_CLASS.containsKey(name))
|
||||
throw new IllegalArgumentException("Klasse ist bereits registriert: " + name);
|
||||
int id = ++nextNetId;
|
||||
STRING_TO_CLASS.put(name, clazz);
|
||||
CLASS_TO_STRING.put(clazz, name);
|
||||
ID_TO_CLASS.put(id, clazz);
|
||||
CLASS_TO_ID.put(clazz, id);
|
||||
// STRING_TO_ID.put(name, id);
|
||||
STRING_TO_NAME.put(name, typename);
|
||||
return id;
|
||||
}
|
||||
|
||||
private static void registerEntity(String name, Class<? extends EntityLiving> clazz, String origin, String typename, int eggColor, int spotColor) {
|
||||
if(register) {
|
||||
registerEntity(name, clazz, typename);
|
||||
}
|
||||
else {
|
||||
// String name = clazz.getSimpleName().substring(6);
|
||||
SPAWN_EGGS.put(name, new EntityEggInfo(name, origin, eggColor, spotColor));
|
||||
}
|
||||
}
|
||||
|
||||
// private static void registerEntity(Class<? extends EntityLiving> clazz, String origin, String typename, int eggColor, int spotColor) {
|
||||
// SpeciesInfo species = SpeciesRegistry.CLASSES.get(clazz);
|
||||
// if(species == null)
|
||||
// throw new IllegalArgumentException("'" + typename + "' ist keine NPC-Klasse");
|
||||
// registerEntity(species.sname, clazz, origin, typename, eggColor, spotColor);
|
||||
// }
|
||||
|
||||
public static Entity createEntityByName(String entityName, World worldIn) {
|
||||
Entity entity = null;
|
||||
|
||||
try {
|
||||
Class<? extends Entity> oclass = (Class)STRING_TO_CLASS.get(entityName);
|
||||
|
||||
if(oclass != null) {
|
||||
entity = (Entity)oclass.getConstructor(World.class).newInstance(worldIn);
|
||||
}
|
||||
}
|
||||
catch(Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static Entity createEntityFromNBT(NBTTagCompound nbt, World worldIn) {
|
||||
Entity entity = null;
|
||||
|
||||
// if("Minecart".equals(nbt.getString("id"))) {
|
||||
// nbt.setString("id", EntityMinecart.EnumMinecartType.byNetworkID(nbt.getInteger("Type")).getName());
|
||||
// nbt.removeTag("Type");
|
||||
// }
|
||||
|
||||
try {
|
||||
Class<? extends Entity> oclass = (Class)STRING_TO_CLASS.get(nbt.getString("id"));
|
||||
|
||||
if(oclass != null) {
|
||||
entity = (Entity)oclass.getConstructor(World.class).newInstance(worldIn);
|
||||
}
|
||||
}
|
||||
catch(Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
if(entity != null) {
|
||||
entity.readFromNBT(nbt);
|
||||
}
|
||||
else {
|
||||
Log.JNI.warn("Ignoriere Objekt mit Name " + nbt.getString("id"));
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static Entity createEntityByID(int entityID, World worldIn) {
|
||||
Entity entity = null;
|
||||
|
||||
try {
|
||||
Class<? extends Entity> oclass = ID_TO_CLASS.get(entityID);
|
||||
|
||||
if(oclass != null) {
|
||||
entity = oclass.getConstructor(World.class).newInstance(worldIn);
|
||||
}
|
||||
}
|
||||
catch(Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
if(entity == null) {
|
||||
Log.JNI.warn("Ignoriere Objekt mit ID " + entityID);
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static Entity createEntityByID(int entityID, World worldIn, double x, double y, double z, int data) {
|
||||
Entity entity = null;
|
||||
|
||||
try {
|
||||
Class<? extends Entity> oclass = ID_TO_CLASS.get(entityID);
|
||||
|
||||
if(oclass != null) {
|
||||
if(IObjectData.class.isAssignableFrom(oclass)) {
|
||||
// Constructor<? extends Entity> cn;
|
||||
// try {
|
||||
entity = oclass.getConstructor(World.class, double.class, double.class, double.class, int.class)
|
||||
.newInstance(worldIn, x, y, z, data);
|
||||
// }
|
||||
// catch(NoSuchMethodException e) {
|
||||
// }
|
||||
}
|
||||
// if(entity == null)
|
||||
else {
|
||||
entity = oclass.getConstructor(World.class, double.class, double.class, double.class)
|
||||
.newInstance(worldIn, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
if(entity == null) {
|
||||
Log.JNI.warn("Ignoriere Objekt mit ID " + entityID);
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static int getEntityID(Entity entityIn) {
|
||||
Integer integer = CLASS_TO_ID.get(entityIn.getClass());
|
||||
return integer == null ? 0 : integer.intValue();
|
||||
}
|
||||
|
||||
public static String getEntityString(Entity entityIn) {
|
||||
return CLASS_TO_STRING.get(entityIn.getClass());
|
||||
}
|
||||
|
||||
public static String getEntityName(String name) {
|
||||
String typename = STRING_TO_NAME.get(name);
|
||||
return typename == null ? "Unbekannt" : typename;
|
||||
}
|
||||
|
||||
public static String getEntityString(Class<? extends Entity> clazz) {
|
||||
return CLASS_TO_STRING.get(clazz);
|
||||
}
|
||||
|
||||
// public static List<String> getEntityNameList(boolean lower) {
|
||||
// Set<String> set = STRING_TO_CLASS.keySet();
|
||||
// List<String> list = Lists.<String>newArrayList();
|
||||
//
|
||||
// for(String s : set) {
|
||||
// Class<? extends Entity> oclass = (Class)STRING_TO_CLASS.get(s);
|
||||
//
|
||||
// if((oclass.getModifiers() & Modifier.ABSTRACT) != Modifier.ABSTRACT) {
|
||||
// list.add(lower ? s.toLowerCase() : s);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// list.add(lower ? "lightning" : "Lightning");
|
||||
// return list;
|
||||
// }
|
||||
|
||||
public static Set<Class<? extends Entity>> getAllClasses() {
|
||||
return CLASS_TO_STRING.keySet();
|
||||
}
|
||||
|
||||
static void registerEggs() {
|
||||
registerEntity("Dragon", EntityDragon.class, "tbd", "Drache", 0x000000, 0x580094);
|
||||
registerEntity("Bat", EntityBat.class, "transylvania", "Fledermaus", 4996656, 986895);
|
||||
registerEntity("Pig", EntityPig.class, "terra", "Schwein", 15771042, 14377823);
|
||||
registerEntity("Sheep", EntitySheep.class, "terra", "Schaf", 15198183, 16758197);
|
||||
registerEntity("Cow", EntityCow.class, "terra", "Kuh", 4470310, 10592673);
|
||||
registerEntity("Chicken", EntityChicken.class, "terra", "Huhn", 10592673, 16711680);
|
||||
registerEntity("Squid", EntitySquid.class, "tbd", "Tintenfisch", 2243405, 7375001);
|
||||
registerEntity("Wolf", EntityWolf.class, "terra", "Wolf", 14144467, 13545366);
|
||||
registerEntity("Mooshroom", EntityMooshroom.class, "tbd", "Pilzkuh", 10489616, 12040119);
|
||||
registerEntity("Ocelot", EntityOcelot.class, "terra", "Ozelot", 15720061, 5653556);
|
||||
registerEntity("Horse", EntityHorse.class, "terra", "Pferd", 12623485, 15656192);
|
||||
registerEntity("Rabbit", EntityRabbit.class, "terra", "Kaninchen", 10051392, 7555121);
|
||||
registerEntity("Mouse", EntityMouse.class, "terra", "Maus", 0x606060, 0xb0b0b0);
|
||||
|
||||
for(int z = 0; z < SpeciesRegistry.SPECIMEN.size(); z++) {
|
||||
SpeciesInfo info = SpeciesRegistry.SPECIMEN.get(z);
|
||||
registerEntity(info.id, info.clazz, info.origin, info.name, info.color1, info.color2);
|
||||
}
|
||||
}
|
||||
|
||||
static void register() {
|
||||
register = true;
|
||||
|
||||
registerEntity("Item", EntityItem.class, "Gegenstand");
|
||||
registerEntity("Xp", EntityXp.class, "Erfahrungskugel");
|
||||
registerEntity("Egg", EntityEgg.class, "Ei");
|
||||
registerEntity("LeashKnot", EntityLeashKnot.class, "Leinenknoten");
|
||||
// registerEntity("Painting", EntityPainting.class, "Gemälde");
|
||||
registerEntity("Arrow", EntityArrow.class, "Pfeil");
|
||||
registerEntity("Snowball", EntitySnowball.class, "Schneeball");
|
||||
registerEntity("Fireball", EntityFireball.class, "Feuerball");
|
||||
registerEntity("FireCharge", EntityFireCharge.class, "Feuerkugel");
|
||||
registerEntity("Orb", EntityOrb.class, "Geladene Kugel");
|
||||
registerEntity("Potion", EntityPotion.class, "Trank");
|
||||
registerEntity("XpBottle", EntityXpBottle.class, "Erfahrungsfläschchen");
|
||||
// registerEntity("Frame", EntityFrame.class, "Rahmen");
|
||||
registerEntity("Box", EntityBox.class, "Eisenwürfel");
|
||||
registerEntity("Tnt", EntityTnt.class, "TNT");
|
||||
registerEntity("Falling", EntityFalling.class, "Fallender Block");
|
||||
registerEntity("Fireworks", EntityFireworks.class, "Feuerwerk");
|
||||
registerEntity("Boat", EntityBoat.class, "Boot");
|
||||
registerEntity("Minecart", EntityMinecart.class, "Lore");
|
||||
registerEntity("ChestCart", EntityChestCart.class, "Güterlore");
|
||||
registerEntity("TntCart", EntityTntCart.class, "TNT-Lore");
|
||||
registerEntity("HopperCart", EntityHopperCart.class, "Trichterlore");
|
||||
registerEntity("Hook", EntityHook.class, "Angelhaken");
|
||||
registerEntity("Dynamite", EntityDynamite.class, "Dynamit");
|
||||
registerEntity("Nuke", EntityNuke.class, "T-17");
|
||||
registerEntity("Die", EntityDie.class, "Würfel");
|
||||
registerEntity("Explosion", EntityExplosion.class, "Explosion");
|
||||
registerEntity("Crystal", EntityCrystal.class, "Kristall");
|
||||
registerEntity("Bullet", EntityBullet.class, "Kugel");
|
||||
|
||||
//// nextNetId = 255;
|
||||
// registerEntity("Dragon", EntityDragon.class, 0x000000, 0x580094);
|
||||
// registerEntity("Bat", EntityBat.class, 4996656, 986895);
|
||||
// registerEntity("Pig", EntityPig.class, 15771042, 14377823);
|
||||
// registerEntity("Sheep", EntitySheep.class, 15198183, 16758197);
|
||||
// registerEntity("Cow", EntityCow.class, 4470310, 10592673);
|
||||
// registerEntity("Chicken", EntityChicken.class, 10592673, 16711680);
|
||||
// registerEntity("Squid", EntitySquid.class, 2243405, 7375001);
|
||||
// registerEntity("Wolf", EntityWolf.class, 14144467, 13545366);
|
||||
// registerEntity("Mooshroom", EntityMooshroom.class, 10489616, 12040119);
|
||||
// registerEntity("Ocelot", EntityOcelot.class, 15720061, 5653556);
|
||||
// registerEntity("Horse", EntityHorse.class, 12623485, 15656192);
|
||||
// registerEntity("Rabbit", EntityRabbit.class, 10051392, 7555121);
|
||||
// registerEntity("Mouse", EntityMouse.class, 0x606060, 0xb0b0b0);
|
||||
//
|
||||
//// nextNetId = 511;
|
||||
// for(int z = 0; z < SpeciesRegistry.SPECIMEN.size(); z++) {
|
||||
// SpeciesInfo info = SpeciesRegistry.SPECIMEN.get(z);
|
||||
// registerEntity(info.clazz, info.color1, info.color2);
|
||||
// }
|
||||
registerEggs();
|
||||
}
|
||||
|
||||
public static void registerRenderers(Map<Class<? extends Entity>, Render<? extends Entity>> map,
|
||||
Map<ModelType, RenderNpc> models, RenderManager mgr, RenderItem ritem) {
|
||||
map.put(EntityPig.class, new RenderPig(mgr, new ModelPig()));
|
||||
map.put(EntitySheep.class, new RenderSheep(mgr, new ModelSheep2()));
|
||||
map.put(EntityCow.class, new RenderCow(mgr, new ModelCow()));
|
||||
map.put(EntityMooshroom.class, new RenderMooshroom(mgr, new ModelCow()));
|
||||
map.put(EntityWolf.class, new RenderWolf(mgr, new ModelWolf()));
|
||||
map.put(EntityChicken.class, new RenderChicken(mgr, new ModelChicken()));
|
||||
map.put(EntityOcelot.class, new RenderOcelot(mgr, new ModelOcelot()));
|
||||
map.put(EntityRabbit.class, new RenderRabbit(mgr, new ModelRabbit()));
|
||||
map.put(EntitySquid.class, new RenderSquid(mgr, new ModelSquid()));
|
||||
map.put(EntityBat.class, new RenderBat(mgr));
|
||||
map.put(EntityDragon.class, new RenderDragon(mgr));
|
||||
map.put(EntityCrystal.class, new RenderCrystal(mgr));
|
||||
map.put(Entity.class, new RenderEntity(mgr));
|
||||
// map.put(EntityPainting.class, new RenderPainting(mgr));
|
||||
// map.put(EntityFrame.class, new RenderItemFrame(mgr, ritem));
|
||||
map.put(EntityLeashKnot.class, new RenderLeashKnot(mgr));
|
||||
map.put(EntityArrow.class, new RenderArrow(mgr));
|
||||
map.put(EntitySnowball.class, new RenderItemEntity(mgr, Items.snowball, ritem));
|
||||
map.put(EntityOrb.class, new RenderItemEntity(mgr, Items.charged_orb, ritem));
|
||||
map.put(EntityEgg.class, new RenderItemEntity(mgr, Items.egg, ritem));
|
||||
map.put(EntityPotion.class, new RenderPotion(mgr, ritem));
|
||||
map.put(EntityXpBottle.class, new RenderItemEntity(mgr, Items.experience_bottle, ritem));
|
||||
map.put(EntityFireworks.class, new RenderItemEntity(mgr, Items.fireworks, ritem));
|
||||
map.put(EntityFireball.class, new RenderFireball(mgr, 0.75F));
|
||||
map.put(EntityFireCharge.class, new RenderFireball(mgr, 0.5F));
|
||||
map.put(EntityBox.class, new RenderFlyingBox(mgr));
|
||||
map.put(EntityItem.class, new RenderEntityItem(mgr, ritem));
|
||||
map.put(EntityXp.class, new RenderXpOrb(mgr));
|
||||
map.put(EntityTnt.class, new RenderTntPrimed(mgr));
|
||||
map.put(EntityFalling.class, new RenderFallingBlock(mgr));
|
||||
map.put(EntityTntCart.class, new RenderTntMinecart(mgr));
|
||||
map.put(EntityCart.class, new RenderMinecart(mgr));
|
||||
map.put(EntityBoat.class, new RenderBoat(mgr));
|
||||
map.put(EntityHook.class, new RenderFish(mgr));
|
||||
map.put(EntityHorse.class, new RenderHorse(mgr, new ModelHorse()));
|
||||
map.put(EntityDynamite.class, new RenderDynamite(mgr, Items.dynamite, ritem));
|
||||
map.put(EntityNuke.class, new RenderBlockEntity(mgr, Blocks.nuke.getState()));
|
||||
map.put(EntityMouse.class, new RenderMouse(mgr, new ModelMouse()));
|
||||
map.put(EntityDie.class, new RenderDie(mgr));
|
||||
map.put(EntityBullet.class, new RenderBullet(mgr));
|
||||
map.put(EntityLightning.class, new RenderLightning(mgr));
|
||||
models.put(ModelType.HUMANOID, new RenderHumanoid(mgr, 12, 12, "textures/entity/char.png"));
|
||||
models.put(ModelType.ARACHNOID, new RenderArachnoid(mgr));
|
||||
models.put(ModelType.SLIME, new RenderSlime(mgr));
|
||||
models.put(ModelType.DWARF, new RenderHumanoid(mgr, 10, 10, "textures/entity/dwarf.png"));
|
||||
models.put(ModelType.HALFLING, new RenderHumanoid(mgr, 8, 8, "textures/entity/goblin.png"));
|
||||
models.put(ModelType.SPACE_MARINE, new RenderSpaceMarine(mgr));
|
||||
for(int z = 0; z < SpeciesRegistry.SPECIMEN.size(); z++) {
|
||||
SpeciesInfo info = SpeciesRegistry.SPECIMEN.get(z);
|
||||
map.put(info.clazz, models.get(info.renderer));
|
||||
}
|
||||
}
|
||||
}
|
75
java/src/game/init/FlammabilityRegistry.java
Executable file
75
java/src/game/init/FlammabilityRegistry.java
Executable file
|
@ -0,0 +1,75 @@
|
|||
package game.init;
|
||||
|
||||
import game.block.Block;
|
||||
|
||||
public abstract class FlammabilityRegistry {
|
||||
private static void setFlammable(Block blockIn, int encouragement, int flammability) {
|
||||
Blocks.fire.setFireInfo(blockIn, encouragement, flammability);
|
||||
}
|
||||
|
||||
static void register() {
|
||||
// setFlammable(Blocks.planks, 5, 20);
|
||||
for(WoodType wood : WoodType.values()) {
|
||||
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_planks"), 5, 20);
|
||||
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_slab"), 5, 20);
|
||||
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_stairs"), 5, 20);
|
||||
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_fence"), 5, 20);
|
||||
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_fence_gate"), 5, 20);
|
||||
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_log"), 5, 5);
|
||||
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_leaves"), 30, 60);
|
||||
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_sapling"), 15, 100);
|
||||
}
|
||||
setFlammable(Blocks.bookshelf, 30, 20);
|
||||
setFlammable(Blocks.tnt, 15, 100);
|
||||
setFlammable(Blocks.tallgrass, 60, 100);
|
||||
setFlammable(Blocks.double_plant, 60, 100);
|
||||
setFlammable(Blocks.flower, 60, 100);
|
||||
setFlammable(Blocks.deadbush, 60, 100);
|
||||
setFlammable(Blocks.dry_leaves, 60, 100);
|
||||
setFlammable(Blocks.wool, 30, 60);
|
||||
setFlammable(Blocks.vine, 15, 100);
|
||||
setFlammable(Blocks.coal_block, 5, 5);
|
||||
setFlammable(Blocks.hay_block, 60, 20);
|
||||
setFlammable(Blocks.carpet, 60, 20);
|
||||
|
||||
// setFlammable(Blocks.double_wooden_slab, 5, 20);
|
||||
// setFlammable(Blocks.wooden_slab, 5, 20);
|
||||
// setFlammable(Blocks.oak_fence_gate, 5, 20);
|
||||
// setFlammable(Blocks.spruce_fence_gate, 5, 20);
|
||||
// setFlammable(Blocks.birch_fence_gate, 5, 20);
|
||||
// setFlammable(Blocks.jungle_fence_gate, 5, 20);
|
||||
// setFlammable(Blocks.dark_oak_fence_gate, 5, 20);
|
||||
// setFlammable(Blocks.acacia_fence_gate, 5, 20);
|
||||
// setFlammable(Blocks.oak_fence, 5, 20);
|
||||
// setFlammable(Blocks.spruce_fence, 5, 20);
|
||||
// setFlammable(Blocks.birch_fence, 5, 20);
|
||||
// setFlammable(Blocks.jungle_fence, 5, 20);
|
||||
// setFlammable(Blocks.dark_oak_fence, 5, 20);
|
||||
// setFlammable(Blocks.acacia_fence, 5, 20);
|
||||
// setFlammable(Blocks.oak_stairs, 5, 20);
|
||||
// setFlammable(Blocks.birch_stairs, 5, 20);
|
||||
// setFlammable(Blocks.spruce_stairs, 5, 20);
|
||||
// setFlammable(Blocks.jungle_stairs, 5, 20);
|
||||
// setFlammable(Blocks.log, 5, 5);
|
||||
// setFlammable(Blocks.log2, 5, 5);
|
||||
// for(BlockLeaves leaves : BlockLeaves.LEAVES) {
|
||||
// setFlammable(leaves, 30, 60);
|
||||
//// setFlammable(Blocks.leaves2, 30, 60);
|
||||
// }
|
||||
// setFlammable(Blocks.red_flower, 60, 100);
|
||||
// setFlammable(Blocks.cherry_leaves, 30, 60);
|
||||
// setFlammable(Blocks.maple_leaves, 30, 60);
|
||||
// setFlammable(Blocks.cherry_fence_gate, 5, 20);
|
||||
// setFlammable(Blocks.maple_fence_gate, 5, 20);
|
||||
// setFlammable(Blocks.cherry_fence, 5, 20);
|
||||
// setFlammable(Blocks.maple_fence, 5, 20);
|
||||
// setFlammable(Blocks.cherry_stairs, 5, 20);
|
||||
// setFlammable(Blocks.maple_stairs, 5, 20);
|
||||
// setFlammable(Blocks.wooden_vslab, 5, 20);
|
||||
// setFlammable(Blocks.wooden_vslab2, 5, 20);
|
||||
// for(BlockSlab slab : BlockSlab.SLABS) {
|
||||
// if(slab.getMaterial() == Material.wood)
|
||||
// setFlammable(slab, 5, 20);
|
||||
// }
|
||||
}
|
||||
}
|
84
java/src/game/init/FluidRegistry.java
Executable file
84
java/src/game/init/FluidRegistry.java
Executable file
|
@ -0,0 +1,84 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import game.block.Block;
|
||||
import game.block.BlockDynamicLiquid;
|
||||
import game.block.BlockLiquid;
|
||||
import game.block.BlockStaticLiquid;
|
||||
import game.collect.Lists;
|
||||
import game.collect.Maps;
|
||||
import game.material.Material;
|
||||
|
||||
public abstract class FluidRegistry {
|
||||
public static enum LiquidType {
|
||||
COLD(Material.coldFluid), HOT(Material.hotFluid), WATER(Material.water), LAVA(Material.lava);
|
||||
|
||||
public final Material material;
|
||||
|
||||
private LiquidType(Material material) {
|
||||
this.material = material;
|
||||
}
|
||||
}
|
||||
|
||||
static class FluidInfo {
|
||||
private final int id;
|
||||
private final BlockStaticLiquid stBlock;
|
||||
private final BlockDynamicLiquid dyBlock;
|
||||
private final Object stAnim;
|
||||
private final Object dyAnim;
|
||||
|
||||
private FluidInfo(int id, BlockStaticLiquid stBlock, BlockDynamicLiquid dyBlock, Object stAnim, Object dyAnim) {
|
||||
this.id = id;
|
||||
this.stBlock = stBlock;
|
||||
this.dyBlock = dyBlock;
|
||||
this.stAnim = stAnim;
|
||||
this.dyAnim = dyAnim;
|
||||
}
|
||||
}
|
||||
|
||||
private static int currentId;
|
||||
|
||||
private static final List<FluidInfo> FLUIDS = Lists.newArrayList();
|
||||
private static final Map<Block, Integer> ID_MAP = Maps.newHashMap();
|
||||
|
||||
public static int getFluidMeta(BlockLiquid block) {
|
||||
return ID_MAP.get(block).intValue();
|
||||
}
|
||||
|
||||
public static BlockDynamicLiquid getFluidBlock(int meta) {
|
||||
return meta < 0 || meta >= currentId ? Blocks.flowing_water : FLUIDS.get(meta).dyBlock;
|
||||
}
|
||||
|
||||
public static BlockStaticLiquid getStaticBlock(int meta) {
|
||||
return meta < 0 || meta >= currentId ? Blocks.water : FLUIDS.get(meta).stBlock;
|
||||
}
|
||||
|
||||
public static Object getFluidAnim(int meta) {
|
||||
return FLUIDS.get(meta).dyAnim;
|
||||
}
|
||||
|
||||
public static Object getStaticAnim(int meta) {
|
||||
return FLUIDS.get(meta).stAnim;
|
||||
}
|
||||
|
||||
public static int getNumFluids() {
|
||||
return currentId;
|
||||
}
|
||||
|
||||
public static BlockStaticLiquid getStaticBlock(BlockDynamicLiquid dy) {
|
||||
return FLUIDS.get(ID_MAP.get(dy).intValue()).stBlock;
|
||||
}
|
||||
|
||||
public static BlockDynamicLiquid getDynamicBlock(BlockStaticLiquid st) {
|
||||
return FLUIDS.get(ID_MAP.get(st).intValue()).dyBlock;
|
||||
}
|
||||
|
||||
static void registerFluid(BlockStaticLiquid stBlock, BlockDynamicLiquid dyBlock, Object stAnim, Object dyAnim) {
|
||||
FluidInfo info = new FluidInfo(currentId++, stBlock, dyBlock, stAnim, dyAnim);
|
||||
FLUIDS.add(info);
|
||||
ID_MAP.put(stBlock, info.id);
|
||||
ID_MAP.put(dyBlock, info.id);
|
||||
}
|
||||
}
|
5
java/src/game/init/IObjectIntIterable.java
Executable file
5
java/src/game/init/IObjectIntIterable.java
Executable file
|
@ -0,0 +1,5 @@
|
|||
package game.init;
|
||||
|
||||
public interface IObjectIntIterable<T> extends Iterable<T>
|
||||
{
|
||||
}
|
11
java/src/game/init/IRegistry.java
Executable file
11
java/src/game/init/IRegistry.java
Executable file
|
@ -0,0 +1,11 @@
|
|||
package game.init;
|
||||
|
||||
public interface IRegistry<K, V> extends Iterable<V>
|
||||
{
|
||||
V getObject(K name);
|
||||
|
||||
/**
|
||||
* Register an object on this registry.
|
||||
*/
|
||||
void putObject(K key, V value);
|
||||
}
|
647
java/src/game/init/ItemRegistry.java
Executable file
647
java/src/game/init/ItemRegistry.java
Executable file
|
@ -0,0 +1,647 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
import game.block.Block;
|
||||
import game.block.BlockBed;
|
||||
import game.block.BlockButton;
|
||||
import game.block.BlockDirt;
|
||||
import game.block.BlockDoor;
|
||||
import game.block.BlockDoublePlant;
|
||||
import game.block.BlockFence;
|
||||
import game.block.BlockFlower;
|
||||
import game.block.BlockLeaves;
|
||||
import game.block.BlockOre;
|
||||
import game.block.BlockSand;
|
||||
import game.block.BlockSandStone;
|
||||
import game.block.BlockSapling;
|
||||
import game.block.BlockSlab;
|
||||
import game.block.BlockStoneBrick;
|
||||
import game.block.BlockWall;
|
||||
import game.collect.Maps;
|
||||
import game.collect.Sets;
|
||||
import game.color.DyeColor;
|
||||
import game.color.TextColor;
|
||||
import game.entity.item.EntityCart;
|
||||
import game.entity.npc.CharacterInfo;
|
||||
import game.entity.npc.SpeciesInfo;
|
||||
import game.item.CheatTab;
|
||||
import game.item.Item;
|
||||
import game.item.ItemAmmo;
|
||||
import game.item.ItemAnvilBlock;
|
||||
import game.item.ItemAppleGold;
|
||||
import game.item.ItemArmor;
|
||||
import game.item.ItemAxe;
|
||||
import game.item.ItemBanHammer;
|
||||
import game.item.ItemBanner;
|
||||
import game.item.ItemBed;
|
||||
import game.item.ItemBlock;
|
||||
import game.item.ItemBoat;
|
||||
import game.item.ItemBoltgun;
|
||||
import game.item.ItemBook;
|
||||
import game.item.ItemBow;
|
||||
import game.item.ItemBucket;
|
||||
import game.item.ItemBucketMilk;
|
||||
import game.item.ItemButton;
|
||||
import game.item.ItemCamera;
|
||||
import game.item.ItemCarrotOnAStick;
|
||||
import game.item.ItemChargedOrb;
|
||||
import game.item.ItemChest;
|
||||
import game.item.ItemCloth;
|
||||
import game.item.ItemCoal;
|
||||
import game.item.ItemColored;
|
||||
import game.item.ItemDie;
|
||||
import game.item.ItemDispenser;
|
||||
import game.item.ItemDoor;
|
||||
import game.item.ItemDoublePlant;
|
||||
import game.item.ItemDye;
|
||||
import game.item.ItemDynamite;
|
||||
import game.item.ItemEditWand;
|
||||
import game.item.ItemEffect;
|
||||
import game.item.ItemEgg;
|
||||
import game.item.ItemEnchantedBook;
|
||||
import game.item.ItemExpBottle;
|
||||
import game.item.ItemExterminator;
|
||||
import game.item.ItemFence;
|
||||
import game.item.ItemFireball;
|
||||
import game.item.ItemFirework;
|
||||
import game.item.ItemFireworkCharge;
|
||||
import game.item.ItemFishFood;
|
||||
import game.item.ItemFishingRod;
|
||||
import game.item.ItemFlintAndSteel;
|
||||
import game.item.ItemFood;
|
||||
import game.item.ItemFragile;
|
||||
import game.item.ItemGlassBottle;
|
||||
import game.item.ItemHoe;
|
||||
import game.item.ItemHorseArmor;
|
||||
import game.item.ItemHugeMushroom;
|
||||
import game.item.ItemInfoWand;
|
||||
import game.item.ItemKey;
|
||||
import game.item.ItemLead;
|
||||
import game.item.ItemLeaves;
|
||||
import game.item.ItemLightning;
|
||||
import game.item.ItemLilyPad;
|
||||
import game.item.ItemMagnet;
|
||||
import game.item.ItemMagnetic;
|
||||
import game.item.ItemMetal;
|
||||
import game.item.ItemMetalBlock;
|
||||
import game.item.ItemMinecart;
|
||||
import game.item.ItemMonsterPlacer;
|
||||
import game.item.ItemMultiTexture;
|
||||
import game.item.ItemNameTag;
|
||||
import game.item.ItemNpcSpawner;
|
||||
import game.item.ItemNugget;
|
||||
import game.item.ItemPickaxe;
|
||||
import game.item.ItemPiston;
|
||||
import game.item.ItemPotion;
|
||||
import game.item.ItemPressurePlate;
|
||||
import game.item.ItemRecord;
|
||||
import game.item.ItemRedstone;
|
||||
import game.item.ItemReed;
|
||||
import game.item.ItemRod;
|
||||
import game.item.ItemSaddle;
|
||||
import game.item.ItemSeedFood;
|
||||
import game.item.ItemSeeds;
|
||||
import game.item.ItemShears;
|
||||
import game.item.ItemSign;
|
||||
import game.item.ItemSkull;
|
||||
import game.item.ItemSlab;
|
||||
import game.item.ItemSmall;
|
||||
import game.item.ItemSnow;
|
||||
import game.item.ItemSnowball;
|
||||
import game.item.ItemSoup;
|
||||
import game.item.ItemSpaceNavigator;
|
||||
import game.item.ItemSpade;
|
||||
import game.item.ItemStack;
|
||||
import game.item.ItemStick;
|
||||
import game.item.ItemSword;
|
||||
import game.item.ItemTNT;
|
||||
import game.item.ItemTiny;
|
||||
import game.item.ItemWall;
|
||||
import game.item.ItemWeatherToken;
|
||||
import game.potion.Potion;
|
||||
import game.potion.PotionHelper;
|
||||
import game.world.Weather;
|
||||
|
||||
public abstract class ItemRegistry {
|
||||
public static final RegistryNamespaced<String, Item> REGISTRY = new RegistryNamespaced();
|
||||
public static final Map<Block, ItemBlock> BLOCKMAP = Maps.<Block, ItemBlock>newHashMap();
|
||||
public static final Set<Block> SPECIALIZED = Sets.<Block>newHashSet();
|
||||
|
||||
private static int nextItemId = 4096;
|
||||
|
||||
public static int getIdFromItem(Item item) {
|
||||
return item == null ? 0 : REGISTRY.getIDForObject(item);
|
||||
}
|
||||
|
||||
public static Item getItemById(int id) {
|
||||
return REGISTRY.getObjectById(id);
|
||||
}
|
||||
|
||||
public static ItemBlock getItemFromBlock(Block block) {
|
||||
return BLOCKMAP.get(block);
|
||||
}
|
||||
|
||||
public static Item getRegisteredItem(String name) {
|
||||
return REGISTRY.getObject(name);
|
||||
}
|
||||
|
||||
private static ItemBlock registerFlat(Block block) {
|
||||
ItemBlock item = new ItemBlock(block, "");
|
||||
registerBlock(block, item);
|
||||
return item;
|
||||
}
|
||||
|
||||
private static ItemBlock registerFlat(Block block, String texture) {
|
||||
ItemBlock item = new ItemBlock(block, texture.indexOf('/') == -1 ? "blocks/" + texture : texture);
|
||||
registerBlock(block, item);
|
||||
return item;
|
||||
}
|
||||
|
||||
private static void registerBlock(Block block, ItemBlock item) {
|
||||
REGISTRY.register(BlockRegistry.getIdFromBlock(block), BlockRegistry.REGISTRY.getNameForObject(block), item);
|
||||
BLOCKMAP.put(block, item);
|
||||
}
|
||||
|
||||
private static void registerSpecial(Block block) {
|
||||
if(BLOCKMAP.containsKey(block) || SPECIALIZED.contains(block))
|
||||
throw new IllegalArgumentException("Block " + BlockRegistry.REGISTRY.getNameForObject(block) + " ist bereits registriert");
|
||||
SPECIALIZED.add(block);
|
||||
}
|
||||
|
||||
private static void registerItem(String name, Item item) {
|
||||
if(item.getBlock() != null)
|
||||
throw new IllegalArgumentException("Item " + name + " darf keinen Block besitzen");
|
||||
REGISTRY.register(nextItemId++, name, item);
|
||||
}
|
||||
|
||||
private static void registerItem(Item item) {
|
||||
if(item.getBlock() == null)
|
||||
throw new IllegalArgumentException("Unbenanntes Item benötigt einen Block");
|
||||
registerSpecial(item.getBlock());
|
||||
REGISTRY.register(BlockRegistry.getIdFromBlock(item.getBlock()), BlockRegistry.REGISTRY.getNameForObject(item.getBlock()), item);
|
||||
}
|
||||
|
||||
private static void registerTools(ToolMaterial material, String name, String prefix) {
|
||||
// String loc = name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||
if(material.hasTools()) {
|
||||
registerItem(name + "_shovel", (new ItemSpade(material)).setDisplay(prefix + "schaufel"));
|
||||
registerItem(name + "_pickaxe", (new ItemPickaxe(material)).setDisplay(prefix + "spitzhacke"));
|
||||
registerItem(name + "_axe", (new ItemAxe(material)).setDisplay(prefix + "axt"));
|
||||
registerItem(name + "_hoe", (new ItemHoe(material)).setDisplay(prefix + "hacke"));
|
||||
}
|
||||
if(material.hasExtras()) {
|
||||
registerItem(name + "_shears", (new ItemShears(material)).setDisplay(prefix + "schere"));
|
||||
registerItem(name + "_horse_armor", (new ItemHorseArmor(material, name)).setDisplay(prefix + "pferderüstung"));
|
||||
}
|
||||
if(material.hasWeapons()) {
|
||||
registerItem(name + "_sword", (new ItemSword(material)).setDisplay(prefix + "schwert"));
|
||||
}
|
||||
if(material.hasArmor()) {
|
||||
registerItem(name + "_helmet", (new ItemArmor(material, name, 0)).setDisplay(prefix == null ? "Kappe" : prefix + "helm"));
|
||||
registerItem(name + "_chestplate", (new ItemArmor(material, name, 1)).setDisplay(prefix == null ? "Jacke" : prefix + "brustpanzer"));
|
||||
registerItem(name + "_leggings", (new ItemArmor(material, name, 2)).setDisplay(prefix == null ? "Hose" : prefix + "beinschutz"));
|
||||
registerItem(name + "_boots", (new ItemArmor(material, name, 3)).setDisplay(prefix == null ? "Stiefel" : prefix + "stiefel"));
|
||||
}
|
||||
}
|
||||
|
||||
static void register() {
|
||||
registerBlock(Blocks.grass, new ItemColored(Blocks.grass, false));
|
||||
registerBlock(Blocks.dirt, (new ItemMultiTexture(Blocks.dirt, Blocks.dirt, new Function<ItemStack, String>() {
|
||||
public String apply(ItemStack p_apply_1_) {
|
||||
return BlockDirt.DirtType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
|
||||
}
|
||||
})).setDisplay("Erde"));
|
||||
// registerBlock(Blocks.planks, (new ItemMultiTexture(Blocks.planks, Blocks.planks, new Function<ItemStack, String>() {
|
||||
// public String apply(ItemStack p_apply_1_) {
|
||||
// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName();
|
||||
// }
|
||||
// })).setUnlocalizedName("wood"));
|
||||
// registerBlock(Blocks.sapling, (new ItemMultiTexture(Blocks.sapling, Blocks.sapling, true, new Function<ItemStack, String>() {
|
||||
// public String apply(ItemStack p_apply_1_) {
|
||||
// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName();
|
||||
// }
|
||||
// })).setUnlocalizedName("sapling"));
|
||||
registerBlock(Blocks.sand, (new ItemMultiTexture(Blocks.sand, Blocks.sand, new Function<ItemStack, String>() {
|
||||
public String apply(ItemStack p_apply_1_) {
|
||||
return BlockSand.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
|
||||
}
|
||||
})).setDisplay("Sand"));
|
||||
// registerBlock(Blocks.log, (new ItemMultiTexture(Blocks.log, Blocks.log, new Function<ItemStack, String>() {
|
||||
// public String apply(ItemStack p_apply_1_) {
|
||||
// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName();
|
||||
// }
|
||||
// })).setUnlocalizedName("log"));
|
||||
// registerBlock(Blocks.log2, (new ItemMultiTexture(Blocks.log2, Blocks.log2, new Function<ItemStack, String>() {
|
||||
// public String apply(ItemStack p_apply_1_) {
|
||||
// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata() + 4).getUnlocalizedName();
|
||||
// }
|
||||
// })).setUnlocalizedName("log"));
|
||||
registerBlock(Blocks.dispenser, new ItemDispenser(Blocks.dispenser));
|
||||
registerBlock(Blocks.sandstone, (new ItemMultiTexture(Blocks.sandstone, Blocks.sandstone, new Function<ItemStack, String>() {
|
||||
public String apply(ItemStack p_apply_1_) {
|
||||
return BlockSandStone.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
|
||||
}
|
||||
})).setDisplay("Sandstein"));
|
||||
registerFlat(Blocks.golden_rail);
|
||||
registerFlat(Blocks.detector_rail);
|
||||
registerBlock(Blocks.sticky_piston, new ItemPiston(Blocks.sticky_piston));
|
||||
registerFlat(Blocks.web);
|
||||
registerBlock(Blocks.tallgrass, (new ItemColored(Blocks.tallgrass, true, "")).setSubtypeNames(new String[] {"Busch", "Gras", "Farn"}));
|
||||
registerFlat(Blocks.deadbush);
|
||||
registerBlock(Blocks.piston, new ItemPiston(Blocks.piston));
|
||||
registerBlock(Blocks.wool, (new ItemCloth(Blocks.wool, -1)).setDisplay("Wolle"));
|
||||
registerBlock(Blocks.flower, (new ItemMultiTexture(Blocks.flower, Blocks.flower, true, new Function<ItemStack, String>() {
|
||||
public String apply(ItemStack stack) {
|
||||
return BlockFlower.EnumFlowerType.getType(BlockFlower.EnumFlowerColor.BASE, stack.getMetadata()).getDisplay();
|
||||
}
|
||||
})).setDisplay("Blume"));
|
||||
registerFlat(Blocks.brown_mushroom);
|
||||
registerFlat(Blocks.red_mushroom);
|
||||
registerBlock(Blocks.tnt, new ItemTNT(Blocks.tnt));
|
||||
registerBlock(Blocks.nuke, new ItemBlock(Blocks.nuke).setColor(TextColor.RED));
|
||||
registerFlat(Blocks.torch);
|
||||
registerBlock(Blocks.chest, new ItemChest(Blocks.chest));
|
||||
registerFlat(Blocks.ladder);
|
||||
registerFlat(Blocks.rail);
|
||||
registerFlat(Blocks.lever, "lever");
|
||||
registerBlock(Blocks.stone_pressure_plate, new ItemPressurePlate(Blocks.stone_pressure_plate));
|
||||
registerBlock(Blocks.wooden_pressure_plate, new ItemPressurePlate(Blocks.wooden_pressure_plate));
|
||||
registerFlat(Blocks.redstone_torch);
|
||||
// registerBlock(Blocks.stone_button, new ItemButton(Blocks.stone_button));
|
||||
registerBlock(Blocks.snow_layer, new ItemSnow(Blocks.snow_layer));
|
||||
// registerBlock(Blocks.oak_fence, new ItemFence(Blocks.oak_fence));
|
||||
// registerBlock(Blocks.spruce_fence, new ItemFence(Blocks.spruce_fence));
|
||||
// registerBlock(Blocks.birch_fence, new ItemFence(Blocks.birch_fence));
|
||||
// registerBlock(Blocks.jungle_fence, new ItemFence(Blocks.jungle_fence));
|
||||
// registerBlock(Blocks.dark_oak_fence, new ItemFence(Blocks.dark_oak_fence));
|
||||
// registerBlock(Blocks.acacia_fence, new ItemFence(Blocks.acacia_fence));
|
||||
registerBlock(Blocks.stonebrick, (new ItemMultiTexture(Blocks.stonebrick, Blocks.stonebrick, new Function<ItemStack, String>() {
|
||||
public String apply(ItemStack p_apply_1_) {
|
||||
return BlockStoneBrick.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
|
||||
}
|
||||
})).setDisplay("Steinziegel"));
|
||||
registerBlock(Blocks.brown_mushroom_block, new ItemHugeMushroom(Blocks.brown_mushroom_block));
|
||||
registerBlock(Blocks.red_mushroom_block, new ItemHugeMushroom(Blocks.red_mushroom_block));
|
||||
registerFlat(Blocks.iron_bars);
|
||||
registerFlat(Blocks.glass_pane, "glass");
|
||||
registerBlock(Blocks.vine, new ItemColored(Blocks.vine, false, ""));
|
||||
registerBlock(Blocks.waterlily, new ItemLilyPad(Blocks.waterlily));
|
||||
// registerBlock(Blocks.blood_brick_fence, new ItemFence(Blocks.blood_brick_fence));
|
||||
// registerBlock(Blocks.black_brick_fence, new ItemFence(Blocks.black_brick_fence));
|
||||
registerFlat(Blocks.tripwire_hook, "tripwire_hook");
|
||||
registerBlock(Blocks.cobblestone_wall,
|
||||
(new ItemWall(Blocks.cobblestone_wall, Blocks.cobblestone_wall, new Function<ItemStack, String>() {
|
||||
public String apply(ItemStack p_apply_1_) {
|
||||
return BlockWall.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
|
||||
}
|
||||
})).setDisplay("Bruchsteinmauer"));
|
||||
// registerBlock(Blocks.wooden_button, new ItemButton(Blocks.wooden_button));
|
||||
registerBlock(Blocks.anvil, (new ItemAnvilBlock(Blocks.anvil)).setDisplay("Amboss"));
|
||||
registerBlock(Blocks.trapped_chest, new ItemChest(Blocks.trapped_chest));
|
||||
registerBlock(Blocks.light_weighted_pressure_plate, new ItemPressurePlate(Blocks.light_weighted_pressure_plate));
|
||||
registerBlock(Blocks.heavy_weighted_pressure_plate, new ItemPressurePlate(Blocks.heavy_weighted_pressure_plate));
|
||||
registerFlat(Blocks.hopper, "items/hopper");
|
||||
registerBlock(Blocks.quartz_block,
|
||||
(new ItemMultiTexture(Blocks.quartz_block, Blocks.quartz_block, new String[] {"Quarzblock", "Gemeißelter Quarzblock", "Quarzsäule"}))
|
||||
.setDisplay("Quarzblock"));
|
||||
registerBlock(Blocks.black_quartz_block,
|
||||
(new ItemMultiTexture(Blocks.black_quartz_block, Blocks.black_quartz_block, new String[] {"Schwarzer Quarzblock", "Schwarzer gemeißelter Quarzblock", "Schwarze Quarzsäule"}))
|
||||
.setDisplay("Schwarzer Quarzblock"));
|
||||
registerFlat(Blocks.activator_rail);
|
||||
registerBlock(Blocks.dropper, new ItemDispenser(Blocks.dropper));
|
||||
registerBlock(Blocks.stained_hardened_clay, (new ItemCloth(Blocks.stained_hardened_clay, null)).setDisplay("gefärbter Ton"));
|
||||
registerBlock(Blocks.carpet, (new ItemCloth(Blocks.carpet, 1)).setDisplay("Teppich"));
|
||||
registerBlock(Blocks.double_plant, (new ItemDoublePlant(Blocks.double_plant, Blocks.double_plant, new Function<ItemStack, String>() {
|
||||
public String apply(ItemStack p_apply_1_) {
|
||||
return BlockDoublePlant.EnumPlantType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
|
||||
}
|
||||
})).setDisplay("Pflanze"));
|
||||
registerBlock(Blocks.stained_glass, (new ItemCloth(Blocks.stained_glass, null)).setDisplay("Glas"));
|
||||
registerBlock(Blocks.stained_glass_pane, (new ItemCloth(Blocks.stained_glass_pane, null, "glass")).setDisplay("Glasscheibe"));
|
||||
// registerBlock(Blocks.cherry_fence, new ItemFence(Blocks.cherry_fence));
|
||||
// registerBlock(Blocks.maple_fence, new ItemFence(Blocks.maple_fence));
|
||||
registerFlat(Blocks.blue_mushroom);
|
||||
// registerBlock(Blocks.red_button, new ItemButton(Blocks.red_button));
|
||||
registerBlock(Blocks.rock, (new ItemMultiTexture(Blocks.rock, Blocks.rock, new Function<ItemStack, String>() {
|
||||
public String apply(ItemStack stack) {
|
||||
return stack.getMetadata() == 1 ? "Glatter Felsen" : "Felsen";
|
||||
}
|
||||
})).setDisplay("Felsen"));
|
||||
|
||||
for(BlockLeaves leaves : BlockLeaves.LEAVES) {
|
||||
registerBlock(leaves, new ItemLeaves(leaves)); // .setDisplay(BlockRegistry.REGISTRY.getNameForObject(leaves)));
|
||||
}
|
||||
for(BlockSlab slab : BlockSlab.SLABS) {
|
||||
registerBlock(slab, new ItemSlab(slab));
|
||||
}
|
||||
for(BlockFence fence : BlockFence.FENCES) {
|
||||
registerBlock(fence, new ItemFence(fence));
|
||||
}
|
||||
for(BlockButton button : BlockButton.BUTTONS) {
|
||||
registerBlock(button, new ItemButton(button));
|
||||
}
|
||||
for(BlockSapling sapling : BlockSapling.SAPLINGS) {
|
||||
registerFlat(sapling);
|
||||
}
|
||||
|
||||
|
||||
Item bucket = (new ItemBucket(null, false)).setDisplay("Eimer");
|
||||
registerItem("bucket", bucket);
|
||||
for(int z = 0; z < FluidRegistry.getNumFluids(); z++) {
|
||||
registerItem(BlockRegistry.REGISTRY.getNameForObject(FluidRegistry.getStaticBlock(z)) +
|
||||
"_bucket", new ItemBucket(FluidRegistry.getFluidBlock(z), false).setDisplay("Eimer")
|
||||
.setContainerItem(bucket));
|
||||
}
|
||||
registerItem("recursive_bucket", (new ItemBucket(null, true)).setDisplay("Unendlicher Eimer"));
|
||||
for(int z = 0; z < FluidRegistry.getNumFluids(); z++) {
|
||||
registerItem("recursive_" + BlockRegistry.REGISTRY.getNameForObject(FluidRegistry.getStaticBlock(z)) +
|
||||
"_bucket", new ItemBucket(FluidRegistry.getFluidBlock(z), true).setDisplay("Flutender Eimer"));
|
||||
}
|
||||
registerItem("milk_bucket", (new ItemBucketMilk()).setDisplay("Milch").setContainerItem(bucket));
|
||||
|
||||
// registerItem("painting", (new ItemHangingEntity(EntityPainting.class)).setDisplay("Gemälde"));
|
||||
// registerItem("item_frame", (new ItemHangingEntity(EntityFrame.class)).setDisplay("Rahmen"));
|
||||
registerItem("boat", (new ItemBoat()).setDisplay("Boot"));
|
||||
registerItem("minecart", (new ItemMinecart(EntityCart.EnumMinecartType.RIDEABLE)).setDisplay("Lore"));
|
||||
registerItem("chest_minecart", (new ItemMinecart(EntityCart.EnumMinecartType.CHEST)).setDisplay("Güterlore"));
|
||||
registerItem("hopper_minecart", (new ItemMinecart(EntityCart.EnumMinecartType.HOPPER)).setDisplay("Trichterlore"));
|
||||
registerItem("tnt_minecart", (new ItemMinecart(EntityCart.EnumMinecartType.TNT)).setDisplay("TNT-Lore")
|
||||
.setColor(TextColor.RED));
|
||||
for(EntityEggInfo egg : EntityRegistry.SPAWN_EGGS.values()) {
|
||||
registerItem(egg.spawnedID.toLowerCase() + "_spawner", (new ItemMonsterPlacer(egg.spawnedID))
|
||||
.setDisplay("Spawner").setMaxStackSize(ItemStack.MAX_SIZE));
|
||||
}
|
||||
for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) {
|
||||
for(CharacterInfo charinfo : species.chars) {
|
||||
if(charinfo.spawner)
|
||||
registerItem(charinfo.skin.replace("~", "") + "_spawner", (new ItemNpcSpawner(charinfo)).setDisplay("NSC-Spawner")
|
||||
.setMaxStackSize(ItemStack.MAX_SIZE));
|
||||
}
|
||||
}
|
||||
|
||||
registerItem("wand", (new ItemEditWand()).setDisplay("Bearbeitungswerkzeug"));
|
||||
registerItem("info_wand", (new ItemInfoWand()).setDisplay("Infowerkzeug"));
|
||||
registerItem("lightning_wand", (new ItemLightning()).setDisplay("Geladenes Zepter"));
|
||||
registerItem("banhammer", (new ItemBanHammer()).setDisplay("Hammer der Verbannung").setTab(CheatTab.tabTools));
|
||||
registerItem("key", (new ItemKey()).setDisplay("Schlüssel").setTab(CheatTab.tabTools).setMaxStackSize(128));
|
||||
registerItem("die", (new ItemDie()).setDisplay("Würfel").setMaxStackSize(128));
|
||||
registerItem("chick_magnet", (new ItemMagnet(true)).setDisplay("Kükenmagnet"));
|
||||
registerItem("magnet", (new ItemMagnet(false)).setDisplay("Magnet"));
|
||||
registerItem("camera", (new ItemCamera()).setDisplay("Kamera").setTab(CheatTab.tabTools));
|
||||
|
||||
for(Weather weather : Weather.values()) {
|
||||
registerItem("weather_token_" + weather.getName(), new ItemWeatherToken(weather).setDisplay("Wetterkristall").setTab(CheatTab.tabTools));
|
||||
}
|
||||
|
||||
registerItem("flint_and_steel", (new ItemFlintAndSteel()).setDisplay("Feuerzeug"));
|
||||
registerItem("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxStackSize(128));
|
||||
registerItem("bow", (new ItemBow()).setDisplay("Bogen"));
|
||||
registerItem("boltgun", (new ItemBoltgun()).setDisplay("Bolter"));
|
||||
registerItem("bolt", (new ItemAmmo(5, 1.0f, 128)).setDisplay("Bolter-Munition"));
|
||||
registerItem("arrow", (new Item()).setDisplay("Pfeil").setTab(CheatTab.tabCombat).setMaxStackSize(128));
|
||||
Item coal = (new ItemCoal()).setDisplay("Kohle");
|
||||
registerItem("coal", coal);
|
||||
registerItem("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.tabMaterials).setMaxStackSize(256));
|
||||
registerItem("bowl", (new ItemSmall()).setDisplay("Schüssel").setTab(CheatTab.tabMisc));
|
||||
registerItem("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe"));
|
||||
registerItem((new ItemReed(Blocks.string)).setDisplay("Faden").setTab(CheatTab.tabTech).setMaxStackSize(1024));
|
||||
registerItem("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.tabMaterials).setMaxStackSize(512));
|
||||
registerItem("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.tabMaterials).setMaxStackSize(256));
|
||||
registerItem((new ItemSeeds(Blocks.wheat, Blocks.farmland)).setDisplay("Weizenkörner").setMaxStackSize(256));
|
||||
registerItem("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.tabMaterials).setMaxStackSize(128));
|
||||
registerItem("bread", (new ItemFood(5, false)).setDisplay("Brot"));
|
||||
registerItem("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.tabMaterials).setMaxStackSize(128));
|
||||
registerItem("porkchop", (new ItemFood(3, true)).setDisplay("Rohes Schweinefleisch"));
|
||||
registerItem("cooked_porkchop", (new ItemFood(8, true)).setDisplay("Gebratenes Schweinefleisch"));
|
||||
registerItem("golden_apple", (new ItemAppleGold(4, false)).setPotionEffect(Potion.regeneration.id, 5, 1, 1.0F)
|
||||
.setDisplay("Goldener Apfel"));
|
||||
registerItem((new ItemSign()).setDisplay("Schild"));
|
||||
// registerItem("oak_door", (new ItemDoor(Blocks.oak_door)).setUnlocalizedName("doorOak"));
|
||||
// registerItem("water_bucket", (new ItemBucket(Blocks.flowing_water)).setUnlocalizedName("bucketWater").setContainerItem(bucket));
|
||||
// registerItem("lava_bucket", (new ItemBucket(Blocks.flowing_lava)).setUnlocalizedName("bucketLava").setContainerItem(bucket));
|
||||
registerItem("saddle", (new ItemSaddle()).setDisplay("Sattel"));
|
||||
// registerItem("iron_door", (new ItemDoor(Blocks.iron_door)).setUnlocalizedName("doorIron"));
|
||||
registerItem((new ItemRedstone()).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxStackSize(256));
|
||||
registerItem("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxStackSize(128));
|
||||
registerItem("leather", (new Item()).setDisplay("Leder").setTab(CheatTab.tabMaterials));
|
||||
registerItem("brick", (new Item()).setDisplay("Ziegel").setTab(CheatTab.tabMaterials));
|
||||
registerItem("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.tabMaterials).setMaxStackSize(128));
|
||||
registerItem((new ItemReed(Blocks.reeds)).setDisplay("Zuckerrohr").setTab(CheatTab.tabPlants).setMaxStackSize(128));
|
||||
registerItem("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.tabMaterials).setMaxStackSize(256));
|
||||
registerItem("book", (new ItemBook()).setDisplay("Buch").setTab(CheatTab.tabMisc));
|
||||
registerItem("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.tabMaterials).setMaxStackSize(128));
|
||||
registerItem("egg", (new ItemEgg()).setDisplay("Ei").setMaxStackSize(128));
|
||||
registerItem("navigator", (new ItemSpaceNavigator()).setDisplay("Elektronischer Navigator").setTab(CheatTab.tabTools));
|
||||
registerItem("exterminator", (new ItemExterminator()).setDisplay("Weltenzerstörer").setTab(CheatTab.tabTools));
|
||||
registerItem("fishing_rod", (new ItemFishingRod()).setDisplay("Angel"));
|
||||
registerItem("glowstone_dust", (new Item()).setDisplay("Glowstonestaub").setPotionEffect(PotionHelper.glowstoneEffect)
|
||||
.setTab(CheatTab.tabMaterials).setMaxStackSize(256));
|
||||
registerItem("fish", (new ItemFishFood(false)).setDisplay("Fisch").setHasSubtypes(true));
|
||||
registerItem("cooked_fish", (new ItemFishFood(true)).setDisplay("Fisch").setHasSubtypes(true));
|
||||
Item dye = (new ItemDye()).setDisplay("Farbstoff").setMaxStackSize(512);
|
||||
registerItem("dye", dye);
|
||||
registerItem("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.tabMaterials).setMaxStackSize(128));
|
||||
registerItem("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.tabMaterials).setMaxStackSize(512));
|
||||
registerItem((new ItemReed(Blocks.cake)).setMaxStackSize(1).setDisplay("Kuchen").setTab(CheatTab.tabDeco));
|
||||
registerItem((new ItemReed(Blocks.repeater)).setDisplay("Redstone-Verstärker").setTab(CheatTab.tabTech));
|
||||
registerItem("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxStackSize(128));
|
||||
registerItem("melon", (new ItemFood(2, false)).setDisplay("Melone"));
|
||||
registerItem((new ItemSeeds(Blocks.pumpkin_stem, Blocks.farmland)).setDisplay("Kürbiskerne").setMaxStackSize(256));
|
||||
registerItem((new ItemSeeds(Blocks.melon_stem, Blocks.farmland)).setDisplay("Melonenkerne").setMaxStackSize(256));
|
||||
registerItem("beef", (new ItemFood(3, true)).setDisplay("Rohes Rindfleisch"));
|
||||
registerItem("cooked_beef", (new ItemFood(8, true)).setDisplay("Steak"));
|
||||
registerItem("chicken", (new ItemFood(2, true)).setDisplay("Rohes Hühnchen"));
|
||||
registerItem("cooked_chicken", (new ItemFood(6, true)).setDisplay("Gebratenes Hühnchen"));
|
||||
registerItem("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch"));
|
||||
registerItem("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.tabTools));
|
||||
registerItem("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.tabMaterials).setMaxStackSize(256));
|
||||
registerItem("ghast_tear", (new ItemTiny()).setDisplay("Ghastträne").setPotionEffect(PotionHelper.ghastTearEffect).setTab(CheatTab.tabMaterials).setMaxStackSize(256));
|
||||
registerItem("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.tabMetals).setMaxStackSize(256));
|
||||
registerItem((new ItemSeeds(Blocks.soul_wart, Blocks.soul_sand)).setDisplay("Seelenwarze").setPotionEffect("+4").setMaxStackSize(128));
|
||||
registerItem("potion", (new ItemPotion()).setDisplay("Trank"));
|
||||
registerItem("glass_bottle", (new ItemGlassBottle()).setDisplay("Glasflasche"));
|
||||
registerItem("spider_eye", (new ItemFood(2, false)).setPotionEffect(Potion.poison.id, 5, 0, 1.0F).setDisplay("Spinnenauge")
|
||||
.setPotionEffect(PotionHelper.spiderEyeEffect).setMaxStackSize(128));
|
||||
registerItem("fermented_spider_eye", (new Item()).setDisplay("Fermentiertes Spinnenauge")
|
||||
.setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.tabMisc).setMaxStackSize(128));
|
||||
registerItem("blaze_powder", (new Item()).setDisplay("Lohenstaub").setPotionEffect(PotionHelper.blazePowderEffect)
|
||||
.setTab(CheatTab.tabMaterials).setMaxStackSize(256));
|
||||
registerItem("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.tabMaterials).setMaxStackSize(128));
|
||||
registerItem((new ItemReed(Blocks.brewing_stand)).setDisplay("Braustand").setTab(CheatTab.tabTech));
|
||||
registerItem((new ItemReed(Blocks.cauldron)).setDisplay("Kessel").setTab(CheatTab.tabTech));
|
||||
registerItem("charged_orb", (new ItemChargedOrb()).setDisplay("Geladene Kugel"));
|
||||
registerItem("speckled_melon", (new Item()).setDisplay("Glitzernde Melone").setPotionEffect(PotionHelper.speckledMelonEffect)
|
||||
.setTab(CheatTab.tabMisc));
|
||||
registerItem("experience_bottle", (new ItemExpBottle()).setDisplay("Erfahrungsfläschchen"));
|
||||
registerItem("fire_charge", (new ItemFireball()).setDisplay("Feuerkugel"));
|
||||
registerItem("writable_book", (new Item()).setDisplay("Buch und Feder").setTab(CheatTab.tabTools));
|
||||
registerItem("written_book", (new Item()).setDisplay("Beschriebenes Buch").setTab(CheatTab.tabMisc));
|
||||
Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.tabMetals);
|
||||
registerItem("emerald", emerald);
|
||||
registerItem((new ItemReed(Blocks.flower_pot)).setDisplay("Blumentopf").setTab(CheatTab.tabDeco));
|
||||
registerItem((new ItemSeedFood(3, Blocks.carrot, Blocks.farmland)).setDisplay("Karotte").setMaxStackSize(128));
|
||||
registerItem((new ItemSeedFood(1, Blocks.potato, Blocks.farmland)).setDisplay("Kartoffel").setMaxStackSize(128));
|
||||
registerItem("baked_potato", (new ItemFood(5, false)).setDisplay("Ofenkartoffel").setMaxStackSize(128));
|
||||
registerItem("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Potion.poison.id, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").setMaxStackSize(128));
|
||||
registerItem("golden_carrot", (new ItemFood(6, false)).setDisplay("Goldene Karotte")
|
||||
.setPotionEffect(PotionHelper.goldenCarrotEffect).setTab(CheatTab.tabMisc));
|
||||
registerItem((new ItemSkull()).setDisplay("Kopf"));
|
||||
registerItem("carrot_on_a_stick", (new ItemCarrotOnAStick()).setDisplay("Karottenrute"));
|
||||
registerItem("charge_crystal", (new ItemEffect()).setDisplay("Energiekristall").setTab(CheatTab.tabMisc).setColor(TextColor.DMAGENTA));
|
||||
registerItem("pumpkin_pie", (new ItemFood(8, false)).setDisplay("Kürbiskuchen").setTab(CheatTab.tabMisc));
|
||||
registerItem("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete"));
|
||||
registerItem("firework_charge", (new ItemFireworkCharge()).setDisplay("Feuerwerksstern").setTab(CheatTab.tabMaterials));
|
||||
registerItem("enchanted_book", (new ItemEnchantedBook()).setMaxStackSize(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.tabMagic));
|
||||
registerItem((new ItemReed(Blocks.comparator)).setDisplay("Redstone-Komparator").setTab(CheatTab.tabTech));
|
||||
registerItem("bloodbrick", (new Item()).setDisplay("Blutroter Ziegel").setTab(CheatTab.tabMaterials));
|
||||
registerItem("blackbrick", (new Item()).setDisplay("Schwarzer Ziegel").setTab(CheatTab.tabMaterials));
|
||||
Item quartz = (new Item()).setDisplay("Quarz").setTab(CheatTab.tabMetals);
|
||||
registerItem("quartz", quartz);
|
||||
Item bquartz = (new Item()).setDisplay("Schwarzes Quarz").setTab(CheatTab.tabMetals);
|
||||
registerItem("black_quartz", bquartz);
|
||||
registerItem("lead", (new ItemLead()).setDisplay("Leine").setMaxStackSize(128));
|
||||
registerItem("name_tag", (new ItemNameTag()).setDisplay("Namensschild"));
|
||||
registerItem((new ItemBanner()).setDisplay("Banner"));
|
||||
// registerItem("spruce_door", (new ItemDoor(Blocks.spruce_door)).setUnlocalizedName("doorSpruce"));
|
||||
// registerItem("birch_door", (new ItemDoor(Blocks.birch_door)).setUnlocalizedName("doorBirch"));
|
||||
// registerItem("jungle_door", (new ItemDoor(Blocks.jungle_door)).setUnlocalizedName("doorJungle"));
|
||||
// registerItem("acacia_door", (new ItemDoor(Blocks.acacia_door)).setUnlocalizedName("doorAcacia"));
|
||||
// registerItem("dark_oak_door", (new ItemDoor(Blocks.dark_oak_door)).setUnlocalizedName("doorDarkOak"));
|
||||
registerItem("dynamite", (new ItemDynamite()).setDisplay("Dynamit").setColor(TextColor.RED));
|
||||
// registerItem("cherry_door", (new ItemDoor(Blocks.cherry_door)).setUnlocalizedName("doorCherry"));
|
||||
// registerItem("maple_door", (new ItemDoor(Blocks.maple_door)).setUnlocalizedName("doorMaple"));
|
||||
registerItem("chain", (new ItemMagnetic()).setDisplay("Kette").setTab(CheatTab.tabMaterials));
|
||||
|
||||
for(OreType ore : OreType.values()) {
|
||||
// String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1);
|
||||
// registerItemBlock(BlockRegistry.getRegisteredBlock(ore.name + "_ore"));
|
||||
// registerItemBlock(BlockRegistry.getRegisteredBlock(ore.name + "_block"));
|
||||
// if(ore.gem != null) {
|
||||
Item itm = (new Item()).setDisplay(ore.itemDisplay).setTab(CheatTab.tabMetals);
|
||||
registerItem(ore.item, itm);
|
||||
((BlockOre)BlockRegistry.getRegisteredBlock(ore.name + "_ore")).setDropItem(new ItemStack(itm, ore.dropQuantity),
|
||||
ore.bonusChance, ore.experience);
|
||||
// }
|
||||
// else {
|
||||
// Item itm = (new Item()).setUnlocalizedName("ingot" + loc).setCreativeTab(CreativeTab.tabMaterialsFood);
|
||||
// registerItem(ore.name + "_ingot", itm);
|
||||
// ((BlockOre)BlockRegistry.getRegisteredBlock(ore.name + "_ore")).setSmeltItem(new ItemStack(itm));
|
||||
// }
|
||||
registerTools(ore.material, ore.name, ore.display);
|
||||
}
|
||||
for(MetalType metal : MetalType.values()) {
|
||||
// String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1);
|
||||
Block oreBlock = BlockRegistry.getRegisteredBlock(metal.name + "_ore");
|
||||
ItemBlock ore = new ItemMetalBlock(oreBlock, metal, true);
|
||||
registerBlock(oreBlock, ore);
|
||||
Block fullBlock = BlockRegistry.getRegisteredBlock(metal.name + "_block");
|
||||
ItemBlock block = new ItemMetalBlock(fullBlock, metal, false);
|
||||
registerBlock(fullBlock, block);
|
||||
if(metal.isPowder) {
|
||||
Item itm = (new ItemMetal(metal)).setDisplay(metal.display + "pulver").setTab(CheatTab.tabMetals);
|
||||
registerItem(metal.name + "_powder", itm);
|
||||
((BlockOre)BlockRegistry.getRegisteredBlock(metal.name + "_ore")).setDropItem(new ItemStack(itm), 0, 2);
|
||||
}
|
||||
else {
|
||||
Item itm = (new ItemMetal(metal)).setDisplay(metal.display + "barren").setTab(CheatTab.tabMetals);
|
||||
registerItem(metal.name + "_ingot", itm);
|
||||
((BlockOre)BlockRegistry.getRegisteredBlock(metal.name + "_ore")).setSmeltItem(new ItemStack(itm));
|
||||
}
|
||||
if(metal.material != null)
|
||||
registerTools(metal.material, metal.name, metal.display);
|
||||
}
|
||||
for(ToolType tool : ToolType.values()) {
|
||||
registerTools(tool.material, tool.name, tool.display);
|
||||
}
|
||||
for(BlockDoor door : BlockDoor.DOORS) {
|
||||
registerItem(new ItemDoor(door)); // .setDisplay(door.getDisplay()));
|
||||
}
|
||||
for(DyeColor color : BlockBed.COLORS) {
|
||||
registerItem(new ItemBed((BlockBed)BlockRegistry.getRegisteredBlock(color.getName() + "_bed")).setMaxStackSize(1).setDisplay(color.getSubject(0) + " Bett"));
|
||||
}
|
||||
|
||||
registerItem("record_13", (new ItemRecord()).setDisplay("Protokoll #1 - 13 Tage ohne Kaffee"));
|
||||
registerItem("record_cat", (new ItemRecord()).setDisplay("Protokoll #2 - Versuchskatzen"));
|
||||
registerItem("record_blocks", (new ItemRecord()).setDisplay("Protokoll #3 - Blöcke und mehr Experimente"));
|
||||
registerItem("record_chirp", (new ItemRecord()).setDisplay("Protokoll #4 - Experimente mit Vögeln: Eine gute Idee?"));
|
||||
registerItem("record_far", (new ItemRecord()).setDisplay("Protokoll #5 - Haben wir es mit dem Design übertrieben?"));
|
||||
registerItem("record_mall", (new ItemRecord()).setDisplay("Protokoll #6 - Wocheneinkauf und mehr Kaffee"));
|
||||
registerItem("record_mellohi", (new ItemRecord()).setDisplay("Protokoll #7 - Explosion: Hoffe auf Versicherungsersatz"));
|
||||
registerItem("record_stal", (new ItemRecord()).setDisplay("Protokoll #8 - Fortschritt stagniert"));
|
||||
registerItem("record_strad", (new ItemRecord()).setDisplay("Protokoll #9 - Neue Strategie"));
|
||||
registerItem("record_ward", (new ItemRecord()).setDisplay("Protokoll #10 - Neue Lösung: Seelenwarzen??"));
|
||||
registerItem("record_11", (new ItemRecord()).setDisplay("Protokoll #11 - Wir waren erfolgreich"));
|
||||
registerItem("record_wait", (new ItemRecord()).setDisplay("Protokoll #12 - Warte auf Bezahlung"));
|
||||
registerItem("record_delay", (new ItemRecord()).setDisplay("Protokoll #13 - Verzögerung der Umsetzung"));
|
||||
registerItem("record_extend", (new ItemRecord()).setDisplay("Protokoll #14 - Explosive Erweiterung unseres Labors"));
|
||||
|
||||
((BlockOre)BlockRegistry.getRegisteredBlock("coal_ore")).setDropItem(new ItemStack(coal), 0);
|
||||
((BlockOre)BlockRegistry.getRegisteredBlock("emerald_ore")).setDropItem(new ItemStack(emerald), 3);
|
||||
((BlockOre)BlockRegistry.getRegisteredBlock("lapis_ore")).setDropItem(new ItemStack(dye, 4, DyeColor.BLUE.getDyeDamage()), 4, 2);
|
||||
((BlockOre)BlockRegistry.getRegisteredBlock("quartz_ore")).setDropItem(new ItemStack(quartz), 2);
|
||||
((BlockOre)BlockRegistry.getRegisteredBlock("black_quartz_ore")).setDropItem(new ItemStack(bquartz), 3);
|
||||
|
||||
|
||||
for(int z = 0; z < FluidRegistry.getNumFluids(); z++) {
|
||||
registerSpecial(FluidRegistry.getFluidBlock(z));
|
||||
registerSpecial(FluidRegistry.getStaticBlock(z));
|
||||
}
|
||||
// for(EnumDyeColor color : BlockBed.COLORS) {
|
||||
// registerSpecial(BlockRegistry.getRegisteredBlock(color.getName() + "_bed"));
|
||||
// }
|
||||
// for(BlockDoor door : BlockDoor.DOORS) {
|
||||
// registerSpecial(door);
|
||||
// }
|
||||
|
||||
registerSpecial(Blocks.air);
|
||||
|
||||
// registerSpecial(Blocks.flowing_water);
|
||||
// registerSpecial(Blocks.water);
|
||||
// registerSpecial(Blocks.flowing_lava);
|
||||
// registerSpecial(Blocks.lava);
|
||||
|
||||
// registerSpecial(Blocks.wheat);
|
||||
// registerSpecial(Blocks.carrots);
|
||||
// registerSpecial(Blocks.potatoes);
|
||||
// registerSpecial(Blocks.soul_wart);
|
||||
// registerSpecial(Blocks.pumpkin_stem);
|
||||
// registerSpecial(Blocks.melon_stem);
|
||||
registerSpecial(Blocks.cocoa);
|
||||
// registerSpecial(Blocks.reeds);
|
||||
|
||||
registerSpecial(Blocks.fire);
|
||||
registerSpecial(Blocks.portal);
|
||||
registerSpecial(Blocks.floor_portal);
|
||||
// registerSpecial(Blocks.standing_sign);
|
||||
registerSpecial(Blocks.wall_sign);
|
||||
// registerSpecial(Blocks.standing_banner);
|
||||
registerSpecial(Blocks.wall_banner);
|
||||
// registerSpecial(Blocks.cake);
|
||||
// registerSpecial(Blocks.brewing_stand);
|
||||
// registerSpecial(Blocks.cauldron);
|
||||
// registerSpecial(Blocks.flower_pot);
|
||||
// registerSpecial(Blocks.skull);
|
||||
|
||||
// registerSpecial(Blocks.tripwire);
|
||||
registerSpecial(Blocks.piston_head);
|
||||
registerSpecial(Blocks.piston_extension);
|
||||
registerSpecial(Blocks.lit_redstone_ore);
|
||||
registerSpecial(Blocks.lit_redstone_lamp);
|
||||
// registerSpecial(Blocks.redstone_wire);
|
||||
registerSpecial(Blocks.unlit_redstone_torch);
|
||||
// registerSpecial(Blocks.unpowered_repeater);
|
||||
registerSpecial(Blocks.powered_repeater);
|
||||
// registerSpecial(Blocks.unpowered_comparator);
|
||||
registerSpecial(Blocks.powered_comparator);
|
||||
registerSpecial(Blocks.daylight_detector_inverted);
|
||||
|
||||
for(Block block : BlockRegistry.REGISTRY) {
|
||||
if(!BLOCKMAP.containsKey(block) && !SPECIALIZED.contains(block))
|
||||
registerBlock(block, new ItemBlock(block));
|
||||
// Log.info("Block " + BlockRegistry.REGISTRY.getNameForObject(block) + " hat kein Item");
|
||||
}
|
||||
}
|
||||
}
|
251
java/src/game/init/Items.java
Executable file
251
java/src/game/init/Items.java
Executable file
|
@ -0,0 +1,251 @@
|
|||
package game.init;
|
||||
|
||||
import game.item.Item;
|
||||
import game.item.ItemAmmo;
|
||||
import game.item.ItemArmor;
|
||||
import game.item.ItemBow;
|
||||
import game.item.ItemEnchantedBook;
|
||||
import game.item.ItemFishingRod;
|
||||
import game.item.ItemPotion;
|
||||
import game.item.ItemShears;
|
||||
|
||||
|
||||
public abstract class Items {
|
||||
public static final Item iron_shovel = get("iron_shovel");
|
||||
public static final Item iron_pickaxe = get("iron_pickaxe");
|
||||
public static final Item iron_axe = get("iron_axe");
|
||||
public static final Item flint_and_steel = get("flint_and_steel");
|
||||
public static final Item apple = get("apple");
|
||||
public static final ItemBow bow = (ItemBow)get("bow");
|
||||
public static final Item arrow = get("arrow");
|
||||
public static final Item coal = get("coal");
|
||||
public static final Item diamond = get("diamond");
|
||||
public static final Item iron_ingot = get("iron_ingot");
|
||||
public static final Item gold_ingot = get("gold_ingot");
|
||||
public static final Item iron_sword = get("iron_sword");
|
||||
public static final Item wood_sword = get("wood_sword");
|
||||
public static final Item wood_shovel = get("wood_shovel");
|
||||
public static final Item wood_pickaxe = get("wood_pickaxe");
|
||||
public static final Item wood_axe = get("wood_axe");
|
||||
public static final Item stone_sword = get("stone_sword");
|
||||
public static final Item stone_shovel = get("stone_shovel");
|
||||
public static final Item stone_pickaxe = get("stone_pickaxe");
|
||||
public static final Item stone_axe = get("stone_axe");
|
||||
public static final Item diamond_sword = get("diamond_sword");
|
||||
public static final Item diamond_shovel = get("diamond_shovel");
|
||||
public static final Item diamond_pickaxe = get("diamond_pickaxe");
|
||||
public static final Item diamond_axe = get("diamond_axe");
|
||||
public static final Item stick = get("stick");
|
||||
public static final Item bowl = get("bowl");
|
||||
public static final Item mushroom_stew = get("mushroom_stew");
|
||||
public static final Item gold_sword = get("gold_sword");
|
||||
public static final Item gold_shovel = get("gold_shovel");
|
||||
public static final Item gold_pickaxe = get("gold_pickaxe");
|
||||
public static final Item gold_axe = get("gold_axe");
|
||||
public static final Item string = get("string");
|
||||
public static final Item feather = get("feather");
|
||||
public static final Item gunpowder = get("gunpowder");
|
||||
public static final Item wood_hoe = get("wood_hoe");
|
||||
public static final Item stone_hoe = get("stone_hoe");
|
||||
public static final Item iron_hoe = get("iron_hoe");
|
||||
public static final Item diamond_hoe = get("diamond_hoe");
|
||||
public static final Item gold_hoe = get("gold_hoe");
|
||||
public static final Item wheat = get("wheat");
|
||||
public static final Item wheats = get("wheats");
|
||||
public static final Item bread = get("bread");
|
||||
public static final ItemArmor leather_helmet = (ItemArmor)get("leather_helmet");
|
||||
public static final ItemArmor leather_chestplate = (ItemArmor)get("leather_chestplate");
|
||||
public static final ItemArmor leather_leggings = (ItemArmor)get("leather_leggings");
|
||||
public static final ItemArmor leather_boots = (ItemArmor)get("leather_boots");
|
||||
public static final ItemArmor chain_helmet = (ItemArmor)get("chain_helmet");
|
||||
public static final ItemArmor chain_chestplate = (ItemArmor)get("chain_chestplate");
|
||||
public static final ItemArmor chain_leggings = (ItemArmor)get("chain_leggings");
|
||||
public static final ItemArmor chain_boots = (ItemArmor)get("chain_boots");
|
||||
public static final ItemArmor iron_helmet = (ItemArmor)get("iron_helmet");
|
||||
public static final ItemArmor iron_chestplate = (ItemArmor)get("iron_chestplate");
|
||||
public static final ItemArmor iron_leggings = (ItemArmor)get("iron_leggings");
|
||||
public static final ItemArmor iron_boots = (ItemArmor)get("iron_boots");
|
||||
public static final ItemArmor diamond_helmet = (ItemArmor)get("diamond_helmet");
|
||||
public static final ItemArmor diamond_chestplate = (ItemArmor)get("diamond_chestplate");
|
||||
public static final ItemArmor diamond_leggings = (ItemArmor)get("diamond_leggings");
|
||||
public static final ItemArmor diamond_boots = (ItemArmor)get("diamond_boots");
|
||||
public static final ItemArmor gold_helmet = (ItemArmor)get("gold_helmet");
|
||||
public static final ItemArmor gold_chestplate = (ItemArmor)get("gold_chestplate");
|
||||
public static final ItemArmor gold_leggings = (ItemArmor)get("gold_leggings");
|
||||
public static final ItemArmor gold_boots = (ItemArmor)get("gold_boots");
|
||||
public static final Item flint = get("flint");
|
||||
public static final Item porkchop = get("porkchop");
|
||||
public static final Item cooked_porkchop = get("cooked_porkchop");
|
||||
// public static final Item painting = get("painting");
|
||||
public static final Item golden_apple = get("golden_apple");
|
||||
public static final Item sign = get("sign");
|
||||
public static final Item oak_door = get("oak_door");
|
||||
public static final Item spruce_door = get("spruce_door");
|
||||
public static final Item birch_door = get("birch_door");
|
||||
public static final Item jungle_door = get("jungle_door");
|
||||
public static final Item acacia_door = get("acacia_door");
|
||||
public static final Item dark_oak_door = get("dark_oak_door");
|
||||
public static final Item bucket = get("bucket");
|
||||
public static final Item water_bucket = get("water_bucket");
|
||||
// public static final Item lava_bucket = get("lava_bucket");
|
||||
// public static final Item fluid_bucket = get("fluid_bucket");
|
||||
public static final Item minecart = get("minecart");
|
||||
public static final Item saddle = get("saddle");
|
||||
public static final Item iron_door = get("iron_door");
|
||||
public static final Item redstone = get("redstone");
|
||||
public static final Item snowball = get("snowball");
|
||||
public static final Item boat = get("boat");
|
||||
public static final Item leather = get("leather");
|
||||
public static final Item milk_bucket = get("milk_bucket");
|
||||
public static final Item brick = get("brick");
|
||||
public static final Item clay_ball = get("clay_ball");
|
||||
public static final Item reeds = get("reeds");
|
||||
public static final Item paper = get("paper");
|
||||
public static final Item book = get("book");
|
||||
public static final Item slime_ball = get("slime_ball");
|
||||
public static final Item chest_minecart = get("chest_minecart");
|
||||
// public static final Item furnace_minecart = get("furnace_minecart");
|
||||
public static final Item egg = get("egg");
|
||||
public static final Item navigator = get("navigator");
|
||||
public static final ItemFishingRod fishing_rod = (ItemFishingRod)get("fishing_rod");
|
||||
// public static final Item clock = get("clock");
|
||||
public static final Item glowstone_dust = get("glowstone_dust");
|
||||
public static final Item fish = get("fish");
|
||||
public static final Item cooked_fish = get("cooked_fish");
|
||||
public static final Item dye = get("dye");
|
||||
public static final Item bone = get("bone");
|
||||
public static final Item sugar = get("sugar");
|
||||
public static final Item cake = get("cake");
|
||||
// public static final Item red_bed = get("red_bed");
|
||||
public static final Item repeater = get("repeater");
|
||||
public static final Item cookie = get("cookie");
|
||||
public static final ItemShears iron_shears = (ItemShears)get("iron_shears");
|
||||
public static final Item melon = get("melon");
|
||||
public static final Item pumpkin_stem = get("pumpkin_stem");
|
||||
public static final Item melon_stem = get("melon_stem");
|
||||
public static final Item beef = get("beef");
|
||||
public static final Item cooked_beef = get("cooked_beef");
|
||||
public static final Item chicken = get("chicken");
|
||||
public static final Item cooked_chicken = get("cooked_chicken");
|
||||
public static final Item rotten_flesh = get("rotten_flesh");
|
||||
public static final Item orb = get("orb");
|
||||
public static final Item blaze_rod = get("blaze_rod");
|
||||
public static final Item ghast_tear = get("ghast_tear");
|
||||
public static final Item gold_nugget = get("gold_nugget");
|
||||
public static final Item soul_wart = get("soul_wart");
|
||||
public static final ItemPotion potion = (ItemPotion)get("potion");
|
||||
public static final Item glass_bottle = get("glass_bottle");
|
||||
public static final Item spider_eye = get("spider_eye");
|
||||
public static final Item fermented_spider_eye = get("fermented_spider_eye");
|
||||
public static final Item blaze_powder = get("blaze_powder");
|
||||
public static final Item magma_cream = get("magma_cream");
|
||||
public static final Item brewing_stand = get("brewing_stand");
|
||||
public static final Item cauldron = get("cauldron");
|
||||
public static final Item charged_orb = get("charged_orb");
|
||||
public static final Item speckled_melon = get("speckled_melon");
|
||||
// public static final Item spawn_egg = get("spawn_egg");
|
||||
public static final Item experience_bottle = get("experience_bottle");
|
||||
public static final Item fire_charge = get("fire_charge");
|
||||
public static final Item writable_book = get("writable_book");
|
||||
public static final Item written_book = get("written_book");
|
||||
public static final Item emerald = get("emerald");
|
||||
// public static final Item item_frame = get("item_frame");
|
||||
public static final Item flower_pot = get("flower_pot");
|
||||
public static final Item carrot = get("carrot");
|
||||
public static final Item potato = get("potato");
|
||||
public static final Item baked_potato = get("baked_potato");
|
||||
public static final Item poisonous_potato = get("poisonous_potato");
|
||||
public static final Item golden_carrot = get("golden_carrot");
|
||||
public static final Item skull = get("skull");
|
||||
public static final Item carrot_on_a_stick = get("carrot_on_a_stick");
|
||||
public static final Item charge_crystal = get("charge_crystal");
|
||||
public static final Item pumpkin_pie = get("pumpkin_pie");
|
||||
public static final Item fireworks = get("fireworks");
|
||||
public static final Item firework_charge = get("firework_charge");
|
||||
public static final ItemEnchantedBook enchanted_book = (ItemEnchantedBook)get("enchanted_book");
|
||||
public static final Item comparator = get("comparator");
|
||||
public static final Item bloodbrick = get("bloodbrick");
|
||||
public static final Item quartz = get("quartz");
|
||||
public static final Item tnt_minecart = get("tnt_minecart");
|
||||
public static final Item hopper_minecart = get("hopper_minecart");
|
||||
public static final Item iron_horse_armor = get("iron_horse_armor");
|
||||
public static final Item gold_horse_armor = get("gold_horse_armor");
|
||||
public static final Item diamond_horse_armor = get("diamond_horse_armor");
|
||||
public static final Item lead = get("lead");
|
||||
public static final Item name_tag = get("name_tag");
|
||||
public static final Item record_13 = get("record_13");
|
||||
public static final Item record_cat = get("record_cat");
|
||||
public static final Item record_blocks = get("record_blocks");
|
||||
public static final Item record_chirp = get("record_chirp");
|
||||
public static final Item record_far = get("record_far");
|
||||
public static final Item record_mall = get("record_mall");
|
||||
public static final Item record_mellohi = get("record_mellohi");
|
||||
public static final Item record_stal = get("record_stal");
|
||||
public static final Item record_strad = get("record_strad");
|
||||
public static final Item record_ward = get("record_ward");
|
||||
public static final Item record_11 = get("record_11");
|
||||
public static final Item record_wait = get("record_wait");
|
||||
public static final Item record_delay = get("record_delay");
|
||||
public static final Item record_extend = get("record_extend");
|
||||
public static final Item banner = get("banner");
|
||||
|
||||
public static final Item portal_frame = get("portal_frame");
|
||||
|
||||
public static final Item dynamite = get("dynamite");
|
||||
public static final Item cherry_door = get("cherry_door");
|
||||
public static final Item maple_door = get("maple_door");
|
||||
public static final ItemShears diamond_shears = (ItemShears)get("diamond_shears");
|
||||
|
||||
public static final Item thi_fragment = get("thi_fragment");
|
||||
public static final Item ahrd_fragment = get("ahrd_fragment");
|
||||
public static final Item ghi_fragment = get("ghi_fragment");
|
||||
public static final Item nieh_fragment = get("nieh_fragment");
|
||||
|
||||
// public static final Item npc_spawner = get("npc_spawner");
|
||||
public static final Item wand = get("wand");
|
||||
// public static final Item navigator = get("navigator");
|
||||
|
||||
public static final Item copper_ingot = get("copper_ingot");
|
||||
public static final Item tin_ingot = get("tin_ingot");
|
||||
public static final Item aluminium_ingot = get("aluminium_ingot");
|
||||
public static final Item lead_ingot = get("lead_ingot");
|
||||
public static final Item nickel_ingot = get("nickel_ingot");
|
||||
public static final Item cobalt_ingot = get("cobalt_ingot");
|
||||
public static final Item neodymium_ingot = get("neodymium_ingot");
|
||||
|
||||
public static final Item die = get("die");
|
||||
public static final Item lightning_wand = get("lightning_wand");
|
||||
public static final Item info_wand = get("info_wand");
|
||||
public static final Item key = get("key");
|
||||
public static final Item ruby = get("ruby");
|
||||
public static final Item chick_magnet = get("chick_magnet");
|
||||
public static final Item magnet = get("magnet");
|
||||
public static final Item cinnabar = get("cinnabar");
|
||||
public static final Item chain = get("chain");
|
||||
public static final Item camera = get("camera");
|
||||
public static final Item boltgun = get("boltgun");
|
||||
public static final ItemAmmo bolt = (ItemAmmo)get("bolt");
|
||||
|
||||
private static Item get(String id) {
|
||||
if(!ItemRegistry.REGISTRY.containsKey(id))
|
||||
throw new RuntimeException("Item " + id + " does not exist!");
|
||||
return ItemRegistry.REGISTRY.getObject(id);
|
||||
}
|
||||
|
||||
// static {
|
||||
// for(Field field : Items.class.getDeclaredFields()) {
|
||||
// if(Item.class.isAssignableFrom(field.getType())) {
|
||||
// if(!ItemRegistry.REGISTRY.containsKey(field.getName())) {
|
||||
// throw new RuntimeException("Item " + field.getName() + " does not exist!");
|
||||
// }
|
||||
// Item item = ItemRegistry.REGISTRY.getObject(field.getName());
|
||||
// try {
|
||||
// field.set(null, item);
|
||||
// }
|
||||
// catch(IllegalArgumentException | IllegalAccessException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
102
java/src/game/init/MetalType.java
Executable file
102
java/src/game/init/MetalType.java
Executable file
|
@ -0,0 +1,102 @@
|
|||
package game.init;
|
||||
|
||||
import game.color.TextColor;
|
||||
|
||||
public enum MetalType {
|
||||
IRON("iron", 26, "Fe", "Eisen", 0, new ToolMaterial(2, 8.0f, 0.0f, 250, 6.0F, 2, 14, true, 15, 9, 2, 6, 5, 2).setMagnetic()),
|
||||
COPPER("copper", 29, "Cu", "Kupfer", 0),
|
||||
TIN("tin", 50, "Sn", "Zinn", 0),
|
||||
|
||||
ALUMINIUM("aluminium", 13, "Al", "Aluminium", 1),
|
||||
LEAD("lead", 82, "Pb", "Blei", 1),
|
||||
|
||||
POTASSIUM("potassium", 19, "K", "Kalium", true, 2),
|
||||
CALCIUM("calcium", 20, "Ca", "Calcium", true, 2),
|
||||
NICKEL("nickel", 28, "Ni", "Nickel", 2),
|
||||
ZINC("zinc", 30, "Zn", "Zink", 2),
|
||||
|
||||
LITHIUM("lithium", 3, "Li", "Lithium", 3),
|
||||
SODIUM("sodium", 11, "Na", "Natrium", true, 3),
|
||||
PHOSPHOR("phosphor", 15, "P", "Phosphor", true, 3),
|
||||
SULFUR("sulfur", 16, "S", "Schwefel", true, 3),
|
||||
ARSENIC("arsenic", 33, "As", "Arsen", true, 3),
|
||||
SELENIUM("selenium", 34, "Se", "Selen", true, 3),
|
||||
IODINE("iodine", 53, "I", "Iod", true, 3),
|
||||
TUNGSTEN("tungsten", 74, "W", "Wolfram", 3),
|
||||
|
||||
MAGNESIUM("magnesium", 12, "Mg", "Magnesium", true, 4),
|
||||
SILICON("silicon", 14, "Si", "Silizium", 4),
|
||||
TITANIUM("titanium", 22, "Ti", "Titan", 4),
|
||||
VANADIUM("vanadium", 23, "V", "Vanadium", 4),
|
||||
CHROME("chrome", 24, "Cr", "Chrom", 4),
|
||||
PLATINUM("platinum", 78, "Pt", "Platin", 4),
|
||||
GOLD("gold", 79, "Au", "Gold", 4, new ToolMaterial(0, 15.0f, 1.0f, 32, 12.0F, 0, 22, true, 7, 25, 2, 5, 3, 1)),
|
||||
|
||||
MANGANESE("manganese", 25, "Mn", "Mangan", 5),
|
||||
COBALT("cobalt", 27, "Co", "Cobalt", 5),
|
||||
PALLADIUM("palladium", 46, "Pd", "Palladium", 5),
|
||||
SILVER("silver", 47, "Ag", "Silber", 5),
|
||||
ANTIMONY("antimony", 51, "Sb", "Antimon", true, 5),
|
||||
PRASEODYMIUM("praseodymium", 59, "Pr", "Praseodym", 5),
|
||||
NEODYMIUM("neodymium", 60, "Nd", "Neodym", 5),
|
||||
BISMUTH("bismuth", 83, "Bi", "Bismut", 5),
|
||||
|
||||
RADIUM("radium", 88, "Ra", "Radium", 6, 0.6f),
|
||||
URANIUM("uranium", 92, "U", "Uran", 7, 1.0f),
|
||||
NEPTUNIUM("neptunium", 93, "Np", "Neptunium", 8, 2.0f),
|
||||
PLUTONIUM("plutonium", 94, "Pu", "Plutonium", 9, 4.0f);
|
||||
|
||||
|
||||
public final int order;
|
||||
public final String sign;
|
||||
public final String name;
|
||||
public final String display;
|
||||
public final boolean isPowder;
|
||||
public final int rarity;
|
||||
public final float radioactivity;
|
||||
public final ToolMaterial material;
|
||||
|
||||
private MetalType(String name, int order, String sign, String display, boolean isPowder, int rarity, float radioactivity,
|
||||
ToolMaterial material) {
|
||||
this.order = order;
|
||||
this.sign = sign;
|
||||
this.name = name;
|
||||
this.display = display;
|
||||
this.isPowder = isPowder;
|
||||
this.rarity = rarity;
|
||||
this.radioactivity = radioactivity;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
private MetalType(String name, int order, String sign, String display, boolean isPowder, int rarity) {
|
||||
this(name, order, sign, display, isPowder, rarity, 0.0f, null);
|
||||
}
|
||||
|
||||
private MetalType(String name, int order, String sign, String display, int rarity, float radioactivity) {
|
||||
this(name, order, sign, display, false, rarity, radioactivity, null);
|
||||
}
|
||||
|
||||
private MetalType(String name, int order, String sign, String display, int rarity) {
|
||||
this(name, order, sign, display, false, rarity, 0.0f, null);
|
||||
}
|
||||
|
||||
private MetalType(String name, int order, String sign, String display, int rarity, ToolMaterial material) {
|
||||
this(name, order, sign, display, false, rarity, 0.0f, material);
|
||||
}
|
||||
|
||||
public String formatSymbol() {
|
||||
return TextColor.YELLOW + "Element-Symbol: " + TextColor.ORANGE + this.order + " " + this.sign;
|
||||
}
|
||||
|
||||
public String formatRarity() {
|
||||
return TextColor.DMAGENTA + "Seltenheit: " + TextColor.NEON + "" + (this.rarity + 1);
|
||||
}
|
||||
|
||||
public String formatRadioactivity() {
|
||||
return TextColor.RED + "Radioaktivität: " + TextColor.GREEN + String.format("%.1f RN", this.radioactivity * 100.0f);
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return this == IRON || this == NICKEL || this == COBALT;
|
||||
}
|
||||
}
|
281
java/src/game/init/NameRegistry.java
Executable file
281
java/src/game/init/NameRegistry.java
Executable file
|
@ -0,0 +1,281 @@
|
|||
package game.init;
|
||||
|
||||
import game.rng.Random;
|
||||
|
||||
/**
|
||||
* This class is released under the GNU general public license (GPL)
|
||||
* <p>
|
||||
* <h1>Description:</h1> This class generates random names from syllables, and provides
|
||||
* programmer a simple way to set a group of rules for the generator to avoid
|
||||
* unpronounceable and bizarre names.
|
||||
* <p>
|
||||
* <h1>Syllable table requirements/format:</h1>
|
||||
* 1) All syllables must be added using {@link #pre(NameRegistry, String...)},
|
||||
* {@link #mid(NameRegistry, String...)} and {@link #sur(NameRegistry, String...)}
|
||||
* in {@link #register()}. It is called from {@link game.init.Registry Registry}.<p>
|
||||
* 2) To add new generator types, add a constant to {@link NameRegistry} <p>
|
||||
* 3) A syllable should not start or end with whitespace, as this character is ignored in
|
||||
* vocal/consonant checks, but one or more spaces can be contained within the string. <p>
|
||||
* 4) '+' and '-' as the first and last characters are used to set rules, and using them in
|
||||
* as normal characters in these positions will result in undesired behaviour.
|
||||
* <p>
|
||||
* <h1>Syllable classification:</h1> A name is usually composed from 3 different classes of
|
||||
* syllables, which are prefix, middle part and suffix. To declare a syllable
|
||||
* as a prefix in the table, use {@link #pre(NameRegistry, String...) pre()}.
|
||||
* To declare a syllable as a suffix in the table, use {@link #sur(NameRegistry, String...) sur()}.
|
||||
* Everything else has to be be added as a middle part using {@link #mid(NameRegistry, String...) mid()}.
|
||||
* <p>
|
||||
* <h1>Number of syllables:</h1> Names may have any positive number of syllables. In case
|
||||
* of 2 syllables, the name will be composed from a prefix and a suffix. In case of 1
|
||||
* syllable, the name will be chosen from amongst the prefixes. In case of 3 and
|
||||
* more syllables, the name will begin with a prefix, is extended with middle parts and
|
||||
* ended with a suffix.
|
||||
* <p>
|
||||
* <h1>Assigning rules:</h1> I included a way to set 4 kinds of rules for every syllable.
|
||||
* To add rules to the syllables, write them right before and right after the syllable.
|
||||
* (example: "-aad+").
|
||||
* <p>
|
||||
* 1) ...+ means that the next syllable must definitely start with a vocal. <p>
|
||||
* 2) ...- means that the next syllable must definitely start with a consonant. <p>
|
||||
* 3) +... means that this syllable can only be appended to another syllable that
|
||||
* ends with a vocal. <p>
|
||||
* 4) -... means that this syllable can only be appended to another syllable that
|
||||
* ends with a consonant. <p>
|
||||
* So, the example "-aad+" means that "aad" can only be after a consonant and
|
||||
* the next syllable must start with a vocal. Beware of creating logical mistakes,
|
||||
* like providing only syllables ending with consonants, but expecting only
|
||||
* vocals, which will be detected and an empty string will be returned.
|
||||
* <p>
|
||||
* <h1>Generating names:</h1> To generate a name, use {@link #generate(Random, int)}.
|
||||
* Call this method on the {@link NameRegistry} enum of the name type to generate.
|
||||
* The first parameter is a extended PRNG {@link Random} object to use to select
|
||||
* random syllables. The second parameter is the number of syllables to generate,
|
||||
* as described above.
|
||||
* <p>
|
||||
*
|
||||
* @author Joonas Vali, August 2009.
|
||||
* @author Sen, December 2023.
|
||||
*/
|
||||
public enum NameRegistry {
|
||||
FANTASY,
|
||||
ELVEN,
|
||||
GOBLIN,
|
||||
ROMAN;
|
||||
|
||||
private static enum CharType {
|
||||
NONE,
|
||||
VOWEL,
|
||||
CONSONANT
|
||||
}
|
||||
|
||||
private static class Syllable {
|
||||
private final String text;
|
||||
private final boolean reqVowel;
|
||||
private final boolean reqConsonant;
|
||||
private final boolean noVowel;
|
||||
private final boolean noConsonant;
|
||||
private final boolean vowelFirst;
|
||||
private final boolean consonantFirst;
|
||||
private final boolean vowelLast;
|
||||
private final boolean consonantLast;
|
||||
|
||||
private Syllable(String text, boolean captitalize) {
|
||||
this(text.substring(text.startsWith("+") || text.startsWith("-") ? 1 : 0, text.length() -
|
||||
(text.endsWith("+") || text.endsWith("-") ? 1 : 0)), captitalize,
|
||||
text.endsWith("+"), text.endsWith("-"), text.startsWith("-"), text.startsWith("+"));
|
||||
}
|
||||
|
||||
private Syllable(String text, boolean captitalize, boolean reqVowel, boolean reqConsonant, boolean noVowel, boolean noConsonant) {
|
||||
this.text = captitalize ? text.substring(0, 1).toUpperCase().concat(text.substring(1)) : text.toLowerCase();
|
||||
text = text.toLowerCase();
|
||||
this.reqVowel = reqVowel;
|
||||
this.reqConsonant = reqConsonant;
|
||||
this.noVowel = noVowel;
|
||||
this.noConsonant = noConsonant;
|
||||
this.vowelFirst = VOWELS.indexOf(text.charAt(0)) != -1;
|
||||
this.consonantFirst = CONSONANTS.indexOf(text.charAt(0)) != -1;
|
||||
this.vowelLast = VOWELS.indexOf(text.charAt(text.length() - 1)) != -1;
|
||||
this.consonantLast = CONSONANTS.indexOf(text.charAt(text.length() - 1)) != -1;
|
||||
}
|
||||
}
|
||||
|
||||
private static class TokenList extends java.util.ArrayList<Syllable> {
|
||||
private boolean hasFirstVowel;
|
||||
private boolean hasFirstConsonant;
|
||||
private boolean hasConsonants;
|
||||
private boolean hasVowels;
|
||||
|
||||
public boolean add(Syllable syl) {
|
||||
if(super.add(syl)) {
|
||||
this.hasFirstVowel |= syl.vowelFirst;
|
||||
this.hasFirstConsonant |= syl.consonantFirst;
|
||||
this.hasConsonants |= syl.noVowel || !syl.noConsonant;
|
||||
this.hasVowels |= syl.noConsonant || !syl.noVowel;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static final String VOWELS = "aeiouyäöü";
|
||||
private static final String CONSONANTS = "bcdfghjklmnpqrstvwxyß";
|
||||
|
||||
private final TokenList pre = new TokenList();
|
||||
private final TokenList mid = new TokenList();
|
||||
private final TokenList sur = new TokenList();
|
||||
|
||||
private static void pre(NameRegistry type, String ... syls) {
|
||||
TokenList list = type.pre;
|
||||
for(String syl : syls)
|
||||
list.add(new Syllable(syl, true));
|
||||
}
|
||||
|
||||
private static void mid(NameRegistry type, String ... syls) {
|
||||
TokenList list = type.mid;
|
||||
for(String syl : syls)
|
||||
list.add(new Syllable(syl, false));
|
||||
}
|
||||
|
||||
private static void sur(NameRegistry type, String ... syls) {
|
||||
TokenList list = type.sur;
|
||||
for(String syl : syls)
|
||||
list.add(new Syllable(syl, false));
|
||||
}
|
||||
|
||||
static void register() {
|
||||
pre(FANTASY, "a-", "ab", "ac", "ad", "af", "ak", "am", "an", "ap", "ar", "as", "at", "aw", "az", "ael", "ael", "ao",
|
||||
"aer", "ash", "arsh+", "ath", "arg+", "arv+", "art+", "arn+", "ag", "ang+", "anthr+", "ba-", "be-", "bi", "bo-", "bu-",
|
||||
"beo-", "bra-", "bre-", "bei", "bro-", "bru", "breo-", "brao-", "da-", "de-", "di", "do-", "du-", "dae-", "dai", "dao-",
|
||||
"dra-", "dre-", "dri", "dro-", "dash", "desh", "dosh", "darr+", "dar", "derr+", "der", "dorr+", "dor", "durr+", "dur",
|
||||
"dran", "dren", "dron", "drun", "drav", "drev", "drov", "dov", "duv", "darv+", "dorv+", "durv+", "eo-", "ei-", "ed",
|
||||
"ga-", "go-", "gu-", "gra-", "gro-", "gru-", "garl", "gorl", "ha-", "he-", "hi-", "ho-", "hu-", "han", "hun", "hon",
|
||||
"idr+", "igr+", "irn+", "ign+", "in", "ins", "intr+", "ka-", "ke-", "ki", "ko-", "ku-", "kov", "korv+", "kran", "kren",
|
||||
"kron", "krun", "karn", "kern", "korn", "kurn", "lod+", "lodd+", "la-", "lad+", "ladd+", "lor", "lorn+", "llor",
|
||||
"llorn+", "llorv+", "orv+", "orn+", "orgl+", "pa-", "pu-", "po-", "ra-", "re-", "ru-", "rab+", "rak", "rob+", "rok",
|
||||
"rub+", "ruk", "stra-", "stre-", "sto-", "sar", "sor", "ser", "tu-", "tuk", "tuv+", "un", "unn+", "und", "ud", "uk",
|
||||
"va", "vaa-", "ve-", "vo-", "vu-", "val", "vel", "vol", "vul", "vraal", "vral", "vrul", "vratt+", "vrott+", "vrod+",
|
||||
"vrok+", "vork+", "vort+", "za-", "zaa-", "zar", "zon", "zoll+");
|
||||
|
||||
mid(FANTASY, "-ab", "-ac", "-ad", "-af", "-ak", "-am", "-an", "-ap", "-ar", "-as", "-at", "-aw", "-az", "-ael", "-ael",
|
||||
"-ao", "-aer", "ba", "be", "bi", "bo", "bu", "beo", "bra", "bre", "bei", "bro", "bru", "breo", "brao", "da", "de", "di",
|
||||
"do", "du", "dae", "dai", "dao", "dra", "dre", "dri", "dro", "dash", "desh", "dosh", "darr", "dar", "derr", "der",
|
||||
"dorr", "dor", "durr", "dur", "dran", "dren", "dron", "drun", "drav", "drev", "drov", "dov", "duv", "darv", "dorv",
|
||||
"durv", "-eo-", "-ei", "-ed", "+ga-", "+go-", "+gu-", "+gra", "+gro", "+gru-", "+garl", "+gorl", "+ha-", "+he-", "+hi",
|
||||
"+ho-", "+hu-", "+han", "+hun", "+hon", "-idr+", "-igr+", "-irn+", "-ign+", "in", "ins", "-intr", "+ka-", "+ke-", "+ki",
|
||||
"+ko-", "+ku-", "+kov+", "+korv+", "+kran+", "+kren+", "+kron+", "+krun+", "+karn+", "+kern+", "+korn+", "+kurn+",
|
||||
"+lod", "+lodd", "+la-", "+lad", "+ladd+", "+lor", "+lorn+", "-orv+", "-orn+", "-orgl+", "+pa-", "+pu-", "+po-",
|
||||
"+ra-", "+re-", "+ru-", "+rab-", "+rak-", "+rob-", "+rok", "+rub-", "+ruk", "+stra-", "+stre-", "+sto-", "+sar", "+sor",
|
||||
"+serr-", "+tu-", "+tuk", "+tuv-", "-un", "-unn+", "-und+", "-ud+", "-uk", "+va-", "+vaa-", "+ve-", "+vo-", "+vu-",
|
||||
"+val", "+vel", "+vol", "+vul", "+vral+", "+vrul+"); // "ladd -v +v", "lor -v"
|
||||
|
||||
sur(FANTASY, "-al", "-ol", "-ul", "-ath", "-oth", "-an", "-un", "-en", "-iel", "-iol", "-iul", "-at", "-ut", "+ll",
|
||||
"+d", "+st", "+ss", "s");
|
||||
|
||||
|
||||
pre(ELVEN, "ael", "aer", "af", "ah", "am", "ama", "an", "ang+", "ansr+", "cael", "dae-", "dho", "eir", "fi", "fir",
|
||||
"la", "seh", "sel", "ev", "fis", "hu", "ha", "gar", "gil", "ka", "kan", "ya", "za", "zy", "mara", "mai-", "lue-", "ny",
|
||||
"she", "sum", "syl");
|
||||
|
||||
mid(ELVEN, "-ae-", "-ael", "dar", "deth+", "+dre", "+drim", "dul", "-ean", "el", "emar", "hal", "-iat", "mah", "ten",
|
||||
"+que-", "ria", "rail", "ther", "thus", "thi", "san");
|
||||
|
||||
sur(ELVEN, "-ael", "dar", "deth", "dre", "drim", "dul", "-ean", "el", "emar", "nes", "nin", "oth", "hal", "iat", "mah",
|
||||
"ten", "ther", "thus", "thi", "ran", "ath", "ess", "san", "yth", "las", "lian", "evar");
|
||||
|
||||
|
||||
pre(GOBLIN, "waa-", "boo-", "gar", "bar", "dar", "jar", "var", "kra", "gra", "dra", "zra", "gob", "dob", "rob", "fob",
|
||||
"zob", "rag", "nag", "dag");
|
||||
|
||||
mid(GOBLIN, "bra", "ga", "da", "do", "go", "ze", "sha", "naz", "zub", "zu", "na", "gor", "boo-");
|
||||
|
||||
sur(GOBLIN, "byr", "gyr", "dyr", "vyr", "zyr", "-yr", "zog", "rog", "gog", "-og", "gul", "dul", "bul", "rul", "-ul",
|
||||
"+rgh");
|
||||
|
||||
|
||||
pre(ROMAN, "a", "al", "au-", "an", "ba", "be", "bi", "br+", "da", "di", "do", "du", "e", "eu-", "fa");
|
||||
|
||||
mid(ROMAN, "bi", "be", "bo", "bu", "nul+", "gu", "da", "-au-", "fri", "gus");
|
||||
|
||||
sur(ROMAN, "tus", "lus", "lius", "nus", "es", "-ius", "cus", "tor", "cio", "tin");
|
||||
}
|
||||
|
||||
public String generate(Random rand, int syls) {
|
||||
if((syls > 2 && this.mid.isEmpty()) || this.pre.isEmpty() || (syls > 1 && this.sur.isEmpty()) || syls < 1)
|
||||
return "";
|
||||
CharType expecting = CharType.NONE;
|
||||
Syllable syl = rand.pick(this.pre);
|
||||
CharType last = syl.vowelLast ? CharType.VOWEL : CharType.CONSONANT;
|
||||
if(syls > 2) {
|
||||
if(syl.reqVowel) {
|
||||
expecting = CharType.VOWEL;
|
||||
if(!this.mid.hasFirstVowel)
|
||||
return "";
|
||||
}
|
||||
if(syl.reqConsonant) {
|
||||
expecting = CharType.CONSONANT;
|
||||
if(!this.mid.hasFirstConsonant)
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(syl.reqVowel) {
|
||||
expecting = CharType.VOWEL;
|
||||
if(!this.sur.hasFirstVowel)
|
||||
return "";
|
||||
}
|
||||
if(syl.reqConsonant) {
|
||||
expecting = CharType.CONSONANT;
|
||||
if(!this.sur.hasFirstConsonant)
|
||||
return "";
|
||||
}
|
||||
}
|
||||
if(syl.vowelLast && !this.mid.hasVowels)
|
||||
return "";
|
||||
if(syl.consonantLast && !this.mid.hasConsonants)
|
||||
return "";
|
||||
StringBuilder name = new StringBuilder(syl.text);
|
||||
for(int i = 0; i < syls - 2; i++) {
|
||||
do {
|
||||
syl = rand.pick(this.mid);
|
||||
}
|
||||
while(expecting == CharType.VOWEL && !syl.vowelFirst || expecting == CharType.CONSONANT && !syl.consonantFirst
|
||||
|| last == CharType.VOWEL && syl.noVowel || last == CharType.CONSONANT && syl.noConsonant);
|
||||
expecting = CharType.NONE;
|
||||
if(syl.reqVowel) {
|
||||
expecting = CharType.VOWEL;
|
||||
if(i < syls - 3 && !this.mid.hasFirstVowel)
|
||||
return "";
|
||||
if(i == syls - 3 && !this.sur.hasFirstVowel)
|
||||
return "";
|
||||
}
|
||||
if(syl.reqConsonant) {
|
||||
expecting = CharType.CONSONANT;
|
||||
if(i < syls - 3 && !this.mid.hasFirstConsonant)
|
||||
return "";
|
||||
if(i == syls - 3 && !this.sur.hasFirstConsonant)
|
||||
return "";
|
||||
}
|
||||
if(syl.vowelLast && !this.mid.hasVowels && syls > 3)
|
||||
return "";
|
||||
if(syl.consonantLast && !this.mid.hasConsonants && syls > 3)
|
||||
return "";
|
||||
if(i == syls - 3) {
|
||||
if(syl.vowelLast && !this.sur.hasVowels)
|
||||
return "";
|
||||
if(syl.consonantLast && !this.sur.hasConsonants)
|
||||
return "";
|
||||
}
|
||||
last = syl.vowelLast ? CharType.VOWEL : CharType.CONSONANT;
|
||||
name.append(syl.text);
|
||||
}
|
||||
if(syls > 1) {
|
||||
do {
|
||||
syl = rand.pick(this.sur);
|
||||
}
|
||||
while(expecting == CharType.VOWEL && !syl.vowelFirst || expecting == CharType.CONSONANT && !syl.consonantFirst
|
||||
|| last == CharType.VOWEL && syl.noVowel || last == CharType.CONSONANT && syl.noConsonant);
|
||||
name.append(syl.text);
|
||||
}
|
||||
return name.toString();
|
||||
}
|
||||
}
|
43
java/src/game/init/ObjectIntIdentityMap.java
Executable file
43
java/src/game/init/ObjectIntIdentityMap.java
Executable file
|
@ -0,0 +1,43 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import game.Predicates;
|
||||
import game.collect.Iterators;
|
||||
import game.collect.Lists;
|
||||
|
||||
public class ObjectIntIdentityMap<T> implements IObjectIntIterable<T>
|
||||
{
|
||||
private final IdentityHashMap<T, Integer> identityMap = new IdentityHashMap(512);
|
||||
private final List<T> objectList = Lists.<T>newArrayList();
|
||||
|
||||
public void put(T key, int value)
|
||||
{
|
||||
this.identityMap.put(key, value);
|
||||
|
||||
while (this.objectList.size() <= value)
|
||||
{
|
||||
this.objectList.add(null);
|
||||
}
|
||||
|
||||
this.objectList.set(value, key);
|
||||
}
|
||||
|
||||
public int get(T key)
|
||||
{
|
||||
Integer integer = (Integer)this.identityMap.get(key);
|
||||
return integer == null ? -1 : integer.intValue();
|
||||
}
|
||||
|
||||
public final T getByValue(int value)
|
||||
{
|
||||
return (T)(value >= 0 && value < this.objectList.size() ? this.objectList.get(value) : null);
|
||||
}
|
||||
|
||||
public Iterator<T> iterator()
|
||||
{
|
||||
return Iterators.filter(this.objectList.iterator(), Predicates.notNull());
|
||||
}
|
||||
}
|
35
java/src/game/init/OreType.java
Executable file
35
java/src/game/init/OreType.java
Executable file
|
@ -0,0 +1,35 @@
|
|||
package game.init;
|
||||
|
||||
public enum OreType {
|
||||
DIAMOND("diamond", "Diamant", new ToolMaterial(3, 12.0f, 2.0f, 1561, 8.0F, 3, 10, true, 33, 10, 3, 8, 6, 3), "diamond", 3, 1, 0),
|
||||
THETIUM("thetium", "Thetium", "Thi-Fragment", new ToolMaterial(4, 20.0f, 4.0f, 3451, 11.0F, 7, 12, false, 59, 12, 4, 9, 7, 4), "thi_fragment", 5, 1, 0),
|
||||
ARDITE("ardite", "Ardit", "Ahrd-Fragment", new ToolMaterial(5, 30.0f, 12.0f, 7320, 11, 12, 86, 12, 6, 12, 9, 5), "ahrd_fragment", 7, 1, 0),
|
||||
GYRIYN("gyriyn", "Gyriyn", "Ghi-Fragment", new ToolMaterial(5, 7320, 15.0F, 11, 12, false), "ghi_fragment", 7, 1, 0),
|
||||
NICHUN("nichun", "Nichun", "Nieh-Fragment", new ToolMaterial(6, 50.0f, 40.0f, 21300, 20.0F, 18, 15, false, 172, 15, 12, 23, 14, 11), "nieh_fragment", 10, 1, 0),
|
||||
RUBY("ruby", "Rubin", new ToolMaterial(3), "ruby", 3, 1, 0),
|
||||
CINNABAR("cinnabar", "Zinnober", new ToolMaterial(2), "cinnabar", 2, 1, 1);
|
||||
|
||||
public final ToolMaterial material;
|
||||
public final String name;
|
||||
public final String display;
|
||||
public final String itemDisplay;
|
||||
public final String item;
|
||||
public final int experience;
|
||||
public final int dropQuantity;
|
||||
public final int bonusChance;
|
||||
|
||||
private OreType(String name, String display, ToolMaterial material, String gem, int xpDrop, int dropped, int bonus) {
|
||||
this(name, display, display, material, gem, xpDrop, dropped, bonus);
|
||||
}
|
||||
|
||||
private OreType(String name, String display, String itemDisplay, ToolMaterial material, String gem, int xpDrop, int dropped, int bonus) {
|
||||
this.material = material;
|
||||
this.name = name;
|
||||
this.display = display;
|
||||
this.itemDisplay = itemDisplay;
|
||||
this.item = gem;
|
||||
this.experience = xpDrop;
|
||||
this.dropQuantity = dropped;
|
||||
this.bonusChance = bonus;
|
||||
}
|
||||
}
|
22
java/src/game/init/Registry.java
Executable file
22
java/src/game/init/Registry.java
Executable file
|
@ -0,0 +1,22 @@
|
|||
package game.init;
|
||||
|
||||
public abstract class Registry {
|
||||
public static void register() {
|
||||
NameRegistry.register();
|
||||
BlockRegistry.register();
|
||||
FlammabilityRegistry.register();
|
||||
SpeciesRegistry.register();
|
||||
EntityRegistry.registerEggs();
|
||||
ItemRegistry.register();
|
||||
TileRegistry.register();
|
||||
CraftingRegistry.register();
|
||||
SmeltingRegistry.register();
|
||||
// StatRegistry.register();
|
||||
EntityRegistry.register();
|
||||
SpeciesRegistry.registerItems();
|
||||
DispenserRegistry.register();
|
||||
UniverseRegistry.register();
|
||||
RotationRegistry.register();
|
||||
ReorderRegistry.register();
|
||||
}
|
||||
}
|
20
java/src/game/init/RegistryDefaulted.java
Executable file
20
java/src/game/init/RegistryDefaulted.java
Executable file
|
@ -0,0 +1,20 @@
|
|||
package game.init;
|
||||
|
||||
public class RegistryDefaulted<K, V> extends RegistrySimple<K, V>
|
||||
{
|
||||
/**
|
||||
* Default object for this registry, returned when an object is not found.
|
||||
*/
|
||||
private final V defaultObject;
|
||||
|
||||
public RegistryDefaulted(V defaultObjectIn)
|
||||
{
|
||||
this.defaultObject = defaultObjectIn;
|
||||
}
|
||||
|
||||
public V getObject(K name)
|
||||
{
|
||||
V v = super.getObject(name);
|
||||
return (V)(v == null ? this.defaultObject : v);
|
||||
}
|
||||
}
|
78
java/src/game/init/RegistryNamespaced.java
Executable file
78
java/src/game/init/RegistryNamespaced.java
Executable file
|
@ -0,0 +1,78 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import game.collect.BiMap;
|
||||
import game.collect.HashBiMap;
|
||||
|
||||
public class RegistryNamespaced<K, V> extends RegistrySimple<K, V> implements IObjectIntIterable<V>
|
||||
{
|
||||
protected final ObjectIntIdentityMap<V> underlyingIntegerMap = new ObjectIntIdentityMap();
|
||||
protected final Map<V, K> inverseObjectRegistry;
|
||||
|
||||
public RegistryNamespaced()
|
||||
{
|
||||
this.inverseObjectRegistry = ((BiMap)this.registryObjects).inverse();
|
||||
}
|
||||
|
||||
public void register(int id, K key, V value)
|
||||
{
|
||||
if(this.registryObjects.containsKey(key))
|
||||
throw new IllegalArgumentException("Schlüssel " + String.valueOf(key) + " ist bereits mit ID " +
|
||||
this.underlyingIntegerMap.get(this.registryObjects.get(key)) + " registriert");
|
||||
if(this.underlyingIntegerMap.getByValue(id) != null)
|
||||
throw new IllegalArgumentException("ID " + id + " ist bereits mit Name " +
|
||||
this.inverseObjectRegistry.get(this.underlyingIntegerMap.getByValue(id)) + " registriert");
|
||||
|
||||
this.underlyingIntegerMap.put(value, id);
|
||||
this.putObject(key, value);
|
||||
}
|
||||
|
||||
protected Map<K, V> createUnderlyingMap()
|
||||
{
|
||||
return HashBiMap.<K, V>create();
|
||||
}
|
||||
|
||||
public V getObject(K name)
|
||||
{
|
||||
return super.getObject(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name we use to identify the given object.
|
||||
*/
|
||||
public K getNameForObject(V value)
|
||||
{
|
||||
return (K)this.inverseObjectRegistry.get(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this registry contain an entry for the given key?
|
||||
*/
|
||||
public boolean containsKey(K key)
|
||||
{
|
||||
return super.containsKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the integer ID we use to identify the given object.
|
||||
*/
|
||||
public int getIDForObject(V value)
|
||||
{
|
||||
return this.underlyingIntegerMap.get(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the object identified by the given ID.
|
||||
*/
|
||||
public V getObjectById(int id)
|
||||
{
|
||||
return (V)this.underlyingIntegerMap.getByValue(id);
|
||||
}
|
||||
|
||||
public Iterator<V> iterator()
|
||||
{
|
||||
return this.underlyingIntegerMap.iterator();
|
||||
}
|
||||
}
|
67
java/src/game/init/RegistryNamespacedDefaultedByKey.java
Executable file
67
java/src/game/init/RegistryNamespacedDefaultedByKey.java
Executable file
|
@ -0,0 +1,67 @@
|
|||
package game.init;
|
||||
|
||||
public class RegistryNamespacedDefaultedByKey<K, V> extends RegistryNamespaced<K, V>
|
||||
{
|
||||
/** The key of the default value. */
|
||||
private final K defaultValueKey;
|
||||
|
||||
/**
|
||||
* The default value for this registry, retrurned in the place of a null value.
|
||||
*/
|
||||
private V defaultValue;
|
||||
|
||||
public RegistryNamespacedDefaultedByKey(K defaultValueKeyIn)
|
||||
{
|
||||
this.defaultValueKey = defaultValueKeyIn;
|
||||
}
|
||||
|
||||
public void register(int id, K key, V value)
|
||||
{
|
||||
if (this.defaultValueKey.equals(key))
|
||||
{
|
||||
this.defaultValue = value;
|
||||
}
|
||||
|
||||
// if(this.getObjectExact(key) != null)
|
||||
// throw new IllegalArgumentException("Schlüssel " + String.valueOf(key) + " ist bereits registriert");
|
||||
// if(this.getObjectExact(id) != null)
|
||||
// throw new IllegalArgumentException("ID " + id + " ist bereits registriert");
|
||||
|
||||
super.register(id, key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* validates that this registry's key is non-null
|
||||
*/
|
||||
public void validateKey()
|
||||
{
|
||||
if (this.defaultValueKey == null) {
|
||||
throw new NullPointerException("Standard-Schlüssel ist Null");
|
||||
}
|
||||
}
|
||||
|
||||
public V getObject(K name)
|
||||
{
|
||||
V v = super.getObject(name);
|
||||
return (V)(v == null ? this.defaultValue : v);
|
||||
}
|
||||
|
||||
public V getObjectExact(K name)
|
||||
{
|
||||
return super.getObject(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the object identified by the given ID.
|
||||
*/
|
||||
public V getObjectById(int id)
|
||||
{
|
||||
V v = super.getObjectById(id);
|
||||
return (V)(v == null ? this.defaultValue : v);
|
||||
}
|
||||
|
||||
public V getObjectExact(int id)
|
||||
{
|
||||
return super.getObjectById(id);
|
||||
}
|
||||
}
|
61
java/src/game/init/RegistrySimple.java
Executable file
61
java/src/game/init/RegistrySimple.java
Executable file
|
@ -0,0 +1,61 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import game.collect.Maps;
|
||||
|
||||
public class RegistrySimple<K, V> implements IRegistry<K, V>
|
||||
{
|
||||
protected final Map<K, V> registryObjects = this.createUnderlyingMap();
|
||||
|
||||
protected Map<K, V> createUnderlyingMap()
|
||||
{
|
||||
return Maps.<K, V>newHashMap();
|
||||
}
|
||||
|
||||
public V getObject(K name)
|
||||
{
|
||||
return this.registryObjects.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an object on this registry.
|
||||
*/
|
||||
public void putObject(K key, V value)
|
||||
{
|
||||
if (key == null) {
|
||||
throw new NullPointerException("Key is null");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("Value is null");
|
||||
}
|
||||
|
||||
// if (this.registryObjects.containsKey(key))
|
||||
// {
|
||||
// Log.CONFIG.debug("Füge doppelten Schlüssel \'" + key + "\' der Registry hinzu");
|
||||
// }
|
||||
|
||||
this.registryObjects.put(key, value);
|
||||
}
|
||||
|
||||
public Set<K> getKeys()
|
||||
{
|
||||
return Collections.<K>unmodifiableSet(this.registryObjects.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this registry contain an entry for the given key?
|
||||
*/
|
||||
public boolean containsKey(K key)
|
||||
{
|
||||
return this.registryObjects.containsKey(key);
|
||||
}
|
||||
|
||||
public Iterator<V> iterator()
|
||||
{
|
||||
return this.registryObjects.values().iterator();
|
||||
}
|
||||
}
|
225
java/src/game/init/ReorderRegistry.java
Executable file
225
java/src/game/init/ReorderRegistry.java
Executable file
|
@ -0,0 +1,225 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import game.block.Block;
|
||||
import game.block.BlockBed;
|
||||
import game.block.BlockDoor;
|
||||
import game.color.DyeColor;
|
||||
import game.world.Facing;
|
||||
import game.world.State;
|
||||
import game.world.Vec3i;
|
||||
|
||||
public abstract class ReorderRegistry {
|
||||
private static final Set<Block> PLACE_LAST = new HashSet<Block>();
|
||||
private static final Set<Block> PLACE_FINAL = new HashSet<Block>();
|
||||
private static final Map<State, Vec3i> STATE_ATTACH = new HashMap<State, Vec3i>();
|
||||
private static final Map<Block, Vec3i> BLOCK_ATTACH = new HashMap<Block, Vec3i>();
|
||||
|
||||
public static boolean shouldPlaceLast(Block id) {
|
||||
return PLACE_LAST.contains(id);
|
||||
}
|
||||
|
||||
public static boolean shouldPlaceFinal(Block id) {
|
||||
return PLACE_FINAL.contains(id) || id instanceof BlockDoor;
|
||||
}
|
||||
|
||||
public static Vec3i getAttachment(State state) {
|
||||
Vec3i direction = BLOCK_ATTACH.get(state.getBlock());
|
||||
if (direction != null) return direction;
|
||||
return STATE_ATTACH.get(state);
|
||||
}
|
||||
|
||||
static void register() {
|
||||
for(WoodType wood : WoodType.values()) {
|
||||
PLACE_LAST.add(BlockRegistry.getRegisteredBlock(wood.getName() + "_sapling"));
|
||||
}
|
||||
// PLACE_LAST.add(Blocks.bed);
|
||||
for(DyeColor color : BlockBed.COLORS) {
|
||||
PLACE_LAST.add(BlockRegistry.getRegisteredBlock(color.getName() + "_bed"));
|
||||
}
|
||||
PLACE_LAST.add(Blocks.golden_rail);
|
||||
PLACE_LAST.add(Blocks.detector_rail);
|
||||
PLACE_LAST.add(Blocks.tallgrass);
|
||||
PLACE_LAST.add(Blocks.deadbush);
|
||||
PLACE_LAST.add(Blocks.piston_head);
|
||||
PLACE_LAST.add(Blocks.flower);
|
||||
PLACE_LAST.add(Blocks.brown_mushroom);
|
||||
PLACE_LAST.add(Blocks.red_mushroom_block);
|
||||
PLACE_LAST.add(Blocks.torch);
|
||||
PLACE_LAST.add(Blocks.fire);
|
||||
PLACE_LAST.add(Blocks.redstone);
|
||||
PLACE_LAST.add(Blocks.wheat);
|
||||
PLACE_LAST.add(Blocks.ladder);
|
||||
PLACE_LAST.add(Blocks.rail);
|
||||
PLACE_LAST.add(Blocks.lever);
|
||||
PLACE_LAST.add(Blocks.stone_pressure_plate);
|
||||
PLACE_LAST.add(Blocks.wooden_pressure_plate);
|
||||
PLACE_LAST.add(Blocks.unlit_redstone_torch);
|
||||
PLACE_LAST.add(Blocks.redstone_torch);
|
||||
PLACE_LAST.add(Blocks.stone_button);
|
||||
PLACE_LAST.add(Blocks.snow_layer);
|
||||
PLACE_LAST.add(Blocks.portal);
|
||||
PLACE_LAST.add(Blocks.repeater);
|
||||
PLACE_LAST.add(Blocks.powered_repeater);
|
||||
PLACE_LAST.add(Blocks.trapdoor);
|
||||
PLACE_LAST.add(Blocks.vine);
|
||||
PLACE_LAST.add(Blocks.waterlily);
|
||||
PLACE_LAST.add(Blocks.soul_wart);
|
||||
PLACE_LAST.add(Blocks.piston);
|
||||
PLACE_LAST.add(Blocks.sticky_piston);
|
||||
PLACE_LAST.add(Blocks.piston_head);
|
||||
PLACE_LAST.add(Blocks.piston_extension);
|
||||
PLACE_LAST.add(Blocks.cocoa);
|
||||
PLACE_LAST.add(Blocks.tripwire_hook);
|
||||
PLACE_LAST.add(Blocks.string);
|
||||
PLACE_LAST.add(Blocks.flower_pot);
|
||||
PLACE_LAST.add(Blocks.carrot);
|
||||
PLACE_LAST.add(Blocks.potato);
|
||||
PLACE_LAST.add(Blocks.wooden_button);
|
||||
PLACE_LAST.add(Blocks.anvil); // becomes relevant with asynchronous placement
|
||||
PLACE_LAST.add(Blocks.light_weighted_pressure_plate);
|
||||
PLACE_LAST.add(Blocks.heavy_weighted_pressure_plate);
|
||||
PLACE_LAST.add(Blocks.comparator);
|
||||
PLACE_LAST.add(Blocks.powered_comparator);
|
||||
PLACE_LAST.add(Blocks.activator_rail);
|
||||
PLACE_LAST.add(Blocks.iron_trapdoor);
|
||||
PLACE_LAST.add(Blocks.carpet);
|
||||
PLACE_LAST.add(Blocks.double_plant);
|
||||
PLACE_LAST.add(Blocks.daylight_detector_inverted);
|
||||
// shouldPlaceLast.add(Blocks.daylight_detector);
|
||||
PLACE_LAST.add(Blocks.blue_mushroom);
|
||||
PLACE_LAST.add(Blocks.red_button);
|
||||
}
|
||||
|
||||
static {
|
||||
PLACE_FINAL.add(Blocks.sign);
|
||||
PLACE_FINAL.add(Blocks.wall_sign);
|
||||
PLACE_FINAL.add(Blocks.cactus);
|
||||
PLACE_FINAL.add(Blocks.reeds);
|
||||
PLACE_FINAL.add(Blocks.cake);
|
||||
PLACE_FINAL.add(Blocks.piston_head);
|
||||
PLACE_FINAL.add(Blocks.piston_extension);
|
||||
PLACE_FINAL.add(Blocks.banner);
|
||||
PLACE_FINAL.add(Blocks.wall_banner);
|
||||
}
|
||||
|
||||
private static void addAttach(State state, Facing dir) {
|
||||
STATE_ATTACH.put(state, dir.getDirectionVec());
|
||||
}
|
||||
|
||||
private static void addAttach(Block block, Facing dir) {
|
||||
BLOCK_ATTACH.put(block, dir.getDirectionVec());
|
||||
}
|
||||
|
||||
private static void addCardinals(Block type, int west, int north, int east, int south) {
|
||||
addAttach(type.getStateFromMeta(west), Facing.WEST);
|
||||
addAttach(type.getStateFromMeta(north), Facing.NORTH);
|
||||
addAttach(type.getStateFromMeta(east), Facing.EAST);
|
||||
addAttach(type.getStateFromMeta(south), Facing.SOUTH);
|
||||
}
|
||||
|
||||
static {
|
||||
for(WoodType wood : WoodType.values()) {
|
||||
addAttach(BlockRegistry.getRegisteredBlock(wood.getName() + "_sapling"), Facing.DOWN);
|
||||
}
|
||||
addAttach(Blocks.tallgrass, Facing.DOWN);
|
||||
addAttach(Blocks.deadbush, Facing.DOWN);
|
||||
for (int offset = 0; offset < 16; offset += 8) {
|
||||
addAttach(Blocks.piston_head.getStateFromMeta(offset + 0), Facing.UP);
|
||||
addAttach(Blocks.piston_head.getStateFromMeta(offset + 1), Facing.DOWN);
|
||||
addCardinals(Blocks.piston_head, offset + 2, offset + 5, offset + 3, offset + 4);
|
||||
}
|
||||
addAttach(Blocks.flower, Facing.DOWN);
|
||||
addAttach(Blocks.brown_mushroom, Facing.DOWN);
|
||||
addAttach(Blocks.red_mushroom, Facing.DOWN);
|
||||
for (Block blockId : new Block[] { Blocks.torch, Blocks.redstone_torch, Blocks.unlit_redstone_torch }) {
|
||||
addAttach(blockId.getStateFromMeta(0), Facing.DOWN);
|
||||
addAttach(blockId.getStateFromMeta(5), Facing.DOWN); // According to the wiki, this one is history. Keeping both, for now...
|
||||
addCardinals(blockId, 4, 1, 3, 2);
|
||||
}
|
||||
addAttach(Blocks.redstone, Facing.DOWN);
|
||||
addAttach(Blocks.wheat, Facing.DOWN);
|
||||
addAttach(Blocks.sign, Facing.DOWN);
|
||||
addCardinals(Blocks.ladder, 2, 5, 3, 4);
|
||||
addCardinals(Blocks.wall_sign, 2, 5, 3, 4);
|
||||
for (int offset = 0; offset < 16; offset += 8) {
|
||||
addCardinals(Blocks.lever, offset + 4, offset + 1, offset + 3, offset + 2);
|
||||
addAttach(Blocks.lever.getStateFromMeta(offset + 5), Facing.DOWN);
|
||||
addAttach(Blocks.lever.getStateFromMeta(offset + 6), Facing.DOWN);
|
||||
addAttach(Blocks.lever.getStateFromMeta(offset + 7), Facing.UP);
|
||||
addAttach(Blocks.lever.getStateFromMeta(offset + 0), Facing.UP);
|
||||
}
|
||||
addAttach(Blocks.stone_pressure_plate, Facing.DOWN);
|
||||
addAttach(Blocks.iron_door, Facing.DOWN);
|
||||
addAttach(Blocks.wooden_pressure_plate, Facing.DOWN);
|
||||
// redstone torches: see torches
|
||||
for (int offset = 0; offset < 16; offset += 8) {
|
||||
addCardinals(Blocks.stone_button, offset + 4, offset + 1, offset + 3, offset + 2);
|
||||
addCardinals(Blocks.wooden_button, offset + 4, offset + 1, offset + 3, offset + 2);
|
||||
addCardinals(Blocks.red_button, offset + 4, offset + 1, offset + 3, offset + 2);
|
||||
}
|
||||
addAttach(Blocks.stone_button.getStateFromMeta(0), Facing.UP);
|
||||
addAttach(Blocks.stone_button.getStateFromMeta(5), Facing.DOWN);
|
||||
addAttach(Blocks.wooden_button.getStateFromMeta(0), Facing.UP);
|
||||
addAttach(Blocks.wooden_button.getStateFromMeta(5), Facing.DOWN);
|
||||
addAttach(Blocks.red_button.getStateFromMeta(0), Facing.UP);
|
||||
addAttach(Blocks.red_button.getStateFromMeta(5), Facing.DOWN);
|
||||
addAttach(Blocks.cactus, Facing.DOWN);
|
||||
addAttach(Blocks.reeds, Facing.DOWN);
|
||||
addAttach(Blocks.cake, Facing.DOWN);
|
||||
addAttach(Blocks.repeater, Facing.DOWN);
|
||||
addAttach(Blocks.powered_repeater, Facing.DOWN);
|
||||
for (int offset = 0; offset < 16; offset += 4) {
|
||||
addCardinals(Blocks.trapdoor, offset + 0, offset + 3, offset + 1, offset + 2);
|
||||
addCardinals(Blocks.iron_trapdoor, offset + 0, offset + 3, offset + 1, offset + 2);
|
||||
}
|
||||
addAttach(Blocks.pumpkin_stem, Facing.DOWN);
|
||||
addAttach(Blocks.melon_stem, Facing.DOWN);
|
||||
// vines are complicated, but I'll list the single-attachment variants anyway
|
||||
addAttach(Blocks.vine.getStateFromMeta(0), Facing.UP);
|
||||
addCardinals(Blocks.vine, 1, 2, 4, 8);
|
||||
addAttach(Blocks.soul_wart, Facing.DOWN);
|
||||
for (int offset = 0; offset < 16; offset += 4) {
|
||||
addCardinals(Blocks.cocoa, offset + 0, offset + 1, offset + 2, offset + 3);
|
||||
}
|
||||
for (int offset = 0; offset < 16; offset += 4) {
|
||||
addCardinals(Blocks.tripwire_hook, offset + 2, offset + 3, offset + 0, offset + 1);
|
||||
}
|
||||
addAttach(Blocks.string, Facing.DOWN);
|
||||
addAttach(Blocks.flower_pot, Facing.DOWN);
|
||||
addAttach(Blocks.carrot, Facing.DOWN);
|
||||
addAttach(Blocks.potato, Facing.DOWN);
|
||||
addAttach(Blocks.anvil, Facing.DOWN);
|
||||
addAttach(Blocks.light_weighted_pressure_plate, Facing.DOWN);
|
||||
addAttach(Blocks.heavy_weighted_pressure_plate, Facing.DOWN);
|
||||
addAttach(Blocks.comparator, Facing.DOWN);
|
||||
addAttach(Blocks.powered_comparator, Facing.DOWN);
|
||||
addAttach(Blocks.carpet, Facing.DOWN);
|
||||
addAttach(Blocks.double_plant, Facing.DOWN);
|
||||
addAttach(Blocks.banner, Facing.DOWN);
|
||||
addCardinals(Blocks.wall_banner, 4, 2, 5, 3);
|
||||
addAttach(Blocks.oak_door, Facing.DOWN);
|
||||
addAttach(Blocks.spruce_door, Facing.DOWN);
|
||||
addAttach(Blocks.birch_door, Facing.DOWN);
|
||||
addAttach(Blocks.jungle_door, Facing.DOWN);
|
||||
addAttach(Blocks.acacia_door, Facing.DOWN);
|
||||
addAttach(Blocks.dark_oak_door, Facing.DOWN);
|
||||
addAttach(Blocks.cherry_door, Facing.DOWN);
|
||||
addAttach(Blocks.maple_door, Facing.DOWN);
|
||||
|
||||
// Rails are hardcoded to be attached to the block below them.
|
||||
// In addition to that, let's attach ascending rails to the block they're ascending towards.
|
||||
for (int offset = 0; offset < 16; offset += 8) {
|
||||
addCardinals(Blocks.golden_rail, offset + 3, offset + 4, offset + 2, offset + 5);
|
||||
addCardinals(Blocks.detector_rail, offset + 3, offset + 4, offset + 2, offset + 5);
|
||||
addCardinals(Blocks.rail, offset + 3, offset + 4, offset + 2, offset + 5);
|
||||
addCardinals(Blocks.activator_rail, offset + 3, offset + 4, offset + 2, offset + 5);
|
||||
}
|
||||
|
||||
addAttach(Blocks.blue_mushroom, Facing.DOWN);
|
||||
}
|
||||
}
|
132
java/src/game/init/RotationRegistry.java
Executable file
132
java/src/game/init/RotationRegistry.java
Executable file
|
@ -0,0 +1,132 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import game.block.Block;
|
||||
import game.block.BlockDoor;
|
||||
import game.block.BlockLever;
|
||||
import game.block.BlockLog;
|
||||
import game.block.BlockPortal;
|
||||
import game.block.BlockQuartz;
|
||||
import game.block.BlockRail;
|
||||
import game.block.BlockRailBase;
|
||||
import game.block.BlockRailDetector;
|
||||
import game.block.BlockRailPowered;
|
||||
import game.block.BlockRotatedPillar;
|
||||
import game.clipboard.Rotation;
|
||||
import game.clipboard.RotationValue;
|
||||
import game.clipboard.Vector;
|
||||
import game.collect.Lists;
|
||||
import game.collect.Maps;
|
||||
import game.properties.IProperty;
|
||||
import game.properties.PropertyDirection;
|
||||
import game.world.Facing;
|
||||
import game.world.State;
|
||||
import game.world.Vec3i;
|
||||
|
||||
public abstract class RotationRegistry {
|
||||
private static final Map<Block, Rotation> MAP = new HashMap<Block, Rotation>();
|
||||
|
||||
static void register() {
|
||||
for(Block block : game.init.BlockRegistry.REGISTRY) {
|
||||
for(IProperty<?> prop : block.getPropertyMap()) {
|
||||
Predicate<Integer> predicate = null;
|
||||
if(prop == BlockDoor.FACING) {
|
||||
predicate = new Predicate<Integer>() {
|
||||
@Override
|
||||
public boolean test(Integer meta) {
|
||||
return (meta & 8) == 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
List<RotationValue> values = Lists.newArrayList();
|
||||
Map<Object, Byte> map = Maps.newHashMap();
|
||||
for(int z = 15; z >= 0; z--) {
|
||||
State st = block.getStateFromMeta(z);
|
||||
if(st.getProperties().containsKey(prop)) {
|
||||
map.put(st.getProperties().get(prop), (byte)z);
|
||||
}
|
||||
}
|
||||
|
||||
byte mask = 0;
|
||||
for(Object v : prop.getAllowedValues()) {
|
||||
if(map.get(v) == null) {
|
||||
continue;
|
||||
}
|
||||
mask |= map.get(v);
|
||||
}
|
||||
if(mask == 0) {
|
||||
continue;
|
||||
}
|
||||
for(Object v : prop.getAllowedValues()) {
|
||||
if(map.get(v) == null) {
|
||||
continue;
|
||||
}
|
||||
Vec3i dv = null;
|
||||
Facing.Axis axis = null;
|
||||
if(prop instanceof PropertyDirection) {
|
||||
dv = ((Facing)v).getDirectionVec();
|
||||
}
|
||||
else if(prop == BlockRotatedPillar.AXIS) {
|
||||
axis = ((Facing.Axis)v);
|
||||
}
|
||||
else if(prop == BlockPortal.AXIS) {
|
||||
axis = ((Facing.Axis)v);
|
||||
}
|
||||
else if(prop == BlockLog.LOG_AXIS) {
|
||||
axis = ((BlockLog.EnumAxis)v).getAxis();
|
||||
}
|
||||
else if(prop == BlockQuartz.VARIANT) {
|
||||
axis = ((BlockQuartz.EnumType)v).getAxis();
|
||||
}
|
||||
else if(prop == BlockLever.FACING) {
|
||||
dv = ((BlockLever.EnumOrientation)v).getFacing().getDirectionVec();
|
||||
}
|
||||
else if(prop == BlockRail.SHAPE || prop == BlockRailDetector.SHAPE || prop == BlockRailPowered.SHAPE) {
|
||||
dv = ((BlockRailBase.EnumRailDirection)v).getFacing().getDirectionVec();
|
||||
}
|
||||
// else if(prop == BlockDoor.HINGE) {
|
||||
// dv = ((BlockDoor.EnumHingePosition)v) == BlockDoor.EnumHingePosition.LEFT ? new Vec3i(-1, 0, 0) : new Vec3i(1, 0, 0);
|
||||
// }
|
||||
if(axis != null) {
|
||||
switch(axis) {
|
||||
case X:
|
||||
dv = new Vec3i(1, 0, 0);
|
||||
break;
|
||||
case Y:
|
||||
dv = new Vec3i(0, 1, 0);
|
||||
break;
|
||||
case Z:
|
||||
dv = new Vec3i(0, 0, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(dv == null) {
|
||||
continue;
|
||||
}
|
||||
values.add(new RotationValue(mask, (byte)(map.get(v) & mask), new Vector(dv.getX(), dv.getY(), dv.getZ())));
|
||||
if(axis != null) {
|
||||
values.add(new RotationValue(mask, (byte)(map.get(v) & mask), new Vector(-dv.getX(), -dv.getY(), -dv.getZ())));
|
||||
}
|
||||
}
|
||||
if(!values.isEmpty()) {
|
||||
int legacyId = game.init.BlockRegistry.getIdFromBlock(block);
|
||||
Rotation state = new Rotation(values.toArray(new RotationValue[values.size()]), predicate);
|
||||
// Log.CONFIG.debug("Block " + game.init.BlockRegistry.REGISTRY.getNameForObject(block) + "/" + legacyId + " mask = " + String.format("0x%x", mask));
|
||||
// for(RotationValue value : values) {
|
||||
// Log.CONFIG.debug(" meta " + value.data + " -> " + value.direction.toString());
|
||||
// }
|
||||
MAP.put(block, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Rotation getRotation(Block block) {
|
||||
return MAP.get(block);
|
||||
}
|
||||
}
|
122
java/src/game/init/SmeltingRegistry.java
Executable file
122
java/src/game/init/SmeltingRegistry.java
Executable file
|
@ -0,0 +1,122 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import game.block.Block;
|
||||
import game.block.BlockStoneBrick;
|
||||
import game.collect.Maps;
|
||||
import game.color.DyeColor;
|
||||
import game.item.Item;
|
||||
import game.item.ItemFishFood;
|
||||
import game.item.ItemStack;
|
||||
|
||||
public abstract class SmeltingRegistry
|
||||
{
|
||||
private static final Map<ItemStack, ItemStack> smeltingList = Maps.<ItemStack, ItemStack>newHashMap();
|
||||
private static final Map<ItemStack, Float> experienceList = Maps.<ItemStack, Float>newHashMap();
|
||||
|
||||
private static boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == 32767 || stack2.getMetadata() == stack1.getMetadata());
|
||||
}
|
||||
|
||||
static void register()
|
||||
{
|
||||
// add(Blocks.iron_ore, new ItemStack(Items.iron_ingot), 0.7F);
|
||||
// add(Blocks.gold_ore, new ItemStack(Items.gold_ingot), 1.0F);
|
||||
// add(Blocks.diamond_ore, new ItemStack(Items.diamond), 1.0F);
|
||||
add(Blocks.sand, new ItemStack(Blocks.glass), 0.1F);
|
||||
add(Items.porkchop, new ItemStack(Items.cooked_porkchop), 0.35F);
|
||||
add(Items.beef, new ItemStack(Items.cooked_beef), 0.35F);
|
||||
add(Items.chicken, new ItemStack(Items.cooked_chicken), 0.35F);
|
||||
// addSmelting(Items.rabbit, new ItemStack(Items.cooked_rabbit), 0.35F);
|
||||
// addSmelting(Items.mutton, new ItemStack(Items.cooked_mutton), 0.35F);
|
||||
add(Blocks.cobblestone, new ItemStack(Blocks.stone), 0.1F);
|
||||
add(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.DEFAULT_META), new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.CRACKED_META), 0.1F);
|
||||
add(Items.clay_ball, new ItemStack(Items.brick), 0.3F);
|
||||
add(Blocks.clay, new ItemStack(Blocks.hardened_clay), 0.35F);
|
||||
add(Blocks.cactus, new ItemStack(Items.dye, 1, DyeColor.GREEN.getDyeDamage()), 0.2F);
|
||||
add(Items.potato, new ItemStack(Items.baked_potato), 0.35F);
|
||||
add(Blocks.hellrock, new ItemStack(Items.bloodbrick), 0.1F);
|
||||
// add(new ItemStack(Blocks.sponge, 1, 1), new ItemStack(Blocks.sponge, 1, 0), 0.15F);
|
||||
|
||||
for (ItemFishFood.FishType itemfishfood$fishtype : ItemFishFood.FishType.values())
|
||||
{
|
||||
if (itemfishfood$fishtype.canCook())
|
||||
{
|
||||
add(new ItemStack(Items.fish, 1, itemfishfood$fishtype.getMetadata()), new ItemStack(Items.cooked_fish, 1, itemfishfood$fishtype.getMetadata()), 0.35F);
|
||||
}
|
||||
}
|
||||
|
||||
add(Blocks.emerald_ore, new ItemStack(Items.emerald), 1.0F);
|
||||
add(Blocks.coal_ore, new ItemStack(Items.coal), 0.1F);
|
||||
add(Blocks.lapis_ore, new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), 0.2F);
|
||||
add(Blocks.quartz_ore, new ItemStack(Items.quartz), 0.2F);
|
||||
add(Blocks.redstone_ore, new ItemStack(Items.redstone), 0.7F);
|
||||
|
||||
for(OreType ore : OreType.values()) {
|
||||
Item item = ItemRegistry.getRegisteredItem(ore.item);
|
||||
add(BlockRegistry.getRegisteredBlock(ore.name + "_ore"), new ItemStack(item), ((float)ore.experience) / 3.0F);
|
||||
}
|
||||
for(MetalType metal : MetalType.values()) {
|
||||
Item item = ItemRegistry.getRegisteredItem(metal.isPowder ? (metal.name + "_powder") : (metal.name + "_ingot"));
|
||||
add(BlockRegistry.getRegisteredBlock(metal.name + "_ore"), new ItemStack(item), 0.7F);
|
||||
}
|
||||
for(WoodType wood : WoodType.values()) {
|
||||
add(BlockRegistry.getRegisteredBlock(wood.getName() + "_log"), new ItemStack(Items.coal, 1, 1), 0.15F);
|
||||
// add(Blocks.log2, new ItemStack(Items.coal, 1, 1), 0.15F);
|
||||
}
|
||||
}
|
||||
|
||||
private static void add(Block input, ItemStack stack, float experience)
|
||||
{
|
||||
add(ItemRegistry.getItemFromBlock(input), stack, experience);
|
||||
}
|
||||
|
||||
private static void add(Item input, ItemStack stack, float experience)
|
||||
{
|
||||
add(new ItemStack(input, 1, 32767), stack, experience);
|
||||
}
|
||||
|
||||
private static void add(ItemStack input, ItemStack stack, float experience)
|
||||
{
|
||||
smeltingList.put(input, stack);
|
||||
experienceList.put(stack, Float.valueOf(experience));
|
||||
}
|
||||
|
||||
public static ItemStack getResult(ItemStack stack)
|
||||
{
|
||||
for (Entry<ItemStack, ItemStack> entry : smeltingList.entrySet())
|
||||
{
|
||||
if (compareItemStacks(stack, (ItemStack)entry.getKey()))
|
||||
{
|
||||
return (ItemStack)entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static float getExperience(ItemStack stack)
|
||||
{
|
||||
for (Entry<ItemStack, Float> entry : experienceList.entrySet())
|
||||
{
|
||||
if (compareItemStacks(stack, (ItemStack)entry.getKey()))
|
||||
{
|
||||
return ((Float)entry.getValue()).floatValue();
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public static void getSmeltingList(Set<Item> set)
|
||||
{
|
||||
for (ItemStack itemstack : smeltingList.values())
|
||||
{
|
||||
set.add(itemstack.getItem());
|
||||
}
|
||||
}
|
||||
}
|
275
java/src/game/init/SoundEvent.java
Executable file
275
java/src/game/init/SoundEvent.java
Executable file
|
@ -0,0 +1,275 @@
|
|||
package game.init;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import game.FileUtils;
|
||||
import game.Log;
|
||||
import game.rng.Random;
|
||||
|
||||
public enum SoundEvent {
|
||||
CLOTH("cloth1", "cloth2", "cloth3", "cloth4"),
|
||||
GRASS("grass1", "grass2", "grass3", "grass4"),
|
||||
GRAVEL("gravel1", "gravel2", "gravel3", "gravel4"),
|
||||
SAND("sand1", "sand2", "sand3", "sand4"),
|
||||
SNOW("snow1", "snow2", "snow3", "snow4"),
|
||||
STONE("stone1", "stone2", "stone3", "stone4"),
|
||||
WOOD("wood1", "wood2", "wood3", "wood4"),
|
||||
GLASS("glass1", "glass2", "glass3"),
|
||||
|
||||
SPELL("spell"),
|
||||
TELEPORT("teleport"),
|
||||
TELEPORT_REV("teleport_back"),
|
||||
FIREBALL("fireball"),
|
||||
METAL("metal1", "metal2", "metal3"),
|
||||
METALHIT("metalhit1", "metalhit2"),
|
||||
ANVIL_BREAK("anvil_break"),
|
||||
ANVIL_LAND("anvil_land"),
|
||||
ANVIL_USE("anvil_use"),
|
||||
THROW("bow"),
|
||||
BOWHIT("bowhit1", "bowhit2", "bowhit3", "bowhit4"),
|
||||
BREAK("break"),
|
||||
CHESTCLOSED("chestclosed"),
|
||||
CHESTOPEN("chestopen"),
|
||||
CLICK("click"),
|
||||
DOOR("door_close", "door_open"),
|
||||
DRINK("drink"),
|
||||
EAT("eat1", "eat2", "eat3"),
|
||||
EXPLODE("explode1", "explode2", "explode3", "explode4"),
|
||||
EXPLODE_ALT("old_explode"),
|
||||
FIZZ("fizz"),
|
||||
FUSE("fuse"),
|
||||
LEVELUP("levelup"),
|
||||
ORB("orb"),
|
||||
POP("pop"),
|
||||
SPLASH("splash"),
|
||||
FALL_BIG("fallbig1", "fallbig2"),
|
||||
FALL_SMALL("fallsmall"),
|
||||
HIT("hit1", "hit2", "hit3"),
|
||||
IGNITE("ignite"),
|
||||
FIRE("fire"),
|
||||
RAIN("rain1", "rain2", "rain3", "rain4"),
|
||||
THUNDER("thunder1", "thunder2", "thunder3"),
|
||||
PISTON_IN("piston_in"),
|
||||
PISTON_OUT("piston_out"),
|
||||
CART("minecart_base"),
|
||||
CART_INSIDE("minecart_inside"),
|
||||
MOLTEN("molten"),
|
||||
MOLTEN_POP("magmapop"),
|
||||
LAVA("lava"),
|
||||
LAVA_POP("lavapop"),
|
||||
WATER("water"),
|
||||
NOTE("note"),
|
||||
BLAST_SMALL("blast"),
|
||||
BLAST_SMALL_FAR("blast_far"),
|
||||
BLAST_LARGE("large_blast"),
|
||||
BLAST_LARGE_FAR("large_blast_far"),
|
||||
LAUNCH("launch"),
|
||||
TWINKLE("twinkle"),
|
||||
TWINKLE_FAR("twinkle_far"),
|
||||
PLOP("plop"),
|
||||
CUT("cut"),
|
||||
|
||||
BAT_DEATH("bat_death"),
|
||||
BAT_HIT("bat_hurt1", "bat_hurt2", "bat_hurt3", "bat_hurt4"),
|
||||
BAT_IDLE("bat_idle1", "bat_idle2", "bat_idle3", "bat_idle4"),
|
||||
BAT_TAKEOFF("bat_takeoff"),
|
||||
|
||||
CAT_HIT("cat_hitt1", "cat_hitt2", "cat_hitt3"),
|
||||
CAT_MEOW("cat_meow1", "cat_meow2", "cat_meow3", "cat_meow4"),
|
||||
CAT_PURREOW("cat_purreow1", "cat_purreow2"),
|
||||
|
||||
CHICKEN_HIT("chicken_hurt1", "chicken_hurt2"),
|
||||
CHICKEN_IDLE("chicken_say1", "chicken_say2", "chicken_say3"),
|
||||
|
||||
COW_HIT("cow_hurt1", "cow_hurt2", "cow_hurt3"),
|
||||
COW_IDLE("cow_say1", "cow_say2", "cow_say3", "cow_say4"),
|
||||
|
||||
DRAGON_IDLE("dragon_growl1", "dragon_growl2", "dragon_growl3", "dragon_growl4"),
|
||||
DRAGON_WINGS("dragon_wings1", "dragon_wings2", "dragon_wings3", "dragon_wings4", "dragon_wings5", "dragon_wings6"),
|
||||
|
||||
HORSE_ANGRY("horse_angry"),
|
||||
HORSE_BREATHE("horse_breathe1", "horse_breathe2", "horse_breathe3"),
|
||||
HORSE_DEATH("horse_death"),
|
||||
HORSE_GALLOP("horse_gallop1", "horse_gallop2", "horse_gallop3", "horse_gallop4"),
|
||||
HORSE_HIT("horse_hit1", "horse_hit2", "horse_hit3", "horse_hit4"),
|
||||
HORSE_IDLE("horse_idle1", "horse_idle2", "horse_idle3"),
|
||||
HORSE_JUMP("horse_jump"),
|
||||
HORSE_LAND("horse_land"),
|
||||
HORSE_SOFT("horse_soft1", "horse_soft2", "horse_soft3", "horse_soft4", "horse_soft5", "horse_soft6"),
|
||||
HORSE_WOOD("horse_wood1", "horse_wood2", "horse_wood3", "horse_wood4", "horse_wood5", "horse_wood6"),
|
||||
|
||||
PIG_DEATH("pig_death"),
|
||||
PIG_IDLE("pig_say1", "pig_say2", "pig_say3"),
|
||||
|
||||
RABBIT_HIT("rabbit_hurt1", "rabbit_hurt2", "rabbit_hurt3", "rabbit_hurt4"),
|
||||
RABBIT_IDLE("rabbit_idle1", "rabbit_idle2", "rabbit_idle3", "rabbit_idle4"),
|
||||
RABBIT_DEATH("rabbit_bunnymurder"),
|
||||
RABBIT_JUMP("rabbit_hop1", "rabbit_hop2", "rabbit_hop3", "rabbit_hop4"),
|
||||
|
||||
SHEEP_IDLE("sheep_say1", "sheep_say2", "sheep_say3"),
|
||||
|
||||
WOLF_BARK("wolf_bark1", "wolf_bark2", "wolf_bark3"),
|
||||
WOLF_DEATH("wolf_death"),
|
||||
WOLF_GROWL("wolf_growl1", "wolf_growl2", "wolf_growl3"),
|
||||
WOLF_HURT("wolf_hurt1", "wolf_hurt2", "wolf_hurt3"),
|
||||
WOLF_PANTING("wolf_panting"),
|
||||
WOLF_SHAKE("wolf_shake"),
|
||||
WOLF_WHINE("wolf_whine"),
|
||||
|
||||
SLIME_ATTACK("slime_attack1", "slime_attack2"),
|
||||
SLIME_BIG("slime_big1", "slime_big2", "slime_big3", "slime_big4"),
|
||||
SLIME_SMALL("slime_small1", "slime_small2", "slime_small3", "slime_small4", "slime_small5");
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
private static final byte[] WAV_HDR = "RIFF".getBytes();
|
||||
private static final byte[] WAV_HDR_FMT = "fmt ".getBytes();
|
||||
private static final byte[] WAV_HDR_DATA = "data".getBytes();
|
||||
private static final byte[] WAV_FORMAT = "WAVE".getBytes();
|
||||
|
||||
private final String[] sounds;
|
||||
private final short[][] buffers;
|
||||
|
||||
public static void loadSounds() {
|
||||
int n = 0;
|
||||
for(SoundEvent entry : SoundEvent.values()) {
|
||||
for(int z = 0; z < entry.sounds.length; z++) {
|
||||
String sound = entry.sounds[z];
|
||||
Log.SOUND.trace("Lade Sound %s", sound);
|
||||
entry.buffers[z] = readWav("sounds/" + sound + ".wav", 48000, (short)1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int read32(byte[] data, int off) {
|
||||
int value = 0;
|
||||
for(int h = 0; h < 4; h++) {
|
||||
value |= (int)((data[h + off]) & 0xff) << (8*h);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private static short read16(byte[] data, int off) {
|
||||
short value = 0;
|
||||
for(int h = 0; h < 2; h++) {
|
||||
value |= (short)((data[h + off]) & 0xff) << (8*h);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private static boolean memcmp(byte[] d1, int off, byte[] d2, int size) {
|
||||
for(int z = 0; z < size; z++) {
|
||||
if(d1[z + off] != d2[z])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static int readWavHeader(byte[] data, int samplerate, short channels, short bytes) {
|
||||
if(memcmp(data, 0, WAV_HDR, 4)) {
|
||||
Log.IO.debug("base header");
|
||||
return 0;
|
||||
}
|
||||
int len = read32(data, 4);
|
||||
if(memcmp(data, 8, WAV_FORMAT, 4)) {
|
||||
Log.IO.debug("wave header");
|
||||
return 0;
|
||||
}
|
||||
if(memcmp(data, 12, WAV_HDR_FMT, 4)) {
|
||||
Log.IO.debug("fmt header");
|
||||
return 0;
|
||||
}
|
||||
if(read32(data, 16) != 16) {
|
||||
Log.IO.debug("header size");
|
||||
return 0;
|
||||
}
|
||||
if(read16(data, 20) != 1) {
|
||||
Log.IO.debug("pcm");
|
||||
return 0;
|
||||
}
|
||||
if(read16(data, 22) != channels) {
|
||||
Log.IO.debug("channels");
|
||||
return 0;
|
||||
}
|
||||
if(read32(data, 24) != samplerate) {
|
||||
Log.IO.debug("sample rate");
|
||||
return 0;
|
||||
}
|
||||
if(read32(data, 28) != (samplerate * ((int)channels) * ((int)bytes))) {
|
||||
Log.IO.debug("bitrate");
|
||||
return 0;
|
||||
}
|
||||
if(read16(data, 32) != (channels * bytes)) {
|
||||
Log.IO.debug("sample align");
|
||||
return 0;
|
||||
}
|
||||
if(read16(data, 34) != (8 * bytes)) {
|
||||
Log.IO.debug("sample size");
|
||||
return 0;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
private static short[] readWav(String filename, int samplerate, short channels) {
|
||||
try {
|
||||
InputStream fd = new BufferedInputStream(FileUtils.getResource(filename));
|
||||
byte[] hdr = new byte[36];
|
||||
if(fd.read(hdr, 0, 36) != 36) {
|
||||
Log.IO.error("Fehler beim Lesen von WAV-Datei '%s': E/A-Fehler", filename);
|
||||
fd.close();
|
||||
return null;
|
||||
}
|
||||
if(readWavHeader(hdr, samplerate, channels, (short)2) == 0) {
|
||||
Log.IO.error("Fehler beim Lesen von WAV-Datei '%s': Falsches oder fehlerhaftes Format", filename);
|
||||
fd.close();
|
||||
return null;
|
||||
}
|
||||
int len = 0;
|
||||
do {
|
||||
if(len != 0 && fd.skip(len) != len) {
|
||||
Log.IO.error("Fehler beim Lesen von WAV-Datei '%s': E/A-Fehler", filename);
|
||||
fd.close();
|
||||
return null;
|
||||
}
|
||||
if(fd.read(hdr, 0, 8) != 8) {
|
||||
Log.IO.error("Fehler beim Lesen von WAV-Datei '%s': E/A-Fehler", filename);
|
||||
fd.close();
|
||||
return null;
|
||||
}
|
||||
len = read32(hdr, 4);
|
||||
}
|
||||
while(memcmp(hdr, 0, WAV_HDR_DATA, 4));
|
||||
int samples = len / ((int)channels * 2);
|
||||
byte[] buf = new byte[samples * channels * 2];
|
||||
if(fd.read(buf, 0, samples * channels * 2) != samples * channels * 2) {
|
||||
Log.IO.error("Fehler beim Lesen von WAV-Datei '%s': E/A-Fehler", filename);
|
||||
fd.close();
|
||||
return null;
|
||||
}
|
||||
fd.close();
|
||||
short[] sbuf = new short[samples * channels];
|
||||
for(int z = 0; z < samples * channels; z++) {
|
||||
sbuf[z] = read16(buf, z << 1);
|
||||
}
|
||||
return sbuf;
|
||||
}
|
||||
catch(FileNotFoundException e) {
|
||||
Log.IO.error("Fehler beim Öffnen von WAV-Datei '%s': Datei nicht gefunden", filename);
|
||||
}
|
||||
catch(IOException e) {
|
||||
Log.IO.error("Fehler beim Öffnen von WAV-Datei '%s': %s", filename, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private SoundEvent(String ... sounds) {
|
||||
this.sounds = sounds;
|
||||
this.buffers = new short[sounds.length][];
|
||||
}
|
||||
|
||||
public short[] getBuffer() {
|
||||
return RANDOM.pick(this.buffers);
|
||||
}
|
||||
}
|
190
java/src/game/init/SpeciesRegistry.java
Executable file
190
java/src/game/init/SpeciesRegistry.java
Executable file
|
@ -0,0 +1,190 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import game.collect.Lists;
|
||||
import game.collect.Maps;
|
||||
import game.collect.Sets;
|
||||
import game.entity.npc.EntityArachnoid;
|
||||
import game.entity.npc.EntityBloodElf;
|
||||
import game.entity.npc.EntityChaosMarine;
|
||||
import game.entity.npc.EntityCpu;
|
||||
import game.entity.npc.EntityCultivator;
|
||||
import game.entity.npc.EntityDarkMage;
|
||||
import game.entity.npc.EntityDwarf;
|
||||
import game.entity.npc.EntityElf;
|
||||
import game.entity.npc.EntityFireDemon;
|
||||
import game.entity.npc.EntityGargoyle;
|
||||
import game.entity.npc.EntityGoblin;
|
||||
import game.entity.npc.EntityHaunter;
|
||||
import game.entity.npc.EntityHuman;
|
||||
import game.entity.npc.EntityMage;
|
||||
import game.entity.npc.EntityMagma;
|
||||
import game.entity.npc.EntityMetalhead;
|
||||
import game.entity.npc.EntityNPC;
|
||||
import game.entity.npc.EntityOrc;
|
||||
import game.entity.npc.EntityPrimarch;
|
||||
import game.entity.npc.EntitySlime;
|
||||
import game.entity.npc.EntitySpaceMarine;
|
||||
import game.entity.npc.EntitySpirit;
|
||||
import game.entity.npc.EntityTiefling;
|
||||
import game.entity.npc.EntityUndead;
|
||||
import game.entity.npc.EntityVampire;
|
||||
import game.entity.npc.EntityWoodElf;
|
||||
import game.entity.npc.EntityZombie;
|
||||
import game.entity.npc.SpeciesInfo;
|
||||
|
||||
public abstract class SpeciesRegistry {
|
||||
public static enum ModelType {
|
||||
HUMANOID("humanoid", 0.6f, 1.8f, 64, 64, "Humanoid"),
|
||||
ARACHNOID("arachnoid", 1.4f, 1.6f, 128, 64, "Arachnoidea"),
|
||||
SLIME("slime", 1.0f, 1.0f, 64, 32, "Schleim"),
|
||||
DWARF("dwarf", 0.58f, 1.56f, 64, 58, "Zwerg"),
|
||||
HALFLING("halfling", 0.62f, 1.40f, 64, 52, "Winzling"),
|
||||
SPACE_MARINE("spacemarine", 1.3f, 3.1f, 128, 106, "Space Marine");
|
||||
|
||||
private static final Map<String, ModelType> LOOKUP = Maps.newHashMap();
|
||||
|
||||
public final float width;
|
||||
public final float height;
|
||||
public final int texWidth;
|
||||
public final int texHeight;
|
||||
public final String name;
|
||||
public final String display;
|
||||
|
||||
private ModelType(String name, float width, float height, int texWidth, int texHeight, String display) {
|
||||
this.name = name;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.texWidth = texWidth;
|
||||
this.texHeight = texHeight;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
// public String getIdString() {
|
||||
// return "modelType." + this.name;
|
||||
// }
|
||||
|
||||
public static ModelType getByName(String name) {
|
||||
ModelType type = LOOKUP.get(name.toLowerCase());
|
||||
return type == null ? HUMANOID : type;
|
||||
}
|
||||
|
||||
static {
|
||||
for(ModelType type : values()) {
|
||||
LOOKUP.put(type.name, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final Map<String, ModelType> SKINS = Maps.newTreeMap();
|
||||
public static final Set<String> CAPES = Sets.newTreeSet();
|
||||
// public static final Map<String, SpeciesInfo> SPECIES = Maps.newHashMap();
|
||||
public static final Map<Class<? extends EntityNPC>, SpeciesInfo> CLASSES = Maps.newHashMap();
|
||||
// public static final List<CharacterInfo> CHARACTERS = Lists.<CharacterInfo>newArrayList();
|
||||
// public static final List<ClassInfo> SPCLASSES = Lists.<ClassInfo>newArrayList();
|
||||
public static final List<SpeciesInfo> SPECIMEN = Lists.<SpeciesInfo>newArrayList();
|
||||
|
||||
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, String origin, String name, float size,
|
||||
int color1, int color2, Object ... names) {
|
||||
SPECIMEN.add(new SpeciesInfo(id, clazz, null, false, origin, name, ModelType.HUMANOID, size, color1, color2, names));
|
||||
}
|
||||
|
||||
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, String origin, String name, ModelType renderer,
|
||||
int color1, int color2) {
|
||||
SPECIMEN.add(new SpeciesInfo(id, clazz, null, false, origin, name, renderer, renderer.height, color1, color2, ""));
|
||||
}
|
||||
|
||||
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, String origin, String name, ModelType renderer,
|
||||
float size, int color1, int color2) {
|
||||
SPECIMEN.add(new SpeciesInfo(id, clazz, null, false, origin, name, renderer, size, color1, color2, ""));
|
||||
}
|
||||
|
||||
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, String origin, String name, float size, int color1,
|
||||
int color2) {
|
||||
SPECIMEN.add(new SpeciesInfo(id, clazz, null, false, origin, name, ModelType.HUMANOID, size, color1, color2, ""));
|
||||
}
|
||||
|
||||
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, Class<? extends Enum> classEnum, String origin,
|
||||
String name, float size, int color1, int color2, Object ... names) {
|
||||
SPECIMEN.add(new SpeciesInfo(id, clazz, classEnum, true, origin, name, ModelType.HUMANOID, size, color1, color2, names));
|
||||
}
|
||||
|
||||
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, Class<? extends Enum> classEnum, boolean prefix,
|
||||
String origin, String name, ModelType renderer, float size, int color1, int color2, Object ... names) {
|
||||
SPECIMEN.add(new SpeciesInfo(id, clazz, classEnum, prefix, origin, name, renderer, size, color1, color2, names));
|
||||
}
|
||||
|
||||
private static void registerItems(Class<? extends EntityNPC> clazz, Object ... items) {
|
||||
CLASSES.get(clazz).addItems(items);
|
||||
}
|
||||
|
||||
static void register() {
|
||||
registerSpecies("Cpu", EntityCpu.class, null, "Test-NSC", 1.8f, 0x202020, 0x8000ff, "Sen", "Troll:trollface", "Hacker", "Herobrine");
|
||||
registerSpecies("Cultivator", EntityCultivator.class, "nienrath", "Kultivator", 1.85f, 0x000000, 0xff0000, "Wei Wuxian", 0x000000, 0xff0000,
|
||||
"Lan Wangji", 0xffffff, 0x80e0ff, "Jiang Cheng", 0x200000, 0xaf00ff, "Shen Qingqiu", 0xffffff, 0x80ff80,
|
||||
"Luo Binghe", 0x600000, 0x000000);
|
||||
registerSpecies("Metalhead", EntityMetalhead.class, "thedric", "Metalhead", 1.8f, 0x606060, 0xf0f0f0,
|
||||
":metalhead_1", ":metalhead_2", ":metalhead_3",
|
||||
":metalhead_4", ":metalhead_5", ":metalhead_6", ":metalhead_7", ":metalhead_8", ":metalhead_9", ":metalhead_10",
|
||||
":metalhead_11", ":metalhead_12", ":metalhead_13", ":metalhead_14");
|
||||
registerSpecies("Elf", EntityElf.class, "gharoth", "Elbe", 1.95f, 0x054100, 0xd2d2d2, ":highelf", "Thranduil", 0x82888b, 0xeae7bd);
|
||||
registerSpecies("WoodElf", EntityWoodElf.class, "gharoth", "Waldelbe", 1.75f, 0x054100, 0x00bb00);
|
||||
registerSpecies("BloodElf", EntityBloodElf.class, "kyroth", "Blutelbe", 1.9f, 0x054100, 0x960000, "::bloodelf");
|
||||
registerSpecies("Human", EntityHuman.class, EntityHuman.ClassType.class, "terra", "NSC", 1.8f, 0x4f7d9a, 0x034c7a,
|
||||
EntityHuman.ClassType.KNIGHT,
|
||||
":knight_1", ":knight_2", ":knight_3",
|
||||
":knight_4", ":knight_5", ":knight_6", ":knight_7", ":knight_8", EntityHuman.ClassType.PEASANT,
|
||||
":peasant_1", ":peasant_2", ":peasant_3",
|
||||
":peasant_4", ":~peasant_5", ":peasant_6");
|
||||
registerSpecies("Spirit", EntitySpirit.class, "yrdinath", "Geist", 1.65f, 0xdfdfff, 0xbfbfff);
|
||||
registerSpecies("Haunter", EntityHaunter.class, "warp", "Verfolger", 1.55f, 0xffdfdf, 0xffbfbf);
|
||||
registerSpecies("FireDemon", EntityFireDemon.class, "ahrd", "Feuerdämon", 2.55f, 0xff0000, 0xff7f00);
|
||||
|
||||
registerSpecies("DarkMage", EntityDarkMage.class, "kyroth", "Dunkler Magier", 1.85f, 0xf6b201, 0xfff87e);
|
||||
registerSpecies("Tiefling", EntityTiefling.class, "thedric", "Tiefling", 2.0f, 0xb01515, 0xb0736f);
|
||||
registerSpecies("Zombie", EntityZombie.class, "terra", "Zombie", 1.8f, 0x00afaf, 0x799c65, ":zombie_1", ":zombie_2", ":zombie_3",
|
||||
":zombie_4", ":zombie_5", ":zombie_6");
|
||||
registerSpecies("Undead", EntityUndead.class, "terra", "Untoter", 1.8f, 0xc1c1c1, 0x494949, ":undead_1", ":undead_2", ":undead_3",
|
||||
":undead_4");
|
||||
registerSpecies("Arachnoid", EntityArachnoid.class, "tbd", "Arachnoidea", ModelType.ARACHNOID, 0x342d27, 0xa80e0e);
|
||||
registerSpecies("Mage", EntityMage.class, "terra", "Magier", 1.85f, 0x340000, 0x51a03e, ":mage_1", ":mage_2", ":mage_3",
|
||||
":mage_4", ":mage_5", ":mage_6");
|
||||
registerSpecies("Gargoyle", EntityGargoyle.class, "tbd", "Gargoyle", 2.2f, 0x401010, 0x534437);
|
||||
registerSpecies("Slime", EntitySlime.class, "tbd", "Schleim", ModelType.SLIME, 0x51a03e, 0x7ebf6e);
|
||||
registerSpecies("Magma", EntityMagma.class, "thedric", "Magmaschleim", ModelType.SLIME, 0x340000, 0xfcfc00);
|
||||
registerSpecies("Orc", EntityOrc.class, "tbd", "Ork", 1.9f, 0x00af00, 0x004000, ":orc_1", ":orc_2", ":orc_3",
|
||||
":orc_4", ":orc_5", ":orc_6", ":orc_7", ":orc_8", ":orc_9", ":orc_10", ":orc_11", ":orc_12");
|
||||
registerSpecies("Vampire", EntityVampire.class, "transylvania", "Vampir", 1.8f, 0x7f0000, 0xff0000, ":vampire_1", ":vampire_2", ":vampire_3",
|
||||
":vampire_4", ":vampire_5", ":vampire_6", ":vampire_7", ":vampire_8", "Alucard:alucard_1", "Alucard:alucard_2",
|
||||
"Dracula:dracula_1", "Dracula:dracula_2", "Dracula:dracula_3", "Dracula:dracula_4", "Dracula:dracula_5",
|
||||
"Dracula:dracula_6");
|
||||
registerSpecies("Dwarf", EntityDwarf.class, "tbd", "Zwerg", ModelType.DWARF, 0x523925, 0x975b2b);
|
||||
registerSpecies("Primarch", EntityPrimarch.class, EntityPrimarch.Founding.class, false, "terra", "Primarch", ModelType.HUMANOID, 2.65f,
|
||||
0xaf0000, 0x400000, EntityPrimarch.Founding.PRIMARCHS);
|
||||
registerSpecies("SpaceMarine", EntitySpaceMarine.class, EntitySpaceMarine.Legion.class, true, "terra", "Space Marine", ModelType.SPACE_MARINE,
|
||||
2.15f, 0x000000, 0xffffff, EntitySpaceMarine.Legion.MARINES);
|
||||
registerSpecies("ChaosMarine", EntityChaosMarine.class, EntityChaosMarine.Legion.class, true, "warp", "Chaos Marine", ModelType.SPACE_MARINE,
|
||||
2.15f, 0x000000, 0xff0000, EntityChaosMarine.Legion.MARINES);
|
||||
registerSpecies("Goblin", EntityGoblin.class, "luna", "Goblin", ModelType.HALFLING, 0x50af50, 0x504050);
|
||||
}
|
||||
|
||||
static void registerItems() {
|
||||
registerItems(EntityMetalhead.class,
|
||||
Blocks.iron_block, 5, Items.iron_ingot,
|
||||
Blocks.tin_block, 5, Items.tin_ingot,
|
||||
Blocks.aluminium_block, 5, Items.aluminium_ingot,
|
||||
Blocks.copper_block, 5, Items.copper_ingot,
|
||||
Blocks.lead_block, 5, Items.lead_ingot
|
||||
);
|
||||
registerItems(EntityElf.class, 3, Items.bow, 1, Items.iron_sword);
|
||||
registerItems(EntityWoodElf.class, 1, Items.bow, 2, null);
|
||||
registerItems(EntityBloodElf.class, 1, Items.bow, 3, Items.iron_sword, 1, Items.stone_sword);
|
||||
registerItems(EntityUndead.class, 9, Items.bow, 1, null);
|
||||
registerItems(EntitySpirit.class, 4, Items.snowball, 1, null);
|
||||
registerItems(EntitySpaceMarine.class, 2, Items.boltgun, 1, null);
|
||||
registerItems(EntityChaosMarine.class, 2, Items.boltgun, 1, null);
|
||||
}
|
||||
}
|
63
java/src/game/init/TileRegistry.java
Executable file
63
java/src/game/init/TileRegistry.java
Executable file
|
@ -0,0 +1,63 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import game.collect.Maps;
|
||||
import game.tileentity.TileEntity;
|
||||
import game.tileentity.TileEntityBanner;
|
||||
import game.tileentity.TileEntityBeacon;
|
||||
import game.tileentity.TileEntityBrewingStand;
|
||||
import game.tileentity.TileEntityChest;
|
||||
import game.tileentity.TileEntityComparator;
|
||||
import game.tileentity.TileEntityDaylightDetector;
|
||||
import game.tileentity.TileEntityDispenser;
|
||||
import game.tileentity.TileEntityDropper;
|
||||
import game.tileentity.TileEntityEnchantmentTable;
|
||||
import game.tileentity.TileEntityFurnace;
|
||||
import game.tileentity.TileEntityHopper;
|
||||
import game.tileentity.TileEntityMobSpawner;
|
||||
import game.tileentity.TileEntityNote;
|
||||
import game.tileentity.TileEntityPiston;
|
||||
import game.tileentity.TileEntitySign;
|
||||
import game.tileentity.TileEntitySkull;
|
||||
import game.tileentity.TileEntityTianReactor;
|
||||
|
||||
public abstract class TileRegistry {
|
||||
public static final Map<String, Class<? extends TileEntity>> nameToClassMap = Maps.<String, Class<? extends TileEntity>>newHashMap();
|
||||
public static final Map<Class<? extends TileEntity>, String> classToNameMap = Maps.<Class<? extends TileEntity>, String>newHashMap();
|
||||
public static final Map<Class<? extends TileEntity>, Integer> classToIdMap = Maps.<Class<? extends TileEntity>, Integer>newHashMap();
|
||||
private static int nextId;
|
||||
|
||||
private static void addMapping(Class<? extends TileEntity> cl, String id) {
|
||||
if(nameToClassMap.containsKey(id))
|
||||
throw new IllegalArgumentException("Duplicate id: " + id);
|
||||
nameToClassMap.put(id, cl);
|
||||
classToNameMap.put(cl, id);
|
||||
classToIdMap.put(cl, ++nextId);
|
||||
}
|
||||
|
||||
static void register() {
|
||||
addMapping(TileEntityFurnace.class, "Furnace");
|
||||
addMapping(TileEntityChest.class, "Chest");
|
||||
// addMapping(TileEntityWarpChest.class, "WarpChest");
|
||||
// addMapping(BlockJukebox.TileEntityJukebox.class, "RecordPlayer");
|
||||
addMapping(TileEntityDispenser.class, "Trap");
|
||||
addMapping(TileEntityDropper.class, "Dropper");
|
||||
addMapping(TileEntitySign.class, "Sign");
|
||||
addMapping(TileEntityMobSpawner.class, "MobSpawner");
|
||||
addMapping(TileEntityNote.class, "Music");
|
||||
addMapping(TileEntityPiston.class, "Piston");
|
||||
addMapping(TileEntityBrewingStand.class, "Cauldron");
|
||||
addMapping(TileEntityEnchantmentTable.class, "EnchantTable");
|
||||
// addMapping(TileEntityPortal.class, "Portal");
|
||||
// addMapping(TileEntityCommandBlock.class, "Control");
|
||||
addMapping(TileEntityBeacon.class, "Beacon");
|
||||
addMapping(TileEntitySkull.class, "Skull");
|
||||
addMapping(TileEntityDaylightDetector.class, "DLDetector");
|
||||
addMapping(TileEntityHopper.class, "Hopper");
|
||||
addMapping(TileEntityComparator.class, "Comparator");
|
||||
// addMapping(TileEntityFlowerPot.class, "FlowerPot");
|
||||
addMapping(TileEntityBanner.class, "Banner");
|
||||
addMapping(TileEntityTianReactor.class, "TianReactor");
|
||||
}
|
||||
}
|
164
java/src/game/init/ToolMaterial.java
Executable file
164
java/src/game/init/ToolMaterial.java
Executable file
|
@ -0,0 +1,164 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import game.collect.Sets;
|
||||
import game.item.Item;
|
||||
|
||||
public class ToolMaterial
|
||||
{
|
||||
private static final int[] MAX_DAMAGE = new int[] {11, 16, 15, 13};
|
||||
private static final float[] RAD_REDUCE = new float[] {1.0f, 1.7f, 1.6f, 1.4f};
|
||||
private static final float[] MAG_REDUCE = new float[] {1.0f, 1.2f, 1.1f, 1.0f};
|
||||
|
||||
private final int harvestLevel;
|
||||
private final int maxUses;
|
||||
private final float efficiencyOnProperMaterial;
|
||||
private final int damageVsEntity;
|
||||
private final float radiationResistance;
|
||||
private final float magicResistance;
|
||||
private final int enchantability;
|
||||
private final int maxDamageFactor;
|
||||
private final int[] damageReductionAmountArray;
|
||||
private final int armorEnchantability;
|
||||
private final boolean tools;
|
||||
private final boolean weapons;
|
||||
private final boolean extras;
|
||||
private boolean magnetic;
|
||||
private int defColor = 0xffffffff;
|
||||
private Set<Item> repair = Sets.newHashSet();
|
||||
|
||||
private ToolMaterial(float rad, float mag, int level, int uses, float efficiency, int damage, int ench, boolean tools,
|
||||
boolean weapons, boolean extras, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
this.harvestLevel = level;
|
||||
this.maxUses = uses;
|
||||
this.efficiencyOnProperMaterial = efficiency;
|
||||
this.damageVsEntity = damage;
|
||||
this.enchantability = ench;
|
||||
this.maxDamageFactor = auses;
|
||||
this.damageReductionAmountArray = new int[] {r1, r2, r3, r4};
|
||||
this.armorEnchantability = aench;
|
||||
this.radiationResistance = rad;
|
||||
this.magicResistance = mag;
|
||||
this.tools = tools;
|
||||
this.weapons = weapons;
|
||||
this.extras = extras;
|
||||
}
|
||||
|
||||
protected ToolMaterial(int level) {
|
||||
this(0.0f, 0.0f, level, 0, 0.0f, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
protected ToolMaterial(int level, int uses, float efficiency, int damage, int ench, boolean weapons) {
|
||||
this(0.0f, 0.0f, level, uses, efficiency, damage, ench, true, weapons, false, 0, ench, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
protected ToolMaterial(int level, float rad, float mag, int uses, int damage, int ench, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
this(rad, mag, level, uses, 0.0F, damage, ench, false, true, false, auses, aench, r1, r2, r3, r4);
|
||||
}
|
||||
|
||||
protected ToolMaterial(int level, float rad, float mag, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
this(rad, mag, 0, 0, 0.0F, 0, 0, false, false, false, auses, aench, r1, r2, r3, r4);
|
||||
}
|
||||
|
||||
protected ToolMaterial(int level, float rad, float mag, int uses, float efficiency, int damage, int ench, boolean extras,
|
||||
int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
this(rad, mag, level, uses, efficiency, damage, ench, true, true, extras, auses, aench, r1, r2, r3, r4);
|
||||
}
|
||||
|
||||
protected ToolMaterial setDyeable(int defColor) {
|
||||
this.defColor = defColor;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected ToolMaterial setMagnetic() {
|
||||
this.magnetic = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void addRepairItem(Item item) {
|
||||
this.repair.add(item);
|
||||
}
|
||||
|
||||
public boolean hasArmor() {
|
||||
return this.maxDamageFactor > 0;
|
||||
}
|
||||
|
||||
public boolean hasTools() {
|
||||
return this.tools;
|
||||
}
|
||||
|
||||
public boolean hasWeapons() {
|
||||
return this.weapons;
|
||||
}
|
||||
|
||||
public boolean hasExtras() {
|
||||
return this.extras;
|
||||
}
|
||||
|
||||
public int getMaxUses()
|
||||
{
|
||||
return this.maxUses;
|
||||
}
|
||||
|
||||
public float getEfficiencyOnProperMaterial()
|
||||
{
|
||||
return this.efficiencyOnProperMaterial;
|
||||
}
|
||||
|
||||
public int getDamageVsEntity()
|
||||
{
|
||||
return this.damageVsEntity;
|
||||
}
|
||||
|
||||
public int getHarvestLevel()
|
||||
{
|
||||
return this.harvestLevel;
|
||||
}
|
||||
|
||||
public int getEnchantability()
|
||||
{
|
||||
return this.enchantability;
|
||||
}
|
||||
|
||||
public boolean isRepairItem(Item item) {
|
||||
return this.repair.contains(item);
|
||||
}
|
||||
|
||||
public int getDurability(int armorType)
|
||||
{
|
||||
return MAX_DAMAGE[armorType] * this.maxDamageFactor;
|
||||
}
|
||||
|
||||
public float getRadiationReduction(int armorType)
|
||||
{
|
||||
return RAD_REDUCE[armorType] * this.radiationResistance;
|
||||
}
|
||||
|
||||
public float getMagicReduction(int armorType)
|
||||
{
|
||||
return MAG_REDUCE[armorType] * this.magicResistance;
|
||||
}
|
||||
|
||||
public int getDamageReductionAmount(int armorType)
|
||||
{
|
||||
return this.damageReductionAmountArray[armorType];
|
||||
}
|
||||
|
||||
public int getArmorEnchantability()
|
||||
{
|
||||
return this.armorEnchantability;
|
||||
}
|
||||
|
||||
public boolean canBeDyed() {
|
||||
return this.defColor != 0xffffffff;
|
||||
}
|
||||
|
||||
public int getDefaultColor() {
|
||||
return this.defColor;
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return this.magnetic;
|
||||
}
|
||||
}
|
21
java/src/game/init/ToolType.java
Executable file
21
java/src/game/init/ToolType.java
Executable file
|
@ -0,0 +1,21 @@
|
|||
package game.init;
|
||||
|
||||
public enum ToolType {
|
||||
WOOD("wood", "Holz", new ToolMaterial(0, 59, 2.0F, 0, 15, true), WoodType.getNames("planks")),
|
||||
STONE("stone", "Stein", new ToolMaterial(1, 131, 4.0F, 1, 5, true), "cobblestone"),
|
||||
LEATHER("leather", "Leder", new ToolMaterial(0, 2.0f, 0.0f, 5, 15, 1, 3, 2, 1).setDyeable(0xa06540), "leather"),
|
||||
CHAIN("chain", "Ketten", new ToolMaterial(0, 0.5f, 0.25f, 15, 12, 2, 5, 4, 1).setMagnetic(), "chain"),
|
||||
CLOTH("cloth", null, new ToolMaterial(0, 0.0f, 0.0f, 10, 0, 0, 0, 0, 0).setDyeable(0xffffff), "string");
|
||||
|
||||
public final ToolMaterial material;
|
||||
public final String name;
|
||||
public final String display;
|
||||
public final String[] items;
|
||||
|
||||
private ToolType(String name, String display, ToolMaterial material, String ... items) {
|
||||
this.material = material;
|
||||
this.name = name;
|
||||
this.display = display;
|
||||
this.items = items;
|
||||
}
|
||||
}
|
268
java/src/game/init/TradeRegistry.java
Executable file
268
java/src/game/init/TradeRegistry.java
Executable file
|
@ -0,0 +1,268 @@
|
|||
package game.init;
|
||||
|
||||
import game.color.DyeColor;
|
||||
import game.enchantment.Enchantment;
|
||||
import game.enchantment.EnchantmentHelper;
|
||||
import game.enchantment.RngEnchantment;
|
||||
import game.item.Item;
|
||||
import game.item.ItemStack;
|
||||
import game.rng.Random;
|
||||
import game.village.MerchantRecipe;
|
||||
import game.village.MerchantRecipeList;
|
||||
|
||||
public abstract class TradeRegistry {
|
||||
public interface ITradeList {
|
||||
void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random);
|
||||
}
|
||||
|
||||
public static final ITradeList[] TRADES = new ITradeList[] {
|
||||
new GemForItem(Items.wheats, new PriceInfo(18, 22)),
|
||||
new GemForItem(Items.potato, new PriceInfo(15, 19)),
|
||||
new GemForItem(Items.carrot, new PriceInfo(15, 19)),
|
||||
new ItemForGem(Items.bread, new PriceInfo(-4, -2)),
|
||||
new GemForItem(ItemRegistry.getItemFromBlock(Blocks.pumpkin), new PriceInfo(8, 13)),
|
||||
new ItemForGem(Items.pumpkin_pie, new PriceInfo(-3, -2)),
|
||||
new GemForItem(ItemRegistry.getItemFromBlock(Blocks.melon_block), new PriceInfo(7, 12)),
|
||||
new ItemForGem(Items.apple, new PriceInfo(-5, -7)),
|
||||
new ItemForGem(Items.cookie, new PriceInfo(-6, -10)),
|
||||
new ItemForGem(Items.cake, new PriceInfo(1, 1)),
|
||||
new GemForItem(Items.string, new PriceInfo(15, 20)),
|
||||
new GemForItem(Items.coal, new PriceInfo(16, 24)),
|
||||
new ItemForGemItem(Items.fish, new PriceInfo(6, 6), Items.cooked_fish,
|
||||
new PriceInfo(6, 6)),
|
||||
new EnchForGem(Items.fishing_rod, new PriceInfo(7, 8)),
|
||||
new GemForItem(ItemRegistry.getItemFromBlock(Blocks.wool), new PriceInfo(16, 22)),
|
||||
new ItemForGem(Items.iron_shears, new PriceInfo(3, 4)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 0),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 1),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 2),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 3),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 4),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 5),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 6),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 7),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 8),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 9),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 10),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 11),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 12),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 13),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 14),
|
||||
new PriceInfo(1, 2)),
|
||||
new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 15),
|
||||
new PriceInfo(1, 2)),
|
||||
new GemForItem(Items.string, new PriceInfo(15, 20)),
|
||||
new ItemForGem(Items.arrow, new PriceInfo(-12, -8)),
|
||||
new ItemForGem(Items.bow, new PriceInfo(2, 3)),
|
||||
new ItemForGemItem(ItemRegistry.getItemFromBlock(Blocks.gravel),
|
||||
new PriceInfo(10, 10), Items.flint, new PriceInfo(6, 10)),
|
||||
new GemForItem(Items.paper, new PriceInfo(24, 36)),
|
||||
new BookForGem(),
|
||||
new GemForItem(Items.book, new PriceInfo(8, 10)),
|
||||
new ItemForGem(Items.navigator, new PriceInfo(10, 12)),
|
||||
new ItemForGem(ItemRegistry.getItemFromBlock(Blocks.bookshelf),
|
||||
new PriceInfo(3, 4)),
|
||||
new GemForItem(Items.written_book, new PriceInfo(2, 2)),
|
||||
// new ItemForGem(Items.clock, new PriceInfo(10, 12)),
|
||||
new ItemForGem(ItemRegistry.getItemFromBlock(Blocks.glass),
|
||||
new PriceInfo(-5, -3)),
|
||||
new BookForGem(),
|
||||
new BookForGem(),
|
||||
new ItemForGem(Items.name_tag, new PriceInfo(20, 22)),
|
||||
new GemForItem(Items.rotten_flesh, new PriceInfo(36, 40)),
|
||||
new GemForItem(Items.gold_ingot, new PriceInfo(8, 10)),
|
||||
new ItemForGem(Items.redstone, new PriceInfo(-4, -1)),
|
||||
new ItemForGem(new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()),
|
||||
new PriceInfo(-2, -1)),
|
||||
new ItemForGem(Items.charged_orb, new PriceInfo(7, 11)),
|
||||
new ItemForGem(ItemRegistry.getItemFromBlock(Blocks.glowstone),
|
||||
new PriceInfo(-3, -1)),
|
||||
new ItemForGem(Items.experience_bottle, new PriceInfo(3, 11)),
|
||||
new GemForItem(Items.coal, new PriceInfo(16, 24)),
|
||||
new ItemForGem(Items.iron_helmet, new PriceInfo(4, 6)),
|
||||
new GemForItem(Items.iron_ingot, new PriceInfo(7, 9)),
|
||||
new ItemForGem(Items.iron_chestplate, new PriceInfo(10, 14)),
|
||||
new GemForItem(Items.diamond, new PriceInfo(3, 4)),
|
||||
new EnchForGem(Items.diamond_chestplate, new PriceInfo(16, 19)),
|
||||
new ItemForGem(Items.chain_boots, new PriceInfo(5, 7)),
|
||||
new ItemForGem(Items.chain_leggings, new PriceInfo(9, 11)),
|
||||
new ItemForGem(Items.chain_helmet, new PriceInfo(5, 7)),
|
||||
new ItemForGem(Items.chain_chestplate, new PriceInfo(11, 15)),
|
||||
new GemForItem(Items.coal, new PriceInfo(16, 24)),
|
||||
new ItemForGem(Items.iron_axe, new PriceInfo(6, 8)),
|
||||
new GemForItem(Items.iron_ingot, new PriceInfo(7, 9)),
|
||||
new EnchForGem(Items.iron_sword, new PriceInfo(9, 10)),
|
||||
new GemForItem(Items.diamond, new PriceInfo(3, 4)),
|
||||
new EnchForGem(Items.diamond_sword, new PriceInfo(12, 15)),
|
||||
new EnchForGem(Items.diamond_axe, new PriceInfo(9, 12)),
|
||||
new GemForItem(Items.coal, new PriceInfo(16, 24)),
|
||||
new EnchForGem(Items.iron_shovel, new PriceInfo(5, 7)),
|
||||
new GemForItem(Items.iron_ingot, new PriceInfo(7, 9)),
|
||||
new EnchForGem(Items.iron_pickaxe, new PriceInfo(9, 11)),
|
||||
new GemForItem(Items.diamond, new PriceInfo(3, 4)),
|
||||
new EnchForGem(Items.diamond_pickaxe, new PriceInfo(12, 15)),
|
||||
new GemForItem(Items.porkchop, new PriceInfo(14, 18)),
|
||||
new GemForItem(Items.chicken, new PriceInfo(14, 18)),
|
||||
new GemForItem(Items.coal, new PriceInfo(16, 24)),
|
||||
new ItemForGem(Items.cooked_porkchop, new PriceInfo(-7, -5)),
|
||||
new ItemForGem(Items.cooked_chicken, new PriceInfo(-8, -6)),
|
||||
new GemForItem(Items.leather, new PriceInfo(9, 12)),
|
||||
new ItemForGem(Items.leather_leggings, new PriceInfo(2, 4)),
|
||||
new EnchForGem(Items.leather_chestplate, new PriceInfo(7, 12)),
|
||||
new ItemForGem(Items.saddle, new PriceInfo(8, 10))
|
||||
};
|
||||
|
||||
static class GemForItem implements ITradeList {
|
||||
public Item sellItem;
|
||||
public PriceInfo price;
|
||||
|
||||
public GemForItem(Item itemIn, PriceInfo priceIn) {
|
||||
this.sellItem = itemIn;
|
||||
this.price = priceIn;
|
||||
}
|
||||
|
||||
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) {
|
||||
int i = 1;
|
||||
|
||||
if(this.price != null) {
|
||||
i = this.price.getPrice(random);
|
||||
}
|
||||
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(this.sellItem, i, 0), Items.emerald));
|
||||
}
|
||||
}
|
||||
|
||||
static class ItemForGemItem implements ITradeList {
|
||||
public ItemStack buyingItemStack;
|
||||
public PriceInfo buyingPriceInfo;
|
||||
public ItemStack sellingItemstack;
|
||||
public PriceInfo field_179408_d;
|
||||
|
||||
public ItemForGemItem(Item p_i45813_1_, PriceInfo p_i45813_2_, Item p_i45813_3_, PriceInfo p_i45813_4_) {
|
||||
this.buyingItemStack = new ItemStack(p_i45813_1_);
|
||||
this.buyingPriceInfo = p_i45813_2_;
|
||||
this.sellingItemstack = new ItemStack(p_i45813_3_);
|
||||
this.field_179408_d = p_i45813_4_;
|
||||
}
|
||||
|
||||
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) {
|
||||
int i = 1;
|
||||
|
||||
if(this.buyingPriceInfo != null) {
|
||||
i = this.buyingPriceInfo.getPrice(random);
|
||||
}
|
||||
|
||||
int j = 1;
|
||||
|
||||
if(this.field_179408_d != null) {
|
||||
j = this.field_179408_d.getPrice(random);
|
||||
}
|
||||
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(this.buyingItemStack.getItem(), i, this.buyingItemStack.getMetadata()),
|
||||
new ItemStack(Items.emerald), new ItemStack(this.sellingItemstack.getItem(), j, this.sellingItemstack.getMetadata())));
|
||||
}
|
||||
}
|
||||
|
||||
static class BookForGem implements ITradeList {
|
||||
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) {
|
||||
Enchantment enchantment = random.pick(Enchantment.enchantmentsBookList);
|
||||
int i = random.range(enchantment.getMinLevel(), enchantment.getMaxLevel());
|
||||
ItemStack itemstack = Items.enchanted_book.getEnchantedItemStack(new RngEnchantment(enchantment, i));
|
||||
int j = 2 + random.zrange(5 + i * 10) + 3 * i;
|
||||
|
||||
if(j > 64) {
|
||||
j = 64;
|
||||
}
|
||||
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.book), new ItemStack(Items.emerald, j), itemstack));
|
||||
}
|
||||
}
|
||||
|
||||
static class EnchForGem implements ITradeList {
|
||||
public ItemStack enchantedItemStack;
|
||||
public PriceInfo priceInfo;
|
||||
|
||||
public EnchForGem(Item p_i45814_1_, PriceInfo p_i45814_2_) {
|
||||
this.enchantedItemStack = new ItemStack(p_i45814_1_);
|
||||
this.priceInfo = p_i45814_2_;
|
||||
}
|
||||
|
||||
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) {
|
||||
int i = 1;
|
||||
|
||||
if(this.priceInfo != null) {
|
||||
i = this.priceInfo.getPrice(random);
|
||||
}
|
||||
|
||||
ItemStack itemstack = new ItemStack(Items.emerald, i, 0);
|
||||
ItemStack itemstack1 = new ItemStack(this.enchantedItemStack.getItem(), 1, this.enchantedItemStack.getMetadata());
|
||||
itemstack1 = EnchantmentHelper.addRandomEnchantment(random, itemstack1, random.range(5, 19));
|
||||
recipeList.add(new MerchantRecipe(itemstack, itemstack1));
|
||||
}
|
||||
}
|
||||
|
||||
static class ItemForGem implements ITradeList {
|
||||
public ItemStack itemToBuy;
|
||||
public PriceInfo priceInfo;
|
||||
|
||||
public ItemForGem(Item par1Item, PriceInfo priceInfo) {
|
||||
this.itemToBuy = new ItemStack(par1Item);
|
||||
this.priceInfo = priceInfo;
|
||||
}
|
||||
|
||||
public ItemForGem(ItemStack stack, PriceInfo priceInfo) {
|
||||
this.itemToBuy = stack;
|
||||
this.priceInfo = priceInfo;
|
||||
}
|
||||
|
||||
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) {
|
||||
int i = 1;
|
||||
|
||||
if(this.priceInfo != null) {
|
||||
i = this.priceInfo.getPrice(random);
|
||||
}
|
||||
|
||||
ItemStack itemstack;
|
||||
ItemStack itemstack1;
|
||||
|
||||
if(i < 0) {
|
||||
itemstack = new ItemStack(Items.emerald, 1, 0);
|
||||
itemstack1 = new ItemStack(this.itemToBuy.getItem(), -i, this.itemToBuy.getMetadata());
|
||||
}
|
||||
else {
|
||||
itemstack = new ItemStack(Items.emerald, i, 0);
|
||||
itemstack1 = new ItemStack(this.itemToBuy.getItem(), 1, this.itemToBuy.getMetadata());
|
||||
}
|
||||
|
||||
recipeList.add(new MerchantRecipe(itemstack, itemstack1));
|
||||
}
|
||||
}
|
||||
|
||||
private static class PriceInfo {
|
||||
private Integer a;
|
||||
private Integer b;
|
||||
|
||||
private PriceInfo(int a, int b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
private int getPrice(Random rand) {
|
||||
return this.a >= this.b ? this.a : this.a + rand.zrange(this.b - this.a + 1);
|
||||
}
|
||||
}
|
||||
}
|
817
java/src/game/init/UniverseRegistry.java
Executable file
817
java/src/game/init/UniverseRegistry.java
Executable file
|
@ -0,0 +1,817 @@
|
|||
package game.init;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import game.Log;
|
||||
import game.biome.Biome;
|
||||
import game.block.BlockColored;
|
||||
import game.block.BlockSand;
|
||||
import game.block.LeavesType;
|
||||
import game.collect.Lists;
|
||||
import game.collect.Maps;
|
||||
import game.collect.Sets;
|
||||
import game.color.DyeColor;
|
||||
import game.dimension.Area;
|
||||
import game.dimension.DimType;
|
||||
import game.dimension.Dimension;
|
||||
import game.dimension.Dimension.GeneratorType;
|
||||
import game.dimension.Dimension.ReplacerType;
|
||||
import game.dimension.Domain;
|
||||
import game.dimension.Galaxy;
|
||||
import game.dimension.Moon;
|
||||
import game.dimension.Planet;
|
||||
import game.dimension.Sector;
|
||||
import game.dimension.Semi;
|
||||
import game.dimension.Space;
|
||||
import game.dimension.Star;
|
||||
import game.nbt.NBTException;
|
||||
import game.nbt.NBTParser;
|
||||
import game.nbt.NBTTagCompound;
|
||||
import game.nbt.NBTTagList;
|
||||
import game.rng.Random;
|
||||
import game.world.PortalType;
|
||||
import game.world.State;
|
||||
import game.world.Weather;
|
||||
|
||||
public abstract class UniverseRegistry {
|
||||
public static final int MORE_DIM_ID = 1000;
|
||||
public static final long EARTH_YEAR = 8766144L;
|
||||
|
||||
private static final List<Dimension> BASE_DIMS = Lists.newArrayList();
|
||||
private static final Map<Integer, Dimension> BASE_REGISTRY = Maps.newHashMap();
|
||||
private static final Map<String, Dimension> BASE_ALIASES = Maps.newHashMap();
|
||||
private static final Map<String, String> BASE_MAP = Maps.newHashMap();
|
||||
private static final Map<String, String> BASE_NAMES = Maps.newHashMap();
|
||||
private static final Map<Integer, Integer> PORTALS = Maps.newHashMap();
|
||||
|
||||
private static final List<Dimension> DIMENSIONS = Lists.newArrayList();
|
||||
private static final Map<Integer, Dimension> REGISTRY = Maps.newTreeMap();
|
||||
private static final Map<String, Dimension> ALIASES = Maps.newTreeMap();
|
||||
private static final Set<String> NAMES = Sets.newTreeSet();
|
||||
|
||||
// private static final Map<String, Moon> MOONS = Maps.newHashMap();
|
||||
// private static final Map<String, Planet> PLANETS = Maps.newHashMap();
|
||||
// private static final Map<String, Star> STARS = Maps.newHashMap();
|
||||
private static final Map<String, Sector> SECTORS = Maps.newHashMap();
|
||||
private static final Map<String, Galaxy> GALAXIES = Maps.newHashMap();
|
||||
private static final Map<String, Domain> DOMAINS = Maps.newHashMap();
|
||||
|
||||
private static final Map<Moon, Planet> MOON_MAP = Maps.newHashMap();
|
||||
private static final Map<Planet, Star> PLANET_MAP = Maps.newHashMap();
|
||||
private static final Map<Star, Sector> STAR_MAP = Maps.newHashMap();
|
||||
private static final Map<Sector, Galaxy> SECTOR_MAP = Maps.newHashMap();
|
||||
private static final Map<Area, Domain> AREA_MAP = Maps.newHashMap();
|
||||
|
||||
private static int nextDimId;
|
||||
|
||||
public static void clear() {
|
||||
nextDimId = UniverseRegistry.MORE_DIM_ID;
|
||||
ALIASES.clear();
|
||||
NAMES.clear();
|
||||
REGISTRY.clear();
|
||||
DIMENSIONS.clear();
|
||||
SECTORS.clear();
|
||||
GALAXIES.clear();
|
||||
DOMAINS.clear();
|
||||
MOON_MAP.clear();
|
||||
PLANET_MAP.clear();
|
||||
STAR_MAP.clear();
|
||||
SECTOR_MAP.clear();
|
||||
AREA_MAP.clear();
|
||||
register(Space.INSTANCE);
|
||||
for(Dimension dim : BASE_REGISTRY.values()) {
|
||||
register(dim.copy());
|
||||
}
|
||||
for(Entry<String, String> entry : BASE_MAP.entrySet()) {
|
||||
assign(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadNbt(NBTTagCompound tag) {
|
||||
NBTTagList list = tag.getTagList("Dimensions", 10);
|
||||
for(int z = 0; z < list.tagCount(); z++) {
|
||||
Dimension dim = Dimension.getByNbt(list.getCompoundTagAt(z));
|
||||
if(!REGISTRY.containsKey(dim.getDimensionId()) && !ALIASES.containsKey(dim.getDimensionName()))
|
||||
register(dim);
|
||||
}
|
||||
|
||||
list = tag.getTagList("Names", 10);
|
||||
for(int z = 0; z < list.tagCount(); z++) {
|
||||
NBTTagCompound data = list.getCompoundTagAt(z);
|
||||
String id = data.getString("ID");
|
||||
// if(BASE_ALIASES.containsKey(id)) {
|
||||
Dimension dim = ALIASES.get(id);
|
||||
if(dim != null && dim != Space.INSTANCE)
|
||||
dim.readNbt(data);
|
||||
// }
|
||||
}
|
||||
|
||||
list = tag.getTagList("Sectors", 10);
|
||||
for(int z = 0; z < list.tagCount(); z++) {
|
||||
NBTTagCompound data = list.getCompoundTagAt(z);
|
||||
String id = data.getString("ID");
|
||||
Sector sector = SECTORS.get(id);
|
||||
if(sector == null)
|
||||
SECTORS.put(id, sector = new Sector(id));
|
||||
sector.readNbt(data);
|
||||
}
|
||||
|
||||
list = tag.getTagList("Galaxies", 10);
|
||||
for(int z = 0; z < list.tagCount(); z++) {
|
||||
NBTTagCompound data = list.getCompoundTagAt(z);
|
||||
String id = data.getString("ID");
|
||||
Galaxy galaxy = GALAXIES.get(id);
|
||||
if(galaxy == null)
|
||||
GALAXIES.put(id, galaxy = new Galaxy(id));
|
||||
galaxy.readNbt(data);
|
||||
}
|
||||
|
||||
list = tag.getTagList("Domains", 10);
|
||||
for(int z = 0; z < list.tagCount(); z++) {
|
||||
NBTTagCompound data = list.getCompoundTagAt(z);
|
||||
String id = data.getString("ID");
|
||||
Domain domain = DOMAINS.get(id);
|
||||
if(domain == null)
|
||||
DOMAINS.put(id, domain = new Domain(id));
|
||||
domain.readNbt(data);
|
||||
}
|
||||
|
||||
list = tag.getTagList("Barycenters", 10);
|
||||
for(int z = 0; z < list.tagCount(); z++) {
|
||||
NBTTagCompound link = list.getCompoundTagAt(z);
|
||||
if(!assign(link.getString("Celestial"), link.getString("Center")))
|
||||
Log.JNI.warn("Konnte '" + link.getString("Celestial") + "' nicht zu '" + link.getString("Center") + "' zuweisen");
|
||||
}
|
||||
}
|
||||
|
||||
public static NBTTagCompound saveNbt() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(Dimension dim : DIMENSIONS) {
|
||||
if(!BASE_REGISTRY.containsKey(dim.getDimensionId()) && dim != Space.INSTANCE)
|
||||
list.appendTag(dim.toNbt());
|
||||
}
|
||||
if(!list.hasNoTags())
|
||||
tag.setTag("Dimensions", list);
|
||||
|
||||
list = new NBTTagList();
|
||||
for(Dimension dim : DIMENSIONS) {
|
||||
if(/* BASE_REGISTRY.containsKey(dim.getDimensionId()) */ dim != Space.INSTANCE) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
dim.writeNbt(data);
|
||||
if(!data.hasNoTags()) {
|
||||
data.setString("ID", dim.getDimensionName());
|
||||
list.appendTag(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!list.hasNoTags())
|
||||
tag.setTag("Names", list);
|
||||
|
||||
list = new NBTTagList();
|
||||
for(Sector sector : SECTORS.values()) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
sector.writeNbt(data);
|
||||
if(!data.hasNoTags()) {
|
||||
data.setString("ID", sector.id);
|
||||
list.appendTag(data);
|
||||
}
|
||||
}
|
||||
if(!list.hasNoTags())
|
||||
tag.setTag("Sectors", list);
|
||||
|
||||
list = new NBTTagList();
|
||||
for(Galaxy galaxy : GALAXIES.values()) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
galaxy.writeNbt(data);
|
||||
if(!data.hasNoTags()) {
|
||||
data.setString("ID", galaxy.id);
|
||||
list.appendTag(data);
|
||||
}
|
||||
}
|
||||
if(!list.hasNoTags())
|
||||
tag.setTag("Galaxies", list);
|
||||
|
||||
list = new NBTTagList();
|
||||
for(Domain domain : DOMAINS.values()) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
domain.writeNbt(data);
|
||||
if(!data.hasNoTags()) {
|
||||
data.setString("ID", domain.id);
|
||||
list.appendTag(data);
|
||||
}
|
||||
}
|
||||
if(!list.hasNoTags())
|
||||
tag.setTag("Domains", list);
|
||||
|
||||
list = new NBTTagList();
|
||||
for(Entry<Moon, Planet> entry : MOON_MAP.entrySet()) {
|
||||
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
||||
continue;
|
||||
NBTTagCompound link = new NBTTagCompound();
|
||||
link.setString("Celestial", entry.getKey().getDimensionName());
|
||||
link.setString("Center", entry.getValue().getDimensionName());
|
||||
list.appendTag(link);
|
||||
}
|
||||
for(Entry<Planet, Star> entry : PLANET_MAP.entrySet()) {
|
||||
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
||||
continue;
|
||||
NBTTagCompound link = new NBTTagCompound();
|
||||
link.setString("Celestial", entry.getKey().getDimensionName());
|
||||
link.setString("Center", entry.getValue().getDimensionName());
|
||||
list.appendTag(link);
|
||||
}
|
||||
for(Entry<Star, Sector> entry : STAR_MAP.entrySet()) {
|
||||
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
||||
continue;
|
||||
NBTTagCompound link = new NBTTagCompound();
|
||||
link.setString("Celestial", entry.getKey().getDimensionName());
|
||||
link.setString("Center", entry.getValue().id);
|
||||
list.appendTag(link);
|
||||
}
|
||||
for(Entry<Sector, Galaxy> entry : SECTOR_MAP.entrySet()) {
|
||||
if(BASE_MAP.containsKey(entry.getKey().id))
|
||||
continue;
|
||||
NBTTagCompound link = new NBTTagCompound();
|
||||
link.setString("Celestial", entry.getKey().id);
|
||||
link.setString("Center", entry.getValue().id);
|
||||
list.appendTag(link);
|
||||
}
|
||||
for(Entry<Area, Domain> entry : AREA_MAP.entrySet()) {
|
||||
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
||||
continue;
|
||||
NBTTagCompound link = new NBTTagCompound();
|
||||
link.setString("Celestial", entry.getKey().getDimensionName());
|
||||
link.setString("Center", entry.getValue().id);
|
||||
list.appendTag(link);
|
||||
}
|
||||
if(!list.hasNoTags())
|
||||
tag.setTag("Barycenters", list);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static Planet registerPlanet(String star, String name, String custom, int sky, int fog, int clouds, long orbit, long rotation,
|
||||
float offset, float gravity, float temperature, int brightness) {
|
||||
if(!ALIASES.containsKey(star) || ALIASES.get(star).getType() != DimType.STAR || ALIASES.containsKey(name))
|
||||
return null;
|
||||
Planet dim = new Planet(nextDimId++, name, sky, fog, clouds, orbit, rotation, offset, gravity, temperature, brightness);
|
||||
register(dim);
|
||||
assign(name, star);
|
||||
dim.setTimeQualifier(3);
|
||||
dim.setCustomName(custom);
|
||||
return dim;
|
||||
}
|
||||
|
||||
public static Dimension[] registerPreset(Dimension preset) {
|
||||
if(ALIASES.containsKey(preset.getDimensionName()))
|
||||
return new Dimension[] {preset};
|
||||
Random rand = new Random();
|
||||
String pname = NameRegistry.FANTASY.generate(rand, rand.range(2, 5));
|
||||
preset = preset.copy(nextDimId++, pname.toLowerCase());
|
||||
preset.setCustomName(pname);
|
||||
register(preset);
|
||||
if(preset.getType() == DimType.PLANET) {
|
||||
String galaxy = NameRegistry.FANTASY.generate(rand, rand.range(2, 5));
|
||||
String sector = NameRegistry.FANTASY.generate(rand, rand.range(2, 5));
|
||||
String sname = NameRegistry.FANTASY.generate(rand, rand.range(2, 5));
|
||||
Star star = new Star(nextDimId++, sname.toLowerCase(), 0xff0000 | (rand.range(0x60, 0xa0) << 8),
|
||||
rand.frange(200.0f, 400.0f), rand.frange(5000.0f, 7000.0f),
|
||||
rand.pick(Blocks.lava.getState(), Blocks.magma.getState()), rand.range(64, 212));
|
||||
star.setCustomName(sname);
|
||||
register(star);
|
||||
assign(preset.getDimensionName(), star.getDimensionName());
|
||||
assign(star.getDimensionName(), sector.toLowerCase());
|
||||
SECTORS.get(sector.toLowerCase()).setCustomName(sector);
|
||||
assign(sector.toLowerCase(), galaxy.toLowerCase());
|
||||
GALAXIES.get(galaxy.toLowerCase()).setCustomName(galaxy);
|
||||
return new Dimension[] {preset, star};
|
||||
}
|
||||
else if(preset.getType() == DimType.AREA) {
|
||||
String domain = NameRegistry.FANTASY.generate(rand, rand.range(2, 5));
|
||||
assign(preset.getDimensionName(), domain.toLowerCase());
|
||||
DOMAINS.get(domain.toLowerCase()).setCustomName(domain);
|
||||
}
|
||||
return new Dimension[] {preset};
|
||||
}
|
||||
|
||||
public static boolean assign(String body, String center) {
|
||||
Dimension celestial = ALIASES.get(body);
|
||||
Dimension barycenter = ALIASES.get(center);
|
||||
if(celestial != null && celestial.getType() == DimType.MOON && barycenter != null
|
||||
&& barycenter.getType() == DimType.PLANET) {
|
||||
MOON_MAP.put((Moon)celestial, (Planet)barycenter);
|
||||
((Planet)barycenter).addMoon((Moon)celestial);
|
||||
return true;
|
||||
}
|
||||
else if(celestial != null && celestial.getType() == DimType.PLANET && barycenter != null
|
||||
&& barycenter.getType() == DimType.STAR) {
|
||||
PLANET_MAP.put((Planet)celestial, (Star)barycenter);
|
||||
((Star)barycenter).addPlanet((Planet)celestial);
|
||||
return true;
|
||||
}
|
||||
else if(celestial != null && celestial.getType() == DimType.STAR && barycenter == null) {
|
||||
Sector sector = SECTORS.get(center);
|
||||
if(sector == null) {
|
||||
SECTORS.put(center, sector = new Sector(center));
|
||||
if(BASE_NAMES.containsKey(center))
|
||||
sector.setCustomName(BASE_NAMES.get(center));
|
||||
}
|
||||
STAR_MAP.put((Star)celestial, sector);
|
||||
sector.addStar((Star)celestial);
|
||||
return true;
|
||||
}
|
||||
else if(celestial != null && celestial.getType() == DimType.AREA && barycenter == null) {
|
||||
Domain domain = DOMAINS.get(center);
|
||||
if(domain == null) {
|
||||
DOMAINS.put(center, domain = new Domain(center));
|
||||
if(BASE_NAMES.containsKey(center))
|
||||
domain.setCustomName(BASE_NAMES.get(center));
|
||||
}
|
||||
AREA_MAP.put((Area)celestial, domain);
|
||||
domain.addArea((Area)celestial);
|
||||
return true;
|
||||
}
|
||||
else if(celestial == null && barycenter == null) {
|
||||
Sector sector = SECTORS.get(body);
|
||||
if(sector == null) {
|
||||
SECTORS.put(body, sector = new Sector(body));
|
||||
if(BASE_NAMES.containsKey(body))
|
||||
sector.setCustomName(BASE_NAMES.get(body));
|
||||
}
|
||||
Galaxy galaxy = GALAXIES.get(center);
|
||||
if(galaxy == null) {
|
||||
GALAXIES.put(center, galaxy = new Galaxy(center));
|
||||
if(BASE_NAMES.containsKey(center))
|
||||
galaxy.setCustomName(BASE_NAMES.get(center));
|
||||
}
|
||||
SECTOR_MAP.put(sector, galaxy);
|
||||
galaxy.addSector(sector);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void register(Dimension dim) {
|
||||
DIMENSIONS.add(dim);
|
||||
ALIASES.put(dim.getDimensionName(), dim);
|
||||
NAMES.add(dim.getDimensionName());
|
||||
REGISTRY.put(dim.getDimensionId(), dim);
|
||||
}
|
||||
|
||||
public static List<Dimension> getDimensions() {
|
||||
return DIMENSIONS;
|
||||
}
|
||||
|
||||
public static Dimension getDimension(int dim) {
|
||||
return REGISTRY.get(dim);
|
||||
}
|
||||
|
||||
public static Dimension getDimension(String name) {
|
||||
return ALIASES.get(name);
|
||||
}
|
||||
|
||||
public static Set<String> getWorldNames() {
|
||||
return NAMES;
|
||||
}
|
||||
|
||||
public static String getDefaultName(String name) {
|
||||
return BASE_NAMES.get(name);
|
||||
}
|
||||
|
||||
public static List<Dimension> getBaseDimensions() {
|
||||
return BASE_DIMS;
|
||||
}
|
||||
|
||||
public static int getPortalDest(int src, PortalType portal) {
|
||||
return PORTALS.containsKey((portal.ordinal() << 20) | src) ? PORTALS.get((portal.ordinal() << 20) | src) :
|
||||
(PORTALS.containsKey(portal.ordinal() | 0x7ff00000) ? PORTALS.get(portal.ordinal() | 0x7ff00000) : src);
|
||||
}
|
||||
|
||||
// public static Text getUnformattedName(Dimension dim, boolean full) {
|
||||
// Text base = dim.getNameComponent();
|
||||
//// if(dim.getCustomName() != null && !dim.getCustomName().isEmpty())
|
||||
//// base = new TextComponent(dim.getCustomName());
|
||||
//// else if(dim.getDimensionId() >= Constants.MORE_DIM_ID)
|
||||
////// base = new Translation("dimension." + dim.getType().getName(), dim.getDimensionName());
|
||||
//// base = new Translation("preset." + dim.getDimensionName());
|
||||
//// else
|
||||
//// base = new Translation("dimension." + dim.getDimensionName());
|
||||
// if(!full)
|
||||
// return base;
|
||||
// switch(dim.getType()) {
|
||||
// case MOON:
|
||||
// dim = MOON_MAP.get(dim);
|
||||
// if(dim == null)
|
||||
// return base;
|
||||
// base.appendText(" / ").appendSibling(dim.getNameComponent());
|
||||
// case PLANET:
|
||||
// dim = PLANET_MAP.get(dim);
|
||||
// if(dim == null)
|
||||
// return base;
|
||||
// base.appendText(" / ").appendSibling(dim.getNameComponent());
|
||||
// case STAR:
|
||||
// Sector sector = STAR_MAP.get(dim);
|
||||
// if(sector == null)
|
||||
// return base;
|
||||
// base.appendText(" / ").appendSibling(sector.getNameComponent());
|
||||
// Galaxy galaxy = SECTOR_MAP.get(sector);
|
||||
// if(galaxy == null)
|
||||
// return base;
|
||||
// base.appendText(" / ").appendSibling(galaxy.getNameComponent());
|
||||
// break;
|
||||
// case AREA:
|
||||
// Domain domain = AREA_MAP.get(dim);
|
||||
// if(domain == null)
|
||||
// return base;
|
||||
// base.appendText(" / ").appendSibling(domain.getNameComponent());
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// return base;
|
||||
// }
|
||||
|
||||
public static String getFormattedName(Dimension dim, boolean full) {
|
||||
String base = dim.getNameString();
|
||||
// if(dim.getCustomName() != null && !dim.getCustomName().isEmpty())
|
||||
// base = dim.getCustomName();
|
||||
// else if(dim.getDimensionId() >= Constants.MORE_DIM_ID)
|
||||
//// base = I18n.format("dimension." + dim.getType().getName(), dim.getDimensionName());
|
||||
// base = I18n.format("preset." + dim.getDimensionName());
|
||||
// else
|
||||
// base = I18n.format("dimension." + dim.getDimensionName());
|
||||
if(!full)
|
||||
return base;
|
||||
switch(dim.getType()) {
|
||||
case MOON:
|
||||
dim = MOON_MAP.get(dim);
|
||||
if(dim == null)
|
||||
return base;
|
||||
base += " / " + dim.getNameString();
|
||||
case PLANET:
|
||||
dim = PLANET_MAP.get(dim);
|
||||
if(dim == null)
|
||||
return base;
|
||||
base += " / " + dim.getNameString();
|
||||
case STAR:
|
||||
Sector sector = STAR_MAP.get(dim);
|
||||
if(sector == null)
|
||||
return base;
|
||||
base += " / " + sector.getNameString();
|
||||
Galaxy galaxy = SECTOR_MAP.get(sector);
|
||||
if(galaxy == null)
|
||||
return base;
|
||||
base += " / " + galaxy.getNameString();
|
||||
break;
|
||||
case AREA:
|
||||
Domain domain = AREA_MAP.get(dim);
|
||||
if(domain == null)
|
||||
return base;
|
||||
base += " / " + domain.getNameString();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
private static void registerDimension(String name, Dimension dim) {
|
||||
dim.setCustomName(name);
|
||||
BASE_NAMES.put(dim.getDimensionName(), name);
|
||||
if(dim.getType() == DimType.PLANET || dim.getType() == DimType.AREA || dim.getType() == DimType.SEMI)
|
||||
BASE_DIMS.add(dim);
|
||||
BASE_REGISTRY.put(dim.getDimensionId(), dim);
|
||||
BASE_ALIASES.put(dim.getDimensionName(), dim);
|
||||
}
|
||||
|
||||
private static void registerGalaxy(String name, String galaxy) {
|
||||
BASE_NAMES.put(galaxy, name);
|
||||
}
|
||||
|
||||
private static void registerSector(String name, String sector, String galaxy) {
|
||||
BASE_MAP.put(sector, galaxy);
|
||||
BASE_NAMES.put(sector, name);
|
||||
}
|
||||
|
||||
private static void registerDomain(String name, String domain) {
|
||||
BASE_NAMES.put(domain, name);
|
||||
}
|
||||
|
||||
private static void registerDimension(String name, Dimension dim, String base) {
|
||||
registerDimension(name, dim);
|
||||
BASE_MAP.put(dim.getDimensionName(), base);
|
||||
}
|
||||
|
||||
private static void registerPortal(PortalType portal, String src, String dest) {
|
||||
PORTALS.put((portal.ordinal() << 20) | BASE_ALIASES.get(src).getDimensionId(), BASE_ALIASES.get(dest).getDimensionId());
|
||||
}
|
||||
|
||||
private static void registerPortal(PortalType portal, String dest) {
|
||||
PORTALS.put(portal.ordinal() | 0x7ff00000, BASE_ALIASES.get(dest).getDimensionId());
|
||||
}
|
||||
|
||||
static void register() {
|
||||
registerGalaxy("Milchstraße", "milkyway");
|
||||
registerSector("Solar", "solar", "milkyway");
|
||||
registerDimension("Sol", new Star(2, "sol", 0xff7f00, 274.0f, 5778.0f, Blocks.lava.getState(), 128).setTimeQualifier(1), "solar");
|
||||
registerDimension("Terra", new Planet(1, "terra", 0xffffffff, 0xc0d8ff, 0xffffff, UniverseRegistry.EARTH_YEAR, 24000L, 28.0f, 9.81f,
|
||||
259.15f).setTimeQualifier(0)
|
||||
.setPerlinGen(Blocks.stone.getState(), Blocks.water.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.gravel.getState())
|
||||
.setBiomeGen(Biome.forest, false, 4, 4, 6, 50, 50, Biome.mushroomPlains).enableMobs().enableSnow()
|
||||
.setFrostBiomes(Biome.icePlains, Biome.icePlains, Biome.icePlains, Biome.coldTaiga, Biome.megaTaiga)
|
||||
.setColdBiomes(Biome.forest, Biome.extremeHills, Biome.taiga, Biome.plains)
|
||||
.setMediumBiomes(Biome.forest, Biome.roofedForest, Biome.extremeHills, Biome.plains, Biome.birchForest,
|
||||
Biome.swampland, Biome.jungle)
|
||||
.setHotBiomes(Biome.desert, Biome.desert, Biome.desert, Biome.savanna, Biome.savanna, Biome.plains)
|
||||
.enableCavesRavines(Blocks.lava.getState()).setDungeons(8).setWorldFloor(Blocks.bedrock.getState())
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), Blocks.stone.getState(), null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
|
||||
.addMetalOres(MetalType.values())
|
||||
.addOre(Blocks.dirt.getState(), 10, 0, 33, 0, 256, false)
|
||||
.addOre(Blocks.gravel.getState(), 8, 0, 33, 0, 256, false)
|
||||
.addOre(Blocks.rock.getState(), 6, 0, 22, 24, 72, false)
|
||||
.addOre(Blocks.coal_ore.getState(), 20, 0, 17, 0, 128, false)
|
||||
.addOre(Blocks.redstone_ore.getState(), 8, 0, 8, 0, 16, false)
|
||||
.addOre(Blocks.lapis_ore.getState(), 1, 0, 7, 16, 16, true)
|
||||
.addOre(Blocks.diamond_ore.getState(), 1, 0, 8, 0, 16, false)
|
||||
.addOre(Blocks.ruby_ore.getState(), 1, 0, 4, 12, 8, true)
|
||||
.addOre(Blocks.cinnabar_ore.getState(), 1, 0, 11, 0, 24, false)
|
||||
.enableVillages().enableMineshafts().enableScattered().enableStrongholds(), "sol");
|
||||
registerDimension("Luna", new Moon(3, "luna", 0x333333, 0x333333, 655728L, 655728L, 1.62f, 210.0f, 8)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63).setBiome(Biome.moon)
|
||||
.setTimeQualifier(1), "terra");
|
||||
|
||||
registerDimension("Merkur", new Planet(4, "mercury", 0x666666, 0x535353, 0x858585, 2111297L, 1407509L, 3.7f, 440.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
|
||||
.setTimeQualifier(1), "sol");
|
||||
registerDimension("Venus", new Planet(5, "venus", 0xc0c0c0, 0xa0a0a0, 0xe0e0e0, 5392908L, 5832449L, 8.87f, 737.0f)
|
||||
.setPerlinGen(Blocks.sand.getState(), Blocks.air.getState(), 63)
|
||||
.setTimeQualifier(1), "sol");
|
||||
registerDimension("Mars", new Planet(6, "mars", 0xd6905b, 0xbd723a, 0xbd9273, 16487781L, 24623L, 3.71f, 208.0f)
|
||||
.setPerlinGen(Blocks.sand.getState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND),
|
||||
Blocks.air.getState(), 63).setTimeQualifier(1), "sol");
|
||||
registerDimension("Jupiter", new Planet(7, "jupiter", 0xffd5ba, 0xb89f90, 0xc7b5a9, 103989391L, 9925L, 24.79f, 163.0f).enableDenseFog()
|
||||
.setFlatGen(Blocks.hydrogen.getState(), 256).setTimeQualifier(1).setCloudHeight(576.0f), "sol");
|
||||
registerDimension("Saturn", new Planet(8, "saturn", 0xf1d1a1, 0xd3b385, 0xeed7b5, 258141008L, 10656L, 10.44f, 133.0f).enableDenseFog()
|
||||
.setFlatGen(Blocks.hydrogen.getState(), 256).setTimeQualifier(1).setCloudHeight(576.0f), "sol");
|
||||
registerDimension("Uranus", new Planet(9, "uranus", 0xcee6ff, 0xadd2f9, 0x8eb0d3, 736503770L, 17240L, 8.87f, 78.0f)
|
||||
.setPerlinGen(Blocks.packed_ice.getState(), Blocks.water.getState(), 70)
|
||||
.addOre(Blocks.diamond_ore.getState(), 4, 4, 12, 0, 60, false)
|
||||
.setTimeQualifier(1), "sol");
|
||||
registerDimension("Neptun", new Planet(10, "neptune", 0xb4d9ff, 0x85bef9, 0x649bd3, 1444584441L, 16110L, 11.15f, 72.0f)
|
||||
.setPerlinGen(Blocks.packed_ice.getState(), Blocks.water.getState(), 70)
|
||||
.addOre(Blocks.diamond_ore.getState(), 4, 2, 1, 0, 60, false)
|
||||
.setTimeQualifier(1), "sol");
|
||||
registerDimension("Ceres", new Planet(11, "ceres", 0x666666, 0x535353, 0x858585, 40315496L, 9074L, 0.27f, 167.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
|
||||
.setTimeQualifier(1), "sol");
|
||||
registerDimension("Pluto", new Planet(12, "pluto", 0x666666, 0x535353, 0x858585, 2173127098L, 153293L, 0.62f, 40.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
|
||||
.setTimeQualifier(1), "sol");
|
||||
registerDimension("Haumea", new Planet(13, "haumea", 0x666666, 0x535353, 0x858585, 2487831667L, 3914L, 0.63f, 48.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
|
||||
.setTimeQualifier(1), "sol");
|
||||
registerDimension("Makemake", new Planet(14, "makemake", 0x666666, 0x535353, 0x858585, 2684193293L, 22826L, 0.4f, 30.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
|
||||
.setTimeQualifier(1), "sol");
|
||||
registerDimension("Eris", new Planet(15, "eris", 0x666666, 0x535353, 0x858585, 4900274496L, 378862L, 0.82f, 30.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
|
||||
.setTimeQualifier(1), "sol");
|
||||
|
||||
registerDimension("Gi'rok", new Star(100, "girok", 0xff8f00, 232.0f, 5220.0f, Blocks.lava.getState(), 112).setTimeQualifier(2), "solar");
|
||||
registerDimension("'Elbenplanet Gharoth'", new Planet(101, "gharoth", 0xffffffff, 0xc0d8ff, 0xffffff, 4837386L, 52960L, 30.0f, 10.0f, 257.3f)
|
||||
.setTimeQualifier(2).setSimpleGen(Blocks.dirt.getState(), Blocks.water.getState(), 64)
|
||||
.setSimpleReplacer(Blocks.gravel.getState(), Blocks.sand.getState()).setBiome(Biome.elvenForest)
|
||||
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs().enableSnow()
|
||||
.setWorldFloor(Blocks.bedrock.getState())
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
|
||||
.addOre(Blocks.thetium_ore.getState(), 1, 0, 3, 0, 14, false)
|
||||
.addOre(Blocks.gyriyn_ore.getState(), 0, 2, 3, 0, 12, false), "girok");
|
||||
registerDimension("'Vampirplanet Transsylvanien'", new Planet(102, "transylvania", 0xffffffff, 0xc0d8ff, 0xffffff, 33850466L, 49760L, 20.0f, 10.0f, 255.5f)
|
||||
.setTimeQualifier(5).setPerlinGen(Blocks.rock.getState(), Blocks.water.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.gravel.getState()).setBiomeGen(Biome.forest, true, 5, 3, 3, 30)
|
||||
.enableCavesRavines(Blocks.lava.getState()).setDungeons(10).enableMobs().enableSnow()
|
||||
.setWorldFloor(Blocks.bedrock.getState())
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
|
||||
.addOre(Blocks.coal_ore.getState(), 12, 0, 14, 4, 28, false)
|
||||
.addOre(Blocks.lead_ore.getState(), 2, 0, 8, 0, 8, false)
|
||||
.addOre(Blocks.ardite_ore.getState(), 0, 2, 3, 0, 12, false)
|
||||
.addOre(Blocks.nichun_ore.getState(), 0, 10, 1, 0, 10, false), "girok");
|
||||
registerDimension("'Eismond Yrdinath'", new Moon(103, "yrdinath", 0xccccff, 0xccccff, 46743637L, 17460L, 2.5f, 239.15f, 8).setTimeQualifier(4)
|
||||
.setPerlinGen(Blocks.snow.getState(), Blocks.ice.getState(), 63).setBiome(Biome.snowLand)
|
||||
.setWorldFloor(Blocks.air.getState()).enableMobs().enableSnow().setWeather(Weather.SNOW), "transylvania");
|
||||
registerDimension("'Wüstenplanet Me'sar'", new Planet(104, "mesar", 0xff7f3f, 0xff6022, 0xff6f00, 56643366L, 87340L, 11.0f, 333.15f)
|
||||
.setTimeQualifier(5).setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.sand.getState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND))
|
||||
.setBiomeGen(Biome.mesa, true, 3, 1000, 100000, 100000)
|
||||
.enableCavesRavines(Blocks.lava.getState()).enableMobs()
|
||||
.setWorldFloor(Blocks.bedrock.getState())
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
|
||||
.addOre(Blocks.iron_ore.getState(), 6, 2, 24, 0, 64, false)
|
||||
.addOre(Blocks.gold_ore.getState(), 4, 2, 20, 0, 48, false)
|
||||
.addOre(Blocks.lead_ore.getState(), 6, 0, 14, 0, 32, false)
|
||||
.addOre(Blocks.copper_ore.getState(), 8, 2, 12, 0, 52, false)
|
||||
.addOre(Blocks.coal_ore.getState(), 8, 4, 30, 0, 16, false)
|
||||
.addOre(Blocks.stone.getState(), 8, 4, 33, 0, 80, false), "girok");
|
||||
|
||||
registerDimension("Der Warp", new Semi(-1, "warp", 0x0c001f, 0x0c001f, 0x190033, 285.0f, 3).setCloudTexture("clouds_dense").setCloudHeight(238.0f)
|
||||
.setPerlinGen(Blocks.obsidian.getState(), Blocks.lava.getState(), 63)
|
||||
.setBiome(Biome.chaos).enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableMobs().enableSnow()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.obsidian.getState(), 8, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 1, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 1, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true)
|
||||
.setStarBrightness(0.9f).setDeepStarBrightness(0.6f)
|
||||
.setStarColorSin(25.0f, 0.1f, 0.25f, 0xff00ff, 1, 4).setDeepStarColorSin(25.0f, 0.1f, 0.5f, 0xff00ff, 1, 4));
|
||||
|
||||
registerDomain("Tian'Xin", "tianxin");
|
||||
registerDimension("Ni'enrath", new Area(-2, "nienrath", 0x7f00ff, 0x7f00ff, 276.15f, 1)
|
||||
.setPerlinGen(Blocks.tian.getState(), Blocks.water.getState(), 63).setBiome(Biome.tian)
|
||||
.setBiomeReplacer(Blocks.tian.getState()).enableLongCaves().enableMobs().enableSnow()
|
||||
.addLake(Blocks.water.getState(), Blocks.tian.getState(), Blocks.tian.getState(), 4, 0, 255, false)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false), "tianxin");
|
||||
|
||||
registerDimension("Cyberspace", new Area(-3, "cyberspace", 0x000000, 0x000000, 293.15f, 15)
|
||||
.setFlatGen(Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.GREEN), 2)
|
||||
.enableMobs());
|
||||
|
||||
registerDomain("Hölle", "hell");
|
||||
registerDimension("Kreis Thedric", new Area(-1001, "thedric", 0x330707, 0x330707, 347.15f, 2).enableLongCaves().enableMobs().enableFortresses()
|
||||
.setWorldFloor(Blocks.air.getState()).setWorldCeiling(Blocks.bedrock.getState()).enableDenseFog()
|
||||
.setCavernGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
|
||||
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState())
|
||||
.setBiome(Biome.upperHell), "hell");
|
||||
registerDimension("Kreis Kyroth", new Area(-1002, "kyroth", 0x990000, 0x990000, 387.15f, 3).enableLongCaves().enableMobs()
|
||||
.setWorldFloor(Blocks.air.getState())
|
||||
.setSimpleGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 64)
|
||||
.setSimpleReplacer(Blocks.obsidian.getState(), Blocks.soul_sand.getState())
|
||||
.setBiome(Biome.lowerHell)
|
||||
.addLake(Blocks.lava.getState(), null, null, 4, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true), "hell");
|
||||
registerDimension("Kreis Ahrd", new Area(-1003, "ahrd", 0xcc0000, 0xcc0000, 467.15f, 15).enableLongCaves().enableMobs()
|
||||
.setWorldFloor(Blocks.air.getState())
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.hellHills)
|
||||
.addLake(Blocks.lava.getState(), Blocks.soul_sand.getState(), Blocks.soul_sand.getState(),
|
||||
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true), "hell");
|
||||
registerDimension("Kreis Mizorath", new Area(-1004, "mizorath", 0xff0000, 0xff0000, 1067.15f, 15).enableMobs()
|
||||
.setWorldFloor(Blocks.air.getState())
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.blood.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.soulPlains), "hell");
|
||||
registerDimension("Kreis Dargoth", new Area(-1005, "dargoth", 0xff3f0c, 0xff3f0c, 1707.15f, 15).enableMobs()
|
||||
.setWorldFloor(Blocks.air.getState())
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.magma.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.soulPlains), "hell");
|
||||
registerDimension("Kreis Aasirith", new Area(-1006, "aasirith", 0x191919, 0x191919, 2482.0f, 1).enableLongCaves().enableMobs()
|
||||
.setWorldFloor(Blocks.air.getState())
|
||||
.setPerlinGen(Blocks.rock.getState(), Blocks.magma.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.ash.getState()).setBiome(Biome.ashLand)
|
||||
.addLake(Blocks.lava.getState(), Blocks.rock.getState(), Blocks.rock.getState(),
|
||||
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true), "hell");
|
||||
|
||||
setPresets();
|
||||
clear();
|
||||
}
|
||||
|
||||
private static Dimension addPreset(String name, String data) {
|
||||
return addPreset(name, "terra", data);
|
||||
}
|
||||
|
||||
private static Dimension addPreset(String name, String base, String data) {
|
||||
Dimension dim = BASE_ALIASES.get(base).copy(UniverseRegistry.MORE_DIM_ID, "preset");
|
||||
NBTTagCompound ptag;
|
||||
try {
|
||||
ptag = NBTParser.parseTag("{" + data + "}");
|
||||
}
|
||||
catch(NBTException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
NBTTagCompound dtag = dim.toNbt(true);
|
||||
if(ptag.getBoolean("ClearGenerator")) {
|
||||
ptag.removeTag("ClearGenerator");
|
||||
dtag.removeTag("FloorBlock");
|
||||
dtag.removeTag("CeilingBlock");
|
||||
dtag.removeTag("Layers");
|
||||
dtag.removeTag("AddBiomes");
|
||||
dtag.removeTag("FrostBiomes");
|
||||
dtag.removeTag("ColdBiomes");
|
||||
dtag.removeTag("MediumBiomes");
|
||||
dtag.removeTag("HotBiomes");
|
||||
dtag.removeTag("Ores");
|
||||
dtag.removeTag("Lakes");
|
||||
dtag.removeTag("Liquids");
|
||||
dtag.setString("Generator", GeneratorType.FLAT.getName());
|
||||
dtag.setString("Replacer", ReplacerType.NONE.getName());
|
||||
// dtag.setBoolean("MobGen", false);
|
||||
// dtag.setBoolean("SnowGen", false);
|
||||
dtag.setBoolean("Caves", false);
|
||||
dtag.setBoolean("Ravines", false);
|
||||
dtag.setBoolean("AltCaves", false);
|
||||
dtag.setBoolean("Strongholds", false);
|
||||
dtag.setBoolean("Villages", false);
|
||||
dtag.setBoolean("Mineshafts", false);
|
||||
dtag.setBoolean("Scattered", false);
|
||||
dtag.setBoolean("Fortresses", false);
|
||||
dtag.setInteger("Dungeons", 0);
|
||||
dtag.setInteger("BiomeSize", 0);
|
||||
dtag.setInteger("RiverSize", 4);
|
||||
dtag.setInteger("SnowRarity", 6);
|
||||
dtag.setInteger("SeaRarity", 50);
|
||||
dtag.setInteger("AddRarity", 50);
|
||||
dtag.setInteger("SeaLevel", 0);
|
||||
dtag.setString("DefaultBiome", Biome.none.name.toLowerCase());
|
||||
dtag.setBoolean("SemiFixed", false);
|
||||
// dtag.setString("DefaultWeather", Weather.CLEAR.getName());
|
||||
dtag.setString("DefaultLeaves", LeavesType.SPRING.getName());
|
||||
dtag.setString("FillerBlock", BlockRegistry.toIdName(Blocks.air.getState()));
|
||||
dtag.setString("TopBlock", BlockRegistry.toIdName(Blocks.air.getState()));
|
||||
dtag.setString("SurfaceBlock", BlockRegistry.toIdName(Blocks.air.getState()));
|
||||
dtag.setString("AltBlock1", BlockRegistry.toIdName(Blocks.air.getState()));
|
||||
dtag.setString("AltBlock2", BlockRegistry.toIdName(Blocks.air.getState()));
|
||||
dtag.setString("LiquidBlock", BlockRegistry.toIdName(Blocks.air.getState()));
|
||||
dtag.setString("CaveFillBlock", BlockRegistry.toIdName(Blocks.air.getState()));
|
||||
}
|
||||
dtag.merge(ptag);
|
||||
dim.fromNbt(dtag);
|
||||
dim.setCustomName(name);
|
||||
BASE_DIMS.add(dim);
|
||||
return dim;
|
||||
}
|
||||
|
||||
private static Dimension addFlatPreset(String name, Biome biome, boolean populate, State main, Object ... layers) {
|
||||
return addFlatPreset(name, "terra", biome, populate, main, layers);
|
||||
}
|
||||
|
||||
private static Dimension addFlatPreset(String name, String base, Biome biome, boolean populate, State main, Object ... layers) {
|
||||
Dimension dim = addPreset("Flach - " + name, base, "ClearGenerator:1b" + (populate ? "" : ",NoPopulation:1b"));
|
||||
dim.setBiome(biome);
|
||||
if(main != null)
|
||||
dim.setFlatGen(main, layers);
|
||||
return dim;
|
||||
}
|
||||
|
||||
private static void setPresets()
|
||||
{
|
||||
addPreset("Standard", "");
|
||||
addPreset("Doppelte Höhe (128)", "BaseSize:17.0,Stretch:24.0,ScaleY:80.0,SeaLevel:127");
|
||||
addPreset("Große Biome", "BiomeSize:6");
|
||||
addPreset("Überdreht", "Amplification:2.0");
|
||||
addPreset("Wasserwelt", "ScaleX:5000.0,ScaleY:1000.0,ScaleZ:5000.0,Stretch:8.0,BDepthWeight:2.0,BDepthOffset:0.5,BScaleWeight:2.0,BScaleOffset:0.375,SeaLevel:511");
|
||||
addPreset("Inselland", "CoordScale:3000.0,HeightScale:6000.0,UpperLmtScale:250.0,Stretch:10.0");
|
||||
addPreset("Favorit des Gräbers", "ScaleX:5000.0,ScaleY:1000.0,ScaleZ:5000.0,Stretch:5.0,BDepthWeight:2.0,BDepthOffset:1.0,BScaleWeight:4.0,BScaleOffset:1.0");
|
||||
addPreset("Verrückte Berge", "CoordScale:738.41864,HeightScale:157.69133,UpperLmtScale:801.4267,LowerLmtScale:1254.1643,DepthScaleX:374.93652,DepthScaleZ:288.65228,"
|
||||
+ "ScaleX:1355.9908,ScaleY:745.5343,ScaleZ:1183.464,BaseSize:1.8758626,Stretch:1.7137525,BDepthWeight:1.7553768,BDepthOffset:3.4701107,BScaleOffset:2.535211");
|
||||
addPreset("Trockenheit", "ScaleX:1000.0,ScaleY:3000.0,ScaleZ:1000.0,Stretch:10.0,SeaLevel:20");
|
||||
addPreset("Chaotische Höhlen", "UpperLmtScale:2.0,LowerLmtScale:64.0,SeaLevel:6");
|
||||
addPreset("Viel Glück", "LiquidBlock:lava,SeaLevel:40");
|
||||
|
||||
addFlatPreset("Klassisch", Biome.plains, false, Blocks.dirt.getState(), Blocks.bedrock.getState(), 2, Blocks.dirt.getState(),
|
||||
Blocks.grass.getState()).enableVillages();
|
||||
|
||||
addFlatPreset("Abbauwelt", Biome.extremeHills, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 230, Blocks.stone.getState(),
|
||||
5, Blocks.dirt.getState(), Blocks.grass.getState()).enableStrongholds().enableMineshafts().setDungeons(8);
|
||||
|
||||
addFlatPreset("Wasserwelt", Biome.sea, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 5, Blocks.stone.getState(),
|
||||
52, Blocks.dirt.getState(), 5, Blocks.sand.getState(), 90, Blocks.water.getState());
|
||||
|
||||
addFlatPreset("Oberfläche", Biome.plains, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
|
||||
3, Blocks.dirt.getState(), Blocks.grass.getState()).setBiomeReplacer(Blocks.gravel.getState()).enableVillages().enableStrongholds().enableMineshafts().setDungeons(8)
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false).addLake(Blocks.lava.getState(), Blocks.stone.getState(), null, 8, 8, 255, true);
|
||||
|
||||
addFlatPreset("Verschneites Königreich", Biome.icePlains, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
|
||||
3, Blocks.dirt.getState(), Blocks.grass.getState(), Blocks.snow_layer.getState()).enableVillages();
|
||||
|
||||
addFlatPreset("Verschneites Königreich +", Biome.icePlains, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
|
||||
3, Blocks.dirt.getState(), Blocks.grass.getState(), Blocks.snow_layer.getState()).setBiomeReplacer(Blocks.gravel.getState()).enableVillages()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false);
|
||||
|
||||
addFlatPreset("Unendliche Grube", Biome.plains, false, Blocks.dirt.getState(), 2, Blocks.cobblestone.getState(), 3, Blocks.dirt.getState(), Blocks.grass.getState())
|
||||
.setBiomeReplacer(Blocks.gravel.getState()).enableVillages();
|
||||
|
||||
addFlatPreset("Wüste", Biome.desert, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(), 52, Blocks.sandstone.getState())
|
||||
.enableVillages().enableScattered();
|
||||
|
||||
addFlatPreset("Redstonewelt", Biome.desert, false, Blocks.sandstone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(),
|
||||
52, Blocks.sandstone.getState());
|
||||
|
||||
addPreset("Leer", "ClearGenerator:1b");
|
||||
addPreset("Alpha 1.2", "Strongholds:0b,Villages:0b,MineShafts:0b,Scattered:0b,Generator:simple,Replacer:simple,Ravines:0b,SeaLevel:64,AltBlock2:sand");
|
||||
}
|
||||
}
|
65
java/src/game/init/WoodType.java
Executable file
65
java/src/game/init/WoodType.java
Executable file
|
@ -0,0 +1,65 @@
|
|||
package game.init;
|
||||
|
||||
import game.color.Colorizer;
|
||||
|
||||
public enum WoodType {
|
||||
OAK("oak", "Eichen", null, 20, "apple"),
|
||||
SPRUCE("spruce", "Fichten", Colorizer.PINE, 20),
|
||||
BIRCH("birch", "Birken", Colorizer.BIRCH, 20),
|
||||
JUNGLE("jungle", "Tropen", null, 40),
|
||||
ACACIA("acacia", "Akazien", null, 20),
|
||||
DARK_OAK("dark_oak", "Schwarzeichen", null, 20),
|
||||
CHERRY("cherry", "Kirsch", Colorizer.NONE, 20),
|
||||
MAPLE("maple", "Ahorn", Colorizer.NONE, 20),
|
||||
TIAN("tian", "Tian", Colorizer.NONE, 80);
|
||||
|
||||
private final String name;
|
||||
private final Colorizer tintType;
|
||||
private final int sapChance;
|
||||
private final String item;
|
||||
private final String display;
|
||||
|
||||
private WoodType(String name, String display, Colorizer tint, int sapChance) {
|
||||
this(name, display, tint, sapChance, null);
|
||||
}
|
||||
|
||||
private WoodType(String name, String display, Colorizer tint, int sapChance, String item) {
|
||||
this.name = name;
|
||||
this.tintType = tint;
|
||||
this.sapChance = sapChance;
|
||||
this.item = item;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public Colorizer getTintType() {
|
||||
return this.tintType;
|
||||
}
|
||||
|
||||
public int getSaplingChance() {
|
||||
return this.sapChance;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return this.display;
|
||||
}
|
||||
|
||||
public String getItem() {
|
||||
return this.item;
|
||||
}
|
||||
|
||||
public static String[] getNames(String suffix) {
|
||||
String[] str = new String[values().length];
|
||||
for(int z = 0; z < str.length; z++) {
|
||||
str[z] = values()[z].name + "_" + suffix;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue