Skip to content

Commit

Permalink
Ported to 1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bdew committed Jun 24, 2014
1 parent 0a216a1 commit 084e6dc
Show file tree
Hide file tree
Showing 37 changed files with 147 additions and 121 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,3 +8,4 @@
/.gradle
/*.iml
/*.ipr
/.idea/libraries/Gradle__*
1 change: 0 additions & 1 deletion .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 12 additions & 6 deletions build.gradle
Expand Up @@ -9,19 +9,23 @@ buildscript {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}

apply plugin: 'forge'
apply plugin: 'scala'
apply plugin: 'forge'

version = "0.9.0"
ext.bdlibver = "1.2.3.48"
version = "0.9.1"
ext.bdlibver = "1.3.0.10"
ext.apiVer = version
ext.versuffix = "mc164"
ext.versuffix = "mc172"

if (project.hasProperty('buildnum')) {
project.version = project.version + '.' + project.buildnum
Expand All @@ -35,7 +39,7 @@ group = "net.bdew"
archivesBaseName = "pressure"

minecraft {
version = "1.6.4-9.11.1.964"
version = "1.7.2-10.12.2.1126"
replace("BDLIB_VER", project.bdlibver)
replace("PRESSURE_VER", project.version)
replace("PRESSURE_APIVER", project.apiVer)
Expand All @@ -51,6 +55,8 @@ repositories {
}

dependencies {
compile "codechicken:CodeChickenLib:1.7.2-1.1.1.80:dev"
compile "codechicken:ForgeMultipart:1.7.2-1.1.0.288:dev"
compile "net.bdew:bdlib:" + bdlibver
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Thu Nov 28 11:30:59 IST 2013
#Wed Mar 26 13:33:58 CDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-bin.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-bin.zip
28 changes: 14 additions & 14 deletions resources/assets/pressure/pressure-config.cfg
@@ -1,35 +1,35 @@
P = B:pistonBase
G = I:ingotGold
I = I:ingotIron
P = B:piston
G = I:gold_ingot
I = I:iron_ingot
D = I:diamond
C = I:dyePowder@2 // Cactus Green
L = I:dyePowder@4 // Lapis
E = I:enderPearl
W = I:bucketWater
C = I:dye@2 // Cactus Green
L = I:dye@4 // Lapis
E = I:ender_pearl
W = I:water_bucket
R = I:redstone

RIL
IEI => pressure:Interface
IEI => I:pressure:Interface
LIR

H = pressure:Interface
H = I:pressure:Interface

III
C_C => pressure:Pipe * 6
C_C => B:pressure:Pipe * 6
III

ICI
I_I => pressure:Input
I_I => B:pressure:Input
IHI

IHI
I_I => pressure:Output
I_I => B:pressure:Output
ICI

III
W_W => pressure:Water
W_W => B:pressure:Water
III

ICI
P_P => pressure:Pump
P_P => B:pressure:Pump
ICI
1 change: 1 addition & 0 deletions settings.gradle
@@ -0,0 +1 @@
rootProject.name = 'pressure'
18 changes: 11 additions & 7 deletions src/net/bdew/pressure/ItemDebugger.scala
Expand Up @@ -10,16 +10,20 @@
package net.bdew.pressure

import net.bdew.lib.items.SimpleItem
import net.minecraft.item.{Item, ItemStack}
import net.minecraft.item.ItemStack
import net.minecraft.world.World
import net.minecraft.entity.player.EntityPlayer
import net.bdew.pressure.misc.{Helper, BlockRef}
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.client.renderer.texture.IIconRegister
import cpw.mods.fml.relauncher.{SideOnly, Side}
import net.minecraft.util.ChatComponentText
import cpw.mods.fml.common.registry.GameRegistry

class ItemDebugger(id: Int) extends SimpleItem(id, "Debugger") {
object ItemDebugger extends SimpleItem("Debugger") {
setMaxStackSize(1)

implicit def string2chatcomp(s: String) = new ChatComponentText(s)

override def onItemUse(stack: ItemStack, player: EntityPlayer, world: World, x: Int, y: Int, z: Int, side: Int, xOff: Float, yOff: Float, zOff: Float): Boolean = {
if (!world.isRemote) {
val br = BlockRef(world, x, y, z)
Expand All @@ -34,11 +38,11 @@ class ItemDebugger(id: Int) extends SimpleItem(id, "Debugger") {
true
}

@SideOnly(Side.CLIENT)
override def getIconFromDamage(par1: Int) = Item.stick.getIconFromDamage(0)
private val stick = GameRegistry.findItem("minecraft", "stick")

//override def getIcon(stack: ItemStack, pass: Int) = Item.stick.getIcon(stack, 0)
@SideOnly(Side.CLIENT)
override def getIconFromDamage(par1: Int) = stick.getIconFromDamage(0)

@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {}
override def registerIcons(reg: IIconRegister) {}
}
11 changes: 6 additions & 5 deletions src/net/bdew/pressure/Pressure.scala
Expand Up @@ -9,17 +9,15 @@

package net.bdew.pressure

import java.util.logging.Logger
import net.bdew.pressure.config._
import cpw.mods.fml.common.Mod
import cpw.mods.fml.common.Mod.EventHandler
import cpw.mods.fml.common.event._
import cpw.mods.fml.common.network.NetworkMod
import cpw.mods.fml.common.network.NetworkRegistry
import java.io.File
import org.apache.logging.log4j.Logger

@Mod(modid = Pressure.modId, version = "PRESSURE_VER", name = "Pressure Piping", dependencies = "after:BuildCraft|energy;after:BuildCraft|Silicon;after:IC2;after:CoFHCore;required-after:bdlib", modLanguage = "scala")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
object Pressure {
var log: Logger = null
var instance = this
Expand All @@ -30,7 +28,10 @@ object Pressure {
var configDir: File = null

def logInfo(msg: String, args: Any*) = log.info(msg.format(args: _*))
def logWarn(msg: String, args: Any*) = log.warning(msg.format(args: _*))
def logWarn(msg: String, args: Any*) = log.warn(msg.format(args: _*))
def logError(msg: String, args: Any*) = log.error(msg.format(args: _*))
def logWarnException(msg: String, t: Throwable, args: Any*) = log.warn(msg.format(args: _*), t)
def logErrorException(msg: String, t: Throwable, args: Any*) = log.error(msg.format(args: _*), t)

@EventHandler
def preInit(event: FMLPreInitializationEvent) {
Expand All @@ -43,7 +44,7 @@ object Pressure {

@EventHandler
def init(event: FMLInitializationEvent) {
NetworkRegistry.instance.registerGuiHandler(this, Config.guiHandler)
NetworkRegistry.INSTANCE.registerGuiHandler(this, Config.guiHandler)
TuningLoader.loadDealayed()
}

Expand Down
2 changes: 1 addition & 1 deletion src/net/bdew/pressure/api/IPressureConnectableBlock.java
Expand Up @@ -10,7 +10,7 @@
package net.bdew.pressure.api;

import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;

/**
* Implemented on all blocks that can connect to Pressure pipes or blocks
Expand Down
2 changes: 1 addition & 1 deletion src/net/bdew/pressure/api/IPressureHelper.java
Expand Up @@ -10,7 +10,7 @@
package net.bdew.pressure.api;

import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;

public interface IPressureHelper {
Expand Down
16 changes: 8 additions & 8 deletions src/net/bdew/pressure/blocks/BaseIOBlock.scala
Expand Up @@ -9,22 +9,22 @@

package net.bdew.pressure.blocks

import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.client.renderer.texture.IIconRegister
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.bdew.lib.rotate.{BaseRotateableBlock, IconType}
import net.minecraft.util.Icon
import net.minecraft.util.IIcon
import net.minecraft.world.{World, IBlockAccess}
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.common.util.ForgeDirection
import net.bdew.lib.block.HasTE
import net.bdew.pressure.render.RotatedBlockRenderer

class BaseIOBlock[T <: TileFilterable](id: Int, name: String, teClass: Class[T])
extends Block(id, Material.iron) with BaseRotateableBlock with HasTE[T] with BlockFilterable[T] {
class BaseIOBlock[T <: TileFilterable](name: String, teClass: Class[T])
extends Block(Material.iron) with BaseRotateableBlock with HasTE[T] with BlockFilterable[T] {
override val TEClass = teClass

setUnlocalizedName("pressure." + name)
setBlockName("pressure." + name)
setHardness(2)

override def getFacing(world: IBlockAccess, x: Int, y: Int, z: Int) =
Expand All @@ -48,9 +48,9 @@ class BaseIOBlock[T <: TileFilterable](id: Int, name: String, teClass: Class[T])
case _ => sideIcon
}

var frontIcon, sideIcon, backIcon: Icon = null
var frontIcon, sideIcon, backIcon: IIcon = null
@SideOnly(Side.CLIENT)
override def registerIcons(ir: IconRegister) = {
override def registerBlockIcons(ir: IIconRegister) = {
frontIcon = ir.registerIcon("pressure:%s/front".format(name))
backIcon = ir.registerIcon("pressure:%s/back".format(name))
sideIcon = ir.registerIcon("pressure:%s/side".format(name))
Expand Down
12 changes: 6 additions & 6 deletions src/net/bdew/pressure/blocks/BlockFilterable.scala
Expand Up @@ -13,27 +13,27 @@ import net.bdew.lib.block.HasTE
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.world.{IBlockAccess, World}
import net.minecraftforge.fluids.{FluidRegistry, FluidContainerRegistry}
import net.minecraft.item.Item
import net.bdew.lib.Misc
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.common.util.ForgeDirection
import net.bdew.lib.rotate.{IconType, BaseRotateableBlock}
import cpw.mods.fml.common.registry.GameRegistry
import net.minecraft.util.ChatComponentTranslation

trait BlockFilterable[T <: TileFilterable] extends BaseRotateableBlock with HasTE[T] {
override def onBlockActivated(world: World, x: Int, y: Int, z: Int, player: EntityPlayer, meta: Int, xoffs: Float, yoffs: Float, zoffs: Float): Boolean = {
if (!player.isSneaking) {
val item = Option(player.getCurrentEquippedItem)
if (item exists (_.getItem == Item.bucketEmpty)) {
if (item exists (_.getItem == GameRegistry.findItem("minecraft", "bucket"))) {
if (!world.isRemote) {
getTE(world, x, y, z).fluidFilter := null
player.addChatMessage(Misc.toLocal("pressure.label.filter.unset"))
player.addChatMessage(new ChatComponentTranslation("pressure.label.filter.unset"))
}
return true
}
val fluid = item flatMap (x => Option(FluidContainerRegistry.getFluidForFilledItem(x))) getOrElse (return false)
if (!world.isRemote) {
getTE(world, x, y, z).fluidFilter := fluid.getFluid.getName
player.addChatMessage(Misc.toLocalF("pressure.label.filter.set", fluid.getFluid.getLocalizedName))
player.addChatMessage(new ChatComponentTranslation("pressure.label.filter.set", fluid.getFluid.getLocalizedName))
}
return true
}
Expand Down
6 changes: 3 additions & 3 deletions src/net/bdew/pressure/blocks/BlockNotifyUpdates.scala
Expand Up @@ -12,15 +12,15 @@ package net.bdew.pressure.blocks
import net.minecraft.block.Block
import net.minecraft.world.World
import net.bdew.pressure.misc.Helper
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.common.util.ForgeDirection

trait BlockNotifyUpdates extends Block {
def notifyPressureSystemUpdate(w: World, x: Int, y: Int, z: Int) =
Helper.notifyBlockChanged(w, x, y, z)

override def breakBlock(world: World, x: Int, y: Int, z: Int, id: Int, meta: Int) = {
override def breakBlock(world: World, x: Int, y: Int, z: Int, block: Block, meta: Int) = {
notifyPressureSystemUpdate(world, x, y, z)
super.breakBlock(world, x, y, z, id, meta)
super.breakBlock(world, x, y, z, block, meta)
}

override def onBlockPlaced(world: World, x: Int, y: Int, z: Int, side: Int, hitX: Float, hitY: Float, hitZ: Float, meta: Int) = {
Expand Down
10 changes: 5 additions & 5 deletions src/net/bdew/pressure/blocks/BlockPipe.scala
Expand Up @@ -11,16 +11,16 @@ package net.bdew.pressure.blocks

import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.client.renderer.texture.IIconRegister
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.pressure.api.IPressureConnectableBlock
import net.bdew.pressure.render.PipeRenderer
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.common.util.ForgeDirection
import net.minecraft.world.{World, IBlockAccess}
import net.bdew.pressure.misc.Helper

class BlockPipe(id: Int) extends Block(id, Material.iron) with IPressureConnectableBlock with BlockNotifyUpdates {
setUnlocalizedName("pressure.pipe")
object BlockPipe extends Block(Material.iron) with IPressureConnectableBlock with BlockNotifyUpdates {
setBlockName("pressure.pipe")
setHardness(2)

override def renderAsNormalBlock() = false
Expand All @@ -30,7 +30,7 @@ class BlockPipe(id: Int) extends Block(id, Material.iron) with IPressureConnecta
override def getRenderType = PipeRenderer.id

@SideOnly(Side.CLIENT)
override def registerIcons(ir: IconRegister) = {
override def registerBlockIcons(ir: IIconRegister) = {
blockIcon = ir.registerIcon("pressure:pipe")
}

Expand Down

0 comments on commit 084e6dc

Please sign in to comment.