commit
d71e28bbcd
365 changed files with 2633 additions and 1970 deletions
|
@ -1,212 +0,0 @@
|
||||||
package StevenDimDoors.mod_pocketDim;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.WeightedRandom;
|
|
||||||
import net.minecraft.util.WeightedRandomChestContent;
|
|
||||||
import net.minecraftforge.common.ChestGenHooks;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Registers a category of loot chests for Dimensional Doors in Forge.
|
|
||||||
*/
|
|
||||||
public class DDLoot {
|
|
||||||
|
|
||||||
//These are the categories of loot to be merged into our chests
|
|
||||||
static final String[] chestSources = new String[] {
|
|
||||||
ChestGenHooks.MINESHAFT_CORRIDOR,
|
|
||||||
ChestGenHooks.PYRAMID_DESERT_CHEST,
|
|
||||||
ChestGenHooks.PYRAMID_JUNGLE_CHEST,
|
|
||||||
ChestGenHooks.STRONGHOLD_CORRIDOR,
|
|
||||||
ChestGenHooks.STRONGHOLD_CROSSING,
|
|
||||||
ChestGenHooks.VILLAGE_BLACKSMITH,
|
|
||||||
ChestGenHooks.DUNGEON_CHEST
|
|
||||||
};
|
|
||||||
|
|
||||||
public static final String DIMENSIONAL_DUNGEON_CHEST = "dimensionalDungeonChest";
|
|
||||||
public static ChestGenHooks DungeonChestInfo = null;
|
|
||||||
private static final int CHEST_SIZE = 5;
|
|
||||||
|
|
||||||
private static final int COMMON_LOOT_WEIGHT = 9; //1 less than weight of iron ingots
|
|
||||||
private static final int UNCOMMON_LOOT_WEIGHT = 4; //1 less than weight of iron armor
|
|
||||||
private static final int RARE_LOOT_WEIGHT = 1; //Same weight as music discs, golden apple
|
|
||||||
private static final int DUNGEON_CHEST_WEIGHT_INFLATION = 10; // (weight of iron ingots in dungeon) / (weight of iron ingots in other chests)
|
|
||||||
|
|
||||||
private DDLoot() { }
|
|
||||||
|
|
||||||
public static void registerInfo()
|
|
||||||
{
|
|
||||||
DDProperties properties = DDProperties.instance();
|
|
||||||
|
|
||||||
//Register the dimensional dungeon chest with ChestGenHooks. This isn't necessary, but allows
|
|
||||||
//other mods to add their own loot to our chests if they know our loot category, without having
|
|
||||||
//to interface with our code.
|
|
||||||
DungeonChestInfo = ChestGenHooks.getInfo(DIMENSIONAL_DUNGEON_CHEST);
|
|
||||||
DungeonChestInfo.setMin(CHEST_SIZE);
|
|
||||||
DungeonChestInfo.setMax(CHEST_SIZE);
|
|
||||||
|
|
||||||
//Merge the item lists from source chests
|
|
||||||
//This means chests will include future loot as Minecraft updates! ^_^
|
|
||||||
ArrayList<WeightedRandomChestContent> items = mergeCategories(chestSources);
|
|
||||||
|
|
||||||
//Add any enabled DD loot to the list of items
|
|
||||||
addContent(properties.FabricOfRealityLootEnabled, items, mod_pocketDim.blockDimWall.blockID, 8, 32, COMMON_LOOT_WEIGHT);
|
|
||||||
|
|
||||||
addContent(properties.DimensionalDoorLootEnabled, items, mod_pocketDim.itemDimDoor.itemID, UNCOMMON_LOOT_WEIGHT);
|
|
||||||
addContent(properties.WarpDoorLootEnabled, items, mod_pocketDim.itemExitDoor.itemID, UNCOMMON_LOOT_WEIGHT);
|
|
||||||
addContent(properties.TransTrapdoorLootEnabled, items, mod_pocketDim.transTrapdoor.blockID, UNCOMMON_LOOT_WEIGHT);
|
|
||||||
addContent(properties.RiftSignatureLootEnabled, items, mod_pocketDim.itemLinkSignature.itemID, UNCOMMON_LOOT_WEIGHT);
|
|
||||||
addContent(properties.StableFabricLootEnabled, items, mod_pocketDim.itemStableFabric.itemID, UNCOMMON_LOOT_WEIGHT);
|
|
||||||
addContent(properties.RiftRemoverLootEnabled, items, mod_pocketDim.itemRiftRemover.itemID, UNCOMMON_LOOT_WEIGHT);
|
|
||||||
|
|
||||||
addContent(properties.UnstableDoorLootEnabled, items, mod_pocketDim.itemChaosDoor.itemID, RARE_LOOT_WEIGHT);
|
|
||||||
addContent(properties.StabilizedRiftSignatureLootEnabled, items, mod_pocketDim.itemStabilizedLinkSignature.itemID, RARE_LOOT_WEIGHT);
|
|
||||||
addContent(properties.RiftBladeLootEnabled, items, mod_pocketDim.itemRiftBlade.itemID, RARE_LOOT_WEIGHT);
|
|
||||||
|
|
||||||
//Add all the items to our dungeon chest
|
|
||||||
addItemsToContainer(DungeonChestInfo, items);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ArrayList<WeightedRandomChestContent> mergeCategories(String[] categories)
|
|
||||||
{
|
|
||||||
//Retrieve the items of each container category and merge the lists together. If two matching items
|
|
||||||
//are found, choose the item with the minimum weight. Special checks are included for DUNGEON_CHEST
|
|
||||||
//because the items in that category have strange weights that are incompatible with all other
|
|
||||||
//chest categories.
|
|
||||||
|
|
||||||
Random random = new Random();
|
|
||||||
HashMap<Integer, WeightedRandomChestContent> container = new HashMap<Integer, WeightedRandomChestContent>();
|
|
||||||
|
|
||||||
for (String category : categories)
|
|
||||||
{
|
|
||||||
WeightedRandomChestContent[] items = ChestGenHooks.getItems(category, random);
|
|
||||||
for (WeightedRandomChestContent item : items)
|
|
||||||
{
|
|
||||||
ItemStack stack = item.theItemId;
|
|
||||||
int id = stack.itemID;
|
|
||||||
int subtype = stack.getItem().getHasSubtypes() ? stack.getItemDamage() : 0;
|
|
||||||
|
|
||||||
//Correct the weights of Vanilla dungeon chests (DUNGEON_CHEST)
|
|
||||||
//Comparing by String references is valid here since they should match!
|
|
||||||
if (category == ChestGenHooks.DUNGEON_CHEST)
|
|
||||||
{
|
|
||||||
//It's okay to modify the weights directly. These are copies of instances,
|
|
||||||
//not direct references. It won't affect Vanilla chests.
|
|
||||||
item.itemWeight /= DUNGEON_CHEST_WEIGHT_INFLATION;
|
|
||||||
if (item.itemWeight == 0)
|
|
||||||
item.itemWeight = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Generate an identifier for this item using its item ID and damage value,
|
|
||||||
//if it has subtypes. This solves the issue of matching items that have
|
|
||||||
//the same item ID but different subtypes (e.g. wood planks, dyes).
|
|
||||||
int key = ((subtype & 0xFFFF) << 16) + ((id & 0xFFFF) << 16);
|
|
||||||
WeightedRandomChestContent other = container.get(key);
|
|
||||||
if (other == null)
|
|
||||||
{
|
|
||||||
//This item has not been seen before. Simply add it to the container.
|
|
||||||
container.put(key, item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//This item conflicts with an existing entry. Replace that entry
|
|
||||||
//if our current item has a lower weight.
|
|
||||||
if (item.itemWeight < other.itemWeight)
|
|
||||||
{
|
|
||||||
container.put(key, item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//I've added a minor hack here to make enchanted books more common
|
|
||||||
//If this is necessary for more items, create an override table and use that
|
|
||||||
//rather than hardcoding the changes below
|
|
||||||
final int enchantedBookID = Item.enchantedBook.itemID;
|
|
||||||
for (WeightedRandomChestContent item : container.values())
|
|
||||||
{
|
|
||||||
if (item.theItemId.itemID == enchantedBookID)
|
|
||||||
{
|
|
||||||
item.itemWeight = 4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Return merged list
|
|
||||||
return new ArrayList<WeightedRandomChestContent>( container.values() );
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void addContent(boolean include, ArrayList<WeightedRandomChestContent> items,
|
|
||||||
int itemID, int weight)
|
|
||||||
{
|
|
||||||
if (include)
|
|
||||||
items.add(new WeightedRandomChestContent(itemID, 0, 1, 1, weight));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void addContent(boolean include, ArrayList<WeightedRandomChestContent> items,
|
|
||||||
int itemID, int minAmount, int maxAmount, int weight)
|
|
||||||
{
|
|
||||||
if (include)
|
|
||||||
items.add(new WeightedRandomChestContent(itemID, 0, minAmount, maxAmount, weight));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void addItemsToContainer(ChestGenHooks container, ArrayList<WeightedRandomChestContent> items)
|
|
||||||
{
|
|
||||||
//System.out.println("Preparing Chest Stuff");
|
|
||||||
|
|
||||||
for (WeightedRandomChestContent item : items)
|
|
||||||
{
|
|
||||||
container.addItem(item);
|
|
||||||
//Uncomment this code to print out loot and weight pairs
|
|
||||||
//System.out.println(item.theItemId.getDisplayName() + "\t" + item.itemWeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void generateChestContents(ChestGenHooks chestInfo, IInventory inventory, Random random)
|
|
||||||
{
|
|
||||||
//This is a custom version of net.minecraft.util.WeightedRandomChestContent.generateChestContents()
|
|
||||||
//It's designed to avoid the following bugs in MC 1.5:
|
|
||||||
//1. The randomized filling algorithm will sometimes overwrite item stacks with other stacks
|
|
||||||
//2. If multiple enchanted books appear, then they will have the same enchantment
|
|
||||||
|
|
||||||
//The prime number below is used for choosing chest slots in a seemingly-random pattern. Its value
|
|
||||||
//was selected specifically to achieve a spread-out distribution for chests with up to 104 slots.
|
|
||||||
//Choosing a prime number ensures that our increments are relatively-prime to the chest size, which
|
|
||||||
//means we'll cover all the slots before repeating any. This is mathematically guaranteed.
|
|
||||||
final int primeOffset = 239333;
|
|
||||||
|
|
||||||
int count = chestInfo.getCount(random);
|
|
||||||
int size = inventory.getSizeInventory();
|
|
||||||
WeightedRandomChestContent[] content = chestInfo.getItems(random);
|
|
||||||
|
|
||||||
for (int k = 0; k < count; k++)
|
|
||||||
{
|
|
||||||
WeightedRandomChestContent selection = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, content);
|
|
||||||
|
|
||||||
//Call getChestGenBase() to make sure we generate a different enchantment for books.
|
|
||||||
//Don't just use a condition to check if the item is an instance of ItemEnchantedBook because
|
|
||||||
//we don't know if other mods might add items that also need to be regenerated.
|
|
||||||
selection = selection.theItemId.getItem().getChestGenBase(chestInfo, random, selection);
|
|
||||||
|
|
||||||
ItemStack[] stacks = ChestGenHooks.generateStacks(random, selection.theItemId, selection.theMinimumChanceToGenerateItem, selection.theMaximumChanceToGenerateItem);
|
|
||||||
|
|
||||||
for (ItemStack item : stacks)
|
|
||||||
{
|
|
||||||
int limit = size;
|
|
||||||
int index = random.nextInt(size);
|
|
||||||
|
|
||||||
while (limit > 0 && inventory.getStackInSlot(index) != null)
|
|
||||||
{
|
|
||||||
limit--;
|
|
||||||
index = (index + primeOffset) % size;
|
|
||||||
}
|
|
||||||
|
|
||||||
inventory.setInventorySlotContents(index, item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
package StevenDimDoors.mod_pocketDim.items;
|
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemDoor;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class ItemGoldDoor extends ItemDoor
|
|
||||||
{
|
|
||||||
|
|
||||||
public ItemGoldDoor(int par1, Material par2Material)
|
|
||||||
{
|
|
||||||
super(par1, par2Material);
|
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
|
||||||
{
|
|
||||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
|
||||||
{
|
|
||||||
if (par7 != 1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++par5;
|
|
||||||
Block block = mod_pocketDim.goldDoor;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack))
|
|
||||||
{
|
|
||||||
if (!block.canPlaceBlockAt(par3World, par4, par5, par6))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int i1 = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
|
|
||||||
placeDoorBlock(par3World, par4, par5, par6, i1, block);
|
|
||||||
--par1ItemStack.stackSize;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,78 +0,0 @@
|
||||||
package StevenDimDoors.mod_pocketDim.tileentities;
|
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class TileEntityDimDoor extends TileEntity
|
|
||||||
|
|
||||||
{
|
|
||||||
public boolean openOrClosed;
|
|
||||||
public int orientation;
|
|
||||||
public boolean hasExit;
|
|
||||||
public boolean isDungeonChainLink;
|
|
||||||
public boolean hasGennedPair=false;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean canUpdate()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateEntity()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
|
||||||
{
|
|
||||||
super.readFromNBT(nbt);
|
|
||||||
int i = nbt.getInteger(("Size"));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.openOrClosed = nbt.getBoolean("openOrClosed");
|
|
||||||
|
|
||||||
this.orientation = nbt.getInteger("orientation");
|
|
||||||
|
|
||||||
this.hasExit = nbt.getBoolean("hasExit");
|
|
||||||
|
|
||||||
this.isDungeonChainLink = nbt.getBoolean("isDungeonChainLink");
|
|
||||||
|
|
||||||
this.hasGennedPair = nbt.getBoolean("hasGennedPair");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound nbt)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
super.writeToNBT(nbt);
|
|
||||||
nbt.setBoolean("openOrClosed", this.openOrClosed);
|
|
||||||
|
|
||||||
nbt.setBoolean("hasExit", this.hasExit);
|
|
||||||
|
|
||||||
nbt.setInteger("orientation", this.orientation);
|
|
||||||
|
|
||||||
nbt.setBoolean("isDungeonChainLink", isDungeonChainLink);
|
|
||||||
|
|
||||||
nbt.setBoolean("hasGennedPair", hasGennedPair);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,141 +0,0 @@
|
||||||
package StevenDimDoors.mod_pocketDim.tileentities;
|
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.IChunkLoader;
|
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
|
||||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
|
||||||
import StevenDimDoors.mod_pocketDim.world.PocketBuilder;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.world.ChunkCoordIntPair;
|
|
||||||
import net.minecraftforge.common.ForgeChunkManager;
|
|
||||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
|
||||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
|
||||||
|
|
||||||
public class TileEntityDimDoorGold extends TileEntityDimDoor implements IChunkLoader
|
|
||||||
{
|
|
||||||
|
|
||||||
private Ticket chunkTicket;
|
|
||||||
|
|
||||||
public boolean canUpdate()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity()
|
|
||||||
{ // every tick?
|
|
||||||
if (PocketManager.getDimensionData(this.worldObj) != null &&
|
|
||||||
PocketManager.getDimensionData(this.worldObj).isPocketDimension() &&
|
|
||||||
!this.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
if(PocketManager.getLink(this.xCoord,this.yCoord,this.zCoord,this.worldObj)==null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.chunkTicket == null)
|
|
||||||
{
|
|
||||||
if(chunkTicket == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
chunkTicket = ForgeChunkManager.requestTicket(mod_pocketDim.instance, worldObj, Type.NORMAL);
|
|
||||||
chunkTicket.getModData().setInteger("goldDimDoorX", xCoord);
|
|
||||||
chunkTicket.getModData().setInteger("goldDimDoorY", yCoord);
|
|
||||||
chunkTicket.getModData().setInteger("goldDimDoorZ", zCoord);
|
|
||||||
forceChunkLoading(chunkTicket,this.xCoord,this.zCoord);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void forceChunkLoading(Ticket chunkTicket,int x,int z)
|
|
||||||
{
|
|
||||||
Point4D origin = PocketManager.getDimensionData(this.worldObj).origin();
|
|
||||||
int orientation = PocketManager.getDimensionData(this.worldObj).orientation();
|
|
||||||
|
|
||||||
int xOffset=0;
|
|
||||||
int zOffset=0;
|
|
||||||
|
|
||||||
switch(orientation)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
xOffset = PocketBuilder.DEFAULT_POCKET_SIZE/2;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
zOffset = PocketBuilder.DEFAULT_POCKET_SIZE/2;
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
xOffset = -PocketBuilder.DEFAULT_POCKET_SIZE/2;
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
zOffset = -PocketBuilder.DEFAULT_POCKET_SIZE/2;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for(int chunkX = -1; chunkX<2;chunkX++)
|
|
||||||
{
|
|
||||||
for(int chunkZ = -1; chunkZ<2;chunkZ++)
|
|
||||||
{
|
|
||||||
ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair((origin.getX()+xOffset >> 4)+chunkX, (origin.getZ()+zOffset >> 4)+chunkZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void invalidate()
|
|
||||||
{
|
|
||||||
ForgeChunkManager.releaseTicket(chunkTicket);
|
|
||||||
super.invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
|
||||||
{
|
|
||||||
super.readFromNBT(nbt);
|
|
||||||
int i = nbt.getInteger(("Size"));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.openOrClosed = nbt.getBoolean("openOrClosed");
|
|
||||||
|
|
||||||
this.orientation = nbt.getInteger("orientation");
|
|
||||||
|
|
||||||
this.hasExit = nbt.getBoolean("hasExit");
|
|
||||||
|
|
||||||
this.isDungeonChainLink = nbt.getBoolean("isDungeonChainLink");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound nbt)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
super.writeToNBT(nbt);
|
|
||||||
nbt.setBoolean("openOrClosed", this.openOrClosed);
|
|
||||||
|
|
||||||
nbt.setBoolean("hasExit", this.hasExit);
|
|
||||||
|
|
||||||
nbt.setInteger("orientation", this.orientation);
|
|
||||||
|
|
||||||
nbt.setBoolean("isDungeonChainLink", isDungeonChainLink);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package StevenDimDoors.mod_pocketDim.watcher;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
|
||||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
|
||||||
|
|
||||||
public class ClientLinkData
|
|
||||||
{
|
|
||||||
public Point4D point;
|
|
||||||
public int orientation;
|
|
||||||
|
|
||||||
public ClientLinkData(DimLink link)
|
|
||||||
{
|
|
||||||
this.point= link.source();
|
|
||||||
this.orientation=link.orientation();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClientLinkData(Point4D point, int orientation)
|
|
||||||
{
|
|
||||||
this.point = point;
|
|
||||||
this.orientation=orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void write(DataOutputStream output) throws IOException
|
|
||||||
{
|
|
||||||
Point4D.write(point, output);
|
|
||||||
output.writeInt(orientation);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ClientLinkData read(DataInputStream input) throws IOException
|
|
||||||
{
|
|
||||||
return new ClientLinkData(Point4D.read(input), input.readInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,232 +0,0 @@
|
||||||
package StevenDimDoors.mod_pocketDim.world;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.multiplayer.WorldClient;
|
|
||||||
import net.minecraft.client.renderer.GLAllocation;
|
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
import net.minecraftforge.client.IRenderHandler;
|
|
||||||
|
|
||||||
public class CustomSkyProvider extends IRenderHandler
|
|
||||||
{
|
|
||||||
|
|
||||||
int starGLCallList;
|
|
||||||
int glSkyList;
|
|
||||||
int glSkyList2;
|
|
||||||
|
|
||||||
|
|
||||||
public String getMoonRenderPath()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSunRenderPath()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(float par1, WorldClient world, Minecraft mc)
|
|
||||||
{
|
|
||||||
|
|
||||||
starGLCallList = GLAllocation.generateDisplayLists(3);
|
|
||||||
glSkyList = this.starGLCallList + 1;
|
|
||||||
glSkyList2 = this.starGLCallList + 2;
|
|
||||||
GL11.glDisable(GL11.GL_FOG);
|
|
||||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
|
||||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
RenderHelper.disableStandardItemLighting();
|
|
||||||
GL11.glDepthMask(false);
|
|
||||||
mc.renderEngine.bindTexture("/misc/tunnel.png");
|
|
||||||
Tessellator tessellator = Tessellator.instance;
|
|
||||||
|
|
||||||
if (mc.theWorld.provider.isSurfaceWorld())
|
|
||||||
{
|
|
||||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
|
||||||
Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, par1);
|
|
||||||
float f1 = (float)vec3.xCoord;
|
|
||||||
float f2 = (float)vec3.yCoord;
|
|
||||||
float f3 = (float)vec3.zCoord;
|
|
||||||
float f4;
|
|
||||||
|
|
||||||
if (mc.gameSettings.anaglyph)
|
|
||||||
{
|
|
||||||
float f5 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
|
||||||
float f6 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
|
||||||
f4 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
|
||||||
f1 = f5;
|
|
||||||
f2 = f6;
|
|
||||||
f3 = f4;
|
|
||||||
}
|
|
||||||
|
|
||||||
GL11.glColor3f(f1, f2, f3);
|
|
||||||
Tessellator tessellator1 = Tessellator.instance;
|
|
||||||
GL11.glDepthMask(false);
|
|
||||||
GL11.glEnable(GL11.GL_FOG);
|
|
||||||
GL11.glColor3f(f1, f2, f3);
|
|
||||||
GL11.glCallList(this.glSkyList);
|
|
||||||
GL11.glDisable(GL11.GL_FOG);
|
|
||||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
|
||||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
RenderHelper.disableStandardItemLighting();
|
|
||||||
float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(par1), par1);
|
|
||||||
float f7;
|
|
||||||
float f8;
|
|
||||||
float f9;
|
|
||||||
float f10;
|
|
||||||
|
|
||||||
if (afloat != null)
|
|
||||||
{
|
|
||||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
|
||||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
|
||||||
GL11.glRotatef(MathHelper.sin(world.getCelestialAngleRadians(par1)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
|
|
||||||
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
|
||||||
f4 = afloat[0];
|
|
||||||
f7 = afloat[1];
|
|
||||||
f8 = afloat[2];
|
|
||||||
float f11;
|
|
||||||
|
|
||||||
if (mc.gameSettings.anaglyph)
|
|
||||||
{
|
|
||||||
f9 = (f4 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
|
|
||||||
f10 = (f4 * 30.0F + f7 * 70.0F) / 100.0F;
|
|
||||||
f11 = (f4 * 30.0F + f8 * 70.0F) / 100.0F;
|
|
||||||
f4 = f9;
|
|
||||||
f7 = f10;
|
|
||||||
f8 = f11;
|
|
||||||
}
|
|
||||||
|
|
||||||
tessellator1.startDrawing(6);
|
|
||||||
tessellator1.setColorRGBA_F(f4, f7, f8, afloat[3]);
|
|
||||||
tessellator1.addVertex(0.0D, 100.0D, 0.0D);
|
|
||||||
byte b0 = 16;
|
|
||||||
tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);
|
|
||||||
|
|
||||||
for (int j = 0; j <= b0; ++j)
|
|
||||||
{
|
|
||||||
f11 = (float)j * (float)Math.PI * 2.0F / (float)b0;
|
|
||||||
float f12 = MathHelper.sin(f11);
|
|
||||||
float f13 = MathHelper.cos(f11);
|
|
||||||
tessellator1.addVertex((double)(f12 * 120.0F), (double)(f13 * 120.0F), (double)(-f13 * 40.0F * afloat[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
tessellator1.draw();
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
GL11.glShadeModel(GL11.GL_FLAT);
|
|
||||||
}
|
|
||||||
|
|
||||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
|
||||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
f4 = 1.0F - world.getRainStrength(par1);
|
|
||||||
f7 = 0.0F;
|
|
||||||
f8 = 0.0F;
|
|
||||||
f9 = 0.0F;
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, f4);
|
|
||||||
GL11.glTranslatef(f7, f8, f9);
|
|
||||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
|
||||||
GL11.glRotatef(world.getCelestialAngle(par1) * 360.0F, 1.0F, 0.0F, 0.0F);
|
|
||||||
f10 = 30.0F;
|
|
||||||
mc.renderEngine.bindTexture(this.getSunRenderPath());
|
|
||||||
tessellator1.startDrawingQuads();
|
|
||||||
tessellator1.addVertexWithUV((double)(-f10), 100.0D, (double)(-f10), 0.0D, 0.0D);
|
|
||||||
tessellator1.addVertexWithUV((double)f10, 100.0D, (double)(-f10), 1.0D, 0.0D);
|
|
||||||
tessellator1.addVertexWithUV((double)f10, 100.0D, (double)f10, 1.0D, 1.0D);
|
|
||||||
tessellator1.addVertexWithUV((double)(-f10), 100.0D, (double)f10, 0.0D, 1.0D);
|
|
||||||
tessellator1.draw();
|
|
||||||
f10 = 20.0F;
|
|
||||||
mc.renderEngine.bindTexture(this.getMoonRenderPath());
|
|
||||||
int k = world.getMoonPhase();
|
|
||||||
int l = k % 4;
|
|
||||||
int i1 = k / 4 % 2;
|
|
||||||
float f14 = (float)(l + 0) ;
|
|
||||||
float f15 = (float)(i1 + 0);
|
|
||||||
float f16 = (float)(l + 1) ;
|
|
||||||
float f17 = (float)(i1 + 1);
|
|
||||||
tessellator1.startDrawingQuads();
|
|
||||||
tessellator1.addVertexWithUV((double)(-f10), -100.0D, (double)f10, (double)f16, (double)f17);
|
|
||||||
tessellator1.addVertexWithUV((double)f10, -100.0D, (double)f10, (double)f14, (double)f17);
|
|
||||||
tessellator1.addVertexWithUV((double)f10, -100.0D, (double)(-f10), (double)f14, (double)f15);
|
|
||||||
tessellator1.addVertexWithUV((double)(-f10), -100.0D, (double)(-f10), (double)f16, (double)f15);
|
|
||||||
tessellator1.draw();
|
|
||||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
|
||||||
float f18 = world.getStarBrightness(par1) * f4;
|
|
||||||
|
|
||||||
if (f18 > 0.0F)
|
|
||||||
{
|
|
||||||
GL11.glColor4f(f18, f18, f18, f18);
|
|
||||||
GL11.glCallList(this.starGLCallList);
|
|
||||||
}
|
|
||||||
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
GL11.glDisable(GL11.GL_BLEND);
|
|
||||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
|
||||||
GL11.glEnable(GL11.GL_FOG);
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
|
||||||
GL11.glColor3f(0.0F, 0.0F, 0.0F);
|
|
||||||
double d0 = mc.thePlayer.getPosition(par1).yCoord - world.getHorizon();
|
|
||||||
|
|
||||||
if (d0 < 0.0D)
|
|
||||||
{
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
GL11.glTranslatef(0.0F, 12.0F, 0.0F);
|
|
||||||
GL11.glCallList(this.glSkyList2);
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
f8 = 1.0F;
|
|
||||||
f9 = -((float)(d0 + 65.0D));
|
|
||||||
f10 = -f8;
|
|
||||||
tessellator1.startDrawingQuads();
|
|
||||||
tessellator1.setColorRGBA_I(0, 255);
|
|
||||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)f8);
|
|
||||||
tessellator1.addVertex((double)f8, (double)f9, (double)f8);
|
|
||||||
tessellator1.addVertex((double)f8, (double)f10, (double)f8);
|
|
||||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)f8);
|
|
||||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8));
|
|
||||||
tessellator1.addVertex((double)f8, (double)f10, (double)(-f8));
|
|
||||||
tessellator1.addVertex((double)f8, (double)f9, (double)(-f8));
|
|
||||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)(-f8));
|
|
||||||
tessellator1.addVertex((double)f8, (double)f10, (double)(-f8));
|
|
||||||
tessellator1.addVertex((double)f8, (double)f10, (double)f8);
|
|
||||||
tessellator1.addVertex((double)f8, (double)f9, (double)f8);
|
|
||||||
tessellator1.addVertex((double)f8, (double)f9, (double)(-f8));
|
|
||||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)(-f8));
|
|
||||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)f8);
|
|
||||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)f8);
|
|
||||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8));
|
|
||||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8));
|
|
||||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)f8);
|
|
||||||
tessellator1.addVertex((double)f8, (double)f10, (double)f8);
|
|
||||||
tessellator1.addVertex((double)f8, (double)f10, (double)(-f8));
|
|
||||||
tessellator1.draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (world.provider.isSkyColored())
|
|
||||||
{
|
|
||||||
GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GL11.glColor3f(f1, f2, f3);
|
|
||||||
}
|
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
GL11.glTranslatef(0.0F, -((float)(d0 - 16.0D)), 0.0F);
|
|
||||||
GL11.glCallList(this.glSkyList2);
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
|
||||||
GL11.glDepthMask(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package StevenDimDoors.mod_pocketDim.world;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.multiplayer.WorldClient;
|
|
||||||
import net.minecraft.client.renderer.GLAllocation;
|
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
import net.minecraftforge.client.IRenderHandler;
|
|
||||||
|
|
||||||
public class LimboSkyProvider extends CustomSkyProvider
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public String getMoonRenderPath()
|
|
||||||
{
|
|
||||||
return "/mods/DimDoors/textures/other/limboMoon.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSunRenderPath()
|
|
||||||
{
|
|
||||||
return "/mods/DimDoors/textures/other/limboSun.png";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package StevenDimDoors.mod_pocketDim.world;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.multiplayer.WorldClient;
|
|
||||||
import net.minecraft.client.renderer.GLAllocation;
|
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
import net.minecraftforge.client.IRenderHandler;
|
|
||||||
|
|
||||||
public class PocketSkyProvider extends CustomSkyProvider
|
|
||||||
{
|
|
||||||
|
|
||||||
public class LimboSkyProvider extends CustomSkyProvider
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public String getMoonRenderPath()
|
|
||||||
{
|
|
||||||
return "/mods/DimDoors/textures/other/pocketMoon.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSunRenderPath()
|
|
||||||
{
|
|
||||||
return "/mods/DimDoors/textures/other/pocketSun.png";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
package StevenDimDoors.mod_pocketDimClient;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public class RenderMobObelisk extends RenderLiving
|
|
||||||
{
|
|
||||||
protected ModelMobObelisk obeliskModel;
|
|
||||||
|
|
||||||
public RenderMobObelisk(float f)
|
|
||||||
{
|
|
||||||
super(new ModelMobObelisk(), f);
|
|
||||||
this.obeliskModel = (ModelMobObelisk)this.mainModel;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
48
build.gradle
Normal file
48
build.gradle
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
name = "forge"
|
||||||
|
url = "http://files.minecraftforge.net/maven"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'forge'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
version = "2.2.1RC1-" + System.getenv("BUILD_NUMBER")
|
||||||
|
group= "com.stevenrs11.dimdoors" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
archivesBaseName = "DimensionalDoors"
|
||||||
|
|
||||||
|
minecraft {
|
||||||
|
version = "1.6.4-9.11.1.964"
|
||||||
|
}
|
||||||
|
|
||||||
|
targetCompatibility = '1.6'
|
||||||
|
sourceCompatibility = '1.6'
|
||||||
|
|
||||||
|
processResources
|
||||||
|
{
|
||||||
|
// replace stuff in mcmod.info, nothing else
|
||||||
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
|
include 'mcmod.info'
|
||||||
|
|
||||||
|
// replace version and mcversion
|
||||||
|
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy everything else, thats not the mcmod.info
|
||||||
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
|
exclude 'mcmod.info'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jar
|
||||||
|
{
|
||||||
|
destinationDir = new File("build/dist/")
|
||||||
|
}
|
|
@ -1,64 +1,93 @@
|
||||||
|
|
||||||
|
|
||||||
<project name="DimensionalDoors" default="install" basedir=".">
|
<project name="DimensionalDoors" default="install" basedir=".">
|
||||||
|
|
||||||
<property environment="env" />
|
<property environment="env" />
|
||||||
|
|
||||||
|
<property name="project.name" value="DimDoors" />
|
||||||
|
<property name="src.dir" value="StevenDimDoors" />
|
||||||
|
<property name="resources.dir" value="resources" />
|
||||||
|
<property name="schematics.dir" value="schematics" />
|
||||||
|
<property name="versionclass.dir" value="mod_pocketDim" />
|
||||||
|
<property name="versionclass.file" value="mod_pocketDim.java"/>
|
||||||
|
|
||||||
|
<property name="minecraft.version" value="1.6.4" />
|
||||||
|
<property name="forge.forgeversion" value="9.11.1" />
|
||||||
|
<property name="forge.buildnum" value="953" />
|
||||||
|
|
||||||
<property name="build.dir" value="build" />
|
<property name="build.dir" value="build" />
|
||||||
<property name="classes.dir" value="${build.dir}/packaging" />
|
<property name="classes.dir" value="${build.dir}/packaging" />
|
||||||
<property name="src.dir" value="src" />
|
<property name="resourcePack.dir" value="${classes.dir}" />
|
||||||
<property name="forge.version" value="1.5.2-7.8.0.691" />
|
<property name="schematicPack.dir" value="${classes.dir}/schematics/" />
|
||||||
|
<property name="apiclasses.dir" value="${build.dir}/api-packaging" />
|
||||||
|
<property name="forge.version" value="${minecraft.version}-${forge.forgeversion}.${forge.buildnum}" />
|
||||||
<property name="forge.url" value="http://files.minecraftforge.net/minecraftforge/minecraftforge-src-${forge.version}.zip" />
|
<property name="forge.url" value="http://files.minecraftforge.net/minecraftforge/minecraftforge-src-${forge.version}.zip" />
|
||||||
<property name="mcp.version" value="751" />
|
|
||||||
<property name="forge.dir" value="${build.dir}/forge" />
|
<property name="forge.dir" value="${build.dir}/forge" />
|
||||||
<property name="mcp.dir" value="${forge.dir}/mcp" />
|
<property name="mcp.dir" value="${forge.dir}/mcp" />
|
||||||
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft" />
|
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft/StevenDimDoors" />
|
||||||
<property name="resources.dir" value="resources" />
|
|
||||||
|
|
||||||
<property name="gson.url" value="https://google-gson.googlecode.com/files/google-gson-2.2.4-release.zip" />
|
|
||||||
<property name="gson.name" value="gson-2.2.4.zip" />
|
|
||||||
|
|
||||||
<property name="package.meta-inf" value="META-INF" />
|
<property name="package.meta-inf" value="META-INF" />
|
||||||
<property name="build.ver" value="1.5.2" />
|
|
||||||
<property name="dist.dir" value="${build.dir}/dist" />
|
<property name="dist.dir" value="${build.dir}/dist" />
|
||||||
|
|
||||||
<property name="download.dir" value="downloads" />
|
<property name="download.dir" value="${build.dir}/downloads" />
|
||||||
|
|
||||||
<property name="lib.dir" value="${mcp.dir}/lib" />
|
<property name="lib.dir" value="${mcp.dir}/lib" />
|
||||||
|
|
||||||
<property file="${forge.dir}/forgeversion.properties" />
|
<property file="${forge.dir}/forgeversion.properties" />
|
||||||
<condition property="forge.already.installed">
|
<condition property="forge.already.installed">
|
||||||
<equals arg1="${forge.build.number}" arg2="691" />
|
<equals arg1="${forge.build.number}" arg2="${forge.buildnum}" />
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<property name="verclass.dir" value="${mcpsrc.dir}/StevenDimDoors/mod_pocketDim/" />
|
|
||||||
<property name="verclass.name" value="mod_pocketDim.java"/>
|
|
||||||
|
|
||||||
|
|
||||||
<mkdir dir="${download.dir}"/>
|
<mkdir dir="${download.dir}"/>
|
||||||
<mkdir dir="${build.dir}" />
|
<mkdir dir="${build.dir}" />
|
||||||
|
|
||||||
<target name="get-version" depends="setup-forge">
|
<target name="get-version" depends="setup-forge">
|
||||||
<mkdir dir="${mcpsrc.dir}/StevenDimDoors" />
|
<!-- Copy source -->
|
||||||
<copy todir="${mcpsrc.dir}/StevenDimDoors" overwrite="true">
|
<copy todir="${mcpsrc.dir}" overwrite="true">
|
||||||
<fileset dir="StevenDimDoors" />
|
<fileset dir="${src.dir}"/>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<exec dir="${verclass.dir}" executable="sh" osfamily="unix" outputproperty="grep.out">
|
<!-- Get the version from the mcmod.info -->
|
||||||
<arg value="-c"/>
|
<script language="javascript">
|
||||||
<arg value="grep -o -P '[0-9.]+R[0-9.]+(RC[0-9]+)?(B[0-9]+)?' ${verclass.name}"/>
|
importClass(java.io.File);
|
||||||
</exec>
|
importClass(java.nio.file.Files)
|
||||||
<exec executable="python" osfamily="unix">
|
importClass(java.io.FileReader);
|
||||||
<arg value="versionscript.py" />
|
importClass(java.io.BufferedReader);
|
||||||
<arg value="${grep.out}" />
|
importClass(java.io.FileWriter);
|
||||||
</exec>
|
importClass(java.io.BufferedWriter);
|
||||||
<echo message="Grepped version: ${grep.out}"/>
|
|
||||||
<copy todir="${classes.dir}" file="mcmod.info" overwrite="true"/>
|
echo = project.createTask("echo");
|
||||||
|
echo.setMessage("Parsing mcmod.info...");
|
||||||
|
echo.perform();
|
||||||
|
|
||||||
|
var file = new File("./mcmod.info");
|
||||||
|
|
||||||
|
fr = new FileReader(file);
|
||||||
|
br = new BufferedReader(fr);
|
||||||
|
|
||||||
|
// Read the file.
|
||||||
|
// This assumes the file has no line
|
||||||
|
var line;
|
||||||
|
var json = "";
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
json += line;
|
||||||
|
}
|
||||||
|
|
||||||
|
var struct = JSON.parse(json);
|
||||||
|
var version = struct["modlist"][0].version;
|
||||||
|
|
||||||
|
echo = project.createTask("echo");
|
||||||
|
echo.setMessage("Parsed version: " + version);
|
||||||
|
echo.perform();
|
||||||
|
|
||||||
|
project.setProperty("mod.version", version);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Replace the version information in the mod class -->
|
||||||
|
<replace file="${mcpsrc.dir}/${versionclass.dir}/${versionclass.file}">
|
||||||
|
<replacefilter token="$VERSION$" value="${mod.version}"/>
|
||||||
|
</replace>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip" />
|
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip" />
|
||||||
<available property="gson-exists" file="${mcpsrc.dir}/com/google/gson/Gson.java" />
|
<available property="already-compiled" file="${classes.dir}/${src.dir}" />
|
||||||
<available property="already-compiled" file="${classes.dir}/deathrat" />
|
|
||||||
<condition property="should-download-ant-contrib">
|
<condition property="should-download-ant-contrib">
|
||||||
<or>
|
<or>
|
||||||
<available file="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
|
<available file="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
|
||||||
|
@ -67,27 +96,16 @@
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<target name="install" depends="build">
|
<target name="install" depends="build">
|
||||||
<copy todir="${classes.dir}/schematics" overwrite="true">
|
<delete dir="${mcpsrc.dir}/${src.dir}" />
|
||||||
<fileset dir="schematics" />
|
<delete dir="${dist.dir}" />
|
||||||
</copy>
|
<jar destfile="${dist.dir}/${project.name}-${mod.version}-${build.number}.jar" basedir="${classes.dir}"/>
|
||||||
<zip destfile="${dist.dir}/DimensionalDoors-${grep.out}-${build.number}.zip" basedir="${classes.dir}"/>
|
|
||||||
<delete dir="${classes.dir}" />
|
<delete dir="${classes.dir}" />
|
||||||
<delete dir="${mcp.dir}/reobf"/>
|
<delete dir="${mcp.dir}/reobf"/>
|
||||||
<delete dir="${mcpsrc.dir}/StevenDimDoors" />
|
<delete dir="{$apiclasses.dir}" />
|
||||||
<delete dir="${mcpsrc.dir}/Steven" />
|
<delete dir="${mcpsrc.dir}/${src.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="get-gson" unless="gson-exists">
|
<target name="build" depends="get-version" unless="already-compiled">
|
||||||
<get src="${gson.url}" dest="${download.dir}/${gson.name}" />
|
|
||||||
<unzip src="${download.dir}/${gson.name}" dest="${download.dir}" />
|
|
||||||
<unzip src="${download.dir}/google-gson-2.2.4/gson-2.2.4-sources.jar" dest="${download.dir}/google-gson-2.2.4/"/>
|
|
||||||
<copy todir="${mcpsrc.dir}/com">
|
|
||||||
<fileset dir="${download.dir}/google-gson-2.2.4/com"/>
|
|
||||||
</copy>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build" depends="get-version,get-gson" unless="already-compiled">
|
|
||||||
|
|
||||||
<!-- Recompile -->
|
<!-- Recompile -->
|
||||||
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
|
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
|
||||||
<arg line="/c recompile.bat"/>
|
<arg line="/c recompile.bat"/>
|
||||||
|
@ -99,19 +117,36 @@
|
||||||
|
|
||||||
<!-- Reobf -->
|
<!-- Reobf -->
|
||||||
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
|
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
|
||||||
<arg line="/c reobfuscate_srg.bat"/>
|
<arg line="/c reobfuscate.bat --srgnames"/>
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
|
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
|
||||||
<arg value="reobfuscate_srg.sh" />
|
<arg value="reobfuscate.sh" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<copy todir="${classes.dir}">
|
<copy todir="${classes.dir}">
|
||||||
<fileset dir="${mcp.dir}/reobf/minecraft"/>
|
<fileset dir="${mcp.dir}/reobf/minecraft"/>
|
||||||
</copy>
|
</copy>
|
||||||
<copy todir="${classes.dir}">
|
|
||||||
<fileset dir="${resources.dir}"/>
|
<copy todir="${resourcePack.dir}">
|
||||||
|
<fileset dir="${resources.dir}" />
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
|
<copy todir="${schematicPack.dir}">
|
||||||
|
<fileset dir="${schematics.dir}" />
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
<copy todir="${classes.dir}">
|
||||||
|
<fileset file="mcmod.info" />
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
<copy todir="${classes.dir}">
|
||||||
|
<fileset file="${resources.dir}/pack.mcmeta" />
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
<delete file="${resourcePack.dir}/mcmod.info" />
|
||||||
|
|
||||||
|
<delete file="${resourcePack.dir}/pack.mcmeta" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="build-number-there" if="env.BUILD_NUMBER" >
|
<target name="build-number-there" if="env.BUILD_NUMBER" >
|
||||||
|
@ -121,7 +156,7 @@
|
||||||
|
|
||||||
<target name="build-number-not-there" unless="env.BUILD_NUMBER" >
|
<target name="build-number-not-there" unless="env.BUILD_NUMBER" >
|
||||||
<echo message="!! No build number set !!" />
|
<echo message="!! No build number set !!" />
|
||||||
<property name="build.number" value="CUSTOM_BUILD" />
|
<property name="build.number" value="0" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="setup-forge" depends="download-forge,build-number-there,build-number-not-there" unless="forge.already.installed">
|
<target name="setup-forge" depends="download-forge,build-number-there,build-number-not-there" unless="forge.already.installed">
|
||||||
|
@ -133,15 +168,9 @@
|
||||||
</fileset>
|
</fileset>
|
||||||
</unzip>
|
</unzip>
|
||||||
|
|
||||||
|
|
||||||
<!-- Change executables' permitions -->
|
<!-- Change executables' permitions -->
|
||||||
|
|
||||||
<chmod file="${forge.dir}/install.sh" perm="+x"/>
|
<chmod file="${forge.dir}/install.sh" perm="+x"/>
|
||||||
|
|
||||||
<!-- if your building on OSX these 2 should be executable -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Install forge -->
|
<!-- Install forge -->
|
||||||
<delete dir="${mcp.dir}" failonerror="no"/>
|
<delete dir="${mcp.dir}" failonerror="no"/>
|
||||||
<exec dir="${forge.dir}" executable="cmd" osfamily="windows" inputstring="Yes\n">
|
<exec dir="${forge.dir}" executable="cmd" osfamily="windows" inputstring="Yes\n">
|
||||||
|
@ -152,28 +181,11 @@
|
||||||
<arg value="install.sh" />
|
<arg value="install.sh" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<get src="http://mirror.technicpack.net/Technic/lib/fml/fml_libs15.zip" dest="${download.dir}/fml_libs15.zip" />
|
|
||||||
<unzip src="${download.dir}/fml_libs15.zip" dest="${lib.dir}/" />
|
|
||||||
|
|
||||||
<exec dir="${forge.dir}" executable="cmd" osfamily="windows" inputstring="Yes">
|
|
||||||
<arg line="/c install.cmd"/>
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<exec dir="${forge.dir}" executable="sh" osfamily="unix" inputstring="Yes">
|
|
||||||
<arg value="install.sh" />
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<chmod file="${mcp.dir}/updatemd5.sh" perm="+x"/>
|
<chmod file="${mcp.dir}/updatemd5.sh" perm="+x"/>
|
||||||
<chmod file="${mcp.dir}/recompile.sh" perm="+x"/>
|
<chmod file="${mcp.dir}/recompile.sh" perm="+x"/>
|
||||||
<chmod file="${mcp.dir}/reobfuscate_srg.sh" perm="+x"/>
|
<chmod file="${mcp.dir}/reobfuscate.sh" perm="+x"/>
|
||||||
<chmod file="${mcp.dir}/runtime/bin/astyle-osx" perm="+x" />
|
<chmod file="${mcp.dir}/runtime/bin/astyle-osx" perm="+x" />
|
||||||
<chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x" />
|
<chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x" />
|
||||||
<!-- Copy libraries -->
|
|
||||||
<!-- <copy todir="${mcp.dir}/lib" >
|
|
||||||
<fileset dir="lib" >
|
|
||||||
<patternset includes="*.jar" />
|
|
||||||
</fileset>
|
|
||||||
</copy> -->
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="download-forge" depends="download-ant-contrib" unless="forge-exists">
|
<target name="download-forge" depends="download-ant-contrib" unless="forge-exists">
|
||||||
|
@ -186,11 +198,10 @@
|
||||||
</classpath>
|
</classpath>
|
||||||
</taskdef>
|
</taskdef>
|
||||||
<echo message="Downloading forge... " />
|
<echo message="Downloading forge... " />
|
||||||
<get src="${forge.url}" dest="${download.dir}/minecraftforge-src-${forge.version}.zip" />
|
<get src="http://files.minecraftforge.net/minecraftforge-src-${forge.version}.zip"
|
||||||
|
dest="${download.dir}/minecraftforge-src-${forge.version}.zip" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<target name="download-ant-contrib" unless="should-download-ant-contrib">
|
<target name="download-ant-contrib" unless="should-download-ant-contrib">
|
||||||
<echo message="Getting: ant-contrib"/>
|
<echo message="Getting: ant-contrib"/>
|
||||||
<mkdir dir="${download.dir}/tmp"/>
|
<mkdir dir="${download.dir}/tmp"/>
|
||||||
|
@ -217,4 +228,3 @@
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
199
buildOLD.xml
199
buildOLD.xml
|
@ -1,199 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
<project name="DimensionalDoors" default="install" basedir=".">
|
|
||||||
|
|
||||||
<property environment="env" />
|
|
||||||
|
|
||||||
<property name="build.dir" value="build" />
|
|
||||||
<property name="classes.dir" value="${build.dir}/packaging" />
|
|
||||||
<property name="src.dir" value="src" />
|
|
||||||
<property name="forge.version" value="1.5.2-7.8.0.691" />
|
|
||||||
<property name="forge.url" value="http://files.minecraftforge.net/minecraftforge/minecraftforge-src-${forge.version}.zip" />
|
|
||||||
<property name="mcp.version" value="751" />
|
|
||||||
<property name="forge.dir" value="${build.dir}/forge" />
|
|
||||||
<property name="mcp.dir" value="${forge.dir}/mcp" />
|
|
||||||
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft" />
|
|
||||||
<property name="resources.dir" value="resources" />
|
|
||||||
|
|
||||||
<property name="package.meta-inf" value="META-INF" />
|
|
||||||
<property name="build.ver" value="1.5.2" />
|
|
||||||
<property name="dist.dir" value="${build.dir}/dist" />
|
|
||||||
|
|
||||||
<property name="download.dir" value="downloads" />
|
|
||||||
|
|
||||||
<property name="lib.dir" value="${mcp.dir}/lib" />
|
|
||||||
|
|
||||||
<property file="${forge.dir}/forgeversion.properties" />
|
|
||||||
<condition property="forge.already.installed">
|
|
||||||
<equals arg1="${forge.build.number}" arg2="691" />
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<property name="verclass.dir" value="${mcpsrc.dir}/StevenDimDoors/mod_pocketDim/" />
|
|
||||||
<property name="verclass.name" value="mod_pocketDim.java"/>
|
|
||||||
|
|
||||||
|
|
||||||
<mkdir dir="${download.dir}"/>
|
|
||||||
<mkdir dir="${build.dir}" />
|
|
||||||
|
|
||||||
<target name="get-version" depends="setup-forge">
|
|
||||||
<mkdir dir="${mcpsrc.dir}/StevenDimDoors" />
|
|
||||||
<copy todir="${mcpsrc.dir}/StevenDimDoors" overwrite="true">
|
|
||||||
<fileset dir="StevenDimDoors" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<exec dir="${verclass.dir}" executable="sh" osfamily="unix" outputproperty="grep.out">
|
|
||||||
<arg value="-c"/>
|
|
||||||
<arg value="grep -o -P '[0-9.]+R[0-9.]+(RC[0-9]+)?(B[0-9]+)?' ${verclass.name}"/>
|
|
||||||
</exec>
|
|
||||||
<exec executable="python" osfamily="unix">
|
|
||||||
<arg value="versionscript.py" />
|
|
||||||
<arg value="${grep.out}" />
|
|
||||||
</exec>
|
|
||||||
<echo message="Grepped version: ${grep.out}"/>
|
|
||||||
<copy todir="${classes.dir}" file="mcmod.info" overwrite="true"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip" />
|
|
||||||
<available property="already-compiled" file="${classes.dir}/deathrat" />
|
|
||||||
<condition property="should-download-ant-contrib">
|
|
||||||
<or>
|
|
||||||
<available file="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
|
|
||||||
<available file="${download.dir}/minecraftforge-src-${forge.version}.zip"/>
|
|
||||||
</or>
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<target name="install" depends="build">
|
|
||||||
<copy todir="${classes.dir}/schematics" overwrite="true">
|
|
||||||
<fileset dir="schematics" />
|
|
||||||
</copy>
|
|
||||||
<zip destfile="${dist.dir}/DimensionalDoors-${grep.out}-${build.number}.zip" basedir="${classes.dir}"/>
|
|
||||||
<delete dir="${classes.dir}" />
|
|
||||||
<delete dir="${mcp.dir}/reobf"/>
|
|
||||||
<delete dir="${mcpsrc}/StevenDimDoors" />
|
|
||||||
<delete dir="${mcpsrc}/Steven" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build" depends="get-version" unless="already-compiled">
|
|
||||||
<!-- Recompile -->
|
|
||||||
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
|
|
||||||
<arg line="/c recompile.bat"/>
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<exec dir="${mcp.dir}" executable="sh" osfamily="unix" failonerror="true">
|
|
||||||
<arg value="recompile.sh" />
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<!-- Reobf -->
|
|
||||||
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
|
|
||||||
<arg line="/c reobfuscate_srg.bat"/>
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
|
|
||||||
<arg value="reobfuscate_srg.sh" />
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<copy todir="${classes.dir}">
|
|
||||||
<fileset dir="${mcp.dir}/reobf/minecraft"/>
|
|
||||||
</copy>
|
|
||||||
<copy todir="${classes.dir}">
|
|
||||||
<fileset dir="${resources.dir}"/>
|
|
||||||
</copy>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build-number-there" if="env.BUILD_NUMBER" >
|
|
||||||
<echo message="Using build number ${env.BUILD_NUMBER}..." />
|
|
||||||
<property name="build.number" value="${env.BUILD_NUMBER}" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build-number-not-there" unless="env.BUILD_NUMBER" >
|
|
||||||
<echo message="!! No build number set !!" />
|
|
||||||
<property name="build.number" value="CUSTOM_BUILD" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="setup-forge" depends="download-forge,build-number-there,build-number-not-there" unless="forge.already.installed">
|
|
||||||
|
|
||||||
<property name="build.full" value="${build.number}" />
|
|
||||||
<unzip dest="${build.dir}">
|
|
||||||
<fileset dir="${download.dir}">
|
|
||||||
<include name="minecraftforge-src-${forge.version}.zip"/>
|
|
||||||
</fileset>
|
|
||||||
</unzip>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Change executables' permitions -->
|
|
||||||
|
|
||||||
<chmod file="${forge.dir}/install.sh" perm="+x"/>
|
|
||||||
|
|
||||||
<!-- if your building on OSX these 2 should be executable -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Install forge -->
|
|
||||||
<delete dir="${mcp.dir}" failonerror="no"/>
|
|
||||||
<exec dir="${forge.dir}" executable="cmd" osfamily="windows" inputstring="Yes\n">
|
|
||||||
<arg line="/c install.cmd"/>
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<exec dir="${forge.dir}" executable="sh" osfamily="unix" inputstring="Yes\n">
|
|
||||||
<arg value="install.sh" />
|
|
||||||
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
|
|
||||||
<chmod file="${mcp.dir}/updatemd5.sh" perm="+x"/>
|
|
||||||
<chmod file="${mcp.dir}/recompile.sh" perm="+x"/>
|
|
||||||
<chmod file="${mcp.dir}/reobfuscate_srg.sh" perm="+x"/>
|
|
||||||
<chmod file="${mcp.dir}/runtime/bin/astyle-osx" perm="+x" />
|
|
||||||
<chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x" />
|
|
||||||
<!-- Copy libraries -->
|
|
||||||
<!-- <copy todir="${mcp.dir}/lib" >
|
|
||||||
<fileset dir="lib" >
|
|
||||||
<patternset includes="*.jar" />
|
|
||||||
</fileset>
|
|
||||||
</copy> -->
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="download-forge" depends="download-ant-contrib" unless="forge-exists">
|
|
||||||
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
|
||||||
<classpath>
|
|
||||||
<pathelement location="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
|
|
||||||
<fileset dir="${download.dir}/ant-contrib/lib">
|
|
||||||
<include name="*.jar"/>
|
|
||||||
</fileset>
|
|
||||||
</classpath>
|
|
||||||
</taskdef>
|
|
||||||
<echo message="Downloading forge... " />
|
|
||||||
<get src="${forge.url}" dest="${download.dir}/minecraftforge-src-${forge.version}.zip" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<target name="download-ant-contrib" unless="should-download-ant-contrib">
|
|
||||||
<echo message="Getting: ant-contrib"/>
|
|
||||||
<mkdir dir="${download.dir}/tmp"/>
|
|
||||||
<mkdir dir="${download.dir}/ant-contrib/lib" />
|
|
||||||
<get src="http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ant-contrib-1.0b3-bin.zip/download" dest="${download.dir}/tmp/ant-contrib-1.0b3-bin.zip"/>
|
|
||||||
<get src="http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.6-bin.zip" dest="${download.dir}/tmp/commons-codec-1.6-bin.zip"/>
|
|
||||||
|
|
||||||
<unzip src="${download.dir}/tmp/ant-contrib-1.0b3-bin.zip" dest="${download.dir}"/>
|
|
||||||
<unzip src="${download.dir}/tmp/commons-codec-1.6-bin.zip" dest="${download.dir}/tmp"/>
|
|
||||||
|
|
||||||
<move todir="${download.dir}/ant-contrib/lib">
|
|
||||||
<fileset file="${download.dir}/tmp/commons-codec-1.6/commons-codec-1.6.jar"/>
|
|
||||||
</move>
|
|
||||||
|
|
||||||
<!-- Delete useless files -->
|
|
||||||
<delete dir="${download.dir}/ant-contrib/docs"/>
|
|
||||||
<delete dir="${download.dir}/tmp"/>
|
|
||||||
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean" >
|
|
||||||
<delete dir="${build.dir}" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
|
|
||||||
</project>
|
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#Tue Oct 29 18:00:54 CDT 2013
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
|
164
gradlew
vendored
Executable file
164
gradlew
vendored
Executable file
|
@ -0,0 +1,164 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >&-
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >&-
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
gradlew.bat
vendored
Normal file
90
gradlew.bat
vendored
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
Binary file not shown.
Before Width: | Height: | Size: 1 KiB |
|
@ -1 +0,0 @@
|
||||||
0*7,1*7,2*7,3*7,4*7,5*7,6*7,5*7,4*7,3*7,2*7,1*7
|
|
|
@ -29,7 +29,7 @@ public class BlankTeleporter extends Teleporter
|
||||||
public void setEntityPosition(Entity entity, double x, double y, double z)
|
public void setEntityPosition(Entity entity, double x, double y, double z)
|
||||||
{
|
{
|
||||||
entity.lastTickPosX = entity.prevPosX = entity.posX = x;
|
entity.lastTickPosX = entity.prevPosX = entity.posX = x;
|
||||||
entity.lastTickPosY = entity.prevPosY = entity.posY = y + (double)entity.yOffset;
|
entity.lastTickPosY = entity.prevPosY = entity.posY = y + entity.yOffset;
|
||||||
entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z;
|
entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z;
|
||||||
entity.setPosition(x, y, z);
|
entity.setPosition(x, y, z);
|
||||||
}
|
}
|
|
@ -8,6 +8,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class CloudRenderBlank extends IRenderHandler
|
public class CloudRenderBlank extends IRenderHandler
|
||||||
{
|
{
|
||||||
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void render(float partialTicks, WorldClient world, Minecraft mc)
|
public void render(float partialTicks, WorldClient world, Minecraft mc)
|
||||||
{
|
{
|
|
@ -4,12 +4,18 @@ import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.network.INetworkManager;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.network.NetLoginHandler;
|
import net.minecraft.network.NetLoginHandler;
|
||||||
import net.minecraft.network.packet.NetHandler;
|
import net.minecraft.network.packet.NetHandler;
|
||||||
import net.minecraft.network.packet.Packet1Login;
|
import net.minecraft.network.packet.Packet1Login;
|
||||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.integrated.IntegratedServer;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
import net.minecraftforge.common.network.ForgePacket;
|
||||||
|
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
|
||||||
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||||
import cpw.mods.fml.common.network.Player;
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
@ -18,26 +24,23 @@ public class ConnectionHandler implements IConnectionHandler
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
||||||
|
{
|
||||||
|
for(NewDimData data : PocketManager.getDimensions())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
Packet250CustomPayload[] pkt = ForgePacket.makePacketSet(new DimensionRegisterPacket(data.id(), DimensionManager.getProviderType(data.id())));
|
||||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
manager.addToSendQueue(pkt[0]);
|
||||||
DataOutputStream writer = new DataOutputStream(buffer);
|
|
||||||
writer.writeByte(PacketConstants.CLIENT_JOIN_PACKET_ID);
|
|
||||||
PocketManager.writePacket(writer);
|
|
||||||
writer.close();
|
|
||||||
packet.channel = PacketConstants.CHANNEL_NAME;
|
|
||||||
packet.data = buffer.toByteArray();
|
|
||||||
packet.length = packet.data.length;
|
|
||||||
manager.addToSendQueue(packet);
|
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch(Exception E)
|
||||||
{
|
{
|
||||||
//This shouldn't happen...
|
|
||||||
e.printStackTrace();
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
262
src/main/java/StevenDimDoors/mod_pocketDim/DDLoot.java
Normal file
262
src/main/java/StevenDimDoors/mod_pocketDim/DDLoot.java
Normal file
|
@ -0,0 +1,262 @@
|
||||||
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.enchantment.Enchantment;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.util.WeightedRandom;
|
||||||
|
import net.minecraft.util.WeightedRandomChestContent;
|
||||||
|
import net.minecraftforge.common.ChestGenHooks;
|
||||||
|
import StevenDimDoors.mod_pocketDim.util.WeightedContainer;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Registers a category of loot chests for Dimensional Doors in Forge.
|
||||||
|
*/
|
||||||
|
public class DDLoot {
|
||||||
|
|
||||||
|
private static final double MIN_ITEM_DAMAGE = 0.3;
|
||||||
|
private static final double MAX_ITEM_DAMAGE = 0.9;
|
||||||
|
private static final int ITEM_ENCHANTMENT_CHANCE = 50;
|
||||||
|
private static final int MAX_ITEM_ENCHANTMENT_CHANCE = 100;
|
||||||
|
|
||||||
|
public static final String DIMENSIONAL_DUNGEON_CHEST = "dimensionalDungeonChest";
|
||||||
|
public static ChestGenHooks DungeonChestInfo = null;
|
||||||
|
private static final int CHEST_SIZE = 5;
|
||||||
|
|
||||||
|
private DDLoot() { }
|
||||||
|
|
||||||
|
public static void registerInfo(DDProperties properties)
|
||||||
|
{
|
||||||
|
// Register the dimensional dungeon chest with ChestGenHooks. This isn't necessary, but allows
|
||||||
|
// other mods to add their own loot to our chests if they know our loot category, without having
|
||||||
|
// to interface with our code.
|
||||||
|
DungeonChestInfo = ChestGenHooks.getInfo(DIMENSIONAL_DUNGEON_CHEST);
|
||||||
|
DungeonChestInfo.setMin(CHEST_SIZE);
|
||||||
|
DungeonChestInfo.setMax(CHEST_SIZE);
|
||||||
|
|
||||||
|
ArrayList<WeightedRandomChestContent> items = new ArrayList<WeightedRandomChestContent>();
|
||||||
|
|
||||||
|
addContent(true, items, Item.ingotIron.itemID, 160, 1, 3);
|
||||||
|
addContent(true, items, Item.coal.itemID, 120, 1, 3);
|
||||||
|
addContent(true, items, Item.netherQuartz.itemID, 120, 1, 3);
|
||||||
|
addContent(true, items, Item.enchantedBook.itemID, 100);
|
||||||
|
addContent(true, items, Item.ingotGold.itemID, 80, 1, 3);
|
||||||
|
addContent(true, items, Item.diamond.itemID, 40, 1, 2);
|
||||||
|
addContent(true, items, Item.emerald.itemID, 20, 1, 2);
|
||||||
|
addContent(true, items, Item.appleGold.itemID, 10);
|
||||||
|
|
||||||
|
addContent(properties.FabricOfRealityLootEnabled, items, mod_pocketDim.blockDimWall.blockID, 80, 4, 16);
|
||||||
|
addContent(properties.StableFabricLootEnabled, items, mod_pocketDim.itemStableFabric.itemID, 40);
|
||||||
|
|
||||||
|
// Add all the items to our dungeon chest
|
||||||
|
addItemsToContainer(DungeonChestInfo, items);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addContent(boolean include, ArrayList<WeightedRandomChestContent> items,
|
||||||
|
int itemID, int weight)
|
||||||
|
{
|
||||||
|
if (include)
|
||||||
|
items.add(new WeightedRandomChestContent(itemID, 0, 1, 1, weight));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addContent(boolean include, ArrayList<WeightedRandomChestContent> items,
|
||||||
|
int itemID, int weight, int minAmount, int maxAmount)
|
||||||
|
{
|
||||||
|
if (include)
|
||||||
|
items.add(new WeightedRandomChestContent(itemID, 0, minAmount, maxAmount, weight));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addItemsToContainer(ChestGenHooks container, ArrayList<WeightedRandomChestContent> items)
|
||||||
|
{
|
||||||
|
for (WeightedRandomChestContent item : items)
|
||||||
|
{
|
||||||
|
container.addItem(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void fillChest(ArrayList<ItemStack> stacks, IInventory inventory, Random random)
|
||||||
|
{
|
||||||
|
// This custom chest-filling function avoids overwriting item stacks
|
||||||
|
|
||||||
|
// The prime number below is used for choosing chest slots in a seemingly-random pattern. Its value
|
||||||
|
// was selected specifically to achieve a spread-out distribution for chests with up to 104 slots.
|
||||||
|
// Choosing a prime number ensures that our increments are relatively-prime to the chest size, which
|
||||||
|
// means we'll cover all the slots before repeating any. This is mathematically guaranteed.
|
||||||
|
final int primeOffset = 239333;
|
||||||
|
|
||||||
|
int size = inventory.getSizeInventory();
|
||||||
|
for (ItemStack item : stacks)
|
||||||
|
{
|
||||||
|
int limit = size;
|
||||||
|
int index = random.nextInt(size);
|
||||||
|
|
||||||
|
while (limit > 0 && inventory.getStackInSlot(index) != null)
|
||||||
|
{
|
||||||
|
limit--;
|
||||||
|
index = (index + primeOffset) % size;
|
||||||
|
}
|
||||||
|
|
||||||
|
inventory.setInventorySlotContents(index, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void generateChestContents(ChestGenHooks chestInfo, IInventory inventory, Random random)
|
||||||
|
{
|
||||||
|
// This is a custom version of net.minecraft.util.WeightedRandomChestContent.generateChestContents()
|
||||||
|
// It's designed to avoid the following bugs in MC 1.5:
|
||||||
|
// 1. If multiple enchanted books appear, then they will have the same enchantment
|
||||||
|
// 2. The randomized filling algorithm will sometimes overwrite item stacks with other stacks
|
||||||
|
|
||||||
|
int count = chestInfo.getCount(random);
|
||||||
|
WeightedRandomChestContent[] content = chestInfo.getItems(random);
|
||||||
|
ArrayList<ItemStack> allStacks = new ArrayList<ItemStack>();
|
||||||
|
|
||||||
|
for (int k = 0; k < count; k++)
|
||||||
|
{
|
||||||
|
WeightedRandomChestContent selection = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, content);
|
||||||
|
|
||||||
|
// Call getChestGenBase() to make sure we generate a different enchantment for books.
|
||||||
|
// Don't just use a condition to check if the item is an instance of ItemEnchantedBook because
|
||||||
|
// we don't know if other mods might add items that also need to be regenerated.
|
||||||
|
selection = selection.theItemId.getItem().getChestGenBase(chestInfo, random, selection);
|
||||||
|
|
||||||
|
ItemStack[] stacks = ChestGenHooks.generateStacks(random, selection.theItemId, selection.theMinimumChanceToGenerateItem, selection.theMaximumChanceToGenerateItem);
|
||||||
|
for (int h = 0; h < stacks.length; h++)
|
||||||
|
{
|
||||||
|
allStacks.add(stacks[h]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fillChest(allStacks, inventory, random);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fillGraveChest(IInventory inventory, Random random, DDProperties properties)
|
||||||
|
{
|
||||||
|
// This function fills "grave chests", which are chests for dungeons that
|
||||||
|
// look like a player died in the area and his remains were gathered in
|
||||||
|
// a chest. Doing this properly requires fine control of loot generation,
|
||||||
|
// so we use our own function rather than Minecraft's functions.
|
||||||
|
int k;
|
||||||
|
int count;
|
||||||
|
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||||
|
ArrayList<WeightedContainer<Item>> selection = new ArrayList<WeightedContainer<Item>>();
|
||||||
|
|
||||||
|
// Insert bones and rotten flesh
|
||||||
|
// Make stacks of single items to spread them out
|
||||||
|
count = MathHelper.getRandomIntegerInRange(random, 2, 5);
|
||||||
|
for (k = 0; k < count; k++)
|
||||||
|
{
|
||||||
|
stacks.add( new ItemStack(Item.bone, 1) );
|
||||||
|
}
|
||||||
|
count = MathHelper.getRandomIntegerInRange(random, 2, 4);
|
||||||
|
for (k = 0; k < count; k++)
|
||||||
|
{
|
||||||
|
stacks.add( new ItemStack(Item.rottenFlesh, 1) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert tools
|
||||||
|
// 30% chance of adding a pickaxe
|
||||||
|
if (random.nextInt(100) < 30)
|
||||||
|
{
|
||||||
|
addModifiedTool(Item.pickaxeIron, stacks, random);
|
||||||
|
}
|
||||||
|
// 30% chance of adding a bow and some arrows
|
||||||
|
if (random.nextInt(100) < 30)
|
||||||
|
{
|
||||||
|
addModifiedBow(stacks, random);
|
||||||
|
stacks.add( new ItemStack(Item.arrow, MathHelper.getRandomIntegerInRange(random, 8, 32)) );
|
||||||
|
}
|
||||||
|
// 10% chance of adding a Rift Blade (no enchants)
|
||||||
|
if (properties.RiftBladeLootEnabled && random.nextInt(100) < 10)
|
||||||
|
{
|
||||||
|
stacks.add( new ItemStack(mod_pocketDim.itemRiftBlade, 1) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 20% of adding an iron sword, 10% of adding a stone sword
|
||||||
|
addModifiedSword( getRandomItem(Item.swordIron, Item.swordStone, null, 20, 10, random) , stacks, random);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert equipment
|
||||||
|
// For each piece, 25% of an iron piece, 10% of a chainmail piece
|
||||||
|
addModifiedEquipment( getRandomItem(Item.helmetIron, Item.helmetChain, null, 25, 10, random) , stacks, random);
|
||||||
|
addModifiedEquipment( getRandomItem(Item.plateIron, Item.plateChain, null, 25, 10, random) , stacks, random);
|
||||||
|
addModifiedEquipment( getRandomItem(Item.legsIron, Item.legsChain, null, 25, 10, random) , stacks, random);
|
||||||
|
addModifiedEquipment( getRandomItem(Item.bootsIron, Item.bootsChain, null, 25, 10, random) , stacks, random);
|
||||||
|
|
||||||
|
// Insert other random stuff
|
||||||
|
// 40% chance for a name tag, 35% chance for a glass bottle, and 5% chance for record 11
|
||||||
|
addItemWithChance(stacks, random, 40, Item.nameTag, 1);
|
||||||
|
addItemWithChance(stacks, random, 35, Item.glassBottle, 1);
|
||||||
|
addItemWithChance(stacks, random, 5, Item.record11, 1);
|
||||||
|
|
||||||
|
fillChest(stacks, inventory, random);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addModifiedEquipment(Item item, ArrayList<ItemStack> stacks, Random random)
|
||||||
|
{
|
||||||
|
if (item == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
stacks.add( getModifiedItem(item, random, new Enchantment[] { Enchantment.blastProtection, Enchantment.fireProtection, Enchantment.protection, Enchantment.projectileProtection }) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addModifiedSword(Item item, ArrayList<ItemStack> stacks, Random random)
|
||||||
|
{
|
||||||
|
if (item == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
stacks.add( getModifiedItem(item, random, new Enchantment[] { Enchantment.fireAspect, Enchantment.knockback, Enchantment.sharpness }) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addModifiedTool(Item tool, ArrayList<ItemStack> stacks, Random random)
|
||||||
|
{
|
||||||
|
if (tool == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
stacks.add( getModifiedItem(tool, random, new Enchantment[] { Enchantment.efficiency, Enchantment.unbreaking }) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addModifiedBow(ArrayList<ItemStack> stacks, Random random)
|
||||||
|
{
|
||||||
|
stacks.add( getModifiedItem(Item.bow, random, new Enchantment[] { Enchantment.flame, Enchantment.power, Enchantment.punch }) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ItemStack getModifiedItem(Item item, Random random, Enchantment[] enchantments)
|
||||||
|
{
|
||||||
|
ItemStack result = applyRandomDamage(item, random);
|
||||||
|
if (enchantments.length > 0 && random.nextInt(MAX_ITEM_ENCHANTMENT_CHANCE) < ITEM_ENCHANTMENT_CHANCE)
|
||||||
|
{
|
||||||
|
result.addEnchantment(enchantments[ random.nextInt(enchantments.length) ], 1);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Item getRandomItem(Item a, Item b, Item c, int weightA, int weightB, Random random)
|
||||||
|
{
|
||||||
|
int roll = random.nextInt(100);
|
||||||
|
if (roll < weightA)
|
||||||
|
return a;
|
||||||
|
if (roll < weightA + weightB)
|
||||||
|
return b;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addItemWithChance(ArrayList<ItemStack> stacks, Random random, int chance, Item item, int count)
|
||||||
|
{
|
||||||
|
if (random.nextInt(100) < chance)
|
||||||
|
{
|
||||||
|
stacks.add(new ItemStack(item, count));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ItemStack applyRandomDamage(Item item, Random random)
|
||||||
|
{
|
||||||
|
int damage = (int) (item.getMaxDamage() * MathHelper.getRandomDoubleInRange(random, MIN_ITEM_DAMAGE, MAX_ITEM_DAMAGE));
|
||||||
|
return new ItemStack(item, 1, damage);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
import paulscode.sound.SoundSystem;
|
import paulscode.sound.SoundSystem;
|
||||||
|
import net.minecraft.client.audio.SoundManager;
|
||||||
|
import net.minecraft.client.audio.SoundPool;
|
||||||
import net.minecraft.client.audio.SoundPoolEntry;
|
import net.minecraft.client.audio.SoundPoolEntry;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -36,15 +38,15 @@ public class EventHookContainer
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onSoundLoad(SoundLoadEvent event)
|
public void onSoundLoad(SoundLoadEvent event)
|
||||||
{
|
{
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/monk.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/monk.ogg")));
|
event.manager.addSound(mod_pocketDim.modid+":monk.ogg");
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/crack.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/crack.ogg")));
|
event.manager.addSound(mod_pocketDim.modid+":crack.ogg");
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/tearing.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/tearing.ogg")));
|
event.manager.addSound(mod_pocketDim.modid+":tearing.ogg");
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/rift.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/rift.ogg")));
|
event.manager.addSound(mod_pocketDim.modid+":rift.ogg");
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftStart.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftStart.ogg")));
|
event.manager.addSound(mod_pocketDim.modid+":riftStart.ogg");
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftEnd.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftEnd.ogg")));
|
event.manager.addSound(mod_pocketDim.modid+":riftEnd.ogg");
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftClose.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftClose.ogg")));
|
event.manager.addSound(mod_pocketDim.modid+":riftClose.ogg");
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftDoor.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftDoor.ogg")));
|
event.manager.addSound(mod_pocketDim.modid+":riftDoor.ogg");
|
||||||
event.manager.soundPoolMusic.addSound("mods/DimDoors/sfx/creepy.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/creepy.ogg")));
|
event.manager.addMusic(mod_pocketDim.modid+":creepy.ogg");
|
||||||
|
|
||||||
}
|
}
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
@ -93,10 +95,11 @@ public class EventHookContainer
|
||||||
{
|
{
|
||||||
player.inventory.clearInventory(-1, -1);
|
player.inventory.clearInventory(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChunkCoordinates coords = LimboProvider.getLimboSkySpawn(player.worldObj.rand);
|
ChunkCoordinates coords = LimboProvider.getLimboSkySpawn(player.worldObj.rand);
|
||||||
Point4D destination = new Point4D((int) (coords.posX+entity.posX), coords.posY, (int) (coords.posZ+entity.posZ ), mod_pocketDim.properties.LimboDimensionID);
|
Point4D destination = new Point4D((int) (coords.posX+entity.posX), coords.posY, (int) (coords.posZ+entity.posZ ), mod_pocketDim.properties.LimboDimensionID);
|
||||||
DDTeleporter.teleportEntity(player, destination, false);
|
DDTeleporter.teleportEntity(player, destination, false);
|
||||||
player.setEntityHealth(player.getMaxHealth());
|
player.setHealth(player.getMaxHealth());
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -114,17 +117,24 @@ public class EventHookContainer
|
||||||
|
|
||||||
public void playMusicForDim(World world)
|
public void playMusicForDim(World world)
|
||||||
{
|
{
|
||||||
if(world.isRemote&&world.provider instanceof LimboProvider)
|
if(world.isRemote)
|
||||||
{
|
{
|
||||||
SoundSystem sndSystem = FMLClientHandler.instance().getClient().sndManager.sndSystem;
|
SoundManager sndManager = FMLClientHandler.instance().getClient().sndManager;
|
||||||
sndSystem.stop("BgMusic");
|
|
||||||
SoundPoolEntry soundPoolEntry = FMLClientHandler.instance().getClient().sndManager.soundPoolMusic.getRandomSoundFromSoundPool("mods.DimDoors.sfx.creepy");
|
if(world.provider instanceof LimboProvider)
|
||||||
sndSystem.backgroundMusic("LimboMusic", soundPoolEntry.soundUrl, soundPoolEntry.soundName, false);
|
{
|
||||||
sndSystem.play("LimboMusic");
|
sndManager.sndSystem.stop("BgMusic");
|
||||||
|
SoundPoolEntry soundPoolEntry = sndManager.soundPoolMusic.getRandomSoundFromSoundPool(mod_pocketDim.modid+":creepy");
|
||||||
|
if(soundPoolEntry!=null)
|
||||||
|
{
|
||||||
|
sndManager.sndSystem.backgroundMusic("LimboMusic", soundPoolEntry.getSoundUrl(), soundPoolEntry.getSoundName(), false);
|
||||||
|
sndManager.sndSystem.play("LimboMusic");
|
||||||
}
|
}
|
||||||
else if(world.isRemote && !(world.provider instanceof LimboProvider))
|
}
|
||||||
|
else if(!(world.provider instanceof LimboProvider))
|
||||||
{
|
{
|
||||||
FMLClientHandler.instance().getClient().sndManager.sndSystem.stop("LimboMusic");
|
sndManager.sndSystem.stop("LimboMusic");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InvalidClassException;
|
import java.io.InvalidClassException;
|
||||||
|
@ -6,7 +7,7 @@ import java.io.ObjectInputStream;
|
||||||
import java.io.ObjectStreamClass;
|
import java.io.ObjectStreamClass;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class ObjectSaveInputStream extends ObjectInputStream {
|
public class ObjectSaveInputStream extends ObjectInputStream {
|
||||||
|
|
||||||
// private static Logger logger = LoggerFactory.getLogger(ObjectSaveInputStream.class);
|
// private static Logger logger = LoggerFactory.getLogger(ObjectSaveInputStream.class);
|
||||||
|
@ -18,7 +19,7 @@ public class ObjectSaveInputStream extends ObjectInputStream {
|
||||||
@Override
|
@Override
|
||||||
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
|
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
|
||||||
ObjectStreamClass resultClassDescriptor = super.readClassDescriptor(); // initially streams descriptor
|
ObjectStreamClass resultClassDescriptor = super.readClassDescriptor(); // initially streams descriptor
|
||||||
Class localClass; // the class in the local JVM that this descriptor represents.
|
Class<?> localClass; // the class in the local JVM that this descriptor represents.
|
||||||
try {
|
try {
|
||||||
localClass = Class.forName(resultClassDescriptor.getName());
|
localClass = Class.forName(resultClassDescriptor.getName());
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
|
@ -11,4 +11,6 @@ public class PacketConstants
|
||||||
public static final byte DELETE_DIM_PACKET_ID = 3;
|
public static final byte DELETE_DIM_PACKET_ID = 3;
|
||||||
public static final byte CREATE_LINK_PACKET_ID = 4;
|
public static final byte CREATE_LINK_PACKET_ID = 4;
|
||||||
public static final byte DELETE_LINK_PACKET_ID = 5;
|
public static final byte DELETE_LINK_PACKET_ID = 5;
|
||||||
|
public static final byte CLIENT_LOGIN_DIM_REGISTER = 6;
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
import net.minecraftforge.common.network.ForgePacket;
|
||||||
|
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
|
||||||
|
import cpw.mods.fml.common.IPlayerTracker;
|
||||||
|
|
||||||
|
public class PlayerTracker implements IPlayerTracker
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerLogin(EntityPlayer player)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerLogout(EntityPlayer player) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerChangedDimension(EntityPlayer player) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerRespawn(EntityPlayer player)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -56,6 +56,7 @@ public class Point3D implements Serializable {
|
||||||
return this.z = z;
|
return this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Point3D clone()
|
public Point3D clone()
|
||||||
{
|
{
|
||||||
return new Point3D(x, y, z);
|
return new Point3D(x, y, z);
|
||||||
|
@ -75,6 +76,7 @@ public class Point3D implements Serializable {
|
||||||
return (this.x == other.x && this.y == other.y && this.z == other.z);
|
return (this.x == other.x && this.y == other.y && this.z == other.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object other)
|
public boolean equals(Object other)
|
||||||
{
|
{
|
||||||
return equals((Point3D) other);
|
return equals((Point3D) other);
|
|
@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
|
||||||
import net.minecraft.network.INetworkManager;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
|
@ -40,21 +41,47 @@ public class ServerPacketHandler implements IPacketHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class LinkWatcher implements IUpdateWatcher<Point4D>
|
private static class LinkWatcher implements IUpdateWatcher<ClientLinkData>
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onCreated(Point4D message)
|
public void onCreated(ClientLinkData message)
|
||||||
{
|
{
|
||||||
sendLinkPacket(PacketConstants.CREATE_LINK_PACKET_ID, message);
|
sendLinkPacket(PacketConstants.CREATE_LINK_PACKET_ID, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDeleted(Point4D message)
|
public void onDeleted(ClientLinkData message)
|
||||||
{
|
{
|
||||||
sendLinkPacket(PacketConstants.DELETE_LINK_PACKET_ID, message);
|
sendLinkPacket(PacketConstants.DELETE_LINK_PACKET_ID, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Packet250CustomPayload createLinkPacket(ClientLinkData data)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||||
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream writer = new DataOutputStream(buffer);
|
||||||
|
writer.writeByte(PacketConstants.CREATE_LINK_PACKET_ID);
|
||||||
|
data.write(writer);
|
||||||
|
writer.close();
|
||||||
|
packet.channel = PacketConstants.CHANNEL_NAME;
|
||||||
|
packet.data = buffer.toByteArray();
|
||||||
|
packet.length = packet.data.length;
|
||||||
|
return packet;
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
//This shouldn't happen...
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void sendDimPacket(byte id, ClientDimData data)
|
private static void sendDimPacket(byte id, ClientDimData data)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -77,7 +104,7 @@ public class ServerPacketHandler implements IPacketHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendLinkPacket(byte id, Point4D data)
|
private static void sendLinkPacket(byte id, ClientLinkData message)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -85,7 +112,7 @@ public class ServerPacketHandler implements IPacketHandler
|
||||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
DataOutputStream writer = new DataOutputStream(buffer);
|
DataOutputStream writer = new DataOutputStream(buffer);
|
||||||
writer.writeByte(id);
|
writer.writeByte(id);
|
||||||
Point4D.write(data, writer);
|
message.write(writer);
|
||||||
writer.close();
|
writer.close();
|
||||||
packet.channel = PacketConstants.CHANNEL_NAME;
|
packet.channel = PacketConstants.CHANNEL_NAME;
|
||||||
packet.data = buffer.toByteArray();
|
packet.data = buffer.toByteArray();
|
|
@ -6,12 +6,10 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockDoor;
|
import net.minecraft.block.BlockDoor;
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.particle.EntityFX;
|
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemDoor;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
|
@ -22,12 +20,12 @@ import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
||||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
|
|
||||||
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
|
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
|
||||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
|
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEntityProvider
|
public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEntityProvider
|
||||||
{
|
{
|
||||||
protected final DDProperties properties;
|
protected final DDProperties properties;
|
||||||
|
@ -40,12 +38,14 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_top");
|
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()+"_top");
|
||||||
this.blockIconBottom = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_bottom");
|
this.blockIconBottom = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()+"_bottom");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,6 +64,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
this.enterDimDoor(world, x, y, z, entity);
|
this.enterDimDoor(world, x, y, z, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
shouldOpen = false;
|
shouldOpen = false;
|
||||||
if (!world.isRemote && world.getBlockId(x, y-1, z) == this.blockID)
|
if (!world.isRemote && world.getBlockId(x, y-1, z) == this.blockID)
|
||||||
{
|
{
|
||||||
int var12 = (int) (MathHelper.floor_double((double)((player.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3);
|
int var12 = MathHelper.floor_double((player.rotationYaw+90) * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
|
|
||||||
if (world.getBlockMetadata(x, y-1, z) == var12)
|
if (world.getBlockMetadata(x, y-1, z) == var12)
|
||||||
{
|
{
|
||||||
|
@ -87,7 +88,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
}
|
}
|
||||||
if (!world.isRemote && world.getBlockId(x, y+1, z) == this.blockID)
|
if (!world.isRemote && world.getBlockId(x, y+1, z) == this.blockID)
|
||||||
{
|
{
|
||||||
int var12 = (int) (MathHelper.floor_double((double)((player.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3);
|
int var12 = MathHelper.floor_double((player.rotationYaw+90) * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
if(world.getBlockMetadata(x, y, z)==var12)
|
if(world.getBlockMetadata(x, y, z)==var12)
|
||||||
{
|
{
|
||||||
var12 = BlockRotator.transformMetadata(var12, 1, this.blockID);
|
var12 = BlockRotator.transformMetadata(var12, 1, this.blockID);
|
||||||
|
@ -144,6 +145,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
/**
|
/**
|
||||||
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
|
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||||
{
|
{
|
||||||
|
@ -175,6 +177,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
|
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
|
||||||
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
|
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
||||||
{
|
{
|
||||||
TileEntityDimDoor tile = (TileEntityDimDoor) par1World.getBlockTileEntity(par2, par3, par4);
|
TileEntityDimDoor tile = (TileEntityDimDoor) par1World.getBlockTileEntity(par2, par3, par4);
|
||||||
|
@ -386,7 +389,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
if (canUse && entity instanceof EntityPlayer)
|
if (canUse && entity instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
// Dont check for non-player entites
|
// Dont check for non-player entites
|
||||||
canUse = isEntityFacingDoor(metadata, (EntityLiving) entity);
|
canUse = isEntityFacingDoor(metadata, (EntityLivingBase) entity);
|
||||||
}
|
}
|
||||||
if (canUse)
|
if (canUse)
|
||||||
{
|
{
|
||||||
|
@ -418,12 +421,12 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
return (metadata & 4) != 0;
|
return (metadata & 4) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean isEntityFacingDoor(int metadata, EntityLiving entity)
|
protected static boolean isEntityFacingDoor(int metadata, EntityLivingBase entity)
|
||||||
{
|
{
|
||||||
// Although any entity has the proper fields for this check,
|
// Although any entity has the proper fields for this check,
|
||||||
// we should only apply it to living entities since things
|
// we should only apply it to living entities since things
|
||||||
// like Minecarts might come in backwards.
|
// like Minecarts might come in backwards.
|
||||||
int direction = (int) (MathHelper.floor_double((double) ((entity.rotationYaw + 90) * 4.0F / 360.0F) + 0.5D) & 3);
|
int direction = MathHelper.floor_double((entity.rotationYaw + 90) * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
return ((metadata & 3) == direction);
|
return ((metadata & 3) == direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -57,10 +57,11 @@ public class BlockDimWall extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.blockIcon[0] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
|
this.blockIcon[0] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
||||||
this.blockIcon[1] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2() + "Perm");
|
this.blockIcon[1] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "Perm");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
@ -77,6 +78,7 @@ public class BlockDimWall extends Block
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(int unknown, CreativeTabs tab, List subItems)
|
public void getSubBlocks(int unknown, CreativeTabs tab, List subItems)
|
||||||
|
@ -86,13 +88,16 @@ public class BlockDimWall extends Block
|
||||||
subItems.add(new ItemStack(this, 1, ix));
|
subItems.add(new ItemStack(this, 1, ix));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected boolean canSilkHarvest()
|
protected boolean canSilkHarvest()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int quantityDropped(Random par1Random)
|
public int quantityDropped(Random par1Random)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -101,6 +106,7 @@ public class BlockDimWall extends Block
|
||||||
/**
|
/**
|
||||||
* replaces the block clicked with the held block, instead of placing the block on top of it. Shift click to disable.
|
* replaces the block clicked with the held block, instead of placing the block on top of it. Shift click to disable.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
|
||||||
{
|
{
|
||||||
//Check if the metadata value is 0 -- we don't want the user to replace Ancient Fabric
|
//Check if the metadata value is 0 -- we don't want the user to replace Ancient Fabric
|
|
@ -30,21 +30,25 @@ public class BlockDimWallPerm extends Block
|
||||||
properties = DDProperties.instance();
|
properties = DDProperties.instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
|
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int quantityDropped(Random par1Random)
|
public int quantityDropped(Random par1Random)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only matters if the player is in limbo, acts to teleport the player from limbo back to dim 0
|
* Only matters if the player is in limbo, acts to teleport the player from limbo back to dim 0
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
|
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
|
||||||
{
|
{
|
||||||
if (!world.isRemote && world.provider.dimensionId == properties.LimboDimensionID)
|
if (!world.isRemote && world.provider.dimensionId == properties.LimboDimensionID)
|
|
@ -17,6 +17,7 @@ public class BlockDoorGold extends BlockDoor
|
||||||
{
|
{
|
||||||
|
|
||||||
private Icon blockIconBottom;
|
private Icon blockIconBottom;
|
||||||
|
@SuppressWarnings("unused") // ??
|
||||||
private DDProperties properties;
|
private DDProperties properties;
|
||||||
|
|
||||||
public BlockDoorGold(int par1, Material par2Material,DDProperties properties)
|
public BlockDoorGold(int par1, Material par2Material,DDProperties properties)
|
||||||
|
@ -26,22 +27,25 @@ public class BlockDoorGold extends BlockDoor
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
|
{
|
||||||
|
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()+"_top");
|
||||||
|
this.blockIconBottom = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()+"_bottom");
|
||||||
|
}
|
||||||
|
|
||||||
public int idDropped(int par1, Random par2Random, int par3)
|
public int idDropped(int par1, Random par2Random, int par3)
|
||||||
{
|
{
|
||||||
return mod_pocketDim.itemGoldDoor.itemID;
|
return mod_pocketDim.itemGoldDoor.itemID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
@Override
|
||||||
{
|
|
||||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_top");
|
|
||||||
this.blockIconBottom = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_bottom");
|
|
||||||
}
|
|
||||||
|
|
||||||
public Icon getIcon(int par1, int par2)
|
public Icon getIcon(int par1, int par2)
|
||||||
{
|
{
|
||||||
return this.blockIcon;
|
return this.blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||||
{
|
{
|
|
@ -1,27 +1,24 @@
|
||||||
package StevenDimDoors.mod_pocketDim.blocks;
|
package StevenDimDoors.mod_pocketDim.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
|
|
||||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
|
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
|
||||||
|
|
||||||
public class BlockGoldDimDoor extends BaseDimDoor implements IDimDoor
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public class BlockGoldDimDoor extends BaseDimDoor
|
||||||
{
|
{
|
||||||
|
|
||||||
public BlockGoldDimDoor(int blockID, Material material,
|
public BlockGoldDimDoor(int blockID, Material material,
|
||||||
DDProperties properties) {
|
DDProperties properties) {
|
||||||
super(blockID, material, properties);
|
super(blockID, material, properties);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -40,7 +40,7 @@ public class BlockLimbo extends Block
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IconRegister iconRegister)
|
public void registerIcons(IconRegister iconRegister)
|
||||||
{
|
{
|
||||||
this.blockIcon = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
|
this.blockIcon = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -17,6 +17,8 @@ import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
|
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||||
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift;
|
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift;
|
||||||
import StevenDimDoors.mod_pocketDimClient.ClosingRiftFX;
|
import StevenDimDoors.mod_pocketDimClient.ClosingRiftFX;
|
||||||
|
@ -66,7 +68,7 @@ public class BlockRift extends BlockContainer
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
|
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//sends a packet informing the client that there is a link present so it renders properly. (when placed)
|
//sends a packet informing the client that there is a link present so it renders properly. (when placed)
|
||||||
|
@ -152,6 +154,8 @@ public class BlockRift extends BlockContainer
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//function that regulates how many blocks it eats/ how fast it eats them.
|
//function that regulates how many blocks it eats/ how fast it eats them.
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(World world, int x, int y, int z, Random random)
|
public void updateTick(World world, int x, int y, int z, Random random)
|
||||||
|
@ -162,11 +166,12 @@ public class BlockRift extends BlockContainer
|
||||||
//Randomly decide whether to search for blocks to destroy. This reduces the frequency of search operations,
|
//Randomly decide whether to search for blocks to destroy. This reduces the frequency of search operations,
|
||||||
//moderates performance impact, and controls the apparent speed of block destruction.
|
//moderates performance impact, and controls the apparent speed of block destruction.
|
||||||
if (random.nextInt(MAX_BLOCK_SEARCH_CHANCE) < BLOCK_SEARCH_CHANCE &&
|
if (random.nextInt(MAX_BLOCK_SEARCH_CHANCE) < BLOCK_SEARCH_CHANCE &&
|
||||||
((TileEntityRift) world.getBlockTileEntity(x, y, z)).isNearRift )
|
((TileEntityRift) world.getBlockTileEntity(x, y, z)).isNearRift() )
|
||||||
{
|
{
|
||||||
destroyNearbyBlocks(world, x, y, z, random);
|
destroyNearbyBlocks(world, x, y, z, random);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void destroyNearbyBlocks(World world, int x, int y, int z, Random random)
|
private void destroyNearbyBlocks(World world, int x, int y, int z, Random random)
|
||||||
|
@ -313,10 +318,10 @@ public class BlockRift extends BlockContainer
|
||||||
yChange=(float) ((yGrowth+yGrowthn)+rand.nextGaussian()*.05F);
|
yChange=(float) ((yGrowth+yGrowthn)+rand.nextGaussian()*.05F);
|
||||||
zChange=(float) ((zGrowth+zGrowthn)+rand.nextGaussian()*.05F);
|
zChange=(float) ((zGrowth+zGrowthn)+rand.nextGaussian()*.05F);
|
||||||
|
|
||||||
Xoffset= (float) ((0.25F/(1+Math.abs(xChange))));
|
Xoffset= ((0.25F/(1+Math.abs(xChange))));
|
||||||
|
|
||||||
Yoffset= (float) ((0.25F/(1+Math.abs(yChange))));
|
Yoffset= ((0.25F/(1+Math.abs(yChange))));
|
||||||
Zoffset= (float) ((0.25F/(1+Math.abs(zChange))));
|
Zoffset= ((0.25F/(1+Math.abs(zChange))));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class DimensionalDoor extends BaseDimDoor
|
public class DimensionalDoor extends BaseDimDoor
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,6 @@ import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.item.ItemDoor;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
|
@ -17,9 +16,9 @@ import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
|
|
||||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
|
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider
|
public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -32,7 +31,7 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
|
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Teleports the player to the exit link of that dimension, assuming it is a pocket
|
//Teleports the player to the exit link of that dimension, assuming it is a pocket
|
||||||
|
@ -65,6 +64,7 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
|
||||||
this.updateAttachedTile(world, x, y, z);
|
this.updateAttachedTile(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateTick(World world, int x, int y, int z, Random random)
|
public void updateTick(World world, int x, int y, int z, Random random)
|
||||||
{
|
{
|
||||||
TileEntityTransTrapdoor tile = (TileEntityTransTrapdoor) world.getBlockTileEntity(x, y, z);
|
TileEntityTransTrapdoor tile = (TileEntityTransTrapdoor) world.getBlockTileEntity(x, y, z);
|
|
@ -1,21 +1,21 @@
|
||||||
package StevenDimDoors.mod_pocketDim.blocks;
|
package StevenDimDoors.mod_pocketDim.blocks;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.client.particle.EntityFX;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EntityLiving;
|
|
||||||
import net.minecraft.item.ItemDoor;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
||||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
|
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.particle.EntityFX;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class TransientDoor extends BaseDimDoor
|
public class TransientDoor extends BaseDimDoor
|
||||||
{
|
{
|
||||||
public TransientDoor(int blockID, Material material, DDProperties properties)
|
public TransientDoor(int blockID, Material material, DDProperties properties)
|
||||||
|
@ -37,10 +37,10 @@ public class TransientDoor extends BaseDimDoor
|
||||||
{
|
{
|
||||||
boolean canUse = true;
|
boolean canUse = true;
|
||||||
int metadata = world.getBlockMetadata(x, y - 1, z);
|
int metadata = world.getBlockMetadata(x, y - 1, z);
|
||||||
if (canUse && entity instanceof EntityLiving)
|
if (canUse && entity instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
// Don't check for non-living entities since it might not work right
|
// Don't check for non-living entities since it might not work right
|
||||||
canUse = BaseDimDoor.isEntityFacingDoor(metadata, (EntityLiving) entity);
|
canUse = BaseDimDoor.isEntityFacingDoor(metadata, (EntityLivingBase) entity);
|
||||||
}
|
}
|
||||||
if (canUse)
|
if (canUse)
|
||||||
{
|
{
|
|
@ -9,6 +9,7 @@ import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class WarpDoor extends BaseDimDoor
|
public class WarpDoor extends BaseDimDoor
|
||||||
{
|
{
|
||||||
public WarpDoor(int blockID, Material material, DDProperties properties)
|
public WarpDoor(int blockID, Material material, DDProperties properties)
|
|
@ -1,9 +1,5 @@
|
||||||
package StevenDimDoors.mod_pocketDim.commands;
|
package StevenDimDoors.mod_pocketDim.commands;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||||
|
@ -13,6 +9,13 @@ import StevenDimDoors.mod_pocketDim.dungeon.DungeonData;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.world.PocketBuilder;
|
import StevenDimDoors.mod_pocketDim.world.PocketBuilder;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class CommandCreateDungeonRift extends DDCommandBase
|
public class CommandCreateDungeonRift extends DDCommandBase
|
||||||
{
|
{
|
||||||
private static CommandCreateDungeonRift instance = null;
|
private static CommandCreateDungeonRift instance = null;
|
||||||
|
@ -30,6 +33,13 @@ public class CommandCreateDungeonRift extends DDCommandBase
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandUsage(ICommandSender sender) {
|
||||||
|
return "Usage: /dd-rift <dungeon name>\r\n" +
|
||||||
|
" /dd-rift list\r\n" +
|
||||||
|
" /dd-rift random";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||||
{
|
{
|
||||||
|
@ -54,9 +64,9 @@ public class CommandCreateDungeonRift extends DDCommandBase
|
||||||
Collection<String> dungeonNames = dungeonHelper.getDungeonNames();
|
Collection<String> dungeonNames = dungeonHelper.getDungeonNames();
|
||||||
for (String name : dungeonNames)
|
for (String name : dungeonNames)
|
||||||
{
|
{
|
||||||
sender.sendChatToPlayer(name);
|
sendChat(sender,(name));
|
||||||
}
|
}
|
||||||
sender.sendChatToPlayer("");
|
sendChat(sender,(""));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -65,7 +75,7 @@ public class CommandCreateDungeonRift extends DDCommandBase
|
||||||
int x = MathHelper.floor_double(sender.posX);
|
int x = MathHelper.floor_double(sender.posX);
|
||||||
int y = MathHelper.floor_double(sender.posY);
|
int y = MathHelper.floor_double(sender.posY);
|
||||||
int z = MathHelper.floor_double (sender.posZ);
|
int z = MathHelper.floor_double (sender.posZ);
|
||||||
int orientation = MathHelper.floor_double((double) ((sender.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
|
int orientation = MathHelper.floor_double((sender.rotationYaw + 180.0F) * 4.0F / 360.0F - 0.5D) & 3;
|
||||||
|
|
||||||
if (command[0].equals("random"))
|
if (command[0].equals("random"))
|
||||||
{
|
{
|
||||||
|
@ -74,7 +84,7 @@ public class CommandCreateDungeonRift extends DDCommandBase
|
||||||
link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON,orientation);
|
link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON,orientation);
|
||||||
sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID,0,3);
|
sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID,0,3);
|
||||||
|
|
||||||
sender.sendChatToPlayer("Created a rift to a random dungeon.");
|
sendChat(sender,("Created a rift to a random dungeon."));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -93,7 +103,7 @@ public class CommandCreateDungeonRift extends DDCommandBase
|
||||||
PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, result);
|
PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, result);
|
||||||
|
|
||||||
sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID,0,3);
|
sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID,0,3);
|
||||||
sender.sendChatToPlayer("Created a rift to \"" + result.schematicName() + "\" dungeon (Dimension ID = " + link.destination().getDimension() + ").");
|
sendChat(sender,("Created a rift to \"" + result.schematicName() + "\" dungeon (Dimension ID = " + link.destination().getDimension() + ")."));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
|
@ -1,5 +1,6 @@
|
||||||
package StevenDimDoors.mod_pocketDim.commands;
|
package StevenDimDoors.mod_pocketDim.commands;
|
||||||
|
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||||
|
|
||||||
|
@ -20,6 +21,11 @@ public class CommandCreatePocket extends DDCommandBase
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandUsage(ICommandSender sender) {
|
||||||
|
return "Usage: /dd-create";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +47,7 @@ public class CommandCreatePocket extends DDCommandBase
|
||||||
DungeonHelper.instance().createCustomDungeonDoor(sender.worldObj, x, y, z);
|
DungeonHelper.instance().createCustomDungeonDoor(sender.worldObj, x, y, z);
|
||||||
|
|
||||||
//Notify the player
|
//Notify the player
|
||||||
sender.sendChatToPlayer("Created a door to a pocket dimension. Please build your dungeon there.");
|
sendChat(sender,("Created a door to a pocket dimension. Please build your dungeon there."));
|
||||||
}
|
}
|
||||||
return DDCommandResult.SUCCESS;
|
return DDCommandResult.SUCCESS;
|
||||||
}
|
}
|
|
@ -1,14 +1,16 @@
|
||||||
package StevenDimDoors.mod_pocketDim.commands;
|
package StevenDimDoors.mod_pocketDim.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.DimensionManager;
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class CommandDeleteAllLinks extends DDCommandBase
|
public class CommandDeleteAllLinks extends DDCommandBase
|
||||||
{
|
{
|
||||||
private static CommandDeleteAllLinks instance = null;
|
private static CommandDeleteAllLinks instance = null;
|
||||||
|
@ -26,6 +28,11 @@ public class CommandDeleteAllLinks extends DDCommandBase
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandUsage(ICommandSender sender) {
|
||||||
|
return "Usage: /dd-deletelinks <targetDimensionID>";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +48,7 @@ public class CommandDeleteAllLinks extends DDCommandBase
|
||||||
{
|
{
|
||||||
targetDim=0;
|
targetDim=0;
|
||||||
shouldGo=false;
|
shouldGo=false;
|
||||||
sender.sendChatToPlayer("Error-Invalid argument, delete_all_links <targetDimID>");
|
sendChat(sender, ("Error-Invalid argument, delete_all_links <targetDimID>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(shouldGo)
|
if(shouldGo)
|
||||||
|
@ -59,7 +66,7 @@ public class CommandDeleteAllLinks extends DDCommandBase
|
||||||
|
|
||||||
linksRemoved++;
|
linksRemoved++;
|
||||||
}
|
}
|
||||||
sender.sendChatToPlayer("Removed " + linksRemoved + " links.");
|
sendChat(sender,("Removed " + linksRemoved + " links."));
|
||||||
|
|
||||||
}
|
}
|
||||||
return DDCommandResult.SUCCESS; //TEMPORARY HACK
|
return DDCommandResult.SUCCESS; //TEMPORARY HACK
|
|
@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
|
@ -9,6 +10,7 @@ import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class CommandDeleteRifts extends DDCommandBase
|
public class CommandDeleteRifts extends DDCommandBase
|
||||||
{
|
{
|
||||||
private static CommandDeleteRifts instance = null;
|
private static CommandDeleteRifts instance = null;
|
||||||
|
@ -26,6 +28,11 @@ public class CommandDeleteRifts extends DDCommandBase
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandUsage(ICommandSender sender) {
|
||||||
|
return "Usage: /dd-??? <dimension ID>";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +48,7 @@ public class CommandDeleteRifts extends DDCommandBase
|
||||||
{
|
{
|
||||||
targetDim=0;
|
targetDim=0;
|
||||||
shouldGo=false;
|
shouldGo=false;
|
||||||
sender.sendChatToPlayer("Error-Invalid argument, delete_all_links <targetDimID>");
|
sendChat(sender,("Error-Invalid argument, delete_all_links <targetDimID>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(shouldGo)
|
if(shouldGo)
|
||||||
|
@ -54,14 +61,20 @@ public class CommandDeleteRifts extends DDCommandBase
|
||||||
{
|
{
|
||||||
World targetWorld = PocketManager.loadDimension(targetDim);
|
World targetWorld = PocketManager.loadDimension(targetDim);
|
||||||
|
|
||||||
if(sender.worldObj.getBlockId(link.source().getX(), link.source().getY(), link.source().getZ())==mod_pocketDim.blockRift.blockID)
|
if(!mod_pocketDim.blockRift.isBlockImmune(sender.worldObj,link.source().getX(), link.source().getY(), link.source().getZ())||
|
||||||
|
(targetWorld.getBlockId(link.source().getX(), link.source().getY(), link.source().getZ())==mod_pocketDim.blockRift.blockID))
|
||||||
{
|
{
|
||||||
targetWorld.setBlock(link.source().getX(), link.source().getY(), link.source().getZ(), 0);
|
|
||||||
linksRemoved++;
|
linksRemoved++;
|
||||||
|
targetWorld.setBlock(link.source().getX(), link.source().getY(), link.source().getZ(), 0);
|
||||||
dim.deleteLink(link);
|
dim.deleteLink(link);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//TODO Probably should check what the block is, but thats annoying so Ill do it later.
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
sender.sendChatToPlayer("Removed " + linksRemoved + " rifts.");
|
sendChat(sender,("Removed " + linksRemoved + " links."));
|
||||||
|
|
||||||
}
|
}
|
||||||
return DDCommandResult.SUCCESS; //TEMPORARY HACK
|
return DDCommandResult.SUCCESS; //TEMPORARY HACK
|
|
@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.commands;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||||
|
@ -25,6 +26,13 @@ public class CommandExportDungeon extends DDCommandBase
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandUsage(ICommandSender sender) {
|
||||||
|
return "Usage: /dd-export <dungeon type> <dungeon name> open <weight>\r\n" +
|
||||||
|
" /dd-export <dungeon type> <dungeon name> closed <weight>\r\n" +
|
||||||
|
" /dd-export <schematic name> override";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||||
{
|
{
|
||||||
|
@ -132,7 +140,7 @@ public class CommandExportDungeon extends DDCommandBase
|
||||||
String exportPath = properties.CustomSchematicDirectory + File.separator + name + ".schematic";
|
String exportPath = properties.CustomSchematicDirectory + File.separator + name + ".schematic";
|
||||||
if (dungeonHelper.exportDungeon(player.worldObj, x, y, z, exportPath))
|
if (dungeonHelper.exportDungeon(player.worldObj, x, y, z, exportPath))
|
||||||
{
|
{
|
||||||
player.sendChatToPlayer("Saved dungeon schematic in " + exportPath);
|
sendChat(player,("Saved dungeon schematic in " + exportPath));
|
||||||
dungeonHelper.registerDungeon(exportPath, dungeonHelper.getDungeonPack("ruins"), false, true);
|
dungeonHelper.registerDungeon(exportPath, dungeonHelper.getDungeonPack("ruins"), false, true);
|
||||||
return DDCommandResult.SUCCESS;
|
return DDCommandResult.SUCCESS;
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||||
|
@ -9,6 +10,7 @@ import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class CommandResetDungeons extends DDCommandBase
|
public class CommandResetDungeons extends DDCommandBase
|
||||||
{
|
{
|
||||||
private static CommandResetDungeons instance = null;
|
private static CommandResetDungeons instance = null;
|
||||||
|
@ -26,6 +28,11 @@ public class CommandResetDungeons extends DDCommandBase
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandUsage(ICommandSender sender) {
|
||||||
|
return "/dd-resetdungeons";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +91,7 @@ public class CommandResetDungeons extends DDCommandBase
|
||||||
//TODO- for some reason the parent field of loaded dimenions get reset to null if I call .setParentToRoot() before I delete the pockets.
|
//TODO- for some reason the parent field of loaded dimenions get reset to null if I call .setParentToRoot() before I delete the pockets.
|
||||||
//TODO implement blackList
|
//TODO implement blackList
|
||||||
//Notify the user of the results
|
//Notify the user of the results
|
||||||
sender.sendChatToPlayer("Reset complete. " + resetCount + " out of " + dungeonCount + " dungeons were reset.");
|
sendChat(sender,("Reset complete. " + resetCount + " out of " + dungeonCount + " dungeons were reset."));
|
||||||
return DDCommandResult.SUCCESS;
|
return DDCommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,30 +1,23 @@
|
||||||
package StevenDimDoors.mod_pocketDim.commands;
|
package StevenDimDoors.mod_pocketDim.commands;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
||||||
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
|
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import net.minecraft.command.ICommandSender;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.BlankTeleporter;
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
|
||||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.world.WorldServer;
|
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
|
||||||
|
|
||||||
public class CommandTeleportPlayer extends DDCommandBase
|
public class CommandTeleportPlayer extends DDCommandBase
|
||||||
{
|
{
|
||||||
private static CommandTeleportPlayer instance = null;
|
private static CommandTeleportPlayer instance = null;
|
||||||
|
|
||||||
private CommandTeleportPlayer()
|
private CommandTeleportPlayer()
|
||||||
{
|
{
|
||||||
super("dd-tp", new String[] {"<Player Name> <Dimension ID> <X Coord> <Y Coord> <Z Coord>"} );
|
super("dd-tp", new String[] {"<Player Name> <Dimension ID> <X Coord> <Y Coord> <Z Coord>","<Player Name> <Dimension ID>"} );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CommandTeleportPlayer instance()
|
public static CommandTeleportPlayer instance()
|
||||||
|
@ -36,13 +29,17 @@ public class CommandTeleportPlayer extends DDCommandBase
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandUsage(ICommandSender sender) {
|
||||||
|
return "Usage: /dd-tp <player name> <dimension id> <x> <y> <z>";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO- Change to accept variety of input, like just coords, just dim ID, or two player names.
|
* TODO- Change to accept variety of input, like just coords, just dim ID, or two player names.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||||
{
|
{
|
||||||
List dimensionIDs = Arrays.asList(DimensionManager.getStaticDimensionIDs()); //Gets list of all registered dimensions, regardless if loaded or not
|
|
||||||
EntityPlayer targetPlayer = sender;
|
EntityPlayer targetPlayer = sender;
|
||||||
int dimDestinationID = sender.worldObj.provider.dimensionId;
|
int dimDestinationID = sender.worldObj.provider.dimensionId;
|
||||||
|
|
||||||
|
@ -65,7 +62,7 @@ public class CommandTeleportPlayer extends DDCommandBase
|
||||||
}
|
}
|
||||||
dimDestinationID=Integer.parseInt(command[1]);//gets the target dim ID from the command string
|
dimDestinationID=Integer.parseInt(command[1]);//gets the target dim ID from the command string
|
||||||
|
|
||||||
if(!dimensionIDs.contains(dimDestinationID))
|
if(!DimensionManager.isDimensionRegistered(dimDestinationID))
|
||||||
{
|
{
|
||||||
return DDCommandResult.INVALID_DIMENSION_ID;
|
return DDCommandResult.INVALID_DIMENSION_ID;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +71,55 @@ public class CommandTeleportPlayer extends DDCommandBase
|
||||||
Point4D destination = new Point4D(Integer.parseInt(command[2]),Integer.parseInt(command[3]),Integer.parseInt(command[4]),dimDestinationID);
|
Point4D destination = new Point4D(Integer.parseInt(command[2]),Integer.parseInt(command[3]),Integer.parseInt(command[4]),dimDestinationID);
|
||||||
DDTeleporter.teleportEntity(targetPlayer, destination, false);
|
DDTeleporter.teleportEntity(targetPlayer, destination, false);
|
||||||
}
|
}
|
||||||
|
else if(command.length == 2 && isInteger(command[1]))
|
||||||
|
{
|
||||||
|
if(sender.worldObj.getPlayerEntityByName(command[0])!=null) //Gets the targeted player
|
||||||
|
{
|
||||||
|
targetPlayer = sender.worldObj.getPlayerEntityByName(command[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return DDCommandResult.INVALID_ARGUMENTS;
|
||||||
|
}
|
||||||
|
dimDestinationID=Integer.parseInt(command[1]);//gets the target dim ID from the command string
|
||||||
|
|
||||||
|
if(!DimensionManager.isDimensionRegistered(dimDestinationID))
|
||||||
|
{
|
||||||
|
return DDCommandResult.INVALID_DIMENSION_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Point4D destination = PocketManager.getDimensionData(dimDestinationID).origin();
|
||||||
|
if(!PocketManager.getDimensionData(dimDestinationID).isPocketDimension())
|
||||||
|
{
|
||||||
|
destination = new Point4D(destination.getX(),PocketManager.loadDimension(dimDestinationID).getTopSolidOrLiquidBlock(
|
||||||
|
destination.getX(), destination.getZ()),
|
||||||
|
destination.getZ(),destination.getDimension());
|
||||||
|
}
|
||||||
|
DDTeleporter.teleportEntity(targetPlayer, destination, false);
|
||||||
|
}
|
||||||
|
else if(command.length == 1 && isInteger(command[0]))
|
||||||
|
{
|
||||||
|
|
||||||
|
targetPlayer = sender;
|
||||||
|
|
||||||
|
dimDestinationID=Integer.parseInt(command[0]);//gets the target dim ID from the command string
|
||||||
|
|
||||||
|
if(!DimensionManager.isDimensionRegistered(dimDestinationID))
|
||||||
|
{
|
||||||
|
return DDCommandResult.INVALID_DIMENSION_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Point4D destination = PocketManager.getDimensionData(dimDestinationID).origin();
|
||||||
|
if(!PocketManager.getDimensionData(dimDestinationID).isPocketDimension())
|
||||||
|
{
|
||||||
|
destination = new Point4D(destination.getX(),PocketManager.loadDimension(dimDestinationID).getTopSolidOrLiquidBlock(
|
||||||
|
destination.getX(), destination.getZ()),
|
||||||
|
destination.getZ(),destination.getDimension());
|
||||||
|
}
|
||||||
|
DDTeleporter.teleportEntity(targetPlayer, destination, false);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return DDCommandResult.INVALID_ARGUMENTS;
|
return DDCommandResult.INVALID_ARGUMENTS;
|
|
@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.commands;
|
||||||
import net.minecraft.command.CommandBase;
|
import net.minecraft.command.CommandBase;
|
||||||
import net.minecraft.command.ICommandSender;
|
import net.minecraft.command.ICommandSender;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.util.ChatMessageComponent;
|
||||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -32,6 +33,7 @@ public abstract class DDCommandBase extends CommandBase
|
||||||
*/
|
*/
|
||||||
protected abstract DDCommandResult processCommand(EntityPlayer sender, String[] command);
|
protected abstract DDCommandResult processCommand(EntityPlayer sender, String[] command);
|
||||||
|
|
||||||
|
@Override
|
||||||
public final String getCommandName()
|
public final String getCommandName()
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
|
@ -49,6 +51,7 @@ public abstract class DDCommandBase extends CommandBase
|
||||||
* Method invoked by the server to execute a command. The call is forwarded to a derived class
|
* Method invoked by the server to execute a command. The call is forwarded to a derived class
|
||||||
* to provide the sending player directly.
|
* to provide the sending player directly.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void processCommand(ICommandSender sender, String[] command)
|
public final void processCommand(ICommandSender sender, String[] command)
|
||||||
{
|
{
|
||||||
//Forward the command
|
//Forward the command
|
||||||
|
@ -63,10 +66,24 @@ public abstract class DDCommandBase extends CommandBase
|
||||||
//Send the argument formats for this command
|
//Send the argument formats for this command
|
||||||
for (String format : formats)
|
for (String format : formats)
|
||||||
{
|
{
|
||||||
player.sendChatToPlayer("Usage: " + name + " " + format);
|
sendChat(player,("Usage: " + name + " " + format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.sendChatToPlayer(result.getMessage());
|
sendChat(player,(result.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sendChat(EntityPlayer player, String message)
|
||||||
|
{
|
||||||
|
ChatMessageComponent cmp = new ChatMessageComponent();
|
||||||
|
cmp.addText(message);
|
||||||
|
player.sendChatToPlayer(cmp);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(Object par1Obj)
|
||||||
|
{
|
||||||
|
return this.getCommandName().compareTo(((CommandBase)par1Obj).getCommandName());
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -9,8 +9,8 @@ import net.minecraft.entity.EntityList;
|
||||||
import net.minecraft.entity.item.EntityMinecart;
|
import net.minecraft.entity.item.EntityMinecart;
|
||||||
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.item.ItemDoor;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
import net.minecraft.network.packet.Packet41EntityEffect;
|
import net.minecraft.network.packet.Packet41EntityEffect;
|
||||||
import net.minecraft.network.packet.Packet43Experience;
|
import net.minecraft.network.packet.Packet43Experience;
|
||||||
import net.minecraft.network.packet.Packet9Respawn;
|
import net.minecraft.network.packet.Packet9Respawn;
|
||||||
|
@ -20,20 +20,22 @@ import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
import net.minecraftforge.common.network.ForgePacket;
|
||||||
|
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.blocks.BlockRift;
|
|
||||||
import StevenDimDoors.mod_pocketDim.blocks.IDimDoor;
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
|
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
|
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
|
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
|
||||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
|
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||||
|
import StevenDimDoors.mod_pocketDim.watcher.ClientDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.world.PocketBuilder;
|
import StevenDimDoors.mod_pocketDim.world.PocketBuilder;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class DDTeleporter
|
public class DDTeleporter
|
||||||
{
|
{
|
||||||
private static final Random random = new Random();
|
private static final Random random = new Random();
|
||||||
|
@ -235,7 +237,7 @@ public class DDTeleporter
|
||||||
private static void setEntityPosition(Entity entity, double x, double y, double z)
|
private static void setEntityPosition(Entity entity, double x, double y, double z)
|
||||||
{
|
{
|
||||||
entity.lastTickPosX = entity.prevPosX = entity.posX = x;
|
entity.lastTickPosX = entity.prevPosX = entity.posX = x;
|
||||||
entity.lastTickPosY = entity.prevPosY = entity.posY = y + (double)entity.yOffset;
|
entity.lastTickPosY = entity.prevPosY = entity.posY = y + entity.yOffset;
|
||||||
entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z;
|
entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z;
|
||||||
entity.setPosition(x, y, z);
|
entity.setPosition(x, y, z);
|
||||||
}
|
}
|
||||||
|
@ -273,6 +275,7 @@ public class DDTeleporter
|
||||||
throw new IllegalArgumentException("destination cannot be null.");
|
throw new IllegalArgumentException("destination cannot be null.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//This beautiful teleport method is based off of xCompWiz's teleport function.
|
//This beautiful teleport method is based off of xCompWiz's teleport function.
|
||||||
|
|
||||||
WorldServer oldWorld = (WorldServer) entity.worldObj;
|
WorldServer oldWorld = (WorldServer) entity.worldObj;
|
||||||
|
@ -304,7 +307,7 @@ public class DDTeleporter
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newWorld = (WorldServer) oldWorld;
|
newWorld = oldWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -317,6 +320,10 @@ public class DDTeleporter
|
||||||
if(player != null) // Are we working with a player?
|
if(player != null) // Are we working with a player?
|
||||||
{
|
{
|
||||||
// We need to do all this special stuff to move a player between dimensions.
|
// We need to do all this special stuff to move a player between dimensions.
|
||||||
|
//Give the client the dimensionData for the destination
|
||||||
|
PocketManager.dimWatcher.onCreated(new ClientDimData(PocketManager.getDimensionData(destination.getDimension())));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Set the new dimension and inform the client that it's moving to a new world.
|
// Set the new dimension and inform the client that it's moving to a new world.
|
||||||
player.dimension = destination.getDimension();
|
player.dimension = destination.getDimension();
|
||||||
|
@ -327,6 +334,7 @@ public class DDTeleporter
|
||||||
// the last non-sleeping player leaves the Overworld
|
// the last non-sleeping player leaves the Overworld
|
||||||
// for a pocket dimension, causing all sleeping players
|
// for a pocket dimension, causing all sleeping players
|
||||||
// to remain asleep instead of progressing to day.
|
// to remain asleep instead of progressing to day.
|
||||||
|
((WorldServer)entity.worldObj).getPlayerManager().removePlayer(player);
|
||||||
oldWorld.removePlayerEntityDangerously(player);
|
oldWorld.removePlayerEntityDangerously(player);
|
||||||
player.isDead = false;
|
player.isDead = false;
|
||||||
|
|
||||||
|
@ -357,13 +365,13 @@ public class DDTeleporter
|
||||||
oldWorld.getChunkFromChunkCoords(entX, entZ).isModified = true;
|
oldWorld.getChunkFromChunkCoords(entX, entZ).isModified = true;
|
||||||
}
|
}
|
||||||
// Memory concerns.
|
// Memory concerns.
|
||||||
oldWorld.releaseEntitySkin(entity);
|
oldWorld.onEntityRemoved(entity);
|
||||||
|
|
||||||
if (player == null) // Are we NOT working with a player?
|
if (player == null) // Are we NOT working with a player?
|
||||||
{
|
{
|
||||||
NBTTagCompound entityNBT = new NBTTagCompound();
|
NBTTagCompound entityNBT = new NBTTagCompound();
|
||||||
entity.isDead = false;
|
entity.isDead = false;
|
||||||
entity.addEntityID(entityNBT);
|
entity.writeMountToNBT(entityNBT);
|
||||||
entity.isDead = true;
|
entity.isDead = true;
|
||||||
entity = EntityList.createEntityFromNBT(entityNBT, newWorld);
|
entity = EntityList.createEntityFromNBT(entityNBT, newWorld);
|
||||||
|
|
||||||
|
@ -399,7 +407,6 @@ public class DDTeleporter
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
newWorld.getChunkProvider().loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4);
|
newWorld.getChunkProvider().loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4);
|
||||||
|
|
||||||
// Tell Forge we're moving its players so everyone else knows.
|
// Tell Forge we're moving its players so everyone else knows.
|
||||||
// Let's try doing this down here in case this is what's killing NEI.
|
// Let's try doing this down here in case this is what's killing NEI.
|
||||||
GameRegistry.onPlayerChangedDimension((EntityPlayer)entity);
|
GameRegistry.onPlayerChangedDimension((EntityPlayer)entity);
|
||||||
|
@ -471,7 +478,7 @@ public class DDTeleporter
|
||||||
{
|
{
|
||||||
if(PocketManager.isBlackListed(link.destination().getDimension()))
|
if(PocketManager.isBlackListed(link.destination().getDimension()))
|
||||||
{
|
{
|
||||||
link=PocketManager.getDimensionData(link.source().getDimension()).createLink(link.source,LinkTypes.SAFE_EXIT,link.orientation);
|
link=PocketManager.getDimensionData(link.source().getDimension()).createLink(link.link.point,LinkTypes.SAFE_EXIT,link.link.orientation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -547,7 +554,7 @@ public class DDTeleporter
|
||||||
// To avoid loops, don't generate a destination if the player is
|
// To avoid loops, don't generate a destination if the player is
|
||||||
// already in a non-pocket dimension.
|
// already in a non-pocket dimension.
|
||||||
|
|
||||||
NewDimData current = PocketManager.getDimensionData(link.source.getDimension());
|
NewDimData current = PocketManager.getDimensionData(link.link.point.getDimension());
|
||||||
if (current.isPocketDimension())
|
if (current.isPocketDimension())
|
||||||
{
|
{
|
||||||
Point4D source = link.source();
|
Point4D source = link.source();
|
||||||
|
@ -571,7 +578,7 @@ public class DDTeleporter
|
||||||
{
|
{
|
||||||
World startWorld = PocketManager.loadDimension(link.source().getDimension());
|
World startWorld = PocketManager.loadDimension(link.source().getDimension());
|
||||||
World destWorld = PocketManager.loadDimension(link.destination().getDimension());
|
World destWorld = PocketManager.loadDimension(link.destination().getDimension());
|
||||||
TileEntity doorTE = startWorld.getBlockTileEntity(link.source().getX(), link.source().getY(), link.source.getZ());
|
TileEntity doorTE = startWorld.getBlockTileEntity(link.source().getX(), link.source().getY(), link.link.point.getZ());
|
||||||
if(doorTE instanceof TileEntityDimDoor)
|
if(doorTE instanceof TileEntityDimDoor)
|
||||||
{
|
{
|
||||||
if((TileEntityDimDoor.class.cast(doorTE).hasGennedPair))
|
if((TileEntityDimDoor.class.cast(doorTE).hasGennedPair))
|
||||||
|
@ -601,7 +608,7 @@ public class DDTeleporter
|
||||||
}
|
}
|
||||||
private static boolean generateSafeExit(DimLink link, DDProperties properties)
|
private static boolean generateSafeExit(DimLink link, DDProperties properties)
|
||||||
{
|
{
|
||||||
NewDimData current = PocketManager.getDimensionData(link.source.getDimension());
|
NewDimData current = PocketManager.getDimensionData(link.link.point.getDimension());
|
||||||
return generateSafeExit(current.root(), link, properties);
|
return generateSafeExit(current.root(), link, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +617,7 @@ public class DDTeleporter
|
||||||
// A dungeon exit acts the same as a safe exit, but has the chance of
|
// A dungeon exit acts the same as a safe exit, but has the chance of
|
||||||
// taking the user to any non-pocket dimension, excluding Limbo and The End.
|
// taking the user to any non-pocket dimension, excluding Limbo and The End.
|
||||||
|
|
||||||
NewDimData current = PocketManager.getDimensionData(link.source.getDimension());
|
NewDimData current = PocketManager.getDimensionData(link.link.point.getDimension());
|
||||||
ArrayList<NewDimData> roots = PocketManager.getRootDimensions();
|
ArrayList<NewDimData> roots = PocketManager.getRootDimensions();
|
||||||
int shiftChance = START_ROOT_SHIFT_CHANCE + ROOT_SHIFT_CHANCE_PER_LEVEL * (current.packDepth() - 1);
|
int shiftChance = START_ROOT_SHIFT_CHANCE + ROOT_SHIFT_CHANCE_PER_LEVEL * (current.packDepth() - 1);
|
||||||
|
|
|
@ -4,46 +4,56 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||||
|
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
|
||||||
|
|
||||||
public abstract class DimLink
|
public abstract class DimLink
|
||||||
{
|
{
|
||||||
protected Point4D source;
|
protected ClientLinkData link;
|
||||||
protected DimLink parent;
|
protected DimLink parent;
|
||||||
protected LinkTail tail;
|
protected LinkTail tail;
|
||||||
protected int orientation;
|
|
||||||
protected List<DimLink> children;
|
protected List<DimLink> children;
|
||||||
|
|
||||||
protected DimLink(Point4D source, DimLink parent, int orientation)
|
protected DimLink(ClientLinkData link, DimLink parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (parent.source.getDimension() != source.getDimension())
|
if (parent.link.point.getDimension() != link.point.getDimension())
|
||||||
{
|
{
|
||||||
// Ban having children in other dimensions to avoid serialization issues with cross-dimensional tails
|
// Ban having children in other dimensions to avoid serialization issues with cross-dimensional tails
|
||||||
throw new IllegalArgumentException("source and parent.source must have the same dimension.");
|
throw new IllegalArgumentException("source and parent.source must have the same dimension.");
|
||||||
}
|
}
|
||||||
this.orientation=orientation;
|
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.source = source;
|
this.link = link;
|
||||||
this.tail = parent.tail;
|
this.tail = parent.tail;
|
||||||
this.children = new LinkedList<DimLink>();
|
this.children = new LinkedList<DimLink>();
|
||||||
parent.children.add(this);
|
parent.children.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DimLink(Point4D source, int linkType, int orientation)
|
protected DimLink(ClientLinkData link, int linkType)
|
||||||
{
|
{
|
||||||
if ((linkType < LinkTypes.ENUM_MIN || linkType > LinkTypes.ENUM_MAX) && linkType != LinkTypes.CLIENT_SIDE)
|
if ((linkType < LinkTypes.ENUM_MIN || linkType > LinkTypes.ENUM_MAX) && linkType != LinkTypes.CLIENT_SIDE)
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException("The specified link type is invalid.");
|
throw new IllegalArgumentException("The specified link type is invalid.");
|
||||||
}
|
}
|
||||||
this.orientation = orientation;
|
|
||||||
this.parent = null;
|
this.parent = null;
|
||||||
this.source = source;
|
this.link = link;
|
||||||
this.tail = new LinkTail(linkType, null);
|
this.tail = new LinkTail(linkType, null);
|
||||||
this.children = new LinkedList<DimLink>();
|
this.children = new LinkedList<DimLink>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point4D source()
|
public Point4D source()
|
||||||
{
|
{
|
||||||
return source;
|
return link.point;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int orientation()
|
||||||
|
{
|
||||||
|
return link.orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientLinkData link()
|
||||||
|
{
|
||||||
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point4D destination()
|
public Point4D destination()
|
||||||
|
@ -52,7 +62,7 @@ public abstract class DimLink
|
||||||
}
|
}
|
||||||
public int getDestinationOrientation()
|
public int getDestinationOrientation()
|
||||||
{
|
{
|
||||||
return PocketManager.getLink(source.getX(), source.getY(), source.getZ(), source.getDimension()).orientation();
|
return PocketManager.getLink(link.point.getX(), link.point.getY(), link.point.getZ(), link.point.getDimension()).link().orientation;
|
||||||
}
|
}
|
||||||
public boolean hasDestination()
|
public boolean hasDestination()
|
||||||
{
|
{
|
||||||
|
@ -78,13 +88,9 @@ public abstract class DimLink
|
||||||
{
|
{
|
||||||
return tail.getLinkType();
|
return tail.getLinkType();
|
||||||
}
|
}
|
||||||
public int orientation()
|
|
||||||
{
|
|
||||||
return orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return source + " -> " + (hasDestination() ? destination() : "");
|
return link.point + " -> " + (hasDestination() ? destination() : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@ import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||||
|
@ -14,18 +15,19 @@ import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack;
|
||||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||||
import StevenDimDoors.mod_pocketDim.watcher.IUpdateWatcher;
|
import StevenDimDoors.mod_pocketDim.watcher.IUpdateWatcher;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public abstract class NewDimData
|
public abstract class NewDimData
|
||||||
{
|
{
|
||||||
private static class InnerDimLink extends DimLink
|
private static class InnerDimLink extends DimLink
|
||||||
{
|
{
|
||||||
public InnerDimLink(Point4D source, DimLink parent,int orientation)
|
public InnerDimLink(Point4D source, DimLink parent,int orientation)
|
||||||
{
|
{
|
||||||
super(source, parent,orientation);
|
super(new ClientLinkData(source, orientation), parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InnerDimLink(Point4D source, int linkType, int orientation)
|
public InnerDimLink(Point4D source, int linkType, int orientation)
|
||||||
{
|
{
|
||||||
super(source, linkType,orientation);
|
super(new ClientLinkData(source, orientation), linkType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDestination(int x, int y, int z, NewDimData dimension)
|
public void setDestination(int x, int y, int z, NewDimData dimension)
|
||||||
|
@ -49,7 +51,7 @@ public abstract class NewDimData
|
||||||
}
|
}
|
||||||
|
|
||||||
parent = null;
|
parent = null;
|
||||||
source = null;
|
link = null;
|
||||||
tail = new LinkTail(0, null);
|
tail = new LinkTail(0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +66,7 @@ public abstract class NewDimData
|
||||||
//Ignore this request silently
|
//Ignore this request silently
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (nextParent.source.getDimension() != source.getDimension())
|
if (nextParent.link.point.getDimension() != link.point.getDimension())
|
||||||
{
|
{
|
||||||
// Ban having children in other dimensions to avoid serialization issues with cross-dimensional tails
|
// Ban having children in other dimensions to avoid serialization issues with cross-dimensional tails
|
||||||
throw new IllegalArgumentException("source and parent.source must have the same dimension.");
|
throw new IllegalArgumentException("source and parent.source must have the same dimension.");
|
||||||
|
@ -87,7 +89,7 @@ public abstract class NewDimData
|
||||||
parent = nextParent;
|
parent = nextParent;
|
||||||
tail = nextParent.tail;
|
tail = nextParent.tail;
|
||||||
nextParent.children.add(this);
|
nextParent.children.add(this);
|
||||||
this.orientation=orientation;
|
this.link.orientation=orientation;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +112,7 @@ public abstract class NewDimData
|
||||||
parent = null;
|
parent = null;
|
||||||
tail = new LinkTail(linkType, null);
|
tail = new LinkTail(linkType, null);
|
||||||
//Set new orientation
|
//Set new orientation
|
||||||
this.orientation=orientation;
|
this.link.orientation=orientation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,10 +131,10 @@ public abstract class NewDimData
|
||||||
protected Point4D origin;
|
protected Point4D origin;
|
||||||
protected int orientation;
|
protected int orientation;
|
||||||
protected DungeonData dungeon;
|
protected DungeonData dungeon;
|
||||||
protected IUpdateWatcher<Point4D> linkWatcher;
|
public IUpdateWatcher<ClientLinkData> linkWatcher;
|
||||||
|
|
||||||
protected NewDimData(int id, NewDimData parent, boolean isPocket, boolean isDungeon,
|
protected NewDimData(int id, NewDimData parent, boolean isPocket, boolean isDungeon,
|
||||||
IUpdateWatcher<Point4D> linkWatcher)
|
IUpdateWatcher<ClientLinkData> linkWatcher)
|
||||||
{
|
{
|
||||||
// The isPocket flag is redundant. It's meant as an integrity safeguard.
|
// The isPocket flag is redundant. It's meant as an integrity safeguard.
|
||||||
if (isPocket && (parent == null))
|
if (isPocket && (parent == null))
|
||||||
|
@ -196,6 +198,7 @@ public abstract class NewDimData
|
||||||
this.root = root;
|
this.root = root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public DimLink findNearestRift(World world, int range, int x, int y, int z)
|
public DimLink findNearestRift(World world, int range, int x, int y, int z)
|
||||||
{
|
{
|
||||||
//TODO: Rewrite this later to use an octtree
|
//TODO: Rewrite this later to use an octtree
|
||||||
|
@ -224,7 +227,7 @@ public abstract class NewDimData
|
||||||
for (k = -range; k <= range; k++)
|
for (k = -range; k <= range; k++)
|
||||||
{
|
{
|
||||||
distance = getAbsoluteSum(i, j, k);
|
distance = getAbsoluteSum(i, j, k);
|
||||||
if (distance > 1 && distance < minDistance && world.getBlockId(x + i, y + j, z + k) == properties.RiftBlockID)
|
if (distance > 0 && distance < minDistance && world.getBlockId(x + i, y + j, z + k) == properties.RiftBlockID)
|
||||||
{
|
{
|
||||||
link = getLink(x+i, y+j, z+k);
|
link = getLink(x+i, y+j, z+k);
|
||||||
if (link != null)
|
if (link != null)
|
||||||
|
@ -240,11 +243,52 @@ public abstract class NewDimData
|
||||||
return nearest;
|
return nearest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<DimLink> findRiftsInRange(World world, int range, int x, int y, int z)
|
||||||
|
{
|
||||||
|
ArrayList<DimLink> links = new ArrayList<DimLink>();
|
||||||
|
//TODO: Rewrite this later to use an octtree
|
||||||
|
|
||||||
|
//Sanity check...
|
||||||
|
if (world.provider.dimensionId != id)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("Attempted to search for links in a World instance for a different dimension!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Note: Only detect rifts at a distance > 1, so we ignore the rift
|
||||||
|
//that called this function and any adjacent rifts.
|
||||||
|
|
||||||
|
DimLink link;
|
||||||
|
|
||||||
|
int distance;
|
||||||
|
int i, j, k;
|
||||||
|
DDProperties properties = DDProperties.instance();
|
||||||
|
|
||||||
|
for (i = -range; i <= range; i++)
|
||||||
|
{
|
||||||
|
for (j = -range; j <= range; j++)
|
||||||
|
{
|
||||||
|
for (k = -range; k <= range; k++)
|
||||||
|
{
|
||||||
|
distance = getAbsoluteSum(i, j, k);
|
||||||
|
if (distance > 0 && world.getBlockId(x + i, y + j, z + k) == properties.RiftBlockID)
|
||||||
|
{
|
||||||
|
link = getLink(x+i, y+j, z+k);
|
||||||
|
if (link != null)
|
||||||
|
{
|
||||||
|
links.add(link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return links;
|
||||||
|
}
|
||||||
|
|
||||||
private static int getAbsoluteSum(int i, int j, int k)
|
private static int getAbsoluteSum(int i, int j, int k)
|
||||||
{
|
{
|
||||||
return Math.abs(i) + Math.abs(j) + Math.abs(k);
|
return Math.abs(i) + Math.abs(j) + Math.abs(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DimLink createLink(int x, int y, int z, int linkType,int orientation)
|
public DimLink createLink(int x, int y, int z, int linkType,int orientation)
|
||||||
{
|
{
|
||||||
return createLink(new Point4D(x, y, z, id), linkType,orientation);
|
return createLink(new Point4D(x, y, z, id), linkType,orientation);
|
||||||
|
@ -267,7 +311,7 @@ public abstract class NewDimData
|
||||||
//Link created!
|
//Link created!
|
||||||
if(linkType!=LinkTypes.CLIENT_SIDE)
|
if(linkType!=LinkTypes.CLIENT_SIDE)
|
||||||
{
|
{
|
||||||
linkWatcher.onCreated(link.source);
|
linkWatcher.onCreated(link.link);
|
||||||
}
|
}
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
@ -290,19 +334,19 @@ public abstract class NewDimData
|
||||||
InnerDimLink link = linkMapping.get(source);
|
InnerDimLink link = linkMapping.get(source);
|
||||||
if (link == null)
|
if (link == null)
|
||||||
{
|
{
|
||||||
link = new InnerDimLink(source, parent, parent.orientation);
|
link = new InnerDimLink(source, parent, parent.link.orientation);
|
||||||
linkMapping.put(source, link);
|
linkMapping.put(source, link);
|
||||||
linkList.add(link);
|
linkList.add(link);
|
||||||
|
|
||||||
//Link created!
|
//Link created!
|
||||||
linkWatcher.onCreated(link.source);
|
linkWatcher.onCreated(link.link);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (link.overwrite(parent, parent.orientation))
|
if (link.overwrite(parent, parent.link.orientation))
|
||||||
{
|
{
|
||||||
//Link created!
|
//Link created!
|
||||||
linkWatcher.onCreated(link.source);
|
linkWatcher.onCreated(link.link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return link;
|
return link;
|
||||||
|
@ -319,7 +363,7 @@ public abstract class NewDimData
|
||||||
{
|
{
|
||||||
linkList.remove(target);
|
linkList.remove(target);
|
||||||
//Raise deletion event
|
//Raise deletion event
|
||||||
linkWatcher.onDeleted(target.source);
|
linkWatcher.onDeleted(target.link);
|
||||||
target.clear();
|
target.clear();
|
||||||
}
|
}
|
||||||
return (target != null);
|
return (target != null);
|
||||||
|
@ -333,7 +377,11 @@ public abstract class NewDimData
|
||||||
{
|
{
|
||||||
linkList.remove(target);
|
linkList.remove(target);
|
||||||
//Raise deletion event
|
//Raise deletion event
|
||||||
linkWatcher.onDeleted(target.source);
|
//TODO why is source null here?
|
||||||
|
if(target.link!=null)
|
||||||
|
{
|
||||||
|
linkWatcher.onDeleted(target.link);
|
||||||
|
}
|
||||||
target.clear();
|
target.clear();
|
||||||
}
|
}
|
||||||
return (target != null);
|
return (target != null);
|
|
@ -9,6 +9,8 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
|
@ -36,6 +38,7 @@ import StevenDimDoors.mod_pocketDim.watcher.UpdateWatcherProxy;
|
||||||
* This class regulates all the operations involving the storage and manipulation of dimensions. It handles saving dim data, teleporting the player, and
|
* This class regulates all the operations involving the storage and manipulation of dimensions. It handles saving dim data, teleporting the player, and
|
||||||
* creating/registering new dimensions as well as loading old dimensions on startup
|
* creating/registering new dimensions as well as loading old dimensions on startup
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class PocketManager
|
public class PocketManager
|
||||||
{
|
{
|
||||||
private static class InnerDimData extends NewDimData implements IPackable<PackedDimData>
|
private static class InnerDimData extends NewDimData implements IPackable<PackedDimData>
|
||||||
|
@ -46,7 +49,7 @@ public class PocketManager
|
||||||
// that any link destinations must be real dimensions controlled by PocketManager.
|
// that any link destinations must be real dimensions controlled by PocketManager.
|
||||||
|
|
||||||
public InnerDimData(int id, InnerDimData parent, boolean isPocket, boolean isDungeon,
|
public InnerDimData(int id, InnerDimData parent, boolean isPocket, boolean isDungeon,
|
||||||
IUpdateWatcher<Point4D> linkWatcher)
|
IUpdateWatcher<ClientLinkData> linkWatcher)
|
||||||
{
|
{
|
||||||
super(id, parent, isPocket, isDungeon, linkWatcher);
|
super(id, parent, isPocket, isDungeon, linkWatcher);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +121,7 @@ public class PocketManager
|
||||||
Point3D parentPoint = new Point3D(-1,-1,-1);
|
Point3D parentPoint = new Point3D(-1,-1,-1);
|
||||||
if(link.parent!=null)
|
if(link.parent!=null)
|
||||||
{
|
{
|
||||||
parentPoint=link.parent.source.toPoint3D();
|
parentPoint=link.parent.link.point.toPoint3D();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(DimLink childLink : link.children)
|
for(DimLink childLink : link.children)
|
||||||
|
@ -126,7 +129,7 @@ public class PocketManager
|
||||||
children.add(childLink.source().toPoint3D());
|
children.add(childLink.source().toPoint3D());
|
||||||
}
|
}
|
||||||
PackedLinkTail tail = new PackedLinkTail(link.tail.getDestination(),link.tail.getLinkType());
|
PackedLinkTail tail = new PackedLinkTail(link.tail.getDestination(),link.tail.getLinkType());
|
||||||
Links.add(new PackedLinkData(link.source,parentPoint,tail,link.orientation,children));
|
Links.add(new PackedLinkData(link.link.point,parentPoint,tail,link.link.orientation,children));
|
||||||
|
|
||||||
PackedLinkTail tempTail = new PackedLinkTail(link.tail.getDestination(),link.tail.getLinkType());
|
PackedLinkTail tempTail = new PackedLinkTail(link.tail.getDestination(),link.tail.getLinkType());
|
||||||
if(Tails.contains(tempTail))
|
if(Tails.contains(tempTail))
|
||||||
|
@ -211,8 +214,8 @@ public class PocketManager
|
||||||
* Set as true if we are a client that has connected to a dedicated server
|
* Set as true if we are a client that has connected to a dedicated server
|
||||||
*/
|
*/
|
||||||
public static volatile boolean isConnected = false;
|
public static volatile boolean isConnected = false;
|
||||||
private static final UpdateWatcherProxy<Point4D> linkWatcher = new UpdateWatcherProxy<Point4D>();
|
public static final UpdateWatcherProxy<ClientLinkData> linkWatcher = new UpdateWatcherProxy<ClientLinkData>();
|
||||||
private static final UpdateWatcherProxy<ClientDimData> dimWatcher = new UpdateWatcherProxy<ClientDimData>();
|
static final UpdateWatcherProxy<ClientDimData> dimWatcher = new UpdateWatcherProxy<ClientDimData>();
|
||||||
private static ArrayList<NewDimData> rootDimensions = null;
|
private static ArrayList<NewDimData> rootDimensions = null;
|
||||||
|
|
||||||
//HashMap that maps all the dimension IDs registered with DimDoors to their DD data.
|
//HashMap that maps all the dimension IDs registered with DimDoors to their DD data.
|
||||||
|
@ -276,6 +279,7 @@ public class PocketManager
|
||||||
dimData.parent=dimData;
|
dimData.parent=dimData;
|
||||||
dimData.isFilled=packedData.IsFilled;
|
dimData.isFilled=packedData.IsFilled;
|
||||||
dimData.origin = new Point4D(packedData.Origin.getX(),packedData.Origin.getY(),packedData.Origin.getZ(),packedData.ID);
|
dimData.origin = new Point4D(packedData.Origin.getX(),packedData.Origin.getY(),packedData.Origin.getZ(),packedData.ID);
|
||||||
|
|
||||||
PocketManager.rootDimensions.add(dimData);
|
PocketManager.rootDimensions.add(dimData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -284,6 +288,7 @@ public class PocketManager
|
||||||
dimData = new InnerDimData(packedData.ID, test,true, packedData.IsDungeon, linkWatcher);
|
dimData = new InnerDimData(packedData.ID, test,true, packedData.IsDungeon, linkWatcher);
|
||||||
dimData.isFilled=packedData.IsFilled;
|
dimData.isFilled=packedData.IsFilled;
|
||||||
dimData.origin = new Point4D(packedData.Origin.getX(),packedData.Origin.getY(),packedData.Origin.getZ(),packedData.ID);
|
dimData.origin = new Point4D(packedData.Origin.getX(),packedData.Origin.getY(),packedData.Origin.getZ(),packedData.ID);
|
||||||
|
|
||||||
dimData.root=PocketManager.getDimensionData(packedData.RootID);
|
dimData.root=PocketManager.getDimensionData(packedData.RootID);
|
||||||
|
|
||||||
if(packedData.DungeonData!=null)
|
if(packedData.DungeonData!=null)
|
||||||
|
@ -454,11 +459,7 @@ public class PocketManager
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
System.out.println("Writing Dimensional Doors save data...");
|
DDSaveHandler.saveAll(dimensionData.values(), dimensionIDBlackList);
|
||||||
if ( DDSaveHandler.saveAll(dimensionData.values(),dimensionIDBlackList) )
|
|
||||||
{
|
|
||||||
System.out.println("Saved successfully!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -525,6 +526,7 @@ public class PocketManager
|
||||||
return dimension;
|
return dimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
private static NewDimData registerClientDimension(int dimensionID, int rootID)
|
private static NewDimData registerClientDimension(int dimensionID, int rootID)
|
||||||
{
|
{
|
||||||
// No need to raise events heres since this code should only run on the client side
|
// No need to raise events heres since this code should only run on the client side
|
||||||
|
@ -549,10 +551,13 @@ public class PocketManager
|
||||||
{
|
{
|
||||||
dimension = root;
|
dimension = root;
|
||||||
}
|
}
|
||||||
if(dimension.isPocketDimension())
|
if(dimension.isPocketDimension()&&!DimensionManager.isDimensionRegistered(dimension.id()))
|
||||||
{
|
{
|
||||||
//Im registering pocket dims here. I *think* we can assume that if its a pocket and we are
|
//Im registering pocket dims here. I *think* we can assume that if its a pocket and we are
|
||||||
//registering its dim data, we also need to register it with forge.
|
//registering its dim data, we also need to register it with forge.
|
||||||
|
|
||||||
|
//New packet stuff prevents this from always being true, unfortuantly. I send the dimdata to the client when they teleport.
|
||||||
|
//Steven
|
||||||
DimensionManager.registerDimension(dimensionID, mod_pocketDim.properties.PocketProviderID);
|
DimensionManager.registerDimension(dimensionID, mod_pocketDim.properties.PocketProviderID);
|
||||||
}
|
}
|
||||||
return dimension;
|
return dimension;
|
||||||
|
@ -596,8 +601,7 @@ public class PocketManager
|
||||||
|
|
||||||
public static void unload()
|
public static void unload()
|
||||||
{
|
{
|
||||||
System.out.println("Dimensional Doors unloading...");
|
System.out.println("Unloading Pocket Dimensions...");
|
||||||
|
|
||||||
if (!isLoaded)
|
if (!isLoaded)
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("Pocket dimensions have already been unloaded!");
|
throw new IllegalStateException("Pocket dimensions have already been unloaded!");
|
||||||
|
@ -648,12 +652,12 @@ public class PocketManager
|
||||||
return dimWatcher.unregisterReceiver(watcher);
|
return dimWatcher.unregisterReceiver(watcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerLinkWatcher(IUpdateWatcher<Point4D> watcher)
|
public static void registerLinkWatcher(IUpdateWatcher<ClientLinkData> watcher)
|
||||||
{
|
{
|
||||||
linkWatcher.registerReceiver(watcher);
|
linkWatcher.registerReceiver(watcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean unregisterLinkWatcher(IUpdateWatcher<Point4D> watcher)
|
public static boolean unregisterLinkWatcher(IUpdateWatcher<ClientLinkData> watcher)
|
||||||
{
|
{
|
||||||
return linkWatcher.unregisterReceiver(watcher);
|
return linkWatcher.unregisterReceiver(watcher);
|
||||||
}
|
}
|
||||||
|
@ -685,9 +689,10 @@ public class PocketManager
|
||||||
}
|
}
|
||||||
public static void readPacket(DataInputStream input) throws IOException
|
public static void readPacket(DataInputStream input) throws IOException
|
||||||
{
|
{
|
||||||
|
//TODO- figure out why this is getting called so frequently
|
||||||
if (isLoaded)
|
if (isLoaded)
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("Pocket dimensions have already been loaded!");
|
return;
|
||||||
}
|
}
|
||||||
if (isLoading)
|
if (isLoading)
|
||||||
{
|
{
|
||||||
|
@ -696,8 +701,12 @@ public class PocketManager
|
||||||
// Load compacted client-side dimension data
|
// Load compacted client-side dimension data
|
||||||
load();
|
load();
|
||||||
Compactor.readDimensions(input, new DimRegistrationCallback());
|
Compactor.readDimensions(input, new DimRegistrationCallback());
|
||||||
isConnected = true;
|
|
||||||
|
// Register pocket dimensions
|
||||||
|
DDProperties properties = DDProperties.instance();
|
||||||
|
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
|
isConnected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -81,6 +81,7 @@ public class DungeonSchematic extends Schematic {
|
||||||
|
|
||||||
public static DungeonSchematic readFromFile(File schematicFile) throws FileNotFoundException, InvalidSchematicException
|
public static DungeonSchematic readFromFile(File schematicFile) throws FileNotFoundException, InvalidSchematicException
|
||||||
{
|
{
|
||||||
|
// TODO: fix resource leak
|
||||||
return readFromStream(new FileInputStream(schematicFile));
|
return readFromStream(new FileInputStream(schematicFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +170,7 @@ public class DungeonSchematic extends Schematic {
|
||||||
return new DungeonSchematic(Schematic.copyFromWorld(world, x, y, z, width, height, length, doCompactBounds));
|
return new DungeonSchematic(Schematic.copyFromWorld(world, x, y, z, width, height, length, doCompactBounds));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyToWorld(World world, Point3D pocketCenter, int targetOrientation, DimLink entryLink, Random random)
|
public void copyToWorld(World world, Point3D pocketCenter, int targetOrientation, DimLink entryLink, Random random, DDProperties properties)
|
||||||
{
|
{
|
||||||
//TODO: This function is an improvised solution so we can get the release moving. In the future,
|
//TODO: This function is an improvised solution so we can get the release moving. In the future,
|
||||||
//we should generalize block transformations and implement support for them at the level of Schematic,
|
//we should generalize block transformations and implement support for them at the level of Schematic,
|
||||||
|
@ -223,10 +224,10 @@ public class DungeonSchematic extends Schematic {
|
||||||
world.setBlockTileEntity(pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), TileEntity.createAndLoadEntity(tileTag));
|
world.setBlockTileEntity(pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), TileEntity.createAndLoadEntity(tileTag));
|
||||||
}
|
}
|
||||||
|
|
||||||
setUpDungeon(PocketManager.getDimensionData(world), world, pocketCenter, turnAngle, entryLink, random);
|
setUpDungeon(PocketManager.getDimensionData(world), world, pocketCenter, turnAngle, entryLink, random, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpDungeon(NewDimData dimension, World world, Point3D pocketCenter, int turnAngle, DimLink entryLink, Random random)
|
private void setUpDungeon(NewDimData dimension, World world, Point3D pocketCenter, int turnAngle, DimLink entryLink, Random random, DDProperties properties)
|
||||||
{
|
{
|
||||||
//Transform dungeon corners
|
//Transform dungeon corners
|
||||||
Point3D minCorner = new Point3D(0, 0, 0);
|
Point3D minCorner = new Point3D(0, 0, 0);
|
||||||
|
@ -234,7 +235,7 @@ public class DungeonSchematic extends Schematic {
|
||||||
transformCorners(entranceDoorLocation, pocketCenter, turnAngle, minCorner, maxCorner);
|
transformCorners(entranceDoorLocation, pocketCenter, turnAngle, minCorner, maxCorner);
|
||||||
|
|
||||||
//Fill empty chests and dispensers
|
//Fill empty chests and dispensers
|
||||||
FillContainersOperation filler = new FillContainersOperation(random);
|
FillContainersOperation filler = new FillContainersOperation(random, properties);
|
||||||
filler.apply(world, minCorner, maxCorner);
|
filler.apply(world, minCorner, maxCorner);
|
||||||
|
|
||||||
//Set up entrance door rift
|
//Set up entrance door rift
|
||||||
|
@ -301,7 +302,7 @@ public class DungeonSchematic extends Schematic {
|
||||||
Point3D location = point.clone();
|
Point3D location = point.clone();
|
||||||
BlockRotator.transformPoint(location, entrance, rotation, pocketCenter);
|
BlockRotator.transformPoint(location, entrance, rotation, pocketCenter);
|
||||||
int orientation = world.getBlockMetadata(location.getX(), location.getY()-1, location.getZ());
|
int orientation = world.getBlockMetadata(location.getX(), location.getY()-1, location.getZ());
|
||||||
dimension.createLink(location.getX(), location.getY(), location.getZ(), LinkTypes.DUNGEON_EXIT,orientation);
|
dimension.createLink(location.getX(), location.getY(), location.getZ(), LinkTypes.DUNGEON_EXIT, orientation);
|
||||||
//Replace the sandstone block under the exit door with the same block as the one underneath it
|
//Replace the sandstone block under the exit door with the same block as the one underneath it
|
||||||
int x = location.getX();
|
int x = location.getX();
|
||||||
int y = location.getY() - 3;
|
int y = location.getY() - 3;
|
||||||
|
@ -321,7 +322,7 @@ public class DungeonSchematic extends Schematic {
|
||||||
BlockRotator.transformPoint(location, entrance, rotation, pocketCenter);
|
BlockRotator.transformPoint(location, entrance, rotation, pocketCenter);
|
||||||
int orientation = world.getBlockMetadata(location.getX(), location.getY()-1, location.getZ());
|
int orientation = world.getBlockMetadata(location.getX(), location.getY()-1, location.getZ());
|
||||||
|
|
||||||
dimension.createLink(location.getX(), location.getY(), location.getZ(), LinkTypes.DUNGEON,orientation);
|
dimension.createLink(location.getX(), location.getY(), location.getZ(), LinkTypes.DUNGEON, orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void spawnMonolith(World world, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter, boolean canSpawn)
|
private static void spawnMonolith(World world, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter, boolean canSpawn)
|
|
@ -12,16 +12,22 @@ import net.minecraft.tileentity.TileEntityChest;
|
||||||
import net.minecraft.tileentity.TileEntityDispenser;
|
import net.minecraft.tileentity.TileEntityDispenser;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.DDLoot;
|
import StevenDimDoors.mod_pocketDim.DDLoot;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.schematic.WorldOperation;
|
import StevenDimDoors.mod_pocketDim.schematic.WorldOperation;
|
||||||
|
|
||||||
public class FillContainersOperation extends WorldOperation
|
public class FillContainersOperation extends WorldOperation
|
||||||
{
|
{
|
||||||
private Random random;
|
private Random random;
|
||||||
|
private DDProperties properties;
|
||||||
|
|
||||||
public FillContainersOperation(Random random)
|
private static final int GRAVE_CHEST_CHANCE = 100;
|
||||||
|
private static final int MAX_GRAVE_CHEST_CHANCE = 700;
|
||||||
|
|
||||||
|
public FillContainersOperation(Random random, DDProperties properties)
|
||||||
{
|
{
|
||||||
super("FillContainersOperation");
|
super("FillContainersOperation");
|
||||||
this.random = random;
|
this.random = random;
|
||||||
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -29,22 +35,30 @@ public class FillContainersOperation extends WorldOperation
|
||||||
{
|
{
|
||||||
int blockID = world.getBlockId(x, y, z);
|
int blockID = world.getBlockId(x, y, z);
|
||||||
|
|
||||||
//Fill empty chests and dispensers
|
// Fill empty chests and dispensers
|
||||||
if (Block.blocksList[blockID] instanceof BlockContainer)
|
if (Block.blocksList[blockID] instanceof BlockContainer)
|
||||||
{
|
{
|
||||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||||
|
|
||||||
//Fill chests
|
// Fill chests
|
||||||
if (tileEntity instanceof TileEntityChest)
|
if (tileEntity instanceof TileEntityChest)
|
||||||
{
|
{
|
||||||
TileEntityChest chest = (TileEntityChest) tileEntity;
|
TileEntityChest chest = (TileEntityChest) tileEntity;
|
||||||
if (isInventoryEmpty(chest))
|
if (isInventoryEmpty(chest))
|
||||||
|
{
|
||||||
|
// Randomly choose whether this will be a regular dungeon chest or a grave chest
|
||||||
|
if (random.nextInt(MAX_GRAVE_CHEST_CHANCE) < GRAVE_CHEST_CHANCE)
|
||||||
|
{
|
||||||
|
DDLoot.fillGraveChest(chest, random, properties);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
DDLoot.generateChestContents(DDLoot.DungeonChestInfo, chest, random);
|
DDLoot.generateChestContents(DDLoot.DungeonChestInfo, chest, random);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Fill dispensers
|
// Fill dispensers
|
||||||
if (tileEntity instanceof TileEntityDispenser)
|
if (tileEntity instanceof TileEntityDispenser)
|
||||||
{
|
{
|
||||||
TileEntityDispenser dispenser = (TileEntityDispenser) tileEntity;
|
TileEntityDispenser dispenser = (TileEntityDispenser) tileEntity;
|
|
@ -206,6 +206,7 @@ public class DungeonPackConfigReader extends BaseConfigurationProcessor<DungeonP
|
||||||
|
|
||||||
private class DungeonTypeProcessor implements ILineProcessor
|
private class DungeonTypeProcessor implements ILineProcessor
|
||||||
{
|
{
|
||||||
|
@Override
|
||||||
public void process(String line, DungeonPackConfig config) throws ConfigurationProcessingException
|
public void process(String line, DungeonPackConfig config) throws ConfigurationProcessingException
|
||||||
{
|
{
|
||||||
List<String> typeNames = config.getTypeNames();
|
List<String> typeNames = config.getTypeNames();
|
||||||
|
@ -229,6 +230,7 @@ public class DungeonPackConfigReader extends BaseConfigurationProcessor<DungeonP
|
||||||
|
|
||||||
private class DungeonSettingsParser implements ILineProcessor
|
private class DungeonSettingsParser implements ILineProcessor
|
||||||
{
|
{
|
||||||
|
@Override
|
||||||
public void process(String line, DungeonPackConfig config) throws ConfigurationProcessingException
|
public void process(String line, DungeonPackConfig config) throws ConfigurationProcessingException
|
||||||
{
|
{
|
||||||
//The various settings that we support will be hardcoded here.
|
//The various settings that we support will be hardcoded here.
|
||||||
|
@ -295,6 +297,7 @@ public class DungeonPackConfigReader extends BaseConfigurationProcessor<DungeonP
|
||||||
|
|
||||||
private class RuleDefinitionParser implements ILineProcessor
|
private class RuleDefinitionParser implements ILineProcessor
|
||||||
{
|
{
|
||||||
|
@Override
|
||||||
public void process(String definition, DungeonPackConfig config) throws ConfigurationProcessingException
|
public void process(String definition, DungeonPackConfig config) throws ConfigurationProcessingException
|
||||||
{
|
{
|
||||||
String[] ruleParts;
|
String[] ruleParts;
|
|
@ -17,7 +17,7 @@ public class BlockRotationHelper
|
||||||
{
|
{
|
||||||
HashMap<Integer,HashMap<Integer, Integer>> orientation0 = new HashMap<Integer,HashMap<Integer, Integer>>();
|
HashMap<Integer,HashMap<Integer, Integer>> orientation0 = new HashMap<Integer,HashMap<Integer, Integer>>();
|
||||||
|
|
||||||
HashMap<Integer,Integer> stairs0 = new HashMap();
|
HashMap<Integer,Integer> stairs0 = new HashMap<Integer,Integer>();
|
||||||
|
|
||||||
stairs0.put(0, 2);
|
stairs0.put(0, 2);
|
||||||
stairs0.put(1, 3);
|
stairs0.put(1, 3);
|
|
@ -1,5 +1,12 @@
|
||||||
package StevenDimDoors.mod_pocketDim.helpers;
|
package StevenDimDoors.mod_pocketDim.helpers;
|
||||||
|
|
||||||
|
import StevenDimDoors.mod_pocketDim.IChunkLoader;
|
||||||
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -8,16 +15,6 @@ import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.common.ForgeChunkManager;
|
import net.minecraftforge.common.ForgeChunkManager;
|
||||||
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
||||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||||
import StevenDimDoors.mod_pocketDim.IChunkLoader;
|
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
|
||||||
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
|
||||||
|
|
||||||
|
|
||||||
public class ChunkLoaderHelper implements LoadingCallback
|
public class ChunkLoaderHelper implements LoadingCallback
|
||||||
{
|
{
|
||||||
|
@ -42,8 +39,6 @@ public class ChunkLoaderHelper implements LoadingCallback
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void loadChunkForcedWorlds(FMLServerStartingEvent event)
|
public static void loadChunkForcedWorlds(FMLServerStartingEvent event)
|
||||||
{
|
{
|
||||||
for(NewDimData data : PocketManager.getDimensions())
|
for(NewDimData data : PocketManager.getDimensions())
|
|
@ -17,6 +17,7 @@ import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
|
||||||
public class Compactor
|
public class Compactor
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@SuppressWarnings("unused") // ?
|
||||||
private static class DimComparator implements Comparator<NewDimData>
|
private static class DimComparator implements Comparator<NewDimData>
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,6 +39,7 @@ public class Compactor
|
||||||
for (DimLink link : dimension.links())
|
for (DimLink link : dimension.links())
|
||||||
{
|
{
|
||||||
Point4D.write(link.source(), output);
|
Point4D.write(link.source(), output);
|
||||||
|
output.writeInt(link.orientation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,11 @@ public class DungeonHelper
|
||||||
config.setName(name);
|
config.setName(name);
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
catch (ConfigurationProcessingException e)
|
catch (FileNotFoundException e)
|
||||||
|
{
|
||||||
|
System.err.println("Could not find a dungeon pack config file: " + configPath);
|
||||||
|
}
|
||||||
|
catch (Exception e) // handles IOException and ConfigurationProcessingException
|
||||||
{
|
{
|
||||||
System.err.println(e.getMessage());
|
System.err.println(e.getMessage());
|
||||||
if (e.getCause() != null)
|
if (e.getCause() != null)
|
||||||
|
@ -148,10 +152,6 @@ public class DungeonHelper
|
||||||
System.err.println(e.getCause());
|
System.err.println(e.getCause());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e)
|
|
||||||
{
|
|
||||||
System.err.println("Could not find a dungeon pack config file: " + configPath);
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,6 +442,7 @@ public class DungeonHelper
|
||||||
System.out.println("Registering bundled dungeon pack: " + name);
|
System.out.println("Registering bundled dungeon pack: " + name);
|
||||||
|
|
||||||
InputStream listStream = this.getClass().getResourceAsStream(listPath);
|
InputStream listStream = this.getClass().getResourceAsStream(listPath);
|
||||||
|
// chance of leak?
|
||||||
if (listStream == null)
|
if (listStream == null)
|
||||||
{
|
{
|
||||||
System.err.println("Unable to open list of bundled dungeon schematics for " + name);
|
System.err.println("Unable to open list of bundled dungeon schematics for " + name);
|
|
@ -29,6 +29,7 @@ public abstract class BaseItemDoor extends ItemDoor
|
||||||
properties = DDProperties.instance();
|
properties = DDProperties.instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||||
|
@ -59,7 +60,7 @@ public abstract class BaseItemDoor extends ItemDoor
|
||||||
player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack) &&
|
player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack) &&
|
||||||
(!requireLink || PocketManager.getLink(x, y + 1, z, world) != null)&&stack.stackSize>0)
|
(!requireLink || PocketManager.getLink(x, y + 1, z, world) != null)&&stack.stackSize>0)
|
||||||
{
|
{
|
||||||
int orientation = MathHelper.floor_double((double) ((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
|
int orientation = MathHelper.floor_double((player.rotationYaw + 180.0F) * 4.0F / 360.0F - 0.5D) & 3;
|
||||||
placeDoorBlock(world, x, y, z, orientation, doorBlock);
|
placeDoorBlock(world, x, y, z, orientation, doorBlock);
|
||||||
|
|
||||||
if (!player.capabilities.isCreativeMode && reduceStack)
|
if (!player.capabilities.isCreativeMode && reduceStack)
|
|
@ -15,6 +15,7 @@ public class ItemBlockDimWall extends ItemBlock
|
||||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("tile.", ""));
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("tile.", ""));
|
||||||
|
@ -28,6 +29,6 @@ public class ItemBlockDimWall extends ItemBlock
|
||||||
|
|
||||||
public String getUnlocalizedName(ItemStack par1ItemStack)
|
public String getUnlocalizedName(ItemStack par1ItemStack)
|
||||||
{
|
{
|
||||||
return subNames[getItemDamageFromStack(par1ItemStack)];
|
return subNames[this.getDamage(par1ItemStack)];
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,6 @@ package StevenDimDoors.mod_pocketDim.items;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
|
@ -0,0 +1,58 @@
|
||||||
|
package StevenDimDoors.mod_pocketDim.items;
|
||||||
|
|
||||||
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemDoor;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class ItemGoldDoor extends ItemDoor
|
||||||
|
{
|
||||||
|
public ItemGoldDoor(int par1, Material par2Material)
|
||||||
|
{
|
||||||
|
super(par1, par2Material);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
|
{
|
||||||
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||||
|
{
|
||||||
|
if (par7 != 1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++par5;
|
||||||
|
Block block = mod_pocketDim.goldDoor;
|
||||||
|
|
||||||
|
if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack))
|
||||||
|
{
|
||||||
|
if (!block.canPlaceBlockAt(par3World, par4, par5, par6))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i1 = MathHelper.floor_double((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F - 0.5D) & 3;
|
||||||
|
placeDoorBlock(par3World, par4, par5, par6, i1, block);
|
||||||
|
--par1ItemStack.stackSize;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,9 @@ import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
|
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||||
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.item.EnumToolMaterial;
|
import net.minecraft.item.EnumToolMaterial;
|
||||||
|
@ -20,6 +23,7 @@ import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -60,9 +64,11 @@ public class ItemRiftBlade extends ItemSword
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDamageVsEntity(Entity par1Entity)
|
public Multimap getItemAttributeModifiers()
|
||||||
{
|
{
|
||||||
return 7;
|
Multimap multimap = super.getItemAttributeModifiers();
|
||||||
|
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)7, 0));
|
||||||
|
return multimap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,7 +79,7 @@ public class ItemRiftBlade extends ItemSword
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
|
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLiving, EntityLivingBase par3EntityLiving)
|
||||||
{
|
{
|
||||||
par1ItemStack.damageItem(1, par3EntityLiving);
|
par1ItemStack.damageItem(1, par3EntityLiving);
|
||||||
return true;
|
return true;
|
||||||
|
@ -85,9 +91,9 @@ public class ItemRiftBlade extends ItemSword
|
||||||
float var4 = 1.0F;
|
float var4 = 1.0F;
|
||||||
float var5 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4;
|
float var5 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4;
|
||||||
float var6 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4;
|
float var6 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4;
|
||||||
double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)var4;
|
double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * var4;
|
||||||
double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * (double)var4 + 1.62D - (double)par2EntityPlayer.yOffset;
|
double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * var4 + 1.62D - par2EntityPlayer.yOffset;
|
||||||
double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)var4;
|
double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * var4;
|
||||||
Vec3 var13 = par1World.getWorldVec3Pool().getVecFromPool(var7, var9, var11);
|
Vec3 var13 = par1World.getWorldVec3Pool().getVecFromPool(var7, var9, var11);
|
||||||
float var14 = MathHelper.cos(-var6 * 0.017453292F - (float)Math.PI);
|
float var14 = MathHelper.cos(-var6 * 0.017453292F - (float)Math.PI);
|
||||||
float var15 = MathHelper.sin(-var6 * 0.017453292F - (float)Math.PI);
|
float var15 = MathHelper.sin(-var6 * 0.017453292F - (float)Math.PI);
|
||||||
|
@ -100,13 +106,13 @@ public class ItemRiftBlade extends ItemSword
|
||||||
{
|
{
|
||||||
var21 = 7;
|
var21 = 7;
|
||||||
}
|
}
|
||||||
Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21);
|
Vec3 var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21);
|
||||||
return par1World.rayTraceBlocks_do_do(var13, var23, true, false);
|
return par1World.rayTraceBlocks_do_do(var13, var23, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean teleportToEntity(ItemStack item, Entity par1Entity, EntityPlayer holder)
|
private boolean teleportToEntity(ItemStack item, Entity par1Entity, EntityPlayer holder)
|
||||||
{
|
{
|
||||||
Vec3 var2 = holder.worldObj.getWorldVec3Pool().getVecFromPool(holder.posX - par1Entity.posX, holder.boundingBox.minY + (double)(holder.height / 2.0F) - par1Entity.posY + (double)par1Entity.getEyeHeight(), holder.posZ - par1Entity.posZ);
|
Vec3 var2 = holder.worldObj.getWorldVec3Pool().getVecFromPool(holder.posX - par1Entity.posX, holder.boundingBox.minY + holder.height / 2.0F - par1Entity.posY + par1Entity.getEyeHeight(), holder.posZ - par1Entity.posZ);
|
||||||
|
|
||||||
double cooef =( var2.lengthVector()-2.5)/var2.lengthVector();
|
double cooef =( var2.lengthVector()-2.5)/var2.lengthVector();
|
||||||
var2.xCoord*=cooef;
|
var2.xCoord*=cooef;
|
||||||
|
@ -141,13 +147,13 @@ public class ItemRiftBlade extends ItemSword
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<EntityLiving> list = (List<EntityLiving>) world.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(player.posX-8,player.posY-8, player.posZ-8, player.posX+8,player.posY+8, player.posZ+8));
|
List<EntityLiving> list = world.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(player.posX-8,player.posY-8, player.posZ-8, player.posX+8,player.posY+8, player.posZ+8));
|
||||||
list.remove(player);
|
list.remove(player);
|
||||||
|
|
||||||
for (EntityLiving ent : list)
|
for (EntityLiving ent : list)
|
||||||
{
|
{
|
||||||
Vec3 var3 = player.getLook(1.0F).normalize();
|
Vec3 var3 = player.getLook(1.0F).normalize();
|
||||||
Vec3 var4 = player.worldObj.getWorldVec3Pool().getVecFromPool(ent.posX - player.posX, ent.boundingBox.minY + (double)((ent.height) / 2.0F) - ( player.posY + (double) player.getEyeHeight()), ent.posZ - player.posZ);
|
Vec3 var4 = player.worldObj.getWorldVec3Pool().getVecFromPool(ent.posX - player.posX, ent.boundingBox.minY + (ent.height) / 2.0F - ( player.posY + player.getEyeHeight()), ent.posZ - player.posZ);
|
||||||
double var5 = var4.lengthVector();
|
double var5 = var4.lengthVector();
|
||||||
var4 = var4.normalize();
|
var4 = var4.normalize();
|
||||||
double var7 = var3.dotProduct(var4);
|
double var7 = var3.dotProduct(var4);
|
||||||
|
@ -172,13 +178,13 @@ public class ItemRiftBlade extends ItemSword
|
||||||
if (player.canPlayerEdit(x, y, z, hit.sideHit, stack) &&
|
if (player.canPlayerEdit(x, y, z, hit.sideHit, stack) &&
|
||||||
player.canPlayerEdit(x, y + 1, z, hit.sideHit, stack))
|
player.canPlayerEdit(x, y + 1, z, hit.sideHit, stack))
|
||||||
{
|
{
|
||||||
int orientation = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
|
int orientation = MathHelper.floor_double((player.rotationYaw + 180.0F) * 4.0F / 360.0F - 0.5D) & 3;
|
||||||
|
|
||||||
if (BaseItemDoor.canPlace(world, x, y, z) &&
|
if (BaseItemDoor.canPlace(world, x, y, z) &&
|
||||||
BaseItemDoor.canPlace(world, x, y - 1, z))
|
BaseItemDoor.canPlace(world, x, y - 1, z))
|
||||||
{
|
{
|
||||||
ItemDimensionalDoor.placeDoorBlock(world, x, y - 1, z, orientation, mod_pocketDim.transientDoor);
|
ItemDimensionalDoor.placeDoorBlock(world, x, y - 1, z, orientation, mod_pocketDim.transientDoor);
|
||||||
player.worldObj.playSoundAtEntity(player,"mods.DimDoors.sfx.riftDoor", 0.6f, 1);
|
player.worldObj.playSoundAtEntity(player,mod_pocketDim.modid+":riftDoor", 0.6f, 1);
|
||||||
stack.damageItem(3, player);
|
stack.damageItem(3, player);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
@ -212,6 +218,7 @@ public class ItemRiftBlade extends ItemSword
|
||||||
/**
|
/**
|
||||||
* allows items to add custom lines of information to the mouseover description
|
* allows items to add custom lines of information to the mouseover description
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
|
@ -98,15 +98,15 @@ public class ItemRiftSignature extends Item
|
||||||
stack.stackSize--;
|
stack.stackSize--;
|
||||||
}
|
}
|
||||||
clearSource(stack);
|
clearSource(stack);
|
||||||
player.sendChatToPlayer("Rift Created");
|
mod_pocketDim.sendChat(player,("Rift Created"));
|
||||||
world.playSoundAtEntity(player,"mods.DimDoors.sfx.riftEnd", 0.6f, 1);
|
world.playSoundAtEntity(player,mod_pocketDim.modid+":riftEnd", 0.6f, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//The link signature has not been used. Store its current target as the first location.
|
//The link signature has not been used. Store its current target as the first location.
|
||||||
setSource(stack, x, adjustedY, z,orientation, PocketManager.getDimensionData(world));
|
setSource(stack, x, adjustedY, z,orientation, PocketManager.getDimensionData(world));
|
||||||
player.sendChatToPlayer("Location Stored in Rift Signature");
|
mod_pocketDim.sendChat(player,("Location Stored in Rift Signature"));
|
||||||
world.playSoundAtEntity(player,"mods.DimDoors.sfx.riftStart", 0.6f, 1);
|
world.playSoundAtEntity(player,mod_pocketDim.modid+":riftStart", 0.6f, 1);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -25,6 +25,7 @@ public class ItemStabilizedRiftSignature extends ItemRiftSignature
|
||||||
super(itemID);
|
super(itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
||||||
|
@ -49,14 +50,17 @@ public class ItemStabilizedRiftSignature extends ItemRiftSignature
|
||||||
int adjustedY = adjustYForSpecialBlocks(world,x,y,z);
|
int adjustedY = adjustYForSpecialBlocks(world,x,y,z);
|
||||||
|
|
||||||
// Check if the Stabilized Rift Signature has been initialized
|
// Check if the Stabilized Rift Signature has been initialized
|
||||||
int orientation = MathHelper.floor_double((double) ((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
|
int orientation = MathHelper.floor_double((player.rotationYaw + 180.0F) * 4.0F / 360.0F - 0.5D) & 3;
|
||||||
if (source != null)
|
if (source != null)
|
||||||
{
|
{
|
||||||
// Yes, it's initialized. Check if the player is in creative
|
// Yes, it's initialized. Check if the player is in creative
|
||||||
// or if the player can pay an Ender Pearl to create a rift.
|
// or if the player can pay an Ender Pearl to create a rift.
|
||||||
if (!player.capabilities.isCreativeMode && !player.inventory.hasItem(Item.enderPearl.itemID))
|
if (!player.capabilities.isCreativeMode && !player.inventory.hasItem(Item.enderPearl.itemID))
|
||||||
{
|
{
|
||||||
player.sendChatToPlayer("You don't have any Ender Pearls!");
|
mod_pocketDim.sendChat(player,"You don't have any Ender Pearls!");
|
||||||
|
// I won't do this, but this is the chance to localize chat
|
||||||
|
// messages sent to the player; look at ChatMessageComponent
|
||||||
|
// and how MFR does it with items like the safari net launcher
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,14 +90,14 @@ public class ItemStabilizedRiftSignature extends ItemRiftSignature
|
||||||
{
|
{
|
||||||
player.inventory.consumeInventoryItem(Item.enderPearl.itemID);
|
player.inventory.consumeInventoryItem(Item.enderPearl.itemID);
|
||||||
}
|
}
|
||||||
player.sendChatToPlayer("Rift Created");
|
mod_pocketDim.sendChat(player,"Rift Created");
|
||||||
world.playSoundAtEntity(player,"mods.DimDoors.sfx.riftEnd", 0.6f, 1);
|
world.playSoundAtEntity(player,"mods.DimDoors.sfx.riftEnd", 0.6f, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//The link signature has not been used. Store its current target as the first location.
|
//The link signature has not been used. Store its current target as the first location.
|
||||||
setSource(stack, x, adjustedY, z, orientation, PocketManager.getDimensionData(world));
|
setSource(stack, x, adjustedY, z, orientation, PocketManager.getDimensionData(world));
|
||||||
player.sendChatToPlayer("Location Stored in Rift Signature");
|
mod_pocketDim.sendChat(player,"Location Stored in Rift Signature");
|
||||||
world.playSoundAtEntity(player,"mods.DimDoors.sfx.riftStart", 0.6f, 1);
|
world.playSoundAtEntity(player,"mods.DimDoors.sfx.riftStart", 0.6f, 1);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
|
@ -12,6 +12,7 @@ public class ItemStableFabric extends Item
|
||||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
|
@ -12,6 +12,7 @@ public class ItemWorldThread extends Item
|
||||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
|
@ -29,6 +29,7 @@ public class itemRiftRemover extends Item
|
||||||
this.setMaxDamage(4);
|
this.setMaxDamage(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
|
||||||
|
@ -114,7 +115,7 @@ public class itemRiftRemover extends Item
|
||||||
{
|
{
|
||||||
stack.damageItem(1, player);
|
stack.damageItem(1, player);
|
||||||
}
|
}
|
||||||
player.worldObj.playSoundAtEntity(player, "mods.DimDoors.sfx.riftClose", 0.8f, 1);
|
player.worldObj.playSoundAtEntity(player, mod_pocketDim.modid+":riftClose", 0.8f, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,18 +1,5 @@
|
||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.EntityEggInfo;
|
|
||||||
import net.minecraft.entity.EntityList;
|
|
||||||
import net.minecraft.item.EnumToolMaterial;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
|
||||||
import net.minecraftforge.common.DimensionManager;
|
|
||||||
import net.minecraftforge.common.ForgeChunkManager;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWall;
|
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWall;
|
||||||
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWallPerm;
|
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWallPerm;
|
||||||
import StevenDimDoors.mod_pocketDim.blocks.BlockDoorGold;
|
import StevenDimDoors.mod_pocketDim.blocks.BlockDoorGold;
|
||||||
|
@ -62,13 +49,11 @@ import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
import StevenDimDoors.mod_pocketDimClient.ClientPacketHandler;
|
import StevenDimDoors.mod_pocketDimClient.ClientPacketHandler;
|
||||||
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
|
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.IPlayerTracker;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.Init;
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
import cpw.mods.fml.common.Mod.PostInit;
|
|
||||||
import cpw.mods.fml.common.Mod.PreInit;
|
|
||||||
import cpw.mods.fml.common.Mod.ServerStarting;
|
|
||||||
import cpw.mods.fml.common.Mod.ServerStopping;
|
|
||||||
import cpw.mods.fml.common.SidedProxy;
|
import cpw.mods.fml.common.SidedProxy;
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
@ -83,6 +68,22 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
import cpw.mods.fml.common.registry.TickRegistry;
|
import cpw.mods.fml.common.registry.TickRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.EntityEggInfo;
|
||||||
|
import net.minecraft.entity.EntityList;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.EnumToolMaterial;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ChatMessageComponent;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
import net.minecraftforge.common.ForgeChunkManager;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
@Mod(modid = mod_pocketDim.modid, name = "Dimensional Doors", version = mod_pocketDim.version)
|
@Mod(modid = mod_pocketDim.modid, name = "Dimensional Doors", version = mod_pocketDim.version)
|
||||||
|
|
||||||
|
@ -91,11 +92,10 @@ clientPacketHandlerSpec =
|
||||||
@SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ClientPacketHandler.class),
|
@SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ClientPacketHandler.class),
|
||||||
serverPacketHandlerSpec =
|
serverPacketHandlerSpec =
|
||||||
@SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ServerPacketHandler.class))
|
@SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ServerPacketHandler.class))
|
||||||
|
|
||||||
public class mod_pocketDim
|
public class mod_pocketDim
|
||||||
{
|
{
|
||||||
public static final String version = "1.5.2R2.0.1RC1";
|
public static final String version = "$VERSION$";
|
||||||
public static final String modid = "DimDoors";
|
public static final String modid = "dimdoors";
|
||||||
|
|
||||||
//need to clean up
|
//need to clean up
|
||||||
@SidedProxy(clientSide = "StevenDimDoors.mod_pocketDimClient.ClientProxy", serverSide = "StevenDimDoors.mod_pocketDim.CommonProxy")
|
@SidedProxy(clientSide = "StevenDimDoors.mod_pocketDimClient.ClientProxy", serverSide = "StevenDimDoors.mod_pocketDim.CommonProxy")
|
||||||
|
@ -137,6 +137,7 @@ public class mod_pocketDim
|
||||||
public static DDProperties properties;
|
public static DDProperties properties;
|
||||||
public static MonolithSpawner spawner; //Added this field temporarily. Will be refactored out later.
|
public static MonolithSpawner spawner; //Added this field temporarily. Will be refactored out later.
|
||||||
public static GatewayGenerator riftGen;
|
public static GatewayGenerator riftGen;
|
||||||
|
public static PlayerTracker tracker;
|
||||||
|
|
||||||
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab")
|
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab")
|
||||||
{
|
{
|
||||||
|
@ -155,12 +156,14 @@ public class mod_pocketDim
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PreInit
|
@EventHandler
|
||||||
public void onPreInitialization(FMLPreInitializationEvent event)
|
public void onPreInitialization(FMLPreInitializationEvent event)
|
||||||
{
|
{
|
||||||
this.instance = this;
|
instance = this;
|
||||||
//This should be the FIRST thing that gets done.
|
//This should be the FIRST thing that gets done.
|
||||||
properties = DDProperties.initialize(event.getSuggestedConfigurationFile());
|
String path = event.getSuggestedConfigurationFile().getAbsolutePath().replace(modid, "DimDoors");
|
||||||
|
|
||||||
|
properties = DDProperties.initialize(new File(path));
|
||||||
|
|
||||||
//Now do other stuff
|
//Now do other stuff
|
||||||
MinecraftForge.EVENT_BUS.register(new EventHookContainer(properties));
|
MinecraftForge.EVENT_BUS.register(new EventHookContainer(properties));
|
||||||
|
@ -168,7 +171,7 @@ public class mod_pocketDim
|
||||||
riftGen = new GatewayGenerator(properties);
|
riftGen = new GatewayGenerator(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Init
|
@EventHandler
|
||||||
public void onInitialization(FMLInitializationEvent event)
|
public void onInitialization(FMLInitializationEvent event)
|
||||||
{
|
{
|
||||||
CommonTickHandler commonTickHandler = new CommonTickHandler();
|
CommonTickHandler commonTickHandler = new CommonTickHandler();
|
||||||
|
@ -207,10 +210,12 @@ public class mod_pocketDim
|
||||||
itemWorldThread = (new ItemWorldThread(properties.ItemWorldThreadID)).setUnlocalizedName("itemWorldThread");
|
itemWorldThread = (new ItemWorldThread(properties.ItemWorldThreadID)).setUnlocalizedName("itemWorldThread");
|
||||||
|
|
||||||
|
|
||||||
mod_pocketDim.limboBiome= (new BiomeGenLimbo(properties.LimboBiomeID));
|
mod_pocketDim.limboBiome = (new BiomeGenLimbo(properties.LimboBiomeID));
|
||||||
mod_pocketDim.pocketBiome= (new BiomeGenPocket(properties.PocketBiomeID));
|
mod_pocketDim.pocketBiome = (new BiomeGenPocket(properties.PocketBiomeID));
|
||||||
|
|
||||||
GameRegistry.registerWorldGenerator(mod_pocketDim.riftGen);
|
GameRegistry.registerWorldGenerator(mod_pocketDim.riftGen);
|
||||||
|
tracker = new PlayerTracker();
|
||||||
|
GameRegistry.registerPlayerTracker(tracker);
|
||||||
|
|
||||||
GameRegistry.registerBlock(goldDoor, "Golden Door");
|
GameRegistry.registerBlock(goldDoor, "Golden Door");
|
||||||
GameRegistry.registerBlock(goldDimDoor, "Golden Dimensional Door");
|
GameRegistry.registerBlock(goldDimDoor, "Golden Dimensional Door");
|
||||||
|
@ -277,19 +282,21 @@ public class mod_pocketDim
|
||||||
CraftingManager.registerRecipies();
|
CraftingManager.registerRecipies();
|
||||||
DungeonHelper.initialize();
|
DungeonHelper.initialize();
|
||||||
|
|
||||||
|
// Register loot chests
|
||||||
|
DDLoot.registerInfo(properties);
|
||||||
|
|
||||||
proxy.loadTextures();
|
proxy.loadTextures();
|
||||||
proxy.registerRenderers();
|
proxy.registerRenderers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostInit
|
@EventHandler
|
||||||
public void onPostInitialization(FMLPostInitializationEvent event)
|
public void onPostInitialization(FMLPostInitializationEvent event)
|
||||||
{
|
{
|
||||||
ForgeChunkManager.setForcedChunkLoadingCallback(instance, new ChunkLoaderHelper());
|
ForgeChunkManager.setForcedChunkLoadingCallback(instance, new ChunkLoaderHelper());
|
||||||
//Register loot chests
|
|
||||||
DDLoot.registerInfo();
|
|
||||||
}
|
}
|
||||||
@ServerStopping
|
|
||||||
|
@EventHandler
|
||||||
public void onServerStopping(FMLServerStoppingEvent event)
|
public void onServerStopping(FMLServerStoppingEvent event)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -302,7 +309,7 @@ public class mod_pocketDim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ServerStarting
|
@EventHandler
|
||||||
public void onServerStarting(FMLServerStartingEvent event)
|
public void onServerStarting(FMLServerStartingEvent event)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -323,9 +330,16 @@ public class mod_pocketDim
|
||||||
{
|
{
|
||||||
ChunkLoaderHelper.loadChunkForcedWorlds(event);
|
ChunkLoaderHelper.loadChunkForcedWorlds(event);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
System.out.println("Loading chunkloaders failed");
|
System.out.println("Loading chunkloaders failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sendChat(EntityPlayer player, String message)
|
||||||
|
{
|
||||||
|
ChatMessageComponent cmp = new ChatMessageComponent();
|
||||||
|
cmp.addText(message);
|
||||||
|
player.sendChatToPlayer(cmp);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -25,6 +25,7 @@ public class BlacklistProcessor extends BaseConfigurationProcessor<List<Integer>
|
||||||
{
|
{
|
||||||
JsonReader reader = new JsonReader(new InputStreamReader(inputStream, "UTF-8"));
|
JsonReader reader = new JsonReader(new InputStreamReader(inputStream, "UTF-8"));
|
||||||
List<Integer> data = this.createBlacklistFromJson(reader);
|
List<Integer> data = this.createBlacklistFromJson(reader);
|
||||||
|
reader.close();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue