4 Commits
Author SHA1 Message Date
chylex cfab626586 Add README 2023-01-17 03:05:20 +01:00
chylex cc6e26152d Add .gitignore and .gitattributes 2023-01-17 02:41:52 +01:00
chylex cc299af6b8 Add Gradle 7.5.1 wrapper 2023-01-17 02:31:58 +01:00
chylex 8cb7d6f973 Initial commit 2023-01-17 02:30:39 +01:00
1984 changed files with 227 additions and 66650 deletions
+1
View File
@@ -0,0 +1 @@
* text=auto eol=lf
+7 -18
View File
@@ -1,28 +1,17 @@
# gradle
/.gradle/
build/
# idea
out
*.ipr
*.iws
*.iml
.idea/gradle.xml
.idea/tasks.xml
.idea/workspace.xml
.idea/codeStyles
.idea/libraries
/.idea/
# eclipse
bin
/bin/
*.launch
.settings
.metadata
.classpath
.project
# gradle
build
.gradle
# game
run/*
!run/*.ps1
/run/
-41
View File
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaProjectCodeInsightSettings">
<excluded-names>
<name>akka</name>
<name>chylex.hee.client.util.MC</name>
<name>com.ibm</name>
<name>com.sun</name>
<name>java.awt</name>
<name>java.beans</name>
<name>java.rmi</name>
<name>javafx</name>
<name>javax.rmi</name>
<name>javax.swing</name>
<name>javax.xml</name>
<name>jdk.internal</name>
<name>net.java.games.input.Component.Identifier.Key</name>
<name>net.minecraft.init.Blocks</name>
<name>net.minecraft.init.Items</name>
<name>net.minecraft.init.MobEffects</name>
<name>net.minecraft.init.PotionTypes</name>
<name>net.minecraft.init.SoundEvents</name>
<name>net.minecraft.util.EnumActionResult</name>
<name>net.minecraft.util.EnumFacing</name>
<name>net.minecraft.util.EnumHand</name>
<name>net.minecraft.world.EnumDifficulty</name>
<name>net.minecraftforge.fml.common.Mod.EventBusSubscriber</name>
<name>net.minecraftforge.fml.common.eventhandler.Event</name>
<name>net.minecraftforge.fml.common.eventhandler.EventPriority</name>
<name>net.minecraftforge.fml.common.eventhandler.SubscribeEvent</name>
<name>net.minecraftforge.fml.relauncher.Side</name>
<name>net.minecraftforge.fml.relauncher.SideOnly</name>
<name>org.ietf</name>
<name>org.omg</name>
<name>org.w3c</name>
<name>org.xml</name>
<name>scala</name>
<name>sun</name>
</excluded-names>
</component>
</project>
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8">
<module name="Hardcore-Ender-Expansion-2.api" target="1.8" />
<module name="Hardcore-Ender-Expansion-2.main" target="1.8" />
<module name="Hardcore-Ender-Expansion-2.test" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
-22
View File
@@ -1,22 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="CascadeIf" enabled="false" level="INFO" enabled_by_default="false" />
<inspection_tool class="ClassName" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="namePattern" value="[A-Z][_A-Za-z\d]*" />
</inspection_tool>
<inspection_tool class="FoldInitializerAndIfToElvis" enabled="false" level="INFO" enabled_by_default="false" />
<inspection_tool class="FunctionName" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="namePattern" value="([A-Za-z][A-Za-z\d]*)|([A-Z][_A-Z\d]*)" />
</inspection_tool>
<inspection_tool class="RedundantSuppression" enabled="true" level="WARNING" enabled_by_default="true">
<option name="IGNORE_ALL" value="true" />
</inspection_tool>
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="UnusedProperty" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinCodeInsightWorkspaceSettings">
<option name="optimizeImportsOnTheFly" value="true" />
</component>
</project>
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Kotlin2JsCompilerArguments">
<option name="sourceMapEmbedSources" />
<option name="sourceMapPrefix" />
</component>
<component name="Kotlin2JvmCompilerArguments">
<option name="jvmTarget" value="1.8" />
</component>
</project>
-57
View File
@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="10">
<item index="0" class="java.lang.String" itemvalue="chylex.hee.system.migration.forge.SubscribeEvent" />
<item index="1" class="java.lang.String" itemvalue="chylex.hee.system.migration.forge.SubscribeEvent" />
<item index="2" class="java.lang.String" itemvalue="net.minecraftforge.eventbus.api.SubscribeEvent" />
<item index="3" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.Mod" />
<item index="4" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.Mod.EventBusSubscriber" />
<item index="5" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.Mod.EventBusSubscriber" />
<item index="6" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.Mod.EventHandler" />
<item index="7" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.eventhandler.SubscribeEvent" />
<item index="8" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.network.NetworkCheckHandler" />
<item index="9" class="java.lang.String" itemvalue="net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.Name" />
</list>
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="javax.annotation.Nullable" />
<option name="myDefaultNotNull" value="javax.annotation.Nonnull" />
<option name="myNullables">
<value>
<list size="11">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="10">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="9" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/bin" />
</component>
</project>
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/Hardcore-Ender-Expansion-2.iml" filepath="$PROJECT_DIR$/.idea/modules/Hardcore-Ender-Expansion-2.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/Hardcore-Ender-Expansion-2.main.iml" filepath="$PROJECT_DIR$/.idea/modules/Hardcore-Ender-Expansion-2.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/Hardcore-Ender-Expansion-2.test.iml" filepath="$PROJECT_DIR$/.idea/modules/Hardcore-Ender-Expansion-2.test.iml" />
</modules>
</component>
</project>
-14
View File
@@ -1,14 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Unit Tests" type="JUnit" factoryName="JUnit" singleton="true">
<module name="Hardcore-Ender-Expansion-2_test" />
<option name="PACKAGE_NAME" value="chylex.hee.test" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="./run" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
-4
View File
@@ -1,4 +0,0 @@
<changelist name="Development" date="1579752205042" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Development/shelved.patch" />
<option name="DESCRIPTION" value="Development" />
</changelist>
File diff suppressed because one or more lines are too long
-4
View File
@@ -1,4 +0,0 @@
<changelist name="Ender_Eye" date="1579752352230" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Ender_Eye/shelved.patch" />
<option name="DESCRIPTION" value="Ender Eye" />
</changelist>
File diff suppressed because one or more lines are too long
-4
View File
@@ -1,4 +0,0 @@
<changelist name="Experience_Table" date="1579752469474" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Experience_Table/shelved.patch" />
<option name="DESCRIPTION" value="Experience Table" />
</changelist>
File diff suppressed because one or more lines are too long
-4
View File
@@ -1,4 +0,0 @@
<changelist name="Ideas" date="1579750085391" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Ideas/shelved.patch" />
<option name="DESCRIPTION" value="Ideas" />
</changelist>
-53
View File
File diff suppressed because one or more lines are too long
-4
View File
@@ -1,4 +0,0 @@
<changelist name="Later" date="1579750352473" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Later/shelved.patch" />
<option name="DESCRIPTION" value="Later" />
</changelist>
-54
View File
File diff suppressed because one or more lines are too long
-4
View File
@@ -1,4 +0,0 @@
<changelist name="Shulker_Box" date="1579752489313" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Shulker_Box/shelved.patch" />
<option name="DESCRIPTION" value="Shulker Box" />
</changelist>
File diff suppressed because one or more lines are too long
-4
View File
@@ -1,4 +0,0 @@
<changelist name="Territories" date="1579750362160" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Territories/shelved.patch" />
<option name="DESCRIPTION" value="Territories" />
</changelist>
File diff suppressed because one or more lines are too long
-39
View File
@@ -1,39 +0,0 @@
<changelist name="Tomb" date="1579750369609" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Tomb/shelved.patch" />
<option name="DESCRIPTION" value="Tomb" />
<binary>
<option name="BEFORE_PATH" />
<option name="AFTER_PATH" value="src/main/resources/data/hee/structure/tombdungeon/corridor.stairs.end.nbt" />
<option name="SHELVED_PATH" value="$PROJECT_DIR$/.idea/shelf/Tomb/corridor.stairs.end.nbt" />
</binary>
<binary>
<option name="BEFORE_PATH" />
<option name="AFTER_PATH" value="src/main/resources/data/hee/structure/tombdungeon/corridor.stairs.middle.nbt" />
<option name="SHELVED_PATH" value="$PROJECT_DIR$/.idea/shelf/Tomb/corridor.stairs.middle.nbt" />
</binary>
<binary>
<option name="BEFORE_PATH" />
<option name="AFTER_PATH" value="src/main/resources/data/hee/structure/tombdungeon/corridor.stairs.start.nbt" />
<option name="SHELVED_PATH" value="$PROJECT_DIR$/.idea/shelf/Tomb/corridor.stairs.start.nbt" />
</binary>
<binary>
<option name="BEFORE_PATH" />
<option name="AFTER_PATH" value="src/main/resources/data/hee/structure/tombdungeon/main.end.nbt" />
<option name="SHELVED_PATH" value="$PROJECT_DIR$/.idea/shelf/Tomb/main.end.nbt" />
</binary>
<binary>
<option name="BEFORE_PATH" />
<option name="AFTER_PATH" value="src/main/resources/data/hee/structure/tombdungeon/tomb.multi2x4.narrow.nbt" />
<option name="SHELVED_PATH" value="$PROJECT_DIR$/.idea/shelf/Tomb/tomb.multi2x4.narrow.nbt" />
</binary>
<binary>
<option name="BEFORE_PATH" />
<option name="AFTER_PATH" value="src/main/resources/data/hee/structure/tombdungeon/tomb.multi2x4.spacious.nbt" />
<option name="SHELVED_PATH" value="$PROJECT_DIR$/.idea/shelf/Tomb/tomb.multi2x4.spacious.nbt" />
</binary>
<binary>
<option name="BEFORE_PATH" />
<option name="AFTER_PATH" value="src/main/resources/data/hee/structure/tombdungeon/tomb.single.narrow.nbt" />
<option name="SHELVED_PATH" value="$PROJECT_DIR$/.idea/shelf/Tomb/tomb.single.narrow.nbt" />
</binary>
</changelist>
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
-671
View File
@@ -1,671 +0,0 @@
Index: src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_StraightTombs.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_StraightTombs.kt (date 1579593033167)
+++ src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_StraightTombs.kt (date 1579593033167)
@@ -0,0 +1,43 @@
+package chylex.hee.game.world.feature.tombdungeon.piece
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnection
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnectionType.CORRIDOR
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnectionType.TOMB_ENTRANCE
+import chylex.hee.game.world.structure.IBlockPicker.Single.Air
+import chylex.hee.game.world.structure.IStructureWorld
+import chylex.hee.game.world.structure.piece.IStructurePieceConnection
+import chylex.hee.game.world.util.Size
+import chylex.hee.system.migration.Facing.EAST
+import chylex.hee.system.migration.Facing.NORTH
+import chylex.hee.system.migration.Facing.SOUTH
+import chylex.hee.system.migration.Facing.WEST
+import chylex.hee.system.util.Pos
+
+class TombDungeonCorridor_StraightTombs(piece: TombDungeonRoom_Tomb, configuration: Configuration, tombsPerSide: Int, override val isFancy: Boolean) : TombDungeonAbstractPiece(){
+ enum class Configuration{
+ WEST, EAST, BOTH
+ }
+
+ override val size = Size(5, 5, 5 + ((tombsPerSide - 1) * piece.size.x))
+
+ override val connections = mutableListOf<IStructurePieceConnection>().also {
+ it.add(TombDungeonConnection(CORRIDOR, Pos(size.centerX, 0, size.maxZ), SOUTH))
+ it.add(TombDungeonConnection(CORRIDOR, Pos(size.centerX, 0, 0), NORTH))
+
+ val spacing = piece.size.x
+
+ for(tombIndex in 0 until tombsPerSide){
+ if (configuration == Configuration.WEST || configuration == Configuration.BOTH){
+ it.add(TombDungeonConnection(TOMB_ENTRANCE, Pos(0, 0, 2 + (tombIndex * spacing)), WEST))
+ }
+
+ if (configuration == Configuration.EAST || configuration == Configuration.BOTH){
+ it.add(TombDungeonConnection(TOMB_ENTRANCE, Pos(size.maxX, 0, 2 + (tombIndex * spacing)), EAST))
+ }
+ }
+ }.toTypedArray()
+
+ override fun generate(world: IStructureWorld, instance: Instance){
+ super.generate(world, instance)
+ world.placeCube(Pos(1, 1, 1), Pos(size.maxX - 1, size.maxY - 1, size.maxZ - 1), Air)
+ }
+}
Index: src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_Straight.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_Straight.kt (date 1579593033167)
+++ src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_Straight.kt (date 1579593033167)
@@ -0,0 +1,24 @@
+package chylex.hee.game.world.feature.tombdungeon.piece
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnection
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnectionType.CORRIDOR
+import chylex.hee.game.world.structure.IBlockPicker.Single.Air
+import chylex.hee.game.world.structure.IStructureWorld
+import chylex.hee.game.world.structure.piece.IStructurePieceConnection
+import chylex.hee.game.world.util.Size
+import chylex.hee.system.migration.Facing.NORTH
+import chylex.hee.system.migration.Facing.SOUTH
+import chylex.hee.system.util.Pos
+
+class TombDungeonCorridor_Straight(length: Int, override val isFancy: Boolean) : TombDungeonAbstractPiece(){
+ override val size = Size(5, 5, length)
+
+ override val connections = arrayOf<IStructurePieceConnection>(
+ TombDungeonConnection(CORRIDOR, Pos(size.centerX, 0, size.maxZ), SOUTH),
+ TombDungeonConnection(CORRIDOR, Pos(size.centerX, 0, 0), NORTH)
+ )
+
+ override fun generate(world: IStructureWorld, instance: Instance){
+ super.generate(world, instance)
+ world.placeCube(Pos(1, 1, 1), Pos(size.maxX - 1, size.maxY - 1, size.maxZ - 1), Air)
+ }
+}
Index: src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonRoom_End.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonRoom_End.kt (date 1579594244672)
+++ src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonRoom_End.kt (date 1579594244672)
@@ -0,0 +1,108 @@
+package chylex.hee.game.world.feature.tombdungeon.piece
+import chylex.hee.game.block.BlockVoidPortalInner
+import chylex.hee.game.entity.item.EntityTokenHolder
+import chylex.hee.game.item.ItemPortalToken.TokenType.NORMAL
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnection
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnectionType.ROOM_ENTRANCE
+import chylex.hee.game.world.structure.IBlockPicker.Single.Air
+import chylex.hee.game.world.structure.IStructureWorld
+import chylex.hee.game.world.structure.piece.IStructurePieceConnection
+import chylex.hee.game.world.structure.trigger.EntityStructureTrigger
+import chylex.hee.game.world.structure.trigger.TileEntityStructureTrigger
+import chylex.hee.game.world.territory.TerritoryType.FORGOTTEN_TOMBS
+import chylex.hee.init.ModBlocks
+import chylex.hee.system.migration.Facing.EAST
+import chylex.hee.system.migration.Facing.NORTH
+import chylex.hee.system.migration.Facing.SOUTH
+import chylex.hee.system.migration.Facing.WEST
+import chylex.hee.system.migration.vanilla.Blocks
+import chylex.hee.system.util.Pos
+import chylex.hee.system.util.TagCompound
+import chylex.hee.system.util.allInCenteredBox
+import chylex.hee.system.util.with
+import chylex.hee.system.util.withFacing
+import net.minecraft.util.Direction
+import net.minecraft.util.math.BlockPos
+import kotlin.math.abs
+
+class TombDungeonRoom_End(file: String) : TombDungeonAbstractPieceFromFile(file, isFancy = true){
+ override val connections = arrayOf<IStructurePieceConnection>(
+ TombDungeonConnection(ROOM_ENTRANCE, Pos(centerX, 6, maxZ), SOUTH)
+ )
+
+ override fun generate(world: IStructureWorld, instance: Instance){
+ world.placeCube(Pos(1, 2, 1), Pos(maxX - 1, maxY - 1, maxZ - 1), Air)
+ super.generate(world, instance)
+
+ val portalCenter = Pos(centerX, 1, centerZ - 12)
+ val tombOffset = portalCenter.up(2)
+
+ for(pos in portalCenter.allInCenteredBox(1, 0, 1)){
+ world.addTrigger(pos, TileEntityStructureTrigger(ModBlocks.VOID_PORTAL_INNER.with(BlockVoidPortalInner.TYPE, BlockVoidPortalInner.Type.RETURN_INACTIVE), TagCompound()))
+ }
+
+ placeTokenHolders(world, tombOffset)
+ placeChests(world, tombOffset)
+ }
+
+ private fun placeTokenHolders(world: IStructureWorld, tombOffset: BlockPos){
+ val rand = world.rand
+ val tokenTombs = TOMBS.asList().shuffled(rand).take(2)
+
+ for(tokenTomb in tokenTombs){
+ val xOffset = (tokenTomb.offsetX1 + tokenTomb.offsetX2) * 0.5
+ val zOffset = (tokenTomb.offsetZ1 + tokenTomb.offsetZ2) * 0.5
+
+ val nudge = if (tokenTomb.isShortX) EAST else SOUTH
+ val trigger = EntityStructureTrigger({ realWorld -> EntityTokenHolder(realWorld, NORMAL, /*TODO*/FORGOTTEN_TOMBS) }, nudgeFacing = nudge, nudgeAmount = 0.5, yOffset = 0.35)
+
+ world.addTrigger(tombOffset.add(xOffset, 0.0, zOffset), trigger)
+ }
+ }
+
+ private fun placeChests(world: IStructureWorld, tombOffset: BlockPos){
+ val rand = world.rand
+ val chestTombs = TOMBS.flatMap { listOf(it to false, it to true) }.shuffled(rand).take(4)
+
+ for((chestTomb, offsetType) in chestTombs){
+ val x: IntArray
+ val z: IntArray
+ val facing: Direction
+
+ if (chestTomb.isShortX){
+ x = intArrayOf(chestTomb.offsetX1, chestTomb.offsetX2)
+ z = (if (offsetType) chestTomb.offsetZ1 else chestTomb.offsetZ2).let { intArrayOf(it, it) }
+ facing = if (offsetType) SOUTH else NORTH
+ }
+ else{
+ z = intArrayOf(chestTomb.offsetZ1, chestTomb.offsetZ2)
+ x = (if (offsetType) chestTomb.offsetX1 else chestTomb.offsetX2).let { intArrayOf(it, it) }
+ facing = if (offsetType) EAST else WEST
+ }
+
+ val picks = when(rand.nextInt(6)){
+ 0 -> intArrayOf(0)
+ 1 -> intArrayOf(1)
+ else -> intArrayOf(0, 1)
+ }
+
+ for(pick in picks){
+ world.setState(tombOffset.add(x[pick], 0, z[pick]), Blocks.CHEST.withFacing(facing))
+ // TODO loot
+ }
+ }
+ }
+
+ private companion object{
+ private class Tomb(val offsetX1: Int, val offsetZ1: Int, val offsetX2: Int, val offsetZ2: Int){
+ val isShortX = abs(offsetX1 - offsetX2) < abs(offsetZ1 - offsetZ2)
+ }
+
+ private val TOMBS = arrayOf(
+ Tomb(offsetX1 = -10, offsetZ1 = -2, offsetX2 = -9, offsetZ2 = 2),
+ Tomb(offsetX1 = 9, offsetZ1 = -2, offsetX2 = 10, offsetZ2 = 2),
+ Tomb(offsetX1 = 3, offsetZ1 = -9, offsetX2 = 7, offsetZ2 = -8),
+ Tomb(offsetX1 = -7, offsetZ1 = -9, offsetX2 = -3, offsetZ2 = -8)
+ )
+ }
+}
Index: src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_Intersection.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_Intersection.kt (date 1579593033167)
+++ src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_Intersection.kt (date 1579593033167)
@@ -0,0 +1,28 @@
+package chylex.hee.game.world.feature.tombdungeon.piece
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnection
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnectionType.CORRIDOR
+import chylex.hee.game.world.structure.IBlockPicker.Single.Air
+import chylex.hee.game.world.structure.IStructureWorld
+import chylex.hee.game.world.structure.piece.IStructurePieceConnection
+import chylex.hee.game.world.util.Size
+import chylex.hee.system.migration.Facing.EAST
+import chylex.hee.system.migration.Facing.NORTH
+import chylex.hee.system.migration.Facing.SOUTH
+import chylex.hee.system.migration.Facing.WEST
+import chylex.hee.system.util.Pos
+
+class TombDungeonCorridor_Intersection(override val isFancy: Boolean) : TombDungeonAbstractPiece(){
+ override val size = Size(5, 5, 5)
+
+ override val connections = arrayOf<IStructurePieceConnection>(
+ TombDungeonConnection(CORRIDOR, Pos(size.centerX, 0, 0), NORTH),
+ TombDungeonConnection(CORRIDOR, Pos(size.centerX, 0, size.maxZ), SOUTH),
+ TombDungeonConnection(CORRIDOR, Pos(size.maxX, 0, size.centerZ), EAST),
+ TombDungeonConnection(CORRIDOR, Pos(0, 0, size.centerZ), WEST)
+ )
+
+ override fun generate(world: IStructureWorld, instance: Instance){
+ super.generate(world, instance)
+ world.placeCube(Pos(1, 1, 1), Pos(size.maxX - 1, size.maxY - 1, size.maxZ - 1), Air)
+ }
+}
Index: src/main/java/chylex/hee/game/world/feature/tombdungeon/TombDungeonLevel.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/chylex/hee/game/world/feature/tombdungeon/TombDungeonLevel.kt (date 1579593033167)
+++ src/main/java/chylex/hee/game/world/feature/tombdungeon/TombDungeonLevel.kt (date 1579593033167)
@@ -0,0 +1,16 @@
+package chylex.hee.game.world.feature.tombdungeon
+import chylex.hee.system.util.nextInt
+import java.util.Random
+
+@Suppress("unused")
+enum class TombDungeonLevel(val isFancy: Boolean, private val corridorFactor: Int){
+ FIRST (isFancy = false, corridorFactor = 1),
+ SECOND(isFancy = false, corridorFactor = 5),
+ THIRD (isFancy = false, corridorFactor = 2),
+ FOURTH(isFancy = true, corridorFactor = 4),
+ LAST (isFancy = true, corridorFactor = 6);
+
+ fun getCorridorLength(rand: Random): Int{
+ return rand.nextInt(43 + (corridorFactor * 2), 55) + ((corridorFactor - 1) * rand.nextInt(12, 14)) + (if (this == LAST) 10 else 0)
+ }
+}
Index: src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_Stairs.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_Stairs.kt (date 1579593033167)
+++ src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonCorridor_Stairs.kt (date 1579593033167)
@@ -0,0 +1,56 @@
+package chylex.hee.game.world.feature.tombdungeon.piece
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnection
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnectionType.STAIR_BOTTOM
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnectionType.STAIR_TOP
+import chylex.hee.game.world.structure.IStructureWorld
+import chylex.hee.game.world.structure.piece.IStructurePieceConnection
+import chylex.hee.init.ModBlocks
+import chylex.hee.system.migration.Facing.NORTH
+import chylex.hee.system.migration.Facing.SOUTH
+import chylex.hee.system.util.Pos
+import chylex.hee.system.util.nextInt
+
+sealed class TombDungeonCorridor_Stairs(file: String) : TombDungeonAbstractPieceFromFile(file, isFancy = false){
+ class Start(file: String) : TombDungeonCorridor_Stairs(file){
+ override val connections = arrayOf<IStructurePieceConnection>(
+ TombDungeonConnection(STAIR_TOP, Pos(centerX, 2, 0), NORTH),
+ TombDungeonConnection(STAIR_BOTTOM, Pos(centerX, 0, maxZ), SOUTH)
+ )
+
+ override fun generate(world: IStructureWorld, instance: Instance){
+ super.generate(world, instance)
+
+ val rand = world.rand
+
+ for(z in 0..maxZ){
+ if (rand.nextInt(5) <= 1){
+ world.setBlock(Pos(rand.nextInt(1, maxX - 1), 2 - z, z), ModBlocks.DUSTY_STONE_BRICK_SLAB)
+ }
+ }
+ }
+ }
+
+ class Middle(file: String) : TombDungeonCorridor_Stairs(file){
+ override val connections = arrayOf<IStructurePieceConnection>(
+ TombDungeonConnection(STAIR_TOP, Pos(centerX, 1, 0), NORTH),
+ TombDungeonConnection(STAIR_BOTTOM, Pos(centerX, 0, maxZ), SOUTH)
+ )
+
+ override fun generate(world: IStructureWorld, instance: Instance){
+ super.generate(world, instance)
+
+ val rand = world.rand
+
+ if (rand.nextInt(5) <= 1){
+ world.setBlock(Pos(rand.nextInt(1, maxX - 1), 1, 0), ModBlocks.DUSTY_STONE_BRICK_SLAB)
+ }
+ }
+ }
+
+ class End(file: String) : TombDungeonCorridor_Stairs(file){
+ override val connections = arrayOf<IStructurePieceConnection>(
+ TombDungeonConnection(STAIR_TOP, Pos(centerX, 0, 0), NORTH),
+ TombDungeonConnection(STAIR_BOTTOM, Pos(centerX, 0, maxZ), SOUTH)
+ )
+ }
+}
Index: src/main/java/chylex/hee/game/world/feature/tombdungeon/TombDungeonPieces.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>package chylex.hee.game.world.feature.tombdungeon\r\nimport chylex.hee.game.world.structure.IBlockPicker.Weighted.Companion.Weighted\r\nimport chylex.hee.game.world.structure.IStructureDescription\r\nimport chylex.hee.game.world.structure.IStructureDescription.Companion.NULL_LOCATOR\r\nimport chylex.hee.game.world.structure.file.PaletteBuilder\r\nimport chylex.hee.game.world.structure.file.PaletteMappings\r\nimport chylex.hee.game.world.structure.piece.StructurePiece\r\nimport chylex.hee.game.world.util.Size\r\nimport chylex.hee.init.ModBlocks\r\nimport chylex.hee.system.migration.Facing.EAST\r\nimport chylex.hee.system.migration.Facing.NORTH\r\nimport chylex.hee.system.migration.Facing.SOUTH\r\nimport chylex.hee.system.migration.Facing.WEST\r\nimport chylex.hee.system.migration.vanilla.BlockSlab\r\nimport chylex.hee.system.migration.vanilla.BlockStairs\r\nimport chylex.hee.system.migration.vanilla.Blocks\r\nimport chylex.hee.system.util.with\r\nimport chylex.hee.system.util.withFacing\r\nimport net.minecraft.state.properties.Half\r\nimport net.minecraft.state.properties.SlabType\r\n\r\nobject TombDungeonPieces : IStructureDescription{\r\n\toverride val STRUCTURE_SIZE = Size(300, 110, 300)\r\n\t\r\n\toverride val STRUCTURE_BUILDER = TombDungeonBuilder\r\n\toverride val STRUCTURE_LOCATOR = NULL_LOCATOR\r\n\t\r\n\t// Palette\r\n\t\r\n\tval PALETTE_ENTRY_PLAIN_WALL_CEILING = Weighted(\r\n\t\t840 to ModBlocks.DUSTY_STONE_BRICKS,\r\n\t\t125 to ModBlocks.DUSTY_STONE,\r\n\t\t 35 to ModBlocks.DUSTY_STONE_CRACKED_BRICKS\r\n\t)\r\n\t\r\n\tval PALETTE_ENTRY_FANCY_WALL = Weighted(\r\n\t\t94 to ModBlocks.DUSTY_STONE_BRICKS,\r\n\t\t 6 to ModBlocks.DUSTY_STONE_CRACKED_BRICKS\r\n\t)\r\n\t\r\n\tval PALETTE_ENTRY_FANCY_CEILING = Weighted(\r\n\t\t860 to ModBlocks.DUSTY_STONE_BRICKS.defaultState,\r\n\t\t 82 to ModBlocks.DUSTY_STONE_CRACKED_BRICKS.defaultState,\r\n\t\t 30 to ModBlocks.DUSTY_STONE_BRICK_SLAB.with(BlockSlab.TYPE, SlabType.TOP),\r\n\t\t 7 to ModBlocks.DUSTY_STONE_BRICK_STAIRS.with(BlockStairs.HALF, Half.TOP).withFacing(NORTH),\r\n\t\t 7 to ModBlocks.DUSTY_STONE_BRICK_STAIRS.with(BlockStairs.HALF, Half.TOP).withFacing(SOUTH),\r\n\t\t 7 to ModBlocks.DUSTY_STONE_BRICK_STAIRS.with(BlockStairs.HALF, Half.TOP).withFacing(EAST),\r\n\t\t 7 to ModBlocks.DUSTY_STONE_BRICK_STAIRS.with(BlockStairs.HALF, Half.TOP).withFacing(WEST)\r\n\t)\r\n\t\r\n\tprivate val PALETTE_ENTRY_PLAIN_GRAVE = Weighted(\r\n\t\t74 to ModBlocks.GRAVE_DIRT_PLAIN,\r\n\t\t18 to ModBlocks.GRAVE_DIRT_SPIDERLING,\r\n\t\t 8 to ModBlocks.GRAVE_DIRT_LOOT\r\n\t)\r\n\t\r\n\tprivate val PALETTE_ENTRY_FANCY_GRAVE = Weighted(\r\n\t\t69 to ModBlocks.GRAVE_DIRT_PLAIN,\r\n\t\t27 to ModBlocks.GRAVE_DIRT_LOOT,\r\n\t\t 4 to ModBlocks.GRAVE_DIRT_SPIDERLING\r\n\t)\r\n\t\r\n\tprivate fun generateCommonPalette() = PaletteBuilder.Combined().apply {\r\n\t\tadd(\"air\", Blocks.AIR)\r\n\t\tadd(\"dustystone\", ModBlocks.DUSTY_STONE)\r\n\t\tadd(\"dustystone.bricks\", ModBlocks.DUSTY_STONE_BRICKS)\r\n\t\t\r\n\t\tadd(\"slab.dustystonebrick.*\", ModBlocks.DUSTY_STONE_BRICK_SLAB, PaletteMappings.SLAB_TYPE)\r\n\t\tadd(\"stairs.dustystonebrick.*.*\", ModBlocks.DUSTY_STONE_BRICK_STAIRS, listOf(PaletteMappings.STAIR_FLIP, PaletteMappings.FACING_HORIZONTAL)) // UPDATE migrate mappings\r\n\t\t\r\n\t\twith(forDevelopment){\r\n\t\t\tadd(\"dustystone.wall\", Blocks.LAPIS_BLOCK)\r\n\t\t\tadd(\"dustystone.ceiling\", Blocks.COAL_BLOCK)\r\n\t\t\tadd(\"gravedirt\", ModBlocks.GRAVE_DIRT_PLAIN)\r\n\t\t}\r\n\t}\r\n\t\r\n\toverride val PALETTE = with(generateCommonPalette()){\r\n\t\twith(forGeneration){\r\n\t\t\tadd(\"dustystone.wall\", PALETTE_ENTRY_PLAIN_WALL_CEILING)\r\n\t\t\tadd(\"dustystone.ceiling\", PALETTE_ENTRY_PLAIN_WALL_CEILING)\r\n\t\t\tadd(\"gravedirt\", PALETTE_ENTRY_PLAIN_GRAVE)\r\n\t\t}\r\n\t\t\r\n\t\tbuild()\r\n\t}\r\n\t\r\n\tval PALETTE_FANCY = with(generateCommonPalette()){\r\n\t\twith(forGeneration){\r\n\t\t\tadd(\"dustystone.wall\", PALETTE_ENTRY_FANCY_WALL)\r\n\t\t\tadd(\"dustystone.ceiling\", PALETTE_ENTRY_FANCY_CEILING)\r\n\t\t\tadd(\"gravedirt\", PALETTE_ENTRY_FANCY_GRAVE)\r\n\t\t}\r\n\t\t\r\n\t\tbuild()\r\n\t}\r\n\t\r\n\t// Pieces\r\n\t\r\n\toverride val ALL_PIECES\r\n\t\tget() = arrayOf<StructurePiece<*>>()\r\n}\r\n
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/chylex/hee/game/world/feature/tombdungeon/TombDungeonPieces.kt (revision 41aa0b6695a1ac98e2d75beae7cb260618fe1f25)
+++ src/main/java/chylex/hee/game/world/feature/tombdungeon/TombDungeonPieces.kt (date 1579594244682)
@@ -1,10 +1,15 @@
package chylex.hee.game.world.feature.tombdungeon
+import chylex.hee.game.world.feature.tombdungeon.piece.TombDungeonAbstractPiece
+import chylex.hee.game.world.feature.tombdungeon.piece.TombDungeonCorridor_Intersection
+import chylex.hee.game.world.feature.tombdungeon.piece.TombDungeonCorridor_Stairs
+import chylex.hee.game.world.feature.tombdungeon.piece.TombDungeonCorridor_Straight
+import chylex.hee.game.world.feature.tombdungeon.piece.TombDungeonRoom_End
+import chylex.hee.game.world.feature.tombdungeon.piece.TombDungeonRoom_Tomb
import chylex.hee.game.world.structure.IBlockPicker.Weighted.Companion.Weighted
import chylex.hee.game.world.structure.IStructureDescription
import chylex.hee.game.world.structure.IStructureDescription.Companion.NULL_LOCATOR
import chylex.hee.game.world.structure.file.PaletteBuilder
import chylex.hee.game.world.structure.file.PaletteMappings
-import chylex.hee.game.world.structure.piece.StructurePiece
import chylex.hee.game.world.util.Size
import chylex.hee.init.ModBlocks
import chylex.hee.system.migration.Facing.EAST
@@ -14,10 +19,13 @@
import chylex.hee.system.migration.vanilla.BlockSlab
import chylex.hee.system.migration.vanilla.BlockStairs
import chylex.hee.system.migration.vanilla.Blocks
+import chylex.hee.system.util.nextInt
import chylex.hee.system.util.with
import chylex.hee.system.util.withFacing
import net.minecraft.state.properties.Half
import net.minecraft.state.properties.SlabType
+import java.util.Random
+import kotlin.math.min
object TombDungeonPieces : IStructureDescription{
override val STRUCTURE_SIZE = Size(300, 110, 300)
@@ -68,6 +76,13 @@
add("slab.dustystonebrick.*", ModBlocks.DUSTY_STONE_BRICK_SLAB, PaletteMappings.SLAB_TYPE)
add("stairs.dustystonebrick.*.*", ModBlocks.DUSTY_STONE_BRICK_STAIRS, listOf(PaletteMappings.STAIR_FLIP, PaletteMappings.FACING_HORIZONTAL)) // UPDATE migrate mappings
+ add("torch", Blocks.TORCH)
+ add("torch.*", Blocks.WALL_TORCH, PaletteMappings.FACING_HORIZONTAL)
+ add("redstonetorch", Blocks.REDSTONE_TORCH)
+ add("redstonetorch.*", Blocks.REDSTONE_WALL_TORCH, PaletteMappings.FACING_HORIZONTAL)
+
+ add("voidportal.frame", ModBlocks.VOID_PORTAL_FRAME)
+
with(forDevelopment){
add("dustystone.wall", Blocks.LAPIS_BLOCK)
add("dustystone.ceiling", Blocks.COAL_BLOCK)
@@ -97,6 +112,56 @@
// Pieces
+ //val PIECE_ROOM_TOMB_NARROW = TombDungeonRoom_Tomb("tomb.single.narrow.nbt", isFancy = false)
+
+ val PIECE_ROOM_END = TombDungeonRoom_End("main.end.nbt")
+
+ private val PIECES_STAIRS = arrayOf(
+ TombDungeonCorridor_Stairs.Start("corridor.stairs.start.nbt"),
+ TombDungeonCorridor_Stairs.Middle("corridor.stairs.middle.nbt"),
+ TombDungeonCorridor_Stairs.End("corridor.stairs.end.nbt")
+ )
+
+ fun PIECES_STAIRCASE(middle: Int): List<TombDungeonCorridor_Stairs>{
+ return listOf(PIECES_STAIRS[0], *Array(middle){ PIECES_STAIRS[1] }, PIECES_STAIRS[2])
+ }
+
+ fun PIECES_MAIN_CORRIDOR(rand: Random, level: TombDungeonLevel, cornerCount: Int): List<TombDungeonAbstractPiece>{
+ return mutableListOf<TombDungeonAbstractPiece>().apply {
+ val isFancy = level.isFancy
+ var lengthRemaining = level.getCorridorLength(rand)
+
+ while(lengthRemaining > 0){
+ val nextLength = if (level == TombDungeonLevel.LAST)
+ rand.nextInt(1, min(lengthRemaining, (lengthRemaining / 5) + 3))
+ else
+ rand.nextInt(1, min(lengthRemaining, (lengthRemaining / 3) + 5))
+
+ lengthRemaining -= nextLength
+ add(TombDungeonCorridor_Straight(nextLength, isFancy))
+ }
+
+ repeat(cornerCount){
+ add(TombDungeonCorridor_Intersection(isFancy))
+ }
+ }
+ }
+
override val ALL_PIECES
- get() = arrayOf<StructurePiece<*>>()
+ get() = arrayOf(
+ TombDungeonCorridor_Straight(length = 5, isFancy = false),
+ TombDungeonCorridor_Intersection(isFancy = false),
+
+ *PIECES_STAIRS,
+
+ // TODO
+ TombDungeonRoom_Tomb("tomb.single.narrow.nbt", entranceY = 2, isFancy = false),
+ TombDungeonRoom_Tomb("tomb.single.narrow.nbt", entranceY = 2, isFancy = true),
+ TombDungeonRoom_Tomb("tomb.multi2x4.narrow.nbt", entranceY = 1, isFancy = false),
+ TombDungeonRoom_Tomb("tomb.multi2x4.narrow.nbt", entranceY = 1, isFancy = true),
+ TombDungeonRoom_Tomb("tomb.multi2x4.spacious.nbt", entranceY = 3, isFancy = false),
+ TombDungeonRoom_Tomb("tomb.multi2x4.spacious.nbt", entranceY = 3, isFancy = true),
+
+ PIECE_ROOM_END
+ )
}
Index: src/main/java/chylex/hee/game/world/feature/tombdungeon/TombDungeonBuilder.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>package chylex.hee.game.world.feature.tombdungeon\r\nimport chylex.hee.game.world.feature.tombdungeon.TombDungeonPieces.STRUCTURE_SIZE\r\nimport chylex.hee.game.world.feature.tombdungeon.piece.TombDungeonStart\r\nimport chylex.hee.game.world.structure.piece.IStructureBuild\r\nimport chylex.hee.game.world.structure.piece.IStructureBuilder\r\nimport chylex.hee.game.world.structure.piece.StructureBuild\r\nimport chylex.hee.game.world.structure.piece.StructureBuild.PositionedPiece\r\nimport chylex.hee.game.world.util.Size.Alignment.CENTER\r\nimport chylex.hee.game.world.util.Size.Alignment.MAX\r\nimport chylex.hee.game.world.util.Transform\r\nimport net.minecraft.util.math.BlockPos\r\nimport java.util.Random\r\n\r\nobject TombDungeonBuilder : IStructureBuilder{\r\n\tval ENTRANCE_POS: BlockPos = STRUCTURE_SIZE.getPos(CENTER, MAX, MAX).add(-TombDungeonStart.size.centerX, -TombDungeonStart.size.y, -STRUCTURE_SIZE.x / 3)\r\n\t\r\n\toverride fun build(rand: Random): IStructureBuild?{\r\n\t\tval startingPiece = TombDungeonStart.MutableInstance(Transform.NONE)\r\n\t\tval startingPiecePos = ENTRANCE_POS\r\n\t\t\r\n\t\tval build = StructureBuild(STRUCTURE_SIZE, PositionedPiece(startingPiece, startingPiecePos))\r\n\t\t// TODO\r\n\t\treturn build.freeze()\r\n\t}\r\n}\r\n
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/chylex/hee/game/world/feature/tombdungeon/TombDungeonBuilder.kt (revision 41aa0b6695a1ac98e2d75beae7cb260618fe1f25)
+++ src/main/java/chylex/hee/game/world/feature/tombdungeon/TombDungeonBuilder.kt (date 1579593033167)
@@ -1,13 +1,21 @@
package chylex.hee.game.world.feature.tombdungeon
import chylex.hee.game.world.feature.tombdungeon.TombDungeonPieces.STRUCTURE_SIZE
+import chylex.hee.game.world.feature.tombdungeon.piece.TombDungeonAbstractPiece
+import chylex.hee.game.world.feature.tombdungeon.piece.TombDungeonCorridor_Straight
import chylex.hee.game.world.feature.tombdungeon.piece.TombDungeonStart
import chylex.hee.game.world.structure.piece.IStructureBuild
import chylex.hee.game.world.structure.piece.IStructureBuilder
+import chylex.hee.game.world.structure.piece.IStructureBuilder.ProcessBase
import chylex.hee.game.world.structure.piece.StructureBuild
+import chylex.hee.game.world.structure.piece.StructureBuild.AddMode
+import chylex.hee.game.world.structure.piece.StructureBuild.AddMode.APPEND
import chylex.hee.game.world.structure.piece.StructureBuild.PositionedPiece
+import chylex.hee.game.world.structure.piece.StructurePiece
import chylex.hee.game.world.util.Size.Alignment.CENTER
import chylex.hee.game.world.util.Size.Alignment.MAX
import chylex.hee.game.world.util.Transform
+import chylex.hee.system.util.nextInt
+import chylex.hee.system.util.removeItem
import net.minecraft.util.math.BlockPos
import java.util.Random
@@ -19,7 +27,81 @@
val startingPiecePos = ENTRANCE_POS
val build = StructureBuild(STRUCTURE_SIZE, PositionedPiece(startingPiece, startingPiecePos))
- // TODO
+ val process = Process(build, rand)
+
+ var lastPiece = build.generatedPieces.last()
+
+ run {
+ val stairLengths = mutableListOf<Int>().apply {
+ add(rand.nextInt(4, 7))
+ add(rand.nextInt(6, 13))
+ add(rand.nextInt(27, 28) - sum())
+ shuffle(rand)
+ }
+
+ for((index, stairLength) in stairLengths.withIndex()){
+ lastPiece = process.appendPieces(lastPiece, TombDungeonPieces.PIECES_STAIRCASE(stairLength)) ?: return null
+
+ val corridorLength = if (index == stairLengths.lastIndex) rand.nextInt(11, 13) else rand.nextInt(2, rand.nextInt(4, 5))
+ val corridorPiece = TombDungeonCorridor_Straight(corridorLength, isFancy = false)
+
+ lastPiece = process.appendPiece(lastPiece, corridorPiece) ?: return null
+ }
+ }
+
+ run {
+ val cornerCounts = mutableListOf(
+ rand.nextInt(2, 3),
+ rand.nextInt(4, 5),
+ rand.nextInt(5, 7),
+ rand.nextInt(6, 8)
+ )
+
+ for(level in TombDungeonLevel.values().dropLast(1)){
+ val corridorPieces = TombDungeonPieces.PIECES_MAIN_CORRIDOR(rand, level, rand.removeItem(cornerCounts))
+
+ if (!build.guardChain(10){
+ lastPiece = process.appendPieces(lastPiece, corridorPieces.shuffled(rand)) ?: return@guardChain false
+ lastPiece = process.appendPieces(lastPiece, TombDungeonPieces.PIECES_STAIRCASE(rand.nextInt(9, 17))) ?: return@guardChain false
+ return@guardChain true
+ }){
+ return null
+ }
+ }
+ }
+
+ run {
+ val cornerCount = rand.nextInt(10, 11)
+ val corridorPieces = TombDungeonPieces.PIECES_MAIN_CORRIDOR(rand, TombDungeonLevel.LAST, cornerCount)
+
+ if (!build.guardChain(10){
+ lastPiece = process.appendPieces(lastPiece, corridorPieces.shuffled(rand)) ?: return@guardChain false
+ return@guardChain true
+ }){
+ return null
+ }
+ }
+
+ process.appendPiece(lastPiece, TombDungeonPieces.PIECE_ROOM_END) ?: return null
return build.freeze()
}
+
+ private class Process(build: StructureBuild<StructurePiece<Unit>.MutableInstance>, rand: Random) : ProcessBase<StructurePiece<Unit>.MutableInstance>(build, rand){
+
+ // Piece placement
+
+ fun appendPiece(targetPiece: PositionedPiece<StructurePiece<Unit>.MutableInstance>, generatedPiece: TombDungeonAbstractPiece): PositionedPiece<StructurePiece<Unit>.MutableInstance>?{
+ return addPiece(targetPiece, generatedPiece)
+ }
+
+ fun appendPieces(targetPiece: PositionedPiece<StructurePiece<Unit>.MutableInstance>, generatedPieces: List<TombDungeonAbstractPiece>): PositionedPiece<StructurePiece<Unit>.MutableInstance>?{
+ return generatedPieces.fold(targetPiece){ lastPiece, nextPiece -> addPiece(lastPiece, nextPiece) ?: return null }
+ }
+
+ // Helpers
+
+ private fun addPiece(targetPiece: PositionedPiece<StructurePiece<Unit>.MutableInstance>, generatedPiece: TombDungeonAbstractPiece, mode: AddMode = APPEND): PositionedPiece<StructurePiece<Unit>.MutableInstance>?{
+ return baseAddPiece(mode, targetPiece, generatedPiece::MutableInstance)
+ }
+ }
}
Index: src/main/java/chylex/hee/game/world/territory/descriptions/Territory_ForgottenTombs.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>package chylex.hee.game.world.territory.descriptions\r\nimport chylex.hee.client.render.territory.lightmaps.ILightmap\r\nimport chylex.hee.client.render.territory.lightmaps.ILightmap.Companion.calcLightFactor\r\nimport chylex.hee.client.util.MC\r\nimport chylex.hee.game.world.territory.ITerritoryDescription\r\nimport chylex.hee.game.world.territory.properties.TerritoryColors\r\nimport chylex.hee.game.world.territory.properties.TerritoryEnvironment\r\nimport chylex.hee.system.migration.forge.Side\r\nimport chylex.hee.system.migration.forge.Sided\r\nimport chylex.hee.system.migration.vanilla.Potions\r\nimport chylex.hee.system.util.Pos\r\nimport chylex.hee.system.util.allInCenteredBoxMutable\r\nimport chylex.hee.system.util.color.IntColor.Companion.RGB\r\nimport chylex.hee.system.util.lookPosVec\r\nimport chylex.hee.system.util.math.LerpedFloat\r\nimport chylex.hee.system.util.nextFloat\r\nimport net.minecraft.util.math.Vec3d\r\nimport net.minecraft.world.LightType.BLOCK\r\nimport net.minecraft.world.LightType.SKY\r\nimport java.util.Random\r\nimport kotlin.math.max\r\nimport kotlin.math.pow\r\n\r\nobject Territory_ForgottenTombs : ITerritoryDescription{\r\n\toverride val colors = object : TerritoryColors(){\r\n\t\toverride val tokenTop = RGB(211, 212, 152)\r\n\t\toverride val tokenBottom = RGB(160, 151, 116)\r\n\t\t\r\n\t\toverride val portalSeed = 410L\r\n\t\t\r\n\t\toverride fun nextPortalColor(rand: Random, color: FloatArray){\r\n\t\t\tif (rand.nextBoolean()){\r\n\t\t\t\tcolor[0] = rand.nextFloat(0.65F, 0.9F)\r\n\t\t\t\tcolor[1] = rand.nextFloat(0.45F, 0.7F)\r\n\t\t\t\tcolor[2] = rand.nextFloat(0.15F, 0.4F)\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tcolor.fill(rand.nextFloat(0.95F, 1F))\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate const val MAX_FOG_DENSITY = 0.069F\r\n\t\r\n\toverride val environment = object : TerritoryEnvironment(){\r\n\t\toverride val fogColor\r\n\t\t\tget() = (fogDensity / 0.275F).let { Vec3d(0.15 + it, 0.08 + it, 0.03) }\r\n\t\t\r\n\t\toverride val fogDensity\r\n\t\t\tget() = currentFogDensity.get(MC.partialTicks)\r\n\t\t\r\n\t\toverride val skyLight = 15\r\n\t\t\r\n\t\toverride val voidRadiusMpXZ = 1.35F\r\n\t\toverride val voidRadiusMpY = 0.975F\r\n\t\toverride val voidCenterOffset = Vec3d(0.0, -8.0, 0.0)\r\n\t\t\r\n\t\toverride val lightmap = object : ILightmap{\r\n\t\t\toverride fun update(colors: FloatArray, sunBrightness: Float, skyLight: Float, blockLight: Float, partialTicks: Float){\r\n\t\t\t\tval blockFactor = calcLightFactor(blockLight)\r\n\t\t\t\t\r\n\t\t\t\tcolors[0] = (blockLight * 0.9F) + skyLight + 0.12F\r\n\t\t\t\tcolors[1] = (blockFactor * 0.7F) + (skyLight * 0.8F) + 0.08F\r\n\t\t\t\tcolors[2] = (blockFactor * 0.5F) + (skyLight * 1.2F) + (0.09F * nightVisionFactor)\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tprivate val currentFogDensity = LerpedFloat(MAX_FOG_DENSITY)\r\n\t\tprivate var nightVisionFactor = 0F\r\n\t\t\r\n\t\t@Sided(Side.CLIENT)\r\n\t\toverride fun setupClient(){\r\n\t\t\ttickClient()\r\n\t\t\tcurrentFogDensity.updateImmediately(MAX_FOG_DENSITY * 0.8F)\r\n\t\t}\r\n\t\t\r\n\t\t@Sided(Side.CLIENT)\r\n\t\toverride fun tickClient(){\r\n\t\t\tval player = MC.player\r\n\t\t\tval pos = player?.lookPosVec?.let(::Pos)\r\n\t\t\t\r\n\t\t\tval light: Float\r\n\t\t\t\r\n\t\t\tif (pos == null){\r\n\t\t\t\tlight = 1F\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tval world = player.world\r\n\t\t\t\t\r\n\t\t\t\tvar levelBlock = 0\r\n\t\t\t\tvar levelSky = 0\r\n\t\t\t\t\r\n\t\t\t\tfor(offset in pos.allInCenteredBoxMutable(1, 1, 1)){\r\n\t\t\t\t\tlevelBlock = max(levelBlock, world.getLightFor(BLOCK, offset))\r\n\t\t\t\t\tlevelSky = max(levelSky, world.getLightFor(SKY, offset))\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tlight = max(levelBlock / 15F, levelSky / 12F)\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tval prev = currentFogDensity.currentValue\r\n\t\t\tval next = MAX_FOG_DENSITY - (light.pow(0.2F) * 0.85F * MAX_FOG_DENSITY)\r\n\t\t\tval speed = if (next > prev) 0.025F else 0.055F\r\n\t\t\t\r\n\t\t\tcurrentFogDensity.update(prev + (next - prev) * speed)\r\n\t\t\tnightVisionFactor = if (player?.isPotionActive(Potions.NIGHT_VISION) == true) 1F else 0F\r\n\t\t}\r\n\t}\r\n}\r\n
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/chylex/hee/game/world/territory/descriptions/Territory_ForgottenTombs.kt (revision 41aa0b6695a1ac98e2d75beae7cb260618fe1f25)
+++ src/main/java/chylex/hee/game/world/territory/descriptions/Territory_ForgottenTombs.kt (date 1579593955530)
@@ -1,4 +1,5 @@
package chylex.hee.game.world.territory.descriptions
+import chylex.hee.client.render.territory.EnvironmentRenderer
import chylex.hee.client.render.territory.lightmaps.ILightmap
import chylex.hee.client.render.territory.lightmaps.ILightmap.Companion.calcLightFactor
import chylex.hee.client.util.MC
@@ -7,6 +8,7 @@
import chylex.hee.game.world.territory.properties.TerritoryEnvironment
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
+import chylex.hee.system.migration.vanilla.EntityPlayer
import chylex.hee.system.migration.vanilla.Potions
import chylex.hee.system.util.Pos
import chylex.hee.system.util.allInCenteredBoxMutable
@@ -55,6 +57,14 @@
override val voidRadiusMpY = 0.975F
override val voidCenterOffset = Vec3d(0.0, -8.0, 0.0)
+ override val renderer = EnvironmentRenderer(
+ /* TODO SkyCubeStatic(
+ texture = Resource.Vanilla("textures/environment/end_sky.png"),
+ color = Vec3d(0.99, 0.5, 0.7),
+ alpha = 1F
+ )*/
+ )
+
override val lightmap = object : ILightmap{
override fun update(colors: FloatArray, sunBrightness: Float, skyLight: Float, blockLight: Float, partialTicks: Float){
val blockFactor = calcLightFactor(blockLight)
@@ -69,41 +79,32 @@
private var nightVisionFactor = 0F
@Sided(Side.CLIENT)
- override fun setupClient(){
- tickClient()
+ override fun setupClient(player: EntityPlayer){
+ tickClient(player)
currentFogDensity.updateImmediately(MAX_FOG_DENSITY * 0.8F)
}
@Sided(Side.CLIENT)
- override fun tickClient(){
- val player = MC.player
- val pos = player?.lookPosVec?.let(::Pos)
-
- val light: Float
-
- if (pos == null){
- light = 1F
- }
- else{
- val world = player.world
-
- var levelBlock = 0
- var levelSky = 0
-
- for(offset in pos.allInCenteredBoxMutable(1, 1, 1)){
- levelBlock = max(levelBlock, world.getLightFor(BLOCK, offset))
- levelSky = max(levelSky, world.getLightFor(SKY, offset))
- }
-
- light = max(levelBlock / 15F, levelSky / 12F)
- }
+ override fun tickClient(player: EntityPlayer){
+ val world = player.world
+ val pos = Pos(player.lookPosVec)
+
+ var levelBlock = 0
+ var levelSky = 0
+
+ for(offset in pos.allInCenteredBoxMutable(1, 1, 1)){
+ levelBlock = max(levelBlock, world.getLightFor(BLOCK, offset))
+ levelSky = max(levelSky, world.getLightFor(SKY, offset))
+ }
+
+ val light = max(levelBlock / 15F, levelSky / 12F)
val prev = currentFogDensity.currentValue
val next = MAX_FOG_DENSITY - (light.pow(0.2F) * 0.85F * MAX_FOG_DENSITY)
val speed = if (next > prev) 0.025F else 0.055F
currentFogDensity.update(prev + (next - prev) * speed)
- nightVisionFactor = if (player?.isPotionActive(Potions.NIGHT_VISION) == true) 1F else 0F
+ nightVisionFactor = if (player.isPotionActive(Potions.NIGHT_VISION)) 1F else 0F
}
}
}
Index: src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonRoom_Tomb.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonRoom_Tomb.kt (date 1579593033167)
+++ src/main/java/chylex/hee/game/world/feature/tombdungeon/piece/TombDungeonRoom_Tomb.kt (date 1579593033167)
@@ -0,0 +1,18 @@
+package chylex.hee.game.world.feature.tombdungeon.piece
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnection
+import chylex.hee.game.world.feature.tombdungeon.connection.TombDungeonConnectionType.TOMB_ENTRANCE
+import chylex.hee.game.world.structure.IStructureWorld
+import chylex.hee.game.world.structure.piece.IStructurePieceConnection
+import chylex.hee.system.migration.Facing.SOUTH
+import chylex.hee.system.util.Pos
+
+class TombDungeonRoom_Tomb(file: String, entranceY: Int, isFancy: Boolean) : TombDungeonAbstractPieceFromFile(file, isFancy){
+ override val connections = arrayOf<IStructurePieceConnection>(
+ TombDungeonConnection(TOMB_ENTRANCE, Pos(centerX, entranceY, maxZ), SOUTH)
+ )
+
+ override fun generate(world: IStructureWorld, instance: Instance){
+ super.generate(world, instance)
+ // TODO
+ }
+}
Binary file not shown.
Binary file not shown.
Binary file not shown.
-18
View File
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Statistic">
<option name="fileTypes" value="cfg;info;md" />
<option name="separateTabsFileTypes" value="java;json;kt;lang;mcmeta;py" />
<option name="excludedDirectories">
<list>
<option value="$PROJECT_DIR$/.gradle" />
<option value="$PROJECT_DIR$/gradle" />
<option value="$PROJECT_DIR$/.idea" />
<option value="$PROJECT_DIR$/run" />
<option value="$PROJECT_DIR$/bin" />
<option value="$PROJECT_DIR$/assets" />
<option value="$PROJECT_DIR$/build" />
</list>
</option>
</component>
</project>
Generated
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitSharedSettings">
<option name="FORCE_PUSH_PROHIBITED_PATTERNS">
<list />
</option>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+1
View File
@@ -1,2 +1,3 @@
# Hardcore Ender Expansion 2
Work in progress. PRs will not be accepted before release.
Binary file not shown.
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
{"meta":{"format_version":"3.0","model_format":"modded_entity","box_uv":true},"name":"ender_eye","geo_name":"EnderEye","resolution":{"width":128,"height":64},"elements":[{"name":"head","from":[-9,0,-9],"to":[9,18,9],"autouv":0,"color":6,"origin":[0,0.5,0],"uuid":"fb9acb7e-e386-2daf-51e7-e487f7edb51e"},{"name":"eye","from":[-8,1,-9],"to":[8,17,-8],"autouv":0,"color":5,"origin":[0,0,0],"uv_offset":[15,47],"uuid":"0f34925f-0ce7-73d1-b6bc-3ebc6b954619"},{"name":"left","from":[9,-17,-2],"to":[12,10,1],"autouv":0,"color":3,"origin":[0,0,0],"uv_offset":[73,0],"uuid":"683a14b0-c7d3-ee33-e790-ec456d2eafa1"},{"name":"right","from":[-12,-17,-2],"to":[-9,10,1],"autouv":0,"color":6,"shade":false,"origin":[0,0,0],"uv_offset":[73,0],"uuid":"edc957d9-62dd-52d4-82a3-9db5f0f81fee"}],"outliner":[{"name":"head","uuid":"2a0767df-d550-08ea-5bef-585cc941b58f","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,9,0],"children":["fb9acb7e-e386-2daf-51e7-e487f7edb51e"]},{"name":"eye","uuid":"3ed25df7-6cab-0a5f-3900-39521430d664","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,9,0],"children":["0f34925f-0ce7-73d1-b6bc-3ebc6b954619"]},{"name":"arms","uuid":"50918f7b-a888-8c07-5851-72c157cac008","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,8.5,-0.5],"children":["683a14b0-c7d3-ee33-e790-ec456d2eafa1","edc957d9-62dd-52d4-82a3-9db5f0f81fee"]}],"textures":[{"path":"C:\\Dan\\Projekty\\Hardcore-Ender-Expansion-2\\src\\main\\resources\\assets\\hee\\textures\\entity\\ender_eye.png","name":"ender_eye.png","folder":"entity","namespace":"hee","id":"0","particle":false,"mode":"link","saved":true,"uuid":"43e48689-95e3-8430-06f8-1c61b6f96c9d"}]}
Binary file not shown.
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
{"meta":{"format_version":"3.0","model_format":"modded_entity","box_uv":true},"name":"IgneousPlate","geo_name":"IgneousPlate","resolution":{"width":32,"height":16},"elements":[{"name":"cube","from":[-14,-12,0],"to":[-12,-4,2],"autouv":0,"color":3,"origin":[3.5,8,1],"uv_offset":[0,6],"uuid":"90291b85-56cc-94f2-58ac-e37c867ac90a"},{"name":"cube","from":[-4,-12,0],"to":[-2,-4,2],"autouv":0,"color":1,"origin":[0,0,0],"uv_offset":[8,6],"uuid":"cf15a4d3-d9cb-be21-c49a-1e2cf8ba68e9"},{"name":"cube","from":[-14,-4,0],"to":[-2,-2,2],"autouv":0,"color":7,"origin":[0,0,0],"uuid":"5e21b956-681a-3556-7acd-a7098ee9fb5c"},{"name":"cube","from":[-14,-14,0],"to":[-2,-12,2],"autouv":0,"color":4,"origin":[0,0,0],"uv_offset":[0,4],"uuid":"e944760c-3ee1-ca95-0a38-f470471948ba"},{"name":"cube","from":[-12,-12,0.5],"to":[-4,-4,1.5],"autouv":0,"color":3,"origin":[0,0,0],"uv_offset":[14,7],"uuid":"0566d9d0-a1b5-e435-e234-caa759b3aec4"}],"outliner":[{"name":"outerBox","uuid":"a5f25de6-2619-4ae4-2de8-c1cdec9112b7","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,0,0],"children":["90291b85-56cc-94f2-58ac-e37c867ac90a","cf15a4d3-d9cb-be21-c49a-1e2cf8ba68e9","5e21b956-681a-3556-7acd-a7098ee9fb5c","e944760c-3ee1-ca95-0a38-f470471948ba"]},{"name":"innerBox","uuid":"62290e42-d30b-2154-940b-a50c3c127698","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[0,0,0],"children":["0566d9d0-a1b5-e435-e234-caa759b3aec4"]}],"textures":[{"path":"C:\\Dan\\Projekty\\Hardcore-Ender-Expansion-2\\src\\main\\resources\\assets\\hee\\textures\\entity\\igneous_plate.png","name":"igneous_plate.png","folder":"entity","namespace":"hee","id":"0","particle":false,"mode":"link","saved":true,"uuid":"f1c8b220-6b45-6f19-175d-ba78fba868a3"}]}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-131
View File
@@ -1,131 +0,0 @@
buildscript{
ext.kotlin_version = "1.3.61"
repositories{
jcenter()
mavenCentral()
maven{
url = "https://files.minecraftforge.net/maven"
}
}
dependencies{
classpath(group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "3.+", changing: true){
exclude group: "trove", module: "trove"
}
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:" + kotlin_version
}
}
repositories{
maven{
url = "https://minecraft.curseforge.com/api/maven"
}
}
apply plugin: "net.minecraftforge.gradle"
apply plugin: "eclipse"
apply plugin: "kotlin"
def mcversion = "1.14.4"
def forgeversion = "28.1.116"
def kottleversion = "1.4.0"
def prefixName = "displayName = "
def prefixVersion = "version = "
def metaLines = file("src/main/resources/META-INF/mods.toml").readLines()
def metaName = metaLines.find { line -> line.startsWith(prefixName) }.substring(prefixName.length())[1..-2]
def metaVersion = metaLines.find { line -> line.startsWith(prefixVersion) }.substring(prefixVersion.length())[1..-2]
group = "chylex.hee"
version = metaVersion
archivesBaseName = metaName.replaceAll("\\s", "")
sourceCompatibility = targetCompatibility = "1.8"
tasks.withType(JavaCompile){
sourceCompatibility = targetCompatibility = "1.8"
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile){
kotlinOptions{
jvmTarget = "1.8"
apiVersion = "1.3"
languageVersion = "1.3"
freeCompilerArgs = [
"-Xno-call-assertions",
"-Xno-param-assertions",
"-Xno-receiver-assertions",
"-Xjvm-default=enable",
"-Xuse-experimental=kotlin.ExperimentalUnsignedTypes",
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
"-XXLanguage:+InlineClasses"
]
}
}
minecraft{
mappings channel: "snapshot", version: "20200119-1.14.4"
accessTransformer = file("src/main/resources/META-INF/accesstransformer.cfg")
runs{
client{
properties "hee.debug": ""
workingDirectory file("run")
mods{
hee{
source sourceSets.main
}
}
}
server{
properties "hee.debug": ""
workingDirectory file("run")
mods{
hee{
source sourceSets.main
}
}
}
}
}
dependencies{
minecraft "net.minecraftforge:forge:" + mcversion + "-" + forgeversion
implementation "kottle:Kottle:" + kottleversion
testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.0-RC1"
}
test{
systemProperty "junit.jupiter.testinstance.lifecycle.default", "per_class"
}
jar{
archiveName = archivesBaseName + "-" + mcversion + "-v" + version + ".jar"
from("./"){
include "LICENSE"
}
manifest{
attributes([
"Specification-Title" : "bettersprinting",
"Specification-Version": "1",
"Specification-Vendor" : "chylex",
"Implementation-Title" : metaName,
"Implementation-Version": metaVersion,
"Implementation-Vendor" : "chylex",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
-3
View File
@@ -1,3 +0,0 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
Binary file not shown.
+1 -2
View File
@@ -1,6 +1,5 @@
#Wed Oct 31 13:34:38 CET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
Vendored
+186 -110
View File
@@ -1,78 +1,129 @@
#!/usr/bin/env bash
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn ( ) {
warn () {
echo "$*"
}
} >&2
die ( ) {
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
@@ -89,76 +140,101 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+31 -30
View File
@@ -1,4 +1,20 @@
@if "%DEBUG%" == "" @echo off
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -9,19 +25,22 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,44 +64,26 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
-5
View File
@@ -1,5 +0,0 @@
Param([Parameter(Mandatory = $True, Position = 1)][string] $filePath)
Add-Type -AssemblyName System.Windows.Forms
$files = new-object System.Collections.Specialized.StringCollection
$files.Add($filePath)
[System.Windows.Forms.Clipboard]::SetFileDropList($files)
-3
View File
@@ -1,3 +0,0 @@
Param([Parameter(Mandatory = $True, Position = 1)][string] $processId)
Add-Type -MemberDefinition '[DllImport("user32.dll")]public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);' -Name Functions -Namespace Win32
[Win32.Functions]::ShowWindow((Get-Process -Id $processId).MainWindowHandle, 3)
-77
View File
@@ -1,77 +0,0 @@
package chylex.hee
import chylex.hee.game.block.util.CustomPlantType
import chylex.hee.game.entity.living.EntityMobEnderman
import chylex.hee.game.entity.living.behavior.EndermanBlockHandler
import chylex.hee.game.item.util.CustomRarity
import chylex.hee.game.mechanics.causatum.EnderCausatum
import chylex.hee.game.mechanics.instability.Instability
import chylex.hee.game.mechanics.trinket.TrinketHandler
import chylex.hee.game.world.WorldProviderEndCustom
import chylex.hee.game.world.feature.OverworldFeatures
import chylex.hee.game.world.territory.storage.TokenPlayerStorage
import chylex.hee.init.ModCreativeTabs
import chylex.hee.init.ModLoot
import chylex.hee.init.ModNetwork
import chylex.hee.init.ModPotions
import chylex.hee.init.ModTileEntities
import chylex.hee.proxy.Environment
import chylex.hee.system.Debug
import chylex.hee.system.IntegrityCheck
import chylex.hee.system.migration.forge.SubscribeAllEvents
import chylex.hee.system.migration.forge.SubscribeEvent
import net.minecraft.world.dimension.DimensionType
import net.minecraftforge.fml.ModLoadingContext
import net.minecraftforge.fml.common.Mod
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
@Mod(HEE.ID)
@SubscribeAllEvents(modid = HEE.ID, bus = MOD)
object HEE{
const val ID = "hee"
val log: Logger = LogManager.getLogger("HardcoreEnderExpansion")
val version: String
val dim: DimensionType = DimensionType.THE_END
val proxy = Environment.constructProxy()
init{
with(ModLoadingContext.get()){
version = activeContainer.modInfo.version.toString()
}
CustomRarity
CustomPlantType
ModCreativeTabs.initialize()
WorldProviderEndCustom.register()
}
@SubscribeEvent
fun onCommonSetup(@Suppress("UNUSED_PARAMETER") e: FMLCommonSetupEvent){
Debug.initialize()
ModNetwork.initialize()
ModLoot.initialize()
TrinketHandler.register()
EnderCausatum.register()
Instability.register()
TokenPlayerStorage.register()
OverworldFeatures.register()
}
@SubscribeEvent
fun onLoadComplete(@Suppress("UNUSED_PARAMETER") e: FMLLoadCompleteEvent){
EntityMobEnderman.setupBiomeSpawns()
EndermanBlockHandler.setupCarriableBlocks()
ModPotions.setupVanillaOverrides()
ModTileEntities.setupVanillaValidBlocks()
OverworldFeatures.setupVanillaOverrides()
IntegrityCheck.verify()
}
}
@@ -1,24 +0,0 @@
package chylex.hee.client.gui
import chylex.hee.client.gui.base.GuiBaseChestContainer
import chylex.hee.game.container.ContainerAmuletOfRecovery
import chylex.hee.network.server.PacketServerContainerEvent
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import net.minecraft.client.resources.I18n
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.util.text.ITextComponent
import net.minecraftforge.fml.client.config.GuiButtonExt
@Sided(Side.CLIENT)
class GuiAmuletOfRecovery(container: ContainerAmuletOfRecovery, inventory: PlayerInventory, title: ITextComponent) : GuiBaseChestContainer<ContainerAmuletOfRecovery>(container, inventory, title){
override fun init(){
super.init()
val moveAllTitle = I18n.format("gui.hee.amulet_of_recovery.move_all")
val moveAllWidth = (font.getStringWidth(moveAllTitle) + 14).coerceAtMost(xSize / 2)
addButton(GuiButtonExt(guiLeft + xSize - moveAllWidth - 7, (height / 2) + 6, moveAllWidth, 11, moveAllTitle){
PacketServerContainerEvent(0).sendToServer()
})
}
}
@@ -1,63 +0,0 @@
package chylex.hee.client.gui
import chylex.hee.client.render.util.GL
import chylex.hee.client.util.MC
import chylex.hee.game.block.entity.TileEntityBrewingStandCustom
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.ContainerBrewingStand
import chylex.hee.system.util.facades.Resource
import chylex.hee.system.util.totalTime
import net.minecraft.client.gui.screen.inventory.BrewingStandScreen
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.util.text.ITextComponent
@Sided(Side.CLIENT)
class GuiBrewingStandCustom(container: ContainerBrewingStand, inventory: PlayerInventory, title: ITextComponent) : BrewingStandScreen(container, inventory, title){
private companion object{
private val TEX_BACKGROUND = Resource.Custom("textures/gui/brewing_stand.png")
private val BUBBLE_LENGTHS = intArrayOf(0, 6, 11, 16, 20, 24, 29)
}
private var brewStartTime = MC.world!!.totalTime
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
val x = (width - xSize) / 2
val y = (height - ySize) / 2
GL.color(1F, 1F, 1F, 1F)
MC.textureManager.bindTexture(TEX_BACKGROUND)
blit(x, y, 0, 0, xSize, ySize)
val worldTime = MC.world!!.totalTime
val brewTime = container.func_216981_f() // RENAME getBrewTime
if (brewTime > 0){
val brewProgress = (28F * (1F - (brewTime / 400F))).toInt()
if (brewProgress > 0){
blit(x + 97, y + 16, 176, 0, 9, brewProgress)
}
val bubbleLength = BUBBLE_LENGTHS[((worldTime - brewStartTime).toInt() / 2) % 7]
if (bubbleLength > 0){
blit(x + 63, y + 43 - bubbleLength, 185, 29 - bubbleLength, 12, bubbleLength)
}
}
else{
brewStartTime = worldTime
}
if (container.getSlot(TileEntityBrewingStandCustom.SLOT_MODIFIER).hasStack){
blit(x + 62, y + 45, 197, 0, 14, 2)
}
for(slotIndex in TileEntityBrewingStandCustom.SLOTS_POTIONS){
val slot = container.getSlot(slotIndex)
if (!slot.hasStack){
blit(x + slot.xPos, y + slot.yPos, 211, 0, 16, 16)
}
}
}
}
@@ -1,11 +0,0 @@
package chylex.hee.client.gui
import chylex.hee.client.gui.base.GuiBaseChestContainer
import chylex.hee.game.block.entity.TileEntityLootChest
import chylex.hee.game.container.ContainerLootChest
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.util.text.ITextComponent
@Sided(Side.CLIENT)
class GuiLootChest(container: ContainerLootChest, inventory: PlayerInventory, title: ITextComponent) : GuiBaseChestContainer<ContainerLootChest>(container, inventory, TileEntityLootChest.getClientTitle(inventory.player, title))
@@ -1,15 +0,0 @@
package chylex.hee.client.gui
import chylex.hee.client.gui.base.GuiBaseChestContainer
import chylex.hee.game.container.ContainerPortalTokenStorage
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.item.ItemStack
import net.minecraft.util.text.ITextComponent
@Sided(Side.CLIENT)
class GuiPortalTokenStorage(container: ContainerPortalTokenStorage, inventory: PlayerInventory, title: ITextComponent) : GuiBaseChestContainer<ContainerPortalTokenStorage>(container, inventory, title){
fun canActivateToken(stack: ItemStack): Boolean{
return container.canActivateToken(stack)
}
}
@@ -1,41 +0,0 @@
package chylex.hee.client.gui
import chylex.hee.client.gui.base.GuiBaseCustomInventory
import chylex.hee.game.container.ContainerTrinketPouch
import chylex.hee.game.container.base.ContainerBaseCustomInventory
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.color.IntColor.Companion.RGBA
import chylex.hee.system.util.facades.Resource
import chylex.hee.system.util.size
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.util.text.ITextComponent
@Sided(Side.CLIENT)
class GuiTrinketPouch(container: ContainerTrinketPouch, inventory: PlayerInventory, title: ITextComponent) : GuiBaseCustomInventory<ContainerTrinketPouch>(container, inventory, title){
override val texBackground = Resource.Custom("textures/gui/trinket_pouch.png")
override val titleContainer = "gui.hee.trinket_pouch.title"
private val hiddenSlots: Int
private val hiddenSlotColor = RGBA(0u, 0.25F).i
init{
ySize = ContainerTrinketPouch.HEIGHT
hiddenSlots = ContainerTrinketPouch.MAX_SLOTS - (container as ContainerBaseCustomInventory<*>).containerInventory.size
}
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY)
val middleSlot = ContainerTrinketPouch.MAX_SLOTS / 2
repeat(hiddenSlots){
renderSlotCover(middleSlot + ((ContainerTrinketPouch.MAX_SLOTS - it) / 2) * (if (it % 2 == 0) -1 else 1))
}
}
private fun renderSlotCover(index: Int){
val x = guiLeft + 44 + (index * 18)
val y = guiTop + 18
fill(x, y, x + 16, y + 16, hiddenSlotColor)
}
}
@@ -1,48 +0,0 @@
package chylex.hee.client.gui.base
import chylex.hee.client.render.util.GL
import chylex.hee.client.util.MC
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.ContainerChest
import chylex.hee.system.util.color.IntColor.Companion.RGB
import chylex.hee.system.util.facades.Resource
import chylex.hee.system.util.size
import net.minecraft.client.gui.screen.inventory.ContainerScreen
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.util.text.ITextComponent
@Sided(Side.CLIENT)
abstract class GuiBaseChestContainer<T : ContainerChest>(container: T, inventory: PlayerInventory, title: ITextComponent) : ContainerScreen<T>(container, inventory, title){
private companion object{
private val TEX_BACKGROUND = Resource.Vanilla("textures/gui/container/generic_54.png")
private val COLOR_TEXT = RGB(64u).i
}
private val containerRows = container.lowerChestInventory.size / 9
init{
ySize = 114 + (containerRows * 18)
}
override fun render(mouseX: Int, mouseY: Int, partialTicks: Float){
renderBackground()
super.render(mouseX, mouseY, partialTicks)
renderHoveredToolTip(mouseX, mouseY)
}
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
val x = (width - xSize) / 2
val y = (height - ySize) / 2
val heightContainer = 17 + (containerRows * 18)
GL.color(1F, 1F, 1F, 1F)
MC.textureManager.bindTexture(TEX_BACKGROUND)
blit(x, y, 0, 0, xSize, heightContainer)
blit(x, y + heightContainer, 0, 126, xSize, 96)
}
override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int){
font.drawString(title.formattedText, 8F, 6F, COLOR_TEXT)
font.drawString(playerInventory.displayName.formattedText, 8F, ySize - 94F, COLOR_TEXT)
}
}
@@ -1,41 +0,0 @@
package chylex.hee.client.gui.base
import chylex.hee.client.render.util.GL
import chylex.hee.client.util.MC
import chylex.hee.game.container.base.ContainerBaseCustomInventory
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.color.IntColor.Companion.RGB
import net.minecraft.client.gui.screen.inventory.ContainerScreen
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.util.ResourceLocation
import net.minecraft.util.text.ITextComponent
@Sided(Side.CLIENT)
abstract class GuiBaseCustomInventory<T : ContainerBaseCustomInventory<*>>(container: T, inventory: PlayerInventory, title: ITextComponent) : ContainerScreen<T>(container, inventory, title){
private companion object{
private val COLOR_TEXT = RGB(64u).i
}
protected abstract val texBackground: ResourceLocation
protected abstract val titleContainer: String
override fun render(mouseX: Int, mouseY: Int, partialTicks: Float){
renderBackground()
super.render(mouseX, mouseY, partialTicks)
renderHoveredToolTip(mouseX, mouseY)
}
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
val x = (width - xSize) / 2
val y = (height - ySize) / 2
GL.color(1F, 1F, 1F, 1F)
MC.textureManager.bindTexture(texBackground)
blit(x, y, 0, 0, xSize, ySize)
}
override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int){
font.drawString(title.formattedText, 8F, 6F, COLOR_TEXT)
font.drawString(playerInventory.displayName.formattedText, 8F, ySize - 94F, COLOR_TEXT)
}
}
@@ -1,44 +0,0 @@
package chylex.hee.client.model
import chylex.hee.client.util.MC
import chylex.hee.system.migration.Hand.MAIN_HAND
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.EntityPlayer
import chylex.hee.system.util.Vec3
import chylex.hee.system.util.lookPosVec
import chylex.hee.system.util.subtractY
import net.minecraft.util.Hand
import net.minecraft.util.HandSide.RIGHT
import net.minecraft.util.math.MathHelper
import net.minecraft.util.math.Vec3d
import kotlin.math.abs
import kotlin.math.pow
object ModelHelper{
@Sided(Side.CLIENT)
fun getHandPosition(player: EntityPlayer, hand: Hand): Vec3d{
val yawOffsetMp = (if (player.primaryHand == RIGHT) 1 else -1) * (if (hand == MAIN_HAND) 1 else -1)
if (player === MC.player && MC.settings.thirdPersonView == 0){
val pitch = MathHelper.wrapDegrees(player.rotationPitch)
val yaw = MathHelper.wrapDegrees(player.rotationYaw)
val fov = MC.settings.fov.toFloat()
return player
.lookPosVec
.subtractY(0.1 + (pitch.coerceIn(-90F, 45F) * 0.0034))
.add(Vec3.fromYaw(yaw + (yawOffsetMp * fov * 0.6F)).scale(0.25))
.add(Vec3.fromYaw(yaw + 165F - (fov - 90F) / 2F).scale(abs(pitch.coerceIn(0F, 90F) / 90.0).pow(1.5) * (0.3 - abs(fov - 90.0) / 600F)))
// TODO kinda weird and inaccurate, maybe use the camera transformations somehow?
}
else{
val handOffset = if (player.isSneaking) 1.15 else 0.75
return player
.lookPosVec
.subtractY(handOffset)
.add(Vec3.fromYaw(player.renderYawOffset + yawOffsetMp * 39F).scale(0.52))
}
}
}
@@ -1,43 +0,0 @@
package chylex.hee.client.model.block
import chylex.hee.client.render.util.beginBox
import chylex.hee.client.render.util.render
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import net.minecraft.client.renderer.entity.model.RendererModel
import net.minecraft.client.renderer.model.Model
import kotlin.math.PI
import kotlin.math.abs
import kotlin.math.sin
@Sided(Side.CLIENT)
object ModelBlockIgneousPlate : Model(){
const val ANIMATION_PERIOD = PI
private val outerBox: RendererModel
private val innerBox: RendererModel
init{
textureWidth = 32
textureHeight = 16
outerBox = RendererModel(this).apply {
beginBox.offset(12F, 4F, 0F).size( 2, 8, 2).tex(0, 6).add()
beginBox.offset( 2F, 4F, 0F).size( 2, 8, 2).tex(8, 6).add()
beginBox.offset( 2F, 2F, 0F).size(12, 2, 2).tex(0, 0).add()
beginBox.offset( 2F, 12F, 0F).size(12, 2, 2).tex(0, 4).add()
}
innerBox = RendererModel(this).apply {
beginBox.offset(4F, 4F, 0.5F).size(8, 8, 1).tex(14, 7).add()
}
}
fun renderOuterBox(){
outerBox.render()
}
fun renderInnerBox(animation: Double){
innerBox.offsetZ = -abs(sin(-animation)).toFloat() * 0.0925F
innerBox.render()
}
}
@@ -1,67 +0,0 @@
package chylex.hee.client.model.entity
import chylex.hee.client.render.util.beginBox
import chylex.hee.game.entity.living.EntityBossEnderEye
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.toRadians
import net.minecraft.client.renderer.entity.model.EntityModel
import net.minecraft.client.renderer.entity.model.RendererModel
@Sided(Side.CLIENT)
object ModelEntityBossEnderEye : EntityModel<EntityBossEnderEye>(){
const val SCALE = 16F / 18F
private val head: RendererModel
private val eyes: Array<RendererModel>
private val arms: RendererModel
init{
textureWidth = 128
textureHeight = 64
head = RendererModel(this).apply {
setRotationPoint(0F, 15F, 0F)
beginBox.offset(-9F, -9F, -9F).size(18, 18, 18).tex(0, 0).add()
}
eyes = Array(8){
RendererModel(this).apply {
setRotationPoint(0F, 15F, 0F)
beginBox.offset(-8F, -8F, -9F).size(16, 16, 1).tex(-1 + (16 * it), 47).add()
cubeList[0].let { it.quads = arrayOf(it.quads[4]) } // front face only
}
}
arms = RendererModel(this).apply {
setRotationPoint(0F, 15.5F, -0.5F)
beginBox.offset(-12F, -1.5F, -1.5F).size(3, 27, 3).tex(73, 0).add()
beginBox.offset( 9F, -1.5F, -1.5F).size(3, 27, 3).tex(73, 0).mirror().add()
}
}
override fun setLivingAnimations(entity: EntityBossEnderEye, limbSwing: Float, limbSwingAmount: Float, partialTicks: Float){
super.setLivingAnimations(entity, limbSwing, limbSwingAmount, partialTicks)
arms.rotateAngleX = (entity as? EntityBossEnderEye)?.clientArmAngle?.get(partialTicks)?.toRadians() ?: 0F
}
override fun setRotationAngles(entity: EntityBossEnderEye, limbSwing: Float, limbSwingAmount: Float, ageInTicks: Float, netHeadYaw: Float, headPitch: Float, scale: Float){
super.setRotationAngles(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale)
head.rotateAngleX = headPitch.toRadians()
}
override fun render(entity: EntityBossEnderEye, limbSwing: Float, limbSwingAmount: Float, ageInTicks: Float, netHeadYaw: Float, headPitch: Float, scale: Float){
super.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale)
val boss = entity as? EntityBossEnderEye
val eyeState = when{
boss == null -> 1
boss.isSleeping -> 0
else -> boss.demonLevel + 1
}
head.render(scale)
eyes[eyeState].also { it.rotateAngleX = head.rotateAngleX }.render(scale)
arms.render(scale)
}
}
@@ -1,26 +0,0 @@
package chylex.hee.client.model.entity
import chylex.hee.client.render.util.beginBox
import chylex.hee.client.render.util.render
import chylex.hee.game.entity.item.EntityTokenHolder
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import net.minecraft.client.renderer.entity.model.EntityModel
import net.minecraft.client.renderer.entity.model.RendererModel
@Sided(Side.CLIENT)
object ModelEntityTokenHolder : EntityModel<EntityTokenHolder>(){
private val box: RendererModel
init{
textureWidth = 64
textureHeight = 32
box = RendererModel(this).apply {
beginBox.offset(-8F, -8F, -8F).size(16, 16, 16).add()
}
}
fun render(){
box.render()
}
}
@@ -1,15 +0,0 @@
package chylex.hee.client.model.entity
import chylex.hee.game.entity.living.EntityMobUndread
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import net.minecraft.client.renderer.entity.model.AbstractZombieModel
@Sided(Side.CLIENT)
class ModelEntityUndread private constructor(modelSize: Float, textureWidth: Int, textureHeight: Int) : AbstractZombieModel<EntityMobUndread>(modelSize, 0F, textureWidth, textureHeight){
constructor(modelSize: Float, tallTexture: Boolean) : this(modelSize, 64, if (tallTexture) 32 else 64)
constructor() : this(0F, false)
override fun func_212850_a_(entity: EntityMobUndread): Boolean{
return entity.isAggressive
}
}
@@ -1,56 +0,0 @@
package chylex.hee.client.model.item
import chylex.hee.HEE
import chylex.hee.client.util.MC
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.forge.SubscribeAllEvents
import chylex.hee.system.migration.forge.SubscribeEvent
import chylex.hee.system.util.facades.Resource
import net.minecraft.client.renderer.model.IBakedModel
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND
import net.minecraft.client.renderer.model.ModelResourceLocation
import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.event.ModelBakeEvent
import net.minecraftforge.client.event.ModelRegistryEvent
import net.minecraftforge.client.model.BakedModelWrapper
import net.minecraftforge.client.model.ModelLoader
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
import org.apache.commons.lang3.tuple.Pair
import javax.vecmath.Matrix4f
@Sided(Side.CLIENT)
class ModelItemAmuletOfRecovery private constructor(sourceModel: IBakedModel) : BakedModelWrapper<IBakedModel>(sourceModel){
@SubscribeAllEvents(modid = HEE.ID, bus = MOD)
companion object{
private val RESOURCE_NORMAL = ModelResourceLocation(Resource.Custom("amulet_of_recovery"), "inventory")
private val RESOURCE_HELD = Resource.Custom("item/amulet_of_recovery_held")
private lateinit var modelRegistry: MutableMap<ResourceLocation, IBakedModel>
@SubscribeEvent
fun onRegisterModels(@Suppress("UNUSED_PARAMETER") e: ModelRegistryEvent){
ModelLoader.addSpecialModel(RESOURCE_HELD)
}
@SubscribeEvent
fun onModelBake(e: ModelBakeEvent){
modelRegistry = e.modelRegistry
modelRegistry[RESOURCE_NORMAL] = ModelItemAmuletOfRecovery(modelRegistry.getValue(RESOURCE_NORMAL))
}
}
override fun handlePerspective(transformType: TransformType): Pair<out IBakedModel, Matrix4f> = when(transformType){
FIRST_PERSON_LEFT_HAND,
FIRST_PERSON_RIGHT_HAND,
THIRD_PERSON_LEFT_HAND,
THIRD_PERSON_RIGHT_HAND ->
modelRegistry.getOrElse(RESOURCE_HELD){ MC.instance.modelManager.missingModel }.handlePerspective(transformType)
else ->
super.handlePerspective(transformType)
}
}
@@ -1,152 +0,0 @@
package chylex.hee.client.render
import chylex.hee.HEE
import chylex.hee.client.render.util.GL
import chylex.hee.client.render.util.GL.DF_ONE_MINUS_SRC_ALPHA
import chylex.hee.client.render.util.GL.DF_ZERO
import chylex.hee.client.render.util.GL.FOG_EXP
import chylex.hee.client.render.util.GL.SF_ONE
import chylex.hee.client.render.util.GL.SF_SRC_ALPHA
import chylex.hee.client.util.MC
import chylex.hee.game.block.BlockAbstractPortal
import chylex.hee.game.block.entity.TileEntityEnergyCluster
import chylex.hee.game.block.info.Materials
import chylex.hee.game.mechanics.energy.IEnergyQuantity
import chylex.hee.game.mechanics.energy.IEnergyQuantity.Companion.MAX_POSSIBLE_VALUE
import chylex.hee.game.mechanics.energy.IEnergyQuantity.Companion.displayString
import chylex.hee.init.ModBlocks
import chylex.hee.init.ModItems
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.SubscribeAllEvents
import chylex.hee.system.migration.forge.SubscribeEvent
import chylex.hee.system.util.color.IntColor
import chylex.hee.system.util.color.IntColor.Companion.RGB
import chylex.hee.system.util.color.IntColor.Companion.RGBA
import chylex.hee.system.util.facades.Resource
import chylex.hee.system.util.getBlock
import chylex.hee.system.util.getTile
import net.minecraft.client.gui.AbstractGui
import net.minecraft.client.resources.I18n
import net.minecraft.util.text.TextFormatting
import net.minecraftforge.client.event.DrawBlockHighlightEvent
import net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity
import net.minecraftforge.client.event.RenderGameOverlayEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.HELMET
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID)
object OverlayRenderer{
private const val BORDER_SIZE = 4
private const val LINE_SPACING = 7
private val TEX_ENDER_GOO_OVERLAY = Resource.Custom("textures/overlay/ender_goo.png")
private val TEX_PURIFIED_ENDER_GOO_OVERLAY = Resource.Custom("textures/overlay/purified_ender_goo.png")
private var clusterLookedAt: TileEntityEnergyCluster? = null
// Ender Goo
@SubscribeEvent
fun onFogDensity(e: FogDensity){
val inside = e.info.blockAtCamera.material
if (inside === Materials.ENDER_GOO || inside === Materials.PURIFIED_ENDER_GOO){
GL.setFogMode(FOG_EXP)
e.density = if (inside === Materials.ENDER_GOO) 0.66F else 0.06F
e.isCanceled = true // otherwise the event is ignored
}
}
@SubscribeEvent
fun onRenderHelmetOverlayPre(e: RenderGameOverlayEvent.Pre){
if (e.type != HELMET){
return
}
val player = MC.player ?: return
val inside = MC.gameRenderer.activeRenderInfo.blockAtCamera.material
if ((inside === Materials.ENDER_GOO || inside === Materials.PURIFIED_ENDER_GOO) && MC.settings.thirdPersonView == 0 && !player.isSpectator){
val window = MC.window
val brightness = player.brightness
GL.color(brightness, brightness, brightness, 1F)
GL.blendFunc(SF_SRC_ALPHA, DF_ONE_MINUS_SRC_ALPHA, SF_ONE, DF_ZERO)
if (inside === Materials.ENDER_GOO){
MC.textureManager.bindTexture(TEX_ENDER_GOO_OVERLAY)
}
else{
MC.textureManager.bindTexture(TEX_PURIFIED_ENDER_GOO_OVERLAY)
}
MC.instance.ingameGUI.blit(0, 0, 0, 0, window.scaledWidth, window.scaledHeight)
GL.color(1F, 1F, 1F, 1F)
}
}
// Energy Cluster
@SubscribeEvent
fun onRenderText(@Suppress("UNUSED_PARAMETER") e: RenderGameOverlayEvent.Text){
fun drawTextOffScreenCenter(x: Int, y: Int, line: Int, text: String, color: IntColor){
val window = MC.window
with(MC.fontRenderer){
val centerX = x + (window.scaledWidth / 2)
val centerY = y + (window.scaledHeight / 2) + (line * (LINE_SPACING + FONT_HEIGHT))
val textWidth = getStringWidth(text)
val textHeight = FONT_HEIGHT
val offsetX = -(textWidth / 2)
val offsetY = -(textHeight / 2)
AbstractGui.fill(centerX + offsetX - BORDER_SIZE, centerY + offsetY - BORDER_SIZE, centerX - offsetX + BORDER_SIZE - 1, centerY - offsetY + BORDER_SIZE - 1, RGBA(0u, 0.6F).i)
drawStringWithShadow(text, (centerX + offsetX).toFloat(), (centerY + offsetY).toFloat(), color.i)
}
}
clusterLookedAt?.let {
clusterLookedAt = null
fun getQuantityString(quantity: IEnergyQuantity): String{
return if (it.energyLevel == MAX_POSSIBLE_VALUE)
"${TextFormatting.OBFUSCATED}##${TextFormatting.RESET}"
else
quantity.displayString
}
val isIgnored = MC.player?.let { player -> ModItems.ENERGY_ORACLE.isClusterIgnored(player, it.pos) } == true
val firstLine = if (isIgnored) -1 else 0
val health = it.currentHealth
drawTextOffScreenCenter(0, -40, firstLine, I18n.format("hee.energy.overlay.health", health), health.textColor)
val level = getQuantityString(it.energyLevel)
val capacity = getQuantityString(it.energyRegenCapacity)
drawTextOffScreenCenter(0, -40, firstLine + 1, I18n.format("hee.energy.overlay.level", level, capacity), RGB(220u))
if (isIgnored){
drawTextOffScreenCenter(0, -40, firstLine + 2, I18n.format("hee.energy.overlay.ignored"), RGB(160u))
}
}
}
// Block outlines
@SubscribeEvent
fun onRenderBlockOutline(e: DrawBlockHighlightEvent.HighlightBlock){
val world = MC.world ?: return
val pos = e.target.pos
val block = pos.getBlock(world)
if (block === ModBlocks.ENERGY_CLUSTER){
clusterLookedAt = pos.getTile(world)
e.isCanceled = true
}
else if (block is BlockAbstractPortal){
e.isCanceled = true
}
}
}
@@ -1,221 +0,0 @@
package chylex.hee.client.render
import chylex.hee.HEE
import chylex.hee.client.render.util.GL
import chylex.hee.client.render.util.GL.DF_ONE_MINUS_SRC_ALPHA
import chylex.hee.client.render.util.GL.DF_ZERO
import chylex.hee.client.render.util.GL.SF_ONE
import chylex.hee.client.render.util.GL.SF_SRC_ALPHA
import chylex.hee.client.util.MC
import chylex.hee.game.particle.ParticleVoid
import chylex.hee.game.particle.spawner.ParticleSpawnerCustom
import chylex.hee.game.particle.util.IOffset.InBox
import chylex.hee.game.particle.util.IShape.Point
import chylex.hee.game.world.WorldProviderEndCustom
import chylex.hee.game.world.territory.TerritoryType
import chylex.hee.game.world.territory.TerritoryVoid
import chylex.hee.system.Debug
import chylex.hee.system.migration.forge.EventPriority
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.SubscribeAllEvents
import chylex.hee.system.migration.forge.SubscribeEvent
import chylex.hee.system.migration.vanilla.EntityPlayer
import chylex.hee.system.util.color.IntColor
import chylex.hee.system.util.color.IntColor.Companion.RGB
import chylex.hee.system.util.floorToInt
import chylex.hee.system.util.lookDirVec
import chylex.hee.system.util.math.LerpedFloat
import chylex.hee.system.util.posVec
import chylex.hee.system.util.scale
import net.minecraft.client.resources.I18n
import net.minecraftforge.client.event.RenderGameOverlayEvent
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.event.TickEvent.ClientTickEvent
import net.minecraftforge.event.TickEvent.Phase
import org.lwjgl.opengl.GL11.GL_GREATER
import kotlin.math.min
import kotlin.math.pow
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID)
object TerritoryRenderer{
private var prevChunkX = Int.MAX_VALUE
private var prevTerritory: TerritoryType? = null
@SubscribeEvent
fun onClientTick(e: ClientTickEvent){
if (e.phase == Phase.START){
val player = MC.player
if (player != null && player.world.dimension is WorldProviderEndCustom && player.ticksExisted > 0){
Void.tick(player)
Title.tick()
val newChunkX = player.chunkCoordX
if (prevChunkX != newChunkX){
prevChunkX = newChunkX
val newTerritory = TerritoryType.fromX(player.posX.floorToInt())
if (prevTerritory != newTerritory){
prevTerritory = newTerritory
if (newTerritory != null){
Void.reset()
Title.display(newTerritory)
newTerritory.desc.environment.setupClient()
}
}
}
prevTerritory?.desc?.environment?.tickClient()
}
else if (prevTerritory != null){
prevTerritory = null
prevChunkX = Int.MAX_VALUE
Void.reset()
Title.reset()
}
}
}
// Void handling
val VOID_FACTOR_VALUE
get() = Void.voidFactor.get(MC.partialTicks)
private object Void{
private val VOID_PARTICLE = ParticleSpawnerCustom(
type = ParticleVoid,
pos = InBox(8F)
)
val voidFactor = LerpedFloat(TerritoryVoid.OUTSIDE_VOID_FACTOR)
init{
if (Debug.enabled){
MinecraftForge.EVENT_BUS.register(this)
}
}
fun tick(player: EntityPlayer){
val factor = TerritoryVoid.getVoidFactor(player).also(voidFactor::update)
if (factor == TerritoryVoid.OUTSIDE_VOID_FACTOR || MC.instance.isGamePaused){
return
}
if (factor > -1F){
val rand = player.rng
val mp = min(1F, (factor * 0.275F) + 0.275F)
val extra = (mp.pow(1.5F) * 12F).floorToInt()
VOID_PARTICLE.spawn(Point(player, heightMp = 0.5F, amount = 2 + extra), rand)
VOID_PARTICLE.spawn(Point(player.posVec.add(player.lookDirVec.scale(5)), amount = extra / 2), rand)
}
}
fun reset(){
voidFactor.updateImmediately(TerritoryVoid.OUTSIDE_VOID_FACTOR)
}
@SubscribeEvent
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text){
if (MC.settings.showDebugInfo && MC.player?.dimension === HEE.dim){
with(e.left){
add("")
add("End Void Factor: ${"%.3f".format(voidFactor.currentValue)}")
}
}
}
}
// Text rendering
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID)
private object Title{
private const val FADE_TICKS = 22
private var textTime = 0
private var textFade = 0
private var textTitle = ""
private var textMainColor = RGB(0u)
private var textShadowColor = RGB(0u)
fun display(newTerritory: TerritoryType){
val title = I18n.format(newTerritory.translationKey)
textTime = 60 + (2 * title.length)
textFade = FADE_TICKS
textTitle = title
with(newTerritory.desc.colors){
if (tokenTop.asVec.lengthSquared() > tokenBottom.asVec.lengthSquared()){
textMainColor = tokenTop
textShadowColor = tokenBottom
}
else{
textMainColor = tokenBottom
textShadowColor = tokenTop
}
textShadowColor = textShadowColor.let { RGB(it.red / 2, it.green / 2, it.blue / 2) }
}
}
fun tick(){
if (textTime > 0){
--textTime
--textFade
}
}
fun reset(){
textTime = 0
}
@SubscribeEvent(EventPriority.HIGHEST)
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text){
if (textTime == 0){
return
}
val fontRenderer = MC.fontRenderer
val resolution = e.window
val width = resolution.scaledWidth
val height = resolution.scaledHeight
val opacity = when{
textFade > 0 -> ((FADE_TICKS - (textFade - e.partialTicks)) / FADE_TICKS.toFloat()).coerceIn(0F, 1F)
textTime < FADE_TICKS -> ((textTime - e.partialTicks) / FADE_TICKS.toFloat()).coerceIn(0F, 1F)
else -> 1F
}
GL.pushMatrix()
GL.translate(width * 0.5F, height * 0.5F, 0F)
GL.enableBlend()
GL.blendFunc(SF_SRC_ALPHA, DF_ONE_MINUS_SRC_ALPHA, SF_ONE, DF_ZERO)
GL.alphaFunc(GL_GREATER, 0F)
GL.pushMatrix()
GL.scale(3F, 3F, 3F)
val x = -fontRenderer.getStringWidth(textTitle) * 0.5F
val y = -fontRenderer.FONT_HEIGHT - 2F
drawTitle(x + 0.5F, y + 0.5F, textShadowColor.withAlpha(opacity.pow(1.25F)))
drawTitle(x, y, textMainColor.withAlpha(opacity))
GL.popMatrix()
GL.alphaFunc(GL_GREATER, 0.1F)
GL.disableBlend()
GL.popMatrix()
}
private fun drawTitle(x: Float, y: Float, color: IntColor){
if (color.alpha > 3){ // prevents flickering alpha
MC.fontRenderer.drawString(textTitle, x, y, color.i)
}
}
}
}
@@ -1,66 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.client.render.util.GL
import chylex.hee.game.block.entity.base.TileEntityBaseChest
import chylex.hee.system.migration.Facing.EAST
import chylex.hee.system.migration.Facing.NORTH
import chylex.hee.system.migration.Facing.WEST
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
import net.minecraft.client.renderer.tileentity.model.ChestModel
import net.minecraft.util.ResourceLocation
import org.lwjgl.opengl.GL11.GL_MODELVIEW
import org.lwjgl.opengl.GL11.GL_TEXTURE
import kotlin.math.PI
import kotlin.math.pow
@Sided(Side.CLIENT)
abstract class RenderTileAbstractChest<T : TileEntityBaseChest> : TileEntityRenderer<T>(){
protected abstract val texture: ResourceLocation
private val modelChest = ChestModel()
override fun render(tile: T, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
if (destroyStage >= 0){
bindTexture(DESTROY_STAGES[destroyStage])
GL.matrixMode(GL_TEXTURE)
GL.pushMatrix()
GL.scale(4F, 4F, 1F)
GL.translate(0.0625F, 0.0625F, 0.0625F)
GL.matrixMode(GL_MODELVIEW)
}
else{
bindTexture(texture)
}
GL.pushMatrix()
GL.enableRescaleNormal()
GL.color(1F, 1F, 1F)
GL.translate(x, y + 1F, z + 1F)
GL.scale(1F, -1F, -1F)
GL.translate(0.5F, 0.5F, 0.5F)
val rotation = when(tile.facing){
EAST -> 270F
NORTH -> 180F
WEST -> 90F
else -> 0F
}
GL.rotate(rotation, 0F, 1F, 0F)
GL.translate(-0.5F, -0.5F, -0.5F)
modelChest.lid.rotateAngleX = -(1F - (1F - tile.lidAngle.get(partialTicks)).pow(3)) * PI.toFloat() * 0.5F
modelChest.renderAll()
GL.disableRescaleNormal()
GL.popMatrix()
GL.color(1F, 1F, 1F, 1F)
if (destroyStage >= 0){
GL.matrixMode(GL_TEXTURE)
GL.popMatrix()
GL.matrixMode(GL_MODELVIEW)
}
}
}
@@ -1,232 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.client.render.util.GL
import chylex.hee.client.render.util.GL.DF_ONE
import chylex.hee.client.render.util.GL.DF_ONE_MINUS_SRC_ALPHA
import chylex.hee.client.render.util.GL.SF_ONE
import chylex.hee.client.render.util.GL.SF_SRC_ALPHA
import chylex.hee.client.render.util.GL.TEX_Q
import chylex.hee.client.render.util.GL.TEX_R
import chylex.hee.client.render.util.GL.TEX_S
import chylex.hee.client.render.util.GL.TEX_T
import chylex.hee.client.render.util.TESSELLATOR
import chylex.hee.client.render.util.draw
import chylex.hee.client.util.MC
import chylex.hee.game.block.BlockAbstractPortal
import chylex.hee.game.block.BlockAbstractPortal.IPortalController
import chylex.hee.game.block.entity.TileEntityPortalInner
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.facades.Resource
import chylex.hee.system.util.square
import net.minecraft.client.renderer.GLAllocation
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.util.ResourceLocation
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Vec3d
import net.minecraft.world.World
import org.lwjgl.opengl.GL11.GL_EYE_LINEAR
import org.lwjgl.opengl.GL11.GL_EYE_PLANE
import org.lwjgl.opengl.GL11.GL_MODELVIEW
import org.lwjgl.opengl.GL11.GL_OBJECT_LINEAR
import org.lwjgl.opengl.GL11.GL_OBJECT_PLANE
import org.lwjgl.opengl.GL11.GL_QUADS
import org.lwjgl.opengl.GL11.GL_TEXTURE
import java.util.Random
import kotlin.math.pow
@Sided(Side.CLIENT)
abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalController> : TileEntityRenderer<T>(){
private companion object{
private val TEX_BACKGROUND = Resource.Vanilla("textures/environment/end_sky.png")
private val TEX_PARTICLE_LAYER = Resource.Vanilla("textures/entity/end_portal.png")
private val BUFFER = GLAllocation.createDirectFloatBuffer(16)
private fun updateBuffer(value1: Float, value2: Float, value3: Float, value4: Float) = BUFFER.apply {
clear()
put(value1)
put(value2)
put(value3)
put(value4)
flip()
}
private fun getLayerCount(distSq: Double) = when{
distSq > square(60) -> 5
distSq > square(48) -> 7
distSq > square(38) -> 9
distSq > square(30) -> 11
distSq > square(24) -> 13
distSq > square(20) -> 14
else -> 15
}
}
private var cameraTarget = Vec3d.ZERO
private var globalTranslation = 0F
private var isAnimating = false
private var animationProgress = 0F
private fun calculateEasing(layer: Int): Float{
return if (isAnimating)
(1.1F - square(animationProgress * 4.5F - 4.816F) + 22.1F * (1F - ((layer - 1F) / 14F).pow(1.2F))).coerceIn(0F, 1F).pow(1.5F)
else
animationProgress
}
// Properties
protected val rand = Random()
protected val color = FloatArray(3)
protected abstract fun findController(world: World, pos: BlockPos): C?
protected abstract fun generateSeed(controller: C): Long
protected abstract fun generateNextColor(controller: C, layer: Int)
// Rendering
override fun render(tile: T, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
val controller = findController(tile.world ?: return, tile.pos)
rand.setSeed(controller?.let { generateSeed(it) } ?: 0L)
animationProgress = controller?.clientAnimationProgress?.get(partialTicks) ?: 0F
isAnimating = animationProgress > 0F && animationProgress < 1F
cameraTarget = Vec3d.ZERO // UPDATE fix bobbing
globalTranslation = ((MC.systemTime % BlockAbstractPortal.TRANSLATION_SPEED_LONG) / BlockAbstractPortal.TRANSLATION_SPEED) - (controller?.clientPortalOffset?.get(partialTicks) ?: 0F)
val offsetY = -y - 0.75
val topY = offsetY + cameraTarget.y
// setup
GL.disableLighting()
GL.enableBlend()
GL.enableTexGenCoord(TEX_S)
GL.enableTexGenCoord(TEX_T)
GL.enableTexGenCoord(TEX_R)
GL.enableTexGenCoord(TEX_Q)
MC.gameRenderer.setupFogColor(true)
// background
GL.blendFunc(SF_SRC_ALPHA, DF_ONE_MINUS_SRC_ALPHA)
controller?.let { generateNextColor(it, 0) }
transformColor { 0.1F } // discards provided value
renderLayer(
x, y, z,
texture = TEX_BACKGROUND,
layerPosition = (topY / (topY + 65.0)) - offsetY,
layerRotation = 0F,
layerScale = 0.125F,
cameraOffsetMp = 65.0 / topY
)
// inner layers
GL.blendFunc(SF_ONE, DF_ONE)
val layerCount = getLayerCount((x * x) + (y * y) + (z * z))
for(layer in 1..15){
val layerIndexRev = 16 - layer
val colorMultiplier = 1F / (layerIndexRev + 1F)
controller?.let { generateNextColor(it, layer) }
transformColor { it * colorMultiplier * calculateEasing(layer) }
if (layerIndexRev <= layerCount){
renderLayer(
x, y, z,
texture = TEX_PARTICLE_LAYER,
layerPosition = (topY / (topY + layerIndexRev)) - offsetY,
layerRotation = 2F * ((square(layer) * 4321) + (layer * 9)),
layerScale = 0.0625F,
cameraOffsetMp = layerIndexRev / topY
)
}
}
// cleanup
MC.gameRenderer.setupFogColor(false)
GL.disableTexGenCoord(TEX_S)
GL.disableTexGenCoord(TEX_T)
GL.disableTexGenCoord(TEX_R)
GL.disableTexGenCoord(TEX_Q)
GL.disableBlend()
GL.enableLighting()
}
// Utilities
private inline fun transformColor(func: (Float) -> Float){
color[0] = func(color[0])
color[1] = func(color[1])
color[2] = func(color[2])
}
private fun renderLayer(renderX: Double, renderY: Double, renderZ: Double, texture: ResourceLocation, layerPosition: Double, layerRotation: Float, layerScale: Float, cameraOffsetMp: Double){
val globalX = TileEntityRendererDispatcher.staticPlayerX
val globalY = TileEntityRendererDispatcher.staticPlayerY
val globalZ = TileEntityRendererDispatcher.staticPlayerZ
// texture
if (texture != TEX_BACKGROUND){
bindTexture(TEX_BACKGROUND) // force re-bind to fix a bug in older AMD drivers
}
bindTexture(texture)
GL.pushMatrix()
GL.translate(globalX, layerPosition, globalZ)
GL.texGenMode(TEX_S, GL_OBJECT_LINEAR)
GL.texGenMode(TEX_T, GL_OBJECT_LINEAR)
GL.texGenMode(TEX_R, GL_OBJECT_LINEAR)
GL.texGenMode(TEX_Q, GL_EYE_LINEAR)
GL.texGenParam(TEX_S, GL_OBJECT_PLANE, updateBuffer(1F, 0F, 0F, 0F))
GL.texGenParam(TEX_T, GL_OBJECT_PLANE, updateBuffer(0F, 0F, 1F, 0F))
GL.texGenParam(TEX_R, GL_OBJECT_PLANE, updateBuffer(1F, 0F, 0F, 1F))
GL.texGenParam(TEX_Q, GL_EYE_PLANE, updateBuffer(0F, 1F, 0F, 0F))
GL.popMatrix()
// position
GL.matrixMode(GL_TEXTURE)
GL.pushMatrix()
GL.loadIdentity()
GL.translate(0F, globalTranslation, 0F)
GL.scale(layerScale, layerScale, layerScale)
GL.translate(0.5F, 0.5F, 0.5F)
GL.rotate(layerRotation, 0F, 0F, 1F)
GL.translate((cameraTarget.x * cameraOffsetMp) - globalX - 0.5, (cameraTarget.z * cameraOffsetMp) - globalZ - 0.5, -globalY * 2)
// rendering
TESSELLATOR.draw(GL_QUADS, DefaultVertexFormats.POSITION_COLOR){
pos(renderX + 0.0, renderY + 0.75, renderZ + 0.0).color(color[0], color[1], color[2], 1F).endVertex()
pos(renderX + 0.0, renderY + 0.75, renderZ + 1.0).color(color[0], color[1], color[2], 1F).endVertex()
pos(renderX + 1.0, renderY + 0.75, renderZ + 1.0).color(color[0], color[1], color[2], 1F).endVertex()
pos(renderX + 1.0, renderY + 0.75, renderZ + 0.0).color(color[0], color[1], color[2], 1F).endVertex()
}
GL.popMatrix()
GL.matrixMode(GL_MODELVIEW)
}
}
@@ -1,40 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.game.block.entity.TileEntityDarkChest
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.facades.Resource
import net.minecraft.client.renderer.tileentity.ChestTileEntityRenderer
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
import net.minecraft.item.ItemStack
@Sided(Side.CLIENT)
object RenderTileDarkChest : ChestTileEntityRenderer<TileEntityDarkChest>(){
private val TEX_SINGLE = Resource.Custom("textures/entity/dark_chest_single.png")
private val TEX_DOUBLE = Resource.Custom("textures/entity/dark_chest_double.png")
init{
isChristmas = false
}
override fun render(tile: TileEntityDarkChest, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
val prevTexSingle = TEXTURE_NORMAL
val prevTexDouble = TEXTURE_NORMAL_DOUBLE
TEXTURE_NORMAL = TEX_SINGLE
TEXTURE_NORMAL_DOUBLE = TEX_DOUBLE
super.render(tile, x, y, z, partialTicks, destroyStage)
TEXTURE_NORMAL = prevTexSingle
TEXTURE_NORMAL_DOUBLE = prevTexDouble
}
object AsItem : ItemStackTileEntityRenderer(){
private val tile = TileEntityDarkChest()
override fun renderByItem(stack: ItemStack){
TileEntityRendererDispatcher.instance.renderAsItem(tile)
}
}
}
@@ -1,38 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.HEE
import chylex.hee.game.block.BlockAbstractPortal
import chylex.hee.game.block.BlockAbstractPortal.IPortalController
import chylex.hee.game.block.entity.TileEntityEndPortalAcceptor
import chylex.hee.game.block.entity.TileEntityPortalInner
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.closestTickingTile
import chylex.hee.system.util.math.LerpedFloat
import net.minecraft.util.math.BlockPos
import net.minecraft.world.World
@Sided(Side.CLIENT)
object RenderTileEndPortal : RenderTileAbstractPortal<TileEntityPortalInner.End, IPortalController>(){
private object AlwaysOnController : IPortalController{
override val clientAnimationProgress = LerpedFloat(1F)
override val clientPortalOffset = LerpedFloat(0F)
}
override fun findController(world: World, pos: BlockPos): IPortalController?{
if (world.dimension.type === HEE.dim){
return AlwaysOnController
}
return pos.closestTickingTile<TileEntityEndPortalAcceptor>(world, BlockAbstractPortal.MAX_DISTANCE_FROM_FRAME)
}
override fun generateSeed(controller: IPortalController): Long{
return 31100L
}
override fun generateNextColor(controller: IPortalController, layer: Int){
color[0] = (rand.nextFloat() * 0.5F) + 0.1F
color[1] = (rand.nextFloat() * 0.5F) + 0.4F
color[2] = (rand.nextFloat() * 0.5F) + 0.5F
}
}
@@ -1,116 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.HEE
import chylex.hee.game.block.entity.TileEntityExperienceGate
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.forge.SubscribeAllEvents
import chylex.hee.system.migration.forge.SubscribeEvent
import chylex.hee.system.util.facades.Resource
import chylex.hee.system.util.floorToInt
import net.minecraft.client.renderer.BufferBuilder
import net.minecraft.client.renderer.texture.TextureAtlasSprite
import net.minecraft.util.math.BlockPos
import net.minecraft.world.World
import net.minecraftforge.client.event.TextureStitchEvent
import net.minecraftforge.client.model.animation.TileEntityRendererFast
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
@Sided(Side.CLIENT)
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID, bus = MOD)
object RenderTileExperienceGate : TileEntityRendererFast<TileEntityExperienceGate>(){
private const val SPRITE_COUNT = 40
private val TEX = Array(SPRITE_COUNT){ Resource.Custom("block/experience_gate_top_bar_$it") }
private val SPRITES = mutableListOf<TextureAtlasSprite>()
private val FRAMES_CORNER = intArrayOf(9, 10, 11, 12, 13, 14, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39)
private val FRAMES_STRAIGHT = intArrayOf(9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)
private val FRAMES = arrayOf(
intArrayOf(0, 1, 2),
FRAMES_STRAIGHT,
FRAMES_CORNER,
FRAMES_STRAIGHT,
intArrayOf(5, 6, 7, 8, 4),
FRAMES_STRAIGHT,
FRAMES_CORNER,
FRAMES_STRAIGHT,
intArrayOf(3, 4)
)
private val FRAME_COUNT = 1 + FRAMES.sumBy { it.size }
private val FRAME_OFFSETS = FRAMES.indices.map { index -> 1 + FRAMES.take(index).sumBy { it.size } }.toIntArray()
@SubscribeEvent
fun onTextureStitchPre(e: TextureStitchEvent.Pre){
if (e.map.basePath != "textures"){
return
}
with(e){
TEX.forEach { addSprite(it) }
}
}
@SubscribeEvent
fun onTextureStitchPost(e: TextureStitchEvent.Post){
if (e.map.basePath != "textures"){
return
}
SPRITES.clear()
with(e.map){
TEX.forEach { SPRITES.add(getAtlasSprite(it.toString())) }
}
}
private fun getTexture(index: Int, frame: Int): TextureAtlasSprite?{
return FRAMES[index].getOrNull((frame - FRAME_OFFSETS[index]).coerceAtMost(FRAMES[index].lastIndex))?.let(SPRITES::getOrNull)
}
override fun renderTileEntityFast(tile: TileEntityExperienceGate, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, buffer: BufferBuilder){
val world = tile.world ?: return
val pos = tile.pos
val progress = tile.chargeProgress
val frame = if (progress == 0F) 0 else 1 + (progress * (FRAME_COUNT - 2)).floorToInt()
val topLeftBlock = getTexture(8, frame) ?: getTexture(0, frame)
topLeftBlock?.let { buffer.renderTextureAt(x - 1.0, y, z - 1.0, world, pos.add(-1, 1, -1), it, 0b000) }
getTexture(1, frame)?.let { buffer.renderTextureAt(x + 0.0, y, z - 1.0, world, pos.add( 0, 1, -1), it, 0b111) }
getTexture(2, frame)?.let { buffer.renderTextureAt(x + 1.0, y, z - 1.0, world, pos.add( 1, 1, -1), it, 0b011) }
getTexture(3, frame)?.let { buffer.renderTextureAt(x + 1.0, y, z + 0.0, world, pos.add( 1, 1, 0), it, 0b110) }
getTexture(4, frame)?.let { buffer.renderTextureAt(x + 1.0, y, z + 1.0, world, pos.add( 1, 1, 1), it, 0b110) }
getTexture(5, frame)?.let { buffer.renderTextureAt(x + 0.0, y, z + 1.0, world, pos.add( 0, 1, 1), it, 0b001) }
getTexture(6, frame)?.let { buffer.renderTextureAt(x - 1.0, y, z + 1.0, world, pos.add(-1, 1, 1), it, 0b101) }
getTexture(7, frame)?.let { buffer.renderTextureAt(x - 1.0, y, z + 0.0, world, pos.add(-1, 1, 0), it, 0b000) }
}
private fun BufferBuilder.renderTextureAt(x: Double, y: Double, z: Double, world: World, pos: BlockPos, tex: TextureAtlasSprite, rot: Int){
val rotX = (((rot shr 1) and 1) - 0.5) * 1.002
val rotZ = (((rot shr 2) and 1) - 0.5) * 1.002
val u1 = tex.minU.toDouble()
val u2 = tex.maxU.toDouble()
val v1 = tex.minV.toDouble()
val v2 = tex.maxV.toDouble()
val c = if (rot and 1 == 0){
doubleArrayOf(u1, u2, u2, u1, v1, v1, v2, v2)
}
else{
doubleArrayOf(u1, u1, u2, u2, v1, v2, v2, v1)
}
val light = world.getCombinedLight(pos, 0)
val sky = (light shr 16) and 65535
val block = light and 65535
this.pos(x + 0.5 + rotX, y + 1.001, z + 0.5 + rotZ).color(255, 255, 255, 255).tex(c[0], c[4]).lightmap(sky, block).endVertex()
this.pos(x + 0.5 - rotX, y + 1.001, z + 0.5 + rotZ).color(255, 255, 255, 255).tex(c[1], c[5]).lightmap(sky, block).endVertex()
this.pos(x + 0.5 - rotX, y + 1.001, z + 0.5 - rotZ).color(255, 255, 255, 255).tex(c[2], c[6]).lightmap(sky, block).endVertex()
this.pos(x + 0.5 + rotX, y + 1.001, z + 0.5 - rotZ).color(255, 255, 255, 255).tex(c[3], c[7]).lightmap(sky, block).endVertex()
}
}
@@ -1,111 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.client.model.block.ModelBlockIgneousPlate
import chylex.hee.client.render.util.GL
import chylex.hee.game.block.BlockIgneousPlate
import chylex.hee.game.block.entity.TileEntityIgneousPlate
import chylex.hee.init.ModBlocks
import chylex.hee.system.migration.Facing.EAST
import chylex.hee.system.migration.Facing.NORTH
import chylex.hee.system.migration.Facing.UP
import chylex.hee.system.migration.Facing.WEST
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.color.IntColor.Companion.RGB
import chylex.hee.system.util.component1
import chylex.hee.system.util.component2
import chylex.hee.system.util.component3
import chylex.hee.system.util.facades.Resource
import chylex.hee.system.util.floorToInt
import chylex.hee.system.util.getState
import chylex.hee.system.util.offsetTowards
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
import net.minecraft.util.math.Vec3d
import org.lwjgl.opengl.GL11.GL_MODELVIEW
import org.lwjgl.opengl.GL11.GL_TEXTURE
@Sided(Side.CLIENT)
object RenderTileIgneousPlate : TileEntityRenderer<TileEntityIgneousPlate>(){
private val TEX_PLATE = Resource.Custom("textures/entity/igneous_plate.png")
private val COLOR_TRANSITIONS = arrayOf(
RGB(207, 187, 161).asVec,
RGB(247, 205, 82).asVec,
RGB(235, 23, 23).asVec
)
private fun getInnerBoxColor(combinedHeat: Float): Vec3d{
val index = combinedHeat.floorToInt().coerceIn(0, COLOR_TRANSITIONS.lastIndex - 1)
val progress = combinedHeat.toDouble() - index
return COLOR_TRANSITIONS[index].offsetTowards(COLOR_TRANSITIONS[index + 1], progress)
}
override fun render(tile: TileEntityIgneousPlate, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
if (destroyStage >= 0){
bindTexture(DESTROY_STAGES[destroyStage])
GL.matrixMode(GL_TEXTURE)
GL.pushMatrix()
GL.scale(4F, 2F, 1F)
GL.matrixMode(GL_MODELVIEW)
}
else{
bindTexture(TEX_PLATE)
}
val state = tile.world?.let { tile.pos.getState(it) }
if (state?.block !== ModBlocks.IGNEOUS_PLATE){
return
}
GL.pushMatrix()
GL.translate(x, y, z)
when(state[BlockIgneousPlate.FACING_NOT_DOWN]){
UP -> {
GL.translate(0F, 0F, 1F)
GL.rotate(-90F, 1F, 0F, 0F)
}
NORTH -> {
GL.translate(1F, 0F, 1F)
GL.rotate(180F, 0F, 1F, 0F)
}
WEST -> {
GL.translate(1F, 0F, 0F)
GL.rotate(-90F, 0F, 1F, 0F)
}
EAST -> {
GL.translate(0F, 0F, 1F)
GL.rotate(90F, 0F, 1F, 0F)
}
else -> {}
}
GL.enableRescaleNormal()
GL.color(1F, 1F, 1F)
if (destroyStage < 0){
ModelBlockIgneousPlate.renderOuterBox()
val (r, g, b) = getInnerBoxColor(tile.clientCombinedHeat)
GL.color(r.toFloat(), g.toFloat(), b.toFloat())
}
GL.disableLighting()
ModelBlockIgneousPlate.renderInnerBox(tile.clientThrustAnimation.get(partialTicks))
GL.enableLighting()
GL.disableRescaleNormal()
GL.popMatrix()
if (destroyStage >= 0){
GL.matrixMode(GL_TEXTURE)
GL.popMatrix()
GL.matrixMode(GL_MODELVIEW)
}
}
}
@@ -1,192 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.HEE
import chylex.hee.client.render.util.GL
import chylex.hee.client.render.util.TESSELLATOR
import chylex.hee.client.render.util.draw
import chylex.hee.client.util.MC
import chylex.hee.game.block.BlockJarODust
import chylex.hee.game.block.entity.TileEntityJarODust
import chylex.hee.game.mechanics.dust.DustLayers
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.forge.SubscribeAllEvents
import chylex.hee.system.migration.forge.SubscribeEvent
import chylex.hee.system.util.Pos
import chylex.hee.system.util.facades.Resource
import chylex.hee.system.util.floorToInt
import chylex.hee.system.util.getListOfCompounds
import chylex.hee.system.util.heeTagOrNull
import net.minecraft.client.renderer.BufferBuilder
import net.minecraft.client.renderer.RenderHelper
import net.minecraft.client.renderer.model.IBakedModel
import net.minecraft.client.renderer.texture.TextureAtlasSprite
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.item.ItemStack
import net.minecraftforge.client.event.ModelBakeEvent
import net.minecraftforge.client.event.ModelRegistryEvent
import net.minecraftforge.client.event.TextureStitchEvent
import net.minecraftforge.client.model.ModelLoader
import net.minecraftforge.client.model.animation.TileEntityRendererFast
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
import org.lwjgl.opengl.GL11.GL_QUADS
@Sided(Side.CLIENT)
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID, bus = MOD)
object RenderTileJarODust : TileEntityRendererFast<TileEntityJarODust>(){
private val TEX_LAYER = Resource.Custom("block/dust_layer")
private const val TEX_MP = 1.6
private lateinit var SPRITE_LAYER: TextureAtlasSprite
private val AABB = BlockJarODust.AABB
private const val EPSILON_Y = 0.025
private const val EPSILON_XZ = 0.005
@SubscribeEvent
fun onTextureStitchPre(e: TextureStitchEvent.Pre){
if (e.map.basePath == "textures"){
e.addSprite(TEX_LAYER)
}
}
@SubscribeEvent
fun onTextureStitchPost(e: TextureStitchEvent.Post){
if (e.map.basePath == "textures"){
SPRITE_LAYER = e.map.getAtlasSprite(TEX_LAYER.toString())
}
}
override fun renderTileEntityFast(tile: TileEntityJarODust, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, buffer: BufferBuilder){
val world = tile.world ?: MC.world ?: return
val pos = tile.pos
renderLayers(tile.layers, x, y, z, world.getCombinedLight(pos, 0), buffer, renderBottom = false)
}
private fun renderLayers(layers: DustLayers, x: Double, y: Double, z: Double, combinedLight: Int, buffer: BufferBuilder, renderBottom: Boolean){
val contents = layers.contents.takeUnless { it.isEmpty() } ?: return
val unit = AABB.let { it.maxY - it.minY - (EPSILON_Y * 2) } / layers.totalCapacity
val sky = (combinedLight shr 16) and 65535
val block = combinedLight and 65535
val minX = x + AABB.minX + EPSILON_XZ
val maxX = x + AABB.maxX - EPSILON_XZ
val minZ = z + AABB.minZ + EPSILON_XZ
val maxZ = z + AABB.maxZ - EPSILON_XZ
val minU = SPRITE_LAYER.minU.toDouble()
val maxU = SPRITE_LAYER.let { it.minU + (it.maxU - it.minU) * 0.5 } // texture is 16x32 to support repeating pattern
val minV = SPRITE_LAYER.minV.toDouble()
val maxV = SPRITE_LAYER.maxV.toDouble()
val texHalfSize = (maxU - minU)
var relY = 0.0
for((index, info) in contents.withIndex()){
val (dustType, dustAmount) = info
val color = dustType.color
val height = dustAmount * unit
val texMin = minU + (0.01 + relY * TEX_MP) * texHalfSize
val texMax = minU + (0.01 + (relY + height) * TEX_MP) * texHalfSize
val minY = y + relY + AABB.minY + EPSILON_Y
val maxY = minY + height
val sideR = (color[0] / 1.125F).floorToInt().coerceAtLeast(0)
val sideG = (color[1] / 1.125F).floorToInt().coerceAtLeast(0)
val sideB = (color[2] / 1.125F).floorToInt().coerceAtLeast(0)
with(buffer){
pos(minX, minY, minZ).color(sideR, sideG, sideB, 255).tex(texMin, minV).lightmap(sky, block).endVertex()
pos(minX, minY, maxZ).color(sideR, sideG, sideB, 255).tex(texMin, maxV).lightmap(sky, block).endVertex()
pos(minX, maxY, maxZ).color(sideR, sideG, sideB, 255).tex(texMax, maxV).lightmap(sky, block).endVertex()
pos(minX, maxY, minZ).color(sideR, sideG, sideB, 255).tex(texMax, minV).lightmap(sky, block).endVertex()
pos(maxX, minY, maxZ).color(sideR, sideG, sideB, 255).tex(texMin, minV).lightmap(sky, block).endVertex()
pos(maxX, minY, minZ).color(sideR, sideG, sideB, 255).tex(texMin, maxV).lightmap(sky, block).endVertex()
pos(maxX, maxY, minZ).color(sideR, sideG, sideB, 255).tex(texMax, maxV).lightmap(sky, block).endVertex()
pos(maxX, maxY, maxZ).color(sideR, sideG, sideB, 255).tex(texMax, minV).lightmap(sky, block).endVertex()
pos(maxX, minY, minZ).color(sideR, sideG, sideB, 255).tex(texMin, minV).lightmap(sky, block).endVertex()
pos(minX, minY, minZ).color(sideR, sideG, sideB, 255).tex(texMin, maxV).lightmap(sky, block).endVertex()
pos(minX, maxY, minZ).color(sideR, sideG, sideB, 255).tex(texMax, maxV).lightmap(sky, block).endVertex()
pos(maxX, maxY, minZ).color(sideR, sideG, sideB, 255).tex(texMax, minV).lightmap(sky, block).endVertex()
pos(minX, minY, maxZ).color(sideR, sideG, sideB, 255).tex(texMin, minV).lightmap(sky, block).endVertex()
pos(maxX, minY, maxZ).color(sideR, sideG, sideB, 255).tex(texMin, maxV).lightmap(sky, block).endVertex()
pos(maxX, maxY, maxZ).color(sideR, sideG, sideB, 255).tex(texMax, maxV).lightmap(sky, block).endVertex()
pos(minX, maxY, maxZ).color(sideR, sideG, sideB, 255).tex(texMax, minV).lightmap(sky, block).endVertex()
}
if (index == 0 && renderBottom){
val bottomR = color[0]
val bottomG = color[1]
val bottomB = color[2]
with(buffer){
pos(maxX, minY, minZ).color(bottomR, bottomG, bottomB, 255).tex(maxU, minV).lightmap(sky, block).endVertex()
pos(maxX, minY, maxZ).color(bottomR, bottomG, bottomB, 255).tex(maxU, maxV).lightmap(sky, block).endVertex()
pos(minX, minY, maxZ).color(bottomR, bottomG, bottomB, 255).tex(minU, maxV).lightmap(sky, block).endVertex()
pos(minX, minY, minZ).color(bottomR, bottomG, bottomB, 255).tex(minU, minV).lightmap(sky, block).endVertex()
}
}
if (index == contents.lastIndex){
val topR = (color[0] * 1.125F).floorToInt().coerceAtMost(255)
val topG = (color[1] * 1.125F).floorToInt().coerceAtMost(255)
val topB = (color[2] * 1.125F).floorToInt().coerceAtMost(255)
with(buffer){
pos(minX, maxY, minZ).color(topR, topG, topB, 255).tex(minU, minV).lightmap(sky, block).endVertex()
pos(minX, maxY, maxZ).color(topR, topG, topB, 255).tex(minU, maxV).lightmap(sky, block).endVertex()
pos(maxX, maxY, maxZ).color(topR, topG, topB, 255).tex(maxU, maxV).lightmap(sky, block).endVertex()
pos(maxX, maxY, minZ).color(topR, topG, topB, 255).tex(maxU, minV).lightmap(sky, block).endVertex()
}
}
relY += height
}
}
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID, bus = MOD)
object AsItem : ItemStackTileEntityRenderer(){
private val RESOURCE_MODEL = Resource.Custom("block/jar_o_dust_simple")
private lateinit var MODEL: IBakedModel
@SubscribeEvent
fun onRegisterModels(@Suppress("UNUSED_PARAMETER") e: ModelRegistryEvent){
ModelLoader.addSpecialModel(RESOURCE_MODEL)
}
@SubscribeEvent
fun onModelBake(e: ModelBakeEvent){
MODEL = e.modelRegistry.getValue(RESOURCE_MODEL)
}
private val layers = DustLayers(TileEntityJarODust.DUST_CAPACITY)
override fun renderByItem(stack: ItemStack){
val nbt = stack.heeTagOrNull?.getListOfCompounds(BlockJarODust.LAYERS_TAG) ?: return
val player = MC.player ?: return
layers.deserializeNBT(nbt)
GL.enableCull()
RenderHelper.disableStandardItemLighting()
TESSELLATOR.draw(GL_QUADS, DefaultVertexFormats.BLOCK){
renderLayers(layers, 0.0, 0.0, 0.0, world.getCombinedLight(Pos(player), 0), this, renderBottom = true)
}
RenderHelper.enableStandardItemLighting()
MC.instance.blockRendererDispatcher.blockModelRenderer.renderModelBrightnessColor(MODEL, 1F, 1F, 1F, 1F)
GL.disableCull()
}
}
}
@@ -1,21 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.game.block.entity.TileEntityLootChest
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.facades.Resource
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
import net.minecraft.item.ItemStack
@Sided(Side.CLIENT)
object RenderTileLootChest : RenderTileAbstractChest<TileEntityLootChest>(){
override val texture = Resource.Custom("textures/entity/loot_chest.png")
object AsItem : ItemStackTileEntityRenderer(){
private val tile = TileEntityLootChest()
override fun renderByItem(stack: ItemStack){
TileEntityRendererDispatcher.instance.renderAsItem(tile)
}
}
}
@@ -1,39 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.client.render.util.GL
import chylex.hee.client.render.util.ItemRenderHelper
import chylex.hee.client.util.MC
import chylex.hee.game.block.entity.TileEntityMinersBurialAltar
import chylex.hee.init.ModItems
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
import net.minecraft.item.ItemStack
import net.minecraftforge.client.ForgeHooksClient
@Sided(Side.CLIENT)
object RenderTileMinersBurialAltar : TileEntityRenderer<TileEntityMinersBurialAltar>(){
private val PUZZLE_MEDALLION = ItemStack(ModItems.PUZZLE_MEDALLION)
private const val SCALE_XZ = 1.85F
override fun render(tile: TileEntityMinersBurialAltar, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
if (!tile.hasMedallion){
return
}
ItemRenderHelper.beginItemModel()
GL.pushMatrix()
GL.translate(x, y, z)
GL.pushMatrix()
GL.translate(0.5F, 0.7725F - (0.035F * tile.clientMedallionAnimProgress), 0.625F + 0.125F * (SCALE_XZ - 1F))
GL.rotate(270F, 1F, 0F, 0F)
GL.scale(SCALE_XZ, SCALE_XZ, 1.5F)
MC.itemRenderer.renderItem(PUZZLE_MEDALLION, ForgeHooksClient.handleCameraTransforms(ItemRenderHelper.getItemModel(PUZZLE_MEDALLION), GROUND, false))
GL.popMatrix()
GL.popMatrix()
ItemRenderHelper.endItemModel()
}
}
@@ -1,28 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.client.render.util.GL
import chylex.hee.client.util.MC
import chylex.hee.game.block.entity.base.TileEntityBaseSpawner
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
import kotlin.math.max
@Sided(Side.CLIENT)
object RenderTileSpawner : TileEntityRenderer<TileEntityBaseSpawner>(){
override fun render(tile: TileEntityBaseSpawner, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
val entity = tile.clientEntity
val scale = 0.53125F / max(entity.width, entity.height).coerceAtLeast(1F)
GL.pushMatrix()
GL.translate(x + 0.5, y + 0.4, z + 0.5)
GL.rotate(tile.clientRotation.get(partialTicks) * 10F, 0F, 1F, 0F)
GL.translate(0F, -0.2F, 0F)
GL.rotate(-30F, 1F, 0F, 0F)
GL.scale(scale, scale, scale)
entity.setLocationAndAngles(x, y, z, 0F, 0F)
MC.renderManager.renderEntity(entity, 0.0, 0.0, 0.0, 0F, partialTicks, false)
GL.popMatrix()
}
}
@@ -1,69 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.client.render.util.GL
import chylex.hee.client.render.util.ItemRenderHelper
import chylex.hee.client.render.util.TESSELLATOR
import chylex.hee.client.render.util.draw
import chylex.hee.client.util.MC
import chylex.hee.game.block.entity.TileEntityJarODust
import chylex.hee.game.block.entity.base.TileEntityBaseTable
import chylex.hee.game.mechanics.dust.DustLayers
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.Vec3
import chylex.hee.system.util.addY
import chylex.hee.system.util.center
import chylex.hee.system.util.color.IntColor.Companion.RGBA
import chylex.hee.system.util.getTile
import chylex.hee.system.util.lookPosVec
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GUI
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.item.ItemStack
import net.minecraftforge.client.ForgeHooksClient
import net.minecraftforge.client.model.pipeline.LightUtil
import org.lwjgl.opengl.GL11.GL_QUADS
@Sided(Side.CLIENT)
object RenderTileTable : TileEntityRenderer<TileEntityBaseTable>(){
private val COLOR = RGBA(180, 180, 180, 120).i
private const val Y_OFFSET = 0.8F
override fun render(tile: TileEntityBaseTable, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
val dustType = tile.tableDustType ?: return
if (tile.pos.up().getTile<TileEntityJarODust>(world)?.layers?.getDustType(DustLayers.Side.BOTTOM) == dustType){
return
}
ItemRenderHelper.beginItemModel()
GL.pushMatrix()
GL.translate(x, y, z)
GL.pushMatrix()
val rotation = (MC.systemTime % 360000L) / 25F
val center = tile.pos.center.addY(Y_OFFSET.toDouble())
val flip = if (center.subtract(MC.player!!.lookPosVec).dotProduct(Vec3.fromYaw(360F - rotation)) > 0.0) 180F else 0F
GL.translate(0.5F, 0.5F + Y_OFFSET, 0.5F)
GL.rotate(rotation + flip, 0F, 1F, 0F)
GL.scale(0.5F, 0.5F, 0.02F)
val itemStack = ItemStack(dustType.item)
val itemModel = ForgeHooksClient.handleCameraTransforms(ItemRenderHelper.getItemModel(itemStack), GUI, false)
GL.setLightmapCoords(61680F, 0F)
GL.translate(-0.5F, -0.5F, -0.5F)
TESSELLATOR.draw(GL_QUADS, DefaultVertexFormats.ITEM){
val quads = itemModel.getQuads(null, null, tile.wrld.rand)
for(quad in quads){
LightUtil.renderQuadColor(this, quad, COLOR)
}
}
GL.popMatrix()
GL.popMatrix()
ItemRenderHelper.endItemModel()
}
}
@@ -1,179 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.client.render.util.GL
import chylex.hee.client.render.util.ItemRenderHelper
import chylex.hee.client.render.util.TESSELLATOR
import chylex.hee.client.render.util.draw
import chylex.hee.client.util.MC
import chylex.hee.game.block.BlockTablePedestal
import chylex.hee.game.block.entity.TileEntityTablePedestal
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.facades.Resource
import chylex.hee.system.util.nextFloat
import chylex.hee.system.util.size
import chylex.hee.system.util.toRadians
import net.minecraft.client.renderer.ItemRenderer
import net.minecraft.client.renderer.model.IBakedModel
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
import net.minecraft.client.renderer.texture.TextureManager
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraftforge.client.ForgeHooksClient
import org.lwjgl.opengl.GL11.GL_ALWAYS
import org.lwjgl.opengl.GL11.GL_GREATER
import org.lwjgl.opengl.GL11.GL_QUADS
import java.util.Collections
import java.util.Random
import kotlin.math.cos
import kotlin.math.sin
@Sided(Side.CLIENT)
object RenderTileTablePedestal : TileEntityRenderer<TileEntityTablePedestal>(){
private val TEX_SHADOW = Resource.Vanilla("textures/misc/shadow.png")
private val RAND = Random()
private const val SHADOW_XZ_MIN = 0.325
private const val SHADOW_XZ_MAX = 0.675
private val SHADOW_Y = BlockTablePedestal.COMBINED_BOX.maxY + 0.0015625 // between the top of the pedestal and the status indicator
private const val SPREAD_DEPTH_PER_2D_MODEL = 0.09375F
private const val SPREAD_RAND_2D = 0.13125F
private const val SPREAD_RAND_3D_XZ = 0.2625F
private const val SPREAD_RAND_3D_Y = 0.39375F
private val ITEM_ANGLES = (1..9).run {
val section = 360F / endInclusive
map { (it - 0.5F) * section }
}
private fun getItemModelCount(stackSize: Int) = when{
stackSize > 48 -> 5
stackSize > 32 -> 4
stackSize > 16 -> 3
stackSize > 1 -> 2
else -> 1
}
override fun render(tile: TileEntityTablePedestal, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
val textureManager = MC.textureManager
val itemRenderer = MC.itemRenderer
ItemRenderHelper.beginItemModel()
GL.pushMatrix()
GL.translate(x, y, z)
val pos = tile.pos
val stacks = tile.stacksForRendering
val itemRotation = (MC.systemTime % 360000L) / 20F
val baseSeed = pos.toLong()
val offsetAngleIndices = if (stacks.size <= 1)
Collections.emptyList()
else
ITEM_ANGLES.toMutableList()
val shadowAlpha = if (MC.settings.entityShadows)
(0.75 * (1.0 - (MC.renderManager.getDistanceToCamera(x, y, z) / 256.0))).toFloat().coerceAtMost(1F)
else
0F
for((index, stack) in stacks.withIndex()){
renderItemStack(textureManager, itemRenderer, stack, index, itemRotation, baseSeed, offsetAngleIndices, shadowAlpha)
}
GL.popMatrix()
ItemRenderHelper.endItemModel()
}
private fun renderItemStack(textureManager: TextureManager, renderer: ItemRenderer, stack: ItemStack, index: Int, baseRotation: Float, baseSeed: Long, offsetAngleIndices: MutableList<Float>, shadowAlpha: Float){
GL.pushMatrix()
var offsetY = 0F
var rotationMp = 1F
if (index > 0 && offsetAngleIndices.isNotEmpty()){
val seed = baseSeed + (Item.getIdFromItem(stack.item) xor (33867 shl index))
RAND.setSeed(seed)
val locDistance = RAND.nextFloat(0.26F, 0.29F)
val locIndex = RAND.nextInt(offsetAngleIndices.size)
val locAngle = (offsetAngleIndices.removeAt(locIndex) + RAND.nextFloat(-3F, 3F)).toRadians()
GL.translate(cos(locAngle) * locDistance, 0F, sin(locAngle) * locDistance)
offsetY = RAND.nextFloat(0F, 0.05F)
rotationMp = RAND.nextFloat(0.4F, 1.2F)
}
if (shadowAlpha > 0F){
GL.depthMask(false)
GL.alphaFunc(GL_ALWAYS, 0F)
textureManager.bindTexture(TEX_SHADOW)
renderShadow(shadowAlpha)
GL.depthMask(true)
GL.alphaFunc(GL_GREATER, 0.1F)
textureManager.bindTexture(ItemRenderHelper.TEX_BLOCKS_ITEMS)
}
val baseModel = ItemRenderHelper.getItemModel(stack)
val isModel3D = baseModel.isGui3d
val baseY = if (isModel3D) 0.8325F else 1F
GL.translate(0.5F, baseY + offsetY, 0.5F)
GL.rotate(baseRotation * rotationMp, 0F, 1F, 0F)
renderItemWithSpread(renderer, stack, ForgeHooksClient.handleCameraTransforms(baseModel, GROUND, false), isModel3D)
GL.popMatrix()
}
private fun renderItemWithSpread(renderer: ItemRenderer, stack: ItemStack, model: IBakedModel, isModel3D: Boolean){
val extraModels = getItemModelCount(stack.size) - 1
if (extraModels > 0){
RAND.setSeed(Item.getIdFromItem(stack.item).toLong())
if (!isModel3D){
GL.translate(0F, 0F, -SPREAD_DEPTH_PER_2D_MODEL * (extraModels / 2F))
}
}
renderer.renderItem(stack, model)
repeat(extraModels){
GL.pushMatrix()
if (isModel3D){
GL.translate(
RAND.nextFloat(-SPREAD_RAND_3D_XZ, SPREAD_RAND_3D_XZ),
RAND.nextFloat(-SPREAD_RAND_3D_Y, SPREAD_RAND_3D_Y),
RAND.nextFloat(-SPREAD_RAND_3D_XZ, SPREAD_RAND_3D_XZ)
)
}
else{
GL.translate(
RAND.nextFloat(-SPREAD_RAND_2D, SPREAD_RAND_2D),
RAND.nextFloat(-SPREAD_RAND_2D, SPREAD_RAND_2D),
SPREAD_DEPTH_PER_2D_MODEL * (it + 1)
)
}
renderer.renderItem(stack, model)
GL.popMatrix()
}
}
private fun renderShadow(alpha: Float){
TESSELLATOR.draw(GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR){
pos(SHADOW_XZ_MIN, SHADOW_Y, SHADOW_XZ_MIN).tex(0.0, 0.0).color(1F, 1F, 1F, alpha).endVertex()
pos(SHADOW_XZ_MIN, SHADOW_Y, SHADOW_XZ_MAX).tex(0.0, 1.0).color(1F, 1F, 1F, alpha).endVertex()
pos(SHADOW_XZ_MAX, SHADOW_Y, SHADOW_XZ_MAX).tex(1.0, 1.0).color(1F, 1F, 1F, alpha).endVertex()
pos(SHADOW_XZ_MAX, SHADOW_Y, SHADOW_XZ_MIN).tex(1.0, 0.0).color(1F, 1F, 1F, alpha).endVertex()
}
}
}
@@ -1,40 +0,0 @@
package chylex.hee.client.render.block
import chylex.hee.game.block.BlockAbstractPortal
import chylex.hee.game.block.BlockVoidPortalInner.Companion.TYPE
import chylex.hee.game.block.BlockVoidPortalInner.IVoidPortalController
import chylex.hee.game.block.BlockVoidPortalInner.Type.HUB
import chylex.hee.game.block.BlockVoidPortalInner.Type.RETURN_ACTIVE
import chylex.hee.game.block.entity.TileEntityPortalInner
import chylex.hee.game.block.entity.TileEntityVoidPortalStorage
import chylex.hee.game.world.territory.TerritoryInstance.Companion.THE_HUB_INSTANCE
import chylex.hee.init.ModBlocks
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.closestTickingTile
import chylex.hee.system.util.getState
import chylex.hee.system.util.math.LerpedFloat
import net.minecraft.util.math.BlockPos
import net.minecraft.world.World
@Sided(Side.CLIENT)
object RenderTileVoidPortal : RenderTileAbstractPortal<TileEntityPortalInner.Void, IVoidPortalController>(){
private object ActiveReturnController : IVoidPortalController{
override val currentInstance = THE_HUB_INSTANCE
override val clientAnimationProgress = LerpedFloat(1F)
override val clientPortalOffset = LerpedFloat(0F)
}
override fun findController(world: World, pos: BlockPos) = when(pos.getState(world).takeIf { it.block === ModBlocks.VOID_PORTAL_INNER }?.get(TYPE)){
HUB -> pos.closestTickingTile<TileEntityVoidPortalStorage>(world, BlockAbstractPortal.MAX_DISTANCE_FROM_FRAME)
RETURN_ACTIVE -> ActiveReturnController
else -> null
}
override fun generateSeed(controller: IVoidPortalController): Long{
return controller.currentInstance?.territory?.desc?.colors?.portalSeed ?: 0L
}
override fun generateNextColor(controller: IVoidPortalController, layer: Int){
controller.currentInstance?.territory?.desc?.colors?.nextPortalColor(rand, color)
}
}
@@ -1,25 +0,0 @@
package chylex.hee.client.render.entity
import chylex.hee.client.model.entity.ModelEntityBossEnderEye
import chylex.hee.client.model.entity.ModelEntityBossEnderEye.SCALE
import chylex.hee.client.render.util.GL
import chylex.hee.game.entity.living.EntityBossEnderEye
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.RenderLiving
import chylex.hee.system.migration.vanilla.RenderManager
import chylex.hee.system.util.facades.Resource
import net.minecraft.util.ResourceLocation
@Sided(Side.CLIENT)
class RenderEntityBossEnderEye(manager: RenderManager) : RenderLiving<EntityBossEnderEye, ModelEntityBossEnderEye>(manager, ModelEntityBossEnderEye, SCALE){
private val texture = Resource.Custom("textures/entity/ender_eye.png")
override fun preRenderCallback(entity: EntityBossEnderEye, partialTicks: Float){
GL.scale(SCALE, SCALE, SCALE)
super.preRenderCallback(entity, partialTicks)
}
override fun getEntityTexture(entity: EntityBossEnderEye): ResourceLocation{
return texture
}
}
@@ -1,11 +0,0 @@
package chylex.hee.client.render.entity
import chylex.hee.client.util.MC
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.RenderEntityItem
import chylex.hee.system.migration.vanilla.RenderManager
@Sided(Side.CLIENT)
class RenderEntityItemNoBob(manager: RenderManager) : RenderEntityItem(manager, MC.itemRenderer){
override fun shouldBob() = false
}
@@ -1,77 +0,0 @@
package chylex.hee.client.render.entity
import chylex.hee.client.render.util.GL
import chylex.hee.client.render.util.GL.DF_ONE_MINUS_SRC_ALPHA
import chylex.hee.client.render.util.GL.SF_SRC_ALPHA
import chylex.hee.game.entity.living.EntityMobAbstractEnderman
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.EntityEnderman
import chylex.hee.system.migration.vanilla.RenderEnderman
import chylex.hee.system.migration.vanilla.RenderManager
import chylex.hee.system.util.nextFloat
import chylex.hee.system.util.totalTime
import org.lwjgl.opengl.GL11.GL_GREATER
import java.util.Random
@Sided(Side.CLIENT)
open class RenderEntityMobAbstractEnderman(manager: RenderManager) : RenderEnderman(manager){
private val rand = Random()
override fun doRender(entity: EntityEnderman, x: Double, y: Double, z: Double, rotationYaw: Float, partialTicks: Float){
if (entity !is EntityMobAbstractEnderman){
return
}
if (entity.isShaking){
rand.setSeed(entity.world.totalTime)
super.doRender(entity, x + (rand.nextGaussian() * 0.01), y + (rand.nextGaussian() * 0.01), z + (rand.nextGaussian() * 0.01), rotationYaw, partialTicks)
}
else{
super.doRender(entity, x, y, z, rotationYaw, partialTicks)
}
val cloneCount = getCloneCount(entity)
if (cloneCount > 0){
rand.setSeed(entity.world.totalTime * 2L / 3L)
val prevPrevYaw = entity.prevRotationYawHead
val prevYaw = entity.rotationYawHead
val prevPrevPitch = entity.prevRotationPitch
val prevPitch = entity.rotationPitch
repeat(cloneCount){
GL.enableBlend()
GL.blendFunc(SF_SRC_ALPHA, DF_ONE_MINUS_SRC_ALPHA)
GL.alphaFunc(GL_GREATER, 0.004F)
GL.depthMask(false)
GL.color(1F, 1F, 1F, rand.nextFloat(0.05F, 0.3F))
if (rand.nextInt(3) == 0){
entity.rotationYawHead += rand.nextFloat(-45F, 45F)
entity.prevRotationYawHead = entity.rotationYawHead
entity.rotationPitch += rand.nextFloat(-30F, 30F)
entity.prevRotationPitch = entity.rotationPitch
}
super.doRender(entity, x + rand.nextGaussian() * 0.04, y + rand.nextGaussian() * 0.025, z + rand.nextGaussian() * 0.04, rotationYaw, partialTicks)
}
entity.prevRotationYawHead = prevPrevYaw
entity.rotationYawHead = prevYaw
entity.prevRotationPitch = prevPrevPitch
entity.rotationPitch = prevPitch
GL.depthMask(true)
GL.alphaFunc(GL_GREATER, 0.1F)
GL.disableBlend()
}
}
protected open fun getCloneCount(entity: EntityMobAbstractEnderman): Int{
return if (entity.hurtTime == 0 && entity.isAggro) 2 else 0
}
}
@@ -1,14 +0,0 @@
package chylex.hee.client.render.entity
import chylex.hee.game.entity.living.EntityMobAbstractEnderman
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.RenderManager
@Sided(Side.CLIENT)
class RenderEntityMobAngryEnderman(manager: RenderManager) : RenderEntityMobAbstractEnderman(manager){
override fun getCloneCount(entity: EntityMobAbstractEnderman) = when{
entity.hurtTime != 0 -> 0
entity.isAggro -> 2
else -> 1
}
}
@@ -1,33 +0,0 @@
package chylex.hee.client.render.entity
import chylex.hee.client.render.entity.layer.LayerSpiderlingEyes
import chylex.hee.client.render.util.GL
import chylex.hee.game.entity.living.EntityMobSpiderling
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.RenderLiving
import chylex.hee.system.migration.vanilla.RenderManager
import chylex.hee.system.util.facades.Resource
import net.minecraft.client.renderer.entity.model.SpiderModel
import net.minecraft.util.ResourceLocation
@Sided(Side.CLIENT)
class RenderEntityMobSpiderling(manager: RenderManager) : RenderLiving<EntityMobSpiderling, SpiderModel<EntityMobSpiderling>>(manager, SpiderModel(), 0.5F){
private val texture = Resource.Custom("textures/entity/spiderling.png")
init{
addLayer(LayerSpiderlingEyes(this, (entityModel as SpiderModel).field_78209_a)) // RENAME spiderHead
}
override fun preRenderCallback(entity: EntityMobSpiderling, partialTicks: Float){
GL.scale(0.5F, 0.5F, 0.5F)
super.preRenderCallback(entity, partialTicks)
}
override fun getEntityTexture(entity: EntityMobSpiderling): ResourceLocation{
return texture
}
override fun getDeathMaxRotation(entity: EntityMobSpiderling): Float{
return 180F
}
}
@@ -1,35 +0,0 @@
package chylex.hee.client.render.entity
import chylex.hee.client.model.entity.ModelEntityUndread
import chylex.hee.client.render.util.GL
import chylex.hee.game.entity.living.EntityMobUndread
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.RenderBiped
import chylex.hee.system.migration.vanilla.RenderManager
import chylex.hee.system.util.facades.Resource
import net.minecraft.client.renderer.entity.layers.BipedArmorLayer
import net.minecraft.client.renderer.entity.model.AbstractZombieModel
import net.minecraft.util.ResourceLocation
@Sided(Side.CLIENT)
class RenderEntityMobUndread(manager: RenderManager) : RenderBiped<EntityMobUndread, AbstractZombieModel<EntityMobUndread>>(manager, ModelEntityUndread(), 0.5F){
private val texture = Resource.Custom("textures/entity/undread.png")
init{
addLayer(BipedArmorLayer(this, ModelEntityUndread(0.5125F, true), ModelEntityUndread(1F, true)))
}
override fun preRenderCallback(entity: EntityMobUndread, partialTicks: Float){
GL.scale(1.025F, 0.965F, 1.025F)
super.preRenderCallback(entity, partialTicks)
}
override fun getEntityTexture(entity: EntityMobUndread): ResourceLocation{
return texture
}
override fun getDeathMaxRotation(entity: EntityMobUndread): Float{
val uuid = entity.uniqueID
return 15F * (if ((uuid.leastSignificantBits % 2L) xor (uuid.mostSignificantBits % 2L) == 0L) 1F else -1F)
}
}
@@ -1,17 +0,0 @@
package chylex.hee.client.render.entity
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.EntityBat
import chylex.hee.system.migration.vanilla.RenderBat
import chylex.hee.system.migration.vanilla.RenderManager
import chylex.hee.system.util.facades.Resource
import net.minecraft.util.ResourceLocation
@Sided(Side.CLIENT)
class RenderEntityMobVampireBat(manager: RenderManager) : RenderBat(manager){
private val texture = Resource.Custom("textures/entity/vampire_bat.png")
override fun getEntityTexture(entity: EntityBat): ResourceLocation{
return texture
}
}
@@ -1,70 +0,0 @@
package chylex.hee.client.render.entity
import chylex.hee.client.render.util.GL
import chylex.hee.client.util.MC
import chylex.hee.game.entity.living.EntityMobVillagerDying
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.RenderLiving
import chylex.hee.system.migration.vanilla.RenderManager
import chylex.hee.system.util.facades.Resource
import chylex.hee.system.util.totalTime
import net.minecraft.client.renderer.entity.layers.HeadLayer
import net.minecraft.client.renderer.entity.layers.VillagerHeldItemLayer
import net.minecraft.client.renderer.entity.layers.VillagerLevelPendantLayer
import net.minecraft.client.renderer.entity.model.VillagerModel
import net.minecraft.resources.IReloadableResourceManager
import net.minecraft.util.ResourceLocation
import java.util.Random
import kotlin.math.min
@Sided(Side.CLIENT)
class RenderEntityMobVillagerDying(manager: RenderManager) : RenderLiving<EntityMobVillagerDying, VillagerModel<EntityMobVillagerDying>>(manager, VillagerModel(0F), 0.5F){
private val rand = Random()
private val texture = Resource.Vanilla("textures/entity/villager/villager.png")
init{
addLayer(HeadLayer(this))
addLayer(VillagerLevelPendantLayer(this, MC.instance.resourceManager as IReloadableResourceManager, "villager"))
addLayer(VillagerHeldItemLayer(this))
}
override fun doRender(entity: EntityMobVillagerDying, x: Double, y: Double, z: Double, rotationYaw: Float, partialTicks: Float){
rand.setSeed(entity.world.totalTime)
val mp = min(1F, entity.deathTime / 50F) * 0.005F
super.doRender(entity, x + (rand.nextGaussian() * mp), y + (rand.nextGaussian() * mp), z + (rand.nextGaussian() * mp), rotationYaw, partialTicks)
}
override fun getEntityTexture(entity: EntityMobVillagerDying): ResourceLocation{
return texture
}
override fun preRenderCallback(entity: EntityMobVillagerDying, partialTicks: Float){
val scale: Float
if (entity.isChild){
scale = 0.46875F
shadowSize = 0.25F
}
else{
scale = 0.9375F
shadowSize = 0.5F
}
GL.scale(scale, scale, scale)
}
override fun setBrightness(entity: EntityMobVillagerDying, partialTicks: Float, combineTextures: Boolean): Boolean{
val prevDeathTime = entity.deathTime
entity.deathTime = 0
val result = super.setBrightness(entity, partialTicks, combineTextures)
entity.deathTime = prevDeathTime
return result
}
override fun getDeathMaxRotation(entity: EntityMobVillagerDying): Float{
return 0F
}
}
@@ -1,14 +0,0 @@
package chylex.hee.client.render.entity
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.Render
import chylex.hee.system.migration.vanilla.RenderManager
import net.minecraft.client.renderer.culling.ICamera
import net.minecraft.entity.Entity
import net.minecraft.util.ResourceLocation
@Sided(Side.CLIENT)
class RenderEntityNothing(manager: RenderManager) : Render<Entity>(manager){
override fun shouldRender(entity: Entity, camera: ICamera, camX: Double, camY: Double, camZ: Double) = false
override fun getEntityTexture(entity: Entity): ResourceLocation? = null
}
@@ -1,51 +0,0 @@
package chylex.hee.client.render.entity
import chylex.hee.client.render.util.GL
import chylex.hee.client.render.util.ItemRenderHelper
import chylex.hee.client.util.MC
import chylex.hee.game.entity.projectile.EntityProjectileEyeOfEnder
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.Items
import chylex.hee.system.migration.vanilla.Render
import chylex.hee.system.migration.vanilla.RenderManager
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
import net.minecraft.item.ItemStack
import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.ForgeHooksClient
@Sided(Side.CLIENT)
class RenderEntityProjectileEyeOfEnder(manager: RenderManager) : Render<EntityProjectileEyeOfEnder>(manager){
private companion object{
private val RENDERED_ITEM = ItemStack(Items.ENDER_EYE)
}
override fun doRender(entity: EntityProjectileEyeOfEnder, x: Double, y: Double, z: Double, rotationYaw: Float, partialTicks: Float){
ItemRenderHelper.beginItemModel()
GL.pushMatrix()
GL.translate(x, y + entity.renderBob.get(partialTicks), z)
GL.rotate(rotationYaw, 0F, 1F, 0F)
GL.color(1F, 1F, 1F, 1F)
if (renderOutlines){
GL.enableColorMaterial()
GL.enableOutlineMode(getTeamColor(entity))
}
MC.itemRenderer.renderItem(RENDERED_ITEM, ForgeHooksClient.handleCameraTransforms(ItemRenderHelper.getItemModel(RENDERED_ITEM), GROUND, false))
if (renderOutlines){
GL.disableOutlineMode()
GL.disableColorMaterial()
}
GL.popMatrix()
ItemRenderHelper.endItemModel()
super.doRender(entity, x, y, z, rotationYaw, partialTicks)
}
override fun getEntityTexture(entity: EntityProjectileEyeOfEnder): ResourceLocation{
return ItemRenderHelper.TEX_BLOCKS_ITEMS
}
}
@@ -1,54 +0,0 @@
package chylex.hee.client.render.entity
import chylex.hee.client.model.entity.ModelEntityTokenHolder
import chylex.hee.client.render.util.GL
import chylex.hee.client.render.util.GL.DF_ONE_MINUS_SRC_ALPHA
import chylex.hee.client.render.util.GL.SF_SRC_ALPHA
import chylex.hee.game.entity.item.EntityTokenHolder
import chylex.hee.game.item.ItemPortalToken.TokenType.NORMAL
import chylex.hee.game.item.ItemPortalToken.TokenType.RARE
import chylex.hee.game.item.ItemPortalToken.TokenType.SOLITARY
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.migration.vanilla.Render
import chylex.hee.system.migration.vanilla.RenderManager
import chylex.hee.system.util.facades.Resource
import net.minecraft.util.ResourceLocation
import kotlin.math.pow
@Sided(Side.CLIENT)
class RenderEntityTokenHolder(manager: RenderManager) : Render<EntityTokenHolder>(manager){
private val textures = mapOf(
NORMAL to Resource.Custom("textures/entity/token_holder.png"),
RARE to Resource.Custom("textures/entity/token_holder_rare.png"),
SOLITARY to Resource.Custom("textures/entity/token_holder_solitary.png")
)
override fun doRender(entity: EntityTokenHolder, x: Double, y: Double, z: Double, rotationYaw: Float, partialTicks: Float){
val charge = entity.renderCharge.get(partialTicks)
val scale = 0.25F + (0.25F * charge.pow(1.5F))
val alpha = 0.35F + (0.475F * charge.pow(5.5F))
GL.pushMatrix()
GL.translate(x, y + (entity.height * 0.5F), z)
GL.pushMatrix()
GL.scale(scale, scale, scale)
GL.rotate(entity.renderRotation.get(partialTicks), 0F, 1F, 0F)
GL.rotate(55F, 1F, 0F, 1F)
GL.enableBlend()
GL.blendFunc(SF_SRC_ALPHA, DF_ONE_MINUS_SRC_ALPHA)
GL.color(1F, 1F, 1F, alpha)
bindEntityTexture(entity)
ModelEntityTokenHolder.render()
GL.popMatrix()
GL.disableBlend()
GL.popMatrix()
}
override fun getEntityTexture(entity: EntityTokenHolder): ResourceLocation?{
return textures[entity.tokenType]
}
}
@@ -1,56 +0,0 @@
package chylex.hee.client.render.entity.layer
import chylex.hee.client.render.entity.RenderEntityMobSpiderling
import chylex.hee.client.render.util.GL
import chylex.hee.client.render.util.GL.DF_ONE
import chylex.hee.client.render.util.GL.SF_ONE
import chylex.hee.client.util.MC
import chylex.hee.game.entity.living.EntityMobSpiderling
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import chylex.hee.system.util.facades.Resource
import net.minecraft.client.renderer.entity.layers.LayerRenderer
import net.minecraft.client.renderer.entity.model.RendererModel
import net.minecraft.client.renderer.entity.model.SpiderModel
@Sided(Side.CLIENT)
class LayerSpiderlingEyes(spiderlingRenderer: RenderEntityMobSpiderling, private val headRenderer: RendererModel) : LayerRenderer<EntityMobSpiderling, SpiderModel<EntityMobSpiderling>>(spiderlingRenderer){
private val texture = Resource.Custom("textures/entity/spiderling_eyes.png")
override fun render(entity: EntityMobSpiderling, limbSwing: Float, limbSwingAmount: Float, partialTicks: Float, ageInTicks: Float, netHeadYaw: Float, headPitch: Float, scale: Float){
if (entity.isSleeping){
return
}
bindTexture(texture)
GL.disableAlpha()
GL.enableBlend()
GL.blendFunc(SF_ONE, DF_ONE)
GL.depthMask(!entity.isInvisible)
GL.color(1F, 1F, 1F, 1F)
GL.setLightmapCoords(61680F, 0F)
MC.gameRenderer.setupFogColor(true)
if (headPitch == 0F){
GL.pushMatrix()
GL.scale(1.001, 1.001, 1.001) // hack around z-fighting
headRenderer.render(scale)
GL.popMatrix()
}
else{
headRenderer.render(scale)
}
MC.gameRenderer.setupFogColor(false)
func_215334_a(entity) // RENAME resets lightmap
GL.depthMask(true)
GL.disableBlend()
GL.enableAlpha()
}
override fun shouldCombineTextures(): Boolean{
return false
}
}
@@ -1,11 +0,0 @@
package chylex.hee.client.render.territory
import chylex.hee.system.migration.forge.Side
import chylex.hee.system.migration.forge.Sided
import net.minecraft.client.Minecraft
import net.minecraft.client.world.ClientWorld
import net.minecraftforge.client.IRenderHandler
object EmptyRenderer : IRenderHandler{
@Sided(Side.CLIENT)
override fun render(ticks: Int, partialTicks: Float, world: ClientWorld, mc: Minecraft){}
}

Some files were not shown because too many files have changed in this diff Show More