diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java index 7b0c40198..39a8843b8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java @@ -18,7 +18,9 @@ import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; +import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -27,6 +29,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -35,6 +38,8 @@ import java.util.Random; public class BlockOilGenerator extends BlockContainerBase{ + private static final PropertyInteger META = PropertyInteger.create("meta", 0, 7); + public BlockOilGenerator(String name){ super(Material.ROCK, name); this.setHarvestLevel("pickaxe", 0); @@ -45,6 +50,17 @@ public class BlockOilGenerator extends BlockContainerBase{ } + @Override + public boolean isFullCube(IBlockState state){ + return false; + } + + @Override + public boolean isOpaqueCube(IBlockState state){ + return false; + } + + @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityOilGenerator(); @@ -77,6 +93,26 @@ public class BlockOilGenerator extends BlockContainerBase{ return true; } + @Override + public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ + int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; + + if(rotation == 0){ + world.setBlockState(pos, this.getStateFromMeta(0), 2); + } + if(rotation == 1){ + world.setBlockState(pos, this.getStateFromMeta(3), 2); + } + if(rotation == 2){ + world.setBlockState(pos, this.getStateFromMeta(1), 2); + } + if(rotation == 3){ + world.setBlockState(pos, this.getStateFromMeta(2), 2); + } + + super.onBlockPlacedBy(world, pos, state, player, stack); + } + @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.RARE; @@ -87,4 +123,10 @@ public class BlockOilGenerator extends BlockContainerBase{ this.dropInventory(world, pos); super.breakBlock(world, pos, state); } + + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + } diff --git a/src/main/resources/assets/actuallyadditions/blockstates/blockOilGenerator.json b/src/main/resources/assets/actuallyadditions/blockstates/blockOilGenerator.json index 03c8d6e46..d8d0648f6 100644 --- a/src/main/resources/assets/actuallyadditions/blockstates/blockOilGenerator.json +++ b/src/main/resources/assets/actuallyadditions/blockstates/blockOilGenerator.json @@ -1,16 +1,20 @@ { "forge_marker": 1, "defaults": { - "model": "minecraft:cube_bottom_top", + "model": "actuallyadditions:blockOilGenerator", "textures": { - "side": "actuallyadditions:blocks/blockOilGenerator", - "bottom": "actuallyadditions:blocks/blockOilGeneratorBottom", - "top": "actuallyadditions:blocks/blockOilGeneratorTop" + "particle": "actuallyadditions:blocks/blockOilGenerator" }, "transform": "forge:default-block" }, "variants": { "normal": [{}], - "inventory": [{}] + "inventory": [{}], + "meta": { + "0": { "y" : 0 }, + "1": { "y" : 180 }, + "2": { "y" : 270 }, + "3": { "y" : 90 } + } } } \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/models/block/blockOilGenerator.json b/src/main/resources/assets/actuallyadditions/models/block/blockOilGenerator.json new file mode 100644 index 000000000..7e0b9cf7b --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/models/block/blockOilGenerator.json @@ -0,0 +1,89 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "textures": { + "0": "actuallyadditions:blocks/blockOilGenerator", + "1": "actuallyadditions:blocks/blockCoalGeneratorSide", + "2": "actuallyadditions:blocks/blockCoalGeneratorTop", + "3": "actuallyadditions:blocks/blockCoalGeneratorBottom" + }, + "elements": [ + { + "name": "Cube", + "from": [ 1.0, 0.0, 1.0 ], + "to": [ 15.0, 15.0, 15.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 1.0, 1.0, 15.0, 16.0 ] }, + "east": { "texture": "#1", "uv": [ 1.0, 1.0, 15.0, 16.0 ] }, + "south": { "texture": "#1", "uv": [ 1.0, 1.0, 15.0, 16.0 ] }, + "west": { "texture": "#1", "uv": [ 1.0, 1.0, 15.0, 16.0 ] }, + "up": { "texture": "#2", "uv": [ 1.0, 1.0, 15.0, 15.0 ], "cullface": "up" }, + "down": { "texture": "#3", "uv": [ 1.0, 1.0, 15.0, 15.0 ] } + } + }, + { + "name": "Outline", + "from": [ 0.0, 0.0, 0.0 ], + "to": [ 1.0, 15.0, 1.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 15.0, 1.0, 16.0, 15.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } + } + }, + { + "name": "Cube", + "from": [ 0.0, 0.0, 15.0 ], + "to": [ 1.0, 15.0, 16.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } + } + }, + { + "name": "Cube", + "from": [ 15.0, 0.0, 15.0 ], + "to": [ 16.0, 15.0, 16.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } + } + }, + { + "name": "Cube", + "from": [ 15.0, 0.0, 0.0 ], + "to": [ 16.0, 15.0, 1.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 0.0, 1.0, 1.0, 15.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } + } + }, + { + "name": "Cube", + "from": [ 0.0, 15.0, 0.0 ], + "to": [ 16.0, 16.0, 16.0 ], + "faces": { + "north": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "east": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "south": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "west": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, + "up": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, + "down": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockOilGenerator.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockOilGenerator.png index d1618801b..831f0f8d1 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockOilGenerator.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockOilGenerator.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockOilGenerator.png.mcmeta b/src/main/resources/assets/actuallyadditions/textures/blocks/blockOilGenerator.png.mcmeta new file mode 100644 index 000000000..b5b91e18a --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/textures/blocks/blockOilGenerator.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": + { + "frametime": 3 + } +} \ No newline at end of file