Skip to content

Commit

Permalink
initial 1.20.1 port
Browse files Browse the repository at this point in the history
  • Loading branch information
bdew committed Jul 22, 2023
1 parent efe6397 commit c77d215
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 42 deletions.
13 changes: 2 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}

plugins {
id 'scala'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "2.+"
Expand Down
14 changes: 7 additions & 7 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
mod.id=compacter
mod.version=1.10.0
mod.version=1.11.0
curseforge.id=231549
modrinth.id=compacter
minecraft.version=1.19.3
forge.version=44.1.5
bdlib.version=1.26.0.4
scala.version=2.13.10
parchment.version=2022.12.18-1.19.3
slp.version=2.13.10-build-15
minecraft.version=1.20.1
forge.version=47.1.39
bdlib.version=1.27.0.6
scala.version=2.13.11
parchment.version=2023.07.16-1.20.1
slp.version=3.3.0-build-2
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
14 changes: 12 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://maven.parchmentmc.org' }
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
maven {
name = 'Parchment'
url = 'https://maven.parchmentmc.org'
}
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}

rootProject.name = 'compacter'
8 changes: 4 additions & 4 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "kotori_scala"
loaderVersion = "[2.13.10,2.14.0)"
loaderVersion = "[3.3.0,)"
issueTrackerURL = "https://github.com/bdew-minecraft/compacter/issues"
license = "MIT"

Expand All @@ -20,21 +20,21 @@ This mods adds a single simple block - the Compacter.
[[dependencies.compacter]]
modId = "forge"
mandatory = true
versionRange = "[44.1,)"
versionRange = "[47.1,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.compacter]]
modId = "minecraft"
mandatory = true
versionRange = "[1.19.3,)"
versionRange = "[1.20.1,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.compacter]]
modId = "bdlib"
mandatory = true
versionRange = "[1.26.0,)"
versionRange = "[1.27.0,)"
ordering = "NONE"
side = "BOTH"

13 changes: 4 additions & 9 deletions src/main/scala/net/bdew/compacter/misc/CompacterCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package net.bdew.compacter.misc

import net.bdew.compacter.Compacter
import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.{AbstractContainerMenu, CraftingContainer}
import net.minecraft.world.inventory.{AbstractContainerMenu, CraftingContainer, TransientCraftingContainer}
import net.minecraft.world.item.crafting.{CraftingRecipe, RecipeType}
import net.minecraft.world.item.{Item, ItemStack}
import net.minecraft.world.level.Level
Expand All @@ -22,15 +22,10 @@ object ItemDef {

object FakeContainer extends AbstractContainerMenu(null, 0) {
override def stillValid(player: Player): Boolean = true
override def quickMoveStack(player : Player, slot : Int): ItemStack = ItemStack.EMPTY
override def quickMoveStack(player: Player, slot: Int): ItemStack = ItemStack.EMPTY
}

class FakeInventory(cache: CompacterCache, stack: ItemStack) extends CraftingContainer(FakeContainer, cache.size, cache.size) {
override def getContainerSize: Int = cache.size * cache.size

override def setChanged(): Unit = {
}

class FakeInventory(cache: CompacterCache, stack: ItemStack) extends TransientCraftingContainer(FakeContainer, cache.size, cache.size) {
override def getItem(slot: Int): ItemStack = {
val x = slot % cache.size
val y = slot / cache.size
Expand Down Expand Up @@ -60,7 +55,7 @@ class CompacterCache(val size: Int) {

val result = world.getRecipeManager
.getRecipeFor[CraftingContainer, CraftingRecipe](RecipeType.CRAFTING, fakeInventory, world)
.map(recipe => recipe.assemble(fakeInventory))
.map(recipe => recipe.assemble(fakeInventory, world.registryAccess))
.filter(!_.isEmpty)

if (!result.isPresent) {
Expand Down
12 changes: 6 additions & 6 deletions src/main/scala/net/bdew/compacter/misc/WidgetMode.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package net.bdew.compacter.misc

import com.mojang.blaze3d.vertex.PoseStack
import net.bdew.compacter.Textures
import net.bdew.compacter.network.NetworkHandler
import net.bdew.lib.data.DataSlotEnum
import net.bdew.lib.gui._
import net.bdew.lib.gui.widgets.Widget
import net.bdew.lib.{Client, Misc, Text}
import net.minecraft.client.gui.GuiGraphics
import net.minecraft.client.resources.sounds.SimpleSoundInstance
import net.minecraft.network.chat.Component
import net.minecraft.sounds.SoundEvents
Expand All @@ -20,15 +20,15 @@ case class WidgetMode[T <: Enumeration](p: Point, ds: DataSlotEnum[T], pktConstr

val values: Seq[T#Value] = ds.baseEnum.values.toList.sortBy(_.id)

override def drawBackground(m: PoseStack, mouse: Point): Unit = {
override def drawBackground(graphics: GuiGraphics, mouse: Point): Unit = {
if (rect.contains(mouse))
parent.drawTexture(m, rect, Textures.buttonHover)
parent.drawTexture(graphics, rect, Textures.buttonHover)
else
parent.drawTexture(m, rect, Textures.buttonBase)
parent.drawTexture(graphics, rect, Textures.buttonBase)
}

override def draw(m: PoseStack, mouse: Point, partial: Float): Unit = {
parent.drawTexture(m, iconRect, Textures.modeTextures(ds.value))
override def draw(graphics: GuiGraphics, mouse: Point, partial: Float): Unit = {
parent.drawTexture(graphics, iconRect, Textures.modeTextures(ds.value))
}

override def handleTooltip(p: Point, tip: mutable.ArrayBuffer[Component]): Unit = {
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/net/bdew/compacter/registries/Blocks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import net.bdew.lib.managers.BlockManager
import net.minecraft.world.item.BlockItem
import net.minecraft.world.level.block.SoundType
import net.minecraft.world.level.block.state.BlockBehaviour.Properties
import net.minecraft.world.level.material.Material
import net.minecraft.world.level.material.MapColor

object Blocks extends BlockManager(Items) {
def machineProps: Properties = props(Material.STONE)
def machineProps: Properties = props
.mapColor(MapColor.STONE)
.sound(SoundType.STONE)
.strength(2, 8)

Expand Down

0 comments on commit c77d215

Please sign in to comment.