mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Added diamond doors
This commit is contained in:
parent
d34d1ddd60
commit
276a99d7cf
15 changed files with 189 additions and 7 deletions
|
@ -0,0 +1,48 @@
|
||||||
|
package com.minelittlepony.unicopia.block;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.Predicates;
|
||||||
|
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
|
import net.minecraft.block.material.MapColor;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class BlockDiamondDoor extends UDoor {
|
||||||
|
|
||||||
|
public BlockDiamondDoor(String domain, String name, Supplier<Item> theItem) {
|
||||||
|
super(Material.IRON, domain, name, theItem);
|
||||||
|
setSoundType(SoundType.METAL);
|
||||||
|
setHardness(5.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||||
|
return MapColor.DIAMOND;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canOpen(@Nullable EntityPlayer player) {
|
||||||
|
return Predicates.MAGI.test(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean onPowerStateChanged(World world, IBlockState state, BlockPos pos, boolean powered) {
|
||||||
|
if (state.getValue(OPEN)) {
|
||||||
|
world.setBlockState(pos, state.withProperty(OPEN, false), 2);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -54,11 +54,11 @@ public abstract class UDoor extends BlockDoor {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected WorldEvent getCloseSound() {
|
protected WorldEvent getCloseSound() {
|
||||||
return material == Material.IRON ? WorldEvent.IRON_DOOR_SLAM : WorldEvent.WOODEN_DOOR_SLAM;
|
return isLockable() ? WorldEvent.IRON_DOOR_SLAM : WorldEvent.WOODEN_DOOR_SLAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected WorldEvent getOpenSound() {
|
protected WorldEvent getOpenSound() {
|
||||||
return material == Material.IRON ? WorldEvent.IRON_DOOR_OPEN : WorldEvent.WOODEN_DOOR_OPEN;
|
return isLockable() ? WorldEvent.IRON_DOOR_OPEN : WorldEvent.WOODEN_DOOR_OPEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,8 +71,20 @@ public abstract class UDoor extends BlockDoor {
|
||||||
toggleDoor(world, pos, open, false, null);
|
toggleDoor(world, pos, open, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isLockable() {
|
||||||
|
return material == Material.IRON;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean canBePowered() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean canOpen(@Nullable EntityPlayer player) {
|
||||||
|
return player == null || material != Material.IRON;
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean toggleDoor(World world, BlockPos pos, boolean open, boolean force, @Nullable EntityPlayer player) {
|
protected boolean toggleDoor(World world, BlockPos pos, boolean open, boolean force, @Nullable EntityPlayer player) {
|
||||||
if (player != null && material == Material.IRON) {
|
if (!canOpen(player)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +166,7 @@ public abstract class UDoor extends BlockDoor {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
dropBlockAsItem(world, pos, state, 0);
|
dropBlockAsItem(world, pos, state, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (canBePowered()) {
|
||||||
boolean powered = world.isBlockPowered(pos) || world.isBlockPowered(upper);
|
boolean powered = world.isBlockPowered(pos) || world.isBlockPowered(upper);
|
||||||
|
|
||||||
if (sender != this && (powered || sender.getDefaultState().canProvidePower()) && powered != upperDoor.getValue(POWERED)) {
|
if (sender != this && (powered || sender.getDefaultState().canProvidePower()) && powered != upperDoor.getValue(POWERED)) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.minelittlepony.unicopia.block.UPot;
|
||||||
import com.minelittlepony.unicopia.block.USapling;
|
import com.minelittlepony.unicopia.block.USapling;
|
||||||
import com.minelittlepony.unicopia.item.ItemApple;
|
import com.minelittlepony.unicopia.item.ItemApple;
|
||||||
import com.minelittlepony.unicopia.block.BlockCloudDoor;
|
import com.minelittlepony.unicopia.block.BlockCloudDoor;
|
||||||
|
import com.minelittlepony.unicopia.block.BlockDiamondDoor;
|
||||||
import com.minelittlepony.unicopia.block.BlockCloudFarm;
|
import com.minelittlepony.unicopia.block.BlockCloudFarm;
|
||||||
import com.minelittlepony.unicopia.block.BlockCloudFence;
|
import com.minelittlepony.unicopia.block.BlockCloudFence;
|
||||||
import com.minelittlepony.unicopia.block.BlockCloud;
|
import com.minelittlepony.unicopia.block.BlockCloud;
|
||||||
|
@ -61,6 +62,7 @@ public class UBlocks {
|
||||||
public static final Block bakery_door = new BlockDutchDoor(Material.WOOD, Unicopia.MODID, "bakery_door", () -> UItems.bakery_door)
|
public static final Block bakery_door = new BlockDutchDoor(Material.WOOD, Unicopia.MODID, "bakery_door", () -> UItems.bakery_door)
|
||||||
.setSoundType(SoundType.WOOD)
|
.setSoundType(SoundType.WOOD)
|
||||||
.setHardness(3);
|
.setHardness(3);
|
||||||
|
public static final Block diamond_door = new BlockDiamondDoor(Unicopia.MODID, "diamond_door", () -> UItems.diamond_door);
|
||||||
|
|
||||||
public static final BlockGlowingGem enchanted_torch = new BlockGlowingGem(Unicopia.MODID, "enchanted_torch");
|
public static final BlockGlowingGem enchanted_torch = new BlockGlowingGem(Unicopia.MODID, "enchanted_torch");
|
||||||
|
|
||||||
|
@ -101,7 +103,7 @@ public class UBlocks {
|
||||||
enchanted_cloud_slab, enchanted_cloud_slab.doubleSlab,
|
enchanted_cloud_slab, enchanted_cloud_slab.doubleSlab,
|
||||||
packed_cloud_slab, packed_cloud_slab.doubleSlab,
|
packed_cloud_slab, packed_cloud_slab.doubleSlab,
|
||||||
cloud_fence, cloud_banister,
|
cloud_fence, cloud_banister,
|
||||||
mist_door, library_door, bakery_door,
|
mist_door, library_door, bakery_door, diamond_door,
|
||||||
hive, chitin, chissled_chitin, cuccoon, slime_layer,
|
hive, chitin, chissled_chitin, cuccoon, slime_layer,
|
||||||
anvil, cloud_farmland,
|
anvil, cloud_farmland,
|
||||||
sugar_block, flower_pot,
|
sugar_block, flower_pot,
|
||||||
|
|
|
@ -127,6 +127,9 @@ public class UItems {
|
||||||
public static final Item bakery_door = new ItemDoor(UBlocks.bakery_door)
|
public static final Item bakery_door = new ItemDoor(UBlocks.bakery_door)
|
||||||
.setTranslationKey("bakery_door")
|
.setTranslationKey("bakery_door")
|
||||||
.setRegistryName(Unicopia.MODID, "bakery_door");
|
.setRegistryName(Unicopia.MODID, "bakery_door");
|
||||||
|
public static final Item diamond_door = new ItemDoor(UBlocks.diamond_door)
|
||||||
|
.setTranslationKey("diamond_door")
|
||||||
|
.setRegistryName(Unicopia.MODID, "diamond_door");
|
||||||
|
|
||||||
public static final Item sugar_block = new UItemDecoration(UBlocks.sugar_block);
|
public static final Item sugar_block = new UItemDecoration(UBlocks.sugar_block);
|
||||||
|
|
||||||
|
@ -243,7 +246,7 @@ public class UItems {
|
||||||
cloud_stairs,
|
cloud_stairs,
|
||||||
cloud_slab, enchanted_cloud_slab, packed_cloud_slab,
|
cloud_slab, enchanted_cloud_slab, packed_cloud_slab,
|
||||||
cloud_fence, cloud_banister,
|
cloud_fence, cloud_banister,
|
||||||
cloud_farmland, mist_door, library_door, bakery_door, anvil,
|
cloud_farmland, mist_door, library_door, bakery_door, diamond_door, anvil,
|
||||||
|
|
||||||
bag_of_holding, spell, curse, spellbook, mug, enchanted_torch,
|
bag_of_holding, spell, curse, spellbook, mug, enchanted_torch,
|
||||||
staff_meadow_brook, staff_remembrance, alicorn_amulet,
|
staff_meadow_brook, staff_remembrance, alicorn_amulet,
|
||||||
|
@ -278,7 +281,7 @@ public class UItems {
|
||||||
cloud_stairs,
|
cloud_stairs,
|
||||||
cloud_slab, enchanted_cloud_slab, packed_cloud_slab,
|
cloud_slab, enchanted_cloud_slab, packed_cloud_slab,
|
||||||
cloud_fence, cloud_banister,
|
cloud_fence, cloud_banister,
|
||||||
cloud_farmland, mist_door, library_door, bakery_door, anvil,
|
cloud_farmland, mist_door, library_door, bakery_door, diamond_door, anvil,
|
||||||
|
|
||||||
bag_of_holding, spell, curse, spellbook, mug, enchanted_torch,
|
bag_of_holding, spell, curse, spellbook, mug, enchanted_torch,
|
||||||
staff_meadow_brook, staff_remembrance, alicorn_amulet,
|
staff_meadow_brook, staff_remembrance, alicorn_amulet,
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=east,half=lower,hinge=left,open=false,powered=false": { "model": "unicopia:door/diamond_bottom" },
|
||||||
|
"facing=south,half=lower,hinge=left,open=false,powered=false": { "model": "unicopia:door/diamond_bottom", "y": 90 },
|
||||||
|
"facing=west,half=lower,hinge=left,open=false,powered=false": { "model": "unicopia:door/diamond_bottom", "y": 180 },
|
||||||
|
"facing=north,half=lower,hinge=left,open=false,powered=false": { "model": "unicopia:door/diamond_bottom", "y": 270 },
|
||||||
|
"facing=east,half=lower,hinge=right,open=false,powered=false": { "model": "unicopia:door/diamond_bottom_rh" },
|
||||||
|
"facing=south,half=lower,hinge=right,open=false,powered=false": { "model": "unicopia:door/diamond_bottom_rh", "y": 90 },
|
||||||
|
"facing=west,half=lower,hinge=right,open=false,powered=false": { "model": "unicopia:door/diamond_bottom_rh", "y": 180 },
|
||||||
|
"facing=north,half=lower,hinge=right,open=false,powered=false": { "model": "unicopia:door/diamond_bottom_rh", "y": 270 },
|
||||||
|
"facing=east,half=lower,hinge=left,open=true,powered=false": { "model": "unicopia:door/diamond_bottom_rh", "y": 90 },
|
||||||
|
"facing=south,half=lower,hinge=left,open=true,powered=false": { "model": "unicopia:door/diamond_bottom_rh", "y": 180 },
|
||||||
|
"facing=west,half=lower,hinge=left,open=true,powered=false": { "model": "unicopia:door/diamond_bottom_rh", "y": 270 },
|
||||||
|
"facing=north,half=lower,hinge=left,open=true,powered=false": { "model": "unicopia:door/diamond_bottom_rh" },
|
||||||
|
"facing=east,half=lower,hinge=right,open=true,powered=false": { "model": "unicopia:door/diamond_bottom", "y": 270 },
|
||||||
|
"facing=south,half=lower,hinge=right,open=true,powered=false": { "model": "unicopia:door/diamond_bottom" },
|
||||||
|
"facing=west,half=lower,hinge=right,open=true,powered=false": { "model": "unicopia:door/diamond_bottom", "y": 90 },
|
||||||
|
"facing=north,half=lower,hinge=right,open=true,powered=false": { "model": "unicopia:door/diamond_bottom", "y": 180 },
|
||||||
|
"facing=east,half=upper,hinge=left,open=false,powered=false": { "model": "unicopia:door/diamond_top" },
|
||||||
|
"facing=south,half=upper,hinge=left,open=false,powered=false": { "model": "unicopia:door/diamond_top", "y": 90 },
|
||||||
|
"facing=west,half=upper,hinge=left,open=false,powered=false": { "model": "unicopia:door/diamond_top", "y": 180 },
|
||||||
|
"facing=north,half=upper,hinge=left,open=false,powered=false": { "model": "unicopia:door/diamond_top", "y": 270 },
|
||||||
|
"facing=east,half=upper,hinge=right,open=false,powered=false": { "model": "unicopia:door/diamond_top_rh" },
|
||||||
|
"facing=south,half=upper,hinge=right,open=false,powered=false": { "model": "unicopia:door/diamond_top_rh", "y": 90 },
|
||||||
|
"facing=west,half=upper,hinge=right,open=false,powered=false": { "model": "unicopia:door/diamond_top_rh", "y": 180 },
|
||||||
|
"facing=north,half=upper,hinge=right,open=false,powered=false": { "model": "unicopia:door/diamond_top_rh", "y": 270 },
|
||||||
|
"facing=east,half=upper,hinge=left,open=true,powered=false": { "model": "unicopia:door/diamond_top_rh", "y": 90 },
|
||||||
|
"facing=south,half=upper,hinge=left,open=true,powered=false": { "model": "unicopia:door/diamond_top_rh", "y": 180 },
|
||||||
|
"facing=west,half=upper,hinge=left,open=true,powered=false": { "model": "unicopia:door/diamond_top_rh", "y": 270 },
|
||||||
|
"facing=north,half=upper,hinge=left,open=true,powered=false": { "model": "unicopia:door/diamond_top_rh" },
|
||||||
|
"facing=east,half=upper,hinge=right,open=true,powered=false": { "model": "unicopia:door/diamond_top", "y": 270 },
|
||||||
|
"facing=south,half=upper,hinge=right,open=true,powered=false": { "model": "unicopia:door/diamond_top" },
|
||||||
|
"facing=west,half=upper,hinge=right,open=true,powered=false": { "model": "unicopia:door/diamond_top", "y": 90 },
|
||||||
|
"facing=north,half=upper,hinge=right,open=true,powered=false": { "model": "unicopia:door/diamond_top", "y": 180 },
|
||||||
|
"facing=east,half=lower,hinge=left,open=false,powered=true": { "model": "unicopia:door/diamond_bottom" },
|
||||||
|
"facing=south,half=lower,hinge=left,open=false,powered=true": { "model": "unicopia:door/diamond_bottom", "y": 90 },
|
||||||
|
"facing=west,half=lower,hinge=left,open=false,powered=true": { "model": "unicopia:door/diamond_bottom", "y": 180 },
|
||||||
|
"facing=north,half=lower,hinge=left,open=false,powered=true": { "model": "unicopia:door/diamond_bottom", "y": 270 },
|
||||||
|
"facing=east,half=lower,hinge=right,open=false,powered=true": { "model": "unicopia:door/diamond_bottom_rh" },
|
||||||
|
"facing=south,half=lower,hinge=right,open=false,powered=true": { "model": "unicopia:door/diamond_bottom_rh", "y": 90 },
|
||||||
|
"facing=west,half=lower,hinge=right,open=false,powered=true": { "model": "unicopia:door/diamond_bottom_rh", "y": 180 },
|
||||||
|
"facing=north,half=lower,hinge=right,open=false,powered=true": { "model": "unicopia:door/diamond_bottom_rh", "y": 270 },
|
||||||
|
"facing=east,half=lower,hinge=left,open=true,powered=true": { "model": "unicopia:door/diamond_bottom_rh", "y": 90 },
|
||||||
|
"facing=south,half=lower,hinge=left,open=true,powered=true": { "model": "unicopia:door/diamond_bottom_rh", "y": 180 },
|
||||||
|
"facing=west,half=lower,hinge=left,open=true,powered=true": { "model": "unicopia:door/diamond_bottom_rh", "y": 270 },
|
||||||
|
"facing=north,half=lower,hinge=left,open=true,powered=true": { "model": "unicopia:door/diamond_bottom_rh" },
|
||||||
|
"facing=east,half=lower,hinge=right,open=true,powered=true": { "model": "unicopia:door/diamond_bottom", "y": 270 },
|
||||||
|
"facing=south,half=lower,hinge=right,open=true,powered=true": { "model": "unicopia:door/diamond_bottom" },
|
||||||
|
"facing=west,half=lower,hinge=right,open=true,powered=true": { "model": "unicopia:door/diamond_bottom", "y": 90 },
|
||||||
|
"facing=north,half=lower,hinge=right,open=true,powered=true": { "model": "unicopia:door/diamond_bottom", "y": 180 },
|
||||||
|
"facing=east,half=upper,hinge=left,open=false,powered=true": { "model": "unicopia:door/diamond_top" },
|
||||||
|
"facing=south,half=upper,hinge=left,open=false,powered=true": { "model": "unicopia:door/diamond_top", "y": 90 },
|
||||||
|
"facing=west,half=upper,hinge=left,open=false,powered=true": { "model": "unicopia:door/diamond_top", "y": 180 },
|
||||||
|
"facing=north,half=upper,hinge=left,open=false,powered=true": { "model": "unicopia:door/diamond_top", "y": 270 },
|
||||||
|
"facing=east,half=upper,hinge=right,open=false,powered=true": { "model": "unicopia:door/diamond_top_rh" },
|
||||||
|
"facing=south,half=upper,hinge=right,open=false,powered=true": { "model": "unicopia:door/diamond_top_rh", "y": 90 },
|
||||||
|
"facing=west,half=upper,hinge=right,open=false,powered=true": { "model": "unicopia:door/diamond_top_rh", "y": 180 },
|
||||||
|
"facing=north,half=upper,hinge=right,open=false,powered=true": { "model": "unicopia:door/diamond_top_rh", "y": 270 },
|
||||||
|
"facing=east,half=upper,hinge=left,open=true,powered=true": { "model": "unicopia:door/diamond_top_rh", "y": 90 },
|
||||||
|
"facing=south,half=upper,hinge=left,open=true,powered=true": { "model": "unicopia:door/diamond_top_rh", "y": 180 },
|
||||||
|
"facing=west,half=upper,hinge=left,open=true,powered=true": { "model": "unicopia:door/diamond_top_rh", "y": 270 },
|
||||||
|
"facing=north,half=upper,hinge=left,open=true,powered=true": { "model": "unicopia:door/diamond_top_rh" },
|
||||||
|
"facing=east,half=upper,hinge=right,open=true,powered=true": { "model": "unicopia:door/diamond_top", "y": 270 },
|
||||||
|
"facing=south,half=upper,hinge=right,open=true,powered=true": { "model": "unicopia:door/diamond_top" },
|
||||||
|
"facing=west,half=upper,hinge=right,open=true,powered=true": { "model": "unicopia:door/diamond_top", "y": 90 },
|
||||||
|
"facing=north,half=upper,hinge=right,open=true,powered=true": { "model": "unicopia:door/diamond_top", "y": 180 }
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,6 +36,7 @@ item.cloud.large.name=Wild Cloud
|
||||||
item.mist_door.name=Cloud Door
|
item.mist_door.name=Cloud Door
|
||||||
item.library_door.name=Dutch Library Door
|
item.library_door.name=Dutch Library Door
|
||||||
item.bakery_door.name=Dutch Bakery Door
|
item.bakery_door.name=Dutch Bakery Door
|
||||||
|
item.diamond_door.name=Diamond Door
|
||||||
item.dew_drop.name=Dew Drop
|
item.dew_drop.name=Dew Drop
|
||||||
item.cloud_anvil.name=Anvilhead Anvil
|
item.cloud_anvil.name=Anvilhead Anvil
|
||||||
item.chitin_shell.name=Chitinous Shell
|
item.chitin_shell.name=Chitinous Shell
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent": "unicopia:block/door/bottom",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "unicopia:blocks/door_diamond_lower",
|
||||||
|
"top": "unicopia:blocks/door_diamond_upper"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent": "unicopia:block/door/bottom_rh",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "unicopia:blocks/door_diamond_lower",
|
||||||
|
"top": "unicopia:blocks/door_diamond_upper"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent": "unicopia:block/door/top",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "unicopia:blocks/door_diamond_lower",
|
||||||
|
"top": "unicopia:blocks/door_diamond_upper"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent": "unicopia:block/door/top_rh",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "unicopia:blocks/door_diamond_lower",
|
||||||
|
"top": "unicopia:blocks/door_diamond_upper"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "unicopia:items/door_diamond"
|
||||||
|
}
|
||||||
|
}
|
14
src/main/resources/assets/unicopia/recipes/diamond_door.json
Normal file
14
src/main/resources/assets/unicopia/recipes/diamond_door.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"##",
|
||||||
|
"##",
|
||||||
|
"##"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"#": [
|
||||||
|
{ "item": "minecraft:diamond" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"result": { "item": "unicopia:diamond_door", "count": 3 }
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 336 B |
Binary file not shown.
After Width: | Height: | Size: 397 B |
Binary file not shown.
After Width: | Height: | Size: 219 B |
Loading…
Reference in a new issue