mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Made impure iron convert in water and in the crusher
This commit is contained in:
parent
05f159f48a
commit
8b433056d2
3 changed files with 100 additions and 1 deletions
|
@ -0,0 +1,92 @@
|
||||||
|
/*
|
||||||
|
* This file ("BlockImpureIron.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.ItemBlockBase;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.gen.cave.CaveWorldType;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheDusts;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.world.WorldServer;
|
||||||
|
|
||||||
|
public class BlockImpureIron extends BlockGeneric{
|
||||||
|
|
||||||
|
public BlockImpureIron(String name){
|
||||||
|
super(name, Material.ROCK, SoundType.STONE, 3.5F, 12.5F, "pickaxe", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ItemBlockBase getItemBlock(){
|
||||||
|
return new TheItemBlock(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TheItemBlock extends ItemBlockBase{
|
||||||
|
|
||||||
|
public TheItemBlock(Block block){
|
||||||
|
super(block);
|
||||||
|
this.setHasSubtypes(false);
|
||||||
|
this.setMaxDamage(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnlocalizedName(ItemStack stack){
|
||||||
|
return this.getUnlocalizedName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetadata(int damage){
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onEntityItemUpdate(EntityItem item){
|
||||||
|
if(item != null && CaveWorldType.isCave(item.getEntityWorld())){
|
||||||
|
if(item.isInWater()){
|
||||||
|
if(!item.getEntityWorld().isRemote){
|
||||||
|
ItemStack stack = item.getEntityItem();
|
||||||
|
if(stack != null){
|
||||||
|
if(!stack.hasTagCompound()){
|
||||||
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
NBTTagCompound compound = stack.getTagCompound();
|
||||||
|
|
||||||
|
int conversionTimer = compound.getInteger("ConversionTimer");
|
||||||
|
if(conversionTimer >= 2000){
|
||||||
|
item.setEntityItemStack(new ItemStack(InitItems.itemDust, 1, TheDusts.IRON.ordinal()));
|
||||||
|
|
||||||
|
if(item.getEntityWorld() instanceof WorldServer){
|
||||||
|
((WorldServer)item.getEntityWorld()).spawnParticle(EnumParticleTypes.SMOKE_NORMAL, item.posX, item.posY, item.posZ, 30, 0D, 0D, 0D, 0.05D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
compound.setInteger("ConversionTimer", conversionTimer+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(item.getEntityWorld().getTotalWorldTime()%20 == 0){
|
||||||
|
item.getEntityWorld().spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, MathHelper.floor_double(item.posX)+Util.RANDOM.nextDouble(), MathHelper.floor_double(item.posY)+Util.RANDOM.nextDouble(), MathHelper.floor_double(item.posZ)+Util.RANDOM.nextDouble(), 0D, 0D, 0D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -123,7 +123,7 @@ public class InitBlocks{
|
||||||
ModUtil.LOGGER.info("Initializing Blocks...");
|
ModUtil.LOGGER.info("Initializing Blocks...");
|
||||||
|
|
||||||
if(ConfigValues.caveWorld){
|
if(ConfigValues.caveWorld){
|
||||||
blockImpureIron = new BlockGeneric("blockImpureIron", Material.ROCK, SoundType.STONE, 3.5F, 12.5F, "pickaxe", 1);
|
blockImpureIron = new BlockImpureIron("blockImpureIron");
|
||||||
}
|
}
|
||||||
|
|
||||||
blockItemViewer = new BlockItemViewer("blockItemViewer");
|
blockItemViewer = new BlockItemViewer("blockItemViewer");
|
||||||
|
|
|
@ -12,8 +12,11 @@ package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheDusts;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
|
||||||
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
|
@ -34,6 +37,10 @@ public class CrusherCrafting{
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing Crusher Recipes...");
|
ModUtil.LOGGER.info("Initializing Crusher Recipes...");
|
||||||
|
|
||||||
|
if(ConfigValues.caveWorld){
|
||||||
|
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitBlocks.blockImpureIron), new ItemStack(InitItems.itemDust, 2, TheDusts.IRON.ordinal()));
|
||||||
|
}
|
||||||
|
|
||||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15));
|
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15));
|
||||||
miscRecipes.add(RecipeUtil.lastCrusherRecipe());
|
miscRecipes.add(RecipeUtil.lastCrusherRecipe());
|
||||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3));
|
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3));
|
||||||
|
|
Loading…
Reference in a new issue