mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
added crystal chisel, intro text to cave mode, tweaks
This commit is contained in:
parent
ab816a52d4
commit
d4598b3ff3
10 changed files with 189 additions and 29 deletions
|
@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -37,12 +38,12 @@ public class RenderCompost extends TileEntitySpecialRenderer{
|
||||||
Block display = null;
|
Block display = null;
|
||||||
int maxAmount = 0;
|
int maxAmount = 0;
|
||||||
for(CompostRecipe aRecipe : ActuallyAdditionsAPI.COMPOST_RECIPES){
|
for(CompostRecipe aRecipe : ActuallyAdditionsAPI.COMPOST_RECIPES){
|
||||||
if(slot.isItemEqual(aRecipe.input)){
|
if(ItemUtil.areItemsEqual(slot, aRecipe.input, true)){
|
||||||
display = aRecipe.inputDisplay;
|
display = aRecipe.inputDisplay;
|
||||||
maxAmount = aRecipe.input.getMaxStackSize();
|
maxAmount = aRecipe.input.getMaxStackSize();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(slot.isItemEqual(aRecipe.output)){
|
else if(ItemUtil.areItemsEqual(slot, aRecipe.output, true)){
|
||||||
display = aRecipe.outputDisplay;
|
display = aRecipe.outputDisplay;
|
||||||
maxAmount = aRecipe.output.getMaxStackSize();
|
maxAmount = aRecipe.output.getMaxStackSize();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -16,17 +16,24 @@ import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
|
||||||
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
||||||
import de.ellpeck.actuallyadditions.mod.gen.WorldGenLushCaves;
|
import de.ellpeck.actuallyadditions.mod.gen.WorldGenLushCaves;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.init.MobEffects;
|
import net.minecraft.init.MobEffects;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.management.PlayerList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -35,27 +42,42 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class CaveEvents{
|
public class CaveEvents{
|
||||||
|
|
||||||
private static final int TRIES_BEFORE_FAILURE = 500;
|
private static final int TRIES_BEFORE_FAILURE = 100;
|
||||||
private static final int DISTANCE_INBETWEEN = 1000;
|
private static final int DISTANCE_INBETWEEN = 1000;
|
||||||
private static final int CAVE_SPAWN_SPREAD = 50000;
|
private static final int CAVE_SPAWN_SPREAD = 10000;
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPlayerUpdate(PlayerTickEvent event){
|
public void onPlayerUpdate(PlayerTickEvent event){
|
||||||
EntityPlayer player = event.player;
|
if(event.phase == Phase.END){
|
||||||
if(!player.world.isRemote){
|
EntityPlayer player = event.player;
|
||||||
if(WorldTypeCave.is(player.world)){
|
if(!player.world.isRemote){
|
||||||
WorldData data = WorldData.get(player.world);
|
if(WorldTypeCave.is(player.world)){
|
||||||
if(data != null){
|
WorldData worldData = WorldData.get(player.world);
|
||||||
BlockPos spawn = data.generatedCaves.get(player.getUniqueID());
|
if(worldData != null){
|
||||||
if(spawn == null){
|
BlockPos spawn = worldData.generatedCaves.get(player.getUniqueID());
|
||||||
BlockPos cavePos = generateCave(player, data.generatedCaves);
|
if(spawn == null){
|
||||||
|
generateCave(player, worldData.generatedCaves, worldData);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(player.posY >= player.world.getHeight()){
|
||||||
|
putPlayerInCave(player, spawn, worldData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data.generatedCaves.put(player.getUniqueID(), cavePos);
|
PlayerSave playerData = PlayerData.getDataFromPlayer(player);
|
||||||
data.markDirty();
|
if(playerData != null){
|
||||||
}
|
if(player.ticksExisted >= 100){
|
||||||
else{
|
if(playerData.receivedCaveMessages < 11){
|
||||||
if(player.posY >= player.world.getHeight()){
|
if(player.world.getTotalWorldTime()%50 == 0){
|
||||||
putPlayerInCave(player, spawn);
|
TextComponentTranslation text = new TextComponentTranslation("info."+ModUtil.MOD_ID+".cave.whisper."+(playerData.receivedCaveMessages+1));
|
||||||
|
text.getStyle().setColor(TextFormatting.GRAY).setItalic(true);
|
||||||
|
player.sendMessage(text);
|
||||||
|
|
||||||
|
playerData.receivedCaveMessages++;
|
||||||
|
worldData.markDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,10 +85,16 @@ public class CaveEvents{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BlockPos generateCave(EntityPlayer player, Map<UUID, BlockPos> generatedCaves){
|
private static BlockPos generateCave(EntityPlayer player, Map<UUID, BlockPos> generatedCaves, WorldData data){
|
||||||
|
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||||
|
PlayerList list = server.getPlayerList();
|
||||||
|
|
||||||
BlockPos worldSpawn = player.world.getSpawnPoint();
|
BlockPos worldSpawn = player.world.getSpawnPoint();
|
||||||
Random rand = new Random(player.world.getSeed());
|
Random rand = new Random(player.world.getSeed());
|
||||||
|
|
||||||
|
TextComponentString prefix = new TextComponentString("["+TextFormatting.GREEN+ModUtil.NAME+TextFormatting.RESET+"] ");
|
||||||
|
list.sendChatMsg(prefix.createCopy().appendSibling(new TextComponentTranslation("info."+ModUtil.MOD_ID+".cave.generating", player.getName())));
|
||||||
|
|
||||||
BlockPos spawn = null;
|
BlockPos spawn = null;
|
||||||
tries:
|
tries:
|
||||||
for(int i = 0; i < TRIES_BEFORE_FAILURE; i++){
|
for(int i = 0; i < TRIES_BEFORE_FAILURE; i++){
|
||||||
|
@ -85,6 +113,9 @@ public class CaveEvents{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.generatedCaves.put(player.getUniqueID(), spawn);
|
||||||
|
data.markDirty();
|
||||||
|
|
||||||
int chunkX = spawn.getX() >> 4;
|
int chunkX = spawn.getX() >> 4;
|
||||||
int chunkZ = spawn.getZ() >> 4;
|
int chunkZ = spawn.getZ() >> 4;
|
||||||
for(int x = -12; x <= 12; x++){
|
for(int x = -12; x <= 12; x++){
|
||||||
|
@ -94,17 +125,35 @@ public class CaveEvents{
|
||||||
}
|
}
|
||||||
|
|
||||||
StructureBoundingBox box = new StructureBoundingBox(spawn.getX()-7, 0, spawn.getZ()-7, spawn.getX()+7, player.world.getHeight(), spawn.getZ()+7);
|
StructureBoundingBox box = new StructureBoundingBox(spawn.getX()-7, 0, spawn.getZ()-7, spawn.getX()+7, player.world.getHeight(), spawn.getZ()+7);
|
||||||
new WorldGenLushCaves().generate(player.world, rand, spawn, box);
|
new WorldGenLushCaves(){
|
||||||
|
private int crystalCounter;
|
||||||
|
|
||||||
putPlayerInCave(player, spawn);
|
@Override
|
||||||
|
protected Block getClusterToPlace(Random rand){
|
||||||
|
this.crystalCounter++;
|
||||||
|
if(this.crystalCounter >= CRYSTAL_CLUSTERS.length){
|
||||||
|
this.crystalCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CRYSTAL_CLUSTERS[this.crystalCounter];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldTryGenCluster(Random rand){
|
||||||
|
return rand.nextInt(3) == 0;
|
||||||
|
}
|
||||||
|
}.generate(player.world, rand, spawn, box);
|
||||||
|
|
||||||
|
putPlayerInCave(player, spawn, data);
|
||||||
|
|
||||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
|
||||||
server.saveAllWorlds(false);
|
server.saveAllWorlds(false);
|
||||||
|
|
||||||
|
list.sendChatMsg(prefix.appendSibling(new TextComponentTranslation("info."+ModUtil.MOD_ID+".cave.generated", player.getName())));
|
||||||
|
|
||||||
return spawn;
|
return spawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void putPlayerInCave(EntityPlayer player, BlockPos spawn){
|
private static void putPlayerInCave(EntityPlayer player, BlockPos spawn, WorldData data){
|
||||||
if(!player.isSpectator() && player instanceof EntityPlayerMP){
|
if(!player.isSpectator() && player instanceof EntityPlayerMP){
|
||||||
player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 400, 4));
|
player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 400, 4));
|
||||||
player.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 400));
|
player.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 400));
|
||||||
|
@ -116,7 +165,7 @@ public class CaveEvents{
|
||||||
player.inventory.addItemStackToInventory(new ItemStack(InitBlocks.blockTinyTorch, 2));
|
player.inventory.addItemStackToInventory(new ItemStack(InitBlocks.blockTinyTorch, 2));
|
||||||
|
|
||||||
save.bookGottenAlready = true;
|
save.bookGottenAlready = true;
|
||||||
WorldData.get(player.world).markDirty();
|
data.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
((EntityPlayerMP)player).connection.setPlayerLocation(spawn.getX()+0.5, spawn.getY()+1, spawn.getZ()+0.5, 0F, 0F);
|
((EntityPlayerMP)player).connection.setPlayerLocation(spawn.getX()+0.5, spawn.getY()+1, spawn.getZ()+0.5, 0F, 0F);
|
||||||
|
|
|
@ -11,11 +11,13 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.*;
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.*;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
@ -54,6 +56,11 @@ public final class InitCrafting{
|
||||||
|
|
||||||
GameRegistry.addRecipe(new RecipeBioMash());
|
GameRegistry.addRecipe(new RecipeBioMash());
|
||||||
RecipeSorter.register(ModUtil.MOD_ID+":recipeBioMash", RecipeBioMash.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
|
RecipeSorter.register(ModUtil.MOD_ID+":recipeBioMash", RecipeBioMash.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
|
||||||
|
|
||||||
|
if(ActuallyAdditions.isCaveMode){
|
||||||
|
ActuallyAdditionsAPI.addCompostRecipe(new ItemStack(Blocks.LEAVES, 1, Util.WILDCARD), Blocks.LEAVES, new ItemStack(Blocks.DIRT), Blocks.DIRT);
|
||||||
|
ActuallyAdditionsAPI.addCompostRecipe(new ItemStack(Blocks.LEAVES2, 1, Util.WILDCARD), Blocks.LEAVES2, new ItemStack(Blocks.DIRT), Blocks.DIRT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.creative;
|
package de.ellpeck.actuallyadditions.mod.creative;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
@ -148,6 +149,10 @@ public class CreativeTab extends CreativeTabs{
|
||||||
|
|
||||||
this.add(InitBlocks.blockBlackLotus);
|
this.add(InitBlocks.blockBlackLotus);
|
||||||
|
|
||||||
|
if(ActuallyAdditions.isCaveMode){
|
||||||
|
this.add(InitItems.itemCrystalChisel);
|
||||||
|
}
|
||||||
|
|
||||||
this.add(InitItems.itemBag);
|
this.add(InitItems.itemBag);
|
||||||
this.add(InitItems.itemVoidBag);
|
this.add(InitItems.itemVoidBag);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.data;
|
package de.ellpeck.actuallyadditions.mod.data;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -54,6 +55,8 @@ public final class PlayerData{
|
||||||
public boolean shouldDisableBatWings;
|
public boolean shouldDisableBatWings;
|
||||||
public int batWingsFlyTime;
|
public int batWingsFlyTime;
|
||||||
|
|
||||||
|
public int receivedCaveMessages;
|
||||||
|
|
||||||
public IBookletPage[] bookmarks = new IBookletPage[12];
|
public IBookletPage[] bookmarks = new IBookletPage[12];
|
||||||
public List<String> completedTrials = new ArrayList<String>();
|
public List<String> completedTrials = new ArrayList<String>();
|
||||||
|
|
||||||
|
@ -80,6 +83,10 @@ public final class PlayerData{
|
||||||
if(!savingToFile){
|
if(!savingToFile){
|
||||||
this.shouldDisableBatWings = compound.getBoolean("ShouldDisableWings");
|
this.shouldDisableBatWings = compound.getBoolean("ShouldDisableWings");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ActuallyAdditions.isCaveMode){
|
||||||
|
this.receivedCaveMessages = compound.getInteger("ReceivedCaveMessages");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound compound, boolean savingToFile){
|
public void writeToNBT(NBTTagCompound compound, boolean savingToFile){
|
||||||
|
@ -95,6 +102,10 @@ public final class PlayerData{
|
||||||
if(!savingToFile){
|
if(!savingToFile){
|
||||||
compound.setBoolean("ShouldDisableWings", this.shouldDisableBatWings);
|
compound.setBoolean("ShouldDisableWings", this.shouldDisableBatWings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ActuallyAdditions.isCaveMode){
|
||||||
|
compound.setInteger("ReceivedCaveMessages", this.receivedCaveMessages);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTTagList saveBookmarks(){
|
public NBTTagList saveBookmarks(){
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class WorldGenLushCaves{
|
||||||
possiblePoses.add(pos);
|
possiblePoses.add(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(rand.nextInt(20) == 0){
|
else if(this.shouldTryGenCluster(rand)){
|
||||||
EnumFacing[] values = EnumFacing.values();
|
EnumFacing[] values = EnumFacing.values();
|
||||||
EnumFacing side = values[rand.nextInt(values.length)];
|
EnumFacing side = values[rand.nextInt(values.length)];
|
||||||
BlockPos posSide = pos.offset(side);
|
BlockPos posSide = pos.offset(side);
|
||||||
|
@ -89,7 +89,7 @@ public class WorldGenLushCaves{
|
||||||
IBlockState stateSide = world.getBlockState(posSide);
|
IBlockState stateSide = world.getBlockState(posSide);
|
||||||
|
|
||||||
if(state.getBlock().isAir(state, world, pos) && stateSide.getBlock().isSideSolid(stateSide, world, posSide, side.getOpposite())){
|
if(state.getBlock().isAir(state, world, pos) && stateSide.getBlock().isSideSolid(stateSide, world, posSide, side.getOpposite())){
|
||||||
Block block = CRYSTAL_CLUSTERS[rand.nextInt(CRYSTAL_CLUSTERS.length)];
|
Block block = this.getClusterToPlace(rand);
|
||||||
world.setBlockState(pos, block.getDefaultState().withProperty(BlockDirectional.FACING, side.getOpposite()), 2);
|
world.setBlockState(pos, block.getDefaultState().withProperty(BlockDirectional.FACING, side.getOpposite()), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,10 +112,10 @@ public class WorldGenLushCaves{
|
||||||
if(rand.nextBoolean()){
|
if(rand.nextBoolean()){
|
||||||
if(rand.nextBoolean()){
|
if(rand.nextBoolean()){
|
||||||
trees = new WorldGenBigTree(false);
|
trees = new WorldGenBigTree(false);
|
||||||
|
genCrate = true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
trees = new WorldGenShrub(Blocks.LOG.getDefaultState(), Blocks.LEAVES.getDefaultState());
|
trees = new WorldGenShrub(Blocks.LOG.getDefaultState(), Blocks.LEAVES.getDefaultState());
|
||||||
genCrate = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -146,6 +146,14 @@ public class WorldGenLushCaves{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Block getClusterToPlace(Random rand){
|
||||||
|
return CRYSTAL_CLUSTERS[rand.nextInt(CRYSTAL_CLUSTERS.length)];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean shouldTryGenCluster(Random rand){
|
||||||
|
return rand.nextInt(20) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
private void makeSphereWithGrassFloor(World world, BlockPos center, int radius, StructureBoundingBox boundingBox, Random rand){
|
private void makeSphereWithGrassFloor(World world, BlockPos center, int radius, StructureBoundingBox boundingBox, Random rand){
|
||||||
for(double x = -radius; x < radius; x++){
|
for(double x = -radius; x < radius; x++){
|
||||||
for(double y = -radius; y < radius; y++){
|
for(double y = -radius; y < radius; y++){
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.*;
|
import de.ellpeck.actuallyadditions.mod.items.base.*;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens;
|
import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens;
|
||||||
|
@ -198,10 +199,15 @@ public final class InitItems{
|
||||||
public static Item itemEngineerGoggles;
|
public static Item itemEngineerGoggles;
|
||||||
public static Item itemEngineerGogglesAdvanced;
|
public static Item itemEngineerGogglesAdvanced;
|
||||||
public static Item itemCrystalShard;
|
public static Item itemCrystalShard;
|
||||||
|
public static Item itemCrystalChisel;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing Items...");
|
ModUtil.LOGGER.info("Initializing Items...");
|
||||||
|
|
||||||
|
if(ActuallyAdditions.isCaveMode){
|
||||||
|
itemCrystalChisel = new ItemCrystalChisel("item_crystal_chisel");
|
||||||
|
}
|
||||||
|
|
||||||
itemCrystalShard = new ItemCrystalShard("item_crystal_shard");
|
itemCrystalShard = new ItemCrystalShard("item_crystal_shard");
|
||||||
itemEngineerGogglesAdvanced = new ItemEngineerGoggles("item_engineer_goggles_advanced", true);
|
itemEngineerGogglesAdvanced = new ItemEngineerGoggles("item_engineer_goggles_advanced", true);
|
||||||
itemEngineerGoggles = new ItemEngineerGoggles("item_engineer_goggles", false);
|
itemEngineerGoggles = new ItemEngineerGoggles("item_engineer_goggles", false);
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* This file ("ItemCrystalChisel.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-2017 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.BlockCrystalCluster;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.cave.WorldTypeCave;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.gen.WorldGenLushCaves;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
|
public class ItemCrystalChisel extends ItemBase{
|
||||||
|
|
||||||
|
public ItemCrystalChisel(String name){
|
||||||
|
super(name);
|
||||||
|
|
||||||
|
this.setMaxStackSize(1);
|
||||||
|
this.setMaxDamage(64);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canHarvestBlock(IBlockState block){
|
||||||
|
return block.getBlock() instanceof BlockCrystalCluster;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, EntityPlayer player){
|
||||||
|
if(WorldTypeCave.is(player.world) && !(player instanceof FakePlayer)){
|
||||||
|
IBlockState state = player.world.getBlockState(pos);
|
||||||
|
if(state.getBlock() instanceof BlockCrystalCluster){
|
||||||
|
int index = ArrayUtils.indexOf(WorldGenLushCaves.CRYSTAL_CLUSTERS, state.getBlock());
|
||||||
|
if(index >= 0){
|
||||||
|
if(!player.world.isRemote){
|
||||||
|
if(player.world.rand.nextBoolean()){
|
||||||
|
ItemStack drop = new ItemStack(InitItems.itemCrystalShard, player.world.rand.nextInt(3)+1, index);
|
||||||
|
EntityItem item = new EntityItem(player.world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, drop);
|
||||||
|
player.world.spawnEntity(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
stack.damageItem(1, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -27,7 +28,7 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
||||||
public static CompostRecipe getRecipeForInput(ItemStack input){
|
public static CompostRecipe getRecipeForInput(ItemStack input){
|
||||||
if(StackUtil.isValid(input)){
|
if(StackUtil.isValid(input)){
|
||||||
for(CompostRecipe recipe : ActuallyAdditionsAPI.COMPOST_RECIPES){
|
for(CompostRecipe recipe : ActuallyAdditionsAPI.COMPOST_RECIPES){
|
||||||
if(input.isItemEqual(recipe.input)){
|
if(ItemUtil.areItemsEqual(input, recipe.input, true)){
|
||||||
return recipe;
|
return recipe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -665,7 +665,17 @@ info.actuallyadditions.laserRelay.mode.inputOnly=Only out of adjacent Blocks
|
||||||
info.actuallyadditions.laserRelay.mode.noCompasss=Hold a %s to modify!
|
info.actuallyadditions.laserRelay.mode.noCompasss=Hold a %s to modify!
|
||||||
info.actuallyadditions.cave.generating=Generating cave for player %s, server might lag for a bit...
|
info.actuallyadditions.cave.generating=Generating cave for player %s, server might lag for a bit...
|
||||||
info.actuallyadditions.cave.generated=Finished generating cave for player %s.
|
info.actuallyadditions.cave.generated=Finished generating cave for player %s.
|
||||||
info.actuallyadditions.cave.generatingScreen=Generating cave...
|
info.actuallyadditions.cave.whisper.1=
|
||||||
|
info.actuallyadditions.cave.whisper.2=As darkness surrounds you,
|
||||||
|
info.actuallyadditions.cave.whisper.3=you stumble through this cave.
|
||||||
|
info.actuallyadditions.cave.whisper.4=There's trees, and bushes,
|
||||||
|
info.actuallyadditions.cave.whisper.5=grass, and crystals, rocks.
|
||||||
|
info.actuallyadditions.cave.whisper.6=But there is no one else,
|
||||||
|
info.actuallyadditions.cave.whisper.7=and no way out.
|
||||||
|
info.actuallyadditions.cave.whisper.8="What do I do?", you think.
|
||||||
|
info.actuallyadditions.cave.whisper.9=
|
||||||
|
info.actuallyadditions.cave.whisper.10=Maybe checking the booklet might prove beneficial.
|
||||||
|
info.actuallyadditions.cave.whisper.11=
|
||||||
|
|
||||||
#Container Names
|
#Container Names
|
||||||
container.actuallyadditions.inputter.name=ESD
|
container.actuallyadditions.inputter.name=ESD
|
||||||
|
|
Loading…
Reference in a new issue