From 6480fb386c6aeb9d27a9da42af0055ed646c3ea5 Mon Sep 17 00:00:00 2001 From: zangamj Date: Wed, 20 Jul 2016 14:32:03 -0400 Subject: [PATCH] Finished DimensionalDoor --- .../dimdoors/blocks/DimensionalDoor.java | 16 ++++---- .../assets/dimdoors/blockstates/dimDoor.json | 36 ++++++++++++++++++ .../dimdoors/models/block/dimDoor_bottom.json | 7 ++++ .../models/block/dimDoor_bottom_rh.json | 7 ++++ .../dimdoors/models/block/dimDoor_top.json | 7 ++++ .../dimdoors/models/block/dimDoor_top_rh.json | 7 ++++ ...le.dimDoor_lower.png => dimDoor_lower.png} | Bin ...le.dimDoor_upper.png => dimDoor_upper.png} | Bin 8 files changed, 72 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/assets/dimdoors/blockstates/dimDoor.json create mode 100644 src/main/resources/assets/dimdoors/models/block/dimDoor_bottom.json create mode 100644 src/main/resources/assets/dimdoors/models/block/dimDoor_bottom_rh.json create mode 100644 src/main/resources/assets/dimdoors/models/block/dimDoor_top.json create mode 100644 src/main/resources/assets/dimdoors/models/block/dimDoor_top_rh.json rename src/main/resources/assets/dimdoors/textures/blocks/{tile.dimDoor_lower.png => dimDoor_lower.png} (100%) rename src/main/resources/assets/dimdoors/textures/blocks/{tile.dimDoor_upper.png => dimDoor_upper.png} (100%) diff --git a/src/main/java/com/zixiken/dimdoors/blocks/DimensionalDoor.java b/src/main/java/com/zixiken/dimdoors/blocks/DimensionalDoor.java index 81505d6e..1cc549e7 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/DimensionalDoor.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/DimensionalDoor.java @@ -3,8 +3,11 @@ package com.zixiken.dimdoors.blocks; import com.zixiken.dimdoors.core.DimLink; import com.zixiken.dimdoors.core.PocketManager; import com.zixiken.dimdoors.DimDoors; +import net.minecraft.block.BlockDoor; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import com.zixiken.dimdoors.core.LinkType; import com.zixiken.dimdoors.core.NewDimData; @@ -20,16 +23,13 @@ public class DimensionalDoor extends BaseDimDoor { } @Override - public void placeLink(World world, int x, int y, int z) - { - if (!world.isRemote && world.getBlock(x, y - 1, z) == this) - { + public void placeLink(World world, BlockPos pos) { + IBlockState state = world.getBlockState(pos.down()); + if (!world.isRemote && state.getBlock() == this) { NewDimData dimension = PocketManager.createDimensionData(world); - DimLink link = dimension.getLink(x, y, z); + DimLink link = dimension.getLink(pos); if (link == null) - { - dimension.createLink(x, y, z, LinkType.POCKET,world.getBlockMetadata(x, y - 1, z)); - } + dimension.createLink(pos, LinkType.POCKET, state.getValue(BlockDoor.FACING)); } } diff --git a/src/main/resources/assets/dimdoors/blockstates/dimDoor.json b/src/main/resources/assets/dimdoors/blockstates/dimDoor.json new file mode 100644 index 00000000..fd660435 --- /dev/null +++ b/src/main/resources/assets/dimdoors/blockstates/dimDoor.json @@ -0,0 +1,36 @@ +{ + "variants": { + "facing=east,half=lower,hinge=left,open=false": { "model": "dimDoor_bottom" }, + "facing=south,half=lower,hinge=left,open=false": { "model": "dimDoor_bottom", "y": 90 }, + "facing=west,half=lower,hinge=left,open=false": { "model": "dimDoor_bottom", "y": 180 }, + "facing=north,half=lower,hinge=left,open=false": { "model": "dimDoor_bottom", "y": 270 }, + "facing=east,half=lower,hinge=right,open=false": { "model": "dimDoor_bottom_rh" }, + "facing=south,half=lower,hinge=right,open=false": { "model": "dimDoor_bottom_rh", "y": 90 }, + "facing=west,half=lower,hinge=right,open=false": { "model": "dimDoor_bottom_rh", "y": 180 }, + "facing=north,half=lower,hinge=right,open=false": { "model": "dimDoor_bottom_rh", "y": 270 }, + "facing=east,half=lower,hinge=left,open=true": { "model": "dimDoor_bottom_rh", "y": 90 }, + "facing=south,half=lower,hinge=left,open=true": { "model": "dimDoor_bottom_rh", "y": 180 }, + "facing=west,half=lower,hinge=left,open=true": { "model": "dimDoor_bottom_rh", "y": 270 }, + "facing=north,half=lower,hinge=left,open=true": { "model": "dimDoor_bottom_rh" }, + "facing=east,half=lower,hinge=right,open=true": { "model": "dimDoor_bottom", "y": 270 }, + "facing=south,half=lower,hinge=right,open=true": { "model": "dimDoor_bottom" }, + "facing=west,half=lower,hinge=right,open=true": { "model": "dimDoor_bottom", "y": 90 }, + "facing=north,half=lower,hinge=right,open=true": { "model": "dimDoor_bottom", "y": 180 }, + "facing=east,half=upper,hinge=left,open=false": { "model": "dimDoor_top" }, + "facing=south,half=upper,hinge=left,open=false": { "model": "dimDoor_top", "y": 90 }, + "facing=west,half=upper,hinge=left,open=false": { "model": "dimDoor_top", "y": 180 }, + "facing=north,half=upper,hinge=left,open=false": { "model": "dimDoor_top", "y": 270 }, + "facing=east,half=upper,hinge=right,open=false": { "model": "dimDoor_top_rh" }, + "facing=south,half=upper,hinge=right,open=false": { "model": "dimDoor_top_rh", "y": 90 }, + "facing=west,half=upper,hinge=right,open=false": { "model": "dimDoor_top_rh", "y": 180 }, + "facing=north,half=upper,hinge=right,open=false": { "model": "dimDoor_top_rh", "y": 270 }, + "facing=east,half=upper,hinge=left,open=true": { "model": "dimDoor_top_rh", "y": 90 }, + "facing=south,half=upper,hinge=left,open=true": { "model": "dimDoor_top_rh", "y": 180 }, + "facing=west,half=upper,hinge=left,open=true": { "model": "dimDoor_top_rh", "y": 270 }, + "facing=north,half=upper,hinge=left,open=true": { "model": "dimDoor_top_rh" }, + "facing=east,half=upper,hinge=right,open=true": { "model": "dimDoor_top", "y": 270 }, + "facing=south,half=upper,hinge=right,open=true": { "model": "dimDoor_top" }, + "facing=west,half=upper,hinge=right,open=true": { "model": "dimDoor_top", "y": 90 }, + "facing=north,half=upper,hinge=right,open=true": { "model": "dimDoor_top", "y": 180 } + } +} diff --git a/src/main/resources/assets/dimdoors/models/block/dimDoor_bottom.json b/src/main/resources/assets/dimdoors/models/block/dimDoor_bottom.json new file mode 100644 index 00000000..80ebcf8c --- /dev/null +++ b/src/main/resources/assets/dimdoors/models/block/dimDoor_bottom.json @@ -0,0 +1,7 @@ +{ + "parent": "block/door_bottom", + "textures": { + "bottom": "blocks/dimDoor_lower", + "top": "blocks/dimDoor_upper" + } +} diff --git a/src/main/resources/assets/dimdoors/models/block/dimDoor_bottom_rh.json b/src/main/resources/assets/dimdoors/models/block/dimDoor_bottom_rh.json new file mode 100644 index 00000000..14b767be --- /dev/null +++ b/src/main/resources/assets/dimdoors/models/block/dimDoor_bottom_rh.json @@ -0,0 +1,7 @@ +{ + "parent": "block/door_bottom_rh", + "textures": { + "bottom": "blocks/dimDoor_lower", + "top": "blocks/DimDoor_upper" + } +} diff --git a/src/main/resources/assets/dimdoors/models/block/dimDoor_top.json b/src/main/resources/assets/dimdoors/models/block/dimDoor_top.json new file mode 100644 index 00000000..e5feb103 --- /dev/null +++ b/src/main/resources/assets/dimdoors/models/block/dimDoor_top.json @@ -0,0 +1,7 @@ +{ + "parent": "block/door_top", + "textures": { + "bottom": "blocks/dimDoor_lower", + "top": "blocks/dimDoor_upper" + } +} diff --git a/src/main/resources/assets/dimdoors/models/block/dimDoor_top_rh.json b/src/main/resources/assets/dimdoors/models/block/dimDoor_top_rh.json new file mode 100644 index 00000000..f3903421 --- /dev/null +++ b/src/main/resources/assets/dimdoors/models/block/dimDoor_top_rh.json @@ -0,0 +1,7 @@ +{ + "parent": "block/door_top_rh", + "textures": { + "bottom": "blocks/dimDoor_lower", + "top": "blocks/dimDoor_upper" + } +} diff --git a/src/main/resources/assets/dimdoors/textures/blocks/tile.dimDoor_lower.png b/src/main/resources/assets/dimdoors/textures/blocks/dimDoor_lower.png similarity index 100% rename from src/main/resources/assets/dimdoors/textures/blocks/tile.dimDoor_lower.png rename to src/main/resources/assets/dimdoors/textures/blocks/dimDoor_lower.png diff --git a/src/main/resources/assets/dimdoors/textures/blocks/tile.dimDoor_upper.png b/src/main/resources/assets/dimdoors/textures/blocks/dimDoor_upper.png similarity index 100% rename from src/main/resources/assets/dimdoors/textures/blocks/tile.dimDoor_upper.png rename to src/main/resources/assets/dimdoors/textures/blocks/dimDoor_upper.png