[ci skip] spotlessApply with the new settings

This commit is contained in:
Jason Mitchell committed 2023-01-29 10:24:12 -08:00
1 parent f02b6bae19
commit 6b18eca613
89 files changed
+8520 -7190

No files matched your search

@@ -13,28 +13,32 @@ import cpw.mods.fml.common.Loader
import cpw.mods.fml.common.LoaderState
import net.minecraft.util.MovingObjectPosition.MovingObjectType
object MicroblockEventHandler
{
@SubscribeEvent
@SideOnly(Side.CLIENT)
def postTextureStitch(event:TextureStitchEvent.Post)
{
if(event.map.getTextureType == 0)
MicroMaterialRegistry.loadIcons()
}
object MicroblockEventHandler {
@SubscribeEvent
@SideOnly(Side.CLIENT)
def postTextureStitch(event: TextureStitchEvent.Post) {
if (event.map.getTextureType == 0)
MicroMaterialRegistry.loadIcons()
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
def drawBlockHighlight(event:DrawBlockHighlightEvent)
{
if(event.currentItem != null && event.currentItem.getItem == MicroblockProxy.itemMicro &&
event.target != null && event.target.typeOfHit == MovingObjectType.BLOCK)
{
GL11.glPushMatrix()
RenderUtils.translateToWorldCoords(event.player, event.partialTicks)
if(ItemMicroPartRenderer.renderHighlight(event.player, event.currentItem, event.target))
event.setCanceled(true)
GL11.glPopMatrix()
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
def drawBlockHighlight(event: DrawBlockHighlightEvent) {
if (
event.currentItem != null && event.currentItem.getItem == MicroblockProxy.itemMicro &&
event.target != null && event.target.typeOfHit == MovingObjectType.BLOCK
) {
GL11.glPushMatrix()
RenderUtils.translateToWorldCoords(event.player, event.partialTicks)
if (
ItemMicroPartRenderer.renderHighlight(
event.player,
event.currentItem,
event.target
)
)
event.setCanceled(true)
GL11.glPopMatrix()
}
}
}
}
@@ -12,35 +12,39 @@ import codechicken.microblock.ConfigContent
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent
import scala.collection.JavaConversions._
@Mod(modid = "ForgeMicroblock", acceptedMinecraftVersions = "[1.7.10]", dependencies = "required-after:ForgeMultipart", modLanguage = "scala")
object MicroblockMod
{
@EventHandler
def preInit(event: FMLPreInitializationEvent) {
MicroblockProxy.preInit(event.getModLog)
DefaultContent.load()
ConfigContent.parse(event.getModConfigurationDirectory)
}
@Mod(
modid = "ForgeMicroblock",
acceptedMinecraftVersions = "[1.7.10]",
dependencies = "required-after:ForgeMultipart",
modLanguage = "scala"
)
object MicroblockMod {
@EventHandler
def preInit(event: FMLPreInitializationEvent) {
MicroblockProxy.preInit(event.getModLog)
DefaultContent.load()
ConfigContent.parse(event.getModConfigurationDirectory)
}
@EventHandler
def init(event: FMLInitializationEvent) {
MicroblockProxy.init()
ConfigContent.load()
}
@EventHandler
def init(event: FMLInitializationEvent) {
MicroblockProxy.init()
ConfigContent.load()
}
@EventHandler
def postInit(event: FMLPostInitializationEvent) {
MicroMaterialRegistry.setupIDMap()
MicroblockProxy.postInit()
}
@EventHandler
def postInit(event: FMLPostInitializationEvent) {
MicroMaterialRegistry.setupIDMap()
MicroblockProxy.postInit()
}
@EventHandler
def beforeServerStart(event: FMLServerAboutToStartEvent) {
MicroMaterialRegistry.setupIDMap()
}
@EventHandler
def beforeServerStart(event: FMLServerAboutToStartEvent) {
MicroMaterialRegistry.setupIDMap()
}
@EventHandler
def handleIMC(event: IMCEvent) {
ConfigContent.handleIMC(event.getMessages)
}
@EventHandler
def handleIMC(event: IMCEvent) {
ConfigContent.handleIMC(event.getMessages)
}
}
@@ -1,6 +1,10 @@
package codechicken.microblock.handler
import codechicken.lib.packet.PacketCustom.{IHandshakeHandler, IClientPacketHandler, IServerPacketHandler}
import codechicken.lib.packet.PacketCustom.{
IHandshakeHandler,
IClientPacketHandler,
IServerPacketHandler
}
import codechicken.lib.packet.PacketCustom
import net.minecraft.client.Minecraft
import codechicken.microblock.MicroMaterialRegistry
@@ -10,33 +14,52 @@ import net.minecraft.network.play.server.S40PacketDisconnect
import net.minecraft.util.ChatComponentTranslation
import net.minecraft.network.NetHandlerPlayServer
class MicroblockPH
{
val registryChannel = "ForgeMicroblock" //Must use the 250 system for ID registry as the NetworkMod idMap hasn't been properly initialized from the server yet.
class MicroblockPH {
val registryChannel =
"ForgeMicroblock" // Must use the 250 system for ID registry as the NetworkMod idMap hasn't been properly initialized from the server yet.
}
object MicroblockCPH extends MicroblockPH with IClientPacketHandler
{
def handlePacket(packet: PacketCustom, mc: Minecraft, netHandler:INetHandlerPlayClient) {
packet.getType match {
case 1 => handleMaterialRegistration(packet, netHandler)
}
object MicroblockCPH extends MicroblockPH with IClientPacketHandler {
def handlePacket(
packet: PacketCustom,
mc: Minecraft,
netHandler: INetHandlerPlayClient
) {
packet.getType match {
case 1 => handleMaterialRegistration(packet, netHandler)
}
}
def handleMaterialRegistration(packet: PacketCustom, netHandler: INetHandlerPlayClient) {
val missing = MicroMaterialRegistry.readIDMap(packet)
if (!missing.isEmpty)
netHandler.handleDisconnect(new S40PacketDisconnect(new ChatComponentTranslation("microblock.missing", missing.mkString(", "))))
}
def handleMaterialRegistration(
packet: PacketCustom,
netHandler: INetHandlerPlayClient
) {
val missing = MicroMaterialRegistry.readIDMap(packet)
if (!missing.isEmpty)
netHandler.handleDisconnect(
new S40PacketDisconnect(
new ChatComponentTranslation(
"microblock.missing",
missing.mkString(", ")
)
)
)
}
}
object MicroblockSPH extends MicroblockPH with IServerPacketHandler with IHandshakeHandler
{
def handlePacket(packet: PacketCustom, sender: EntityPlayerMP, netHandler:INetHandlerPlayServer) {}
object MicroblockSPH
extends MicroblockPH
with IServerPacketHandler
with IHandshakeHandler {
def handlePacket(
packet: PacketCustom,
sender: EntityPlayerMP,
netHandler: INetHandlerPlayServer
) {}
def handshakeRecieved(netHandler: NetHandlerPlayServer) {
val packet = new PacketCustom(registryChannel, 1)
MicroMaterialRegistry.writeIDMap(packet)
netHandler.sendPacket(packet.toPacket)
}
}
def handshakeRecieved(netHandler: NetHandlerPlayServer) {
val packet = new PacketCustom(registryChannel, 1)
MicroMaterialRegistry.writeIDMap(packet)
netHandler.sendPacket(packet.toPacket)
}
}
@@ -24,89 +24,112 @@ import org.apache.logging.log4j.Logger
import scala.collection.mutable
class MicroblockProxy_serverImpl
{
var logger: Logger = _
class MicroblockProxy_serverImpl {
var logger: Logger = _
var itemMicro: ItemMicroPart = _
var sawStone: Item = _
var sawIron: Item = _
var sawDiamond: Item = _
var stoneRod: Item = _
var itemMicro: ItemMicroPart = _
var sawStone: Item = _
var sawIron: Item = _
var sawDiamond: Item = _
var stoneRod: Item = _
var useSawIcons: Boolean = _
var useSawIcons: Boolean = _
def preInit(logger: Logger) {
this.logger = logger
itemMicro = new ItemMicroPart
GameRegistry.registerItem(itemMicro, "microblock")
sawStone = createSaw(config, "sawStone", 1)
sawIron = createSaw(config, "sawIron", 2)
sawDiamond = createSaw(config, "sawDiamond", 3)
stoneRod = new Item().setUnlocalizedName("microblock:stoneRod").setTextureName("microblock:stoneRod")
GameRegistry.registerItem(stoneRod, "stoneRod")
def preInit(logger: Logger) {
this.logger = logger
itemMicro = new ItemMicroPart
GameRegistry.registerItem(itemMicro, "microblock")
sawStone = createSaw(config, "sawStone", 1)
sawIron = createSaw(config, "sawIron", 2)
sawDiamond = createSaw(config, "sawDiamond", 3)
stoneRod = new Item()
.setUnlocalizedName("microblock:stoneRod")
.setTextureName("microblock:stoneRod")
GameRegistry.registerItem(stoneRod, "stoneRod")
OreDictionary.registerOre("rodStone", stoneRod)
MinecraftForge.EVENT_BUS.register(MicroblockEventHandler)
OreDictionary.registerOre("rodStone", stoneRod)
MinecraftForge.EVENT_BUS.register(MicroblockEventHandler)
useSawIcons = config.getTag("useSawIcons").setComment("Set to true to use mc style icons for the saw instead of the 3D model").getBooleanValue(false)
useSawIcons = config
.getTag("useSawIcons")
.setComment(
"Set to true to use mc style icons for the saw instead of the 3D model"
)
.getBooleanValue(false)
}
protected var saws = mutable.MutableList[Item]()
def createSaw(config: ConfigFile, name: String, strength: Int) = {
val saw = new ItemSaw(config.getTag(name).useBraces(), strength)
.setUnlocalizedName("microblock:" + name)
.setTextureName("microblock:" + name)
GameRegistry.registerItem(saw, name)
saws += saw
saw
}
def addSawRecipe(saw: Item, blade: Item) {
CraftingManager.getInstance.getRecipeList
.asInstanceOf[JList[IRecipe]]
.add(
new ShapedOreRecipe(
new ItemStack(saw),
"srr",
"sbr",
's': Character,
"stickWood",
'r': Character,
"rodStone",
'b': Character,
blade
)
)
}
def init() {
CraftingManager.getInstance.getRecipeList
.asInstanceOf[JList[IRecipe]]
.add(MicroRecipe)
if (!Loader.isModLoaded("dreamcraft")) {
CraftingManager.getInstance.addRecipe(
new ItemStack(stoneRod, 4),
"s",
"s",
's': Character,
Blocks.stone
)
addSawRecipe(sawStone, Items.flint)
addSawRecipe(sawIron, Items.iron_ingot)
addSawRecipe(sawDiamond, Items.diamond)
}
}
protected var saws = mutable.MutableList[Item]()
def createSaw(config: ConfigFile, name: String, strength: Int) = {
val saw = new ItemSaw(config.getTag(name).useBraces(), strength)
.setUnlocalizedName("microblock:" + name).setTextureName("microblock:" + name)
GameRegistry.registerItem(saw, name)
saws+=saw
saw
}
def addSawRecipe(saw: Item, blade: Item) {
CraftingManager.getInstance.getRecipeList.asInstanceOf[JList[IRecipe]].add(
new ShapedOreRecipe(new ItemStack(saw),
"srr",
"sbr",
's': Character, "stickWood",
'r': Character, "rodStone",
'b': Character, blade))
}
def init() {
CraftingManager.getInstance.getRecipeList.asInstanceOf[JList[IRecipe]].add(MicroRecipe)
if (!Loader.isModLoaded("dreamcraft")) {
CraftingManager.getInstance.addRecipe(new ItemStack(stoneRod, 4), "s", "s", 's': Character, Blocks.stone)
addSawRecipe(sawStone, Items.flint)
addSawRecipe(sawIron, Items.iron_ingot)
addSawRecipe(sawDiamond, Items.diamond)
}
}
def postInit() {
MicroMaterialRegistry.calcMaxCuttingStrength()
PacketCustom.assignHandshakeHandler(MicroblockSPH.registryChannel, MicroblockSPH)
}
def postInit() {
MicroMaterialRegistry.calcMaxCuttingStrength()
PacketCustom.assignHandshakeHandler(
MicroblockSPH.registryChannel,
MicroblockSPH
)
}
}
class MicroblockProxy_clientImpl extends MicroblockProxy_serverImpl
{
@SideOnly(Side.CLIENT)
lazy val renderBlocks = new RenderBlocks
class MicroblockProxy_clientImpl extends MicroblockProxy_serverImpl {
@SideOnly(Side.CLIENT)
lazy val renderBlocks = new RenderBlocks
@SideOnly(Side.CLIENT)
override def postInit() {
super.postInit()
MicroMaterialRegistry.loadIcons()
MinecraftForgeClient.registerItemRenderer(itemMicro, ItemMicroPartRenderer)
PacketCustom.assignHandler(MicroblockCPH.registryChannel, MicroblockCPH)
}
@SideOnly(Side.CLIENT)
override def postInit() {
super.postInit()
MicroMaterialRegistry.loadIcons()
MinecraftForgeClient.registerItemRenderer(itemMicro, ItemMicroPartRenderer)
PacketCustom.assignHandler(MicroblockCPH.registryChannel, MicroblockCPH)
}
@SideOnly(Side.CLIENT)
override def init() {
super.init()
saws.foreach(MinecraftForgeClient.registerItemRenderer(_, ItemSawRenderer))
}
@SideOnly(Side.CLIENT)
override def init() {
super.init()
saws.foreach(MinecraftForgeClient.registerItemRenderer(_, ItemSawRenderer))
}
}
object MicroblockProxy extends MicroblockProxy_clientImpl
{
}
object MicroblockProxy extends MicroblockProxy_clientImpl {}