Added Skyroot Beds to 1.7.10.
|
@ -4,8 +4,12 @@ import com.legacy.aether.network.AetherNetwork;
|
|||
import com.legacy.aether.network.packets.PacketSendEternalDay;
|
||||
import com.legacy.aether.network.packets.PacketSendShouldCycle;
|
||||
import com.legacy.aether.network.packets.PacketSendTime;
|
||||
import com.legacy.aether.player.PlayerAether;
|
||||
import com.legacy.aether.world.AetherData;
|
||||
import com.legacy.aether.world.AetherWorldProvider;
|
||||
import com.legacy.aether.world.TeleporterAether;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
|
@ -14,17 +18,22 @@ import net.minecraft.entity.boss.EntityWither;
|
|||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntityCow;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.event.entity.EntityStruckByLightningEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
|
@ -44,6 +53,7 @@ import com.legacy.aether.registry.achievements.AchievementsAether;
|
|||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerWakeUpEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
public class
|
||||
|
@ -265,4 +275,41 @@ AetherEventHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerSleepInBed(PlayerWakeUpEvent event)
|
||||
{
|
||||
final World world = event.entityPlayer.worldObj;
|
||||
|
||||
if (!world.isRemote && event.entityPlayer.dimension == AetherConfig.getAetherDimensionID())
|
||||
{
|
||||
final MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
|
||||
final WorldServer worldServer = server.worldServerForDimension(0);
|
||||
|
||||
if (worldServer.playerEntities.size() > 0)
|
||||
{
|
||||
if (worldServer.areAllPlayersAsleep())
|
||||
{
|
||||
performTimeSet(event, world, worldServer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
performTimeSet(event, world, worldServer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void performTimeSet(PlayerWakeUpEvent event, World world, WorldServer worldServer)
|
||||
{
|
||||
if (world.getGameRules().getGameRuleBooleanValue("doDaylightCycle") && event.entityPlayer.isPlayerFullyAsleep())
|
||||
{
|
||||
final long i = worldServer.getWorldInfo().getWorldTime() + 24000L;
|
||||
|
||||
worldServer.getWorldInfo().setWorldTime(i - i % 24000L);
|
||||
|
||||
PlayerAether.get(event.entityPlayer).setBedLocation(event.entityPlayer.getBedLocation(AetherConfig.getAetherDimensionID()));
|
||||
}
|
||||
}
|
||||
}
|
202
src/main/java/com/legacy/aether/blocks/BlockSkyrootBed.java
Normal file
|
@ -0,0 +1,202 @@
|
|||
package com.legacy.aether.blocks;
|
||||
|
||||
import com.legacy.aether.AetherConfig;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import com.legacy.aether.player.PlayerAether;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockBed;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSkyrootBed extends BlockBed
|
||||
{
|
||||
public static final int[][] field_149981_a = new int[][] {{0, 1}, { -1, 0}, {0, -1}, {1, 0}};
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] field_149980_b;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] field_149982_M;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] field_149983_N;
|
||||
|
||||
public BlockSkyrootBed()
|
||||
{
|
||||
super();
|
||||
this.func_149978_e();
|
||||
this.disableStats();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
|
||||
{
|
||||
if (p_149727_1_.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i1 = p_149727_1_.getBlockMetadata(p_149727_2_, p_149727_3_, p_149727_4_);
|
||||
|
||||
if (!isBlockHeadOfBed(i1))
|
||||
{
|
||||
int j1 = getDirection(i1);
|
||||
p_149727_2_ += field_149981_a[j1][0];
|
||||
p_149727_4_ += field_149981_a[j1][1];
|
||||
|
||||
if (p_149727_1_.getBlock(p_149727_2_, p_149727_3_, p_149727_4_) != this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
i1 = p_149727_1_.getBlockMetadata(p_149727_2_, p_149727_3_, p_149727_4_);
|
||||
}
|
||||
|
||||
if (p_149727_5_.dimension == AetherConfig.getAetherDimensionID() || p_149727_5_.dimension == 0)
|
||||
{
|
||||
if (func_149976_c(i1))
|
||||
{
|
||||
EntityPlayer entityplayer1 = null;
|
||||
Iterator iterator = p_149727_1_.playerEntities.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
EntityPlayer entityplayer2 = (EntityPlayer)iterator.next();
|
||||
|
||||
if (entityplayer2.isPlayerSleeping())
|
||||
{
|
||||
ChunkCoordinates chunkcoordinates = entityplayer2.playerLocation;
|
||||
|
||||
if (chunkcoordinates.posX == p_149727_2_ && chunkcoordinates.posY == p_149727_3_ && chunkcoordinates.posZ == p_149727_4_)
|
||||
{
|
||||
entityplayer1 = entityplayer2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entityplayer1 != null)
|
||||
{
|
||||
p_149727_5_.addChatComponentMessage(new ChatComponentTranslation("tile.bed.occupied", new Object[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
func_149979_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, false);
|
||||
}
|
||||
|
||||
EntityPlayer.EnumStatus enumstatus = p_149727_5_.sleepInBedAt(p_149727_2_, p_149727_3_, p_149727_4_);
|
||||
|
||||
if (enumstatus == EntityPlayer.EnumStatus.OK)
|
||||
{
|
||||
func_149979_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, true);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW)
|
||||
{
|
||||
p_149727_5_.addChatComponentMessage(new ChatComponentTranslation("tile.bed.noSleep", new Object[0]));
|
||||
|
||||
if (p_149727_5_.dimension == AetherConfig.getAetherDimensionID())
|
||||
{
|
||||
p_149727_5_.addChatMessage(new ChatComponentTranslation("gui.skyroot_bed.respawn_point"));
|
||||
p_149727_5_.setSpawnChunk(new ChunkCoordinates(p_149727_2_, p_149727_3_, p_149727_4_), false, AetherConfig.getAetherDimensionID());
|
||||
PlayerAether.get(p_149727_5_).setBedLocation(new ChunkCoordinates(p_149727_2_, p_149727_3_, p_149727_4_));
|
||||
}
|
||||
}
|
||||
else if (enumstatus == EntityPlayer.EnumStatus.NOT_SAFE)
|
||||
{
|
||||
p_149727_5_.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0]));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double d2 = (double)p_149727_2_ + 0.5D;
|
||||
double d0 = (double)p_149727_3_ + 0.5D;
|
||||
double d1 = (double)p_149727_4_ + 0.5D;
|
||||
p_149727_1_.setBlockToAir(p_149727_2_, p_149727_3_, p_149727_4_);
|
||||
int k1 = getDirection(i1);
|
||||
p_149727_2_ += field_149981_a[k1][0];
|
||||
p_149727_4_ += field_149981_a[k1][1];
|
||||
|
||||
if (p_149727_1_.getBlock(p_149727_2_, p_149727_3_, p_149727_4_) == this)
|
||||
{
|
||||
p_149727_1_.setBlockToAir(p_149727_2_, p_149727_3_, p_149727_4_);
|
||||
d2 = (d2 + (double)p_149727_2_ + 0.5D) / 2.0D;
|
||||
d0 = (d0 + (double)p_149727_3_ + 0.5D) / 2.0D;
|
||||
d1 = (d1 + (double)p_149727_4_ + 0.5D) / 2.0D;
|
||||
}
|
||||
|
||||
p_149727_1_.newExplosion((Entity)null, (double)((float)p_149727_2_ + 0.5F), (double)((float)p_149727_3_ + 0.5F), (double)((float)p_149727_4_ + 0.5F), 5.0F, true, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_)
|
||||
{
|
||||
if (p_149691_1_ == 0)
|
||||
{
|
||||
return BlocksAether.skyroot_planks.getBlockTextureFromSide(p_149691_1_);
|
||||
}
|
||||
else
|
||||
{
|
||||
int k = getDirection(p_149691_2_);
|
||||
int l = Direction.bedDirection[k][p_149691_1_];
|
||||
int i1 = isBlockHeadOfBed(p_149691_2_) ? 1 : 0;
|
||||
return (i1 != 1 || l != 2) && (i1 != 0 || l != 3) ? (l != 5 && l != 4 ? this.field_149983_N[i1] : this.field_149982_M[i1]) : this.field_149980_b[i1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister p_149651_1_)
|
||||
{
|
||||
this.field_149983_N = new IIcon[] {p_149651_1_.registerIcon(this.getTextureName() + "_feet_top"), p_149651_1_.registerIcon(this.getTextureName() + "_head_top")};
|
||||
this.field_149980_b = new IIcon[] {p_149651_1_.registerIcon(this.getTextureName() + "_feet_end"), p_149651_1_.registerIcon(this.getTextureName() + "_head_end")};
|
||||
this.field_149982_M = new IIcon[] {p_149651_1_.registerIcon(this.getTextureName() + "_feet_side"), p_149651_1_.registerIcon(this.getTextureName() + "_head_side")};
|
||||
}
|
||||
|
||||
private void func_149978_e()
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5625F, 1.0F);
|
||||
}
|
||||
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return isBlockHeadOfBed(p_149650_1_) ? Item.getItemById(0) : ItemsAether.skyroot_bed_item;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_)
|
||||
{
|
||||
return ItemsAether.skyroot_bed_item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBed(IBlockAccess world, int x, int y, int z, EntityLivingBase player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBedFoot(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return BlockSkyrootBed.isBlockHeadOfBed(world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.legacy.aether.blocks;
|
||||
|
||||
import com.legacy.aether.items.ItemSkyrootBed;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import com.legacy.aether.items.block.ItemBlockRarity;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -111,6 +112,8 @@ public class BlocksAether {
|
|||
|
||||
public static Block skyroot_bookshelf;
|
||||
|
||||
public static Block skyroot_bed;
|
||||
|
||||
public static void initialization() {
|
||||
aether_grass = registerMeta("aether_grass", new BlockAetherGrass());
|
||||
enchanted_aether_grass = registerRarity("enchanted_aether_grass", new BlockEnchantedAetherGrass(), EnumRarity.rare);
|
||||
|
@ -199,6 +202,7 @@ public class BlocksAether {
|
|||
mossy_holystone_slab = registerSlab("mossy_holystone_slab", new BlockAetherSlab("mossy_holystone_slab", false, Material.rock).setBlockTextureName(Aether.find("mossy_holystone")).setHardness(0.5F).setResistance(10.0F), mossy_holystone_double_slab);
|
||||
holystone_brick_slab = registerSlab("holystone_brick_slab", new BlockAetherSlab("holystone_brick_slab", false, Material.rock).setBlockTextureName(Aether.find("holystone_brick")).setHardness(0.5F).setResistance(10.0F), holystone_brick_double_slab);
|
||||
skyroot_bookshelf = register("skyroot_bookshelf", new BlockSkyrootBookshelf());
|
||||
skyroot_bed = registerBed("skyroot_bed", new BlockSkyrootBed().setBlockTextureName(Aether.find("skyroot_bed")));
|
||||
}
|
||||
|
||||
public static boolean isGood(Block block) {
|
||||
|
@ -241,4 +245,12 @@ public class BlocksAether {
|
|||
return block;
|
||||
}
|
||||
|
||||
public static Block registerBed(String name, Block block) {
|
||||
block.setBlockName(name);
|
||||
|
||||
GameRegistry.registerBlock(block, name);
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.legacy.aether.entities.bosses.sun_spirit;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.legacy.aether.world.AetherData;
|
||||
import com.legacy.aether.world.AetherWorldProvider;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -204,6 +205,31 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss {
|
|||
|
||||
dungeonTarget.triggerAchievement(AchievementsAether.defeat_gold);
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (!AetherData.getInstance(this.worldObj).isEternalDay())
|
||||
{
|
||||
AetherData.getInstance(this.worldObj).setEternalDay(true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
WorldProvider provider = this.worldObj.provider;
|
||||
|
||||
if (provider instanceof AetherWorldProvider)
|
||||
{
|
||||
AetherWorldProvider aetherProvider = (AetherWorldProvider) provider;
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (aetherProvider.getIsEternalDay())
|
||||
{
|
||||
aetherProvider.setIsEternalDay(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
this.setDoor(Blocks.air);
|
||||
this.unlockTreasure();
|
||||
}
|
||||
|
@ -487,25 +513,6 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeathUpdate()
|
||||
{
|
||||
WorldProvider provider = this.worldObj.provider;
|
||||
|
||||
if (provider instanceof AetherWorldProvider)
|
||||
{
|
||||
AetherWorldProvider aetherProvider = (AetherWorldProvider) provider;
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (aetherProvider.getIsEternalDay())
|
||||
{
|
||||
aetherProvider.setIsEternalDay(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setDoor(Block block) {
|
||||
int x, y, z;
|
||||
|
||||
|
|
87
src/main/java/com/legacy/aether/items/ItemSkyrootBed.java
Normal file
|
@ -0,0 +1,87 @@
|
|||
package com.legacy.aether.items;
|
||||
|
||||
import com.legacy.aether.blocks.BlockSkyrootBed;
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSkyrootBed extends Item
|
||||
{
|
||||
public ItemSkyrootBed()
|
||||
{
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(AetherCreativeTabs.blocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
|
||||
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
|
||||
*/
|
||||
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
|
||||
{
|
||||
if (p_77648_3_.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (p_77648_7_ != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
++p_77648_5_;
|
||||
BlockSkyrootBed blockbed = (BlockSkyrootBed) BlocksAether.skyroot_bed;
|
||||
int i1 = MathHelper.floor_double((double)(p_77648_2_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
byte b0 = 0;
|
||||
byte b1 = 0;
|
||||
|
||||
if (i1 == 0)
|
||||
{
|
||||
b1 = 1;
|
||||
}
|
||||
|
||||
if (i1 == 1)
|
||||
{
|
||||
b0 = -1;
|
||||
}
|
||||
|
||||
if (i1 == 2)
|
||||
{
|
||||
b1 = -1;
|
||||
}
|
||||
|
||||
if (i1 == 3)
|
||||
{
|
||||
b0 = 1;
|
||||
}
|
||||
|
||||
if (p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.canPlayerEdit(p_77648_4_ + b0, p_77648_5_, p_77648_6_ + b1, p_77648_7_, p_77648_1_))
|
||||
{
|
||||
if (p_77648_3_.isAirBlock(p_77648_4_, p_77648_5_, p_77648_6_) && p_77648_3_.isAirBlock(p_77648_4_ + b0, p_77648_5_, p_77648_6_ + b1) && World.doesBlockHaveSolidTopSurface(p_77648_3_, p_77648_4_, p_77648_5_ - 1, p_77648_6_) && World.doesBlockHaveSolidTopSurface(p_77648_3_, p_77648_4_ + b0, p_77648_5_ - 1, p_77648_6_ + b1))
|
||||
{
|
||||
p_77648_3_.setBlock(p_77648_4_, p_77648_5_, p_77648_6_, blockbed, i1, 3);
|
||||
|
||||
if (p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_) == blockbed)
|
||||
{
|
||||
p_77648_3_.setBlock(p_77648_4_ + b0, p_77648_5_, p_77648_6_ + b1, blockbed, i1 + 8, 3);
|
||||
}
|
||||
|
||||
--p_77648_1_.stackSize;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -116,6 +116,8 @@ public class ItemsAether {
|
|||
|
||||
public static Item aether_spawn_egg;
|
||||
|
||||
public static Item skyroot_bed_item;
|
||||
|
||||
public static void initialization() {
|
||||
zanite_gemstone = register("zanite_gemstone", new ItemAether(AetherCreativeTabs.material).setTextureName(Aether.find("misc/zanite_gemstone")));
|
||||
ambrosium_shard = register("ambrosium_shard", new ItemAmbrosiumShard().setTextureName(Aether.find("misc/ambrosium_shard")));
|
||||
|
@ -260,6 +262,9 @@ public class ItemsAether {
|
|||
developer_stick = register("developer_stick", new ItemDeveloperStick().setTextureName(Aether.find("skyroot_stick")));
|
||||
|
||||
aether_spawn_egg = register("aether_spawn_egg", new ItemAetherSpawnEgg().setTextureName("spawn_egg"));
|
||||
|
||||
skyroot_bed_item = register("skyroot_bed_item", new ItemSkyrootBed().setTextureName(Aether.find("skyroot_bed_item")));
|
||||
|
||||
}
|
||||
|
||||
public static Item register(String name, Item item) {
|
||||
|
|
|
@ -35,7 +35,7 @@ public class PacketSendEternalDay extends AetherPacket<PacketSendEternalDay>
|
|||
@Override
|
||||
public void handleClient(PacketSendEternalDay message, EntityPlayer player)
|
||||
{
|
||||
WorldProvider provider = Minecraft.getMinecraft().theWorld.provider;
|
||||
WorldProvider provider = player.worldObj.provider;
|
||||
|
||||
if (provider instanceof AetherWorldProvider)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ public class PacketSendShouldCycle extends AetherPacket<PacketSendShouldCycle>
|
|||
@Override
|
||||
public void handleClient(PacketSendShouldCycle message, EntityPlayer player)
|
||||
{
|
||||
WorldProvider provider = Minecraft.getMinecraft().theWorld.provider;
|
||||
WorldProvider provider = player.worldObj.provider;
|
||||
|
||||
if (provider instanceof AetherWorldProvider)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ public class PacketSendTime extends AetherPacket<PacketSendTime>
|
|||
@Override
|
||||
public void handleClient(PacketSendTime message, EntityPlayer player)
|
||||
{
|
||||
WorldProvider provider = Minecraft.getMinecraft().theWorld.provider;
|
||||
WorldProvider provider = player.worldObj.provider;
|
||||
|
||||
if (provider instanceof AetherWorldProvider)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -16,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -82,6 +84,8 @@ public class PlayerAether implements IPlayerAether {
|
|||
|
||||
public float prevTimeInPortal;
|
||||
|
||||
private ChunkCoordinates bedLocation;
|
||||
|
||||
public PlayerAether() {
|
||||
this.abilities.addAll(Arrays.<IAetherAbility>asList(new AbilityAccessories(this), new AbilityArmor(this), new AbilityFlight(this), new AbilityRepulsion(this)));
|
||||
}
|
||||
|
@ -223,6 +227,20 @@ public class PlayerAether implements IPlayerAether {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!player.worldObj.isRemote)
|
||||
{
|
||||
if (this.bedLocation != null)
|
||||
{
|
||||
if (player.dimension == AetherConfig.getAetherDimensionID())
|
||||
{
|
||||
if (player.worldObj.getBlock(this.bedLocation.posX, this.bedLocation.posY, this.bedLocation.posZ) != BlocksAether.skyroot_bed)
|
||||
{
|
||||
this.setBedLocation(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -295,6 +313,13 @@ public class PlayerAether implements IPlayerAether {
|
|||
aetherTag.setInteger("shardCount", this.shardCount);
|
||||
aetherTag.setTag("accessories", this.getAccessoryInventory().writeToNBT(aetherTag));
|
||||
|
||||
if (this.bedLocation != null)
|
||||
{
|
||||
aetherTag.setInteger("bedX", this.bedLocation.posX);
|
||||
aetherTag.setInteger("bedY", this.bedLocation.posY);
|
||||
aetherTag.setInteger("bedZ", this.bedLocation.posZ);
|
||||
}
|
||||
|
||||
compound.setTag("aetherI", aetherTag);
|
||||
}
|
||||
|
||||
|
@ -304,6 +329,7 @@ public class PlayerAether implements IPlayerAether {
|
|||
|
||||
this.updateShardCount(aetherTag.getInteger("shardCount"));
|
||||
this.getAccessoryInventory().readFromNBT(aetherTag.getTagList("accessories", 10));
|
||||
this.setBedLocation(new ChunkCoordinates(aetherTag.getInteger("bedX"), aetherTag.getInteger("bedY"), aetherTag.getInteger("bedZ")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -432,4 +458,13 @@ public class PlayerAether implements IPlayerAether {
|
|||
return this.cooldownMax;
|
||||
}
|
||||
|
||||
public void setBedLocation(ChunkCoordinates bedLocation)
|
||||
{
|
||||
this.bedLocation = bedLocation;
|
||||
}
|
||||
|
||||
public ChunkCoordinates getBedLocation()
|
||||
{
|
||||
return bedLocation;
|
||||
}
|
||||
}
|
|
@ -61,6 +61,11 @@ public class PlayerAetherEvents {
|
|||
if (!event.wasDeath || event.entityPlayer.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) {
|
||||
playerAether.setAccessoryInventory(original.getAccessoryInventory());
|
||||
}
|
||||
|
||||
if (event.wasDeath)
|
||||
{
|
||||
playerAether.setBedLocation(original.getBedLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -296,6 +296,8 @@ public class AetherRegistries {
|
|||
register("mossy_holystone_stairs", new ItemStack(BlocksAether.mossy_holystone_stairs, 4), "Z ", "ZZ ", "ZZZ", 'Z', new ItemStack(BlocksAether.mossy_holystone, 1, 1));
|
||||
register("holystone_brick_stairs", new ItemStack(BlocksAether.holystone_brick_stairs, 4), "Z ", "ZZ ", "ZZZ", 'Z', new ItemStack(BlocksAether.holystone_brick, 1));
|
||||
register("skyroot_stairs", new ItemStack(BlocksAether.skyroot_stairs, 4), "Z ", "ZZ ", "ZZZ", 'Z', new ItemStack(BlocksAether.skyroot_planks));
|
||||
|
||||
register("skyroot_bed_item", new ItemStack(ItemsAether.skyroot_bed_item, 1), "XXX", "ZZZ", 'Z', new ItemStack(BlocksAether.skyroot_planks), 'X', new ItemStack(Blocks.wool, 1, 9));
|
||||
}
|
||||
|
||||
private static void register(String name, ItemStack stack, Object... recipe) {
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.legacy.aether.world;
|
||||
|
||||
import com.legacy.aether.AetherConfig;
|
||||
import com.legacy.aether.network.AetherNetwork;
|
||||
import com.legacy.aether.network.packets.PacketSendTime;
|
||||
import com.legacy.aether.player.PlayerAether;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
@ -133,6 +136,12 @@ public class AetherWorldProvider extends WorldProvider {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRespawnDimension(EntityPlayerMP player)
|
||||
{
|
||||
return PlayerAether.get(player).getBedLocation() == null ? 0 : AetherConfig.getAetherDimensionID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCoordinateBeSpawn(int i, int j) {
|
||||
return false;
|
||||
|
|
|
@ -211,7 +211,6 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
|
||||
if (needsCorridor)
|
||||
{
|
||||
System.out.println("called 1");
|
||||
endCorridor(world, random, new PositionData(x, y, z));
|
||||
return true;
|
||||
}
|
||||
|
@ -222,7 +221,6 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
public boolean generateNextRoom(World world, Random random, PositionData pos) {
|
||||
if (needsCorridor)
|
||||
{
|
||||
System.out.println("called 2");
|
||||
endCorridor(world, random, pos);
|
||||
return false;
|
||||
}
|
||||
|
@ -319,7 +317,6 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
|
||||
if(!generateNextRoom(world, random, new PositionData(x, y, z)))
|
||||
{
|
||||
System.out.println("called 3");
|
||||
this.needsCorridor = true;
|
||||
return false;
|
||||
}
|
||||
|
@ -383,8 +380,6 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
return false;
|
||||
}
|
||||
|
||||
System.out.println("east");
|
||||
|
||||
while(tunnelling)
|
||||
{
|
||||
if(isBoxEmpty(world, new PositionData(x, y, z), new PositionData(1, 8, 6)))
|
||||
|
@ -441,8 +436,6 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
return false;
|
||||
}
|
||||
|
||||
System.out.println("west");
|
||||
|
||||
while(tunnelling)
|
||||
{
|
||||
if(isBoxEmpty(world, new PositionData(x, y, z), new PositionData(1, 8, 6)))
|
||||
|
@ -500,8 +493,6 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
return false;
|
||||
}
|
||||
|
||||
System.out.println("south");
|
||||
|
||||
while(tunnelling)
|
||||
{
|
||||
if(isBoxEmpty(world, new PositionData(x, y, z), new PositionData(6, 8, 1)))
|
||||
|
@ -558,8 +549,6 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
return false;
|
||||
}
|
||||
|
||||
System.out.println("north");
|
||||
|
||||
while(tunnelling)
|
||||
{
|
||||
if(isBoxEmpty(world, new PositionData(x, y, z), new PositionData(6, 8, 1)))
|
||||
|
|
|
@ -129,6 +129,7 @@ item.dart_enchanted.name=Enchanted Dart
|
|||
item.enchanted_blueberry.name=Enchanted Berry
|
||||
item.swet_ball.name=Swet Ball
|
||||
item.developer_stick.name=Developer Stick
|
||||
item.skyroot_bed_item.name=Skyroot Bed
|
||||
|
||||
# Block Names
|
||||
tile.aether_portal.name=Aether Portal
|
||||
|
@ -227,6 +228,7 @@ tile.aerogel_double_slab.name=Aerogel Double Slab
|
|||
tile.skyroot_fence_gate.name=Skyroot Fence Gate
|
||||
tile.sun_altar.name=Sun Altar
|
||||
tile.skyroot_bookshelf.name=Skyroot Bookshelf
|
||||
tile.skyroot_bed.name=Skyroot Bed
|
||||
|
||||
# Entities
|
||||
entity.aechor_plant.name=Aechor Plant
|
||||
|
@ -410,3 +412,5 @@ gui.treasure_chest.bronze=Bronze Treasure Chest
|
|||
gui.treasure_chest.silver=Silver Treasure Chest
|
||||
gui.treasure_chest.gold=Gold Treasure Chest
|
||||
gui.treasure_chest.platinum=Platinum Treasure Chest
|
||||
|
||||
gui.skyroot_bed.respawn_point=Respawn point set
|
After Width: | Height: | Size: 450 B |
After Width: | Height: | Size: 420 B |
After Width: | Height: | Size: 592 B |
After Width: | Height: | Size: 460 B |
After Width: | Height: | Size: 465 B |
After Width: | Height: | Size: 667 B |
After Width: | Height: | Size: 311 B |