Initial port to 1.12

This commit is contained in:
Shadowfacts 2017-06-17 18:47:56 -04:00
parent 3f1f0e38ac
commit b99726610f
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
22 changed files with 180 additions and 72 deletions

View File

@ -7,7 +7,7 @@ buildscript {
}
}
dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT"
classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
}
}
@ -51,6 +51,7 @@ processResources {
}
repositories {
jcenter()
maven {
name "shadowfacts"
url "http://mvn.rx14.co.uk/shadowfacts/"
@ -72,7 +73,7 @@ curseforge {
project {
id = "246215"
addGameVersion "1.11"
addGameVersion "1.12"
addGameVersion "Java 8"
mainArtifact(jar) {

View File

@ -2,12 +2,12 @@ mod_version = 2.0.0
group = net.shadowfacts
archivesBaseName = ExtraHoppers
mc_version = 1.11.2
mcp_mappings = snapshot_20170327
forge_version = 13.20.0.2260
mc_version = 1.12
mcp_mappings = snapshot_20170615
forge_version = 14.21.0.2333
kotlin_version = 1.1.1
kotlin_version = 1.1.2-4
shadowmc_version = 3.7.6-SNAPSHOT
forgelin_version = 1.4.1
jei_version = 4.2.10.250
shadowmc_version = 3.8.0-SNAPSHOT
forgelin_version = 1.5.0
jei_version = 4.6.0.61

View File

@ -33,8 +33,6 @@ object ExtraHoppers {
blocks.init()
ModRecipes.init()
NetworkRegistry.INSTANCE.registerGuiHandler(ExtraHoppers, GUIHandler)
}

View File

@ -1,32 +0,0 @@
package net.shadowfacts.extrahoppers
import net.minecraft.init.Blocks
import net.minecraft.init.Items
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.registry.GameRegistry
import net.minecraftforge.oredict.ShapedOreRecipe
/**
* @author shadowfacts
*/
object ModRecipes {
fun init() {
GameRegistry.addRecipe(ShapedOreRecipe(ExtraHoppers.blocks.fluidHopper, "I I", "I I", " B ", 'I', "ingotIron", 'B', Items.BUCKET))
GameRegistry.addRecipe(ShapedOreRecipe(ExtraHoppers.blocks.woodenHopper, "W W", "W W", " W ", 'W', "plankWood"))
GameRegistry.addRecipe(ShapedOreRecipe(ExtraHoppers.blocks.woodenFluidHopper, "W W", "W W", " B ", 'W', "plankWood", 'B', Items.BUCKET))
GameRegistry.addShapelessRecipe(ItemStack(ExtraHoppers.blocks.invertedHopper), Blocks.HOPPER)
GameRegistry.addShapelessRecipe(ItemStack(Blocks.HOPPER), ExtraHoppers.blocks.invertedHopper)
GameRegistry.addShapelessRecipe(ItemStack(ExtraHoppers.blocks.invertedFluidHopper), ExtraHoppers.blocks.fluidHopper)
GameRegistry.addShapelessRecipe(ItemStack(ExtraHoppers.blocks.fluidHopper), ExtraHoppers.blocks.invertedFluidHopper)
GameRegistry.addShapelessRecipe(ItemStack(ExtraHoppers.blocks.invertedWoodenHopper), ExtraHoppers.blocks.woodenHopper)
GameRegistry.addShapelessRecipe(ItemStack(ExtraHoppers.blocks.woodenHopper), ExtraHoppers.blocks.invertedWoodenHopper)
GameRegistry.addShapelessRecipe(ItemStack(ExtraHoppers.blocks.invertedWoodenFluidHopper), ExtraHoppers.blocks.woodenFluidHopper)
GameRegistry.addShapelessRecipe(ItemStack(ExtraHoppers.blocks.woodenFluidHopper), ExtraHoppers.blocks.invertedWoodenFluidHopper)
}
}

View File

@ -4,6 +4,7 @@ import net.minecraft.block.SoundType
import net.minecraft.block.material.Material
import net.minecraft.block.state.IBlockState
import net.minecraft.client.resources.I18n
import net.minecraft.client.util.ITooltipFlag
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
import net.minecraft.util.EnumFacing
@ -47,18 +48,15 @@ open class BlockFluidHopper(inverted: Boolean, name: String = "fluid_hopper", ma
if (player.isSneaking) {
player.openGui(ExtraHoppers, GUIHandler.FLUID_HOPPER, world, pos.x, pos.y, pos.z)
} else {
val te = getTileEntity(world, pos)
val stack = player.getHeldItem(hand)
val result = FluidUtil.interactWithFluidHandler(stack, te.getCapability(FLUID_HANDLER_CAPABILITY, EnumFacing.NORTH), player)
if (result.isSuccess) {
player.setHeldItem(hand, result.getResult())
te.save()
val res = FluidUtil.interactWithFluidHandler(player, hand, world, pos, side)
if (res) {
getTileEntity(world, pos).save()
}
}
return true
}
override fun addInformation(stack: ItemStack, player: EntityPlayer, tooltip: MutableList<String>, advanced: Boolean) {
override fun addInformation(stack: ItemStack, world: World?, tooltip: MutableList<String>, flag: ITooltipFlag) {
tooltip.add(I18n.format("tile.extrahoppers:fluid_hopper.tooltip"))
}

View File

@ -15,7 +15,7 @@ import org.lwjgl.opengl.GL11
*/
object TESRFluidHopper: TileEntitySpecialRenderer<TileEntityFluidHopper>() {
override fun renderTileEntityAt(te: TileEntityFluidHopper, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int) {
override fun renderTileEntityAt(te: TileEntityFluidHopper, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, alpha: Float) {
val pos = if (te.inverted) te.pos.down() else te.pos.up()
if (te.tank.fluid != null && !te.world.getBlockState(pos).isSideSolid(te.world, pos, EnumFacing.DOWN)) {

View File

@ -123,7 +123,7 @@ open class TileEntityFluidHopper(inverted: Boolean): TileEntityHopperBase(invert
val pickupPos = if (inverted) pos.down() else pos.up()
if (FluidUtils.isFluidBlock(world, pickupPos)) {
val toDrain = FluidUtils.drainFluidBlock(world, pickupPos, false)!!
if (toDrain.amount <= tank.capacity - tank.fluidAmount && tank.fill(toDrain, false) === 1000) {
if (toDrain.amount <= tank.capacity - tank.fluidAmount && tank.fill(toDrain, false) == 1000) {
tank.fill(FluidUtils.drainFluidBlock(world, pickupPos, true), true)
return true
}

View File

@ -91,13 +91,13 @@ class TileEntityInvertedHopper: TileEntityHopperBase(true), ITickable {
val items = world.getEntitiesWithinAABB(EntityItem::class.java, AxisAlignedBB(pos.x.toDouble(), pos.y - 0.5, pos.z.toDouble(), pos.x + 1.0, pos.y + 0.5, pos.z + 1.0))
for (item in items) {
for (slot in 0.until(inventory.slots)) {
val result = inventory.insertItem(slot, item.entityItem, true)
if (result.count != item.entityItem.count) {
inventory.insertItem(slot, item.entityItem, false)
val result = inventory.insertItem(slot, item.item, true)
if (result.count != item.item.count) {
inventory.insertItem(slot, item.item, false)
if (result.isEmpty) {
item.setDead()
} else {
item.setEntityItemStack(result)
item.item = result
}
return true
}

View File

@ -86,13 +86,13 @@ class TileEntityWoodenHopper(inverted: Boolean): TileEntityHopperBase(inverted),
val yOffset = if (inverted) -1 else 0
val items = world.getEntitiesWithinAABB(EntityItem::class.java, AxisAlignedBB(pos.x.toDouble(), pos.y + 0.5 + yOffset, pos.z.toDouble(), pos.x + 1.0, pos.y + 1.5 + yOffset, pos.z + 1.0))
for (item in items) {
val result = inventory.insertItem(0, item.entityItem, true)
if (result.count != item.entityItem.count) {
inventory.insertItem(0, item.entityItem, false)
val result = inventory.insertItem(0, item.item, true)
if (result.count != item.item.count) {
inventory.insertItem(0, item.item, false)
if (result.isEmpty) {
item.setDead()
} else {
item.setEntityItemStack(result)
item.item = result
}
return true
}

View File

@ -3,6 +3,7 @@ package net.shadowfacts.extrahoppers.block.wooden_fluid
import net.minecraft.block.SoundType
import net.minecraft.block.material.Material
import net.minecraft.block.state.IBlockState
import net.minecraft.client.util.ITooltipFlag
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
import net.minecraft.util.EnumFacing
@ -35,7 +36,7 @@ class BlockWoodenFluidHopper(inverted: Boolean): BlockFluidHopper(inverted, name
}
}
override fun addInformation(stack: ItemStack, player: EntityPlayer, tooltip: MutableList<String>, advanced: Boolean) {
override fun addInformation(stack: ItemStack, world: World?, tooltip: MutableList<String>, flag: ITooltipFlag) {
}
override fun createTileEntity(world: World, state: IBlockState): TileEntityFluidHopper {

View File

@ -9,20 +9,17 @@ import net.minecraftforge.fml.client.IModGuiFactory
*/
class EHGUIFactory: IModGuiFactory {
override fun initialize(minecraftInstance: Minecraft) {
}
override fun mainConfigGuiClass(): Class<out GuiScreen> {
return EHConfigGUI::class.java
}
override fun runtimeGuiCategories(): Set<IModGuiFactory.RuntimeOptionCategoryElement>? {
return null
}
override fun getHandlerFor(element: IModGuiFactory.RuntimeOptionCategoryElement): IModGuiFactory.RuntimeOptionGuiHandler? {
return null
}
override fun initialize(minecraftInstance: Minecraft) {}
override fun hasConfigGui() = true
override fun createConfigGui(parentScreen: GuiScreen) = EHConfigGUI(parentScreen)
@Deprecated("")
override fun mainConfigGuiClass() = EHConfigGUI::class.java
override fun runtimeGuiCategories() = null
override fun getHandlerFor(element: IModGuiFactory.RuntimeOptionCategoryElement) = null
}

View File

@ -0,0 +1,20 @@
{
"type": "forge:ore_shaped",
"pattern": [
"I I",
"I I",
" B "
],
"key": {
"I": {
"type": "forge:ore_dict",
"ore": "ingotIron"
},
"B": {
"item": "minecraft:bucket"
}
},
"result": {
"item": "extrahoppers:fluid_hopper"
}
}

View File

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "extrahoppers:fluid_hopper"
}
],
"result": {
"item": "extrahoppers:inverted_fluid_hopper"
}
}

View File

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "minecraft:hopper"
}
],
"result": {
"item": "extrahoppers:inverted_hopper"
}
}

View File

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "extrahoppers:wooden_fluid_hopper"
}
],
"result": {
"item": "extrahoppers:inverted_wooden_fluid_hopper"
}
}

View File

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "extrahoppers:wooden_hopper"
}
],
"result": {
"item": "extrahoppers:inverted_wooden_hopper"
}
}

View File

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "extrahoppers:inverted_fluid_hopper"
}
],
"result": {
"item": "extrahoppers:fluid_hopper"
}
}

View File

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "extrahoppers:inverted_hopper"
}
],
"result": {
"item": "minecraft:hopper"
}
}

View File

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "extrahoppers:inverted_wooden_fluid_hopper"
}
],
"result": {
"item": "extrahoppers:wooden_fluid_hopper"
}
}

View File

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "extrahoppers:inverted_wooden_hopper"
}
],
"result": {
"item": "extrahoppers:wooden_hopper"
}
}

View File

@ -0,0 +1,20 @@
{
"type": "forge:ore_shaped",
"pattern": [
"W W",
"W W",
" B "
],
"key": {
"W": {
"type": "forge:ore_dict",
"ore": "plankWood"
},
"B": {
"item": "minecraft:bucket"
}
},
"result": {
"item": "extrahoppers:wooden_fluid_hopper"
}
}

View File

@ -0,0 +1,17 @@
{
"type": "forge:ore_shaped",
"pattern": [
"W W",
"W W",
" W "
],
"key": {
"W": {
"type": "forge:ore_dict",
"ore": "plankWood"
}
},
"result": {
"item": "extrahoppers:wooden_hopper"
}
}