Added a new crafting mechanic, the Empowerer

This commit is contained in:
Ellpeck 2016-08-03 04:01:47 +02:00
parent 12f6430778
commit b31875c38c
49 changed files with 747 additions and 33 deletions

View file

@ -37,6 +37,7 @@ public final class ActuallyAdditionsAPI{
public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<BallOfFurReturn>();
public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<TreasureChestLoot>();
public static final List<LensConversionRecipe> RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<LensConversionRecipe>();
public static final List<EmpowererRecipe> EMPOWERER_RECIPES = new ArrayList<EmpowererRecipe>();
public static final Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<Item, IColorLensChanger>();
public static final List<CoffeeIngredient> COFFEE_MACHINE_INGREDIENTS = new ArrayList<CoffeeIngredient>();
public static final List<CompostRecipe> COMPOST_RECIPES = new ArrayList<CompostRecipe>();
@ -181,6 +182,10 @@ public final class ActuallyAdditionsAPI{
TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
}
public static void addEmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, float[] particleColor){
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, particleColor));
}
/**
* Adds a recipe to the Atomic Reconstructor conversion lenses
* StackSizes can only be 1 and greater ones will be ignored

View file

@ -0,0 +1,38 @@
/*
* This file ("EmpowererRecipe.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.recipe;
import net.minecraft.item.ItemStack;
public class EmpowererRecipe{
public ItemStack input;
public ItemStack output;
public ItemStack modifier1;
public ItemStack modifier2;
public ItemStack modifier3;
public ItemStack modifier4;
public int energyPerStand;
public float[] particleColor;
public EmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, float[] particleColor){
this.input = input;
this.output = output;
this.modifier1 = modifier1;
this.modifier2 = modifier2;
this.modifier3 = modifier3;
this.modifier4 = modifier4;
this.energyPerStand = energyPerStand;
this.particleColor = particleColor;
}
}

View file

@ -35,6 +35,7 @@ import de.ellpeck.actuallyadditions.mod.misc.*;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.ore.InitOreDict;
import de.ellpeck.actuallyadditions.mod.proxy.IProxy;
import de.ellpeck.actuallyadditions.mod.recipe.EmpowererHandler;
import de.ellpeck.actuallyadditions.mod.recipe.FuelHandler;
import de.ellpeck.actuallyadditions.mod.recipe.HairyBallHandler;
import de.ellpeck.actuallyadditions.mod.recipe.TreasureChestHandler;
@ -134,6 +135,7 @@ public class ActuallyAdditions{
HairyBallHandler.init();
TreasureChestHandler.init();
LensRecipeHandler.init();
EmpowererHandler.init();
InitForeignPaxels.init();
InitBooklet.postInit();

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@ -54,6 +55,16 @@ public class BlockDisplayStand extends BlockContainerBase{
player.inventory.decrStackSize(player.inventory.currentItem, 1);
return true;
}
else if(ItemUtil.canBeStacked(heldItem, display)){
int maxTransfer = Math.min(display.stackSize, heldItem.getMaxStackSize()-heldItem.stackSize);
if(maxTransfer > 0){
heldItem.stackSize += maxTransfer;
ItemStack newDisplay = display.copy();
newDisplay.stackSize -= maxTransfer;
stand.setInventorySlotContents(0, newDisplay.stackSize <= 0 ? null : newDisplay);
return true;
}
}
}
else{
if(display != null){

View file

@ -0,0 +1,100 @@
/*
* This file ("BlockQuartzInfuser.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockEmpowerer extends BlockContainerBase{
public BlockEmpowerer(String name){
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta){
return new TileEntityEmpowerer();
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityEmpowerer empowerer = (TileEntityEmpowerer)world.getTileEntity(pos);
if(empowerer != null){
ItemStack stackThere = empowerer.getStackInSlot(0);
if(heldItem != null){
if(stackThere == null && TileEntityEmpowerer.getRecipeForInput(heldItem) != null){
ItemStack toPut = heldItem.copy();
toPut.stackSize = 1;
empowerer.setInventorySlotContents(0, toPut);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
return true;
}
else if(ItemUtil.canBeStacked(heldItem, stackThere)){
int maxTransfer = Math.min(stackThere.stackSize, heldItem.getMaxStackSize()-heldItem.stackSize);
if(maxTransfer > 0){
heldItem.stackSize += maxTransfer;
ItemStack newStackThere = stackThere.copy();
newStackThere.stackSize -= maxTransfer;
empowerer.setInventorySlotContents(0, newStackThere.stackSize <= 0 ? null : newStackThere);
return true;
}
}
}
else{
if(stackThere != null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, stackThere.copy());
empowerer.setInventorySlotContents(0, null);
return true;
}
}
}
return false;
}
else{
return true;
}
}
@Override
public boolean isOpaqueCube(IBlockState state){
return false;
}
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state){
this.dropInventory(worldIn, pos);
super.breakBlock(worldIn, pos, state);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
}

View file

@ -104,6 +104,7 @@ public final class InitBlocks{
public static Block blockBlackLotus;
public static Block blockCrystal;
public static Block blockCrystalEmpowered;
public static Block blockAtomicReconstructor;
public static Block blockMiner;
@ -123,12 +124,14 @@ public final class InitBlocks{
public static Block blockBookletStand;
public static Block blockDisplayStand;
public static Block blockShockSuppressor;
public static Block blockEmpowerer;
public static Block blockTinyTorch;
public static void init(){
ModUtil.LOGGER.info("Initializing Blocks...");
blockEmpowerer = new BlockEmpowerer("blockEmpowerer");
blockTinyTorch = new BlockTinyTorch("blockTinyTorch");
blockShockSuppressor = new BlockShockSuppressor("blockShockSuppressor");
blockDisplayStand = new BlockDisplayStand("blockDisplayStand");
@ -139,6 +142,7 @@ public final class InitBlocks{
blockMiner = new BlockMiner("blockMiner");
blockAtomicReconstructor = new BlockAtomicReconstructor("blockAtomicReconstructor");
blockCrystal = new BlockCrystal("blockCrystal");
blockCrystalEmpowered = new BlockCrystal("blockCrystalEmpowered");
blockBlackLotus = new BlockBlackLotus("blockBlackLotus");
blockLaserRelay = new BlockLaserRelay("blockLaserRelay", Type.ENERGY_BASIC);
blockLaserRelayAdvanced = new BlockLaserRelay("blockLaserRelayAdvanced", Type.ENERGY_ADVANCED);

View file

@ -0,0 +1,53 @@
/*
* This file ("RenderEmpowerer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.render;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
public class RenderEmpowerer extends TileEntitySpecialRenderer{
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int par6){
if(!(tile instanceof TileEntityEmpowerer)){
return;
}
ItemStack stack = ((TileEntityEmpowerer)tile).getStackInSlot(0);
if(stack != null){
GlStateManager.pushMatrix();
GlStateManager.translate((float)x+0.5F, (float)y+1F, (float)z+0.5F);
double boop = Minecraft.getSystemTime()/800D;
GlStateManager.translate(0D, Math.sin(boop%(2*Math.PI))*0.065, 0D);
GlStateManager.rotate((float)(((boop*40D)%360)), 0, 1, 0);
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
GlStateManager.scale(scale, scale, scale);
try{
AssetUtil.renderItemInWorld(stack);
}
catch(Exception e){
ModUtil.LOGGER.error("Something went wrong trying to render an item in an empowerer! The item is "+stack.getItem().getRegistryName()+"!", e);
}
GlStateManager.popMatrix();
}
}
}

View file

@ -62,6 +62,7 @@ public class CreativeTab extends CreativeTabs{
this.add(InitBlocks.blockLaserRelayItemWhitelist);
this.add(InitBlocks.blockItemViewer);
this.add(InitBlocks.blockAtomicReconstructor);
this.add(InitBlocks.blockEmpowerer);
this.add(InitBlocks.blockPhantomface);
this.add(InitBlocks.blockPhantomEnergyface);
this.add(InitBlocks.blockPhantomLiquiface);
@ -217,7 +218,9 @@ public class CreativeTab extends CreativeTabs{
InitForeignPaxels.addToCreativeTab();
this.add(InitBlocks.blockCrystal);
this.add(InitBlocks.blockCrystalEmpowered);
this.add(InitItems.itemCrystal);
this.add(InitItems.itemCrystalEmpowered);
this.add(InitItems.itemJams);

View file

@ -135,6 +135,7 @@ public final class InitItems{
public static Item itemLaserWrench;
public static Item itemCrystal;
public static Item itemCrystalEmpowered;
public static Item itemColorLens;
public static Item itemExplosionLens;
public static Item itemDamageLens;
@ -231,6 +232,7 @@ public final class InitItems{
itemDamageLens = new ItemLens("itemDamageLens", ActuallyAdditionsAPI.lensDeath);
itemDisenchantingLens = new ItemLens("itemDisenchantingLens", ActuallyAdditionsAPI.lensDisenchanting);
itemCrystal = new ItemCrystal("itemCrystal");
itemCrystalEmpowered = new ItemCrystal("itemCrystalEmpowered");
itemLaserWrench = new ItemLaserWrench("itemLaserWrench");
itemChestToCrateUpgrade = new ItemChestToCrateUpgrade("itemChestToCrateUpgrade");
itemBooklet = new ItemBooklet("itemBooklet");

View file

@ -34,7 +34,7 @@ public class LensColor extends Lens{
public static final int ENERGY_USE = 200;
//Thanks to xdjackiexd for this, as I couldn't be bothered
private static final float[][] POSSIBLE_COLORS = {
public static final float[][] POSSIBLE_COLORS = {
{158F, 43F, 39F}, //Red
{234F, 126F, 53F}, //Orange
{194F, 181F, 28F}, //Yellow

View file

@ -15,18 +15,20 @@ import net.minecraft.item.EnumRarity;
public enum TheCrystals{
REDSTONE("Red", Util.CRYSTAL_RED_RARITY),
LAPIS("Blue", Util.CRYSTAL_BLUE_RARITY),
DIAMOND("LightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY),
COAL("Black", Util.CRYSTAL_BLACK_RARITY),
EMERALD("Green", Util.CRYSTAL_GREEN_RARITY),
IRON("White", Util.CRYSTAL_WHITE_RARITY);
REDSTONE("Red", Util.CRYSTAL_RED_RARITY, 158F/255F, 43F/255F, 39F/255F),
LAPIS("Blue", Util.CRYSTAL_BLUE_RARITY, 37F/255F, 49F/255F, 147F/255F),
DIAMOND("LightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY, 99F/255F, 135F/255F, 210F/255F),
COAL("Black", Util.CRYSTAL_BLACK_RARITY, 0.2F, 0.2F, 0.2F),
EMERALD("Green", Util.CRYSTAL_GREEN_RARITY, 54F/255F, 75F/255F, 24F/255F),
IRON("White", Util.CRYSTAL_WHITE_RARITY, 0.8F, 0.8F, 0.8F);
public final String name;
public final EnumRarity rarity;
public final float[] conversionColorParticles;
TheCrystals(String name, EnumRarity rarity){
TheCrystals(String name, EnumRarity rarity, float... conversionColorParticles){
this.name = name;
this.rarity = rarity;
this.conversionColorParticles = conversionColorParticles;
}
}

View file

@ -24,6 +24,8 @@ import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeCategory;
import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeHandler;
import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherRecipeCategory;
import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherRecipeHandler;
import de.ellpeck.actuallyadditions.mod.jei.empowerer.EmpowererRecipeCategory;
import de.ellpeck.actuallyadditions.mod.jei.empowerer.EmpowererRecipeHandler;
import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeCategory;
import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeHandler;
import de.ellpeck.actuallyadditions.mod.util.Util;
@ -43,20 +45,23 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin{
new BookletRecipeCategory(helpers.getGuiHelper()),
new CoffeeMachineRecipeCategory(helpers.getGuiHelper()),
new CrusherRecipeCategory(helpers.getGuiHelper()),
new ReconstructorRecipeCategory(helpers.getGuiHelper())
new ReconstructorRecipeCategory(helpers.getGuiHelper()),
new EmpowererRecipeCategory(helpers.getGuiHelper())
);
registry.addRecipeHandlers(
new BookletRecipeHandler(),
new CoffeeMachineRecipeHandler(),
new CrusherRecipeHandler(),
new ReconstructorRecipeHandler()
new ReconstructorRecipeHandler(),
new EmpowererRecipeHandler()
);
registry.addRecipes(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_DATA);
registry.addRecipes(ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS);
registry.addRecipes(ActuallyAdditionsAPI.CRUSHER_RECIPES);
registry.addRecipes(ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES);
registry.addRecipes(ActuallyAdditionsAPI.EMPOWERER_RECIPES);
registry.addRecipeClickArea(GuiCoffeeMachine.class, 53, 42, 22, 16, CoffeeMachineRecipeCategory.NAME);
registry.addRecipeClickArea(GuiGrinder.class, 80, 40, 24, 22, CrusherRecipeCategory.NAME);
@ -81,6 +86,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin{
registry.addRecipeCategoryCraftingItem(new ItemStack(InitBlocks.blockGrinderDouble), CrusherRecipeCategory.NAME);
registry.addRecipeCategoryCraftingItem(new ItemStack(InitBlocks.blockCoffeeMachine), CoffeeMachineRecipeCategory.NAME);
registry.addRecipeCategoryCraftingItem(new ItemStack(InitBlocks.blockAtomicReconstructor), ReconstructorRecipeCategory.NAME);
registry.addRecipeCategoryCraftingItem(new ItemStack(InitBlocks.blockEmpowerer), EmpowererRecipeCategory.NAME);
registry.addRecipeCategoryCraftingItem(new ItemStack(InitItems.itemBooklet), BookletRecipeCategory.NAME);
}

View file

@ -69,12 +69,12 @@ public class CrusherRecipeCategory implements IRecipeCategory{
recipeLayout.getItemStacks().init(0, true, 19, 7);
recipeLayout.getItemStacks().set(0, RecipeUtil.getCrusherRecipeInputs(wrapper.theRecipe));
recipeLayout.getItemStacks().init(1, true, 7, 55);
recipeLayout.getItemStacks().init(1, false, 7, 55);
recipeLayout.getItemStacks().set(1, RecipeUtil.getCrusherRecipeOutputOnes(wrapper.theRecipe));
List<ItemStack> outputTwos = RecipeUtil.getCrusherRecipeOutputTwos(wrapper.theRecipe);
if(outputTwos != null && !outputTwos.isEmpty()){
recipeLayout.getItemStacks().init(2, true, 31, 55);
recipeLayout.getItemStacks().init(2, false, 31, 55);
recipeLayout.getItemStacks().set(2, outputTwos);
}
}

View file

@ -0,0 +1,84 @@
/*
* This file ("ReconstructorRecipeCategory.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.jei.empowerer;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
public class EmpowererRecipeCategory implements IRecipeCategory{
public static final String NAME = "actuallyadditions.empowerer";
private final IDrawable background;
public EmpowererRecipeCategory(IGuiHelper helper){
this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEIEmpowerer"), 0, 0, 135, 80);
}
@Override
public String getUid(){
return NAME;
}
@Override
public String getTitle(){
return StringUtil.localize("container.nei."+NAME+".name");
}
@Override
public IDrawable getBackground(){
return this.background;
}
@Override
public void drawExtras(Minecraft minecraft){
}
@Override
public void drawAnimations(Minecraft minecraft){
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper){
if(recipeWrapper instanceof EmpowererRecipeWrapper){
EmpowererRecipeWrapper wrapper = (EmpowererRecipeWrapper)recipeWrapper;
recipeLayout.getItemStacks().init(0, true, 31, 31);
recipeLayout.getItemStacks().set(0, wrapper.theRecipe.input);
recipeLayout.getItemStacks().init(1, true, 1, 31);
recipeLayout.getItemStacks().set(1, wrapper.theRecipe.modifier1);
recipeLayout.getItemStacks().init(2, true, 31, 1);
recipeLayout.getItemStacks().set(2, wrapper.theRecipe.modifier2);
recipeLayout.getItemStacks().init(3, true, 61, 31);
recipeLayout.getItemStacks().set(3, wrapper.theRecipe.modifier3);
recipeLayout.getItemStacks().init(4, true, 31, 61);
recipeLayout.getItemStacks().set(4, wrapper.theRecipe.modifier4);
recipeLayout.getItemStacks().init(5, false, 112, 31);
recipeLayout.getItemStacks().set(5, wrapper.theRecipe.output);
}
}
}

View file

@ -0,0 +1,43 @@
/*
* This file ("ReconstructorRecipeHandler.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.jei.empowerer;
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
public class EmpowererRecipeHandler implements IRecipeHandler<EmpowererRecipe>{
@Override
public Class getRecipeClass(){
return EmpowererRecipe.class;
}
@Override
public String getRecipeCategoryUid(){
return EmpowererRecipeCategory.NAME;
}
@Override
public String getRecipeCategoryUid(EmpowererRecipe recipe){
return this.getRecipeCategoryUid();
}
@Override
public IRecipeWrapper getRecipeWrapper(EmpowererRecipe recipe){
return new EmpowererRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(EmpowererRecipe recipe){
return true;
}
}

View file

@ -0,0 +1,94 @@
/*
* This file ("ReconstructorRecipeWrapper.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.jei.empowerer;
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class EmpowererRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
public final EmpowererRecipe theRecipe;
public EmpowererRecipeWrapper(EmpowererRecipe recipe){
this.theRecipe = recipe;
}
@Override
public List getInputs(){
return Arrays.asList(this.theRecipe.input, this.theRecipe.modifier1, this.theRecipe.modifier2, this.theRecipe.modifier3, this.theRecipe.modifier4);
}
@Override
public List getOutputs(){
return Collections.singletonList(this.theRecipe.output);
}
@Override
public List<FluidStack> getFluidInputs(){
return new ArrayList<FluidStack>();
}
@Override
public List<FluidStack> getFluidOutputs(){
return new ArrayList<FluidStack>();
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
this.updateButton(minecraft, mouseX, mouseY);
}
@Override
public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight){
}
@Nullable
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY){
return null;
}
@Override
public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){
return this.handleClick(minecraft, mouseX, mouseY);
}
@Override
public int getButtonX(){
return 2;
}
@Override
public int getButtonY(){
return 2;
}
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockEmpowerer));
}
}

View file

@ -69,7 +69,7 @@ public class ReconstructorRecipeCategory implements IRecipeCategory{
recipeLayout.getItemStacks().init(0, true, 4, 18);
recipeLayout.getItemStacks().set(0, RecipeUtil.getConversionLensInputs(wrapper.theRecipe));
recipeLayout.getItemStacks().init(1, true, 66, 18);
recipeLayout.getItemStacks().init(1, false, 66, 18);
recipeLayout.getItemStacks().set(1, RecipeUtil.getConversionLensOutputs(wrapper.theRecipe));
}

View file

@ -21,7 +21,7 @@ public class ParticleColored extends ParticleRedstone{
public ParticleColored(World world, double x, double y, double z, float size, float r, float g, float b, float ageMulti){
super(world, x, y, z, size, r, g, b);
//To work around Reddust particles resetting the color to red if it's 0 (which is really stupid to be honest)
this.particleRed = ((float)(Math.random()*0.20000000298023224D)+0.8F)*r*((float)Math.random()*0.4F+0.6F);
this.particleRed = ((float)(Math.random()*0.2)+0.8F)*r*((float)Math.random()*0.4F+0.6F);
this.particleMaxAge = (int)((8.0D/(Math.random()*0.8D+0.2D))*ageMulti);
}
}

View file

@ -15,19 +15,13 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderCompost;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderDisplayStand;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderReconstructorLens;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderSmileyCloud;
import de.ellpeck.actuallyadditions.mod.blocks.render.*;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
import de.ellpeck.actuallyadditions.mod.event.ClientEvents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand;
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper;
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
@ -164,6 +158,7 @@ public class ClientProxy implements IProxy{
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAtomicReconstructor.class, new RenderReconstructorLens());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDisplayStand.class, new RenderDisplayStand());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEmpowerer.class, new RenderEmpowerer());
//VillagerRegistry.INSTANCE().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID, "textures/entity/villager/jamVillager.png"));

View file

@ -0,0 +1,31 @@
/*
* This file ("EmpowererHandler.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.recipe;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import net.minecraft.item.ItemStack;
public final class EmpowererHandler{
public static void init(){
ItemStack m = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal());
for(int i = 0; i < TheCrystals.values().length; i++){
float[] color = TheCrystals.values()[i].conversionColorParticles;
ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitItems.itemCrystal, 1, i), new ItemStack(InitItems.itemCrystalEmpowered, 1, i), m, m, m, m, 50000, color);
ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitBlocks.blockCrystal, 1, i), new ItemStack(InitBlocks.blockCrystalEmpowered, 1, i), m, m, m, m, 500000, color);
}
}
}

View file

@ -44,7 +44,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
if(!ConfigBoolValues.LESS_SOUND.isEnabled()){
world.playSound(null, startX, startY, startZ, SoundHandler.reconstructor, SoundCategory.BLOCKS, 0.35F, 1.0F);
}
AssetUtil.shootParticles(world, startX, startY, startZ, endX, endY, endZ, currentLens.getColor(), ConfigBoolValues.LESS_PARTICLES.isEnabled() ? 2 : 8, 2F);
AssetUtil.shootParticles(world, startX, startY, startZ, endX, endY, endZ, currentLens.getColor(), ConfigBoolValues.LESS_PARTICLES.isEnabled() ? 2 : 8, 2F, 1F);
}
@Override

View file

@ -51,6 +51,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
public static void init(){
ModUtil.LOGGER.info("Registering TileEntities...");
//TODO Remove legacy names at some point
register(TileEntityCompost.class, "Compost");
register(TileEntityFeeder.class, "Feeder");
register(TileEntityGiantChest.class, "GiantChest");
@ -104,6 +105,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
register(TileEntityBookletStand.class, "BookletStand");
register(TileEntityDisplayStand.class, "DisplayStand");
register(TileEntityShockSuppressor.class, "ShockSuppressor");
register(TileEntityEmpowerer.class);
}
private static void register(Class<? extends TileEntityBase> tileClass, String legacyName){

View file

@ -22,7 +22,7 @@ import net.minecraft.util.EnumFacing;
public class TileEntityDisplayStand extends TileEntityInventoryBase implements IEnergyDisplay, IEnergyReceiver{
private final EnergyStorage storage = new EnergyStorage(300000);
public final EnergyStorage storage = new EnergyStorage(800000);
private int oldEnergy;
public TileEntityDisplayStand(){

View file

@ -0,0 +1,163 @@
/*
* This file ("TileEntityEmpowerer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import java.util.Arrays;
import java.util.List;
public class TileEntityEmpowerer extends TileEntityInventoryBase{
private int processTime;
public TileEntityEmpowerer(){
super(1, "empowerer");
}
@Override
public void updateEntity(){
super.updateEntity();
if(!this.worldObj.isRemote){
EmpowererRecipe recipe = getRecipeForInput(this.slots[0]);
if(recipe != null){
int processTimeGoal = 150;
TileEntityDisplayStand[] modifierStands = this.getFittingModifiers(recipe, processTimeGoal);
if(modifierStands != null){ //Meaning the display stands around match all the criteria
this.processTime++;
boolean done = this.processTime >= processTimeGoal;
for(TileEntityDisplayStand stand : modifierStands){
if(done){
stand.decrStackSize(0, 1);
((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.END_ROD, false, this.pos.getX()+0.5, this.pos.getY()+1.1, this.pos.getZ()+0.5, 30, 0, 0, 0, 0.25D);
}
stand.storage.extractEnergy(recipe.energyPerStand/processTimeGoal, false);
if(this.processTime%5 == 0 && this.worldObj instanceof WorldServer){
((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, false, this.pos.getX()+0.5, this.pos.getY()+1.1, this.pos.getZ()+0.5, 1, 0, 0, 0, 0.1D);
}
AssetUtil.shootParticles(this.worldObj, stand.getPos().getX(), stand.getPos().getY()+0.45F, stand.getPos().getZ(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), recipe.particleColor, 8, 0.5F, 1F);
}
if(done){
this.slots[0] = recipe.output.copy();
this.markDirty();
this.processTime = 0;
}
}
}
else{
this.processTime = 0;
}
}
}
private TileEntityDisplayStand[] getFittingModifiers(EmpowererRecipe recipe, int powerDivider){
TileEntityDisplayStand[] modifierStands = new TileEntityDisplayStand[4];
List<ItemStack> itemsStillNeeded = Arrays.asList(recipe.modifier1, recipe.modifier2, recipe.modifier3, recipe.modifier4);
for(int i = 0; i < EnumFacing.HORIZONTALS.length; i++){
EnumFacing facing = EnumFacing.HORIZONTALS[i];
BlockPos offset = this.pos.offset(facing, 2);
TileEntity tile = this.worldObj.getTileEntity(offset);
if(tile != null && tile instanceof TileEntityDisplayStand){
TileEntityDisplayStand stand = (TileEntityDisplayStand)tile;
ItemStack standItem = stand.getStackInSlot(0);
if(stand.storage.getEnergyStored() >= recipe.energyPerStand/powerDivider && ItemUtil.contains(itemsStillNeeded, standItem, true)){
modifierStands[i] = stand;
itemsStillNeeded.remove(standItem);
}
else{
return null;
}
}
else{
return null;
}
}
return modifierStands;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
super.writeSyncableNBT(compound, type);
if(type == NBTType.SAVE_TILE){
compound.setInteger("ProcessTime", this.processTime);
}
}
@Override
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
super.readSyncableNBT(compound, type);
if(type == NBTType.SAVE_TILE){
this.processTime = compound.getInteger("ProcessTime");
}
}
public static EmpowererRecipe getRecipeForInput(ItemStack input){
if(input != null){
for(EmpowererRecipe recipe : ActuallyAdditionsAPI.EMPOWERER_RECIPES){
if(recipe.input != null && recipe.input.isItemEqual(input)){
return recipe;
}
}
}
return null;
}
@Override
public boolean shouldSyncSlots(){
return true;
}
@Override
public void markDirty(){
super.markDirty();
this.sendUpdate();
}
@Override
public boolean isItemValidForSlot(int index, ItemStack stack){
return getRecipeForInput(stack) != null;
}
@Override
public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction){
return this.isItemValidForSlot(index, stack);
}
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction){
return getRecipeForInput(stack) == null;
}
@Override
public int getInventoryStackLimit(){
return 1;
}
}

View file

@ -84,7 +84,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
this.storage.receiveEnergy(ENERGY_PRODUCED, false);
if(!ConfigBoolValues.LESS_PARTICLES.isEnabled()){
AssetUtil.shootParticles(this.worldObj, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F);
AssetUtil.shootParticles(this.worldObj, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F, 1F);
}
}
}

View file

@ -169,7 +169,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
private void shootParticles(int endX, int endY, int endZ){
if(!ConfigBoolValues.LESS_PARTICLES.isEnabled()){
AssetUtil.shootParticles(this.worldObj, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F);
AssetUtil.shootParticles(this.worldObj, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F, 1F);
}
}

View file

@ -163,7 +163,7 @@ public final class AssetUtil{
GlStateManager.popMatrix();
}
public static void shootParticles(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int particleAmount, float particleSize){
public static void shootParticles(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int particleAmount, float particleSize, float ageMultiplier){
if(!world.isRemote){
NBTTagCompound data = new NBTTagCompound();
data.setDouble("StartX", startX);
@ -177,7 +177,7 @@ public final class AssetUtil{
data.setFloat("Color3", color[2]);
data.setInteger("ParticleAmount", particleAmount);
data.setFloat("ParticleSize", particleSize);
data.setFloat("AgeMultiplier", 1F);
data.setFloat("AgeMultiplier", ageMultiplier);
PacketHandler.theNetwork.sendToAllAround(new PacketServerToClient(data, PacketHandler.PARTICLE_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96));
}
}

View file

@ -21,6 +21,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
import java.util.Arrays;
import java.util.List;
@ -66,13 +67,17 @@ public final class ItemUtil{
return getPlaceAt(array, stack, checkWildcard) != -1;
}
public static int getPlaceAt(ItemStack[] array, ItemStack stack, boolean checkWildcard){
return getPlaceAt(Arrays.asList(array), stack, checkWildcard);
}
/**
* Returns the place of stack in array, -1 if not present
*/
public static int getPlaceAt(ItemStack[] array, ItemStack stack, boolean checkWildcard){
if(array != null && array.length > 0){
for(int i = 0; i < array.length; i++){
if((stack == null && array[i] == null) || areItemsEqual(stack, array[i], checkWildcard)){
public static int getPlaceAt(List<ItemStack> list, ItemStack stack, boolean checkWildcard){
if(list != null && list.size() > 0){
for(int i = 0; i < list.size(); i++){
if((stack == null && list.get(i) == null) || areItemsEqual(stack, list.get(i), checkWildcard)){
return i;
}
}
@ -88,7 +93,7 @@ public final class ItemUtil{
* Returns true if list contains stack or if both contain null
*/
public static boolean contains(List<ItemStack> list, ItemStack stack, boolean checkWildcard){
return !(list == null || list.isEmpty()) && getPlaceAt(list.toArray(new ItemStack[list.size()]), stack, checkWildcard) != -1;
return !(list == null || list.isEmpty()) && getPlaceAt(list, stack, checkWildcard) != -1;
}
public static void addEnchantment(ItemStack stack, Enchantment e, int level){

View file

@ -0,0 +1,19 @@
{
"forge_marker": 1,
"defaults": {
"model": "minecraft:cube_all",
"transform": "forge:default-block"
},
"variants": {
"normal": [{}],
"inventory": [{}],
"meta": {
"0": { "textures" : { "all" : "actuallyadditions:blocks/blockCrystalEmpoweredRed" } },
"1": { "textures" : { "all" : "actuallyadditions:blocks/blockCrystalEmpoweredBlue" } },
"2": { "textures" : { "all" : "actuallyadditions:blocks/blockCrystalEmpoweredLightBlue" } },
"3": { "textures" : { "all" : "actuallyadditions:blocks/blockCrystalEmpoweredBlack" } },
"4": { "textures" : { "all" : "actuallyadditions:blocks/blockCrystalEmpoweredGreen" } },
"5": { "textures" : { "all" : "actuallyadditions:blocks/blockCrystalEmpoweredWhite" } }
}
}
}

View file

@ -0,0 +1,16 @@
{
"forge_marker": 1,
"defaults": {
"model": "minecraft:half_slab",
"textures": {
"bottom": "actuallyadditions:blocks/blockEmpowerer",
"top": "#bottom",
"side": "actuallyadditions:blocks/blockEmpowererSide"
},
"transform": "forge:default-block"
},
"variants": {
"normal": [{}],
"inventory": [{}]
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "actuallyadditions:item/standardItem",
"textures": {
"layer0": "actuallyadditions:items/itemCrystalEmpoweredBlack"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "actuallyadditions:item/standardItem",
"textures": {
"layer0": "actuallyadditions:items/itemCrystalEmpoweredBlue"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "actuallyadditions:item/standardItem",
"textures": {
"layer0": "actuallyadditions:items/itemCrystalEmpoweredGreen"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "actuallyadditions:item/standardItem",
"textures": {
"layer0": "actuallyadditions:items/itemCrystalEmpoweredLightBlue"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "actuallyadditions:item/standardItem",
"textures": {
"layer0": "actuallyadditions:items/itemCrystalEmpoweredRed"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "actuallyadditions:item/standardItem",
"textures": {
"layer0": "actuallyadditions:items/itemCrystalEmpoweredWhite"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B