Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 36 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
*.class
## .gitignore ##
# ignore all
*
*/

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.gitignore
.idea/
eclipse/
.gradle/
classes/
build/
!build/libs/
src/api/
src/main/kotlin/
src/test/
run_log.txt
buildlog.txt
# allow any
!/src
!/src/
!/gradle
!/gradle/
!/lib
!/lib/
!/libs
!/libs/
!/annotations
!/annotations/
!/version
!/version/
!/info
!/info/
!/build.gradle
!/settings.gradle
!/gradle.properties
!/install.bat
!/Release.bat
!/gradlew
!/gradlew.bat
!/build.bat
!/LICENSE
!/LICENSE.md
!/README
!/README.md
!/CONTRIBUTING
!/CONTRIBUTING.md
!/.gitignore
!/.gitmodules
!/.gitattributes
2 changes: 1 addition & 1 deletion src/main/java/antimattermod/core/AntiMatterModCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class AntiMatterModCore {
@SuppressWarnings("unused")
public void preinit(FMLPreInitializationEvent event) {
loadMeta(modMetadata);
DeveloperBossTexture.downloadTexture();//開発者のスキンのダウンロード
//DeveloperBossTexture.downloadTexture();//開発者のスキンのダウンロード
AntiMatterModRegistry.registerPreInit(event);
AMMRegistry.INSTANCE.handlePreinit();
OreDictionaryRegister.OreDictionaryRegisterPreInit(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package antimattermod.core.Energy.GUI
import antimattermod.core.AntiMatterModCore
import antimattermod.core.Util.Gui.ClearButton
import antimattermod.core.Energy.MultiBlock.TileMultiController
import antimattermod.core.Log
import antimattermod.core.Util.Gui.GuiHelper
import antimattermod.core.Util.Gui.TextureButton
import net.minecraft.client.Minecraft
Expand Down Expand Up @@ -62,15 +63,15 @@ class MultiControllerGui(private val tileMultiController: TileMultiController, p
super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_)
val i = Mouse.getEventX() * this.width / this.mc.displayWidth
val j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1
System.out.println("${i} :: ${j}")
Log.dev.info("${i} :: ${j}")

}

override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseZ: Int) {
super.drawGuiContainerForegroundLayer(mouseX, mouseZ)
when (tileMultiController.page) {
0 -> {
this.fontRendererObj.drawString(StatCollector.translateToLocal(tileMultiController.coreBlockName + ".name"),-3, 11, 0xFFFFFF )
this.fontRendererObj.drawString(StatCollector.translateToLocal(tileMultiController.coreBlockName + ".name"), -3, 11, 0xFFFFFF)

}
1 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ import net.minecraft.tileentity.TileEntity
*/
class TileMultiController : TileEntity() {

var blockMeta: Int = worldObj.getBlockMetadata(xCoord, yCoord, zCoord)
// worldObj may not be initialized when construct
var _blockMeta: Int? = null
val blockMeta: Int
get() {
if (_blockMeta==null)
_blockMeta = worldObj?.getBlockMetadata(xCoord, yCoord, zCoord)
return _blockMeta ?: throw AssertionError("worldObj must be initialized before using")
}

var page: Int = 0
var multiPlaceIndex: Int = -1

Expand Down
71 changes: 71 additions & 0 deletions src/main/java/antimattermod/core/Log.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package antimattermod.core;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.message.Message;
import org.apache.logging.log4j.spi.AbstractLogger;

/**
* ログクラス
* <p>
* さらば!{@link java.io.PrintStream#println() System.out.println()}
*
* @author Kamesuta
*/
public class Log {
private static boolean isDebugEnabled = true;
public static
@Nonnull
Logger log = LogManager.getLogger(AntiMatterModCore.MOD_ID);
public static
@Nonnull
Logger dev = new DevLogger(log);

private static class DevLogger extends AbstractLogger {
private Logger logger;

DevLogger(@Nonnull final Logger logger) {
this.logger = logger;
}

private boolean isEnabled() {
return isDebugEnabled;
}

@Override
protected boolean isEnabled(final @Nullable Level level, final @Nullable Marker marker, final @Nullable Message data, final @Nullable Throwable t) {
return isEnabled();
}

@Override
protected boolean isEnabled(final @Nullable Level level, final @Nullable Marker marker, final @Nullable Object data, final @Nullable Throwable t) {
return isEnabled();
}

@Override
protected boolean isEnabled(final @Nullable Level level, final @Nullable Marker marker, final @Nullable String data) {
return isEnabled();
}

@Override
protected boolean isEnabled(final @Nullable Level level, final @Nullable Marker marker, final @Nullable String data, final @Nullable Object... p1) {
return isEnabled();
}

@Override
protected boolean isEnabled(final @Nullable Level level, final @Nullable Marker marker, final @Nullable String data, final @Nullable Throwable t) {
return isEnabled();
}

@Override
public void log(final @Nullable Marker marker, final @Nullable String fqcn, final @Nullable Level level, final @Nullable Message data, final @Nullable Throwable t) {
if (isEnabled() && data != null)
this.logger.log(level, marker, "[DEBUG] " + data.getFormattedMessage(), t);
}
}
}
55 changes: 28 additions & 27 deletions src/main/java/antimattermod/core/Mob/render/RenderDeveloperBoss.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,25 @@ import java.io.File
* Created by kojin15.
*/
class RenderDeveloperBoss() : RenderLiving(ModelDeveloperBoss(), 0.5f) {

var skin: ResourceLocation? = null

//仮コード。後に書き換える
override fun getEntityTexture(entity: Entity): ResourceLocation? {
if (skin == null) {
val texpath = DeveloperBossTexture.Raitichan.texturePath
if (skin == null && texpath != null) {
skin = ResourceLocation("AntiMatterMod:s/texture/raitichan.png")
val texturemanager = Minecraft.getMinecraft().textureManager
var obj = texturemanager.getTexture(skin)
if (obj == null) {
obj = ThreadDownloadImageData(File(DeveloperBossTexture.Raitichan.texturePath), null, AbstractClientPlayer.locationStevePng,
//==================================================================================================================
obj = ThreadDownloadImageData(texpath, null, AbstractClientPlayer.locationStevePng, null
/*/==================================================================================================================
object : IImageBuffer {

private var imageData: IntArray? = null
private var imageWidth: Int = 0
private var imageHeight: Int = 0

override fun parseUserSkin(bufferedImage: BufferedImage?): BufferedImage? {
if (bufferedImage == null) {
return null
Expand All @@ -54,13 +55,13 @@ class RenderDeveloperBoss() : RenderLiving(ModelDeveloperBoss(), 0.5f) {
this.setAreaOpaque(0, 0, 32, 16)//頭部分を不透明に
this.setAreaOpaque(0, 16, 64, 32)//胴体や腕等の旧テクスチャ部分を不透明に
this.setAreaOpaque(16, 48, 48, 64)//新テクスチャの腕や足部分を不透明に

this.setAreaTransparent(32, 0, 64, 16)//頭のウェアー部分がすべて不透明だった場合透明に

if (bufferedImage.height < 64) {//旧型テクスチャの場合のコピー処理
var bytes: Array<Int?>
var bytes2: Array<Int?>

pasteArea(32, 48, 48, 64, copyArea(40, 16, 56, 32))//左腕のテクスチャコピー
mirrorArea(32, 52, 48, 64)//左腕のテクスチャ反転
mirrorArea(36, 48, 40, 52)
Expand All @@ -74,7 +75,7 @@ class RenderDeveloperBoss() : RenderLiving(ModelDeveloperBoss(), 0.5f) {
bytes2 = copyArea(36, 52, 40, 64)//parts 2
pasteArea(36, 52, 40, 64, bytes)//3 -> 2 1341
pasteArea(32, 52, 36, 64, bytes2)//2 -> 1 2341

pasteArea(16, 48, 32, 64, copyArea(0, 16, 16, 32))//左足のテクスチャコピー
mirrorArea(16, 52, 32, 64)//左足のテクスチャ反転
mirrorArea(20, 48, 24, 52)
Expand All @@ -88,13 +89,13 @@ class RenderDeveloperBoss() : RenderLiving(ModelDeveloperBoss(), 0.5f) {
bytes2 = copyArea(20, 52, 24, 64)//parts 2
pasteArea(20, 52, 24, 64, bytes)//3 -> 2 1341
pasteArea(16, 52, 20, 64, bytes2)//2 -> 1 2341

}

return bufferedimage1
}
}

private fun copyArea(x: Int, y: Int, xEnd: Int, yEnd: Int): Array<Int?> {
val bytes: Array<Int?> = kotlin.arrayOfNulls((xEnd - x) * (yEnd - y))
var o = 0
Expand All @@ -106,7 +107,7 @@ class RenderDeveloperBoss() : RenderLiving(ModelDeveloperBoss(), 0.5f) {
}
return bytes
}

private fun pasteArea(x: Int, y: Int, xEnd: Int, yEnd: Int, bytes: Array<Int?>) {
var o = 0
for (i in x..xEnd - 1) {
Expand All @@ -116,7 +117,7 @@ class RenderDeveloperBoss() : RenderLiving(ModelDeveloperBoss(), 0.5f) {
}
}
}

private fun mirrorArea(x: Int, y: Int, xEnd: Int, yEnd: Int) {
val bytes: Array<Int?> = kotlin.arrayOfNulls((xEnd - x) * (yEnd - y))
var o = 0
Expand All @@ -134,7 +135,7 @@ class RenderDeveloperBoss() : RenderLiving(ModelDeveloperBoss(), 0.5f) {
}
}
}

private fun setAreaTransparent(x: Int, y: Int, xEnd: Int, yEnd: Int) {
if (!this.hasTransparency(x, y, xEnd, yEnd)) {
for (i in x..xEnd - 1) {
Expand All @@ -144,47 +145,47 @@ class RenderDeveloperBoss() : RenderLiving(ModelDeveloperBoss(), 0.5f) {
}
}
}

private fun setAreaOpaque(x: Int, y: Int, xEnd: Int, yExd: Int) {
for (i in x..xEnd - 1) {
for (j in y..yExd - 1) {
this.imageData!![i + j * this.imageWidth] = this.imageData!![i + j * this.imageWidth] or -16777216
}
}
}

private fun hasTransparency(x: Int, y: Int, xEnd: Int, yEnd: Int): Boolean {
for (i in x..xEnd - 1) {
(y..yEnd - 1)
.map { this.imageData!![i + it * this.imageWidth] }
.filter { it shr 24 and 255 < 128 }
.forEach { return true }
}

return false
}

override fun func_152634_a() {
}
}
//==================================================================================================================
*///==================================================================================================================
)

texturemanager.loadTexture(skin, obj)
}
}
return skin
return skin ?: AbstractClientPlayer.locationStevePng
}

fun doRender(entity: EntityDeveloperBoss, d0: Double, d1: Double, d2: Double, f0: Float, f1: Float) {
BossStatus.setBossStatus(entity, false)
super.doRender(entity as EntityLiving, d0, d1, d2, f0, f1)
}

override fun doRender(livingBase: EntityLivingBase, d0: Double, d1: Double, d2: Double, f0: Float, f1: Float) {
this.doRender(livingBase as EntityDeveloperBoss, d0, d1, d2, f0, f1)
}

override fun doRender(living: EntityLiving, d0: Double, d1: Double, d2: Double, f0: Float, f1: Float) {
this.doRender(living as EntityDeveloperBoss, d0, d1, d2, f0, f1)
}
Expand Down
Loading