-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #355 from Team-RTG/dev
Merged 0.4.0 dev into master.
- Loading branch information
Showing
457 changed files
with
5,933 additions
and
3,190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
59 changes: 59 additions & 0 deletions
59
src/main/java/exterminatorJeff/undergroundBiomes/api/BiomeGenUndergroundBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package exterminatorJeff.undergroundBiomes.api; | ||
|
||
public class BiomeGenUndergroundBase { | ||
|
||
|
||
public String biomeName = ""; | ||
|
||
public final int biomeID; | ||
|
||
public boolean hasStrata = false; | ||
|
||
public StrataLayer[] strata; | ||
|
||
public final PerlinNoiseGenerator strataNoise; | ||
|
||
//public int fillerBlock = 0; | ||
//public byte fillerBlockMetadata; | ||
|
||
public final UBStoneCodes fillerBlockCodes; | ||
|
||
public BiomeGenUndergroundBase(int ID, NamedBlock filler, int metadataValue, BiomeGenUndergroundBase [] biomeList){ | ||
this.biomeID = ID; | ||
this.fillerBlockCodes = new UBStoneCodes(filler,metadataValue); | ||
strataNoise = new PerlinNoiseGenerator(1); | ||
biomeList[ID] = this; | ||
} | ||
|
||
public BiomeGenUndergroundBase(int ID, NamedBlock filler, int metadataValue, BiomeGenUndergroundBase [] biomeList, | ||
StrataLayer [] strataLayers){ | ||
this.biomeID = ID; | ||
this.fillerBlockCodes = new UBStoneCodes(filler,metadataValue); | ||
strataNoise = new PerlinNoiseGenerator(1); | ||
biomeList[ID] = this; | ||
AddStrataLayers(strataLayers); | ||
} | ||
|
||
public BiomeGenUndergroundBase AddStrataLayers(StrataLayer[] strata){ | ||
hasStrata = true; | ||
this.strata = strata; | ||
return this; | ||
} | ||
|
||
public UBStoneCodes getStrataBlockAtLayer(int y){ | ||
for(int i = 0; i < strata.length; i++){ | ||
if(strata[i].valueIsInLayer(y) == true){ | ||
return strata[i].codes; | ||
} | ||
} | ||
return fillerBlockCodes; | ||
} | ||
|
||
public BiomeGenUndergroundBase setName(String name){ | ||
this.biomeName = name; | ||
return this; | ||
} | ||
|
||
} | ||
|
||
|
51 changes: 51 additions & 0 deletions
51
src/main/java/exterminatorJeff/undergroundBiomes/api/BlockCodes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package exterminatorJeff.undergroundBiomes.api; | ||
|
||
/** | ||
* | ||
* @author Zeno410 | ||
*/ | ||
|
||
import Zeno410Utils.*; | ||
import net.minecraft.block.Block; | ||
|
||
public class BlockCodes extends BlockState { | ||
public final NamedBlock name; | ||
public final BlockCodes onDrop; | ||
private final int metadataHashcode; | ||
|
||
public BlockCodes(Block block, int metadata) { | ||
super(block,metadata); | ||
name = null; | ||
onDrop = this; | ||
metadataHashcode = new Integer(metadata).hashCode(); | ||
} | ||
|
||
public BlockCodes(NamedBlock namer, int metadata) { | ||
super(namer.block(),metadata); | ||
name = namer; | ||
if (block == null) { | ||
throw new RuntimeException("couldn't find block for "+namer.internal()); | ||
} | ||
onDrop = this; | ||
metadataHashcode = new Integer(metadata).hashCode(); | ||
} | ||
|
||
public BlockCodes(NamedBlock namer, int metadata, BlockCodes onDrop) { | ||
super(namer.block(),metadata); | ||
name = namer; | ||
this.onDrop = onDrop; | ||
metadataHashcode = new Integer(metadata).hashCode(); | ||
} | ||
|
||
public int hashcode() { | ||
return block.hashCode()+metadataHashcode; | ||
} | ||
|
||
public boolean equals(Object compared) { | ||
if (compared instanceof BlockCodes) { | ||
BlockCodes comparedCodes = (BlockCodes)compared; | ||
if ((block==comparedCodes.block)&&(metadata == comparedCodes.metadata)) return true; | ||
} | ||
return false; | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
src/main/java/exterminatorJeff/undergroundBiomes/api/NamedBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package exterminatorJeff.undergroundBiomes.api; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemBlock; | ||
|
||
import cpw.mods.fml.common.registry.GameRegistry; | ||
|
||
public class NamedBlock extends Names { | ||
|
||
protected int id; | ||
public Block block; | ||
|
||
public final static String modid = "undergroundBiomes"; | ||
public NamedBlock(String internalName) { | ||
super(internalName); | ||
} | ||
|
||
public void gameRegister(Block _block, Class itemClass) { | ||
block = _block; | ||
GameRegistry.registerBlock(block, itemClass, internal()); | ||
} | ||
|
||
public void register(int _id, Block _block) { | ||
if (block != null) { | ||
throw duplicateRegistry(); | ||
} | ||
//Registrar.instance.add(this,_id,_block); | ||
reRegister(_id,_block); | ||
} | ||
|
||
public void reRegister(int _id, Block _block) { | ||
id = _id; | ||
block = _block; | ||
block.setBlockName(external()); | ||
Block current = Block.getBlockById(_id); | ||
if (current != block) { | ||
//UndergroundBiomes.logger.info(this.internal() + "was missing "); | ||
if (current != null) { | ||
throw new RuntimeException(this.internal()+ " has been replaced by "+current.toString()); | ||
} | ||
Block.blockRegistry.addObject(id, this.internal(), _block); | ||
} | ||
} | ||
|
||
public Block block() { | ||
return block; | ||
} | ||
|
||
public boolean matches(Item compared) { | ||
if (compared instanceof ItemBlock) { | ||
return (((ItemBlock)compared).field_150939_a.equals(block)); | ||
} | ||
return false; | ||
} | ||
|
||
public boolean matches(Block compared) { | ||
return compared.equals(this.block()); | ||
} | ||
|
||
public int ID() {return Block.getIdFromBlock(block());} | ||
|
||
public Item matchingItem(Block block) { | ||
return Item.getItemById(Block.getIdFromBlock(block)); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
src/main/java/exterminatorJeff/undergroundBiomes/api/NamedItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package exterminatorJeff.undergroundBiomes.api; | ||
|
||
import net.minecraft.client.renderer.texture.IIconRegister; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.init.Items; | ||
import net.minecraft.util.IIcon; | ||
|
||
public class NamedItem extends Names { | ||
|
||
protected int id; | ||
protected Item item; | ||
|
||
public NamedItem(String internalName) { | ||
super(internalName); | ||
} | ||
|
||
public NamedItem(NamedBlock block) { | ||
this (block.internal()); | ||
} | ||
|
||
public void register(int _id, Item _item) { | ||
|
||
// not reregistring in general for now | ||
//Registrar.instance.add(this,_id,_item); | ||
reRegister(_id,_item); | ||
} | ||
|
||
public void reRegister(int _id, Item _item) { | ||
id = _id; | ||
item = _item; | ||
Item current = Item.getItemById(_id); | ||
if (current != _item) { | ||
Item.itemRegistry.addObject(_id, this.internal(), _item); | ||
} | ||
} | ||
|
||
public Item cachedItem() { | ||
if (item == null) { | ||
item = (Item)(Item.itemRegistry.getObject(this.external())); | ||
if (item == null) throw new RuntimeException(this.internal()+ " has no item"); | ||
} | ||
return item; | ||
} | ||
|
||
public Item registeredItem() { | ||
Item result = (Item)(Item.itemRegistry.getObject(internal())); | ||
if (result == null) { | ||
result = (Item)(Item.itemRegistry.getObject(external())); | ||
if (result == null) { | ||
for (Object key: Item.itemRegistry.getKeys()) { | ||
//UndergroundBiomes.logger.info(key.toString()); | ||
} | ||
//UndergroundBiomes.logger.info(external()); | ||
throw new RuntimeException(); | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
public IIcon registerIcons(IIconRegister iconRegister) { | ||
return iconRegister.registerIcon(external()); | ||
} | ||
|
||
public boolean matches(Item matched) { | ||
return item.equals(matched); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/exterminatorJeff/undergroundBiomes/api/NamedSlabPair.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package exterminatorJeff.undergroundBiomes.api; | ||
import Zeno410Utils.*; | ||
import net.minecraft.block.Block; | ||
import java.util.logging.Logger; | ||
|
||
/** | ||
* | ||
* @author Zeno410 | ||
*/ | ||
public class NamedSlabPair { | ||
public static final Logger logger = new Zeno410Logger("NamedSlabPair").logger(); | ||
public final NamedBlock half; | ||
public final NamedBlock full; | ||
|
||
public NamedSlabPair(NamedBlock material) { | ||
half = new NamedSlab(material.internal()+"HalfSlab"); | ||
full = new NamedSlab(material.internal()+"FullSlab"); | ||
} | ||
|
||
public static class NamedSlab extends NamedBlock { | ||
public NamedSlab(String name) {super(name);} | ||
|
||
public Block block() { | ||
// this doesn't register its own items so it doesn't have the block | ||
Block result = Block.getBlockFromName(internal()); | ||
if (result == null) { | ||
result = Block.getBlockFromName(external()); | ||
} | ||
return result; | ||
} | ||
|
||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/exterminatorJeff/undergroundBiomes/api/NamedVanillaBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package exterminatorJeff.undergroundBiomes.api; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.init.Blocks; | ||
|
||
public class NamedVanillaBlock extends NamedBlock { | ||
|
||
public final static NamedBlock cobblestone = new NamedVanillaBlock(Blocks.cobblestone); | ||
public final static NamedBlock cobblestone_wall = new NamedVanillaBlock(Blocks.cobblestone_wall); | ||
public final static NamedBlock dispenser= new NamedVanillaBlock(Blocks.dispenser); | ||
public final static NamedBlock furnace= new NamedVanillaBlock(Blocks.furnace); | ||
|
||
public final static NamedBlock lever= new NamedVanillaBlock(Blocks.lever); | ||
public final static NamedBlock piston= new NamedVanillaBlock(Blocks.piston); | ||
public final static NamedBlock planks= new NamedVanillaBlock(Blocks.planks); | ||
public final static NamedBlock stone_pressure_plate= new NamedVanillaBlock(Blocks.stone_pressure_plate); | ||
|
||
public final static NamedBlock sand= new NamedVanillaBlock(Blocks.sand); | ||
public final static NamedBlock sandstone= new NamedVanillaBlock(Blocks.sandstone); | ||
public final static NamedBlock smoothSandstone= new NamedVanillaBlock(Blocks.sandstone); | ||
public final static NamedBlock stairsCobblestone= new NamedVanillaBlock(Blocks.stone_stairs); | ||
public final static NamedBlock stairsStoneBrick= new NamedVanillaBlock(Blocks.stone_brick_stairs); | ||
public final static NamedBlock stone= new NamedVanillaBlock(Blocks.stone); | ||
public final static NamedBlock stoneBrick= new NamedVanillaBlock(Blocks.stonebrick); | ||
public final static NamedBlock stoneButton= new NamedVanillaBlock(Blocks.stone_button); | ||
public final static NamedBlock stoneSingleSlab= new NamedVanillaBlock(Blocks.stone_slab); | ||
public final static NamedBlock torchRedstoneActive= new NamedVanillaBlock(Blocks.lit_redstone_lamp); | ||
|
||
public NamedVanillaBlock(String name) { | ||
super(name); | ||
id = UBIDs.blockID(name); | ||
block = UBIDs.blockNamed(name); | ||
} | ||
|
||
public NamedVanillaBlock(Block _block) { | ||
super(_block.getUnlocalizedName()); | ||
id = Block.getIdFromBlock(_block); | ||
block = _block; | ||
} | ||
|
||
public Block block() { | ||
if (block == null) { | ||
block = UBIDs.blockNamed(this.internal()); | ||
//if (block == null) throw new RuntimeException(); | ||
} | ||
return block; | ||
} | ||
} |
Oops, something went wrong.