mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
cleanup~
This commit is contained in:
parent
722b634f5f
commit
00766c48d8
57 changed files with 967 additions and 992 deletions
|
@ -70,40 +70,11 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IAct
|
||||||
return this.blockIcon;
|
return this.blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(IIconRegister iconReg){
|
|
||||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
|
||||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front");
|
|
||||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName(){
|
|
||||||
return "blockAtomicReconstructor";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
|
||||||
return EnumRarity.epic;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int i){
|
|
||||||
return new TileEntityAtomicReconstructor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(){
|
public boolean isOpaqueCube(){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
|
||||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
|
@ -134,6 +105,35 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IAct
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||||
|
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||||
|
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerBlockIcons(IIconRegister iconReg){
|
||||||
|
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
||||||
|
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front");
|
||||||
|
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(){
|
||||||
|
return "blockAtomicReconstructor";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
|
return EnumRarity.epic;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World world, int i){
|
||||||
|
return new TileEntityAtomicReconstructor();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||||
this.dropInventory(world, x, y, z);
|
this.dropInventory(world, x, y, z);
|
||||||
|
|
|
@ -26,16 +26,6 @@ public class BlockBlackLotus extends BlockBush implements IActAddItemOrBlock{
|
||||||
this.setStepSound(soundTypeGrass);
|
this.setStepSound(soundTypeGrass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName(){
|
|
||||||
return "blockBlackLotus";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
|
||||||
return EnumRarity.epic;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int meta){
|
public IIcon getIcon(int side, int meta){
|
||||||
|
@ -47,4 +37,14 @@ public class BlockBlackLotus extends BlockBush implements IActAddItemOrBlock{
|
||||||
public void registerBlockIcons(IIconRegister iconReg){
|
public void registerBlockIcons(IIconRegister iconReg){
|
||||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(){
|
||||||
|
return "blockBlackLotus";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
|
return EnumRarity.epic;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,14 +47,14 @@ public class BlockCrystal extends Block implements IActAddItemOrBlock{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public int damageDropped(int meta){
|
||||||
public int getRenderColor(int meta){
|
return meta;
|
||||||
return meta >= allCrystals.length ? super.getRenderColor(meta) : allCrystals[meta].color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int meta){
|
@SideOnly(Side.CLIENT)
|
||||||
return meta;
|
public int getRenderColor(int meta){
|
||||||
|
return meta >= allCrystals.length ? super.getRenderColor(meta) : allCrystals[meta].color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -111,17 +111,6 @@ public class BlockSlabs extends Block implements IActAddItemOrBlock{
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetadata(int meta){
|
|
||||||
return meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
|
||||||
EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack);
|
|
||||||
return rarity == null ? EnumRarity.common : rarity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ){
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ){
|
||||||
if(world.getBlock(x, y, z) == this.field_150939_a && ((side == 1 && world.getBlockMetadata(x, y, z) == 0) || (side == 0 && world.getBlockMetadata(x, y, z) == 1))){
|
if(world.getBlock(x, y, z) == this.field_150939_a && ((side == 1 && world.getBlockMetadata(x, y, z) == 0) || (side == 0 && world.getBlockMetadata(x, y, z) == 1))){
|
||||||
|
@ -138,5 +127,16 @@ public class BlockSlabs extends Block implements IActAddItemOrBlock{
|
||||||
public String getUnlocalizedName(ItemStack stack){
|
public String getUnlocalizedName(ItemStack stack){
|
||||||
return this.getUnlocalizedName();
|
return this.getUnlocalizedName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetadata(int meta){
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
|
EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack);
|
||||||
|
return rarity == null ? EnumRarity.common : rarity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,6 @@ public class BlockWallAA extends BlockWall implements IActAddItemOrBlock{
|
||||||
return this.baseBlock.getBlockTextureFromSide(side);
|
return this.baseBlock.getBlockTextureFromSide(side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName(){
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
|
||||||
return EnumRarity.common;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
@ -61,4 +51,14 @@ public class BlockWallAA extends BlockWall implements IActAddItemOrBlock{
|
||||||
public int damageDropped(int meta){
|
public int damageDropped(int meta){
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(){
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
|
return EnumRarity.common;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,12 @@ public class ModelBookletStand extends ModelBaseAA{
|
||||||
setRotation(book4, -0.837758F, 0F, 0F);
|
setRotation(book4, -0.837758F, 0F, 0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setRotation(ModelRenderer model, float x, float y, float z){
|
||||||
|
model.rotateAngleX = x;
|
||||||
|
model.rotateAngleY = y;
|
||||||
|
model.rotateAngleZ = z;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float f){
|
public void render(float f){
|
||||||
body1.render(f);
|
body1.render(f);
|
||||||
|
@ -106,10 +112,4 @@ public class ModelBookletStand extends ModelBaseAA{
|
||||||
public boolean doesRotate(){
|
public boolean doesRotate(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setRotation(ModelRenderer model, float x, float y, float z){
|
|
||||||
model.rotateAngleX = x;
|
|
||||||
model.rotateAngleY = y;
|
|
||||||
model.rotateAngleZ = z;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,15 @@ public class BookletUtils{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to open a URL in the Browser
|
* Tries to open a URL in the Browser
|
||||||
* @param url The URL
|
*/
|
||||||
|
public static void openBrowser(String url){
|
||||||
|
openBrowser(url, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to open a URL in the Browser
|
||||||
|
*
|
||||||
|
* @param url The URL
|
||||||
* @param shiftUrl The URL to open when Shift is held
|
* @param shiftUrl The URL to open when Shift is held
|
||||||
*/
|
*/
|
||||||
public static void openBrowser(String url, String shiftUrl){
|
public static void openBrowser(String url, String shiftUrl){
|
||||||
|
@ -56,13 +64,6 @@ public class BookletUtils{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tries to open a URL in the Browser
|
|
||||||
*/
|
|
||||||
public static void openBrowser(String url){
|
|
||||||
openBrowser(url, url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the Title of the current chapter, current index entry or just "Actually Additions" if neither is present
|
* Draws the Title of the current chapter, current index entry or just "Actually Additions" if neither is present
|
||||||
*/
|
*/
|
||||||
|
@ -78,6 +79,7 @@ public class BookletUtils{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws an Achievement Info if the page has items that trigger achievements
|
* Draws an Achievement Info if the page has items that trigger achievements
|
||||||
|
*
|
||||||
* @param pre If the hover info texts or the icon should be drawn
|
* @param pre If the hover info texts or the icon should be drawn
|
||||||
*/
|
*/
|
||||||
public static void drawAchievementInfo(GuiBooklet booklet, boolean pre, int mouseX, int mouseY){
|
public static void drawAchievementInfo(GuiBooklet booklet, boolean pre, int mouseX, int mouseY){
|
||||||
|
@ -215,135 +217,9 @@ public class BookletUtils{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when one of the buttons to open an index or a chapter is pressed
|
|
||||||
*/
|
|
||||||
public static void handleChapterButtonClick(GuiBooklet booklet, GuiButton button){
|
|
||||||
int place = Util.arrayContains(booklet.chapterButtons, button);
|
|
||||||
if(place >= 0){
|
|
||||||
if(booklet.currentIndexEntry != null){
|
|
||||||
if(booklet.currentChapter == null){
|
|
||||||
if(place < booklet.currentIndexEntry.chapters.size()){
|
|
||||||
BookletChapter chap = booklet.currentIndexEntry.chapters.get(place+(booklet.chapterButtons.length*booklet.pageOpenInIndex-booklet.chapterButtons.length));
|
|
||||||
openChapter(booklet, chap, chap.pages[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(place < InitBooklet.entries.size()){
|
|
||||||
openIndexEntry(booklet, InitBooklet.entries.get(place), 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the "next page"-button is pressed
|
|
||||||
*/
|
|
||||||
public static void handleNextPage(GuiBooklet booklet){
|
|
||||||
if(booklet.currentIndexEntry != null){
|
|
||||||
if(booklet.currentPage != null){
|
|
||||||
BookletPage page = getNextPage(booklet.currentChapter, booklet.currentPage);
|
|
||||||
if(page != null){
|
|
||||||
booklet.currentPage = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
booklet.buttonForward.visible = getNextPage(booklet.currentChapter, booklet.currentPage) != null;
|
|
||||||
booklet.buttonBackward.visible = getPrevPage(booklet.currentChapter, booklet.currentPage) != null;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
openIndexEntry(booklet, booklet.currentIndexEntry, booklet.pageOpenInIndex+1, !(booklet.currentIndexEntry instanceof BookletEntryAllSearch));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the "previous page"-button is pressed
|
|
||||||
*/
|
|
||||||
public static void handlePreviousPage(GuiBooklet booklet){
|
|
||||||
if(booklet.currentIndexEntry != null){
|
|
||||||
if(booklet.currentPage != null){
|
|
||||||
BookletPage page = getPrevPage(booklet.currentChapter, booklet.currentPage);
|
|
||||||
if(page != null){
|
|
||||||
booklet.currentPage = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
booklet.buttonForward.visible = getNextPage(booklet.currentChapter, booklet.currentPage) != null;
|
|
||||||
booklet.buttonBackward.visible = getPrevPage(booklet.currentChapter, booklet.currentPage) != null;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
openIndexEntry(booklet, booklet.currentIndexEntry, booklet.pageOpenInIndex-1, !(booklet.currentIndexEntry instanceof BookletEntryAllSearch));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the next available page in the booklet (or null if there is none)
|
|
||||||
*/
|
|
||||||
private static BookletPage getNextPage(BookletChapter chapter, BookletPage currentPage){
|
|
||||||
for(int i = 0; i < chapter.pages.length; i++){
|
|
||||||
if(chapter.pages[i] == currentPage){
|
|
||||||
if(i+1 < chapter.pages.length){
|
|
||||||
return chapter.pages[i+1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the previous available page in the booklet (or null if there is none)
|
|
||||||
*/
|
|
||||||
private static BookletPage getPrevPage(BookletChapter chapter, BookletPage currentPage){
|
|
||||||
for(int i = 0; i < chapter.pages.length; i++){
|
|
||||||
if(chapter.pages[i] == currentPage){
|
|
||||||
if(i-1 >= 0){
|
|
||||||
return chapter.pages[i-1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Opens a chapter in the booklet.
|
|
||||||
* Can only be done when the chapter is not null and an index entry is opened in the booklet
|
|
||||||
*/
|
|
||||||
public static void openChapter(GuiBooklet booklet, BookletChapter chapter, BookletPage page){
|
|
||||||
if(chapter == null || booklet.currentIndexEntry == null){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
booklet.searchField.setVisible(false);
|
|
||||||
booklet.searchField.setFocused(false);
|
|
||||||
booklet.searchField.setText("");
|
|
||||||
|
|
||||||
booklet.currentChapter = chapter;
|
|
||||||
booklet.currentPage = page != null && doesChapterHavePage(chapter, page) ? page : chapter.pages[0];
|
|
||||||
|
|
||||||
booklet.buttonForward.visible = getNextPage(chapter, booklet.currentPage) != null;
|
|
||||||
booklet.buttonBackward.visible = getPrevPage(chapter, booklet.currentPage) != null;
|
|
||||||
booklet.buttonPreviousScreen.visible = true;
|
|
||||||
|
|
||||||
for(GuiButton chapterButton : booklet.chapterButtons){
|
|
||||||
chapterButton.visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a chapter has a certain page
|
|
||||||
*/
|
|
||||||
private static boolean doesChapterHavePage(BookletChapter chapter, BookletPage page){
|
|
||||||
for(BookletPage aPage : chapter.pages){
|
|
||||||
if(aPage == page){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens an index entry in the booklet.
|
* Opens an index entry in the booklet.
|
||||||
|
*
|
||||||
* @param resetTextField will clear the text in the searchField and reset the search entry's data
|
* @param resetTextField will clear the text in the searchField and reset the search entry's data
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -390,6 +266,148 @@ public class BookletUtils{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when one of the buttons to open an index or a chapter is pressed
|
||||||
|
*/
|
||||||
|
public static void handleChapterButtonClick(GuiBooklet booklet, GuiButton button){
|
||||||
|
int place = Util.arrayContains(booklet.chapterButtons, button);
|
||||||
|
if(place >= 0){
|
||||||
|
if(booklet.currentIndexEntry != null){
|
||||||
|
if(booklet.currentChapter == null){
|
||||||
|
if(place < booklet.currentIndexEntry.chapters.size()){
|
||||||
|
BookletChapter chap = booklet.currentIndexEntry.chapters.get(place+(booklet.chapterButtons.length*booklet.pageOpenInIndex-booklet.chapterButtons.length));
|
||||||
|
openChapter(booklet, chap, chap.pages[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(place < InitBooklet.entries.size()){
|
||||||
|
openIndexEntry(booklet, InitBooklet.entries.get(place), 1, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens a chapter in the booklet.
|
||||||
|
* Can only be done when the chapter is not null and an index entry is opened in the booklet
|
||||||
|
*/
|
||||||
|
public static void openChapter(GuiBooklet booklet, BookletChapter chapter, BookletPage page){
|
||||||
|
if(chapter == null || booklet.currentIndexEntry == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
booklet.searchField.setVisible(false);
|
||||||
|
booklet.searchField.setFocused(false);
|
||||||
|
booklet.searchField.setText("");
|
||||||
|
|
||||||
|
booklet.currentChapter = chapter;
|
||||||
|
booklet.currentPage = page != null && doesChapterHavePage(chapter, page) ? page : chapter.pages[0];
|
||||||
|
|
||||||
|
booklet.buttonForward.visible = getNextPage(chapter, booklet.currentPage) != null;
|
||||||
|
booklet.buttonBackward.visible = getPrevPage(chapter, booklet.currentPage) != null;
|
||||||
|
booklet.buttonPreviousScreen.visible = true;
|
||||||
|
|
||||||
|
for(GuiButton chapterButton : booklet.chapterButtons){
|
||||||
|
chapterButton.visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a chapter has a certain page
|
||||||
|
*/
|
||||||
|
private static boolean doesChapterHavePage(BookletChapter chapter, BookletPage page){
|
||||||
|
for(BookletPage aPage : chapter.pages){
|
||||||
|
if(aPage == page){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next available page in the booklet (or null if there is none)
|
||||||
|
*/
|
||||||
|
private static BookletPage getNextPage(BookletChapter chapter, BookletPage currentPage){
|
||||||
|
for(int i = 0; i < chapter.pages.length; i++){
|
||||||
|
if(chapter.pages[i] == currentPage){
|
||||||
|
if(i+1 < chapter.pages.length){
|
||||||
|
return chapter.pages[i+1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the previous available page in the booklet (or null if there is none)
|
||||||
|
*/
|
||||||
|
private static BookletPage getPrevPage(BookletChapter chapter, BookletPage currentPage){
|
||||||
|
for(int i = 0; i < chapter.pages.length; i++){
|
||||||
|
if(chapter.pages[i] == currentPage){
|
||||||
|
if(i-1 >= 0){
|
||||||
|
return chapter.pages[i-1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the "next page"-button is pressed
|
||||||
|
*/
|
||||||
|
public static void handleNextPage(GuiBooklet booklet){
|
||||||
|
if(booklet.currentIndexEntry != null){
|
||||||
|
if(booklet.currentPage != null){
|
||||||
|
BookletPage page = getNextPage(booklet.currentChapter, booklet.currentPage);
|
||||||
|
if(page != null){
|
||||||
|
booklet.currentPage = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
booklet.buttonForward.visible = getNextPage(booklet.currentChapter, booklet.currentPage) != null;
|
||||||
|
booklet.buttonBackward.visible = getPrevPage(booklet.currentChapter, booklet.currentPage) != null;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
openIndexEntry(booklet, booklet.currentIndexEntry, booklet.pageOpenInIndex+1, !(booklet.currentIndexEntry instanceof BookletEntryAllSearch));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the "previous page"-button is pressed
|
||||||
|
*/
|
||||||
|
public static void handlePreviousPage(GuiBooklet booklet){
|
||||||
|
if(booklet.currentIndexEntry != null){
|
||||||
|
if(booklet.currentPage != null){
|
||||||
|
BookletPage page = getPrevPage(booklet.currentChapter, booklet.currentPage);
|
||||||
|
if(page != null){
|
||||||
|
booklet.currentPage = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
booklet.buttonForward.visible = getNextPage(booklet.currentChapter, booklet.currentPage) != null;
|
||||||
|
booklet.buttonBackward.visible = getPrevPage(booklet.currentChapter, booklet.currentPage) != null;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
openIndexEntry(booklet, booklet.currentIndexEntry, booklet.pageOpenInIndex-1, !(booklet.currentIndexEntry instanceof BookletEntryAllSearch));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BookletPage getFirstPageForStack(ItemStack stack){
|
||||||
|
ArrayList<BookletPage> pages = getPagesForStack(stack);
|
||||||
|
return pages.isEmpty() ? null : pages.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<BookletPage> getPagesForStack(ItemStack stack){
|
||||||
|
ArrayList<BookletPage> possiblePages = new ArrayList<BookletPage>();
|
||||||
|
for(BookletPage page : InitBooklet.pagesWithItemStackData){
|
||||||
|
if(ItemUtil.contains(page.getItemStacksForPage(), stack, true)){
|
||||||
|
possiblePages.add(page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return possiblePages;
|
||||||
|
}
|
||||||
|
|
||||||
public static class IndexButton extends GuiButton{
|
public static class IndexButton extends GuiButton{
|
||||||
|
|
||||||
public BookletChapter chap;
|
public BookletChapter chap;
|
||||||
|
@ -431,21 +449,6 @@ public class BookletUtils{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<BookletPage> getPagesForStack(ItemStack stack){
|
|
||||||
ArrayList<BookletPage> possiblePages = new ArrayList<BookletPage>();
|
|
||||||
for(BookletPage page : InitBooklet.pagesWithItemStackData){
|
|
||||||
if(ItemUtil.contains(page.getItemStacksForPage(), stack, true)){
|
|
||||||
possiblePages.add(page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return possiblePages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BookletPage getFirstPageForStack(ItemStack stack){
|
|
||||||
ArrayList<BookletPage> pages = getPagesForStack(stack);
|
|
||||||
return pages.isEmpty() ? null : pages.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TexturedButton extends GuiButton{
|
public static class TexturedButton extends GuiButton{
|
||||||
|
|
||||||
public int texturePosX;
|
public int texturePosX;
|
||||||
|
@ -495,7 +498,28 @@ public class BookletUtils{
|
||||||
this.booklet = booklet;
|
this.booklet = booklet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void onPressed(){
|
||||||
|
if(this.assignedEntry != null){
|
||||||
|
if(KeyUtil.isShiftPressed()){
|
||||||
|
this.assignedEntry = null;
|
||||||
|
this.assignedChapter = null;
|
||||||
|
this.assignedPage = null;
|
||||||
|
this.assignedPageInIndex = 1;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
openIndexEntry(this.booklet, this.assignedEntry, this.assignedPageInIndex, true);
|
||||||
|
openChapter(this.booklet, this.assignedChapter, this.assignedPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(this.booklet.currentIndexEntry != null){
|
||||||
|
this.assignedEntry = this.booklet.currentIndexEntry;
|
||||||
|
this.assignedChapter = this.booklet.currentChapter;
|
||||||
|
this.assignedPage = this.booklet.currentPage;
|
||||||
|
this.assignedPageInIndex = this.booklet.pageOpenInIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} @Override
|
||||||
public void drawButton(Minecraft minecraft, int x, int y){
|
public void drawButton(Minecraft minecraft, int x, int y){
|
||||||
if(this.visible){
|
if(this.visible){
|
||||||
minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc);
|
minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc);
|
||||||
|
@ -520,29 +544,6 @@ public class BookletUtils{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPressed(){
|
|
||||||
if(this.assignedEntry != null){
|
|
||||||
if(KeyUtil.isShiftPressed()){
|
|
||||||
this.assignedEntry = null;
|
|
||||||
this.assignedChapter = null;
|
|
||||||
this.assignedPage = null;
|
|
||||||
this.assignedPageInIndex = 1;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
openIndexEntry(this.booklet, this.assignedEntry, this.assignedPageInIndex, true);
|
|
||||||
openChapter(this.booklet, this.assignedChapter, this.assignedPage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(this.booklet.currentIndexEntry != null){
|
|
||||||
this.assignedEntry = this.booklet.currentIndexEntry;
|
|
||||||
this.assignedChapter = this.booklet.currentChapter;
|
|
||||||
this.assignedPage = this.booklet.currentPage;
|
|
||||||
this.assignedPageInIndex = this.booklet.pageOpenInIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void drawHover(int mouseX, int mouseY){
|
public void drawHover(int mouseX, int mouseY){
|
||||||
ArrayList list = new ArrayList();
|
ArrayList list = new ArrayList();
|
||||||
|
@ -562,5 +563,7 @@ public class BookletUtils{
|
||||||
}
|
}
|
||||||
this.booklet.drawHoveringText(list, mouseX, mouseY);
|
this.booklet.drawHoveringText(list, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,11 +67,9 @@ public class GuiBooklet extends GuiScreen{
|
||||||
public GuiButton[] bookmarkButtons = new GuiButton[8];
|
public GuiButton[] bookmarkButtons = new GuiButton[8];
|
||||||
|
|
||||||
public GuiTextField searchField;
|
public GuiTextField searchField;
|
||||||
|
public GuiScreen parentScreen;
|
||||||
private int ticksElapsed;
|
private int ticksElapsed;
|
||||||
private boolean mousePressed;
|
private boolean mousePressed;
|
||||||
|
|
||||||
public GuiScreen parentScreen;
|
|
||||||
private boolean tryOpenMainPage;
|
private boolean tryOpenMainPage;
|
||||||
private boolean saveOnClose;
|
private boolean saveOnClose;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,14 @@ public class GuiBookletStand extends GuiBooklet{
|
||||||
this.theStand = (TileEntityBookletStand)theStand;
|
this.theStand = (TileEntityBookletStand)theStand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(GuiButton button){
|
||||||
|
if(button == this.buttonSetPage){
|
||||||
|
PacketHandler.theNetwork.sendToServer(new PacketBookletStandButton(this.theStand.xCoord, this.theStand.yCoord, this.theStand.zCoord, this.theStand.getWorldObj(), Minecraft.getMinecraft().thePlayer, this.currentIndexEntry, this.currentChapter, this.currentPage, this.pageOpenInIndex));
|
||||||
|
}
|
||||||
|
super.actionPerformed(button);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void initGui(){
|
public void initGui(){
|
||||||
|
@ -60,12 +68,4 @@ public class GuiBookletStand extends GuiBooklet{
|
||||||
BookletUtils.openIndexEntry(this, this.theStand.assignedEntry, this.theStand.assignedPageInIndex, true);
|
BookletUtils.openIndexEntry(this, this.theStand.assignedEntry, this.theStand.assignedPageInIndex, true);
|
||||||
BookletUtils.openChapter(this, this.theStand.assignedChapter, this.theStand.assignedPage);
|
BookletUtils.openChapter(this, this.theStand.assignedChapter, this.theStand.assignedPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(GuiButton button){
|
|
||||||
if(button == this.buttonSetPage){
|
|
||||||
PacketHandler.theNetwork.sendToServer(new PacketBookletStandButton(this.theStand.xCoord, this.theStand.yCoord, this.theStand.zCoord, this.theStand.getWorldObj(), Minecraft.getMinecraft().thePlayer, this.currentIndexEntry, this.currentChapter, this.currentPage, this.pageOpenInIndex));
|
|
||||||
}
|
|
||||||
super.actionPerformed(button);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -53,6 +53,11 @@ public class InitBooklet{
|
||||||
public static BookletEntry entryMisc = new BookletEntry("misc");
|
public static BookletEntry entryMisc = new BookletEntry("misc");
|
||||||
public static BookletEntry allAndSearch = new BookletEntryAllSearch("allAndSearch").setSpecial();
|
public static BookletEntry allAndSearch = new BookletEntryAllSearch("allAndSearch").setSpecial();
|
||||||
|
|
||||||
|
public static void init(){
|
||||||
|
initChapters();
|
||||||
|
countWords();
|
||||||
|
}
|
||||||
|
|
||||||
private static void initChapters(){
|
private static void initChapters(){
|
||||||
//Getting Started
|
//Getting Started
|
||||||
chapterIntro = new BookletChapter("intro", entryGettingStarted, new ItemStack(InitItems.itemLexicon), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
|
chapterIntro = new BookletChapter("intro", entryGettingStarted, new ItemStack(InitItems.itemLexicon), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
|
||||||
|
@ -139,11 +144,6 @@ public class InitBooklet{
|
||||||
new BookletChapter("batteries", entryItemsRF, new ItemStack(InitItems.itemBatteryTriple), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBattery).setNoText(), new PageCrafting(3, ItemCrafting.recipeBatteryDouble).setNoText(), new PageCrafting(4, ItemCrafting.recipeBatteryTriple).setNoText(), new PageCrafting(5, ItemCrafting.recipeBatteryQuadruple).setNoText(), new PageCrafting(6, ItemCrafting.recipeBatteryQuintuple).setNoText());
|
new BookletChapter("batteries", entryItemsRF, new ItemStack(InitItems.itemBatteryTriple), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBattery).setNoText(), new PageCrafting(3, ItemCrafting.recipeBatteryDouble).setNoText(), new PageCrafting(4, ItemCrafting.recipeBatteryTriple).setNoText(), new PageCrafting(5, ItemCrafting.recipeBatteryQuadruple).setNoText(), new PageCrafting(6, ItemCrafting.recipeBatteryQuintuple).setNoText());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init(){
|
|
||||||
initChapters();
|
|
||||||
countWords();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void countWords(){
|
private static void countWords(){
|
||||||
for(BookletEntry entry : entries){
|
for(BookletEntry entry : entries){
|
||||||
for(BookletChapter chapter : entry.chapters){
|
for(BookletChapter chapter : entry.chapters){
|
||||||
|
|
|
@ -35,31 +35,16 @@ import java.util.Map;
|
||||||
|
|
||||||
public class BookletPage{
|
public class BookletPage{
|
||||||
|
|
||||||
|
public boolean arePageStacksWildcard;
|
||||||
protected int id;
|
protected int id;
|
||||||
protected BookletChapter chapter;
|
protected BookletChapter chapter;
|
||||||
private HashMap<String, String> textReplacements = new HashMap<String, String>();
|
private HashMap<String, String> textReplacements = new HashMap<String, String>();
|
||||||
private boolean hasNoText;
|
private boolean hasNoText;
|
||||||
public boolean arePageStacksWildcard;
|
|
||||||
|
|
||||||
public BookletPage(int id){
|
public BookletPage(int id){
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToPagesWithItemStackData(){
|
|
||||||
if(!InitBooklet.pagesWithItemStackData.contains(this)){
|
|
||||||
ItemStack[] stacks = this.getItemStacksForPage();
|
|
||||||
if(stacks != null && stacks.length > 0){
|
|
||||||
//Ensure that there is at least one ItemStack
|
|
||||||
for(ItemStack stack : stacks){
|
|
||||||
if(stack != null){
|
|
||||||
InitBooklet.pagesWithItemStackData.add(this);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public static void renderItem(GuiScreen gui, ItemStack stack, int x, int y, float scale){
|
public static void renderItem(GuiScreen gui, ItemStack stack, int x, int y, float scale){
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
@ -85,6 +70,25 @@ public class BookletPage{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addToPagesWithItemStackData(){
|
||||||
|
if(!InitBooklet.pagesWithItemStackData.contains(this)){
|
||||||
|
ItemStack[] stacks = this.getItemStacksForPage();
|
||||||
|
if(stacks != null && stacks.length > 0){
|
||||||
|
//Ensure that there is at least one ItemStack
|
||||||
|
for(ItemStack stack : stacks){
|
||||||
|
if(stack != null){
|
||||||
|
InitBooklet.pagesWithItemStackData.add(this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack[] getItemStacksForPage(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public BookletPage setNoText(){
|
public BookletPage setNoText(){
|
||||||
this.hasNoText = true;
|
this.hasNoText = true;
|
||||||
return this;
|
return this;
|
||||||
|
@ -166,10 +170,6 @@ public class BookletPage{
|
||||||
gui.mc.fontRenderer.setUnicodeFlag(flagBefore);
|
gui.mc.fontRenderer.setUnicodeFlag(flagBefore);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack[] getItemStacksForPage(){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BookletChapter getChapter(){
|
public BookletChapter getChapter(){
|
||||||
return this.chapter;
|
return this.chapter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,28 @@ public class PageCrafting extends BookletPage{
|
||||||
this.addToPagesWithItemStackData();
|
this.addToPagesWithItemStackData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getItemStacksForPage(){
|
||||||
|
if(this.recipes != null){
|
||||||
|
ItemStack[] stacks = new ItemStack[this.recipes.length];
|
||||||
|
for(int i = 0; i < this.recipes.length; i++){
|
||||||
|
ItemStack output = this.recipes[i].getRecipeOutput();
|
||||||
|
if(output != null){
|
||||||
|
if(!this.arePageStacksWildcard){
|
||||||
|
stacks[i] = output;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ItemStack wildcardOutput = output.copy();
|
||||||
|
wildcardOutput.setItemDamage(Util.WILDCARD);
|
||||||
|
stacks[i] = wildcardOutput;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stacks;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
|
@ -154,26 +176,4 @@ public class PageCrafting extends BookletPage{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack[] getItemStacksForPage(){
|
|
||||||
if(this.recipes != null){
|
|
||||||
ItemStack[] stacks = new ItemStack[this.recipes.length];
|
|
||||||
for(int i = 0; i < this.recipes.length; i++){
|
|
||||||
ItemStack output = this.recipes[i].getRecipeOutput();
|
|
||||||
if(output != null){
|
|
||||||
if(!this.arePageStacksWildcard){
|
|
||||||
stacks[i] = output;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
ItemStack wildcardOutput = output.copy();
|
|
||||||
wildcardOutput.setItemDamage(Util.WILDCARD);
|
|
||||||
stacks[i] = wildcardOutput;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return stacks;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,11 @@ public class PageCrusherRecipe extends BookletPage{
|
||||||
this.addToPagesWithItemStackData();
|
this.addToPagesWithItemStackData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getItemStacksForPage(){
|
||||||
|
return this.recipe == null ? new ItemStack[0] : this.recipe.getRecipeOutputOnes().toArray(new ItemStack[this.recipe.getRecipeOutputOnes().size()]);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
|
@ -121,9 +126,4 @@ public class PageCrusherRecipe extends BookletPage{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack[] getItemStacksForPage(){
|
|
||||||
return this.recipe == null ? new ItemStack[0] : this.recipe.getRecipeOutputOnes().toArray(new ItemStack[this.recipe.getRecipeOutputOnes().size()]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,11 @@ public class PageFurnace extends BookletPage{
|
||||||
this.addToPagesWithItemStackData();
|
this.addToPagesWithItemStackData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getItemStacksForPage(){
|
||||||
|
return this.result == null ? new ItemStack[0] : new ItemStack[]{this.result};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
|
@ -90,11 +95,6 @@ public class PageFurnace extends BookletPage{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack[] getItemStacksForPage(){
|
|
||||||
return this.result == null ? new ItemStack[0] : new ItemStack[]{this.result};
|
|
||||||
}
|
|
||||||
|
|
||||||
private ItemStack getInputForOutput(ItemStack output){
|
private ItemStack getInputForOutput(ItemStack output){
|
||||||
for(Object o : FurnaceRecipes.smelting().getSmeltingList().entrySet()){
|
for(Object o : FurnaceRecipes.smelting().getSmeltingList().entrySet()){
|
||||||
ItemStack stack = (ItemStack)((Map.Entry)o).getValue();
|
ItemStack stack = (ItemStack)((Map.Entry)o).getValue();
|
||||||
|
|
|
@ -31,27 +31,28 @@ public class PageReconstructor extends BookletPage{
|
||||||
private ReconstructorRecipeHandler.Recipe[] recipes;
|
private ReconstructorRecipeHandler.Recipe[] recipes;
|
||||||
private int recipePos;
|
private int recipePos;
|
||||||
|
|
||||||
|
public PageReconstructor(int id, ArrayList<ReconstructorRecipeHandler.Recipe> recipes){
|
||||||
|
this(id, recipes.toArray(new ReconstructorRecipeHandler.Recipe[recipes.size()]));
|
||||||
|
}
|
||||||
|
|
||||||
public PageReconstructor(int id, ReconstructorRecipeHandler.Recipe... recipes){
|
public PageReconstructor(int id, ReconstructorRecipeHandler.Recipe... recipes){
|
||||||
super(id);
|
super(id);
|
||||||
this.recipes = recipes;
|
this.recipes = recipes;
|
||||||
this.addToPagesWithItemStackData();
|
this.addToPagesWithItemStackData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageReconstructor(int id, ArrayList<ReconstructorRecipeHandler.Recipe> recipes){
|
|
||||||
this(id, recipes.toArray(new ReconstructorRecipeHandler.Recipe[recipes.size()]));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public ItemStack[] getItemStacksForPage(){
|
||||||
public void updateScreen(int ticksElapsed){
|
if(this.recipes != null){
|
||||||
if(ticksElapsed%15 == 0){
|
ItemStack[] stacks = new ItemStack[this.recipes.length];
|
||||||
if(this.recipePos+1 >= this.recipes.length){
|
for(int i = 0; i < this.recipes.length; i++){
|
||||||
this.recipePos = 0;
|
if(this.recipes[i] != null){
|
||||||
}
|
stacks[i] = this.recipes[i].getFirstOutput();
|
||||||
else{
|
}
|
||||||
this.recipePos++;
|
|
||||||
}
|
}
|
||||||
|
return stacks;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -112,17 +113,16 @@ public class PageReconstructor extends BookletPage{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack[] getItemStacksForPage(){
|
@SideOnly(Side.CLIENT)
|
||||||
if(this.recipes != null){
|
public void updateScreen(int ticksElapsed){
|
||||||
ItemStack[] stacks = new ItemStack[this.recipes.length];
|
if(ticksElapsed%15 == 0){
|
||||||
for(int i = 0; i < this.recipes.length; i++){
|
if(this.recipePos+1 >= this.recipes.length){
|
||||||
if(this.recipes[i] != null){
|
this.recipePos = 0;
|
||||||
stacks[i] = this.recipes[i].getFirstOutput();
|
}
|
||||||
}
|
else{
|
||||||
|
this.recipePos++;
|
||||||
}
|
}
|
||||||
return stacks;
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getInputForRecipe(ReconstructorRecipeHandler.Recipe recipe){
|
private ItemStack getInputForRecipe(ReconstructorRecipeHandler.Recipe recipe){
|
||||||
|
|
|
@ -29,6 +29,11 @@ public class PageTextOnly extends BookletPage{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getItemStacksForPage(){
|
||||||
|
return this.stack == null ? new ItemStack[0] : new ItemStack[]{this.stack};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
|
@ -37,9 +42,4 @@ public class PageTextOnly extends BookletPage{
|
||||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+9, 115, 0);
|
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+9, 115, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack[] getItemStacksForPage(){
|
|
||||||
return this.stack == null ? new ItemStack[0] : new ItemStack[]{this.stack};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class ItemCrafting{
|
||||||
'B', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())));
|
'B', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())));
|
||||||
recipeLens = Util.GetRecipes.lastIRecipe();
|
recipeLens = Util.GetRecipes.lastIRecipe();
|
||||||
|
|
||||||
//Black Dye
|
//Black Dye
|
||||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.BLACK_DYE.ordinal()), new ItemStack(InitBlocks.blockBlackLotus)));
|
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.BLACK_DYE.ordinal()), new ItemStack(InitBlocks.blockBlackLotus)));
|
||||||
recipeBlackDye = Util.GetRecipes.lastIRecipe();
|
recipeBlackDye = Util.GetRecipes.lastIRecipe();
|
||||||
|
|
||||||
|
|
|
@ -46,16 +46,6 @@ public class PlayerObtainEvents{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){
|
|
||||||
checkAchievements(event.smelting, event.player, InitAchievements.SMELTING_ACH);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onPickupEvent(PlayerEvent.ItemPickupEvent event){
|
|
||||||
checkAchievements(event.pickedUp.getEntityItem(), event.player, InitAchievements.PICKUP_ACH);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void checkAchievements(ItemStack gotten, EntityPlayer player, int type){
|
public static void checkAchievements(ItemStack gotten, EntityPlayer player, int type){
|
||||||
for(int i = 0; i < TheAchievements.values().length; i++){
|
for(int i = 0; i < TheAchievements.values().length; i++){
|
||||||
TheAchievements ach = TheAchievements.values()[i];
|
TheAchievements ach = TheAchievements.values()[i];
|
||||||
|
@ -68,4 +58,14 @@ public class PlayerObtainEvents{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){
|
||||||
|
checkAchievements(event.smelting, event.player, InitAchievements.SMELTING_ACH);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onPickupEvent(PlayerEvent.ItemPickupEvent event){
|
||||||
|
checkAchievements(event.pickedUp.getEntityItem(), event.player, InitAchievements.PICKUP_ACH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,12 @@ public class ItemBooklet extends Item implements IActAddItemOrBlock{
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
|
||||||
|
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc"));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
return EnumRarity.epic;
|
return EnumRarity.epic;
|
||||||
|
@ -56,12 +62,6 @@ public class ItemBooklet extends Item implements IActAddItemOrBlock{
|
||||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
|
|
||||||
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(ItemStack stack, int pass){
|
public IIcon getIcon(ItemStack stack, int pass){
|
||||||
|
|
|
@ -35,6 +35,12 @@ public class ItemCrystal extends Item implements IActAddItemOrBlock{
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public IIcon getIconFromDamage(int par1){
|
||||||
|
return par1 >= this.textures.length ? null : this.textures[par1];
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetadata(int damage){
|
public int getMetadata(int damage){
|
||||||
return damage;
|
return damage;
|
||||||
|
@ -45,12 +51,6 @@ public class ItemCrystal extends Item implements IActAddItemOrBlock{
|
||||||
return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+BlockCrystal.allCrystals[stack.getItemDamage()].name;
|
return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+BlockCrystal.allCrystals[stack.getItemDamage()].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIconFromDamage(int par1){
|
|
||||||
return par1 >= this.textures.length ? null : this.textures[par1];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? EnumRarity.common : BlockCrystal.allCrystals[stack.getItemDamage()].rarity;
|
return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? EnumRarity.common : BlockCrystal.allCrystals[stack.getItemDamage()].rarity;
|
||||||
|
|
|
@ -51,11 +51,10 @@ import java.util.Set;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class ItemDrill extends ItemEnergy{
|
public class ItemDrill extends ItemEnergy{
|
||||||
|
|
||||||
|
private static final int ENERGY_USE = 100;
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon[] allDemDamnIconsMaan;
|
private IIcon[] allDemDamnIconsMaan;
|
||||||
|
|
||||||
private static final int ENERGY_USE = 100;
|
|
||||||
|
|
||||||
public ItemDrill(){
|
public ItemDrill(){
|
||||||
super(500000, 5000);
|
super(500000, 5000);
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
|
@ -68,30 +67,6 @@ public class ItemDrill extends ItemEnergy{
|
||||||
return par1 >= this.allDemDamnIconsMaan.length ? null : this.allDemDamnIconsMaan[par1];
|
return par1 >= this.allDemDamnIconsMaan.length ? null : this.allDemDamnIconsMaan[par1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetadata(int damage){
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubItems(Item item, CreativeTabs tabs, List list){
|
|
||||||
for(int i = 0; i < this.allDemDamnIconsMaan.length; i++){
|
|
||||||
this.addDrillStack(list, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addDrillStack(List list, int meta){
|
|
||||||
ItemStack stackFull = new ItemStack(this, 1, meta);
|
|
||||||
this.setEnergy(stackFull, this.getMaxEnergyStored(stackFull));
|
|
||||||
list.add(stackFull);
|
|
||||||
|
|
||||||
ItemStack stackEmpty = new ItemStack(this, 1, meta);
|
|
||||||
this.setEnergy(stackEmpty, 0);
|
|
||||||
list.add(stackEmpty);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
//Places Blocks if the Placing Upgrade is installed
|
//Places Blocks if the Placing Upgrade is installed
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int hitSide, float hitX, float hitY, float hitZ){
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int hitSide, float hitX, float hitY, float hitZ){
|
||||||
|
@ -192,6 +167,11 @@ public class ItemDrill extends ItemEnergy{
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetadata(int damage){
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hitEntity(ItemStack stack, EntityLivingBase entity1, EntityLivingBase entity2){
|
public boolean hitEntity(ItemStack stack, EntityLivingBase entity1, EntityLivingBase entity2){
|
||||||
int use = this.getEnergyUsePerBlock(stack);
|
int use = this.getEnergyUsePerBlock(stack);
|
||||||
|
@ -363,6 +343,25 @@ public class ItemDrill extends ItemEnergy{
|
||||||
return this.getHasUpgradeAsStack(stack, upgrade) != null;
|
return this.getHasUpgradeAsStack(stack, upgrade) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubItems(Item item, CreativeTabs tabs, List list){
|
||||||
|
for(int i = 0; i < this.allDemDamnIconsMaan.length; i++){
|
||||||
|
this.addDrillStack(list, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addDrillStack(List list, int meta){
|
||||||
|
ItemStack stackFull = new ItemStack(this, 1, meta);
|
||||||
|
this.setEnergy(stackFull, this.getMaxEnergyStored(stackFull));
|
||||||
|
list.add(stackFull);
|
||||||
|
|
||||||
|
ItemStack stackEmpty = new ItemStack(this, 1, meta);
|
||||||
|
this.setEnergy(stackEmpty, 0);
|
||||||
|
list.add(stackEmpty);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Mining Speed of the Drill
|
* Gets the Mining Speed of the Drill
|
||||||
*
|
*
|
||||||
|
|
|
@ -32,20 +32,6 @@ public class SpecialRenderInit{
|
||||||
Util.registerEvent(new SpecialRenderInit());
|
Util.registerEvent(new SpecialRenderInit());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
|
||||||
public void onPlayerRender(RenderPlayerEvent.Specials.Pre event){
|
|
||||||
if(!specialList.isEmpty()){
|
|
||||||
for(Map.Entry<String, RenderSpecial> entry : specialList.entrySet()){
|
|
||||||
//Does the player have one of the names from the list?
|
|
||||||
if(StringUtil.equalsToLowerCase(entry.getKey(), event.entityPlayer.getCommandSenderName())){
|
|
||||||
//Render the special Item/Block
|
|
||||||
entry.getValue().render(event.entityPlayer);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void parse(Properties properties){
|
public static void parse(Properties properties){
|
||||||
for(String key : properties.stringPropertyNames()){
|
for(String key : properties.stringPropertyNames()){
|
||||||
String[] values = properties.getProperty(key).split("@");
|
String[] values = properties.getProperty(key).split("@");
|
||||||
|
@ -79,4 +65,18 @@ public class SpecialRenderInit{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
|
public void onPlayerRender(RenderPlayerEvent.Specials.Pre event){
|
||||||
|
if(!specialList.isEmpty()){
|
||||||
|
for(Map.Entry<String, RenderSpecial> entry : specialList.entrySet()){
|
||||||
|
//Does the player have one of the names from the list?
|
||||||
|
if(StringUtil.equalsToLowerCase(entry.getKey(), event.entityPlayer.getCommandSenderName())){
|
||||||
|
//Render the special Item/Block
|
||||||
|
entry.getValue().render(event.entityPlayer);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class PacketBookletStandButton implements IMessage{
|
||||||
this.playerID = player.getEntityId();
|
this.playerID = player.getEntityId();
|
||||||
|
|
||||||
this.entryID = entry == null ? -1 : InitBooklet.entries.indexOf(entry);
|
this.entryID = entry == null ? -1 : InitBooklet.entries.indexOf(entry);
|
||||||
this.chapterID = entry == null || chapter == null ? -1 : entry.chapters.indexOf(chapter);
|
this.chapterID = entry == null || chapter == null ? -1 : entry.chapters.indexOf(chapter);
|
||||||
this.pageID = page == null ? -1 : page.getID();
|
this.pageID = page == null ? -1 : page.getID();
|
||||||
this.pageInIndex = pageInIndex;
|
this.pageInIndex = pageInIndex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,6 +136,60 @@ public class ReconstructorRecipeHandler{
|
||||||
return possibleRecipes;
|
return possibleRecipes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum LensType{
|
||||||
|
|
||||||
|
NONE(true),
|
||||||
|
COLOR(true),
|
||||||
|
DETONATION(false),
|
||||||
|
JUST_DAMAGE(false);
|
||||||
|
|
||||||
|
//Thanks to xdjackiexd for this, as I couldn't be bothered
|
||||||
|
private static final float[][] possibleColorLensColors = {
|
||||||
|
{158F, 43F, 39F}, //Red
|
||||||
|
{234F, 126F, 53F}, //Orange
|
||||||
|
{194F, 181F, 28F}, //Yellow
|
||||||
|
{57F, 186F, 46F}, //Lime Green
|
||||||
|
{54F, 75F, 24F}, //Green
|
||||||
|
{99F, 135F, 210F}, //Light Blue
|
||||||
|
{38F, 113F, 145F}, //Cyan
|
||||||
|
{37F, 49F, 147F}, //Blue
|
||||||
|
{126F, 52F, 191F}, //Purple
|
||||||
|
{190F, 73F, 201F}, //Magenta
|
||||||
|
{217F, 129F, 153F}, //Pink
|
||||||
|
{86F, 51F, 28F}, //Brown
|
||||||
|
};
|
||||||
|
public ItemStack lens;
|
||||||
|
public boolean hasRecipes;
|
||||||
|
|
||||||
|
LensType(boolean hasRecipes){
|
||||||
|
this.hasRecipes = hasRecipes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float[] getColor(){
|
||||||
|
if(this == COLOR){
|
||||||
|
float[] colors = possibleColorLensColors[Util.RANDOM.nextInt(possibleColorLensColors.length)];
|
||||||
|
return new float[]{colors[0]/255F, colors[1]/255F, colors[2]/255F};
|
||||||
|
}
|
||||||
|
else if(this == DETONATION){
|
||||||
|
return new float[]{158F/255F, 43F/255F, 39F/255F};
|
||||||
|
}
|
||||||
|
else if(this == JUST_DAMAGE){
|
||||||
|
return new float[]{188F/255F, 222F/255F, 1F};
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return new float[]{27F/255F, 109F/255F, 1F};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLens(Item lens){
|
||||||
|
this.lens = new ItemStack(lens);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDistance(){
|
||||||
|
return this == DETONATION ? 30 : (this == JUST_DAMAGE ? 15 : 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class Recipe{
|
public static class Recipe{
|
||||||
|
|
||||||
public String input;
|
public String input;
|
||||||
|
@ -161,57 +215,4 @@ public class ReconstructorRecipeHandler{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum LensType{
|
|
||||||
|
|
||||||
NONE(true),
|
|
||||||
COLOR(true),
|
|
||||||
DETONATION(false),
|
|
||||||
JUST_DAMAGE(false);
|
|
||||||
|
|
||||||
public ItemStack lens;
|
|
||||||
public boolean hasRecipes;
|
|
||||||
|
|
||||||
LensType(boolean hasRecipes){
|
|
||||||
this.hasRecipes = hasRecipes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float[] getColor(){
|
|
||||||
if(this == COLOR){
|
|
||||||
float[] colors = possibleColorLensColors[Util.RANDOM.nextInt(possibleColorLensColors.length)];
|
|
||||||
return new float[]{colors[0]/255F, colors[1]/255F, colors[2]/255F};
|
|
||||||
}
|
|
||||||
else if(this == DETONATION){
|
|
||||||
return new float[]{158F/255F, 43F/255F, 39F/255F};
|
|
||||||
}
|
|
||||||
else if(this == JUST_DAMAGE){
|
|
||||||
return new float[]{188F/255F, 222F/255F, 1F};
|
|
||||||
}
|
|
||||||
else return new float[]{27F/255F, 109F/255F, 1F};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLens(Item lens){
|
|
||||||
this.lens = new ItemStack(lens);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDistance(){
|
|
||||||
return this == DETONATION ? 30 : (this == JUST_DAMAGE ? 15 : 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Thanks to xdjackiexd for this, as I couldn't be bothered
|
|
||||||
private static final float[][] possibleColorLensColors = {
|
|
||||||
{158F, 43F, 39F}, //Red
|
|
||||||
{234F, 126F, 53F}, //Orange
|
|
||||||
{194F, 181F, 28F}, //Yellow
|
|
||||||
{57F, 186F, 46F}, //Lime Green
|
|
||||||
{54F, 75F, 24F}, //Green
|
|
||||||
{99F, 135F, 210F}, //Light Blue
|
|
||||||
{38F, 113F, 145F}, //Cyan
|
|
||||||
{37F, 49F, 147F}, //Blue
|
|
||||||
{126F, 52F, 191F}, //Purple
|
|
||||||
{190F, 73F, 201F}, //Magenta
|
|
||||||
{217F, 129F, 153F}, //Pink
|
|
||||||
{86F, 51F, 28F}, //Brown
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,9 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyReceiver{
|
public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||||
|
|
||||||
public EnergyStorage storage = new EnergyStorage(3000000);
|
|
||||||
|
|
||||||
private int currentTime;
|
|
||||||
|
|
||||||
public static final int ENERGY_USE = 200;
|
public static final int ENERGY_USE = 200;
|
||||||
|
public EnergyStorage storage = new EnergyStorage(3000000);
|
||||||
|
private int currentTime;
|
||||||
|
|
||||||
public TileEntityAtomicReconstructor(){
|
public TileEntityAtomicReconstructor(){
|
||||||
super(1, "reconstructor");
|
super(1, "reconstructor");
|
||||||
|
@ -152,10 +150,6 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shootLaser(int endX, int endY, int endZ, ReconstructorRecipeHandler.LensType currentLens){
|
|
||||||
PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, endX, endY, endZ, currentLens), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReconstructorRecipeHandler.LensType getCurrentLens(){
|
public ReconstructorRecipeHandler.LensType getCurrentLens(){
|
||||||
if(this.slots[0] != null){
|
if(this.slots[0] != null){
|
||||||
if(this.slots[0].getItem() instanceof IReconstructorLens){
|
if(this.slots[0].getItem() instanceof IReconstructorLens){
|
||||||
|
@ -173,6 +167,10 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void shootLaser(int endX, int endY, int endZ, ReconstructorRecipeHandler.LensType currentLens){
|
||||||
|
PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, endX, endY, endZ, currentLens), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
@ -180,6 +178,11 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
this.storage.writeToNBT(compound);
|
this.storage.writeToNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldSyncSlots(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.readSyncableNBT(compound, sync);
|
super.readSyncableNBT(compound, sync);
|
||||||
|
@ -187,6 +190,23 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
this.storage.readFromNBT(compound);
|
this.storage.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
|
return stack != null && stack.getItem() instanceof IReconstructorLens;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int i, ItemStack stack){
|
||||||
|
super.setInventorySlotContents(i, stack);
|
||||||
|
this.sendUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int i, int j){
|
||||||
|
this.sendUpdate();
|
||||||
|
return super.decrStackSize(i, j);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||||
|
@ -216,26 +236,4 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
|
||||||
return stack != null && stack.getItem() instanceof IReconstructorLens;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldSyncSlots(){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack decrStackSize(int i, int j){
|
|
||||||
this.sendUpdate();
|
|
||||||
return super.decrStackSize(i, j);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInventorySlotContents(int i, ItemStack stack){
|
|
||||||
super.setInventorySlotContents(i, stack);
|
|
||||||
this.sendUpdate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,11 +71,6 @@ public abstract class TileEntityBase extends TileEntity{
|
||||||
GameRegistry.registerTileEntity(TileEntityBookletStand.class, ModUtil.MOD_ID_LOWER+":tileEntityBookletStand");
|
GameRegistry.registerTileEntity(TileEntityBookletStand.class, ModUtil.MOD_ID_LOWER+":tileEntityBookletStand");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity(){
|
|
||||||
this.ticksElapsed++;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void readFromNBT(NBTTagCompound compound){
|
public final void readFromNBT(NBTTagCompound compound){
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
|
@ -88,8 +83,9 @@ public abstract class TileEntityBase extends TileEntity{
|
||||||
this.writeSyncableNBT(compound, false);
|
this.writeSyncableNBT(compound, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
@Override
|
||||||
|
public void updateEntity(){
|
||||||
|
this.ticksElapsed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -109,12 +105,16 @@ public abstract class TileEntityBase extends TileEntity{
|
||||||
return !(oldBlock.isAssociatedBlock(newBlock));
|
return !(oldBlock.isAssociatedBlock(newBlock));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean sendUpdateWithInterval(){
|
protected boolean sendUpdateWithInterval(){
|
||||||
if(this.ticksElapsed % ConfigIntValues.TILE_ENTITY_UPDATE_INTERVAL.getValue() == 0){
|
if(this.ticksElapsed%ConfigIntValues.TILE_ENTITY_UPDATE_INTERVAL.getValue() == 0){
|
||||||
this.sendUpdate();
|
this.sendUpdate();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,18 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||||
this.isPlacer = false;
|
this.isPlacer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
compound.setInteger("CurrentTime", this.currentTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.currentTime = compound.getInteger("CurrentTime");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -77,18 +89,6 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
compound.setInteger("CurrentTime", this.currentTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.currentTime = compound.getInteger("CurrentTime");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return this.isPlacer;
|
return this.isPlacer;
|
||||||
|
|
|
@ -26,6 +26,9 @@ import net.minecraftforge.fluids.*;
|
||||||
|
|
||||||
public class TileEntityCanolaPress extends TileEntityInventoryBase implements IEnergyReceiver, IFluidHandler{
|
public class TileEntityCanolaPress extends TileEntityInventoryBase implements IEnergyReceiver, IFluidHandler{
|
||||||
|
|
||||||
|
public static final int PRODUCE = 100;
|
||||||
|
public static final int ENERGY_USE = 35;
|
||||||
|
private static final int TIME = 30;
|
||||||
public EnergyStorage storage = new EnergyStorage(40000);
|
public EnergyStorage storage = new EnergyStorage(40000);
|
||||||
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||||
public int currentProcessTime;
|
public int currentProcessTime;
|
||||||
|
@ -33,14 +36,41 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
||||||
private int lastTankAmount;
|
private int lastTankAmount;
|
||||||
private int lastProcessTime;
|
private int lastProcessTime;
|
||||||
|
|
||||||
public static final int PRODUCE = 100;
|
|
||||||
public static final int ENERGY_USE = 35;
|
|
||||||
private static final int TIME = 30;
|
|
||||||
|
|
||||||
public TileEntityCanolaPress(){
|
public TileEntityCanolaPress(){
|
||||||
super(3, "canolaPress");
|
super(3, "canolaPress");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getTankScaled(int i){
|
||||||
|
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getProcessScaled(int i){
|
||||||
|
return this.currentProcessTime*i/TIME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getEnergyScaled(int i){
|
||||||
|
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
this.tank.writeToNBT(compound);
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
this.tank.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -91,37 +121,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
||||||
return this.slots[slot] != null && this.slots[slot].getItem() == InitItems.itemMisc && this.slots[slot].getItemDamage() == TheMiscItems.CANOLA.ordinal();
|
return this.slots[slot] != null && this.slots[slot].getItem() == InitItems.itemMisc && this.slots[slot].getItemDamage() == TheMiscItems.CANOLA.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getTankScaled(int i){
|
|
||||||
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getProcessScaled(int i){
|
|
||||||
return this.currentProcessTime*i/TIME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getEnergyScaled(int i){
|
|
||||||
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
this.tank.writeToNBT(compound);
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
this.tank.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);
|
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);
|
||||||
|
|
|
@ -22,6 +22,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityCoalGenerator extends TileEntityInventoryBase implements IEnergyProvider{
|
public class TileEntityCoalGenerator extends TileEntityInventoryBase implements IEnergyProvider{
|
||||||
|
|
||||||
|
public static final int PRODUCE = 30;
|
||||||
public EnergyStorage storage = new EnergyStorage(60000);
|
public EnergyStorage storage = new EnergyStorage(60000);
|
||||||
public int maxBurnTime;
|
public int maxBurnTime;
|
||||||
public int currentBurnTime;
|
public int currentBurnTime;
|
||||||
|
@ -29,12 +30,36 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
||||||
private int lastBurnTime;
|
private int lastBurnTime;
|
||||||
private int lastCurrentBurnTime;
|
private int lastCurrentBurnTime;
|
||||||
|
|
||||||
public static final int PRODUCE = 30;
|
|
||||||
|
|
||||||
public TileEntityCoalGenerator(){
|
public TileEntityCoalGenerator(){
|
||||||
super(1, "coalGenerator");
|
super(1, "coalGenerator");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getEnergyScaled(int i){
|
||||||
|
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getBurningScaled(int i){
|
||||||
|
return this.currentBurnTime*i/this.maxBurnTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||||
|
compound.setInteger("MaxBurnTime", this.maxBurnTime);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||||
|
this.maxBurnTime = compound.getInteger("MaxBurnTime");
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -89,32 +114,6 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getEnergyScaled(int i){
|
|
||||||
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getBurningScaled(int i){
|
|
||||||
return this.currentBurnTime*i/this.maxBurnTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
|
||||||
compound.setInteger("MaxBurnTime", this.maxBurnTime);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
|
||||||
this.maxBurnTime = compound.getInteger("MaxBurnTime");
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return TileEntityFurnace.getItemBurnTime(stack) > 0;
|
return TileEntityFurnace.getItemBurnTime(stack) > 0;
|
||||||
|
|
|
@ -32,6 +32,11 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
||||||
public static final int SLOT_OUTPUT = 2;
|
public static final int SLOT_OUTPUT = 2;
|
||||||
public static final int SLOT_WATER_INPUT = 11;
|
public static final int SLOT_WATER_INPUT = 11;
|
||||||
public static final int SLOT_WATER_OUTPUT = 12;
|
public static final int SLOT_WATER_OUTPUT = 12;
|
||||||
|
public static final int CACHE_USE = 15;
|
||||||
|
public static final int ENERGY_USED = 150;
|
||||||
|
public static final int WATER_USE = 500;
|
||||||
|
public static final int COFFEE_CACHE_MAX_AMOUNT = 300;
|
||||||
|
private static final int TIME_USED = 500;
|
||||||
public EnergyStorage storage = new EnergyStorage(300000);
|
public EnergyStorage storage = new EnergyStorage(300000);
|
||||||
public FluidTank tank = new FluidTank(4*FluidContainerRegistry.BUCKET_VOLUME);
|
public FluidTank tank = new FluidTank(4*FluidContainerRegistry.BUCKET_VOLUME);
|
||||||
public int coffeeCacheAmount;
|
public int coffeeCacheAmount;
|
||||||
|
@ -41,16 +46,48 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
||||||
private int lastCoffeeAmount;
|
private int lastCoffeeAmount;
|
||||||
private int lastBrewTime;
|
private int lastBrewTime;
|
||||||
|
|
||||||
private static final int TIME_USED = 500;
|
|
||||||
public static final int CACHE_USE = 15;
|
|
||||||
public static final int ENERGY_USED = 150;
|
|
||||||
public static final int WATER_USE = 500;
|
|
||||||
public static final int COFFEE_CACHE_MAX_AMOUNT = 300;
|
|
||||||
|
|
||||||
public TileEntityCoffeeMachine(){
|
public TileEntityCoffeeMachine(){
|
||||||
super(13, "coffeeMachine");
|
super(13, "coffeeMachine");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getCoffeeScaled(int i){
|
||||||
|
return this.coffeeCacheAmount*i/COFFEE_CACHE_MAX_AMOUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getWaterScaled(int i){
|
||||||
|
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getEnergyScaled(int i){
|
||||||
|
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getBrewScaled(int i){
|
||||||
|
return this.brewTime*i/TIME_USED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
this.tank.writeToNBT(compound);
|
||||||
|
compound.setInteger("Cache", this.coffeeCacheAmount);
|
||||||
|
compound.setInteger("Time", this.brewTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
this.tank.readFromNBT(compound);
|
||||||
|
this.coffeeCacheAmount = compound.getInteger("Cache");
|
||||||
|
this.brewTime = compound.getInteger("Time");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
@ -123,44 +160,6 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getCoffeeScaled(int i){
|
|
||||||
return this.coffeeCacheAmount*i/COFFEE_CACHE_MAX_AMOUNT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getWaterScaled(int i){
|
|
||||||
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getEnergyScaled(int i){
|
|
||||||
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getBrewScaled(int i){
|
|
||||||
return this.brewTime*i/TIME_USED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
this.tank.writeToNBT(compound);
|
|
||||||
compound.setInteger("Cache", this.coffeeCacheAmount);
|
|
||||||
compound.setInteger("Time", this.brewTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
this.tank.readFromNBT(compound);
|
|
||||||
this.coffeeCacheAmount = compound.getInteger("Cache");
|
|
||||||
this.brewTime = compound.getInteger("Time");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal());
|
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal());
|
||||||
|
|
|
@ -19,14 +19,25 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
public class TileEntityCompost extends TileEntityInventoryBase{
|
public class TileEntityCompost extends TileEntityInventoryBase{
|
||||||
|
|
||||||
public int conversionTime;
|
|
||||||
|
|
||||||
public static final int AMOUNT = 10;
|
public static final int AMOUNT = 10;
|
||||||
|
public int conversionTime;
|
||||||
|
|
||||||
public TileEntityCompost(){
|
public TileEntityCompost(){
|
||||||
super(1, "compost");
|
super(1, "compost");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
compound.setInteger("ConversionTime", this.conversionTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.conversionTime = compound.getInteger("ConversionTime");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
@ -58,18 +69,6 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
compound.setInteger("ConversionTime", this.conversionTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.conversionTime = compound.getInteger("ConversionTime");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInventoryStackLimit(){
|
public int getInventoryStackLimit(){
|
||||||
return AMOUNT;
|
return AMOUNT;
|
||||||
|
|
|
@ -26,13 +26,11 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implements IEnergyReceiver{
|
public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||||
|
|
||||||
public EnergyStorage storage = new EnergyStorage(10000);
|
|
||||||
private int lastEnergy;
|
|
||||||
|
|
||||||
private int currentTime;
|
|
||||||
|
|
||||||
public static final int RANGE = 8;
|
public static final int RANGE = 8;
|
||||||
public static final int ENERGY_USE = 5;
|
public static final int ENERGY_USE = 5;
|
||||||
|
public EnergyStorage storage = new EnergyStorage(10000);
|
||||||
|
private int lastEnergy;
|
||||||
|
private int currentTime;
|
||||||
|
|
||||||
public TileEntityDirectionalBreaker(){
|
public TileEntityDirectionalBreaker(){
|
||||||
super(9, "directionalBreaker");
|
super(9, "directionalBreaker");
|
||||||
|
@ -83,11 +81,6 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getEnergyScaled(int i){
|
|
||||||
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
@ -107,6 +100,11 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getEnergyScaled(int i){
|
||||||
|
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||||
return this.isItemValidForSlot(slot, stack);
|
return this.isItemValidForSlot(slot, stack);
|
||||||
|
|
|
@ -23,6 +23,18 @@ public class TileEntityDropper extends TileEntityInventoryBase{
|
||||||
super(9, "dropper");
|
super(9, "dropper");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
compound.setInteger("CurrentTime", this.currentTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.currentTime = compound.getInteger("CurrentTime");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -62,18 +74,6 @@ public class TileEntityDropper extends TileEntityInventoryBase{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
compound.setInteger("CurrentTime", this.currentTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.currentTime = compound.getInteger("CurrentTime");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -28,6 +28,18 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
||||||
super(2, "energizer");
|
super(2, "energizer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
@ -53,18 +65,6 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
||||||
|
|
|
@ -29,6 +29,18 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
||||||
super(2, "enervator");
|
super(2, "enervator");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
@ -63,18 +75,6 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
||||||
|
|
|
@ -22,18 +22,34 @@ import java.util.List;
|
||||||
|
|
||||||
public class TileEntityFeeder extends TileEntityInventoryBase{
|
public class TileEntityFeeder extends TileEntityInventoryBase{
|
||||||
|
|
||||||
|
public static final int THRESHOLD = 30;
|
||||||
|
private static final int TIME = 100;
|
||||||
public int currentTimer;
|
public int currentTimer;
|
||||||
public int currentAnimalAmount;
|
public int currentAnimalAmount;
|
||||||
private int lastAnimalAmount;
|
private int lastAnimalAmount;
|
||||||
private int lastTimer;
|
private int lastTimer;
|
||||||
|
|
||||||
public static final int THRESHOLD = 30;
|
|
||||||
private static final int TIME = 100;
|
|
||||||
|
|
||||||
public TileEntityFeeder(){
|
public TileEntityFeeder(){
|
||||||
super(1, "feeder");
|
super(1, "feeder");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getCurrentTimerToScale(int i){
|
||||||
|
return this.currentTimer*i/TIME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
compound.setInteger("Timer", this.currentTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.currentTimer = compound.getInteger("Timer");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -95,23 +111,6 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getCurrentTimerToScale(int i){
|
|
||||||
return this.currentTimer*i/TIME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
compound.setInteger("Timer", this.currentTimer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.currentTimer = compound.getInteger("Timer");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -22,6 +22,7 @@ import net.minecraftforge.fluids.*;
|
||||||
|
|
||||||
public class TileEntityFermentingBarrel extends TileEntityInventoryBase implements IFluidHandler{
|
public class TileEntityFermentingBarrel extends TileEntityInventoryBase implements IFluidHandler{
|
||||||
|
|
||||||
|
private static final int PROCESS_TIME = 100;
|
||||||
public FluidTank canolaTank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
public FluidTank canolaTank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||||
public FluidTank oilTank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
public FluidTank oilTank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||||
public int currentProcessTime;
|
public int currentProcessTime;
|
||||||
|
@ -29,8 +30,6 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
|
||||||
private int lastOil;
|
private int lastOil;
|
||||||
private int lastProcessTime;
|
private int lastProcessTime;
|
||||||
|
|
||||||
private static final int PROCESS_TIME = 100;
|
|
||||||
|
|
||||||
public TileEntityFermentingBarrel(){
|
public TileEntityFermentingBarrel(){
|
||||||
super(4, "fermentingBarrel");
|
super(4, "fermentingBarrel");
|
||||||
}
|
}
|
||||||
|
@ -76,11 +75,6 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getProcessScaled(int i){
|
|
||||||
return this.currentProcessTime*i/PROCESS_TIME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||||
|
@ -104,6 +98,11 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
|
||||||
return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket);
|
return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getProcessScaled(int i){
|
||||||
|
return this.currentProcessTime*i/PROCESS_TIME;
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getOilTankScaled(int i){
|
public int getOilTankScaled(int i){
|
||||||
return this.oilTank.getFluidAmount()*i/this.oilTank.getCapacity();
|
return this.oilTank.getFluidAmount()*i/this.oilTank.getCapacity();
|
||||||
|
|
|
@ -25,16 +25,6 @@ public class TileEntityFishingNet extends TileEntityBase{
|
||||||
|
|
||||||
public int timeUntilNextDrop;
|
public int timeUntilNextDrop;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
@ -65,6 +55,16 @@ public class TileEntityFishingNet extends TileEntityBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop");
|
||||||
|
}
|
||||||
|
|
||||||
public void insertIntoInventory(IInventory inventory, ItemStack stack){
|
public void insertIntoInventory(IInventory inventory, ItemStack stack){
|
||||||
for(int i = 0; i < inventory.getSizeInventory(); i++){
|
for(int i = 0; i < inventory.getSizeInventory(); i++){
|
||||||
if(inventory.isItemValidForSlot(i, stack)){
|
if(inventory.isItemValidForSlot(i, stack)){
|
||||||
|
|
|
@ -152,11 +152,6 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getTankScaled(int i){
|
|
||||||
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
@ -184,6 +179,11 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getTankScaled(int i){
|
||||||
|
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||||
return this.isItemValidForSlot(slot, stack);
|
return this.isItemValidForSlot(slot, stack);
|
||||||
|
|
|
@ -25,7 +25,8 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
||||||
public static final int SLOT_OUTPUT_1 = 1;
|
public static final int SLOT_OUTPUT_1 = 1;
|
||||||
public static final int SLOT_INPUT_2 = 2;
|
public static final int SLOT_INPUT_2 = 2;
|
||||||
public static final int SLOT_OUTPUT_2 = 3;
|
public static final int SLOT_OUTPUT_2 = 3;
|
||||||
|
public static final int ENERGY_USE = 25;
|
||||||
|
private static final int SMELT_TIME = 80;
|
||||||
public EnergyStorage storage = new EnergyStorage(30000);
|
public EnergyStorage storage = new EnergyStorage(30000);
|
||||||
public int firstSmeltTime;
|
public int firstSmeltTime;
|
||||||
public int secondSmeltTime;
|
public int secondSmeltTime;
|
||||||
|
@ -33,14 +34,26 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
||||||
private int lastFirstSmelt;
|
private int lastFirstSmelt;
|
||||||
private int lastSecondSmelt;
|
private int lastSecondSmelt;
|
||||||
|
|
||||||
private static final int SMELT_TIME = 80;
|
|
||||||
|
|
||||||
public static final int ENERGY_USE = 25;
|
|
||||||
|
|
||||||
public TileEntityFurnaceDouble(){
|
public TileEntityFurnaceDouble(){
|
||||||
super(4, "furnaceDouble");
|
super(4, "furnaceDouble");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
|
||||||
|
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
|
||||||
|
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -131,22 +144,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
|
|
||||||
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
|
|
||||||
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
|
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
|
||||||
|
|
|
@ -18,9 +18,8 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyProvider{
|
public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyProvider{
|
||||||
|
|
||||||
public EnergyStorage storage = new EnergyStorage(30000);
|
|
||||||
|
|
||||||
public static final int PRODUCE = 10;
|
public static final int PRODUCE = 10;
|
||||||
|
public EnergyStorage storage = new EnergyStorage(30000);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
||||||
|
@ -42,25 +41,6 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
|
||||||
return from != ForgeDirection.UP;
|
return from != ForgeDirection.UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasBlockAbove(){
|
|
||||||
for(int y = yCoord+1; y <= worldObj.getHeight(); y++){
|
|
||||||
if(!worldObj.getBlock(xCoord, y, zCoord).isAir(worldObj, xCoord, y, zCoord)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
@ -81,4 +61,23 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBlockAbove(){
|
||||||
|
for(int y = yCoord+1; y <= worldObj.getHeight(); y++){
|
||||||
|
if(!worldObj.getBlock(xCoord, y, zCoord).isAir(worldObj, xCoord, y, zCoord)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,22 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
||||||
|
compound.setInteger("SecondCrushTime", this.secondCrushTime);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
||||||
|
this.secondCrushTime = compound.getInteger("SecondCrushTime");
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -195,22 +211,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
|
||||||
compound.setInteger("SecondCrushTime", this.secondCrushTime);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
|
||||||
this.secondCrushTime = compound.getInteger("SecondCrushTime");
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
|
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
|
||||||
|
|
|
@ -24,10 +24,9 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
public class TileEntityHeatCollector extends TileEntityBase implements IEnergyProvider{
|
public class TileEntityHeatCollector extends TileEntityBase implements IEnergyProvider{
|
||||||
|
|
||||||
public EnergyStorage storage = new EnergyStorage(30000);
|
|
||||||
|
|
||||||
public static final int ENERGY_PRODUCE = 40;
|
public static final int ENERGY_PRODUCE = 40;
|
||||||
public static final int BLOCKS_NEEDED = 4;
|
public static final int BLOCKS_NEEDED = 4;
|
||||||
|
public EnergyStorage storage = new EnergyStorage(30000);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -62,6 +61,16 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
||||||
return this.storage.extractEnergy(maxExtract, simulate);
|
return this.storage.extractEnergy(maxExtract, simulate);
|
||||||
|
@ -81,14 +90,4 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
|
||||||
public boolean canConnectEnergy(ForgeDirection from){
|
public boolean canConnectEnergy(ForgeDirection from){
|
||||||
return from == ForgeDirection.UP;
|
return from == ForgeDirection.UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,38 +80,6 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity(){
|
|
||||||
super.updateEntity();
|
|
||||||
if(!worldObj.isRemote){
|
|
||||||
this.initVars();
|
|
||||||
|
|
||||||
//Is Block not powered by Redstone?
|
|
||||||
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
|
|
||||||
if(!(this.sideToPull == this.sideToPut && this.slotToPullStart == this.slotToPutStart && this.slotToPullEnd == this.slotToPutEnd)){
|
|
||||||
if(sideToPull != -1 && this.placeToPull instanceof IInventory){
|
|
||||||
this.pull();
|
|
||||||
}
|
|
||||||
if(sideToPut != -1 && this.placeToPut instanceof IInventory){
|
|
||||||
this.put();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Update the Client
|
|
||||||
if((this.sideToPut != this.lastPutSide || this.sideToPull != this.lastPullSide || this.slotToPullStart != this.lastPullStart || this.slotToPullEnd != this.lastPullEnd || this.slotToPutStart != this.lastPutStart || this.slotToPutEnd != this.lastPutEnd || this.isPullWhitelist != lastPullWhite || this.isPutWhitelist != this.lastPutWhite) && this.sendUpdateWithInterval()){
|
|
||||||
this.lastPutSide = this.sideToPut;
|
|
||||||
this.lastPullSide = this.sideToPull;
|
|
||||||
this.lastPullStart = this.slotToPullStart;
|
|
||||||
this.lastPullEnd = this.slotToPullEnd;
|
|
||||||
this.lastPutStart = this.slotToPutStart;
|
|
||||||
this.lastPutEnd = this.slotToPutEnd;
|
|
||||||
this.lastPullWhite = this.isPullWhitelist;
|
|
||||||
this.lastPutWhite = this.isPutWhitelist;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pulls Items from the specified Slots on the specified Side
|
* Pulls Items from the specified Slots on the specified Side
|
||||||
*/
|
*/
|
||||||
|
@ -426,6 +394,38 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
||||||
super.readSyncableNBT(compound, sync);
|
super.readSyncableNBT(compound, sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity(){
|
||||||
|
super.updateEntity();
|
||||||
|
if(!worldObj.isRemote){
|
||||||
|
this.initVars();
|
||||||
|
|
||||||
|
//Is Block not powered by Redstone?
|
||||||
|
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
|
||||||
|
if(!(this.sideToPull == this.sideToPut && this.slotToPullStart == this.slotToPutStart && this.slotToPullEnd == this.slotToPutEnd)){
|
||||||
|
if(sideToPull != -1 && this.placeToPull instanceof IInventory){
|
||||||
|
this.pull();
|
||||||
|
}
|
||||||
|
if(sideToPut != -1 && this.placeToPut instanceof IInventory){
|
||||||
|
this.put();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Update the Client
|
||||||
|
if((this.sideToPut != this.lastPutSide || this.sideToPull != this.lastPullSide || this.slotToPullStart != this.lastPullStart || this.slotToPullEnd != this.lastPullEnd || this.slotToPutStart != this.lastPutStart || this.slotToPutEnd != this.lastPutEnd || this.isPullWhitelist != lastPullWhite || this.isPutWhitelist != this.lastPutWhite) && this.sendUpdateWithInterval()){
|
||||||
|
this.lastPutSide = this.sideToPut;
|
||||||
|
this.lastPullSide = this.sideToPull;
|
||||||
|
this.lastPullStart = this.slotToPullStart;
|
||||||
|
this.lastPullEnd = this.slotToPullEnd;
|
||||||
|
this.lastPutStart = this.slotToPutStart;
|
||||||
|
this.lastPutEnd = this.slotToPutEnd;
|
||||||
|
this.lastPullWhite = this.isPullWhitelist;
|
||||||
|
this.lastPutWhite = this.isPutWhitelist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return i == 0;
|
return i == 0;
|
||||||
|
|
|
@ -31,8 +31,23 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
||||||
this.slots = new ItemStack[itemAmount];
|
this.slots = new ItemStack[itemAmount];
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldSyncSlots(){
|
@Override
|
||||||
return false;
|
public int[] getAccessibleSlotsFromSide(int side){
|
||||||
|
if(this.slots.length > 0){
|
||||||
|
int[] theInt = new int[slots.length];
|
||||||
|
for(int i = 0; i < theInt.length; i++){
|
||||||
|
theInt[i] = i;
|
||||||
|
}
|
||||||
|
return theInt;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return new int[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity(){
|
||||||
|
super.updateEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,6 +68,10 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldSyncSlots(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||||
if(!isForSync || this.shouldSyncSlots()){
|
if(!isForSync || this.shouldSyncSlots()){
|
||||||
|
@ -69,25 +88,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getAccessibleSlotsFromSide(int side){
|
|
||||||
if(this.slots.length > 0){
|
|
||||||
int[] theInt = new int[slots.length];
|
|
||||||
for(int i = 0; i < theInt.length; i++){
|
|
||||||
theInt[i] = i;
|
|
||||||
}
|
|
||||||
return theInt;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return new int[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity(){
|
|
||||||
super.updateEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInventoryStackLimit(){
|
public int getInventoryStackLimit(){
|
||||||
return 64;
|
return 64;
|
||||||
|
|
|
@ -22,17 +22,29 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
||||||
|
|
||||||
public static final int SLOT_INPUT = 0;
|
public static final int SLOT_INPUT = 0;
|
||||||
public static final int SLOT_OUTPUT = 1;
|
public static final int SLOT_OUTPUT = 1;
|
||||||
|
public static final int ENERGY_USE = 1500;
|
||||||
public EnergyStorage storage = new EnergyStorage(300000);
|
public EnergyStorage storage = new EnergyStorage(300000);
|
||||||
public int nextRepairTick;
|
public int nextRepairTick;
|
||||||
private int lastEnergy;
|
private int lastEnergy;
|
||||||
|
|
||||||
public static final int ENERGY_USE = 1500;
|
|
||||||
|
|
||||||
public TileEntityItemRepairer(){
|
public TileEntityItemRepairer(){
|
||||||
super(2, "repairer");
|
super(2, "repairer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -69,20 +81,6 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
||||||
return stack != null && stack.getItem().isRepairable();
|
return stack != null && stack.getItem().isRepairable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return i == SLOT_INPUT;
|
return i == SLOT_INPUT;
|
||||||
|
|
|
@ -41,12 +41,6 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void invalidate(){
|
|
||||||
super.invalidate();
|
|
||||||
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(new WorldPos(this.worldObj, this.xCoord, this.yCoord, this.zCoord));
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderParticles(){
|
public void renderParticles(){
|
||||||
if(Util.RANDOM.nextInt(2) == 0){
|
if(Util.RANDOM.nextInt(2) == 0){
|
||||||
|
@ -106,6 +100,12 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invalidate(){
|
||||||
|
super.invalidate();
|
||||||
|
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(new WorldPos(this.worldObj, this.xCoord, this.yCoord, this.zCoord));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||||
return this.transmitEnergy(WorldUtil.getCoordsFromSide(from, worldObj, xCoord, yCoord, zCoord, 0), maxReceive, simulate);
|
return this.transmitEnergy(WorldUtil.getCoordsFromSide(from, worldObj, xCoord, yCoord, zCoord, 0), maxReceive, simulate);
|
||||||
|
|
|
@ -24,25 +24,12 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
|
||||||
public static final int NOT_MULTI = 0;
|
public static final int NOT_MULTI = 0;
|
||||||
public static final int HAS_LAVA = 1;
|
public static final int HAS_LAVA = 1;
|
||||||
public static final int HAS_AIR = 2;
|
public static final int HAS_AIR = 2;
|
||||||
|
public static final int ENERGY_USE = 150000;
|
||||||
//The Positions the Case Blocks should be in for the Factory to work
|
//The Positions the Case Blocks should be in for the Factory to work
|
||||||
private static final int[][] CASE_POSITIONS = {{-1, 1, 0}, {1, 1, 0}, {0, 1, -1}, {0, 1, 1}};
|
private static final int[][] CASE_POSITIONS = {{-1, 1, 0}, {1, 1, 0}, {0, 1, -1}, {0, 1, 1}};
|
||||||
public EnergyStorage storage = new EnergyStorage(3000000);
|
public EnergyStorage storage = new EnergyStorage(3000000);
|
||||||
private int currentWorkTime;
|
private int currentWorkTime;
|
||||||
|
|
||||||
public static final int ENERGY_USE = 150000;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
compound.setInteger("WorkTime", this.currentWorkTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
this.currentWorkTime = compound.getInteger("WorkTime");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -62,6 +49,18 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
compound.setInteger("WorkTime", this.currentWorkTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
this.currentWorkTime = compound.getInteger("WorkTime");
|
||||||
|
}
|
||||||
|
|
||||||
public int isMultiblock(){
|
public int isMultiblock(){
|
||||||
if(WorldUtil.hasBlocksInPlacesGiven(CASE_POSITIONS, InitBlocks.blockMisc, TheMiscBlocks.LAVA_FACTORY_CASE.ordinal(), worldObj, xCoord, yCoord, zCoord)){
|
if(WorldUtil.hasBlocksInPlacesGiven(CASE_POSITIONS, InitBlocks.blockMisc, TheMiscBlocks.LAVA_FACTORY_CASE.ordinal(), worldObj, xCoord, yCoord, zCoord)){
|
||||||
if(worldObj.getBlock(xCoord, yCoord+1, zCoord) == Blocks.lava || worldObj.getBlock(xCoord, yCoord+1, zCoord) == Blocks.flowing_lava){
|
if(worldObj.getBlock(xCoord, yCoord+1, zCoord) == Blocks.lava || worldObj.getBlock(xCoord, yCoord+1, zCoord) == Blocks.flowing_lava){
|
||||||
|
|
|
@ -23,23 +23,11 @@ import java.util.Collections;
|
||||||
|
|
||||||
public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyProvider{
|
public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyProvider{
|
||||||
|
|
||||||
public EnergyStorage storage = new EnergyStorage(35000);
|
|
||||||
|
|
||||||
public static final int RANGE = 7;
|
public static final int RANGE = 7;
|
||||||
public static final int ENERGY_PRODUCED = 300;
|
public static final int ENERGY_PRODUCED = 300;
|
||||||
|
public EnergyStorage storage = new EnergyStorage(35000);
|
||||||
private int nextUseCounter;
|
private int nextUseCounter;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -94,6 +82,16 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int extractEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
public int extractEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||||
return this.storage.extractEnergy(maxReceive, simulate);
|
return this.storage.extractEnergy(maxReceive, simulate);
|
||||||
|
|
|
@ -23,6 +23,8 @@ import net.minecraftforge.fluids.*;
|
||||||
|
|
||||||
public class TileEntityOilGenerator extends TileEntityInventoryBase implements IEnergyProvider, IFluidHandler{
|
public class TileEntityOilGenerator extends TileEntityInventoryBase implements IEnergyProvider, IFluidHandler{
|
||||||
|
|
||||||
|
public static final int ENERGY_PRODUCED = 76;
|
||||||
|
private static final int BURN_TIME = 100;
|
||||||
public EnergyStorage storage = new EnergyStorage(50000);
|
public EnergyStorage storage = new EnergyStorage(50000);
|
||||||
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||||
public int currentBurnTime;
|
public int currentBurnTime;
|
||||||
|
@ -30,13 +32,41 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
||||||
private int lastTank;
|
private int lastTank;
|
||||||
private int lastBurnTime;
|
private int lastBurnTime;
|
||||||
|
|
||||||
public static final int ENERGY_PRODUCED = 76;
|
|
||||||
private static final int BURN_TIME = 100;
|
|
||||||
|
|
||||||
public TileEntityOilGenerator(){
|
public TileEntityOilGenerator(){
|
||||||
super(2, "oilGenerator");
|
super(2, "oilGenerator");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getEnergyScaled(int i){
|
||||||
|
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getTankScaled(int i){
|
||||||
|
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getBurningScaled(int i){
|
||||||
|
return this.currentBurnTime*i/BURN_TIME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
this.tank.writeToNBT(compound);
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
this.tank.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -89,37 +119,6 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getEnergyScaled(int i){
|
|
||||||
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getTankScaled(int i){
|
|
||||||
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getBurningScaled(int i){
|
|
||||||
return this.currentBurnTime*i/BURN_TIME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
this.tank.writeToNBT(compound);
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
this.tank.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
|
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
|
||||||
|
|
|
@ -25,13 +25,12 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile{
|
public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile{
|
||||||
|
|
||||||
|
public static final int RANGE = 3;
|
||||||
public WorldPos boundPosition;
|
public WorldPos boundPosition;
|
||||||
public int currentTime;
|
public int currentTime;
|
||||||
public int range;
|
public int range;
|
||||||
public boolean isBreaker;
|
public boolean isBreaker;
|
||||||
|
|
||||||
public static final int RANGE = 3;
|
|
||||||
|
|
||||||
public TileEntityPhantomPlacer(int slots, String name){
|
public TileEntityPhantomPlacer(int slots, String name){
|
||||||
super(slots, name);
|
super(slots, name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,22 +24,42 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
public class TileEntityPhantomface extends TileEntityInventoryBase implements IPhantomTile{
|
public class TileEntityPhantomface extends TileEntityInventoryBase implements IPhantomTile{
|
||||||
|
|
||||||
|
public static final int RANGE = 16;
|
||||||
public WorldPos boundPosition;
|
public WorldPos boundPosition;
|
||||||
|
|
||||||
public BlockPhantom.Type type;
|
public BlockPhantom.Type type;
|
||||||
|
|
||||||
public int range;
|
public int range;
|
||||||
|
|
||||||
private int rangeBefore;
|
private int rangeBefore;
|
||||||
private WorldPos boundPosBefore;
|
private WorldPos boundPosBefore;
|
||||||
private Block boundBlockBefore;
|
private Block boundBlockBefore;
|
||||||
|
|
||||||
public static final int RANGE = 16;
|
|
||||||
|
|
||||||
public TileEntityPhantomface(String name){
|
public TileEntityPhantomface(String name){
|
||||||
super(0, name);
|
super(0, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
if(this.boundPosition != null){
|
||||||
|
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
|
||||||
|
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
|
||||||
|
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
|
||||||
|
compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
int x = compound.getInteger("XCoordOfTileStored");
|
||||||
|
int y = compound.getInteger("YCoordOfTileStored");
|
||||||
|
int z = compound.getInteger("ZCoordOfTileStored");
|
||||||
|
int world = compound.getInteger("WorldOfTileStored");
|
||||||
|
if(!(x == 0 && y == 0 && z == 0)){
|
||||||
|
this.boundPosition = new WorldPos(world, x, y, z);
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
@ -137,30 +157,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
return this.range;
|
return this.range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
if(this.boundPosition != null){
|
|
||||||
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
|
|
||||||
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
|
|
||||||
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
|
|
||||||
compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
int x = compound.getInteger("XCoordOfTileStored");
|
|
||||||
int y = compound.getInteger("YCoordOfTileStored");
|
|
||||||
int z = compound.getInteger("ZCoordOfTileStored");
|
|
||||||
int world = compound.getInteger("WorldOfTileStored");
|
|
||||||
if(!(x == 0 && y == 0 && z == 0)){
|
|
||||||
this.boundPosition = new WorldPos(world, x, y, z);
|
|
||||||
this.markDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -23,12 +23,10 @@ import java.util.ArrayList;
|
||||||
public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor{
|
public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor{
|
||||||
|
|
||||||
public static final int WHITELIST_START = 6;
|
public static final int WHITELIST_START = 6;
|
||||||
|
public static final int RANGE = 6;
|
||||||
public boolean isWhitelist = true;
|
public boolean isWhitelist = true;
|
||||||
private boolean lastWhitelist;
|
private boolean lastWhitelist;
|
||||||
|
|
||||||
public static final int RANGE = 6;
|
|
||||||
|
|
||||||
public TileEntityRangedCollector(){
|
public TileEntityRangedCollector(){
|
||||||
super(18, "rangedCollector");
|
super(18, "rangedCollector");
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,17 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac
|
||||||
public int flyHeight;
|
public int flyHeight;
|
||||||
private String nameBefore;
|
private String nameBefore;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity(){
|
||||||
|
super.updateEntity();
|
||||||
|
if(!worldObj.isRemote){
|
||||||
|
if(!Objects.equals(this.name, this.nameBefore) && this.sendUpdateWithInterval()){
|
||||||
|
this.nameBefore = this.name;
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
if(this.name != null){
|
if(this.name != null){
|
||||||
|
@ -39,17 +50,6 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac
|
||||||
this.name = compound.getString("Name");
|
this.name = compound.getString("Name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity(){
|
|
||||||
super.updateEntity();
|
|
||||||
if(!worldObj.isRemote){
|
|
||||||
if(!Objects.equals(this.name, this.nameBefore) && this.sendUpdateWithInterval()){
|
|
||||||
this.nameBefore = this.name;
|
|
||||||
this.markDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextReceived(String text, int textID, EntityPlayer player){
|
public void onTextReceived(String text, int textID, EntityPlayer player){
|
||||||
this.name = text;
|
this.name = text;
|
||||||
|
|
|
@ -29,6 +29,18 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
||||||
super(1, "xpSolidifier");
|
super(1, "xpSolidifier");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
compound.setShort("Amount", this.amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.amount = compound.getShort("Amount");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
@ -53,18 +65,6 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
compound.setShort("Amount", this.amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.amount = compound.getShort("Amount");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -68,12 +68,6 @@ public class WorldPos{
|
||||||
return pos != null && this.x == pos.getX() && this.y == pos.getY() && this.z == pos.getZ() && this.getWorld() == pos.getWorld();
|
return pos != null && this.x == pos.getX() && this.y == pos.getY() && this.z == pos.getZ() && this.getWorld() == pos.getWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlock(Block block, int meta, int flag){
|
|
||||||
if(this.getWorld() != null){
|
|
||||||
this.getWorld().setBlock(this.x, this.y, this.z, block, meta, flag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getX(){
|
public int getX(){
|
||||||
return this.x;
|
return this.x;
|
||||||
}
|
}
|
||||||
|
@ -86,6 +80,12 @@ public class WorldPos{
|
||||||
return this.z;
|
return this.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBlock(Block block, int meta, int flag){
|
||||||
|
if(this.getWorld() != null){
|
||||||
|
this.getWorld().setBlock(this.x, this.y, this.z, block, meta, flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public WorldPos copy(){
|
public WorldPos copy(){
|
||||||
return new WorldPos(this.getWorld(), this.x, this.y, this.z);
|
return new WorldPos(this.getWorld(), this.x, this.y, this.z);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,13 +71,6 @@ public class PersistentClientData{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getName(){
|
|
||||||
if(Minecraft.getMinecraft().theWorld != null){
|
|
||||||
return Minecraft.getMinecraft().isIntegratedServerRunning() ? Minecraft.getMinecraft().getIntegratedServer().getFolderName() : Minecraft.getMinecraft().func_147104_D().serverIP;
|
|
||||||
}
|
|
||||||
else return "Invalid";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static NBTTagCompound getCompoundForWorld(NBTTagCompound mainCompound){
|
private static NBTTagCompound getCompoundForWorld(NBTTagCompound mainCompound){
|
||||||
return mainCompound.getCompoundTag(getName());
|
return mainCompound.getCompoundTag(getName());
|
||||||
}
|
}
|
||||||
|
@ -104,6 +97,15 @@ public class PersistentClientData{
|
||||||
return theFile;
|
return theFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getName(){
|
||||||
|
if(Minecraft.getMinecraft().theWorld != null){
|
||||||
|
return Minecraft.getMinecraft().isIntegratedServerRunning() ? Minecraft.getMinecraft().getIntegratedServer().getFolderName() : Minecraft.getMinecraft().func_147104_D().serverIP;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return "Invalid";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void setTheFile(File file){
|
public static void setTheFile(File file){
|
||||||
theFile = file;
|
theFile = file;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue