Began work on BaseDimDoor. Copied relevant json files for door blockstates and models.

This commit is contained in:
zangamj 2016-06-18 13:02:36 -04:00
parent 4f94735c79
commit e6cc4c292f
7 changed files with 140 additions and 168 deletions

View file

@ -151,73 +151,52 @@ public class DimDoors {
MinecraftForge.EVENT_BUS.register(hooks);
MinecraftForge.TERRAIN_GEN_BUS.register(hooks);
proxy.registerSidedHooks();
// Initialize and register blocks and items
//TODO: Move this all to their own classes
transientDoor = new TransientDoor();
goldenDimensionalDoor = new BlockGoldDimDoor();
DimDoorsNetwork.init();
}
quartzDoor = new BlockDoorQuartz();
personalDimDoor = new PersonalDimDoor();
@Mod.EventHandler
public void onInitialization(FMLInitializationEvent event) {
// Initialize ServerTickHandler instance
serverTickHandler = new ServerTickHandler();
MinecraftForge.EVENT_BUS.register(serverTickHandler);
// Initialize LimboDecay instance: required for BlockLimbo
limboDecay = new LimboDecay(properties);
// Initialize blocks and items
transientDoor = new TransientDoor();
goldenDimensionalDoor = new BlockGoldDimDoor();
quartzDoor = new BlockDoorQuartz();
personalDimDoor = new PersonalDimDoor();
goldenDoor = new BlockDoorGold();
blockDimWall = new BlockDimWall();
blockDimWallPerm = new BlockDimWallPerm();
warpDoor = new WarpDoor();
blockLimbo = new BlockLimbo(limboDecay);
unstableDoor = new UnstableDoor();
dimensionalDoor = new DimensionalDoor();
transTrapdoor = new TransTrapdoor();
goldenDoor = new BlockDoorGold();
blockDimWall = new BlockDimWall();
blockDimWallPerm = new BlockDimWallPerm();
warpDoor = new WarpDoor();
blockLimbo = new BlockLimbo(limboDecay);
unstableDoor = new UnstableDoor();
dimensionalDoor = new DimensionalDoor();
transTrapdoor = new TransTrapdoor();
blockRift = new BlockRift();
itemDDKey = new ItemDDKey();
itemQuartzDoor = new ItemQuartzDoor();
itemPersonalDoor = new ItemPersonalDoor();
itemGoldenDoor = new ItemGoldDoor();
itemGoldenDimensionalDoor = new ItemGoldDimDoor();
itemDimensionalDoor = new ItemDimensionalDoor();
itemWarpDoor = new ItemWarpDoor();
itemRiftSignature = new ItemRiftSignature();
itemRiftRemover = new ItemRiftRemover();
itemStableFabric = new ItemStableFabric();
itemUnstableDoor = new ItemUnstableDoor();
itemRiftBlade = new ItemRiftBlade();
itemStabilizedRiftSignature = new ItemStabilizedRiftSignature();
itemWorldThread = new ItemWorldThread();
// Check if other biomes have been registered with the same IDs we want. If so, crash Minecraft
// to notify the user instead of letting it pass and conflicting with Biomes o' Plenty.
DDBiomeGenBase.checkBiomes(properties.LimboBiomeID, properties.PocketBiomeID);
itemDDKey = new ItemDDKey();
itemQuartzDoor = new ItemQuartzDoor();
itemPersonalDoor = new ItemPersonalDoor();
itemGoldenDoor = new ItemGoldDoor();
itemGoldenDimensionalDoor = new ItemGoldDimDoor();
itemDimensionalDoor = new ItemDimensionalDoor();
itemWarpDoor = new ItemWarpDoor();
itemRiftSignature = new ItemRiftSignature();
itemRiftRemover = new ItemRiftRemover();
itemStableFabric = new ItemStableFabric();
itemUnstableDoor = new ItemUnstableDoor();
itemRiftBlade = new ItemRiftBlade();
itemStabilizedRiftSignature = new ItemStabilizedRiftSignature();
itemWorldThread = new ItemWorldThread();
// Initialize our biomes
DimDoors.limboBiome = (new BiomeGenLimbo(properties.LimboBiomeID));
DimDoors.pocketBiome = (new BiomeGenPocket(properties.PocketBiomeID));
GameRegistry.registerBlock(quartzDoor, null, BlockDoorQuartz.ID);
GameRegistry.registerBlock(personalDimDoor, null, PersonalDimDoor.ID);
GameRegistry.registerBlock(goldenDoor, null, BlockDoorGold.ID);
GameRegistry.registerBlock(goldenDimensionalDoor, null, BlockGoldDimDoor.ID);
GameRegistry.registerBlock(unstableDoor, null, UnstableDoor.ID);
GameRegistry.registerBlock(warpDoor, null, WarpDoor.ID);
GameRegistry.registerBlock(blockRift, BlockRift.ID);
GameRegistry.registerBlock(blockLimbo, BlockLimbo.ID);
GameRegistry.registerBlock(dimensionalDoor, null, DimensionalDoor.ID);
GameRegistry.registerBlock(transTrapdoor, TransTrapdoor.ID);
GameRegistry.registerBlock(quartzDoor, null, BlockDoorQuartz.ID);
GameRegistry.registerBlock(personalDimDoor, null, PersonalDimDoor.ID);
GameRegistry.registerBlock(goldenDoor, null, BlockDoorGold.ID);
GameRegistry.registerBlock(goldenDimensionalDoor, null, BlockGoldDimDoor.ID);
GameRegistry.registerBlock(unstableDoor, null, UnstableDoor.ID);
GameRegistry.registerBlock(warpDoor, null, WarpDoor.ID);
GameRegistry.registerBlock(blockRift, BlockRift.ID);
GameRegistry.registerBlock(blockLimbo, BlockLimbo.ID);
GameRegistry.registerBlock(dimensionalDoor, null, DimensionalDoor.ID);
GameRegistry.registerBlock(transTrapdoor, TransTrapdoor.ID);
GameRegistry.registerBlock(blockDimWall, ItemBlockDimWall.class, BlockDimWall.ID);
GameRegistry.registerBlock(blockDimWallPerm, BlockDimWallPerm.ID);
GameRegistry.registerBlock(transientDoor, TransientDoor.ID);
GameRegistry.registerBlock(blockDimWallPerm, BlockDimWallPerm.ID);
GameRegistry.registerBlock(transientDoor, TransientDoor.ID);
GameRegistry.registerItem(itemDDKey, ItemDDKey.ID);
GameRegistry.registerItem(itemQuartzDoor, ItemQuartzDoor.ID);
GameRegistry.registerItem(itemPersonalDoor, ItemPersonalDoor.ID);
@ -233,6 +212,39 @@ public class DimDoors {
GameRegistry.registerItem(itemStabilizedRiftSignature, ItemStabilizedRiftSignature.ID);
GameRegistry.registerItem(itemWorldThread, ItemWorldThread.ID);
GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor");
GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift");
GameRegistry.registerTileEntity(TileEntityTransTrapdoor.class, "TileEntityDimHatch");
GameRegistry.registerTileEntity(TileEntityDimDoorGold.class, "TileEntityDimDoorGold");
EntityRegistry.registerModEntity(MobMonolith.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true);
EntityList.idToClassMapping.put(properties.MonolithEntityID, MobMonolith.class);
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityList.EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff));
proxy.registerRenderers();
proxy.registerSidedHooks();
DimDoorsNetwork.init();
}
@Mod.EventHandler
public void onInitialization(FMLInitializationEvent event) {
// Initialize ServerTickHandler instance
serverTickHandler = new ServerTickHandler();
MinecraftForge.EVENT_BUS.register(serverTickHandler);
// Initialize LimboDecay instance: required for BlockLimbo
limboDecay = new LimboDecay(properties);
// Check if other biomes have been registered with the same IDs we want. If so, crash Minecraft
// to notify the user instead of letting it pass and conflicting with Biomes o' Plenty.
DDBiomeGenBase.checkBiomes(properties.LimboBiomeID, properties.PocketBiomeID);
// Initialize our biomes
DimDoors.limboBiome = (new BiomeGenLimbo(properties.LimboBiomeID));
DimDoors.pocketBiome = (new BiomeGenPocket(properties.PocketBiomeID));
BlockRotator.setupOrientations();
if(!DimensionManager.registerProviderType(properties.PocketProviderID, PocketProvider.class, false))
@ -244,15 +256,6 @@ public class DimDoors {
DimensionManager.registerDimension(properties.LimboDimensionID, properties.LimboProviderID);
GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor");
GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift");
GameRegistry.registerTileEntity(TileEntityTransTrapdoor.class, "TileEntityDimHatch");
GameRegistry.registerTileEntity(TileEntityDimDoorGold.class, "TileEntityDimDoorGold");
EntityRegistry.registerModEntity(MobMonolith.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true);
EntityList.idToClassMapping.put(properties.MonolithEntityID, MobMonolith.class);
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityList.EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff));
CraftingManager.registerRecipes(properties);
CraftingManager.registerDispenserBehaviors();
MinecraftForge.EVENT_BUS.register(new CraftingManager());

View file

@ -10,8 +10,6 @@ import net.minecraft.block.BlockDoor;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.IconFlipped;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -19,7 +17,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
@ -28,42 +25,15 @@ import com.zixiken.dimdoors.core.DDTeleporter;
import com.zixiken.dimdoors.core.PocketManager;
import com.zixiken.dimdoors.items.ItemDDKey;
import com.zixiken.dimdoors.tileentities.TileEntityDimDoor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEntityProvider
{
@SideOnly(Side.CLIENT)
protected IIcon[] upperTextures;
@SideOnly(Side.CLIENT)
protected IIcon[] lowerTextures;
public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEntityProvider {
public BaseDimDoor(Material material)
{
super(material);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister)
{
upperTextures = new IIcon[2];
lowerTextures = new IIcon[2];
upperTextures[0] = iconRegister.registerIcon(DimDoors.modid + ":" + this.getUnlocalizedName() + "_upper");
lowerTextures[0] = iconRegister.registerIcon(DimDoors.modid + ":" + this.getUnlocalizedName() + "_lower");
upperTextures[1] = new IconFlipped(upperTextures[0], true, false);
lowerTextures[1] = new IconFlipped(lowerTextures[0], true, false);
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata)
{
return upperTextures[0];
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
@ -113,71 +83,6 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
this.updateAttachedTile(world, x, y, z);
}
/**
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
*/
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side)
{
if (side != 1 && side != 0)
{
int fullMetadata = func_150012_g(blockAccess, x, y, z);
int orientation = fullMetadata & 3;
boolean reversed = false;
if (isDoorOpen(fullMetadata))
{
if (orientation == 0 && side == 2)
{
reversed = !reversed;
}
else if (orientation == 1 && side == 5)
{
reversed = !reversed;
}
else if (orientation == 2 && side == 3)
{
reversed = !reversed;
}
else if (orientation == 3 && side == 4)
{
reversed = !reversed;
}
}
else
{
if (orientation == 0 && side == 5)
{
reversed = !reversed;
}
else if (orientation == 1 && side == 3)
{
reversed = !reversed;
}
else if (orientation == 2 && side == 4)
{
reversed = !reversed;
}
else if (orientation == 3 && side == 2)
{
reversed = !reversed;
}
if ((fullMetadata & 16) != 0)
{
reversed = !reversed;
}
}
if (isUpperDoorBlock(fullMetadata))
{
return this.upperTextures[reversed ? 1 : 0];
}
return this.lowerTextures[reversed ? 1 : 0];
}
return this.lowerTextures[0];
}
//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.
public BaseDimDoor updateAttachedTile(World world, int x, int y, int z)

View file

@ -0,0 +1,36 @@
{
"variants": {
"facing=east,half=lower,hinge=left,open=false": { "model": "iron_door_bottom" },
"facing=south,half=lower,hinge=left,open=false": { "model": "iron_door_bottom", "y": 90 },
"facing=west,half=lower,hinge=left,open=false": { "model": "iron_door_bottom", "y": 180 },
"facing=north,half=lower,hinge=left,open=false": { "model": "iron_door_bottom", "y": 270 },
"facing=east,half=lower,hinge=right,open=false": { "model": "iron_door_bottom_rh" },
"facing=south,half=lower,hinge=right,open=false": { "model": "iron_door_bottom_rh", "y": 90 },
"facing=west,half=lower,hinge=right,open=false": { "model": "iron_door_bottom_rh", "y": 180 },
"facing=north,half=lower,hinge=right,open=false": { "model": "iron_door_bottom_rh", "y": 270 },
"facing=east,half=lower,hinge=left,open=true": { "model": "iron_door_bottom_rh", "y": 90 },
"facing=south,half=lower,hinge=left,open=true": { "model": "iron_door_bottom_rh", "y": 180 },
"facing=west,half=lower,hinge=left,open=true": { "model": "iron_door_bottom_rh", "y": 270 },
"facing=north,half=lower,hinge=left,open=true": { "model": "iron_door_bottom_rh" },
"facing=east,half=lower,hinge=right,open=true": { "model": "iron_door_bottom", "y": 270 },
"facing=south,half=lower,hinge=right,open=true": { "model": "iron_door_bottom" },
"facing=west,half=lower,hinge=right,open=true": { "model": "iron_door_bottom", "y": 90 },
"facing=north,half=lower,hinge=right,open=true": { "model": "iron_door_bottom", "y": 180 },
"facing=east,half=upper,hinge=left,open=false": { "model": "iron_door_top" },
"facing=south,half=upper,hinge=left,open=false": { "model": "iron_door_top", "y": 90 },
"facing=west,half=upper,hinge=left,open=false": { "model": "iron_door_top", "y": 180 },
"facing=north,half=upper,hinge=left,open=false": { "model": "iron_door_top", "y": 270 },
"facing=east,half=upper,hinge=right,open=false": { "model": "iron_door_top_rh" },
"facing=south,half=upper,hinge=right,open=false": { "model": "iron_door_top_rh", "y": 90 },
"facing=west,half=upper,hinge=right,open=false": { "model": "iron_door_top_rh", "y": 180 },
"facing=north,half=upper,hinge=right,open=false": { "model": "iron_door_top_rh", "y": 270 },
"facing=east,half=upper,hinge=left,open=true": { "model": "iron_door_top_rh", "y": 90 },
"facing=south,half=upper,hinge=left,open=true": { "model": "iron_door_top_rh", "y": 180 },
"facing=west,half=upper,hinge=left,open=true": { "model": "iron_door_top_rh", "y": 270 },
"facing=north,half=upper,hinge=left,open=true": { "model": "iron_door_top_rh" },
"facing=east,half=upper,hinge=right,open=true": { "model": "iron_door_top", "y": 270 },
"facing=south,half=upper,hinge=right,open=true": { "model": "iron_door_top" },
"facing=west,half=upper,hinge=right,open=true": { "model": "iron_door_top", "y": 90 },
"facing=north,half=upper,hinge=right,open=true": { "model": "iron_door_top", "y": 180 }
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/door_bottom",
"textures": {
"bottom": "blocks/door_iron_lower",
"top": "blocks/door_iron_upper"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/door_bottom_rh",
"textures": {
"bottom": "blocks/door_iron_lower",
"top": "blocks/door_iron_upper"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/door_top",
"textures": {
"bottom": "blocks/door_iron_lower",
"top": "blocks/door_iron_upper"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/door_top_rh",
"textures": {
"bottom": "blocks/door_iron_lower",
"top": "blocks/door_iron_upper"
}
}