forked from Nividica/ThaumicEnergistics
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add block,tile,texture,lang * make new provider can provide essentia * Code Optimization * if fail to bind matrix will clear old XYZ for matrix * spotless * mark dirty after unbind * add research, recipe and change texture * Update en_US.lang Co-authored-by: Alexander Anishin <[email protected]> * Update zh_CN.lang * fix and add comments, fix en_US.lang --------- Co-authored-by: Alexander Anishin <[email protected]>
- Loading branch information
1 parent
d96e256
commit 81e5cea
Showing
20 changed files
with
489 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/thaumicenergistics/client/render/RenderBlockAdvancedInfusionProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package thaumicenergistics.client.render; | ||
|
||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
import thaumicenergistics.client.textures.BlockTextureManager; | ||
import thaumicenergistics.common.registries.Renderers; | ||
import thaumicenergistics.common.tiles.TileInfusionProvider; | ||
|
||
/** | ||
* Renders the {@link TileInfusionProvider} | ||
* | ||
* @author MCTBL | ||
* | ||
*/ | ||
@SideOnly(Side.CLIENT) | ||
public class RenderBlockAdvancedInfusionProvider extends RenderBlockProviderBase { | ||
|
||
public RenderBlockAdvancedInfusionProvider() { | ||
super(BlockTextureManager.ADVANCED_INFUSION_PROVIDER); | ||
} | ||
|
||
@Override | ||
public int getRenderId() { | ||
return Renderers.AdvancedInfusionProviderRenderID; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
src/main/java/thaumicenergistics/common/blocks/BlockAdvancedInfusionProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package thaumicenergistics.common.blocks; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.IIcon; | ||
import net.minecraft.world.World; | ||
|
||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
import thaumicenergistics.client.textures.BlockTextureManager; | ||
import thaumicenergistics.common.registries.Renderers; | ||
import thaumicenergistics.common.tiles.TileAdvancedInfusionProvider; | ||
|
||
/** | ||
* {@link TileAdvancedInfusionProvider} block. | ||
* | ||
* @author MCTBL | ||
* | ||
*/ | ||
public class BlockAdvancedInfusionProvider extends AbstractBlockProviderBase { | ||
|
||
public BlockAdvancedInfusionProvider() { | ||
// Call super with material machine (iron) | ||
super(Material.iron); | ||
|
||
// Basic hardness | ||
this.setHardness(1.0f); | ||
|
||
// Sound of metal | ||
this.setStepSound(Block.soundTypeMetal); | ||
} | ||
|
||
/** | ||
* Called when the provider is right-clicked | ||
* | ||
* @param world | ||
* @param x | ||
* @param y | ||
* @param z | ||
* @param player | ||
* @return | ||
*/ | ||
@Override | ||
protected boolean onBlockActivated(final World world, final int x, final int y, final int z, | ||
final EntityPlayer player) { | ||
if (world.getTileEntity(x, y, z) instanceof TileAdvancedInfusionProvider taip && taip.isActive()) { | ||
if (taip.matrix != null) { | ||
taip.unbindMatrix(); | ||
} | ||
taip.searchMatrix(); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
@Override | ||
public TileEntity createNewTileEntity(final World world, final int metaData) { | ||
// Create a new provider tile, passing the side to attach to | ||
TileAdvancedInfusionProvider tile = new TileAdvancedInfusionProvider(); | ||
|
||
tile.setupProvider(metaData); | ||
|
||
tile.searchMatrix(); | ||
|
||
// Return the tile | ||
return tile; | ||
} | ||
|
||
@SideOnly(Side.CLIENT) | ||
@Override | ||
public IIcon getIcon(final int side, final int metaData) { | ||
return BlockTextureManager.ADVANCED_INFUSION_PROVIDER.getTextures()[1]; | ||
} | ||
|
||
@SideOnly(Side.CLIENT) | ||
@Override | ||
public int getRenderType() { | ||
// Provide our custom ID | ||
return Renderers.AdvancedInfusionProviderRenderID; | ||
} | ||
|
||
@Override | ||
public String getUnlocalizedName() { | ||
return BlockEnum.ADVANCED_INFUSION_PROVIDER.getUnlocalizedName(); | ||
} | ||
|
||
@Override | ||
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block neighbor) { | ||
// Get tile entity | ||
TileEntity tileProvider = world.getTileEntity(x, y, z); | ||
if (tileProvider instanceof TileAdvancedInfusionProvider tP) { | ||
// Inform our tile entity a neighbor has changed | ||
tP.checkGridConnectionColor(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
src/main/java/thaumicenergistics/common/features/FeatureAdvancedInfusionProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package thaumicenergistics.common.features; | ||
|
||
import net.minecraft.item.ItemStack; | ||
|
||
import thaumcraft.api.ThaumcraftApi; | ||
import thaumcraft.api.aspects.Aspect; | ||
import thaumcraft.api.aspects.AspectList; | ||
import thaumcraft.api.research.ResearchPage; | ||
import thaumicenergistics.api.IThEConfig; | ||
import thaumicenergistics.api.ThEApi; | ||
import thaumicenergistics.common.blocks.BlockEnum; | ||
import thaumicenergistics.common.registries.FeatureRegistry; | ||
import thaumicenergistics.common.registries.RecipeRegistry; | ||
import thaumicenergistics.common.registries.ResearchRegistry; | ||
import thaumicenergistics.common.registries.ResearchRegistry.ResearchTypes; | ||
|
||
/** | ||
* {@link TileAdvancedInfusionProvider} feature. | ||
* | ||
* @author MCTBL | ||
* | ||
*/ | ||
public class FeatureAdvancedInfusionProvider extends ThEThaumcraftResearchFeature { | ||
|
||
public FeatureAdvancedInfusionProvider() { | ||
super(ResearchTypes.ADVANCED_INFUSION_PROVIDER.getKey()); | ||
} | ||
|
||
@Override | ||
protected ThEThaumcraftResearchFeature getParentFeature() { | ||
return FeatureRegistry.instance().featureInfusionProvider; | ||
} | ||
|
||
@Override | ||
protected void registerPseudoParents() {} | ||
|
||
@Override | ||
protected void registerResearch() { | ||
// What aspects does research note have | ||
AspectList advancedInfusionProviderList = new AspectList(); | ||
advancedInfusionProviderList.add(Aspect.MECHANISM, 1); | ||
advancedInfusionProviderList.add(Aspect.MAGIC, 1); | ||
advancedInfusionProviderList.add(Aspect.EXCHANGE, 1); | ||
advancedInfusionProviderList.add(Aspect.MOTION, 1); | ||
advancedInfusionProviderList.add(Aspect.TOOL, 1); | ||
advancedInfusionProviderList.add(Aspect.MIND, 1); | ||
advancedInfusionProviderList.add(Aspect.SENSES, 1); | ||
|
||
// Research icon | ||
ItemStack advancedInfusionProviderIcon = new ItemStack(BlockEnum.ADVANCED_INFUSION_PROVIDER.getBlock(), 1); | ||
|
||
// Research Page | ||
ResearchPage[] advancedInfusionProviderPages = new ResearchPage[] { | ||
new ResearchPage(ResearchTypes.ADVANCED_INFUSION_PROVIDER.getPageName(1)), | ||
new ResearchPage(RecipeRegistry.BLOCK_ADVANCED_INFUSION_PROVIDER) }; | ||
|
||
// Create the advanced infusion provider research | ||
ResearchTypes.ADVANCED_INFUSION_PROVIDER.createResearchItem( | ||
advancedInfusionProviderList, | ||
ResearchRegistry.COMPLEXITY_LARGE, | ||
advancedInfusionProviderIcon, | ||
advancedInfusionProviderPages); | ||
|
||
ResearchTypes.ADVANCED_INFUSION_PROVIDER.researchItem.setParents(ResearchTypes.INFUSION_PROVIDER.getKey()); | ||
ResearchTypes.ADVANCED_INFUSION_PROVIDER.researchItem.setConcealed().setSpecial(); | ||
ResearchTypes.ADVANCED_INFUSION_PROVIDER.researchItem.registerResearchItem(); | ||
} | ||
|
||
@Override | ||
protected boolean checkConfigs(IThEConfig theConfig) { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected Object[] getItemReqs(CommonDependantItems cdi) { | ||
return null; | ||
} | ||
|
||
@Override | ||
protected void registerCrafting(CommonDependantItems cdi) { | ||
|
||
ItemStack DiffusionCore = ThEApi.instance().items().DiffusionCore.getStack(); | ||
ItemStack InfusionProvider = ThEApi.instance().blocks().InfusionProvider.getStack(); | ||
ItemStack AdvancedInfusionProvider = ThEApi.instance().blocks().AdvancedInfusionProvider.getStack(); | ||
|
||
// Set required aspects for infusion provider | ||
AspectList advancedInfusionProviderList = new AspectList(); | ||
advancedInfusionProviderList.add(Aspect.MECHANISM, 64); | ||
advancedInfusionProviderList.add(Aspect.MAGIC, 64); | ||
advancedInfusionProviderList.add(Aspect.EXCHANGE, 64); | ||
advancedInfusionProviderList.add(Aspect.MIND, 64); | ||
advancedInfusionProviderList.add(Aspect.GREED, 64); | ||
|
||
ItemStack[] advancedInfusionProviderRecipeItems = { cdi.PrimalCharm, cdi.BallanceShard, DiffusionCore, | ||
cdi.BallanceShard, cdi.PrimalCharm, cdi.BallanceShard, DiffusionCore, cdi.BallanceShard }; | ||
RecipeRegistry.BLOCK_ADVANCED_INFUSION_PROVIDER = ThaumcraftApi.addInfusionCraftingRecipe( | ||
this.researchKey, | ||
AdvancedInfusionProvider, | ||
10, | ||
advancedInfusionProviderList, | ||
InfusionProvider, | ||
advancedInfusionProviderRecipeItems); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.