mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 10:51:55 -04:00
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.8
This commit is contained in:
commit
9e2371c7d7
@ -70,7 +70,7 @@ Alternatively, leave out the `api` classifier and you can build against the dev
|
|||||||
If you have any questions, please do not hesitate to ask, either in the [forums][] or in the [IRC][irc]!
|
If you have any questions, please do not hesitate to ask, either in the [forums][] or in the [IRC][irc]!
|
||||||
|
|
||||||
### OpenComputers
|
### OpenComputers
|
||||||
Want to tinker with the mod itself? Here is how - for IntelliJ IDEA users. For eclipse I assume the process will be similar.
|
Want to tinker with the mod itself? Here is how - for IntelliJ IDEA users.
|
||||||
|
|
||||||
**Important**
|
**Important**
|
||||||
- Make sure you have the Gradle plugin enabled in IDEA (File->Settings->Plugins).
|
- Make sure you have the Gradle plugin enabled in IDEA (File->Settings->Plugins).
|
||||||
@ -84,6 +84,8 @@ to create an IntellJ IDEA project.
|
|||||||
|
|
||||||
Open the project and you will be asked to *import the Gradle project* (check your Event Log if you missed the pop-up). **Do so**. This will configure additionally referenced libraries.
|
Open the project and you will be asked to *import the Gradle project* (check your Event Log if you missed the pop-up). **Do so**. This will configure additionally referenced libraries.
|
||||||
|
|
||||||
|
In the case you wish to use Eclipse rather than IDEA, the process is mostly the same, except you must run `gradlew eclipse` rather than `gradlew idea`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[api]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/java/li/cil/oc/api
|
[api]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/java/li/cil/oc/api
|
||||||
|
@ -1041,6 +1041,10 @@ opencomputers {
|
|||||||
# cost is multiplied with, so 1 is a full refund, 0 disables the
|
# cost is multiplied with, so 1 is a full refund, 0 disables the
|
||||||
# functionality (won't be able to put prints into the material input).
|
# functionality (won't be able to put prints into the material input).
|
||||||
printRecycleRate: 0.75
|
printRecycleRate: 0.75
|
||||||
|
|
||||||
|
# Whether Chamelium is edible or not. When eaten, it gives a (short)
|
||||||
|
# invisibility buff, and (slightly longer) blindness debuff.
|
||||||
|
chameliumEdible: true
|
||||||
}
|
}
|
||||||
|
|
||||||
# Settings for mod integration (the mod previously known as OpenComponents).
|
# Settings for mod integration (the mod previously known as OpenComponents).
|
||||||
|
@ -296,6 +296,7 @@ class Settings(val config: Config) {
|
|||||||
val threadPriority = config.getInt("misc.threadPriority")
|
val threadPriority = config.getInt("misc.threadPriority")
|
||||||
val maxPrintComplexity = config.getInt("misc.maxPrinterShapes")
|
val maxPrintComplexity = config.getInt("misc.maxPrinterShapes")
|
||||||
val printRecycleRate = config.getDouble("misc.printRecycleRate")
|
val printRecycleRate = config.getDouble("misc.printRecycleRate")
|
||||||
|
val chameliumEdible = config.getBoolean("misc.chameliumEdible")
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
// integration
|
// integration
|
||||||
|
@ -1,3 +1,32 @@
|
|||||||
package li.cil.oc.common.item
|
package li.cil.oc.common.item
|
||||||
|
|
||||||
class Chamelium(val parent: Delegator) extends Delegate
|
import li.cil.oc.Settings
|
||||||
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
|
import net.minecraft.item.EnumAction
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.potion.Potion
|
||||||
|
import net.minecraft.potion.PotionEffect
|
||||||
|
import net.minecraft.world.World
|
||||||
|
|
||||||
|
class Chamelium(val parent: Delegator) extends Delegate {
|
||||||
|
override def onItemRightClick(stack: ItemStack, world: World, player: EntityPlayer): ItemStack = {
|
||||||
|
if (Settings.get.chameliumEdible) {
|
||||||
|
player.setItemInUse(stack, getMaxItemUseDuration(stack))
|
||||||
|
}
|
||||||
|
stack
|
||||||
|
}
|
||||||
|
|
||||||
|
override def getItemUseAction(stack: ItemStack): EnumAction = EnumAction.eat
|
||||||
|
|
||||||
|
override def getMaxItemUseDuration(stack: ItemStack): Int = 32
|
||||||
|
|
||||||
|
override def onEaten(stack: ItemStack, world: World, player: EntityPlayer): ItemStack = {
|
||||||
|
if (!world.isRemote) {
|
||||||
|
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 100, 0))
|
||||||
|
player.addPotionEffect(new PotionEffect(Potion.blindness.id, 200, 0))
|
||||||
|
}
|
||||||
|
stack.stackSize -= 1
|
||||||
|
if (stack.stackSize > 0) stack
|
||||||
|
else null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -13,6 +13,7 @@ import li.cil.oc.util.Tooltip
|
|||||||
import net.minecraft.client.resources.model.ModelResourceLocation
|
import net.minecraft.client.resources.model.ModelResourceLocation
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
|
import net.minecraft.item.EnumAction
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
@ -52,8 +53,12 @@ trait Delegate {
|
|||||||
stack
|
stack
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getItemUseAction(stack: ItemStack): EnumAction = EnumAction.none
|
||||||
|
|
||||||
def getMaxItemUseDuration(stack: ItemStack) = 0
|
def getMaxItemUseDuration(stack: ItemStack) = 0
|
||||||
|
|
||||||
|
def onEaten(stack: ItemStack, world: World, player: EntityPlayer): ItemStack = stack
|
||||||
|
|
||||||
def onPlayerStoppedUsing(stack: ItemStack, player: EntityPlayer, duration: Int) {}
|
def onPlayerStoppedUsing(stack: ItemStack, player: EntityPlayer, duration: Int) {}
|
||||||
|
|
||||||
def update(stack: ItemStack, world: World, player: Entity, slot: Int, selected: Boolean) {}
|
def update(stack: ItemStack, world: World, player: Entity, slot: Int, selected: Boolean) {}
|
||||||
|
@ -11,6 +11,7 @@ import net.minecraft.client.resources.model.ModelResourceLocation
|
|||||||
import net.minecraft.creativetab.CreativeTabs
|
import net.minecraft.creativetab.CreativeTabs
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
|
import net.minecraft.item.EnumAction
|
||||||
import net.minecraft.item.EnumRarity
|
import net.minecraft.item.EnumRarity
|
||||||
import net.minecraft.item.Item
|
import net.minecraft.item.Item
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
@ -125,6 +126,18 @@ class Delegator extends Item {
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
|
||||||
|
override def onEaten(stack: ItemStack, world: World, player: EntityPlayer): ItemStack =
|
||||||
|
subItem(stack) match {
|
||||||
|
case Some(subItem) => subItem.onEaten(stack, world, player)
|
||||||
|
case _ => super.onEaten(stack, world, player)
|
||||||
|
}
|
||||||
|
|
||||||
|
override def getItemUseAction(stack: ItemStack): EnumAction =
|
||||||
|
subItem(stack) match {
|
||||||
|
case Some(subItem) => subItem.getItemUseAction(stack)
|
||||||
|
case _ => super.getItemUseAction(stack)
|
||||||
|
}
|
||||||
|
|
||||||
override def getMaxItemUseDuration(stack: ItemStack): Int =
|
override def getMaxItemUseDuration(stack: ItemStack): Int =
|
||||||
Delegator.subItem(stack) match {
|
Delegator.subItem(stack) match {
|
||||||
case Some(subItem) => subItem.getMaxItemUseDuration(stack)
|
case Some(subItem) => subItem.getMaxItemUseDuration(stack)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user