Commit 18c850ea authored by primetoxinz's avatar primetoxinz

Partially implemented Steel Saw.

parent 7c4ce455
......@@ -34,8 +34,8 @@ minecraft {
}
repositories {
maven { url 'http://dvs1.progwml6.com/files/maven' }
maven { url "http://blamejared.com/maven" }
maven { url 'http://dvs1.progwml6.com/files/maven' }
maven { url "http://maven.amadornes.com/" }
maven { url "http://www.ryanliptak.com/maven/" }
mavenCentral()
......
......@@ -6,7 +6,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IMechanicalPower {
public interface IMechanicalPower {
int getMechanicalOutput(EnumFacing facing);
int getMechanicalInput(EnumFacing facing);
......@@ -44,4 +44,5 @@ public interface IMechanicalPower {
if (getBlockType() instanceof IOverpower)
((IOverpower) getBlockType()).overpower(getWorld(), getPos());
}
}
......@@ -21,16 +21,19 @@ public class ContainerSteelAnvil extends Container {
public InventoryCrafting craftMatrix;
public IInventory craftResult;
public InventoryPlayer inventoryPlayer;
public EntityPlayer player;
private TileEntitySteelAnvil te;
private IItemHandler handler;
public ContainerSteelAnvil(InventoryPlayer player, TileEntitySteelAnvil te) {
public ContainerSteelAnvil(InventoryPlayer inventory, TileEntitySteelAnvil te) {
this.te = te;
handler = te.inventory;
inventoryPlayer = player;
craftMatrix = new InventorySteelCrafting(this,te);
this.handler = te.inventory;
this.inventoryPlayer = inventory;
this.player = inventory.player;
craftMatrix = new InventorySteelCrafting(this, te);
craftResult = new InventorySteelCraftingResult(te);
this.addSlotToContainer(new SlotCraftingItemHandler(player.player, craftMatrix, craftResult, 0, 124, 44));
this.addSlotToContainer(new SlotCraftingItemHandler(player, craftMatrix, craftResult, 0, 124, 44));
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
this.addSlotToContainer(new Slot(craftMatrix, j + i * 4, 12 + j * 18, 17 + i * 18));
......@@ -38,11 +41,11 @@ public class ContainerSteelAnvil extends Container {
}
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 102 + i * 18));
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 102 + i * 18));
}
}
for (int i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 160));
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 160));
}
this.onCraftMatrixChanged(craftMatrix);
}
......
package betterwithmods.client.model;
import betterwithmods.common.blocks.tile.gen.IColor;
import betterwithmods.common.blocks.mechanical.tile.IColor;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
......
package betterwithmods.client.model;
import betterwithmods.common.blocks.tile.gen.TileEntityWindmillVertical;
import betterwithmods.common.blocks.mechanical.tile.TileEntityWindmillVertical;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
......
package betterwithmods.client.model;
import betterwithmods.common.blocks.tile.gen.TileEntityWindmillHorizontal;
import betterwithmods.common.blocks.mechanical.tile.TileEntityWindmillHorizontal;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
......
package betterwithmods.client.model;
import betterwithmods.common.BWMBlocks;
import betterwithmods.common.blocks.mechanical.IBlockActive;
import betterwithmods.common.blocks.mechanical.tile.TileSteelSaw;
import betterwithmods.util.DirUtils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
public class TESRSteelSaw extends TileEntitySpecialRenderer<TileSteelSaw> {
@Override
public void render(TileSteelSaw te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
IBlockState state = getWorld().getBlockState(te.getPos());
boolean active = state.getValue(IBlockActive.ACTIVE);
EnumFacing.Axis axis = state.getValue(DirUtils.AXIS);
GlStateManager.pushAttrib();
GlStateManager.pushMatrix();
{
GlStateManager.translate(x, y, z);
GlStateManager.disableRescaleNormal();
GlStateManager.pushMatrix();
{
IBlockState axle = BWMBlocks.STEEL_AXLE.getDefaultState().withProperty(DirUtils.AXIS, axis).withProperty(IBlockActive.ACTIVE, active);
renderBlock(te, axle);
}
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
{
GlStateManager.translate(0.5, 0.5, (axis == EnumFacing.Axis.Z ? -1 : 1) * 0.5);
if (active) {
long angle = (axis != EnumFacing.Axis.Z ? -1 : 1) * (System.currentTimeMillis() / 2) % 360;
switch (axis) {
case X:
GlStateManager.rotate(angle, 1, 0, 0);
break;
case Y:
GlStateManager.rotate(angle, 0, 1, 0);
break;
case Z:
GlStateManager.rotate(angle, 0, 0, 1);
break;
}
}
renderBlock(te, state);
}
GlStateManager.popMatrix();
}
GlStateManager.popMatrix();
GlStateManager.popAttrib();
}
public void renderBlock(TileSteelSaw te, IBlockState state) {
RenderHelper.disableStandardItemLighting();
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
if (Minecraft.isAmbientOcclusionEnabled()) {
GlStateManager.shadeModel(GL11.GL_SMOOTH);
} else {
GlStateManager.shadeModel(GL11.GL_FLAT);
}
World world = te.getWorld();
GlStateManager.translate(-te.getPos().getX(), -te.getPos().getY(), -te.getPos().getZ());
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
IBakedModel model = dispatcher.getModelForState(state);
dispatcher.getBlockModelRenderer().renderModel(world, model, state, te.getPos(), bufferBuilder, true);
tessellator.draw();
RenderHelper.enableStandardItemLighting();
}
@Override
public boolean isGlobalRenderer(TileSteelSaw te) {
return true;
}
}
package betterwithmods.client.model;
import betterwithmods.common.blocks.tile.gen.TileEntityWindmillVertical;
import betterwithmods.common.blocks.mechanical.tile.TileEntityWindmillVertical;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.EnumFacing;
......
package betterwithmods.client.model;
import betterwithmods.common.blocks.tile.gen.TileEntityWaterwheel;
import betterwithmods.common.blocks.mechanical.tile.TileEntityWaterwheel;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.EnumFacing;
......
package betterwithmods.client.model;
import betterwithmods.common.blocks.tile.gen.TileEntityWindmillHorizontal;
import betterwithmods.common.blocks.mechanical.tile.TileEntityWindmillHorizontal;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.EnumFacing;
......
......@@ -6,10 +6,6 @@ import betterwithmods.common.blocks.mechanical.*;
import betterwithmods.common.blocks.mechanical.tile.*;
import betterwithmods.common.blocks.mini.*;
import betterwithmods.common.blocks.tile.*;
import betterwithmods.common.blocks.tile.gen.TileEntityCreativeGen;
import betterwithmods.common.blocks.tile.gen.TileEntityWaterwheel;
import betterwithmods.common.blocks.tile.gen.TileEntityWindmillHorizontal;
import betterwithmods.common.blocks.tile.gen.TileEntityWindmillVertical;
import betterwithmods.common.items.ItemHempSeed;
import betterwithmods.common.items.ItemSimpleSlab;
import betterwithmods.proxy.ClientProxy;
......@@ -41,7 +37,7 @@ public final class BWMBlocks {
public static final Block ROPE = new BlockRope().setRegistryName("rope");
public static final Block SINGLE_MACHINES = new BlockMechMachines().setRegistryName("single_machine");
public static final Block WOODEN_AXLE = new BlockAxle(EnumTier.WOOD, 1, 1, 3).setRegistryName("wooden_axle");
public static final Block STEEL_AXLE = new BlockAxle(EnumTier.STEEL, 1, 2, 5).setRegistryName("steel_axle");
public static final Block STEEL_AXLE = new BlockAxle(EnumTier.STEEL, 1, 3, 5).setRegistryName("steel_axle");
public static final Block WOODEN_GEARBOX = new BlockGearbox(1, EnumTier.WOOD).setRegistryName("wooden_gearbox");
public static final Block STEEL_GEARBOX = new BlockGearbox(3, EnumTier.STEEL).setRegistryName("steel_gearbox");
public static final Block WOODEN_BROKEN_GEARBOX = new BlockBrokenGearbox(EnumTier.WOOD).setRegistryName("wooden_broken_gearbox");
......@@ -98,6 +94,7 @@ public final class BWMBlocks {
public static final Block NETHER_GROWTH = new BlockNetherGrowth().setRegistryName("nether_growth");
public static final Block BEACON = new BlockBeacon();
public static final Block STEEL_BLOCK = new BlockSteel().setRegistryName("steel_block");
public static final Block STEEL_SAW = new BlockSteelSaw().setRegistryName("steel_saw");
private static final List<Block> BLOCKS = new ArrayList<>();
......@@ -172,7 +169,14 @@ public final class BWMBlocks {
registerBlock(STAKE);
registerBlock(NETHER_GROWTH, new ItemBlockSpore(NETHER_GROWTH));
registerBlock(BEACON);
registerBlock(STEEL_BLOCK);
registerBlock(STEEL_BLOCK, new ItemBlockMeta(STEEL_BLOCK) {
@Override
public String getUnlocalizedName(ItemStack stack) {
return getUnlocalizedName();
}
});
registerBlock(STEEL_SAW, new ItemSteelSaw(STEEL_SAW));
}
public static void registerTileEntities() {
......@@ -200,6 +204,7 @@ public final class BWMBlocks {
GameRegistry.registerTileEntity(TileSaw.class, "bwm.saw");
GameRegistry.registerTileEntity(TilePump.class, "bwm.pump");
GameRegistry.registerTileEntity(TileCrank.class, "bwm.crank");
GameRegistry.registerTileEntity(TileSteelSaw.class, "bwm.steel_saw");
}
// /**
......
......@@ -22,6 +22,7 @@ import betterwithmods.module.ModuleLoader;
import betterwithmods.module.compat.Quark;
import betterwithmods.module.compat.Rustic;
import betterwithmods.module.compat.bop.BiomesOPlenty;
import betterwithmods.module.gameplay.CraftingRecipes;
import betterwithmods.module.hardcore.*;
import betterwithmods.util.ColorUtils;
import betterwithmods.util.DispenserBehaviorDynamite;
......@@ -237,19 +238,20 @@ public class BWRegistry {
public static void registerRecipes() {
ForgeRegistry<IRecipe> reg = (ForgeRegistry<IRecipe>) ForgeRegistries.RECIPES;
replaceIRecipe(CraftingRecipes.class, reg);
replaceIRecipe(HCTools.class, reg);
replaceIRecipe(HCDiamond.class, reg);
replaceIRecipe(HCLumber.class, reg);
replaceIRecipe(HCOres.class, reg);
replaceIRecipe(HCRedstone.class, reg);
replaceIRecipe(HCTorches.class, reg);
replaceIRecipe(HCFishing.class, reg);
replaceIRecipe(BiomesOPlenty.class, reg);
replaceIRecipe(Quark.class, reg);
replaceIRecipe(Rustic.class, reg);
replaceIRecipe(HCFishing.class, reg);
registerAnvilRecipes(reg);
registerAnvilRecipes(reg);
}
private static void retrieveRecipes(String category, ForgeRegistry<IRecipe> reg) {
......
package betterwithmods.common.blocks;
import betterwithmods.api.block.IMultiVariants;
import betterwithmods.common.BWSounds;
import betterwithmods.common.items.ItemMaterial;
import betterwithmods.common.items.tools.ItemHacksaw;
......@@ -11,6 +12,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
......@@ -18,6 +20,7 @@ import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
......@@ -25,7 +28,10 @@ import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockSteel extends BWMBlock {
import javax.annotation.Nullable;
import java.util.List;
public class BlockSteel extends BWMBlock implements IMultiVariants{
public static final PropertyInteger HEIGHT = PropertyInteger.create("height", 0, 15);
......@@ -42,6 +48,11 @@ public class BlockSteel extends BWMBlock {
return new AxisAlignedBB(0,0,0,1, (16-state.getValue(HEIGHT))/16d,1);
}
@Override
public int damageDropped(IBlockState state) {
return state.getValue(HEIGHT);
}
@Override
public boolean isFullBlock(IBlockState state) {
return state.getValue(HEIGHT) == 0;
......@@ -57,7 +68,6 @@ public class BlockSteel extends BWMBlock {
return state.getValue(HEIGHT) == 0;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, HEIGHT);
......@@ -88,6 +98,7 @@ public class BlockSteel extends BWMBlock {
worldIn.playSound(null,pos,BWSounds.METAL_HACKSAW, SoundCategory.BLOCKS,1.0f,0.80f);
worldIn.playSound(null,pos, SoundEvents.ENTITY_GHAST_SCREAM, SoundCategory.BLOCKS,0.5f,worldIn.rand.nextFloat() * 0.5f + worldIn.rand.nextFloat()*0.5f);
}
worldIn.spawnParticle(EnumParticleTypes.FLAME,pos.getX()-1,pos.getY()+1, pos.getZ()-1,0,0,0);
stack.damageItem(1,playerIn);
InvUtils.ejectStackWithOffset(worldIn, pos, ItemMaterial.getMaterial(ItemMaterial.EnumMaterial.PLATE_STEEL));
}
......@@ -110,4 +121,14 @@ public class BlockSteel extends BWMBlock {
public int getHarvestLevel(IBlockState state) {
return 4;
}
@Override
public String[] getVariants() {
return new String[]{"height=0","height=1","height=2","height=3","height=4","height=5","height=6","height=7","height=8","height=9","height=10","height=11","height=12","height=13","height=14","height=15"};
}
@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, ITooltipFlag advanced) {
tooltip.add(String.format("Height:%s", 16-stack.getMetadata()));
}
}
package betterwithmods.common.blocks;
import betterwithmods.common.BWMBlocks;
import betterwithmods.common.blocks.mechanical.IBlockActive;
import betterwithmods.util.DirUtils;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class ItemSteelSaw extends ItemBlock {
public ItemSteelSaw(Block block) {
super(block);
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
IBlockState state = worldIn.getBlockState(pos);
EnumFacing.Axis axis = state.getValue(DirUtils.AXIS);
if (state.getBlock() == BWMBlocks.STEEL_AXLE) {
worldIn.setBlockState(pos, BWMBlocks.STEEL_SAW.getDefaultState().withProperty(DirUtils.AXIS,axis).withProperty(IBlockActive.ACTIVE,false));
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
}
......@@ -2,7 +2,7 @@ package betterwithmods.common.blocks.mechanical;
import betterwithmods.client.BWCreativeTabs;
import betterwithmods.common.blocks.BWMBlock;
import betterwithmods.common.blocks.tile.gen.TileEntityCreativeGen;
import betterwithmods.common.blocks.mechanical.tile.TileEntityCreativeGen;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
......
......@@ -56,6 +56,8 @@ public class BlockSaw extends BWMBlock implements IBlockActive, IOverpower {
this.setDefaultState(this.blockState.getBaseState().withProperty(DirUtils.FACING, EnumFacing.UP));
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
......@@ -294,8 +296,8 @@ public class BlockSaw extends BWMBlock implements IBlockActive, IOverpower {
if (block instanceof IDamageDropped)
harvestMeta = ((IDamageDropped) block).damageDropped(state, world, pos2);
if (SawManager.INSTANCE.contains(block, harvestMeta)) {
List<ItemStack> products = SawManager.INSTANCE.getProducts(block, harvestMeta);
if (SawManager.WOOD_SAW.contains(block, harvestMeta)) {
List<ItemStack> products = SawManager.WOOD_SAW.getProducts(block, harvestMeta);
world.setBlockToAir(pos2);
if (!products.isEmpty())
InvUtils.ejectStackWithOffset(world, pos2, products);
......
package betterwithmods.common.blocks.mechanical;
import betterwithmods.common.blocks.EnumTier;
import betterwithmods.common.blocks.mechanical.tile.TileAxle;
import betterwithmods.common.blocks.mechanical.tile.TileSteelSaw;
import betterwithmods.util.DirUtils;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.Optional;
import static betterwithmods.util.DirUtils.AXIS;
public class BlockSteelSaw extends BlockAxle {
public BlockSteelSaw() {
super(EnumTier.STEEL, 1, 3, 5);
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
}
@Nullable
@Override
public TileEntity createTileEntity(World world, IBlockState state) {
return new TileSteelSaw();
}
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
return getDefaultState().withProperty(AXIS, facing.getAxis());
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, DirUtils.AXIS, ACTIVE);
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(ACTIVE, (meta & 1) == 1).withProperty(DirUtils.AXIS, DirUtils.getAxis(meta >> 1));
}
@Override
public int getMetaFromState(IBlockState state) {
int active = state.getValue(ACTIVE) ? 1 : 0;
int axis = state.getValue(DirUtils.AXIS).ordinal();
return active | axis << 1;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.INVISIBLE;
}
public Optional<TileAxle> withTile(World world, BlockPos pos) {
return Optional.of(getTile(world, pos));
}
public TileAxle getTile(World world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileAxle)
return (TileAxle) tile;
return null;
}
@Override
public void overpower(World world, BlockPos pos) {
}
}
package betterwithmods.common.blocks.mechanical;
import betterwithmods.common.BWMItems;
import betterwithmods.common.blocks.tile.gen.TileEntityWaterwheel;
import betterwithmods.common.blocks.mechanical.tile.TileEntityWaterwheel;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
......
package betterwithmods.common.blocks.mechanical;
import betterwithmods.common.BWMItems;
import betterwithmods.common.blocks.tile.gen.IColor;
import betterwithmods.common.blocks.tile.gen.TileEntityWindmillHorizontal;
import betterwithmods.common.blocks.tile.gen.TileEntityWindmillVertical;
import betterwithmods.common.blocks.mechanical.tile.IColor;
import betterwithmods.common.blocks.mechanical.tile.TileEntityWindmillHorizontal;
import betterwithmods.common.blocks.mechanical.tile.TileEntityWindmillVertical;
import betterwithmods.util.ColorUtils;
import betterwithmods.util.DirUtils;
import net.minecraft.block.material.Material;
......
package betterwithmods.common.blocks.tile.gen;
package betterwithmods.common.blocks.mechanical.tile;
public interface IColor {
boolean dyeBlade(int color);
......
package betterwithmods.common.blocks.mechanical.tile;
import betterwithmods.api.block.IOverpower;
import betterwithmods.api.capabilities.CapabilityAxle;
import betterwithmods.api.capabilities.CapabilityMechanicalPower;
import betterwithmods.api.tile.IAxle;
......@@ -69,7 +70,7 @@ public class TileAxle extends TileBasic implements IMechanicalPower, IAxle {
findPower = power;
}
}
if (axle == null){
if (axle == null) {
findSignal = getMaximumSignal();
}
}
......@@ -80,13 +81,13 @@ public class TileAxle extends TileBasic implements IMechanicalPower, IAxle {
setPower(findPower);
if (sources >= 2) {
getBlock().overpower(world, pos);
((IOverpower) getBlockType()).overpower(world, pos);
return;
}
byte newSignal = 0;
if (findSignal > signal) {
if (findSignal == 1) {
getBlock().overpower(world, pos);
((IOverpower) getBlockType()).overpower(world, pos);
}
if (power > 0)
newSignal = (byte) (findSignal - 1);
......@@ -103,9 +104,9 @@ public class TileAxle extends TileBasic implements IMechanicalPower, IAxle {
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setByte("signal", signal);
compound.setInteger("power", power);
compound.setByte("maxSignal",maxSignal);
compound.setInteger("maxPower",maxPower);
compound.setInteger("minPower",minPower);
compound.setByte("maxSignal", maxSignal);
compound.setInteger("maxPower", maxPower);
compound.setInteger("minPower", minPower);
return super.writeToNBT(compound);
}
......@@ -182,16 +183,12 @@ public class TileAxle extends TileBasic implements IMechanicalPower, IAxle {
}
public EnumFacing[] getDirections() {
return getBlock().getAxisDirections(world.getBlockState(pos));
return ((BlockAxle) getBlockType()).getAxisDirections(world.getBlockState(pos));
}
@Override
public EnumFacing.Axis getAxis() {
return getBlock().getAxis(world.getBlockState(pos));
}
public BlockAxle getBlock() {
return (BlockAxle) this.getBlockType();
return ((BlockAxle) getBlockType()).getAxis(world.getBlockState(pos));
}
public void setSignal(byte signal) {
......@@ -205,10 +202,10 @@ public class TileAxle extends TileBasic implements IMechanicalPower, IAxle {
@Override
public void markDirty() {
super.markDirty();
getBlock().setActive(world, pos, power > 0);
for(EnumFacing facing: getDirections()) {
if(!MechanicalUtil.isAxle(world,pos.offset(facing),facing.getOpposite())) {
world.neighborChanged(pos.offset(facing),getBlock(),pos);
((BlockAxle) getBlockType()).setActive(world, pos, power > 0);
for (EnumFacing facing : getDirections()) {
if (!MechanicalUtil.isAxle(world, pos.offset(facing), facing.getOpposite())) {
world.neighborChanged(pos.offset(facing), ((BlockAxle) getBlockType()), pos);
}
}
}
......
package betterwithmods.common.blocks.tile.gen;
package betterwithmods.common.blocks.mechanical.tile;
import betterwithmods.api.capabilities.CapabilityMechanicalPower;
import betterwithmods.api.tile.IMechanicalPower;
......
package betterwithmods.common.blocks.mechanical.tile;
import net.minecraft.util.ITickable;
public abstract class TileAxleMachine extends TileAxle implements ITickable {
}
package betterwithmods.common.blocks.tile.gen;
package betterwithmods.common.blocks.mechanical.tile;
import betterwithmods.api.capabilities.CapabilityMechanicalPower;
import betterwithmods.api.tile.IAxle;
......@@ -35,6 +35,9 @@ public class TileEntityCreativeGen extends TileEntity implements IMechanicalPowe
IAxle axle = MechanicalUtil.getAxle(world,pos.offset(facing),facing.getOpposite());
if(axle != null)
return axle.getMaximumInput();
IMechanicalPower power = MechanicalUtil.getMechanicalPower(world,pos.offset(facing),facing.getOpposite());
if(power != null)
return power.getMaximumInput(facing.getOpposite());
return 0;
}
......
package betterwithmods.common.blocks.tile.gen;
package betterwithmods.common.blocks.mechanical.tile;
import betterwithmods.common.BWMBlocks;
import betterwithmods.common.blocks.mechanical.BlockWaterwheel;