Added slime layer blocks

This commit is contained in:
Sollace 2019-03-09 15:42:11 +02:00
parent 17aaeec7dc
commit 1a66fdabff
16 changed files with 323 additions and 4 deletions

View file

@ -32,10 +32,10 @@ public class BlockChitin extends Block {
setTranslationKey(name);
setRegistryName(domain, name);
setDefaultState(blockState.getBaseState().withProperty(COVERING, Covering.UNCOVERED));
setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
setHardness(50);
setResistance(2000);
setDefaultState(blockState.getBaseState().withProperty(COVERING, Covering.UNCOVERED));
}
@Override

View file

@ -0,0 +1,69 @@
package com.minelittlepony.unicopia.block;
import java.util.Random;
import net.minecraft.block.BlockSnow;
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.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockSlimeLayer extends BlockSnow {
public BlockSlimeLayer(String domain, String name) {
setTranslationKey(name);
setRegistryName(domain, name);
setSoundType(SoundType.SLIME);
setCreativeTab(CreativeTabs.DECORATIONS);
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@Deprecated
public Material getMaterial(IBlockState state) {
return Material.CLAY;
}
@Override
public MapColor getMapColor(IBlockState state, IBlockAccess world, BlockPos pos) {
return MapColor.GRASS;
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Items.SLIME_BALL;
}
@Deprecated
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public void onEntityWalk(World world, BlockPos pos, Entity entity) {
float factor = getMotionFactor(world.getBlockState(pos));
entity.motionX *= factor;
entity.motionY *= factor;
entity.motionZ *= factor;
}
protected float getMotionFactor(IBlockState state) {
return 1/state.getValue(LAYERS);
}
}

View file

@ -0,0 +1,36 @@
package com.minelittlepony.unicopia.forgebullshit;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSnow;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemSnow;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
* A fixed ItemSnow class
*/
@FUF(reason = "GG Forge. I have to undo your changes so this class will work again.")
public class UnFuckedItemSnow extends ItemSnow {
public UnFuckedItemSnow(Block block) {
super(block);
}
@Override
public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) {
IBlockState state = world.getBlockState(pos);
// Check explicitly for the maximum layers.
// Without this layered blocks get stuck on the second layer because of a change introduced with Forge's patches.
if (state.getBlock() instanceof BlockSnow && state.getValue(BlockSnow.LAYERS) < 8) {
return true;
}
// return (state.getBlock() != net.minecraft.init.Blocks.SNOW_LAYER || ((Integer)state.getValue(BlockSnow.LAYERS)) > 7) ? super.canPlaceBlockOnSide(world, pos, side, player, stack) : true;
return super.canPlaceBlockOnSide(world, pos, side, player, stack);
}
}

View file

@ -8,6 +8,7 @@ import com.minelittlepony.unicopia.block.BlockFruitLeaves;
import com.minelittlepony.unicopia.block.BlockGlowingGem;
import com.minelittlepony.unicopia.block.BlockGrowingCuccoon;
import com.minelittlepony.unicopia.block.BlockHiveWall;
import com.minelittlepony.unicopia.block.BlockSlimeLayer;
import com.minelittlepony.unicopia.block.BlockCloudAnvil;
import com.minelittlepony.unicopia.block.BlockCloudBanister;
import com.minelittlepony.unicopia.block.BlockCloudSlab;
@ -75,6 +76,7 @@ public class UBlocks {
public static final BlockHiveWall hive = new BlockHiveWall(Unicopia.MODID, "hive");
public static final BlockChitin chitin = new BlockChitin(Unicopia.MODID, "chitin_block");
public static final BlockGrowingCuccoon cuccoon = new BlockGrowingCuccoon(Unicopia.MODID, "cuccoon");
public static final BlockSlimeLayer slime_layer = new BlockSlimeLayer(Unicopia.MODID, "slime_layer");
public static final Block sugar_block = new BlockSugar(Unicopia.MODID, "sugar_block");
public static final UPot flower_pot = new UPot(Unicopia.MODID, "flower_pot");
@ -95,7 +97,7 @@ public class UBlocks {
packed_cloud_slab, packed_cloud_slab.doubleSlab,
cloud_fence, cloud_banister,
mist_door, library_door, bakery_door,
hive, chitin, cuccoon,
hive, chitin, cuccoon, slime_layer,
anvil, cloud_farmland,
sugar_block, flower_pot,
alfalfa,

View file

@ -58,6 +58,7 @@ import com.minelittlepony.unicopia.forgebullshit.BuildInTexturesBakery;
import com.minelittlepony.unicopia.forgebullshit.ItemModels;
import com.minelittlepony.unicopia.forgebullshit.OreReplacer;
import com.minelittlepony.unicopia.forgebullshit.RegistryLockSpinner;
import com.minelittlepony.unicopia.forgebullshit.UnFuckedItemSnow;
public class UItems {
public static final ItemApple red_apple = new ItemApple("minecraft", "apple");
@ -110,6 +111,8 @@ public class UItems {
.setRegistryName(Unicopia.MODID, "chitin_block");
public static final Item cuccoon = new ItemBlock(UBlocks.cuccoon)
.setRegistryName(Unicopia.MODID, "cuccoon");
public static final Item slime_layer = new UnFuckedItemSnow(UBlocks.slime_layer)
.setRegistryName(Unicopia.MODID, "slime_layer");
public static final Item mist_door = new ItemDoor(UBlocks.mist_door)
.setTranslationKey("mist_door")
@ -246,7 +249,7 @@ public class UItems {
cloudsdale_tomato, tomato_seeds, tomato, moss,
hive, chitin_shell, chitin, cuccoon,
hive, chitin_shell, chitin, cuccoon, slime_layer,
apple_seeds, apple_leaves,
@ -279,7 +282,7 @@ public class UItems {
cereal, sugar_cereal, sugar_block,
tomato_seeds,
hive, chitin_shell, chitin, cuccoon,
hive, chitin_shell, chitin, cuccoon, slime_layer,
apple_seeds, apple_leaves,

View file

@ -1,5 +1,6 @@
package com.minelittlepony.unicopia.spell;
import com.minelittlepony.unicopia.init.UBlocks;
import com.minelittlepony.unicopia.init.USounds;
import com.minelittlepony.unicopia.player.IPlayer;
import com.minelittlepony.unicopia.player.PlayerSpeciesList;
@ -78,6 +79,10 @@ public class SpellChangelingTrap extends AbstractSpell implements ITossedEffect,
}
}
if (caster.getWorld().isAirBlock(origin) || caster.getWorld().getBlockState(origin).getBlock().isReplaceable(caster.getWorld(), origin)) {
caster.getWorld().setBlockState(origin, UBlocks.slime_layer.getDefaultState());
}
entity.motionX = 0;
entity.motionY = 0;
entity.motionZ = 0;

View file

@ -0,0 +1,12 @@
{
"variants": {
"layers=1": { "model": "unicopia:slime/layer_2" },
"layers=2": { "model": "unicopia:slime/layer_4" },
"layers=3": { "model": "unicopia:slime/layer_6" },
"layers=4": { "model": "unicopia:slime/layer_8" },
"layers=5": { "model": "unicopia:slime/layer_10" },
"layers=6": { "model": "unicopia:slime/layer_12" },
"layers=7": { "model": "unicopia:slime/layer_14" },
"layers=8": { "model": "minecraft:slime" }
}
}

View file

@ -18,6 +18,7 @@ tile.hive.name=Hive Wall
tile.chitin_block.name=Chitin Block
tile.chitin_shell.name=Chitin Shell
tile.cuccoon.name=Cocoon
tile.slime_layer.name=Slime
tile.apple_leaves.name=Apple Leaves
tile.apple_sapling.name=Apple Seeds

View file

@ -0,0 +1,30 @@
{
"textures": {
"particle": "minecraft:blocks/slime",
"texture": "minecraft:blocks/slime"
},
"elements": [
{ "from": [ 3, 3, 3 ],
"to": [ 13, 9, 13 ],
"faces": {
"down": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"up": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"north": { "uv": [ 3, 3, 9, 13 ], "texture": "#texture" },
"south": { "uv": [ 3, 3, 9, 13 ], "texture": "#texture" },
"west": { "uv": [ 3, 3, 9, 13 ], "texture": "#texture" },
"east": { "uv": [ 3, 3, 9, 13 ], "texture": "#texture" }
}
},
{ "from": [ 0, 0, 0 ],
"to": [ 16, 10, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
"north": { "uv": [ 0, 6, 16, 16 ], "texture": "#texture", "cullface": "north" },
"south": { "uv": [ 0, 6, 16, 16 ], "texture": "#texture", "cullface": "south" },
"west": { "uv": [ 0, 6, 16, 16 ], "texture": "#texture", "cullface": "west" },
"east": { "uv": [ 0, 6, 16, 16 ], "texture": "#texture", "cullface": "east" }
}
}
]
}

View file

@ -0,0 +1,30 @@
{
"textures": {
"particle": "minecraft:blocks/slime",
"texture": "minecraft:blocks/slime"
},
"elements": [
{ "from": [ 3, 3, 3 ],
"to": [ 13, 11, 13 ],
"faces": {
"down": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"up": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"north": { "uv": [ 3, 3, 11, 13 ], "texture": "#texture" },
"south": { "uv": [ 3, 3, 11, 13 ], "texture": "#texture" },
"west": { "uv": [ 3, 3, 11, 13 ], "texture": "#texture" },
"east": { "uv": [ 3, 3, 11, 13 ], "texture": "#texture" }
}
},
{ "from": [ 0, 0, 0 ],
"to": [ 16, 12, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
"north": { "uv": [ 0, 4, 16, 16 ], "texture": "#texture", "cullface": "north" },
"south": { "uv": [ 0, 4, 16, 16 ], "texture": "#texture", "cullface": "south" },
"west": { "uv": [ 0, 4, 16, 16 ], "texture": "#texture", "cullface": "west" },
"east": { "uv": [ 0, 4, 16, 16 ], "texture": "#texture", "cullface": "east" }
}
}
]
}

View file

@ -0,0 +1,30 @@
{
"textures": {
"particle": "minecraft:blocks/slime",
"texture": "minecraft:blocks/slime"
},
"elements": [
{ "from": [ 3, 3, 3 ],
"to": [ 13, 13, 13 ],
"faces": {
"down": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"up": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"north": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"south": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"west": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"east": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" }
}
},
{ "from": [ 0, 0, 0 ],
"to": [ 16, 14, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
"north": { "uv": [ 0, 2, 16, 16 ], "texture": "#texture" },
"south": { "uv": [ 0, 2, 16, 16 ], "texture": "#texture" },
"west": { "uv": [ 0, 2, 16, 16 ], "texture": "#texture" },
"east": { "uv": [ 0, 2, 16, 16 ], "texture": "#texture" }
}
}
]
}

View file

@ -0,0 +1,19 @@
{ "parent": "block/thin_block",
"textures": {
"particle": "minecraft:blocks/slime",
"texture": "minecraft:blocks/slime"
},
"elements": [
{ "from": [ 0, 0, 0 ],
"to": [ 16, 2, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
"north": { "uv": [ 0, 14, 16, 16 ], "texture": "#texture", "cullface": "north" },
"south": { "uv": [ 0, 14, 16, 16 ], "texture": "#texture", "cullface": "south" },
"west": { "uv": [ 0, 14, 16, 16 ], "texture": "#texture", "cullface": "west" },
"east": { "uv": [ 0, 14, 16, 16 ], "texture": "#texture", "cullface": "east" }
}
}
]
}

View file

@ -0,0 +1,19 @@
{
"textures": {
"particle": "minecraft:blocks/slime",
"texture": "minecraft:blocks/slime"
},
"elements": [
{ "from": [ 0, 0, 0 ],
"to": [ 16, 4, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
"north": { "uv": [ 0, 12, 16, 16 ], "texture": "#texture", "cullface": "north" },
"south": { "uv": [ 0, 12, 16, 16 ], "texture": "#texture", "cullface": "south" },
"west": { "uv": [ 0, 12, 16, 16 ], "texture": "#texture", "cullface": "west" },
"east": { "uv": [ 0, 12, 16, 16 ], "texture": "#texture", "cullface": "east" }
}
}
]
}

View file

@ -0,0 +1,30 @@
{
"textures": {
"particle": "minecraft:blocks/slime",
"texture": "minecraft:blocks/slime"
},
"elements": [
{ "from": [ 3, 3, 3 ],
"to": [ 13, 5, 13 ],
"faces": {
"down": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"up": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"north": { "uv": [ 3, 3, 5, 13 ], "texture": "#texture" },
"south": { "uv": [ 3, 3, 5, 13 ], "texture": "#texture" },
"west": { "uv": [ 3, 3, 5, 13 ], "texture": "#texture" },
"east": { "uv": [ 3, 3, 5, 13 ], "texture": "#texture" }
}
},
{ "from": [ 0, 0, 0 ],
"to": [ 16, 6, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
"north": { "uv": [ 0, 10, 16, 16 ], "texture": "#texture", "cullface": "north" },
"south": { "uv": [ 0, 10, 16, 16 ], "texture": "#texture", "cullface": "south" },
"west": { "uv": [ 0, 10, 16, 16 ], "texture": "#texture", "cullface": "west" },
"east": { "uv": [ 0, 10, 16, 16 ], "texture": "#texture", "cullface": "east" }
}
}
]
}

View file

@ -0,0 +1,30 @@
{
"textures": {
"particle": "minecraft:blocks/slime",
"texture": "minecraft:blocks/slime"
},
"elements": [
{ "from": [ 3, 3, 3 ],
"to": [ 13, 7, 13 ],
"faces": {
"down": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"up": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
"north": { "uv": [ 3, 3, 7, 13 ], "texture": "#texture" },
"south": { "uv": [ 3, 3, 7, 13 ], "texture": "#texture" },
"west": { "uv": [ 3, 3, 7, 13 ], "texture": "#texture" },
"east": { "uv": [ 3, 3, 7, 13 ], "texture": "#texture" }
}
},
{ "from": [ 0, 0, 0 ],
"to": [ 16, 8, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
"north": { "uv": [ 0, 8, 16, 16 ], "texture": "#texture", "cullface": "north" },
"south": { "uv": [ 0, 8, 16, 16 ], "texture": "#texture", "cullface": "south" },
"west": { "uv": [ 0, 8, 16, 16 ], "texture": "#texture", "cullface": "west" },
"east": { "uv": [ 0, 8, 16, 16 ], "texture": "#texture", "cullface": "east" }
}
}
]
}

View file

@ -0,0 +1,3 @@
{
"parent": "unicopia:block/slime/layer_2"
}