Auto indented all code
No actual functionality was changed
This commit is contained in:
parent
c741d5cd35
commit
b61aff025c
48 changed files with 1267 additions and 1121 deletions
|
@ -9,32 +9,33 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
|
|
||||||
public class CraftingManager {
|
public class CraftingManager {
|
||||||
public static void registerRecipes() {
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModItems.itemStableFabric, 1),
|
|
||||||
"yxy", 'x', Items.ENDER_PEARL, 'y', ModItems.itemWorldThread);
|
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoor, 1),
|
|
||||||
"yxy", 'x', ModItems.itemStableFabric, 'y', Items.IRON_DOOR);
|
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorChaos, 1),
|
public static void registerRecipes() {
|
||||||
"yxy", 'x', Items.ENDER_EYE, 'y', ModItems.itemDimDoor);
|
GameRegistry.addRecipe(new ItemStack(ModItems.itemStableFabric, 1),
|
||||||
|
"yxy", 'x', Items.ENDER_PEARL, 'y', ModItems.itemWorldThread);
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorWarp, 1),
|
GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoor, 1),
|
||||||
"yxy", 'x', Items.ENDER_PEARL, 'y', Items.OAK_DOOR);
|
"yxy", 'x', ModItems.itemStableFabric, 'y', Items.IRON_DOOR);
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockDimHatch, 1),
|
GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorChaos, 1),
|
||||||
"y", "x", "y", 'x', Items.ENDER_PEARL, 'y', Blocks.TRAPDOOR);
|
"yxy", 'x', Items.ENDER_EYE, 'y', ModItems.itemDimDoor);
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorGold, 1),
|
GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorWarp, 1),
|
||||||
"yxy", 'x', ModItems.itemStableFabric, 'y', ModItems.itemDoorGold);
|
"yxy", 'x', Items.ENDER_PEARL, 'y', Items.OAK_DOOR);
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModItems.itemDoorGold, 1),
|
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockDimHatch, 1),
|
||||||
"yy", "yy", "yy", 'y', Items.GOLD_INGOT);
|
"y", "x", "y", 'x', Items.ENDER_PEARL, 'y', Blocks.TRAPDOOR);
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorPersonal,1),
|
GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorGold, 1),
|
||||||
"yxy", 'y', ModItems.itemDoorQuartz, 'x', ModItems.itemStableFabric);
|
"yxy", 'x', ModItems.itemStableFabric, 'y', ModItems.itemDoorGold);
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(ModItems.itemDoorQuartz,
|
GameRegistry.addRecipe(new ItemStack(ModItems.itemDoorGold, 1),
|
||||||
"yy", "yy", "yy", 'y', "oreQuartz"));
|
"yy", "yy", "yy", 'y', Items.GOLD_INGOT);
|
||||||
}
|
|
||||||
|
GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorPersonal, 1),
|
||||||
|
"yxy", 'y', ModItems.itemDoorQuartz, 'x', ModItems.itemStableFabric);
|
||||||
|
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(ModItems.itemDoorQuartz,
|
||||||
|
"yy", "yy", "yy", 'y', "oreQuartz"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,19 +41,19 @@ public abstract class DDProxyCommon implements IDDProxy {
|
||||||
ModelManager.registerModels();
|
ModelManager.registerModels();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDoorTE(BlockDimDoorBase door, World world, BlockPos pos) {
|
public void updateDoorTE(BlockDimDoorBase door, World world, BlockPos pos) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityDimDoor) {
|
if (tile instanceof TileEntityDimDoor) {
|
||||||
TileEntityDimDoor dimTile = (TileEntityDimDoor) tile;
|
TileEntityDimDoor dimTile = (TileEntityDimDoor) tile;
|
||||||
IBlockState state = world.getBlockState(pos.down());
|
IBlockState state = world.getBlockState(pos.down());
|
||||||
dimTile.orientation = state.getBlock() instanceof BlockDimDoorBase ?
|
dimTile.orientation = state.getBlock() instanceof BlockDimDoorBase
|
||||||
state.getValue(BlockDoor.FACING).rotateY() :
|
? state.getValue(BlockDoor.FACING).rotateY()
|
||||||
ModBlocks.blockDimDoor.getDefaultState().getValue(BlockDoor.FACING);
|
: ModBlocks.blockDimDoor.getDefaultState().getValue(BlockDoor.FACING);
|
||||||
dimTile.openOrClosed = door.isDoorOnRift(world, pos) && door.isUpperDoorBlock(world.getBlockState(pos));
|
dimTile.openOrClosed = door.isDoorOnRift(world, pos) && door.isUpperDoorBlock(world.getBlockState(pos));
|
||||||
dimTile.lockStatus = 0;
|
dimTile.lockStatus = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract boolean isClient();
|
public abstract boolean isClient();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,52 +15,55 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@Mod(modid = DimDoors.MODID, name = "Dimensional Doors", version = DimDoors.VERSION)
|
@Mod(modid = DimDoors.MODID, name = "Dimensional Doors", version = DimDoors.VERSION)
|
||||||
public class DimDoors {
|
public class DimDoors {
|
||||||
public static final String VERSION = "3.0.0-a1";
|
|
||||||
public static final String MODID = "dimdoors";
|
|
||||||
|
|
||||||
@SidedProxy(clientSide = "com.zixiken.dimdoors.client.DDProxyClient",
|
public static final String VERSION = "3.0.0-a1";
|
||||||
|
public static final String MODID = "dimdoors";
|
||||||
|
|
||||||
|
@SidedProxy(clientSide = "com.zixiken.dimdoors.client.DDProxyClient",
|
||||||
serverSide = "com.zixiken.dimdoors.server.DDProxyServer")
|
serverSide = "com.zixiken.dimdoors.server.DDProxyServer")
|
||||||
public static DDProxyCommon proxy;
|
public static DDProxyCommon proxy;
|
||||||
|
|
||||||
@Mod.Instance(DimDoors.MODID)
|
@Mod.Instance(DimDoors.MODID)
|
||||||
public static DimDoors instance;
|
public static DimDoors instance;
|
||||||
|
|
||||||
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab") {
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public Item getTabIconItem() {return ModItems.itemDimDoor;}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab") {
|
||||||
public void onPreInitialization(FMLPreInitializationEvent event) {
|
@Override
|
||||||
proxy.onPreInitialization(event);
|
@SideOnly(Side.CLIENT)
|
||||||
}
|
public Item getTabIconItem() {
|
||||||
|
return ModItems.itemDimDoor;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void onInitialization(FMLInitializationEvent event) {
|
public void onPreInitialization(FMLPreInitializationEvent event) {
|
||||||
|
proxy.onPreInitialization(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void onInitialization(FMLInitializationEvent event) {
|
||||||
proxy.onInitialization(event);
|
proxy.onInitialization(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void serverLoad( FMLServerStartingEvent event ) {
|
public void serverLoad(FMLServerStartingEvent event) {
|
||||||
//@todo event.registerServerCommand( new DDCommand() ); //to register commands that this mod offers?
|
//@todo event.registerServerCommand( new DDCommand() ); //to register commands that this mod offers?
|
||||||
PocketSavedData.get(getDefWorld());
|
PocketSavedData.get(getDefWorld());
|
||||||
RiftSavedData.get(getDefWorld());
|
RiftSavedData.get(getDefWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isClient() {
|
public static boolean isClient() {
|
||||||
return proxy.isClient();
|
return proxy.isClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isServer() {
|
public static boolean isServer() {
|
||||||
return !isClient();
|
return !isClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static World getDefWorld() {
|
public static World getDefWorld() {
|
||||||
return proxy.getDefWorld(); //gets the server or client world dim 0 handler
|
return proxy.getDefWorld(); //gets the server or client world dim 0 handler
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log( String text ) {
|
public static void log(String text) {
|
||||||
FMLLog.info("[DimDoors] " + text, 0);
|
FMLLog.info("[DimDoors] " + text, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,16 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
public class EventHookContainer {
|
public class EventHookContainer {
|
||||||
@SubscribeEvent
|
|
||||||
public void onPlayerEvent(PlayerInteractEvent event) {
|
|
||||||
// Handle all door placement here
|
|
||||||
|
|
||||||
World world = event.getEntity().world;
|
@SubscribeEvent
|
||||||
ItemStack stack = event.getEntityPlayer().inventory.getCurrentItem();
|
public void onPlayerEvent(PlayerInteractEvent event) {
|
||||||
if (stack != null && ItemDoorBase.tryToPlaceDoor(stack, event.getEntityPlayer(), world, event.getPos(), event.getFace()))
|
// Handle all door placement here
|
||||||
// Cancel the event so that we don't get two doors from vanilla doors
|
|
||||||
event.setCanceled(true);
|
World world = event.getEntity().world;
|
||||||
}
|
ItemStack stack = event.getEntityPlayer().inventory.getCurrentItem();
|
||||||
}
|
if (stack != null && ItemDoorBase.tryToPlaceDoor(stack, event.getEntityPlayer(), world, event.getPos(), event.getFace())) // Cancel the event so that we don't get two doors from vanilla doors
|
||||||
|
{
|
||||||
|
event.setCanceled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.zixiken.dimdoors;
|
||||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||||
|
|
||||||
public interface IChunkLoader {
|
public interface IChunkLoader {
|
||||||
boolean isInitialized();
|
|
||||||
void initialize(Ticket ticket);
|
boolean isInitialized();
|
||||||
|
|
||||||
|
void initialize(Ticket ticket);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,12 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
*
|
*
|
||||||
* @author Robijnvogel
|
* @author Robijnvogel
|
||||||
*/
|
*/
|
||||||
public interface IDDProxy
|
public interface IDDProxy {
|
||||||
{
|
|
||||||
public boolean isClient();
|
public boolean isClient();
|
||||||
|
|
||||||
public void onPreInitialization(FMLPreInitializationEvent event);
|
public void onPreInitialization(FMLPreInitializationEvent event);
|
||||||
|
|
||||||
public void onInitialization(FMLInitializationEvent event);
|
public void onInitialization(FMLInitializationEvent event);
|
||||||
|
|
||||||
public EntityPlayer getLocalPlayer();
|
public EntityPlayer getLocalPlayer();
|
||||||
|
|
|
@ -15,6 +15,7 @@ import static net.minecraft.item.Item.getItemFromBlock;
|
||||||
|
|
||||||
@SuppressWarnings({"MethodCallSideOnly", "NewExpressionSideOnly"})
|
@SuppressWarnings({"MethodCallSideOnly", "NewExpressionSideOnly"})
|
||||||
public class ModelManager {
|
public class ModelManager {
|
||||||
|
|
||||||
public static void registerModels() {
|
public static void registerModels() {
|
||||||
//ItemBlock registration
|
//ItemBlock registration
|
||||||
register(getItemFromBlock(ModBlocks.blockDimWall));
|
register(getItemFromBlock(ModBlocks.blockDimWall));
|
||||||
|
|
|
@ -7,20 +7,23 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockDimDoor extends BlockDimDoorBase {
|
public class BlockDimDoor extends BlockDimDoorBase {
|
||||||
public static final String ID = "blockDimDoor";
|
|
||||||
|
|
||||||
public BlockDimDoor() {
|
public static final String ID = "blockDimDoor";
|
||||||
super(Material.IRON);
|
|
||||||
|
public BlockDimDoor() {
|
||||||
|
super(Material.IRON);
|
||||||
setHardness(1.0F);
|
setHardness(1.0F);
|
||||||
setResistance(2000.0F);
|
setResistance(2000.0F);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void placeLink(World world, BlockPos pos) {
|
public void placeLink(World world, BlockPos pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDoor() {return ModItems.itemDimDoor;}
|
public Item getItemDoor() {
|
||||||
}
|
return ModItems.itemDimDoor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -27,116 +27,135 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, ITileEntityProvider {
|
public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, ITileEntityProvider {
|
||||||
|
|
||||||
public BlockDimDoorBase(Material material) {super(material);}
|
|
||||||
|
|
||||||
@Override
|
public BlockDimDoorBase(Material material) {
|
||||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
|
super(material);
|
||||||
enterDimDoor(world, pos, entity);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
|
||||||
|
enterDimDoor(world, pos, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if(!checkCanOpen(world, pos, player)) {return false;}
|
if (!checkCanOpen(world, pos, player)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER) {
|
if (state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER) {
|
||||||
pos = pos.down();
|
pos = pos.down();
|
||||||
state = world.getBlockState(pos);
|
state = world.getBlockState(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state.getBlock() != this) return false;
|
if (state.getBlock() != this) {
|
||||||
else {
|
return false;
|
||||||
|
} else {
|
||||||
state = state.cycleProperty(BlockDoor.OPEN);
|
state = state.cycleProperty(BlockDoor.OPEN);
|
||||||
world.setBlockState(pos, state, 2);
|
world.setBlockState(pos, state, 2);
|
||||||
world.markBlockRangeForRenderUpdate(pos, pos.up());
|
world.markBlockRangeForRenderUpdate(pos, pos.up());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(IBlockState state) {return state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER;}
|
public boolean hasTileEntity(IBlockState state) {
|
||||||
|
return state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||||
if(state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER) {
|
if (state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER) {
|
||||||
world.setTileEntity(pos, createNewTileEntity(world, 0));
|
world.setTileEntity(pos, createNewTileEntity(world, 0));
|
||||||
updateAttachedTile(world, pos);
|
updateAttachedTile(world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Called to update the render information on the tile entity. Could probably implement a data watcher,
|
//Called to update the render information on the tile entity. Could probably implement a data watcher,
|
||||||
//but this works fine and is more versatile I think.
|
//but this works fine and is more versatile I think.
|
||||||
public BlockDimDoorBase updateAttachedTile(World world, BlockPos pos) {
|
public BlockDimDoorBase updateAttachedTile(World world, BlockPos pos) {
|
||||||
DimDoors.proxy.updateDoorTE(this, world, pos);
|
DimDoors.proxy.updateDoorTE(this, world, pos);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDoorOnRift(World world, BlockPos pos) {return true;}
|
|
||||||
|
|
||||||
@Override
|
public boolean isDoorOnRift(World world, BlockPos pos) {
|
||||||
public void updateTick(World par1World, BlockPos pos, IBlockState state, Random rand) {
|
return true;
|
||||||
updateAttachedTile(par1World, pos);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
|
public void updateTick(World par1World, BlockPos pos, IBlockState state, Random rand) {
|
||||||
*/
|
updateAttachedTile(par1World, pos);
|
||||||
@Override
|
}
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
|
/**
|
||||||
|
* only called by clickMiddleMouseButton , and passed to
|
||||||
|
* inventory.setCurrentItem (along with isCreative)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
return new ItemStack(this.getItemDoor(), 1, 0);
|
return new ItemStack(this.getItemDoor(), 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ID of the items to drop on destruction.
|
* Returns the ID of the items to drop on destruction.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random random, int fortune) {
|
public Item getItemDropped(IBlockState state, Random random, int fortune) {
|
||||||
return isUpperDoorBlock(state) ? null : this.getItemDoor();
|
return isUpperDoorBlock(state) ? null : this.getItemDoor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public ItemStack getItem(World world, BlockPos pos, IBlockState state) { return new ItemStack(this.getItemDoor(), 1, 0); }
|
public ItemStack getItem(World world, BlockPos pos, IBlockState state) {
|
||||||
|
return new ItemStack(this.getItemDoor(), 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metadata) {return new TileEntityDimDoor();}
|
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||||
|
return new TileEntityDimDoor(world);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enterDimDoor(World world, BlockPos pos, Entity entity) {
|
public void enterDimDoor(World world, BlockPos pos, Entity entity) {
|
||||||
// Check that this is the top block of the door
|
// Check that this is the top block of the door
|
||||||
IBlockState state = world.getBlockState(pos.down());
|
IBlockState state = world.getBlockState(pos.down());
|
||||||
if (!world.isRemote && state.getBlock() == this) {
|
if (!world.isRemote && state.getBlock() == this) {
|
||||||
if(state.getValue(BlockDoor.OPEN)
|
if (state.getValue(BlockDoor.OPEN)
|
||||||
&& entity instanceof EntityPlayer
|
&& entity instanceof EntityPlayer
|
||||||
&& isEntityFacingDoor(state, (EntityLivingBase) entity)) {
|
&& isEntityFacingDoor(state, (EntityLivingBase) entity)) {
|
||||||
this.toggleDoor(world, pos, false);
|
this.toggleDoor(world, pos, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BlockPos up = pos.up();
|
BlockPos up = pos.up();
|
||||||
if (world.getBlockState(up).getBlock() == this) enterDimDoor(world, up, entity);
|
if (world.getBlockState(up).getBlock() == this) {
|
||||||
|
enterDimDoor(world, up, entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUpperDoorBlock(IBlockState state) {return state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER;}
|
|
||||||
|
|
||||||
public boolean checkCanOpen(World world, BlockPos pos, EntityPlayer player) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public boolean isUpperDoorBlock(IBlockState state) {
|
||||||
protected static boolean isEntityFacingDoor(IBlockState state, EntityLivingBase entity) {
|
return state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER;
|
||||||
// Although any entity has the proper fields for this check,
|
}
|
||||||
// we should only apply it to living entities since things
|
|
||||||
// like Minecarts might come in backwards.
|
public boolean checkCanOpen(World world, BlockPos pos, EntityPlayer player) {
|
||||||
return (state.getValue(BlockDoor.FACING) == EnumFacing.fromAngle(entity.rotationYaw));
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
protected static boolean isEntityFacingDoor(IBlockState state, EntityLivingBase entity) {
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
// Although any entity has the proper fields for this check,
|
||||||
// This function runs on the server side after a block is replaced
|
// we should only apply it to living entities since things
|
||||||
// We MUST call super.breakBlock() since it involves removing tile entities
|
// like Minecarts might come in backwards.
|
||||||
if(state.getValue(BlockDoor.HALF) == EnumDoorHalf.LOWER) world.setBlockToAir(pos.up());
|
return (state.getValue(BlockDoor.FACING) == EnumFacing.fromAngle(entity.rotationYaw));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||||
|
// This function runs on the server side after a block is replaced
|
||||||
|
// We MUST call super.breakBlock() since it involves removing tile entities
|
||||||
|
if (state.getValue(BlockDoor.HALF) == EnumDoorHalf.LOWER) {
|
||||||
|
world.setBlockToAir(pos.up());
|
||||||
|
}
|
||||||
super.breakBlock(world, pos, state);
|
super.breakBlock(world, pos, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,23 +10,28 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockDimDoorGold extends BlockDimDoorBase {
|
public class BlockDimDoorGold extends BlockDimDoorBase {
|
||||||
|
|
||||||
public static final String ID = "blockDimDoorGold";
|
public static final String ID = "blockDimDoorGold";
|
||||||
|
|
||||||
public BlockDimDoorGold() {
|
public BlockDimDoorGold() {
|
||||||
super(Material.IRON);
|
super(Material.IRON);
|
||||||
setHardness(1.0F);
|
setHardness(1.0F);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void placeLink(World world, BlockPos pos) {
|
public void placeLink(World world, BlockPos pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDoor() {return ModItems.itemDimDoorGold;}
|
public Item getItemDoor() {
|
||||||
|
return ModItems.itemDimDoorGold;
|
||||||
@Override
|
}
|
||||||
public TileEntity createNewTileEntity(World world, int metadata) {return new TileEntityDimDoorGold(world);}
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||||
|
return new TileEntityDimDoorGold(world);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,20 +7,23 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockDimDoorPersonal extends BlockDimDoorBase {
|
public class BlockDimDoorPersonal extends BlockDimDoorBase {
|
||||||
public static final String ID = "blockDimDoorPersonal";
|
|
||||||
|
|
||||||
public BlockDimDoorPersonal() {
|
public static final String ID = "blockDimDoorPersonal";
|
||||||
super(Material.ROCK);
|
|
||||||
|
public BlockDimDoorPersonal() {
|
||||||
|
super(Material.ROCK);
|
||||||
setHardness(0.1F);
|
setHardness(0.1F);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void placeLink(World world, BlockPos pos) {
|
public void placeLink(World world, BlockPos pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDoor() {return ModItems.itemDimDoorPersonal;}
|
public Item getItemDoor() {
|
||||||
|
return ModItems.itemDimDoorPersonal;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,39 +11,46 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockDimDoorTransient extends BlockDimDoorBase {
|
public class BlockDimDoorTransient extends BlockDimDoorBase {
|
||||||
public static final String ID = "blockDimDoorTransient";
|
|
||||||
|
|
||||||
public BlockDimDoorTransient() {
|
public static final String ID = "blockDimDoorTransient";
|
||||||
super(Material.IRON);
|
|
||||||
setHardness(1.0F);
|
|
||||||
setUnlocalizedName(ID);
|
|
||||||
setRegistryName(ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public BlockDimDoorTransient() {
|
||||||
public void enterDimDoor(World world, BlockPos pos, Entity entity) {
|
super(Material.IRON);
|
||||||
// Check that this is the top block of the door
|
setHardness(1.0F);
|
||||||
IBlockState state = world.getBlockState(pos.down());
|
setUnlocalizedName(ID);
|
||||||
if (!world.isRemote && state.getBlock() == this) {
|
setRegistryName(ID);
|
||||||
if (entity instanceof EntityPlayer && isEntityFacingDoor(state, (EntityLivingBase) entity)) {
|
}
|
||||||
// Turn the door into a rift AFTER teleporting the player.
|
|
||||||
// The door's orientation may be necessary for the teleport.
|
@Override
|
||||||
world.setBlockState(pos, ModBlocks.blockRift.getDefaultState());
|
public void enterDimDoor(World world, BlockPos pos, Entity entity) {
|
||||||
world.setBlockToAir(pos.down());
|
// Check that this is the top block of the door
|
||||||
}
|
IBlockState state = world.getBlockState(pos.down());
|
||||||
} else {
|
if (!world.isRemote && state.getBlock() == this) {
|
||||||
|
if (entity instanceof EntityPlayer && isEntityFacingDoor(state, (EntityLivingBase) entity)) {
|
||||||
|
// Turn the door into a rift AFTER teleporting the player.
|
||||||
|
// The door's orientation may be necessary for the teleport.
|
||||||
|
world.setBlockState(pos, ModBlocks.blockRift.getDefaultState());
|
||||||
|
world.setBlockToAir(pos.down());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
BlockPos up = pos.up();
|
BlockPos up = pos.up();
|
||||||
if (world.getBlockState(up).getBlock() == this) enterDimDoor(world, up, entity);
|
if (world.getBlockState(up).getBlock() == this) {
|
||||||
|
enterDimDoor(world, up, entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void placeLink(World world, BlockPos pos) {
|
public void placeLink(World world, BlockPos pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Item getItemDoor() {return null;}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCollidable() {return false;}
|
public Item getItemDoor() {
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCollidable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -11,23 +11,28 @@ import net.minecraft.world.World;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockDimDoorUnstable extends BlockDimDoorBase {
|
public class BlockDimDoorUnstable extends BlockDimDoorBase {
|
||||||
public static final String ID = "blockDimDoorChaos";
|
|
||||||
|
|
||||||
public BlockDimDoorUnstable() {
|
public static final String ID = "blockDimDoorChaos";
|
||||||
super(Material.IRON);
|
|
||||||
|
public BlockDimDoorUnstable() {
|
||||||
|
super(Material.IRON);
|
||||||
setHardness(.2F);
|
setHardness(.2F);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
setLightLevel(.0F);
|
setLightLevel(.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void placeLink(World world, BlockPos pos) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Item getItemDoor() {return ModItems.itemDimDoorChaos;}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random random, int fortune) {return Items.IRON_DOOR;}
|
public void placeLink(World world, BlockPos pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Item getItemDoor() {
|
||||||
|
return ModItems.itemDimDoorChaos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Item getItemDropped(IBlockState state, Random random, int fortune) {
|
||||||
|
return Items.IRON_DOOR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -7,19 +7,22 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockDimDoorWarp extends BlockDimDoorBase {
|
public class BlockDimDoorWarp extends BlockDimDoorBase {
|
||||||
|
|
||||||
public static final String ID = "blockDimDoorWarp";
|
public static final String ID = "blockDimDoorWarp";
|
||||||
|
|
||||||
public BlockDimDoorWarp() {
|
public BlockDimDoorWarp() {
|
||||||
super(Material.WOOD);
|
super(Material.WOOD);
|
||||||
setHardness(1.0F);
|
setHardness(1.0F);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void placeLink(World world, BlockPos pos) {
|
public void placeLink(World world, BlockPos pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDoor() {return ModItems.itemDimDoorWarp;}
|
public Item getItemDoor() {
|
||||||
}
|
return ModItems.itemDimDoorWarp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -31,82 +31,96 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class BlockDimWall extends Block {
|
public class BlockDimWall extends Block {
|
||||||
|
|
||||||
public static final String ID = "blockDimWall";
|
public static final String ID = "blockDimWall";
|
||||||
public static final PropertyInteger TYPE = PropertyInteger.create("type", 0, 2);
|
public static final PropertyInteger TYPE = PropertyInteger.create("type", 0, 2);
|
||||||
|
|
||||||
private static final float SUPER_HIGH_HARDNESS = 10000000000000F;
|
private static final float SUPER_HIGH_HARDNESS = 10000000000000F;
|
||||||
private static final float SUPER_EXPLOSION_RESISTANCE = 18000000F;
|
private static final float SUPER_EXPLOSION_RESISTANCE = 18000000F;
|
||||||
|
|
||||||
public BlockDimWall() {
|
public BlockDimWall() {
|
||||||
super(Material.IRON);
|
super(Material.IRON);
|
||||||
this.setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
this.setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
||||||
setLightLevel(1.0F);
|
setLightLevel(1.0F);
|
||||||
setHardness(0.1F);
|
setHardness(0.1F);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
setDefaultState(blockState.getBaseState().withProperty(TYPE, 0));
|
setDefaultState(blockState.getBaseState().withProperty(TYPE, 0));
|
||||||
setSoundType(SoundType.STONE);
|
setSoundType(SoundType.STONE);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
if(meta >= 0 && meta <= 2) return getDefaultState().withProperty(TYPE, meta);
|
|
||||||
else return getDefaultState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReplaceable(IBlockAccess world, BlockPos pos) {
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
if(world.getBlockState(pos).getValue(TYPE) == 1) return false;
|
if (meta >= 0 && meta <= 2) {
|
||||||
return true;
|
return getDefaultState().withProperty(TYPE, meta);
|
||||||
}
|
} else {
|
||||||
|
return getDefaultState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {return state.getValue(TYPE);}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {return new BlockStateContainer(this, TYPE);}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getBlockHardness(IBlockState state, World world, BlockPos pos) {
|
|
||||||
if (state.getValue(TYPE) != 1) return this.blockHardness;
|
|
||||||
else return SUPER_HIGH_HARDNESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) {
|
|
||||||
if(world.getBlockState(pos).getValue(TYPE) != 1)
|
|
||||||
return super.getExplosionResistance(world, pos, exploder, explosion);
|
|
||||||
else return SUPER_EXPLOSION_RESISTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int damageDropped(IBlockState state) {
|
|
||||||
int metadata = state.getValue(TYPE);
|
|
||||||
//Return 0 to avoid dropping Ancient Fabric even if the player somehow manages to break it
|
|
||||||
return metadata == 1 ? 0 : metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
|
||||||
for (int ix = 0; ix < 3; ix++)
|
|
||||||
subItems.add(new ItemStack(itemIn, 1, ix));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player)
|
public boolean isReplaceable(IBlockAccess world, BlockPos pos) {
|
||||||
{
|
if (world.getBlockState(pos).getValue(TYPE) == 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
public int getMetaFromState(IBlockState state) {
|
||||||
|
return state.getValue(TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockStateContainer createBlockState() {
|
||||||
|
return new BlockStateContainer(this, TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getBlockHardness(IBlockState state, World world, BlockPos pos) {
|
||||||
|
if (state.getValue(TYPE) != 1) {
|
||||||
|
return this.blockHardness;
|
||||||
|
} else {
|
||||||
|
return SUPER_HIGH_HARDNESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) {
|
||||||
|
if (world.getBlockState(pos).getValue(TYPE) != 1) {
|
||||||
|
return super.getExplosionResistance(world, pos, exploder, explosion);
|
||||||
|
} else {
|
||||||
|
return SUPER_EXPLOSION_RESISTANCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int damageDropped(IBlockState state) {
|
||||||
|
int metadata = state.getValue(TYPE);
|
||||||
|
//Return 0 to avoid dropping Ancient Fabric even if the player somehow manages to break it
|
||||||
|
return metadata == 1 ? 0 : metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
||||||
|
for (int ix = 0; ix < 3; ix++) {
|
||||||
|
subItems.add(new ItemStack(itemIn, 1, ix));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
return new ItemStack(Item.getItemFromBlock(this), 1, getMetaFromState(world.getBlockState(pos)));
|
return new ItemStack(Item.getItemFromBlock(this), 1, getMetaFromState(world.getBlockState(pos)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random par1Random)
|
public int quantityDropped(Random par1Random) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,15 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockDoorGold extends BlockDoor {
|
public class BlockDoorGold extends BlockDoor {
|
||||||
|
|
||||||
public static final String ID = "blockDoorGold";
|
public static final String ID = "blockDoorGold";
|
||||||
|
|
||||||
public BlockDoorGold() {
|
public BlockDoorGold() {
|
||||||
super(Material.IRON);
|
super(Material.IRON);
|
||||||
setHardness(0.1F);
|
setHardness(0.1F);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||||
|
|
|
@ -14,14 +14,15 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockDoorQuartz extends BlockDoor {
|
public class BlockDoorQuartz extends BlockDoor {
|
||||||
|
|
||||||
public static final String ID = "blockDoorQuartz";
|
public static final String ID = "blockDoorQuartz";
|
||||||
|
|
||||||
public BlockDoorQuartz() {
|
public BlockDoorQuartz() {
|
||||||
super(Material.ROCK);
|
super(Material.ROCK);
|
||||||
setHardness(0.1F);
|
setHardness(0.1F);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||||
|
|
|
@ -32,159 +32,167 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class BlockRift extends Block implements ITileEntityProvider {
|
public class BlockRift extends Block implements ITileEntityProvider {
|
||||||
private static final float MIN_IMMUNE_RESISTANCE = 5000.0F;
|
|
||||||
|
private static final float MIN_IMMUNE_RESISTANCE = 5000.0F;
|
||||||
public static final String ID = "blockRift";
|
public static final String ID = "blockRift";
|
||||||
|
|
||||||
private final ArrayList<Block> blocksImmuneToRift; // List of Vanilla blocks immune to rifts
|
private final ArrayList<Block> blocksImmuneToRift; // List of Vanilla blocks immune to rifts
|
||||||
private final ArrayList<Block> modBlocksImmuneToRift; // List of DD blocks immune to rifts
|
private final ArrayList<Block> modBlocksImmuneToRift; // List of DD blocks immune to rifts
|
||||||
|
|
||||||
public BlockRift() {
|
public BlockRift() {
|
||||||
super(Material.FIRE);
|
super(Material.FIRE);
|
||||||
setTickRandomly(true);
|
setTickRandomly(true);
|
||||||
setHardness(1.0F);
|
setHardness(1.0F);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
|
|
||||||
modBlocksImmuneToRift = new ArrayList<Block>();
|
modBlocksImmuneToRift = new ArrayList<Block>();
|
||||||
modBlocksImmuneToRift.add(ModBlocks.blockDimWall);
|
modBlocksImmuneToRift.add(ModBlocks.blockDimWall);
|
||||||
modBlocksImmuneToRift.add(ModBlocks.blockDimDoor);
|
modBlocksImmuneToRift.add(ModBlocks.blockDimDoor);
|
||||||
modBlocksImmuneToRift.add(ModBlocks.blockDimDoorWarp);
|
modBlocksImmuneToRift.add(ModBlocks.blockDimDoorWarp);
|
||||||
modBlocksImmuneToRift.add(ModBlocks.blockDimHatch);
|
modBlocksImmuneToRift.add(ModBlocks.blockDimHatch);
|
||||||
modBlocksImmuneToRift.add(ModBlocks.blockDimDoorChaos);
|
modBlocksImmuneToRift.add(ModBlocks.blockDimDoorChaos);
|
||||||
modBlocksImmuneToRift.add(ModBlocks.blockRift);
|
modBlocksImmuneToRift.add(ModBlocks.blockRift);
|
||||||
modBlocksImmuneToRift.add(ModBlocks.blockDimDoorTransient);
|
modBlocksImmuneToRift.add(ModBlocks.blockDimDoorTransient);
|
||||||
modBlocksImmuneToRift.add(ModBlocks.blockDimDoorGold);
|
modBlocksImmuneToRift.add(ModBlocks.blockDimDoorGold);
|
||||||
modBlocksImmuneToRift.add(ModBlocks.blockDoorGold);
|
modBlocksImmuneToRift.add(ModBlocks.blockDoorGold);
|
||||||
modBlocksImmuneToRift.add(ModBlocks.blockDimDoorPersonal);
|
modBlocksImmuneToRift.add(ModBlocks.blockDimDoorPersonal);
|
||||||
modBlocksImmuneToRift.add(ModBlocks.blockDoorQuartz);
|
modBlocksImmuneToRift.add(ModBlocks.blockDoorQuartz);
|
||||||
|
|
||||||
blocksImmuneToRift = new ArrayList<Block>();
|
|
||||||
blocksImmuneToRift.add(Blocks.LAPIS_BLOCK);
|
|
||||||
blocksImmuneToRift.add(Blocks.IRON_BLOCK);
|
|
||||||
blocksImmuneToRift.add(Blocks.GOLD_BLOCK);
|
|
||||||
blocksImmuneToRift.add(Blocks.DIAMOND_BLOCK);
|
|
||||||
blocksImmuneToRift.add(Blocks.EMERALD_BLOCK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCollidable() {return false;}
|
|
||||||
|
|
||||||
@Override
|
blocksImmuneToRift = new ArrayList<Block>();
|
||||||
public boolean isOpaqueCube(IBlockState state) {return false;}
|
blocksImmuneToRift.add(Blocks.LAPIS_BLOCK);
|
||||||
|
blocksImmuneToRift.add(Blocks.IRON_BLOCK);
|
||||||
|
blocksImmuneToRift.add(Blocks.GOLD_BLOCK);
|
||||||
|
blocksImmuneToRift.add(Blocks.DIAMOND_BLOCK);
|
||||||
|
blocksImmuneToRift.add(Blocks.EMERALD_BLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos) {
|
public boolean isCollidable() {
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
*/
|
return false;
|
||||||
@Override
|
}
|
||||||
public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid)
|
|
||||||
{
|
|
||||||
return hitIfLiquid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the
|
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos) {
|
||||||
* adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side
|
return null;
|
||||||
*/
|
}
|
||||||
@Override
|
|
||||||
public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
|
/**
|
||||||
{
|
* Returns whether this block is collideable based on the arguments passed
|
||||||
return true;
|
* in Args: blockMetaData, unknownFlag
|
||||||
}
|
*/
|
||||||
|
@Override
|
||||||
@Override
|
public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid) {
|
||||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
return hitIfLiquid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns Returns true if the given side of this block type should be
|
||||||
|
* rendered (if it's solid or not), if the adjacent block is at the given
|
||||||
|
* coordinates. Args: blockAccess, x, y, z, side
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||||
return EnumBlockRenderType.INVISIBLE; //Tile Entity Special Renderer
|
return EnumBlockRenderType.INVISIBLE; //Tile Entity Special Renderer
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dropWorldThread(World world, BlockPos pos, Random random) {
|
public void dropWorldThread(World world, BlockPos pos, Random random) {
|
||||||
Block block = world.getBlockState(pos).getBlock();
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
|
|
||||||
if (!world.getBlockState(pos).equals(Blocks.AIR) && !(block instanceof BlockLiquid || block instanceof IFluidBlock)) {
|
if (!world.getBlockState(pos).equals(Blocks.AIR) && !(block instanceof BlockLiquid || block instanceof IFluidBlock)) {
|
||||||
ItemStack thread = new ItemStack(ModItems.itemWorldThread, 1);
|
ItemStack thread = new ItemStack(ModItems.itemWorldThread, 1);
|
||||||
world.spawnEntity(new EntityItem(world, pos.getX(), pos.getY(), pos.getZ(), thread));
|
world.spawnEntity(new EntityItem(world, pos.getX(), pos.getY(), pos.getZ(), thread));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lets pistons push through rifts, destroying them
|
* Lets pistons push through rifts, destroying them
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public EnumPushReaction getMobilityFlag(IBlockState state) {
|
public EnumPushReaction getMobilityFlag(IBlockState state) {
|
||||||
return EnumPushReaction.NORMAL;
|
return EnumPushReaction.NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* regulates the render effect, especially when multiple rifts start to link up.
|
* regulates the render effect, especially when multiple rifts start to link
|
||||||
* Has 3 main parts- Grows toward and away from nearest rift, bends toward it, and a randomization function
|
* up. Has 3 main parts- Grows toward and away from nearest rift, bends
|
||||||
*/
|
* toward it, and a randomization function
|
||||||
@Override
|
*/
|
||||||
@SideOnly(Side.CLIENT)
|
@Override
|
||||||
public void randomDisplayTick(IBlockState state, World worldIn, BlockPos pos, Random rand) {
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void randomDisplayTick(IBlockState state, World worldIn, BlockPos pos, Random rand) {
|
||||||
//ArrayList<BlockPos> targets = findReachableBlocks(worldIn, pos, 2, false);
|
//ArrayList<BlockPos> targets = findReachableBlocks(worldIn, pos, 2, false);
|
||||||
//TODO: implement the parts specified in the method comment?
|
//TODO: implement the parts specified in the method comment?
|
||||||
int x = pos.getX(), y = pos.getY(), z = pos.getZ();
|
int x = pos.getX(), y = pos.getY(), z = pos.getZ();
|
||||||
|
|
||||||
TileEntityRift tile = (TileEntityRift)worldIn.getTileEntity(pos);
|
TileEntityRift tile = (TileEntityRift) worldIn.getTileEntity(pos);
|
||||||
//renders an extra little blob on top of the actual rift location so its easier to find.
|
//renders an extra little blob on top of the actual rift location so its easier to find.
|
||||||
// Eventually will only render if the player has the goggles.
|
// Eventually will only render if the player has the goggles.
|
||||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new GoggleRiftFX(
|
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new GoggleRiftFX(
|
||||||
worldIn,
|
worldIn,
|
||||||
x+.5, y+.5, z+.5,
|
x + .5, y + .5, z + .5,
|
||||||
rand.nextGaussian()*0.01D, rand.nextGaussian()*0.01D, rand.nextGaussian()*0.01D));
|
rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D));
|
||||||
|
|
||||||
if(tile.shouldClose)
|
if (tile.shouldClose) //renders an opposite color effect if it is being closed by the rift remover
|
||||||
//renders an opposite color effect if it is being closed by the rift remover
|
{
|
||||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ClosingRiftFX(
|
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ClosingRiftFX(
|
||||||
worldIn,
|
worldIn,
|
||||||
x+.5, y+.5, z+.5,
|
x + .5, y + .5, z + .5,
|
||||||
rand.nextGaussian()*0.01D, rand.nextGaussian()*0.01D, rand.nextGaussian()*0.01D));
|
rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public boolean tryPlacingRift(World world, BlockPos pos) {
|
|
||||||
return world != null && !isBlockImmune(world, pos) && world.setBlockState(pos, getDefaultState());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBlockImmune(World world, BlockPos pos) {
|
public boolean tryPlacingRift(World world, BlockPos pos) {
|
||||||
Block block = world.getBlockState(pos).getBlock();
|
return world != null && !isBlockImmune(world, pos) && world.setBlockState(pos, getDefaultState());
|
||||||
// SenseiKiwi: I've switched to using the block's blast resistance instead of its
|
}
|
||||||
// hardness since most defensive blocks are meant to defend against explosions and
|
|
||||||
// may have low hardness to make them easier to build with. However, block.getExplosionResistance()
|
|
||||||
// is designed to receive an entity, the source of the blast. We have no entity so
|
|
||||||
// I've set this to access blockResistance directly. Might need changing later.
|
|
||||||
return block != null /*&&
|
|
||||||
(block >= MIN_IMMUNE_RESISTANCE*/ ||
|
|
||||||
modBlocksImmuneToRift.contains(block) ||
|
|
||||||
blocksImmuneToRift.contains(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isModBlockImmune(World world, BlockPos pos) {
|
public boolean isBlockImmune(World world, BlockPos pos) {
|
||||||
// Check whether the block at the specified location is one of the
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
// rift-resistant blocks from DD.
|
// SenseiKiwi: I've switched to using the block's blast resistance instead of its
|
||||||
Block block = world.getBlockState(pos).getBlock();
|
// hardness since most defensive blocks are meant to defend against explosions and
|
||||||
return block != null && modBlocksImmuneToRift.contains(block);
|
// may have low hardness to make them easier to build with. However, block.getExplosionResistance()
|
||||||
}
|
// is designed to receive an entity, the source of the blast. We have no entity so
|
||||||
|
// I've set this to access blockResistance directly. Might need changing later.
|
||||||
@Override
|
return block != null
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
/*&&
|
||||||
|
(block >= MIN_IMMUNE_RESISTANCE*/ || modBlocksImmuneToRift.contains(block)
|
||||||
|
|| blocksImmuneToRift.contains(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isModBlockImmune(World world, BlockPos pos) {
|
||||||
|
// Check whether the block at the specified location is one of the
|
||||||
|
// rift-resistant blocks from DD.
|
||||||
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
|
return block != null && modBlocksImmuneToRift.contains(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {return null;}
|
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metadata)
|
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||||
{
|
return new TileEntityRift(world);
|
||||||
return new TileEntityRift(world);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
|
||||||
world.removeTileEntity(pos);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||||
|
world.removeTileEntity(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -25,87 +25,100 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockTransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider {
|
public class BlockTransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider {
|
||||||
public static final String ID = "blockDimHatch";
|
|
||||||
|
|
||||||
public BlockTransTrapdoor() {
|
public static final String ID = "blockDimHatch";
|
||||||
super(Material.WOOD);
|
|
||||||
this.setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
public BlockTransTrapdoor() {
|
||||||
|
super(Material.WOOD);
|
||||||
|
this.setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
||||||
setHardness(1.0F);
|
setHardness(1.0F);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
setSoundType(SoundType.WOOD);
|
setSoundType(SoundType.WOOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
//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
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
|
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
|
||||||
enterDimDoor(world, pos, entity);
|
enterDimDoor(world, pos, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkCanOpen(World world, BlockPos pos) {return this.checkCanOpen(world, pos, null);}
|
public boolean checkCanOpen(World world, BlockPos pos) {
|
||||||
|
return this.checkCanOpen(world, pos, null);
|
||||||
public boolean checkCanOpen(World world, BlockPos pos, EntityPlayer player) {return true;}
|
}
|
||||||
|
|
||||||
|
public boolean checkCanOpen(World world, BlockPos pos, EntityPlayer player) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
return checkCanOpen(worldIn, pos, playerIn) &&
|
return checkCanOpen(worldIn, pos, playerIn)
|
||||||
super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
|
&& super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block neighborBlock) {
|
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block neighborBlock) {
|
||||||
if(checkCanOpen(worldIn, pos)) super.neighborChanged(state, worldIn, pos, neighborBlock);
|
if (checkCanOpen(worldIn, pos)) {
|
||||||
|
super.neighborChanged(state, worldIn, pos, neighborBlock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enterDimDoor(World world, BlockPos pos, Entity entity) {
|
public void enterDimDoor(World world, BlockPos pos, Entity entity) {
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
if (!world.isRemote && state.getValue(BlockTrapDoor.OPEN)) {
|
if (!world.isRemote && state.getValue(BlockTrapDoor.OPEN)) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
state.cycleProperty(BlockTrapDoor.OPEN);
|
state.cycleProperty(BlockTrapDoor.OPEN);
|
||||||
world.markBlockRangeForRenderUpdate(pos, pos);
|
world.markBlockRangeForRenderUpdate(pos, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||||
this.placeLink(world, pos);
|
this.placeLink(world, pos);
|
||||||
world.setTileEntity(pos, createNewTileEntity(world, getMetaFromState(state)));
|
world.setTileEntity(pos, createNewTileEntity(world, getMetaFromState(state)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metadata) {return new TileEntityTransTrapdoor(world);}
|
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||||
|
return new TileEntityTransTrapdoor(world);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void placeLink(World world, BlockPos pos) {
|
public void placeLink(World world, BlockPos pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
return new ItemStack(this.getItemDoor(), 1, 0);
|
return new ItemStack(this.getItemDoor(), 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random random, int fortuneLevel) {
|
public Item getItemDropped(IBlockState state, Random random, int fortuneLevel) {
|
||||||
return Item.getItemFromBlock(Blocks.TRAPDOOR);
|
return Item.getItemFromBlock(Blocks.TRAPDOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDoor() {return Item.getItemFromBlock(ModBlocks.blockDimHatch);}
|
public Item getItemDoor() {
|
||||||
|
return Item.getItemFromBlock(ModBlocks.blockDimHatch);
|
||||||
public static boolean isTrapdoorSetLow(IBlockState state) {
|
}
|
||||||
|
|
||||||
|
public static boolean isTrapdoorSetLow(IBlockState state) {
|
||||||
return state.getValue(BlockTrapDoor.HALF) == DoorHalf.BOTTOM;
|
return state.getValue(BlockTrapDoor.HALF) == DoorHalf.BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDoorOnRift(World world, BlockPos pos) {return true;}
|
public boolean isDoorOnRift(World world, BlockPos pos) {
|
||||||
|
return true;
|
||||||
@Override
|
}
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
|
||||||
// This function runs on the server side after a block is replaced
|
@Override
|
||||||
// We MUST call super.breakBlock() since it involves removing tile entities
|
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||||
|
// This function runs on the server side after a block is replaced
|
||||||
|
// We MUST call super.breakBlock() since it involves removing tile entities
|
||||||
super.breakBlock(world, pos, state);
|
super.breakBlock(world, pos, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,37 +6,41 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public interface IDimDoor
|
public interface IDimDoor {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* A function to enter a dim door and traverse its link, called when a player collides with an open door
|
* A function to enter a dim door and traverse its link, called when a
|
||||||
* @param world
|
* player collides with an open door
|
||||||
* @param x
|
*
|
||||||
* @param y
|
* @param world
|
||||||
* @param z
|
* @param x
|
||||||
* @param entity
|
* @param y
|
||||||
*/
|
* @param z
|
||||||
public void enterDimDoor(World world, BlockPos pos, Entity entity);
|
* @param entity
|
||||||
|
*/
|
||||||
/**
|
public void enterDimDoor(World world, BlockPos pos, Entity entity);
|
||||||
* called when a door is placed to determine how it will place a link
|
|
||||||
* @param world
|
/**
|
||||||
* @param x
|
* called when a door is placed to determine how it will place a link
|
||||||
* @param y
|
*
|
||||||
* @param z
|
* @param world
|
||||||
*/
|
* @param x
|
||||||
public void placeLink(World world, BlockPos pos);
|
* @param y
|
||||||
|
* @param z
|
||||||
public Item getItemDoor();
|
*/
|
||||||
|
public void placeLink(World world, BlockPos pos);
|
||||||
/**
|
|
||||||
* checks if any of this doors blocks are overlapping with a rift
|
public Item getItemDoor();
|
||||||
* @param world
|
|
||||||
* @param x
|
/**
|
||||||
* @param y
|
* checks if any of this doors blocks are overlapping with a rift
|
||||||
* @param z
|
*
|
||||||
* @return
|
* @param world
|
||||||
*/
|
* @param x
|
||||||
public boolean isDoorOnRift(World world, BlockPos pos);
|
* @param y
|
||||||
|
* @param z
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isDoorOnRift(World world, BlockPos pos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.zixiken.dimdoors.blocks;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class ModBlocks {
|
public class ModBlocks {
|
||||||
|
|
||||||
public static BlockDoorQuartz blockDoorQuartz;
|
public static BlockDoorQuartz blockDoorQuartz;
|
||||||
public static BlockDoorGold blockDoorGold;
|
public static BlockDoorGold blockDoorGold;
|
||||||
public static BlockDimDoorPersonal blockDimDoorPersonal;
|
public static BlockDimDoorPersonal blockDimDoorPersonal;
|
||||||
|
|
|
@ -10,49 +10,50 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ClosingRiftFX extends Particle
|
public class ClosingRiftFX extends Particle {
|
||||||
{
|
|
||||||
private int baseTextureIndex = 160;
|
|
||||||
private boolean trail;
|
|
||||||
private boolean twinkle;
|
|
||||||
private float fadeColourRed;
|
|
||||||
private float fadeColourGreen;
|
|
||||||
private float fadeColourBlue;
|
|
||||||
private boolean hasFadeColour;
|
|
||||||
|
|
||||||
public ClosingRiftFX(World world, double x, double y, double z, double motionX, double motionY, double motionZ) {
|
private int baseTextureIndex = 160;
|
||||||
|
private boolean trail;
|
||||||
|
private boolean twinkle;
|
||||||
|
private float fadeColourRed;
|
||||||
|
private float fadeColourGreen;
|
||||||
|
private float fadeColourBlue;
|
||||||
|
private boolean hasFadeColour;
|
||||||
|
|
||||||
super(world, x, y, z);
|
public ClosingRiftFX(World world, double x, double y, double z, double motionX, double motionY, double motionZ) {
|
||||||
this.motionX = motionX;
|
|
||||||
this.motionY = motionY;
|
super(world, x, y, z);
|
||||||
this.motionZ = motionZ;
|
this.motionX = motionX;
|
||||||
this.particleScale *= .55F;
|
this.motionY = motionY;
|
||||||
this.particleMaxAge = 30 + this.rand.nextInt(16);
|
this.motionZ = motionZ;
|
||||||
}
|
this.particleScale *= .55F;
|
||||||
|
this.particleMaxAge = 30 + this.rand.nextInt(16);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderParticle(VertexBuffer worldRenderer, Entity entityIn, float partialTicks, float p_180434_4_,
|
public void renderParticle(VertexBuffer worldRenderer, Entity entityIn, float partialTicks, float p_180434_4_,
|
||||||
float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) {
|
float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) {
|
||||||
if (!this.twinkle
|
if (!this.twinkle
|
||||||
|| this.particleAge < this.particleMaxAge / 3
|
|| this.particleAge < this.particleMaxAge / 3
|
||||||
|| (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
|
|| (this.particleAge + this.particleMaxAge) / 3 % 2 == 0) {
|
||||||
this.doRenderParticle(worldRenderer, partialTicks, p_180434_4_,
|
this.doRenderParticle(worldRenderer, partialTicks, p_180434_4_,
|
||||||
p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_);
|
p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void doRenderParticle(VertexBuffer worldRenderer, float par2, float par3, float par4,
|
public void doRenderParticle(VertexBuffer worldRenderer, float par2, float par3, float par4,
|
||||||
float par5, float par6, float par7) {
|
float par5, float par6, float par7) {
|
||||||
float var8 = super.particleTextureIndexX % 16 / 16.0F;
|
float var8 = super.particleTextureIndexX % 16 / 16.0F;
|
||||||
float var9 = var8 + 0.0624375F;
|
float var9 = var8 + 0.0624375F;
|
||||||
float var10 = this.particleTextureIndexX / 16 / 16.0F;
|
float var10 = this.particleTextureIndexX / 16 / 16.0F;
|
||||||
float var11 = var10 + 0.0624375F;
|
float var11 = var10 + 0.0624375F;
|
||||||
float var12 = 0.1F * this.particleScale;
|
float var12 = 0.1F * this.particleScale;
|
||||||
float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
|
float var13 = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
|
||||||
float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY);
|
float var14 = (float) (this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY);
|
||||||
float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ);
|
float var15 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ);
|
||||||
float var16 = 0.8F;
|
float var16 = 0.8F;
|
||||||
|
|
||||||
worldRenderer.pos(var13 - par3 * var12 - par6 * var12, var14 - par4 * var12, var15 - par5 * var12 - par7 * var12)
|
worldRenderer.pos(var13 - par3 * var12 - par6 * var12, var14 - par4 * var12, var15 - par5 * var12 - par7 * var12)
|
||||||
.tex(var9, var11)
|
.tex(var9, var11)
|
||||||
.color(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7)
|
.color(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7)
|
||||||
.endVertex();
|
.endVertex();
|
||||||
|
@ -68,54 +69,55 @@ public class ClosingRiftFX extends Particle
|
||||||
.tex(var8, var11)
|
.tex(var8, var11)
|
||||||
.color(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7)
|
.color(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7)
|
||||||
.endVertex();
|
.endVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to update the entity's position/logic.
|
* Called to update the entity's position/logic.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate() {
|
public void onUpdate() {
|
||||||
this.prevPosX = this.posX;
|
this.prevPosX = this.posX;
|
||||||
this.prevPosY = this.posY;
|
this.prevPosY = this.posY;
|
||||||
this.prevPosZ = this.posZ;
|
this.prevPosZ = this.posZ;
|
||||||
|
|
||||||
if (this.particleAge++ >= this.particleMaxAge) {
|
if (this.particleAge++ >= this.particleMaxAge) {
|
||||||
this.setExpired();
|
this.setExpired();
|
||||||
} if (this.particleAge > this.particleMaxAge / 2) {
|
}
|
||||||
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / this.particleMaxAge);
|
if (this.particleAge > this.particleMaxAge / 2) {
|
||||||
|
this.setAlphaF(1.0F - ((float) this.particleAge - (float) (this.particleMaxAge / 2)) / this.particleMaxAge);
|
||||||
|
|
||||||
if (this.hasFadeColour) {
|
if (this.hasFadeColour) {
|
||||||
this.particleRed += (this.fadeColourRed - this.particleRed) * 0.2F;
|
this.particleRed += (this.fadeColourRed - this.particleRed) * 0.2F;
|
||||||
this.particleGreen += (this.fadeColourGreen - this.particleGreen) * 0.2F;
|
this.particleGreen += (this.fadeColourGreen - this.particleGreen) * 0.2F;
|
||||||
this.particleBlue += (this.fadeColourBlue - this.particleBlue) * 0.2F;
|
this.particleBlue += (this.fadeColourBlue - this.particleBlue) * 0.2F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setParticleTextureIndex(this.baseTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge));
|
this.setParticleTextureIndex(this.baseTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge));
|
||||||
// this.motionY -= 0.004D;
|
// this.motionY -= 0.004D;
|
||||||
this.move(this.motionX, this.motionY, this.motionZ);
|
this.move(this.motionX, this.motionY, this.motionZ);
|
||||||
this.motionX *= 0.9100000262260437D;
|
this.motionX *= 0.9100000262260437D;
|
||||||
this.motionY *= 0.9100000262260437D;
|
this.motionY *= 0.9100000262260437D;
|
||||||
this.motionZ *= 0.9100000262260437D;
|
this.motionZ *= 0.9100000262260437D;
|
||||||
|
|
||||||
if (this.trail && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0) {
|
if (this.trail && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0) {
|
||||||
ClosingRiftFX var1 = new ClosingRiftFX(this.world, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
|
ClosingRiftFX var1 = new ClosingRiftFX(this.world, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
|
||||||
var1.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue);
|
var1.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue);
|
||||||
var1.particleAge = var1.particleMaxAge / 2;
|
var1.particleAge = var1.particleMaxAge / 2;
|
||||||
|
|
||||||
if (this.hasFadeColour) {
|
if (this.hasFadeColour) {
|
||||||
var1.hasFadeColour = true;
|
var1.hasFadeColour = true;
|
||||||
var1.fadeColourRed = this.fadeColourRed;
|
var1.fadeColourRed = this.fadeColourRed;
|
||||||
var1.fadeColourGreen = this.fadeColourGreen;
|
var1.fadeColourGreen = this.fadeColourGreen;
|
||||||
var1.fadeColourBlue = this.fadeColourBlue;
|
var1.fadeColourBlue = this.fadeColourBlue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var1.twinkle = this.twinkle;
|
var1.twinkle = this.twinkle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBrightnessForRender(float par1) {
|
public int getBrightnessForRender(float par1) {
|
||||||
return 15728880;
|
return 15728880;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
|
|
||||||
public class DDProxyClient extends DDProxyCommon {
|
public class DDProxyClient extends DDProxyCommon {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,4 +37,4 @@ public class DDProxyClient extends DDProxyCommon {
|
||||||
public World getDefWorld() {
|
public World getDefWorld() {
|
||||||
return Minecraft.getMinecraft().getIntegratedServer().worldServerForDimension(0); //gets the client world dim 0 handler
|
return Minecraft.getMinecraft().getIntegratedServer().worldServerForDimension(0); //gets the client world dim 0 handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,10 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GoggleRiftFX extends ParticleCloud {
|
public class GoggleRiftFX extends ParticleCloud {
|
||||||
|
|
||||||
public GoggleRiftFX(World par1World, double par2, double par4, double par6,
|
public GoggleRiftFX(World par1World, double par2, double par4, double par6,
|
||||||
double par8, double par10, double par12) {
|
double par8, double par10, double par12) {
|
||||||
super(par1World, par2, par4, par6, par12, par12, par12);
|
super(par1World, par2, par4, par6, par12, par12, par12);
|
||||||
this.particleMaxAge = 40 + this.rand.nextInt(26);
|
this.particleMaxAge = 40 + this.rand.nextInt(26);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,129 +26,130 @@ import static org.lwjgl.opengl.GL11.*;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor> {
|
public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor> {
|
||||||
private FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
|
|
||||||
private ResourceLocation warpPath= new ResourceLocation(DimDoors.MODID + ":textures/other/WARP.png");
|
|
||||||
private ResourceLocation keyPath= new ResourceLocation(DimDoors.MODID + ":textures/other/keyhole.png");
|
|
||||||
private ResourceLocation KeyholeLight= new ResourceLocation(DimDoors.MODID + ":textures/other/keyholeLight.png");
|
|
||||||
|
|
||||||
/**
|
private FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
|
||||||
* Renders the dimdoor.
|
private ResourceLocation warpPath = new ResourceLocation(DimDoors.MODID + ":textures/other/WARP.png");
|
||||||
*/
|
private ResourceLocation keyPath = new ResourceLocation(DimDoors.MODID + ":textures/other/keyhole.png");
|
||||||
public void renderDimDoorTileEntity(TileEntityDimDoor tile, double x, double y, double z) {
|
private ResourceLocation KeyholeLight = new ResourceLocation(DimDoors.MODID + ":textures/other/keyholeLight.png");
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
|
||||||
Random rand = new Random(31100L);
|
|
||||||
|
|
||||||
for (int count = 0; count < 16; ++count) {
|
/**
|
||||||
GlStateManager.pushMatrix();
|
* Renders the dimdoor.
|
||||||
|
*/
|
||||||
|
public void renderDimDoorTileEntity(TileEntityDimDoor tile, double x, double y, double z) {
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
Random rand = new Random(31100L);
|
||||||
|
|
||||||
float var15 = 16 - count;
|
for (int count = 0; count < 16; ++count) {
|
||||||
float var16 = 0.2625F;
|
GlStateManager.pushMatrix();
|
||||||
float var17 = 1.0F / (var15 + .80F);
|
|
||||||
|
|
||||||
this.bindTexture(warpPath);
|
float var15 = 16 - count;
|
||||||
GlStateManager.enableBlend();
|
float var16 = 0.2625F;
|
||||||
|
float var17 = 1.0F / (var15 + .80F);
|
||||||
|
|
||||||
if (count == 0) {
|
this.bindTexture(warpPath);
|
||||||
var17 = 0.1F;
|
GlStateManager.enableBlend();
|
||||||
var15 = 25.0F;
|
|
||||||
var16 = 0.125F;
|
|
||||||
|
|
||||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
if (count == 0) {
|
||||||
}
|
var17 = 0.1F;
|
||||||
|
var15 = 25.0F;
|
||||||
|
var16 = 0.125F;
|
||||||
|
|
||||||
if (count == 1) {
|
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
var16 = .5F;
|
}
|
||||||
|
|
||||||
GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
if (count == 1) {
|
||||||
}
|
var16 = .5F;
|
||||||
|
|
||||||
GlStateManager.translate(Minecraft.getSystemTime() % 200000L / 200000.0F, 0, 0.0F);
|
|
||||||
GlStateManager.translate(0, Minecraft.getSystemTime() % 200000L / 200000.0F, 0.0F);
|
|
||||||
GlStateManager.translate(0, 0, Minecraft.getSystemTime() % 200000L / 200000.0F);
|
|
||||||
|
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_LINEAR);
|
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_LINEAR);
|
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_LINEAR);
|
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_LINEAR);
|
|
||||||
|
|
||||||
EnumFacing orientation = EnumFacing.getHorizontal((tile.orientation.getHorizontalIndex() % 4) + 4);
|
GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||||
|
}
|
||||||
|
|
||||||
switch (orientation) {
|
GlStateManager.translate(Minecraft.getSystemTime() % 200000L / 200000.0F, 0, 0.0F);
|
||||||
case SOUTH:
|
GlStateManager.translate(0, Minecraft.getSystemTime() % 200000L / 200000.0F, 0.0F);
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
GlStateManager.translate(0, 0, Minecraft.getSystemTime() % 200000L / 200000.0F);
|
||||||
|
|
||||||
|
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_LINEAR);
|
||||||
|
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_LINEAR);
|
||||||
|
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_LINEAR);
|
||||||
|
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_LINEAR);
|
||||||
|
|
||||||
|
EnumFacing orientation = EnumFacing.getHorizontal((tile.orientation.getHorizontalIndex() % 4) + 4);
|
||||||
|
|
||||||
|
switch (orientation) {
|
||||||
|
case SOUTH:
|
||||||
|
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.15F));
|
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.15F));
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.15F));
|
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.15F));
|
||||||
break;
|
break;
|
||||||
case NORTH:
|
case NORTH:
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, -0.15F));
|
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, -0.15F));
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, -0.15F));
|
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, -0.15F));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.S);
|
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.S);
|
||||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.T);
|
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.T);
|
||||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.R);
|
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.R);
|
||||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.Q);
|
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.Q);
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
GlStateManager.matrixMode(GL11.GL_TEXTURE);
|
GlStateManager.matrixMode(GL11.GL_TEXTURE);
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.loadIdentity();
|
GlStateManager.loadIdentity();
|
||||||
GlStateManager.translate(0.0F, Minecraft.getSystemTime() % 200000L / 200000.0F * var15, 0.0F);
|
GlStateManager.translate(0.0F, Minecraft.getSystemTime() % 200000L / 200000.0F * var15, 0.0F);
|
||||||
GlStateManager.scale(var16, var16, var16);
|
GlStateManager.scale(var16, var16, var16);
|
||||||
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
||||||
GlStateManager.rotate((count * count * 4321 + count * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
|
GlStateManager.rotate((count * count * 4321 + count * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||||
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
VertexBuffer worldRenderer = tessellator.getBuffer();
|
VertexBuffer worldRenderer = tessellator.getBuffer();
|
||||||
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
|
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
|
||||||
|
|
||||||
float[] color = tile.getRenderColor(rand);
|
float[] color = tile.getRenderColor(rand);
|
||||||
GlStateManager.color(color[0] * var17, color[1] * var17, color[2] * var17, color[3]);
|
GlStateManager.color(color[0] * var17, color[1] * var17, color[2] * var17, color[3]);
|
||||||
|
|
||||||
switch (tile.orientation) {
|
switch (tile.orientation) {
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
worldRenderer.pos(x + .01, y - 1, z).endVertex();
|
worldRenderer.pos(x + .01, y - 1, z).endVertex();
|
||||||
worldRenderer.pos(x + .01, y - 1, z + 1.0D).endVertex();
|
worldRenderer.pos(x + .01, y - 1, z + 1.0D).endVertex();
|
||||||
worldRenderer.pos(x + .01, y + 1, z + 1.0D).endVertex();
|
worldRenderer.pos(x + .01, y + 1, z + 1.0D).endVertex();
|
||||||
worldRenderer.pos(x + .01, y + 1, z).endVertex();
|
worldRenderer.pos(x + .01, y + 1, z).endVertex();
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
worldRenderer.pos(x, y + 1, z + .01).endVertex();
|
worldRenderer.pos(x, y + 1, z + .01).endVertex();
|
||||||
worldRenderer.pos(x + 1, y + 1, z + .01).endVertex();
|
worldRenderer.pos(x + 1, y + 1, z + .01).endVertex();
|
||||||
worldRenderer.pos(x + 1, y -1, z + .01).endVertex();
|
worldRenderer.pos(x + 1, y - 1, z + .01).endVertex();
|
||||||
worldRenderer.pos(x, y -1, z + .01).endVertex();
|
worldRenderer.pos(x, y - 1, z + .01).endVertex();
|
||||||
break;
|
break;
|
||||||
case NORTH:
|
case NORTH:
|
||||||
worldRenderer.pos(x + .99, y + 1, z).endVertex();
|
worldRenderer.pos(x + .99, y + 1, z).endVertex();
|
||||||
worldRenderer.pos(x + .99, y + 1, z + 1.0D).endVertex();
|
worldRenderer.pos(x + .99, y + 1, z + 1.0D).endVertex();
|
||||||
worldRenderer.pos(x + .99, y - 1, z + 1.0D).endVertex();
|
worldRenderer.pos(x + .99, y - 1, z + 1.0D).endVertex();
|
||||||
worldRenderer.pos(x + .99, y - 1, z).endVertex();
|
worldRenderer.pos(x + .99, y - 1, z).endVertex();
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
worldRenderer.pos(x, y -1, z + .99).endVertex();
|
worldRenderer.pos(x, y - 1, z + .99).endVertex();
|
||||||
worldRenderer.pos(x + 1, y -1, z + .99).endVertex();
|
worldRenderer.pos(x + 1, y - 1, z + .99).endVertex();
|
||||||
worldRenderer.pos(x + 1, y + 1, z + .99).endVertex();
|
worldRenderer.pos(x + 1, y + 1, z + .99).endVertex();
|
||||||
worldRenderer.pos(x, y + 1, z + .99).endVertex();
|
worldRenderer.pos(x, y + 1, z + .99).endVertex();
|
||||||
break;
|
break;
|
||||||
/*case 4:
|
/*case 4:
|
||||||
GL11.glVertex3d(x + .15F, y - 1 , z);
|
GL11.glVertex3d(x + .15F, y - 1 , z);
|
||||||
GL11.glVertex3d(x + .15, y - 1, z + 1.0D);
|
GL11.glVertex3d(x + .15, y - 1, z + 1.0D);
|
||||||
GL11.glVertex3d(x + .15, y + 1, z + 1.0D);
|
GL11.glVertex3d(x + .15, y + 1, z + 1.0D);
|
||||||
|
@ -172,40 +173,40 @@ public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor>
|
||||||
GL11.glVertex3d(x + 1, y + 1, z + .85);
|
GL11.glVertex3d(x + 1, y + 1, z + .85);
|
||||||
GL11.glVertex3d(x, y + 1, z + .85);
|
GL11.glVertex3d(x, y + 1, z + .85);
|
||||||
break;*/
|
break;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
|
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.S);
|
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.S);
|
||||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.T);
|
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.T);
|
||||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.R);
|
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.R);
|
||||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.Q);
|
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.Q);
|
||||||
GlStateManager.enableLighting();
|
GlStateManager.enableLighting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private FloatBuffer getFloatBuffer(float par1, float par2, float par3, float par4) {
|
||||||
|
buffer.clear();
|
||||||
|
buffer.put(par1).put(par2).put(par3).put(par4);
|
||||||
|
buffer.flip();
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderKeyHole(TileEntityDimDoor tile, double x, double y, double z, int i) {
|
||||||
|
EnumFacing rotation = EnumFacing.getHorizontal((tile.orientation.getHorizontalIndex() + 3) % 4);
|
||||||
|
|
||||||
private FloatBuffer getFloatBuffer(float par1, float par2, float par3, float par4) {
|
|
||||||
buffer.clear();
|
|
||||||
buffer.put(par1).put(par2).put(par3).put(par4);
|
|
||||||
buffer.flip();
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void renderKeyHole(TileEntityDimDoor tile, double x, double y, double z, int i) {
|
|
||||||
EnumFacing rotation = EnumFacing.getHorizontal((tile.orientation.getHorizontalIndex()+3)%4);
|
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate(x,y,z);
|
GlStateManager.translate(x, y, z);
|
||||||
|
|
||||||
x = ActiveRenderInfo.getPosition().xCoord;
|
x = ActiveRenderInfo.getPosition().xCoord;
|
||||||
y = ActiveRenderInfo.getPosition().yCoord;
|
y = ActiveRenderInfo.getPosition().yCoord;
|
||||||
z = ActiveRenderInfo.getPosition().zCoord;
|
z = ActiveRenderInfo.getPosition().zCoord;
|
||||||
|
|
||||||
GlStateManager.rotate(180.0F - 90*rotation.getHorizontalIndex(), 0.0F, 1.0F, 0.0F);
|
GlStateManager.rotate(180.0F - 90 * rotation.getHorizontalIndex(), 0.0F, 1.0F, 0.0F);
|
||||||
//GL11.glRotatef((float)(-90 * rotation), 0.0F, 0.0F, 1.0F);
|
//GL11.glRotatef((float)(-90 * rotation), 0.0F, 0.0F, 1.0F);
|
||||||
|
|
||||||
GlStateManager.translate(0.007F, .25F, 0F);
|
GlStateManager.translate(0.007F, .25F, 0F);
|
||||||
|
@ -213,7 +214,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor>
|
||||||
switch (rotation) {
|
switch (rotation) {
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
GL11.glTranslatef(-0.5F, 0, -0.03F);
|
GL11.glTranslatef(-0.5F, 0, -0.03F);
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
GL11.glTranslatef(-.5F, 0F, .97F);
|
GL11.glTranslatef(-.5F, 0F, .97F);
|
||||||
break;
|
break;
|
||||||
|
@ -224,53 +225,54 @@ public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor>
|
||||||
GL11.glTranslatef(0.5F, 0F, -0.03F);
|
GL11.glTranslatef(0.5F, 0F, -0.03F);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glDisable(GL_LIGHTING);
|
GL11.glDisable(GL_LIGHTING);
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
if (i == 1) {
|
||||||
|
bindTexture(KeyholeLight);
|
||||||
if(i==1) {
|
GlStateManager.color(1, 1, 1, .7f);
|
||||||
bindTexture(KeyholeLight);
|
GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_COLOR);
|
||||||
GlStateManager.color(1, 1, 1, .7f);
|
} else {
|
||||||
GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_COLOR);
|
bindTexture(keyPath);
|
||||||
} else {
|
GlStateManager.blendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
|
||||||
bindTexture(keyPath);
|
|
||||||
GlStateManager.blendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
|
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
|
||||||
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
|
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
|
||||||
GlStateManager.scale(0.00860625F, 0.00730625F, 0.0086625F);
|
GlStateManager.scale(0.00860625F, 0.00730625F, 0.0086625F);
|
||||||
GlStateManager.translate(-65.0F, -107.0F, -3.0F);
|
GlStateManager.translate(-65.0F, -107.0F, -3.0F);
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
VertexBuffer worldRenderer = tessellator.getBuffer();
|
VertexBuffer worldRenderer = tessellator.getBuffer();
|
||||||
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
|
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
|
||||||
byte b0 = 7;
|
byte b0 = 7;
|
||||||
|
|
||||||
worldRenderer.pos((double)(0 - b0), (double)(128 + b0), 0.0D).tex(0.0D, 1.0D).normal(0.0F, 0.0F, -1.0F).endVertex();
|
worldRenderer.pos((double) (0 - b0), (double) (128 + b0), 0.0D).tex(0.0D, 1.0D).normal(0.0F, 0.0F, -1.0F).endVertex();
|
||||||
worldRenderer.pos((double)(128 + b0), (double)(128 + b0), 0.0D).tex(1.0D, 1.0D).normal(0.0F, 0.0F, -1.0F).endVertex();
|
worldRenderer.pos((double) (128 + b0), (double) (128 + b0), 0.0D).tex(1.0D, 1.0D).normal(0.0F, 0.0F, -1.0F).endVertex();
|
||||||
worldRenderer.pos((double)(128 + b0), (double)(0 - b0), 0.0D).tex(1.0D, 0.0D).normal(0.0F, 0.0F, -1.0F).endVertex();
|
worldRenderer.pos((double) (128 + b0), (double) (0 - b0), 0.0D).tex(1.0D, 0.0D).normal(0.0F, 0.0F, -1.0F).endVertex();
|
||||||
worldRenderer.pos((double)(0 - b0), (double)(0 - b0), 0.0D).tex(0.0D, 0.0D).normal(0.0F, 0.0F, -1.0F).endVertex();
|
worldRenderer.pos((double) (0 - b0), (double) (0 - b0), 0.0D).tex(0.0D, 0.0D).normal(0.0F, 0.0F, -1.0F).endVertex();
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
|
|
||||||
GlStateManager.translate(0.0F, 0.0F, -1.0F);
|
GlStateManager.translate(0.0F, 0.0F, -1.0F);
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Override
|
public void renderTileEntityAt(TileEntityDimDoor te, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||||
public void renderTileEntityAt(TileEntityDimDoor te, double x, double y, double z, float partialTicks, int destroyStage) {
|
|
||||||
World world = te.getWorld();
|
World world = te.getWorld();
|
||||||
BlockPos pos = te.getPos();
|
BlockPos pos = te.getPos();
|
||||||
((BlockDimDoorBase)world.getBlockState(pos).getBlock()).updateAttachedTile(world, pos);
|
((BlockDimDoorBase) world.getBlockState(pos).getBlock()).updateAttachedTile(world, pos);
|
||||||
if (te.openOrClosed) {
|
if (te.openOrClosed) {
|
||||||
renderDimDoorTileEntity(te, x, y, z);
|
renderDimDoorTileEntity(te, x, y, z);
|
||||||
if(te.lockStatus >= 1)
|
if (te.lockStatus >= 1) {
|
||||||
for(int i = 0; i < 1+te.lockStatus; i++ ) this.renderKeyHole(te, x, y, z, i);
|
for (int i = 0; i < 1 + te.lockStatus; i++) {
|
||||||
|
this.renderKeyHole(te, x, y, z, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,10 @@ import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class RenderTransTrapdoor extends TileEntitySpecialRenderer<TileEntityTransTrapdoor> {
|
public class RenderTransTrapdoor extends TileEntitySpecialRenderer<TileEntityTransTrapdoor> {
|
||||||
|
|
||||||
private FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
|
private FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
|
||||||
private ResourceLocation riftPath= new ResourceLocation(DimDoors.MODID+":textures/other/RIFT.png");
|
private ResourceLocation riftPath = new ResourceLocation(DimDoors.MODID + ":textures/other/RIFT.png");
|
||||||
private ResourceLocation warpPath= new ResourceLocation(DimDoors.MODID+":textures/other/WARP.png");
|
private ResourceLocation warpPath = new ResourceLocation(DimDoors.MODID + ":textures/other/WARP.png");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the dimdoor.
|
* Renders the dimdoor.
|
||||||
|
@ -34,7 +35,7 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer<TileEntityTra
|
||||||
GlStateManager.disableLighting();
|
GlStateManager.disableLighting();
|
||||||
Random random = new Random(31100L);
|
Random random = new Random(31100L);
|
||||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||||
|
|
||||||
for (int count = 0; count < 16; ++count) {
|
for (int count = 0; count < 16; ++count) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
|
||||||
|
@ -58,16 +59,16 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer<TileEntityTra
|
||||||
var16 = .5F;
|
var16 = .5F;
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.translate(Minecraft.getSystemTime() % 200000L / 200000.0F,0, 0.0F);
|
GlStateManager.translate(Minecraft.getSystemTime() % 200000L / 200000.0F, 0, 0.0F);
|
||||||
GlStateManager.translate(0, Minecraft.getSystemTime() % 200000L / 200000.0F, 0.0F);
|
GlStateManager.translate(0, Minecraft.getSystemTime() % 200000L / 200000.0F, 0.0F);
|
||||||
|
|
||||||
GlStateManager.translate(0,0, Minecraft.getSystemTime() % 200000L / 200000.0F);
|
GlStateManager.translate(0, 0, Minecraft.getSystemTime() % 200000L / 200000.0F);
|
||||||
|
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_LINEAR);
|
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_LINEAR);
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_LINEAR);
|
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_LINEAR);
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_LINEAR);
|
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_LINEAR);
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_EYE_LINEAR);
|
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_EYE_LINEAR);
|
||||||
|
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||||
|
@ -83,12 +84,12 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer<TileEntityTra
|
||||||
GlStateManager.matrixMode(GL11.GL_TEXTURE);
|
GlStateManager.matrixMode(GL11.GL_TEXTURE);
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.loadIdentity();
|
GlStateManager.loadIdentity();
|
||||||
GlStateManager.translate(0.0F, Minecraft.getSystemTime() % 200000L / 200000.0F*var15, 0.0F);
|
GlStateManager.translate(0.0F, Minecraft.getSystemTime() % 200000L / 200000.0F * var15, 0.0F);
|
||||||
GlStateManager.scale(var16, var16, var16);
|
GlStateManager.scale(var16, var16, var16);
|
||||||
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
||||||
GlStateManager.rotate((count * count * 4321 + count * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
|
GlStateManager.rotate((count * count * 4321 + count * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||||
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
||||||
|
|
||||||
float r = (random.nextFloat() * 0.5F + 0.1F) * var17;
|
float r = (random.nextFloat() * 0.5F + 0.1F) * var17;
|
||||||
float g = (random.nextFloat() * 0.4F + 0.4F) * var17;
|
float g = (random.nextFloat() * 0.4F + 0.4F) * var17;
|
||||||
float b = (random.nextFloat() * 0.6F + 0.5F) * var17;
|
float b = (random.nextFloat() * 0.6F + 0.5F) * var17;
|
||||||
|
@ -103,29 +104,29 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer<TileEntityTra
|
||||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
|
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
|
||||||
|
|
||||||
if (BlockTransTrapdoor.isTrapdoorSetLow(state)) {
|
if (BlockTransTrapdoor.isTrapdoorSetLow(state)) {
|
||||||
if (state.getValue(BlockTrapDoor.OPEN)) {
|
if (state.getValue(BlockTrapDoor.OPEN)) {
|
||||||
worldrenderer.pos(x, y+0.2, z).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x, y + 0.2, z).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x, y+0.2, z+1).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x, y + 0.2, z + 1).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x+1, y+0.2, z+1).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x + 1, y + 0.2, z + 1).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x+1, y+0.2, z).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x + 1, y + 0.2, z).color(r, g, b, 1.0F).endVertex();
|
||||||
} else {
|
} else {
|
||||||
worldrenderer.pos(x, y+0.15, z).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x, y + 0.15, z).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x, y+0.15, z+1).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x, y + 0.15, z + 1).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x+1, y+0.15, z+1).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x + 1, y + 0.15, z + 1).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x+1, y+0.15, z).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x + 1, y + 0.15, z).color(r, g, b, 1.0F).endVertex();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (state.getValue(BlockTrapDoor.OPEN)) {
|
if (state.getValue(BlockTrapDoor.OPEN)) {
|
||||||
worldrenderer.pos(x, y+0.95, z).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x, y + 0.95, z).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x, y+0.95, z+1).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x, y + 0.95, z + 1).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x+1, y+0.95, z+1).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x + 1, y + 0.95, z + 1).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x+1, y+0.95, z).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x + 1, y + 0.95, z).color(r, g, b, 1.0F).endVertex();
|
||||||
} else {
|
} else {
|
||||||
worldrenderer.pos(x, y+0.85, z).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x, y + 0.85, z).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x, y+0.85, z+1).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x, y + 0.85, z + 1).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x+1, y+0.85, z+1).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x + 1, y + 0.85, z + 1).color(r, g, b, 1.0F).endVertex();
|
||||||
worldrenderer.pos(x+1, y+0.85, z).color(r, g, b, 1.0F).endVertex();
|
worldrenderer.pos(x + 1, y + 0.85, z).color(r, g, b, 1.0F).endVertex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
|
@ -150,6 +151,6 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer<TileEntityTra
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntityTransTrapdoor te, double x, double y, double z, float partialTicks, int destroyStage) {
|
public void renderTileEntityAt(TileEntityTransTrapdoor te, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||||
this.renderTransTrapdoorTileEntity(te, x, y, z, partialTicks);
|
this.renderTransTrapdoorTileEntity(te, x, y, z, partialTicks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,9 @@ import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ItemBlockDimWall extends ItemBlock {
|
public class ItemBlockDimWall extends ItemBlock {
|
||||||
private final static String[] subNames = {"", "Ancient" , "Altered"};
|
|
||||||
|
private final static String[] subNames = {"", "Ancient", "Altered"};
|
||||||
|
|
||||||
public ItemBlockDimWall() {
|
public ItemBlockDimWall() {
|
||||||
super(ModBlocks.blockDimWall);
|
super(ModBlocks.blockDimWall);
|
||||||
setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
||||||
|
@ -17,14 +18,13 @@ public class ItemBlockDimWall extends ItemBlock {
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
setRegistryName(BlockDimWall.ID);
|
setRegistryName(BlockDimWall.ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetadata (int damageValue)
|
public int getMetadata(int damageValue) {
|
||||||
{
|
return damageValue;
|
||||||
return damageValue;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnlocalizedName(ItemStack stack) {
|
public String getUnlocalizedName(ItemStack stack) {
|
||||||
return super.getUnlocalizedName() + subNames[this.getDamage(stack)];
|
return super.getUnlocalizedName() + subNames[this.getDamage(stack)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,19 +10,22 @@ import net.minecraft.item.ItemDoor;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ItemDimDoor extends ItemDoorBase {
|
public class ItemDimDoor extends ItemDoorBase {
|
||||||
public static final String ID = "itemDimDoor";
|
|
||||||
|
|
||||||
public ItemDimDoor() {
|
public static final String ID = "itemDimDoor";
|
||||||
super(ModBlocks.blockDimDoor, (ItemDoor)Items.IRON_DOOR);
|
|
||||||
|
public ItemDimDoor() {
|
||||||
|
super(ModBlocks.blockDimDoor, (ItemDoor) Items.IRON_DOOR);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||||
translateAndAdd("info.dimDoor", tooltip);
|
translateAndAdd("info.dimDoor", tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockDimDoorBase getDoorBlock() {return ModBlocks.blockDimDoor;}
|
protected BlockDimDoorBase getDoorBlock() {
|
||||||
}
|
return ModBlocks.blockDimDoor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -8,18 +8,22 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ItemDimDoorGold extends ItemDoorBase {
|
public class ItemDimDoorGold extends ItemDoorBase {
|
||||||
public static final String ID = "itemDimDoorGold";
|
|
||||||
|
|
||||||
public ItemDimDoorGold() {
|
public static final String ID = "itemDimDoorGold";
|
||||||
super(ModBlocks.blockDimDoorGold, ModItems.itemDoorGold);
|
|
||||||
|
public ItemDimDoorGold() {
|
||||||
|
super(ModBlocks.blockDimDoorGold, ModItems.itemDoorGold);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
|
||||||
translateAndAdd("info.goldDimDoor", tooltip);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockDimDoorBase getDoorBlock() {return ModBlocks.blockDimDoorGold;}
|
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||||
|
translateAndAdd("info.goldDimDoor", tooltip);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockDimDoorBase getDoorBlock() {
|
||||||
|
return ModBlocks.blockDimDoorGold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,19 +8,22 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ItemDimDoorPersonal extends ItemDoorBase {
|
public class ItemDimDoorPersonal extends ItemDoorBase {
|
||||||
public static final String ID = "itemDimDoorQuartz";
|
|
||||||
|
|
||||||
public ItemDimDoorPersonal() {
|
public static final String ID = "itemDimDoorQuartz";
|
||||||
super(ModBlocks.blockDimDoorPersonal, ModItems.itemDoorQuartz);
|
|
||||||
|
public ItemDimDoorPersonal() {
|
||||||
|
super(ModBlocks.blockDimDoorPersonal, ModItems.itemDoorQuartz);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||||
translateAndAdd("info.personalDimDoor", tooltip);
|
translateAndAdd("info.personalDimDoor", tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockDimDoorBase getDoorBlock() {return ModBlocks.blockDimDoorPersonal;}
|
protected BlockDimDoorBase getDoorBlock() {
|
||||||
}
|
return ModBlocks.blockDimDoorPersonal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ItemDimDoorUnstable extends ItemDoorBase {
|
public class ItemDimDoorUnstable extends ItemDoorBase {
|
||||||
|
|
||||||
public static final String ID = "itemDimDoorChaos";
|
public static final String ID = "itemDimDoorChaos";
|
||||||
|
|
||||||
public ItemDimDoorUnstable() {
|
public ItemDimDoorUnstable() {
|
||||||
|
@ -16,11 +17,13 @@ public class ItemDimDoorUnstable extends ItemDoorBase {
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
|
||||||
//tooltip.add(StatCollector.translateToLocal("info.chaosDoor"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockDimDoorBase getDoorBlock() {return ModBlocks.blockDimDoorChaos;}
|
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||||
}
|
//tooltip.add(StatCollector.translateToLocal("info.chaosDoor"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockDimDoorBase getDoorBlock() {
|
||||||
|
return ModBlocks.blockDimDoorChaos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -11,19 +11,22 @@ import net.minecraft.item.ItemDoor;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ItemDimDoorWarp extends ItemDoorBase {
|
public class ItemDimDoorWarp extends ItemDoorBase {
|
||||||
public static final String ID = "itemDimDoorWarp";
|
|
||||||
|
|
||||||
public ItemDimDoorWarp() {
|
public static final String ID = "itemDimDoorWarp";
|
||||||
super(ModBlocks.blockDimDoorWarp, (ItemDoor)Items.OAK_DOOR );
|
|
||||||
|
public ItemDimDoorWarp() {
|
||||||
|
super(ModBlocks.blockDimDoorWarp, (ItemDoor) Items.OAK_DOOR);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||||
translateAndAdd("info.warpDoor",tooltip);
|
translateAndAdd("info.warpDoor", tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockDimDoorBase getDoorBlock() {return ModBlocks.blockDimDoorWarp;}
|
protected BlockDimDoorBase getDoorBlock() {
|
||||||
}
|
return ModBlocks.blockDimDoorWarp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -22,168 +22,190 @@ import net.minecraft.world.World;
|
||||||
import com.zixiken.dimdoors.tileentities.TileEntityDimDoor;
|
import com.zixiken.dimdoors.tileentities.TileEntityDimDoor;
|
||||||
|
|
||||||
public abstract class ItemDoorBase extends ItemDoor {
|
public abstract class ItemDoorBase extends ItemDoor {
|
||||||
// Maps non-dimensional door items to their corresponding dimensional door item
|
// Maps non-dimensional door items to their corresponding dimensional door item
|
||||||
// Also maps dimensional door items to themselves for simplicity
|
// Also maps dimensional door items to themselves for simplicity
|
||||||
private static HashMap<ItemDoor, ItemDoorBase> doorItemMapping = new HashMap<ItemDoor, ItemDoorBase>();
|
|
||||||
|
|
||||||
/**
|
private static HashMap<ItemDoor, ItemDoorBase> doorItemMapping = new HashMap<ItemDoor, ItemDoorBase>();
|
||||||
* door represents the non-dimensional door this item is associated with. Leave null for none.
|
|
||||||
* @param vanillaDoor
|
|
||||||
*/
|
|
||||||
public ItemDoorBase(Block block, ItemDoor vanillaDoor) {
|
|
||||||
super(block);
|
|
||||||
this.setMaxStackSize(64);
|
|
||||||
this.setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
|
||||||
|
|
||||||
doorItemMapping.put(this, this);
|
|
||||||
if (vanillaDoor != null)
|
|
||||||
doorItemMapping.put(vanillaDoor, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public abstract void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overriden in subclasses to specify which door block that door item will
|
|
||||||
* place
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract BlockDimDoorBase getDoorBlock();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overriden here to remove vanilla block placement functionality from
|
* door represents the non-dimensional door this item is associated with.
|
||||||
* dimensional doors, we handle this in the EventHookContainer
|
* Leave null for none.
|
||||||
*/
|
*
|
||||||
@Override
|
* @param vanillaDoor
|
||||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {return EnumActionResult.FAIL;}
|
*/
|
||||||
|
public ItemDoorBase(Block block, ItemDoor vanillaDoor) {
|
||||||
|
super(block);
|
||||||
|
this.setMaxStackSize(64);
|
||||||
|
this.setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
||||||
|
|
||||||
/**
|
doorItemMapping.put(this, this);
|
||||||
* Tries to place a door as a dimensional door
|
if (vanillaDoor != null) {
|
||||||
*
|
doorItemMapping.put(vanillaDoor, this);
|
||||||
* @param stack
|
}
|
||||||
* @param player
|
}
|
||||||
* @param world
|
|
||||||
* @param side
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean tryToPlaceDoor(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side) {
|
|
||||||
if (world.isRemote) return false;
|
|
||||||
|
|
||||||
// Retrieve the actual door type that we want to use here.
|
@Override
|
||||||
// It's okay if stack isn't an ItemDoor. In that case, the lookup will
|
public abstract void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced);
|
||||||
// return null, just as if the item was an unrecognized door type.
|
|
||||||
ItemDoorBase mappedItem = doorItemMapping.get(stack.getItem());
|
|
||||||
if (mappedItem == null) return false;
|
|
||||||
BlockDimDoorBase doorBlock = mappedItem.getDoorBlock();
|
|
||||||
return ItemDoorBase.placeDoorOnBlock(doorBlock, stack, player, world, pos, side) ||
|
|
||||||
ItemDoorBase.placeDoorOnRift(doorBlock, world, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* try to place a door block on a block
|
* Overriden in subclasses to specify which door block that door item will
|
||||||
* @param doorBlock
|
* place
|
||||||
* @param stack
|
*
|
||||||
* @param player
|
* @return
|
||||||
* @param world
|
*/
|
||||||
* @param pos
|
protected abstract BlockDimDoorBase getDoorBlock();
|
||||||
* @param side
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean placeDoorOnBlock(Block doorBlock, ItemStack stack, EntityPlayer player,
|
|
||||||
World world, BlockPos pos, EnumFacing side) {
|
|
||||||
if (world.isRemote) return false;
|
|
||||||
|
|
||||||
// Only place doors on top of blocks - check if we're targeting the top
|
/**
|
||||||
// side
|
* Overriden here to remove vanilla block placement functionality from
|
||||||
if (side == EnumFacing.UP) {
|
* dimensional doors, we handle this in the EventHookContainer
|
||||||
Block block = world.getBlockState(pos).getBlock();
|
*/
|
||||||
if (!world.getBlockState(pos).equals(Blocks.AIR) && !block.isReplaceable(world, pos)) pos = pos.up();
|
@Override
|
||||||
|
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
|
return EnumActionResult.FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to place a door as a dimensional door
|
||||||
|
*
|
||||||
|
* @param stack
|
||||||
|
* @param player
|
||||||
|
* @param world
|
||||||
|
* @param side
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean tryToPlaceDoor(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side) {
|
||||||
|
if (world.isRemote) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve the actual door type that we want to use here.
|
||||||
|
// It's okay if stack isn't an ItemDoor. In that case, the lookup will
|
||||||
|
// return null, just as if the item was an unrecognized door type.
|
||||||
|
ItemDoorBase mappedItem = doorItemMapping.get(stack.getItem());
|
||||||
|
if (mappedItem == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
BlockDimDoorBase doorBlock = mappedItem.getDoorBlock();
|
||||||
|
return ItemDoorBase.placeDoorOnBlock(doorBlock, stack, player, world, pos, side)
|
||||||
|
|| ItemDoorBase.placeDoorOnRift(doorBlock, world, player, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* try to place a door block on a block
|
||||||
|
*
|
||||||
|
* @param doorBlock
|
||||||
|
* @param stack
|
||||||
|
* @param player
|
||||||
|
* @param world
|
||||||
|
* @param pos
|
||||||
|
* @param side
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean placeDoorOnBlock(Block doorBlock, ItemStack stack, EntityPlayer player,
|
||||||
|
World world, BlockPos pos, EnumFacing side) {
|
||||||
|
if (world.isRemote) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only place doors on top of blocks - check if we're targeting the top
|
||||||
|
// side
|
||||||
|
if (side == EnumFacing.UP) {
|
||||||
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
|
if (!world.getBlockState(pos).equals(Blocks.AIR) && !block.isReplaceable(world, pos)) {
|
||||||
|
pos = pos.up();
|
||||||
|
}
|
||||||
|
|
||||||
BlockPos upPos = pos.up();
|
BlockPos upPos = pos.up();
|
||||||
if (canPlace(world, pos) && canPlace(world, upPos) && player.canPlayerEdit(pos, side, stack)
|
if (canPlace(world, pos) && canPlace(world, upPos) && player.canPlayerEdit(pos, side, stack)
|
||||||
&& player.canPlayerEdit(upPos, side, stack) && stack.stackSize > 0
|
&& player.canPlayerEdit(upPos, side, stack) && stack.stackSize > 0
|
||||||
&& stack.getItem() instanceof ItemDoorBase) {
|
&& stack.getItem() instanceof ItemDoorBase) {
|
||||||
placeDoor(world, pos, EnumFacing.fromAngle(player.rotationYaw), doorBlock, true);
|
placeDoor(world, pos, EnumFacing.fromAngle(player.rotationYaw), doorBlock, true);
|
||||||
if (!player.capabilities.isCreativeMode) stack.stackSize--;
|
if (!player.capabilities.isCreativeMode) {
|
||||||
return true;
|
stack.stackSize--;
|
||||||
}
|
}
|
||||||
}
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* uses a raytrace to try and place a door on a rift
|
* uses a raytrace to try and place a door on a rift
|
||||||
*
|
*
|
||||||
* @param doorBlock
|
* @param doorBlock
|
||||||
* @param world
|
* @param world
|
||||||
* @param player
|
* @param player
|
||||||
* @param stack
|
* @param stack
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean placeDoorOnRift(Block doorBlock, World world, EntityPlayer player, ItemStack stack) {
|
public static boolean placeDoorOnRift(Block doorBlock, World world, EntityPlayer player, ItemStack stack) {
|
||||||
if (world.isRemote) return false;
|
if (world.isRemote) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
RayTraceResult hit = ItemDoorBase.doRayTrace(world, player, true);
|
RayTraceResult hit = ItemDoorBase.doRayTrace(world, player, true);
|
||||||
if (hit != null) {
|
if (hit != null) {
|
||||||
BlockPos pos = hit.getBlockPos();
|
BlockPos pos = hit.getBlockPos();
|
||||||
if (world.getBlockState(pos).getBlock() == ModBlocks.blockRift) {
|
if (world.getBlockState(pos).getBlock() == ModBlocks.blockRift) {
|
||||||
BlockPos downPos = pos.down();
|
BlockPos downPos = pos.down();
|
||||||
if (player.canPlayerEdit(pos, hit.sideHit, stack) &&
|
if (player.canPlayerEdit(pos, hit.sideHit, stack)
|
||||||
player.canPlayerEdit(downPos, hit.sideHit, stack) &&
|
&& player.canPlayerEdit(downPos, hit.sideHit, stack)
|
||||||
canPlace(world, pos) && canPlace(world, downPos)) {
|
&& canPlace(world, pos) && canPlace(world, downPos)) {
|
||||||
placeDoor(world, downPos, EnumFacing.fromAngle(player.rotationYaw), doorBlock, true);
|
placeDoor(world, downPos, EnumFacing.fromAngle(player.rotationYaw), doorBlock, true);
|
||||||
if (!(stack.getItem() instanceof ItemDoorBase))
|
if (!(stack.getItem() instanceof ItemDoorBase)) {
|
||||||
((TileEntityDimDoor) world.getTileEntity(pos)).hasGennedPair = true;
|
((TileEntityDimDoor) world.getTileEntity(pos)).hasGennedPair = true;
|
||||||
if (!player.capabilities.isCreativeMode) stack.stackSize--;
|
}
|
||||||
|
if (!player.capabilities.isCreativeMode) {
|
||||||
|
stack.stackSize--;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canPlace(World world, BlockPos pos) {
|
public static boolean canPlace(World world, BlockPos pos) {
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
|
|
||||||
return (state.getBlock() == ModBlocks.blockRift || state.equals(Blocks.AIR) || state.getMaterial().isReplaceable());
|
return (state.getBlock() == ModBlocks.blockRift || state.equals(Blocks.AIR) || state.getMaterial().isReplaceable());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copied from minecraft Item.class
|
* Copied from minecraft Item.class TODO we probably can improve this
|
||||||
* TODO we probably can improve this
|
*
|
||||||
*
|
* @param world
|
||||||
* @param world
|
* @param player
|
||||||
* @param player
|
* @param useLiquids
|
||||||
* @param useLiquids
|
* @return
|
||||||
* @return
|
*/
|
||||||
*/
|
|
||||||
protected static RayTraceResult doRayTrace(World world, EntityPlayer player, boolean useLiquids) {
|
protected static RayTraceResult doRayTrace(World world, EntityPlayer player, boolean useLiquids) {
|
||||||
float f = player.rotationPitch;
|
float f = player.rotationPitch;
|
||||||
float f1 = player.rotationYaw;
|
float f1 = player.rotationYaw;
|
||||||
double d0 = player.posX;
|
double d0 = player.posX;
|
||||||
double d1 = player.posY + (double)player.getEyeHeight();
|
double d1 = player.posY + (double) player.getEyeHeight();
|
||||||
double d2 = player.posZ;
|
double d2 = player.posZ;
|
||||||
Vec3d vec3 = new Vec3d(d0, d1, d2);
|
Vec3d vec3 = new Vec3d(d0, d1, d2);
|
||||||
float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI);
|
float f2 = MathHelper.cos(-f1 * 0.017453292F - (float) Math.PI);
|
||||||
float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI);
|
float f3 = MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI);
|
||||||
float f4 = -MathHelper.cos(-f * 0.017453292F);
|
float f4 = -MathHelper.cos(-f * 0.017453292F);
|
||||||
float f5 = MathHelper.sin(-f * 0.017453292F);
|
float f5 = MathHelper.sin(-f * 0.017453292F);
|
||||||
float f6 = f3 * f4;
|
float f6 = f3 * f4;
|
||||||
float f7 = f2 * f4;
|
float f7 = f2 * f4;
|
||||||
double d3 = 5.0D;
|
double d3 = 5.0D;
|
||||||
if (player instanceof EntityPlayerMP)
|
if (player instanceof EntityPlayerMP) {
|
||||||
d3 = ((EntityPlayerMP)player).interactionManager.getBlockReachDistance();
|
d3 = ((EntityPlayerMP) player).interactionManager.getBlockReachDistance();
|
||||||
Vec3d vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
|
}
|
||||||
|
Vec3d vec31 = vec3.addVector((double) f6 * d3, (double) f5 * d3, (double) f7 * d3);
|
||||||
return world.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
|
return world.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void translateAndAdd(String key, List<String> list) {
|
public void translateAndAdd(String key, List<String> list) {
|
||||||
for(int i=0;i<10;i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
/*if(StatCollector.canTranslate(key+Integer.toString(i))) {
|
/*if(StatCollector.canTranslate(key+Integer.toString(i))) {
|
||||||
String line = StatCollector.translateToLocal(key + Integer.toString(i));
|
String line = StatCollector.translateToLocal(key + Integer.toString(i));
|
||||||
list.add(line);
|
list.add(line);
|
||||||
} else */ break;
|
} else */ break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,13 @@ import com.zixiken.dimdoors.blocks.ModBlocks;
|
||||||
import net.minecraft.item.ItemDoor;
|
import net.minecraft.item.ItemDoor;
|
||||||
|
|
||||||
public class ItemDoorGold extends ItemDoor {
|
public class ItemDoorGold extends ItemDoor {
|
||||||
public static final String ID = "itemDoorGold";
|
|
||||||
|
|
||||||
public ItemDoorGold() {
|
public static final String ID = "itemDoorGold";
|
||||||
super(ModBlocks.blockDoorGold);
|
|
||||||
setMaxStackSize(16);
|
public ItemDoorGold() {
|
||||||
|
super(ModBlocks.blockDoorGold);
|
||||||
|
setMaxStackSize(16);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,12 @@ import com.zixiken.dimdoors.blocks.ModBlocks;
|
||||||
import net.minecraft.item.ItemDoor;
|
import net.minecraft.item.ItemDoor;
|
||||||
|
|
||||||
public class ItemDoorQuartz extends ItemDoor {
|
public class ItemDoorQuartz extends ItemDoor {
|
||||||
|
|
||||||
public static final String ID = "itemDoorQuartz";
|
public static final String ID = "itemDoorQuartz";
|
||||||
|
|
||||||
public ItemDoorQuartz() {
|
public ItemDoorQuartz() {
|
||||||
super(ModBlocks.blockDoorQuartz);
|
super(ModBlocks.blockDoorQuartz);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,13 @@ import com.zixiken.dimdoors.DimDoors;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
public class ItemStableFabric extends Item {
|
public class ItemStableFabric extends Item {
|
||||||
public static final String ID = "itemStableFabric";
|
|
||||||
|
|
||||||
public ItemStableFabric() {
|
public static final String ID = "itemStableFabric";
|
||||||
super();
|
|
||||||
|
public ItemStableFabric() {
|
||||||
|
super();
|
||||||
setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,13 @@ import com.zixiken.dimdoors.DimDoors;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
public class ItemWorldThread extends Item {
|
public class ItemWorldThread extends Item {
|
||||||
public static final String ID = "itemWorldThread";
|
|
||||||
|
|
||||||
public ItemWorldThread() {
|
public static final String ID = "itemWorldThread";
|
||||||
super();
|
|
||||||
|
public ItemWorldThread() {
|
||||||
|
super();
|
||||||
setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
setCreativeTab(DimDoors.dimDoorsCreativeTab);
|
||||||
setUnlocalizedName(ID);
|
setUnlocalizedName(ID);
|
||||||
setRegistryName(ID);
|
setRegistryName(ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import com.zixiken.dimdoors.blocks.ModBlocks;
|
import com.zixiken.dimdoors.blocks.ModBlocks;
|
||||||
|
|
||||||
public class ModItems {
|
public class ModItems {
|
||||||
|
|
||||||
public static ItemDimDoorGold itemDimDoorGold;
|
public static ItemDimDoorGold itemDimDoorGold;
|
||||||
public static ItemDoorGold itemDoorGold;
|
public static ItemDoorGold itemDoorGold;
|
||||||
public static ItemWorldThread itemWorldThread;
|
public static ItemWorldThread itemWorldThread;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraftforge.common.DimensionManager;
|
||||||
*
|
*
|
||||||
* @author Robijnvogel
|
* @author Robijnvogel
|
||||||
*/
|
*/
|
||||||
public class DDProxyServer extends DDProxyCommon{
|
public class DDProxyServer extends DDProxyCommon {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isClient() {
|
public boolean isClient() {
|
||||||
|
@ -30,5 +30,5 @@ public class DDProxyServer extends DDProxyCommon{
|
||||||
public World getDefWorld() {
|
public World getDefWorld() {
|
||||||
return DimensionManager.getWorld(0); //gets the server world dim 0 handler
|
return DimensionManager.getWorld(0); //gets the server world dim 0 handler
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,20 +35,19 @@ class Pocket {
|
||||||
pocket.size = pocketNBT.getInteger("size");
|
pocket.size = pocketNBT.getInteger("size");
|
||||||
pocket.depth = pocketNBT.getInteger("depth");
|
pocket.depth = pocketNBT.getInteger("depth");
|
||||||
pocket.typeID = pocketNBT.getInteger("typeID");
|
pocket.typeID = pocketNBT.getInteger("typeID");
|
||||||
|
|
||||||
//@todo pocket.coords = pocketNBT.get;
|
//@todo pocket.coords = pocketNBT.get;
|
||||||
NBTTagCompound playersNBT = pocketNBT.getCompoundTag("players");
|
NBTTagCompound playersNBT = pocketNBT.getCompoundTag("players");
|
||||||
NBTTagCompound doorsNBT = pocketNBT.getCompoundTag("doors");
|
NBTTagCompound doorsNBT = pocketNBT.getCompoundTag("doors");
|
||||||
//@todo iterate through above two compound tags
|
//@todo iterate through above two compound tags
|
||||||
|
|
||||||
return pocket;
|
return pocket;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NBTBase writeToNBT(Pocket pocket) {
|
static NBTBase writeToNBT(Pocket pocket) {
|
||||||
NBTTagCompound pocketNBT = new NBTTagCompound();
|
NBTTagCompound pocketNBT = new NBTTagCompound();
|
||||||
|
|
||||||
//@todo implement shit;
|
//@todo implement shit;
|
||||||
|
|
||||||
return pocketNBT;
|
return pocketNBT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.world.World;
|
||||||
* @author Robijnvogel
|
* @author Robijnvogel
|
||||||
*/
|
*/
|
||||||
public class PocketRegistry {
|
public class PocketRegistry {
|
||||||
|
|
||||||
public static final PocketRegistry Instance = new PocketRegistry();
|
public static final PocketRegistry Instance = new PocketRegistry();
|
||||||
|
|
||||||
// Privates
|
// Privates
|
||||||
|
@ -43,7 +43,7 @@ public class PocketRegistry {
|
||||||
NBTTagCompound pocketNBT = pocketsNBT.getCompoundTag(tag);
|
NBTTagCompound pocketNBT = pocketsNBT.getCompoundTag(tag);
|
||||||
Pocket pocket = Pocket.readFromNBT(i, pocketNBT);
|
Pocket pocket = Pocket.readFromNBT(i, pocketNBT);
|
||||||
pocketList.put(i, pocket);
|
pocketList.put(i, pocket);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
tag = "" + i;
|
tag = "" + i;
|
||||||
}
|
}
|
||||||
|
@ -60,11 +60,11 @@ public class PocketRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int registerNewPocket(Pocket pocket, World world) {
|
public int registerNewPocket(Pocket pocket, World world) {
|
||||||
pocketList.put(nextUnusedID, pocket);
|
pocketList.put(nextUnusedID, pocket);
|
||||||
|
|
||||||
nextUnusedID++;
|
nextUnusedID++;
|
||||||
PocketSavedData.get(world).markDirty(); //Notify that this needs to be saved on world save
|
PocketSavedData.get(world).markDirty(); //Notify that this needs to be saved on world save
|
||||||
return nextUnusedID -1;
|
return nextUnusedID - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePocket(int pocketID, World world) {
|
public void removePocket(int pocketID, World world) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.world.World;
|
||||||
* @author Robijnvogel
|
* @author Robijnvogel
|
||||||
*/
|
*/
|
||||||
public class RiftRegistry {
|
public class RiftRegistry {
|
||||||
|
|
||||||
public static final RiftRegistry Instance = new RiftRegistry();
|
public static final RiftRegistry Instance = new RiftRegistry();
|
||||||
|
|
||||||
// Privates
|
// Privates
|
||||||
|
@ -46,7 +46,7 @@ public class RiftRegistry {
|
||||||
NBTTagCompound riftNBT = riftsNBT.getCompoundTag(tag);
|
NBTTagCompound riftNBT = riftsNBT.getCompoundTag(tag);
|
||||||
Location riftLocation = Location.readFromNBT(riftNBT);
|
Location riftLocation = Location.readFromNBT(riftNBT);
|
||||||
riftList.put(i, riftLocation);
|
riftList.put(i, riftLocation);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
tag = "" + i;
|
tag = "" + i;
|
||||||
}
|
}
|
||||||
|
@ -64,10 +64,10 @@ public class RiftRegistry {
|
||||||
|
|
||||||
public int registerNewRift(DDTileEntityBase rift) {
|
public int registerNewRift(DDTileEntityBase rift) {
|
||||||
riftList.put(nextRiftID, Location.getLocation(rift));
|
riftList.put(nextRiftID, Location.getLocation(rift));
|
||||||
|
|
||||||
nextRiftID++;
|
nextRiftID++;
|
||||||
RiftSavedData.get(DimDoors.getDefWorld()).markDirty(); //Notify that this needs to be saved on world save
|
RiftSavedData.get(DimDoors.getDefWorld()).markDirty(); //Notify that this needs to be saved on world save
|
||||||
return nextRiftID -1;
|
return nextRiftID - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeRift(int riftID, World world) {
|
public void removeRift(int riftID, World world) {
|
||||||
|
@ -80,7 +80,7 @@ public class RiftRegistry {
|
||||||
public Location getRiftLocation(int ID) {
|
public Location getRiftLocation(int ID) {
|
||||||
return riftList.get(ID);
|
return riftList.get(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pair(int riftID, int riftID2) {
|
public void pair(int riftID, int riftID2) {
|
||||||
Location location = riftList.get(riftID);
|
Location location = riftList.get(riftID);
|
||||||
TileEntity tileEntity = location.getTileEntity(); //@todo this method might need to be in another class?
|
TileEntity tileEntity = location.getTileEntity(); //@todo this method might need to be in another class?
|
||||||
|
@ -89,7 +89,7 @@ public class RiftRegistry {
|
||||||
rift.pair(riftID2);
|
rift.pair(riftID2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unpair(int riftID) {
|
public void unpair(int riftID) {
|
||||||
Location location = riftList.get(riftID);
|
Location location = riftList.get(riftID);
|
||||||
TileEntity tileEntity = location.getTileEntity();
|
TileEntity tileEntity = location.getTileEntity();
|
||||||
|
|
|
@ -8,76 +8,75 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class DDTileEntityBase extends TileEntity
|
public abstract class DDTileEntityBase extends TileEntity {
|
||||||
{
|
|
||||||
public boolean isPaired = false;
|
public boolean isPaired = false;
|
||||||
public int riftID;
|
public int riftID;
|
||||||
public int pairedRiftID;
|
public int pairedRiftID;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return an array of floats representing RGBA color where 1.0 = 255.
|
|
||||||
*/
|
|
||||||
public abstract float[] getRenderColor(Random rand);
|
|
||||||
|
|
||||||
DDTileEntityBase(World world) { //@todo what is the difference between a TileEntity instance being created on Block placement and on world-load?
|
|
||||||
super();
|
|
||||||
this.setWorld(world);
|
|
||||||
register();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) {
|
*
|
||||||
return oldState.getBlock() != newSate.getBlock();
|
* @return an array of floats representing RGBA color where 1.0 = 255.
|
||||||
}
|
*/
|
||||||
|
public abstract float[] getRenderColor(Random rand);
|
||||||
public void pair(int otherRiftID) {
|
|
||||||
if (isPaired) {
|
DDTileEntityBase(World world) { //@todo what is the difference between a TileEntity instance being created on Block placement and on world-load?
|
||||||
if (otherRiftID == pairedRiftID) {
|
super();
|
||||||
return;
|
this.setWorld(world);
|
||||||
}
|
register();
|
||||||
else {
|
}
|
||||||
RiftRegistry.Instance.unpair(pairedRiftID);
|
|
||||||
}
|
@Override
|
||||||
}
|
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) {
|
||||||
pairedRiftID = otherRiftID;
|
return oldState.getBlock() != newSate.getBlock();
|
||||||
RiftRegistry.Instance.pair(pairedRiftID, riftID);
|
}
|
||||||
isPaired = true;
|
|
||||||
this.markDirty();
|
public void pair(int otherRiftID) {
|
||||||
}
|
if (isPaired) {
|
||||||
|
if (otherRiftID == pairedRiftID) {
|
||||||
public void unpair() {
|
|
||||||
if (!isPaired) {
|
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
isPaired = false;
|
|
||||||
RiftRegistry.Instance.unpair(pairedRiftID);
|
RiftRegistry.Instance.unpair(pairedRiftID);
|
||||||
}
|
}
|
||||||
this.markDirty();
|
|
||||||
}
|
}
|
||||||
|
pairedRiftID = otherRiftID;
|
||||||
private void register() {
|
RiftRegistry.Instance.pair(pairedRiftID, riftID);
|
||||||
riftID = RiftRegistry.Instance.registerNewRift(this);
|
isPaired = true;
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unpair() {
|
||||||
|
if (!isPaired) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
isPaired = false;
|
||||||
|
RiftRegistry.Instance.unpair(pairedRiftID);
|
||||||
}
|
}
|
||||||
|
this.markDirty();
|
||||||
@Override
|
}
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
|
||||||
super.readFromNBT(nbt);
|
private void register() {
|
||||||
try {
|
riftID = RiftRegistry.Instance.registerNewRift(this);
|
||||||
this.isPaired = nbt.getBoolean("isPaired");
|
this.markDirty();
|
||||||
this.riftID = nbt.getInteger("riftID");
|
}
|
||||||
this.pairedRiftID = nbt.getInteger("pairedRiftID");
|
|
||||||
} catch (Exception e) {}
|
@Override
|
||||||
}
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
|
super.readFromNBT(nbt);
|
||||||
@Override
|
try {
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
this.isPaired = nbt.getBoolean("isPaired");
|
||||||
super.writeToNBT(nbt);
|
this.riftID = nbt.getInteger("riftID");
|
||||||
nbt.setBoolean("isPaired", this.isPaired);
|
this.pairedRiftID = nbt.getInteger("pairedRiftID");
|
||||||
nbt.setInteger("riftID", this.riftID);
|
} catch (Exception e) {
|
||||||
nbt.setInteger("pairedRiftID", this.pairedRiftID);
|
}
|
||||||
return nbt;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||||
|
super.writeToNBT(nbt);
|
||||||
|
nbt.setBoolean("isPaired", this.isPaired);
|
||||||
|
nbt.setInteger("riftID", this.riftID);
|
||||||
|
nbt.setInteger("pairedRiftID", this.pairedRiftID);
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,58 +6,58 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class TileEntityDimDoor extends DDTileEntityBase {
|
||||||
|
|
||||||
public class TileEntityDimDoor extends DDTileEntityBase
|
public boolean openOrClosed;
|
||||||
{
|
public EnumFacing orientation;
|
||||||
public boolean openOrClosed;
|
public boolean hasExit;
|
||||||
public EnumFacing orientation;
|
public byte lockStatus;
|
||||||
public boolean hasExit;
|
public boolean isDungeonChainLink;
|
||||||
public byte lockStatus;
|
public boolean hasGennedPair = false;
|
||||||
public boolean isDungeonChainLink;
|
|
||||||
public boolean hasGennedPair=false;
|
|
||||||
|
|
||||||
public TileEntityDimDoor(World world) {
|
public TileEntityDimDoor(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.openOrClosed = nbt.getBoolean("openOrClosed");
|
this.openOrClosed = nbt.getBoolean("openOrClosed");
|
||||||
this.orientation = EnumFacing.getFront(nbt.getInteger("orientation"));
|
this.orientation = EnumFacing.getFront(nbt.getInteger("orientation"));
|
||||||
this.hasExit = nbt.getBoolean("hasExit");
|
this.hasExit = nbt.getBoolean("hasExit");
|
||||||
this.isDungeonChainLink = nbt.getBoolean("isDungeonChainLink");
|
this.isDungeonChainLink = nbt.getBoolean("isDungeonChainLink");
|
||||||
this.hasGennedPair = nbt.getBoolean("hasGennedPair");
|
this.hasGennedPair = nbt.getBoolean("hasGennedPair");
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||||
super.writeToNBT(nbt);
|
super.writeToNBT(nbt);
|
||||||
|
|
||||||
nbt.setBoolean("openOrClosed", this.openOrClosed);
|
nbt.setBoolean("openOrClosed", this.openOrClosed);
|
||||||
nbt.setBoolean("hasExit", this.hasExit);
|
nbt.setBoolean("hasExit", this.hasExit);
|
||||||
nbt.setInteger("orientation", this.orientation.getIndex());
|
nbt.setInteger("orientation", this.orientation.getIndex());
|
||||||
nbt.setBoolean("isDungeonChainLink", isDungeonChainLink);
|
nbt.setBoolean("isDungeonChainLink", isDungeonChainLink);
|
||||||
nbt.setBoolean("hasGennedPair", hasGennedPair);
|
nbt.setBoolean("hasGennedPair", hasGennedPair);
|
||||||
return nbt;
|
return nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float[] getRenderColor(Random rand) {
|
public float[] getRenderColor(Random rand) {
|
||||||
float[] rgbaColor = {1,1,1,1};
|
float[] rgbaColor = {1, 1, 1, 1};
|
||||||
if (this.world.provider.getDimension() == -1) {
|
if (this.world.provider.getDimension() == -1) {
|
||||||
rgbaColor[0] = rand.nextFloat() * 0.5F + 0.4F;
|
rgbaColor[0] = rand.nextFloat() * 0.5F + 0.4F;
|
||||||
rgbaColor[1] = rand.nextFloat() * 0.05F;
|
rgbaColor[1] = rand.nextFloat() * 0.05F;
|
||||||
rgbaColor[2] = rand.nextFloat() * 0.05F;
|
rgbaColor[2] = rand.nextFloat() * 0.05F;
|
||||||
} else {
|
} else {
|
||||||
rgbaColor[0] = rand.nextFloat() * 0.5F + 0.1F;
|
rgbaColor[0] = rand.nextFloat() * 0.5F + 0.1F;
|
||||||
rgbaColor[1] = rand.nextFloat() * 0.4F + 0.4F;
|
rgbaColor[1] = rand.nextFloat() * 0.4F + 0.4F;
|
||||||
rgbaColor[2] = rand.nextFloat() * 0.6F + 0.5F;
|
rgbaColor[2] = rand.nextFloat() * 0.6F + 0.5F;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rgbaColor;
|
return rgbaColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,24 +6,25 @@ import net.minecraftforge.common.ForgeChunkManager;
|
||||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||||
|
|
||||||
public class TileEntityDimDoorGold extends TileEntityDimDoor implements IChunkLoader {
|
public class TileEntityDimDoorGold extends TileEntityDimDoor implements IChunkLoader {
|
||||||
private Ticket chunkTicket;
|
|
||||||
private boolean initialized = false;
|
private Ticket chunkTicket;
|
||||||
|
private boolean initialized = false;
|
||||||
|
|
||||||
public TileEntityDimDoorGold(World world) {
|
public TileEntityDimDoorGold(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInitialized() {
|
|
||||||
return initialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(Ticket ticket) {
|
public boolean isInitialized() {
|
||||||
initialized = true;
|
return initialized;
|
||||||
chunkTicket = ticket;
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
|
public void initialize(Ticket ticket) {
|
||||||
|
initialized = true;
|
||||||
|
chunkTicket = ticket;
|
||||||
|
|
||||||
|
/*
|
||||||
// Only do anything if this function is running on the server side
|
// Only do anything if this function is running on the server side
|
||||||
// NOTE: We don't have to check whether this block is the upper door
|
// NOTE: We don't have to check whether this block is the upper door
|
||||||
// block or the lower one because only one of them should have a
|
// block or the lower one because only one of them should have a
|
||||||
|
@ -53,12 +54,12 @@ public class TileEntityDimDoorGold extends TileEntityDimDoor implements IChunkLo
|
||||||
ChunkLoaderHelper.forcePocketChunks(dimension, chunkTicket);
|
ChunkLoaderHelper.forcePocketChunks(dimension, chunkTicket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
ForgeChunkManager.releaseTicket(chunkTicket);
|
ForgeChunkManager.releaseTicket(chunkTicket);
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class TileEntityRift extends DDTileEntityBase implements ITickable {
|
||||||
public float growth = 0;
|
public float growth = 0;
|
||||||
|
|
||||||
public TileEntityRift(World world) {
|
public TileEntityRift(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
// Vary the update times of rifts to prevent all the rifts in a cluster
|
// Vary the update times of rifts to prevent all the rifts in a cluster
|
||||||
// from updating at the same time.
|
// from updating at the same time.
|
||||||
updateTimer = random.nextInt(UPDATE_PERIOD);
|
updateTimer = random.nextInt(UPDATE_PERIOD);
|
||||||
|
|
|
@ -9,18 +9,18 @@ public class TileEntityTransTrapdoor extends DDTileEntityBase {
|
||||||
super(world);
|
super(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float[] getRenderColor(Random rand) {
|
public float[] getRenderColor(Random rand) {
|
||||||
float[] rgbaColor = {1,1,1,1};
|
float[] rgbaColor = {1, 1, 1, 1};
|
||||||
if (this.world.provider.getDimension() == -1) {
|
if (this.world.provider.getDimension() == -1) {
|
||||||
rgbaColor[0] = world.rand.nextFloat() * 0.5F + 0.4F;
|
rgbaColor[0] = world.rand.nextFloat() * 0.5F + 0.4F;
|
||||||
rgbaColor[1] = world.rand.nextFloat() * 0.05F;
|
rgbaColor[1] = world.rand.nextFloat() * 0.05F;
|
||||||
rgbaColor[2] = world.rand.nextFloat() * 0.05F;
|
rgbaColor[2] = world.rand.nextFloat() * 0.05F;
|
||||||
} else {
|
} else {
|
||||||
rgbaColor[0] = world.rand.nextFloat() * 0.5F + 0.1F;
|
rgbaColor[0] = world.rand.nextFloat() * 0.5F + 0.1F;
|
||||||
rgbaColor[1] = world.rand.nextFloat() * 0.4F + 0.4F;
|
rgbaColor[1] = world.rand.nextFloat() * 0.4F + 0.4F;
|
||||||
rgbaColor[2] = world.rand.nextFloat() * 0.6F + 0.5F;
|
rgbaColor[2] = world.rand.nextFloat() * 0.6F + 0.5F;
|
||||||
}
|
}
|
||||||
return rgbaColor;
|
return rgbaColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.world.DimensionType;
|
||||||
import net.minecraft.world.WorldProvider;
|
import net.minecraft.world.WorldProvider;
|
||||||
|
|
||||||
public class PocketProvider extends WorldProvider {
|
public class PocketProvider extends WorldProvider {
|
||||||
|
|
||||||
/*@Override
|
/*@Override
|
||||||
public String getDimensionName() {
|
public String getDimensionName() {
|
||||||
return "Pocket Dimension";
|
return "Pocket Dimension";
|
||||||
|
|
Loading…
Reference in a new issue