mirror of
https://github.com/chylex/Hardcore-Ender-Expansion-2.git
synced 2025-09-17 02:24:48 +02:00
Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
d1496087de | |||
41aa0b6695 | |||
f0b9da84be | |||
642e388035 | |||
1e24978088 | |||
5e1a7f3586 | |||
ab158eabb4 | |||
dbe9b8bf2f | |||
8d6889cf03 | |||
3c2a7cb0d1 | |||
601d5a449b | |||
1de1935aea | |||
f1a9eb1230 | |||
c004d2fa41 | |||
3377172c81 | |||
b350ae059a | |||
ebaa4d7ba4 | |||
d704aa8d8b | |||
6b59906119 | |||
226490bcf8 | |||
46e3f7d635 | |||
d3bde471fd | |||
fb5cd9d104 | |||
a865666179 | |||
838cf7e018 | |||
e987bfc8ab | |||
25569d9fc4 | |||
aacf3bde3f | |||
a44d45d9ce | |||
c1d81413c5 | |||
e31ffac439 | |||
8585ab5509 |
1
.idea/codeInsightSettings.xml
generated
1
.idea/codeInsightSettings.xml
generated
@@ -3,6 +3,7 @@
|
|||||||
<component name="JavaProjectCodeInsightSettings">
|
<component name="JavaProjectCodeInsightSettings">
|
||||||
<excluded-names>
|
<excluded-names>
|
||||||
<name>akka</name>
|
<name>akka</name>
|
||||||
|
<name>chylex.hee.client.util.MC</name>
|
||||||
<name>com.ibm</name>
|
<name>com.ibm</name>
|
||||||
<name>com.sun</name>
|
<name>com.sun</name>
|
||||||
<name>java.awt</name>
|
<name>java.awt</name>
|
||||||
|
6
.idea/kotlinCodeInsightSettings.xml
generated
Normal file
6
.idea/kotlinCodeInsightSettings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KotlinCodeInsightWorkspaceSettings">
|
||||||
|
<option name="optimizeImportsOnTheFly" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
34
.idea/misc.xml
generated
34
.idea/misc.xml
generated
@@ -1,13 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="EntryPointsManager">
|
<component name="EntryPointsManager">
|
||||||
<list size="6">
|
<list size="10">
|
||||||
<item index="0" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.Mod" />
|
<item index="0" class="java.lang.String" itemvalue="chylex.hee.system.migration.forge.SubscribeEvent" />
|
||||||
<item index="1" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.Mod.EventBusSubscriber" />
|
<item index="1" class="java.lang.String" itemvalue="chylex.hee.system.migration.forge.SubscribeEvent" />
|
||||||
<item index="2" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.Mod.EventHandler" />
|
<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.eventhandler.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.network.NetworkCheckHandler" />
|
<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.relauncher.IFMLLoadingPlugin.Name" />
|
<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>
|
</list>
|
||||||
</component>
|
</component>
|
||||||
<component name="NullableNotNullManager">
|
<component name="NullableNotNullManager">
|
||||||
@@ -15,22 +19,34 @@
|
|||||||
<option name="myDefaultNotNull" value="javax.annotation.Nonnull" />
|
<option name="myDefaultNotNull" value="javax.annotation.Nonnull" />
|
||||||
<option name="myNullables">
|
<option name="myNullables">
|
||||||
<value>
|
<value>
|
||||||
<list size="5">
|
<list size="11">
|
||||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
<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="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
<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="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="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>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="myNotNulls">
|
<option name="myNotNulls">
|
||||||
<value>
|
<value>
|
||||||
<list size="4">
|
<list size="10">
|
||||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
<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="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="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="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>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
|
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@@ -3,7 +3,6 @@
|
|||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<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.iml" filepath="$PROJECT_DIR$/.idea/modules/Hardcore-Ender-Expansion-2.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/Hardcore-Ender-Expansion-2.api.iml" filepath="$PROJECT_DIR$/.idea/modules/Hardcore-Ender-Expansion-2.api.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.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" />
|
<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>
|
</modules>
|
||||||
|
15
.idea/runConfigurations/Minecraft_Client.xml
generated
15
.idea/runConfigurations/Minecraft_Client.xml
generated
@@ -1,15 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="Minecraft Client" type="Application" factoryName="Application" singleton="true">
|
|
||||||
<option name="MAIN_CLASS_NAME" value="GradleStart" />
|
|
||||||
<module name="Hardcore-Ender-Expansion-2.main" />
|
|
||||||
<option name="PROGRAM_PARAMETERS" value="--username Player" />
|
|
||||||
<option name="VM_PARAMETERS" value="-Dhee.debug -Dfml.coreMods.load=chylex.hee.system.core.CoremodPlugin -XX:HotswapDeoptClassPath='chylex.,net.,com.sun.proxy.$Proxy,sun.reflect.Generated'" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="./run" />
|
|
||||||
<extension enabled="false" name="coverage" runner="idea" sample_coverage="true" />
|
|
||||||
<RunnerSettings RunnerId="Run" />
|
|
||||||
<ConfigurationWrapper RunnerId="Run" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Make" enabled="true" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
14
.idea/runConfigurations/Minecraft_Server.xml
generated
14
.idea/runConfigurations/Minecraft_Server.xml
generated
@@ -1,14 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="Minecraft Server" type="Application" factoryName="Application" singleton="true">
|
|
||||||
<option name="MAIN_CLASS_NAME" value="GradleStartServer" />
|
|
||||||
<module name="Hardcore-Ender-Expansion-2.main" />
|
|
||||||
<option name="VM_PARAMETERS" value="-Dhee.debug -Dfml.coreMods.load=chylex.hee.system.core.CoremodPlugin -XX:HotswapDeoptClassPath='chylex.,net.,com.sun.proxy.$Proxy,sun.reflect.Generated'" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="./run" />
|
|
||||||
<extension enabled="false" name="coverage" runner="idea" sample_coverage="true" />
|
|
||||||
<RunnerSettings RunnerId="Run" />
|
|
||||||
<ConfigurationWrapper RunnerId="Run" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Make" enabled="true" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
4
.idea/shelf/Development.xml
generated
Normal file
4
.idea/shelf/Development.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<changelist name="Development" date="1579752205042" recycled="false">
|
||||||
|
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Development/shelved.patch" />
|
||||||
|
<option name="DESCRIPTION" value="Development" />
|
||||||
|
</changelist>
|
145
.idea/shelf/Development/shelved.patch
generated
Normal file
145
.idea/shelf/Development/shelved.patch
generated
Normal file
File diff suppressed because one or more lines are too long
4
.idea/shelf/Ender_Eye.xml
generated
Normal file
4
.idea/shelf/Ender_Eye.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<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>
|
69
.idea/shelf/Ender_Eye/shelved.patch
generated
Normal file
69
.idea/shelf/Ender_Eye/shelved.patch
generated
Normal file
File diff suppressed because one or more lines are too long
4
.idea/shelf/Experience_Table.xml
generated
Normal file
4
.idea/shelf/Experience_Table.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<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>
|
342
.idea/shelf/Experience_Table/shelved.patch
generated
Normal file
342
.idea/shelf/Experience_Table/shelved.patch
generated
Normal file
File diff suppressed because one or more lines are too long
4
.idea/shelf/Ideas.xml
generated
Normal file
4
.idea/shelf/Ideas.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<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
.idea/shelf/Ideas/shelved.patch
generated
Normal file
53
.idea/shelf/Ideas/shelved.patch
generated
Normal file
File diff suppressed because one or more lines are too long
4
.idea/shelf/Later.xml
generated
Normal file
4
.idea/shelf/Later.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<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
.idea/shelf/Later/shelved.patch
generated
Normal file
54
.idea/shelf/Later/shelved.patch
generated
Normal file
File diff suppressed because one or more lines are too long
4
.idea/shelf/Shulker_Box.xml
generated
Normal file
4
.idea/shelf/Shulker_Box.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<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>
|
93
.idea/shelf/Shulker_Box/shelved.patch
generated
Normal file
93
.idea/shelf/Shulker_Box/shelved.patch
generated
Normal file
File diff suppressed because one or more lines are too long
4
.idea/shelf/Territories.xml
generated
Normal file
4
.idea/shelf/Territories.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<changelist name="Territories" date="1579750362160" recycled="false">
|
||||||
|
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Territories/shelved.patch" />
|
||||||
|
<option name="DESCRIPTION" value="Territories" />
|
||||||
|
</changelist>
|
153
.idea/shelf/Territories/shelved.patch
generated
Normal file
153
.idea/shelf/Territories/shelved.patch
generated
Normal file
File diff suppressed because one or more lines are too long
39
.idea/shelf/Tomb.xml
generated
Normal file
39
.idea/shelf/Tomb.xml
generated
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<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>
|
BIN
.idea/shelf/Tomb/corridor.stairs.end.nbt
generated
Normal file
BIN
.idea/shelf/Tomb/corridor.stairs.end.nbt
generated
Normal file
Binary file not shown.
BIN
.idea/shelf/Tomb/corridor.stairs.middle.nbt
generated
Normal file
BIN
.idea/shelf/Tomb/corridor.stairs.middle.nbt
generated
Normal file
Binary file not shown.
BIN
.idea/shelf/Tomb/corridor.stairs.start.nbt
generated
Normal file
BIN
.idea/shelf/Tomb/corridor.stairs.start.nbt
generated
Normal file
Binary file not shown.
BIN
.idea/shelf/Tomb/main.end.nbt
generated
Normal file
BIN
.idea/shelf/Tomb/main.end.nbt
generated
Normal file
Binary file not shown.
671
.idea/shelf/Tomb/shelved.patch
generated
Normal file
671
.idea/shelf/Tomb/shelved.patch
generated
Normal file
@@ -0,0 +1,671 @@
|
|||||||
|
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
|
||||||
|
+ }
|
||||||
|
+}
|
BIN
.idea/shelf/Tomb/tomb.multi2x4.narrow.nbt
generated
Normal file
BIN
.idea/shelf/Tomb/tomb.multi2x4.narrow.nbt
generated
Normal file
Binary file not shown.
BIN
.idea/shelf/Tomb/tomb.multi2x4.spacious.nbt
generated
Normal file
BIN
.idea/shelf/Tomb/tomb.multi2x4.spacious.nbt
generated
Normal file
Binary file not shown.
BIN
.idea/shelf/Tomb/tomb.single.narrow.nbt
generated
Normal file
BIN
.idea/shelf/Tomb/tomb.single.narrow.nbt
generated
Normal file
Binary file not shown.
11
.idea/vcs.xml
generated
Normal file
11
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?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>
|
99
build.gradle
99
build.gradle
@@ -1,24 +1,49 @@
|
|||||||
buildscript{
|
buildscript{
|
||||||
ext.kotlin_version = "1.3.40"
|
ext.kotlin_version = "1.3.61"
|
||||||
|
|
||||||
repositories{
|
repositories{
|
||||||
jcenter()
|
jcenter()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
||||||
maven{
|
maven{
|
||||||
url = "http://files.minecraftforge.net/maven"
|
url = "https://files.minecraftforge.net/maven"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies{
|
dependencies{
|
||||||
classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT"
|
classpath(group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "3.+", changing: true){
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
|
exclude group: "trove", module: "trove"
|
||||||
|
}
|
||||||
|
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:" + kotlin_version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: "net.minecraftforge.gradle.forge"
|
repositories{
|
||||||
|
maven{
|
||||||
|
url = "https://minecraft.curseforge.com/api/maven"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: "net.minecraftforge.gradle"
|
||||||
|
apply plugin: "eclipse"
|
||||||
apply plugin: "kotlin"
|
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"
|
sourceCompatibility = targetCompatibility = "1.8"
|
||||||
|
|
||||||
tasks.withType(JavaCompile){
|
tasks.withType(JavaCompile){
|
||||||
@@ -43,36 +68,64 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile){
|
|||||||
}
|
}
|
||||||
|
|
||||||
minecraft{
|
minecraft{
|
||||||
version = "1.12.2-14.23.5.2768"
|
mappings channel: "snapshot", version: "20200119-1.14.4"
|
||||||
runDir = "run"
|
|
||||||
mappings = "stable_39"
|
accessTransformer = file("src/main/resources/META-INF/accesstransformer.cfg")
|
||||||
makeObfSourceJar = false
|
|
||||||
|
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{
|
dependencies{
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
minecraft "net.minecraftforge:forge:" + mcversion + "-" + forgeversion
|
||||||
compile "org.jetbrains.kotlin:kotlin-reflect"
|
implementation "kottle:Kottle:" + kottleversion
|
||||||
|
|
||||||
testCompile "org.junit.jupiter:junit-jupiter-api:5.3.0-RC1"
|
testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.0-RC1"
|
||||||
}
|
}
|
||||||
|
|
||||||
test{
|
test{
|
||||||
systemProperty "junit.jupiter.testinstance.lifecycle.default", "per_class"
|
systemProperty "junit.jupiter.testinstance.lifecycle.default", "per_class"
|
||||||
}
|
}
|
||||||
|
|
||||||
def modinfo = null
|
|
||||||
|
|
||||||
processResources{
|
|
||||||
File file = new File(++sourceSets.main.resources.srcDirs.iterator(), "mcmod.info")
|
|
||||||
modinfo = new groovy.json.JsonSlurper().parseText(file.getText())[0]
|
|
||||||
|
|
||||||
rename("hee_at.cfg", "META-INF/hee_at.cfg")
|
|
||||||
}
|
|
||||||
|
|
||||||
jar{
|
jar{
|
||||||
archiveName = "HardcoreEnderExpansion MC-${project.minecraft.version} v${modinfo.version}.jar"
|
archiveName = archivesBaseName + "-" + mcversion + "-v" + version + ".jar"
|
||||||
|
|
||||||
|
from("./"){
|
||||||
|
include "LICENSE"
|
||||||
|
}
|
||||||
|
|
||||||
manifest{
|
manifest{
|
||||||
attributes "FMLAT": "hee_at.cfg"
|
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")
|
||||||
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,8 @@
|
|||||||
package chylex.hee
|
package chylex.hee
|
||||||
import chylex.hee.game.block.util.CustomPlantType
|
import chylex.hee.game.block.util.CustomPlantType
|
||||||
import chylex.hee.game.commands.HeeServerCommand
|
|
||||||
import chylex.hee.game.entity.CustomCreatureType
|
|
||||||
import chylex.hee.game.entity.item.EntityItemIgneousRock
|
|
||||||
import chylex.hee.game.entity.living.EntityMobEnderman
|
import chylex.hee.game.entity.living.EntityMobEnderman
|
||||||
import chylex.hee.game.entity.living.behavior.EndermanBlockHandler
|
import chylex.hee.game.entity.living.behavior.EndermanBlockHandler
|
||||||
import chylex.hee.game.item.util.CustomRarity
|
import chylex.hee.game.item.util.CustomRarity
|
||||||
import chylex.hee.game.item.util.CustomToolMaterial
|
|
||||||
import chylex.hee.game.mechanics.causatum.EnderCausatum
|
import chylex.hee.game.mechanics.causatum.EnderCausatum
|
||||||
import chylex.hee.game.mechanics.instability.Instability
|
import chylex.hee.game.mechanics.instability.Instability
|
||||||
import chylex.hee.game.mechanics.trinket.TrinketHandler
|
import chylex.hee.game.mechanics.trinket.TrinketHandler
|
||||||
@@ -14,91 +10,68 @@ import chylex.hee.game.world.WorldProviderEndCustom
|
|||||||
import chylex.hee.game.world.feature.OverworldFeatures
|
import chylex.hee.game.world.feature.OverworldFeatures
|
||||||
import chylex.hee.game.world.territory.storage.TokenPlayerStorage
|
import chylex.hee.game.world.territory.storage.TokenPlayerStorage
|
||||||
import chylex.hee.init.ModCreativeTabs
|
import chylex.hee.init.ModCreativeTabs
|
||||||
import chylex.hee.init.ModGuiHandler
|
|
||||||
import chylex.hee.init.ModLoot
|
import chylex.hee.init.ModLoot
|
||||||
import chylex.hee.init.ModNetwork
|
import chylex.hee.init.ModNetwork
|
||||||
import chylex.hee.init.ModPotions
|
import chylex.hee.init.ModPotions
|
||||||
import chylex.hee.init.ModRecipes
|
import chylex.hee.init.ModTileEntities
|
||||||
import chylex.hee.proxy.Environment
|
import chylex.hee.proxy.Environment
|
||||||
import chylex.hee.system.Debug
|
import chylex.hee.system.Debug
|
||||||
import chylex.hee.system.IntegrityCheck
|
import chylex.hee.system.IntegrityCheck
|
||||||
import chylex.hee.system.migration.forge.Side
|
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
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent
|
||||||
import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent
|
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent
|
import org.apache.logging.log4j.LogManager
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent
|
|
||||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent
|
|
||||||
import net.minecraftforge.fml.common.network.NetworkCheckHandler
|
|
||||||
import org.apache.logging.log4j.Logger
|
import org.apache.logging.log4j.Logger
|
||||||
|
|
||||||
@Mod(modid = HEE.ID, useMetadata = true, modLanguageAdapter = "chylex.hee.system.core.KotlinAdapter")
|
@Mod(HEE.ID)
|
||||||
|
@SubscribeAllEvents(modid = HEE.ID, bus = MOD)
|
||||||
object HEE{
|
object HEE{
|
||||||
const val ID = "hee"
|
const val ID = "hee"
|
||||||
const val DIM = 1
|
|
||||||
|
|
||||||
lateinit var log: Logger
|
val log: Logger = LogManager.getLogger("HardcoreEnderExpansion")
|
||||||
lateinit var version: String
|
val version: String
|
||||||
|
|
||||||
|
val dim: DimensionType = DimensionType.THE_END
|
||||||
val proxy = Environment.constructProxy()
|
val proxy = Environment.constructProxy()
|
||||||
|
|
||||||
init{
|
init{
|
||||||
CustomRarity
|
with(ModLoadingContext.get()){
|
||||||
CustomToolMaterial
|
version = activeContainer.modInfo.version.toString()
|
||||||
CustomCreatureType
|
|
||||||
CustomPlantType
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
CustomRarity
|
||||||
fun onPreInit(e: FMLPreInitializationEvent){
|
CustomPlantType
|
||||||
log = e.modLog
|
|
||||||
version = e.modMetadata.version
|
|
||||||
|
|
||||||
Debug.initialize()
|
|
||||||
ModNetwork.initialize()
|
|
||||||
ModGuiHandler.initialize()
|
|
||||||
ModCreativeTabs.initialize()
|
ModCreativeTabs.initialize()
|
||||||
|
WorldProviderEndCustom.register()
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
fun onCommonSetup(@Suppress("UNUSED_PARAMETER") e: FMLCommonSetupEvent){
|
||||||
|
Debug.initialize()
|
||||||
|
|
||||||
|
ModNetwork.initialize()
|
||||||
|
ModLoot.initialize()
|
||||||
|
|
||||||
TrinketHandler.register()
|
TrinketHandler.register()
|
||||||
EnderCausatum.register()
|
EnderCausatum.register()
|
||||||
Instability.register()
|
Instability.register()
|
||||||
TokenPlayerStorage.register()
|
TokenPlayerStorage.register()
|
||||||
WorldProviderEndCustom.register()
|
|
||||||
|
|
||||||
proxy.onPreInit()
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
fun onInit(@Suppress("UNUSED_PARAMETER") e: FMLInitializationEvent){
|
|
||||||
ModLoot.initialize()
|
|
||||||
ModRecipes.initialize()
|
|
||||||
OverworldFeatures.register()
|
OverworldFeatures.register()
|
||||||
proxy.onInit()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@SubscribeEvent
|
||||||
fun onPostInit(@Suppress("UNUSED_PARAMETER") e: FMLPostInitializationEvent){
|
fun onLoadComplete(@Suppress("UNUSED_PARAMETER") e: FMLLoadCompleteEvent){
|
||||||
CustomToolMaterial.setupRepairItems()
|
|
||||||
EntityItemIgneousRock.setupSmeltingTransformations()
|
|
||||||
EntityMobEnderman.setupBiomeSpawns()
|
EntityMobEnderman.setupBiomeSpawns()
|
||||||
EndermanBlockHandler.setupCarriableBlocks()
|
EndermanBlockHandler.setupCarriableBlocks()
|
||||||
ModPotions.setupVanillaOverrides()
|
ModPotions.setupVanillaOverrides()
|
||||||
|
ModTileEntities.setupVanillaValidBlocks()
|
||||||
OverworldFeatures.setupVanillaOverrides()
|
OverworldFeatures.setupVanillaOverrides()
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
fun onLoadComplete(@Suppress("UNUSED_PARAMETER") e: FMLLoadCompleteEvent){
|
|
||||||
IntegrityCheck.verify()
|
IntegrityCheck.verify()
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
fun onServerStarting(e: FMLServerStartingEvent){
|
|
||||||
e.registerServerCommand(HeeServerCommand)
|
|
||||||
}
|
|
||||||
|
|
||||||
@NetworkCheckHandler
|
|
||||||
fun onNetworkCheck(mods: Map<String, String>, @Suppress("UNUSED_PARAMETER") side: Side): Boolean{
|
|
||||||
return mods.isNotEmpty() && mods[ID] == version
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -4,27 +4,21 @@ import chylex.hee.game.container.ContainerAmuletOfRecovery
|
|||||||
import chylex.hee.network.server.PacketServerContainerEvent
|
import chylex.hee.network.server.PacketServerContainerEvent
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.gui.GuiButton
|
|
||||||
import net.minecraft.client.resources.I18n
|
import net.minecraft.client.resources.I18n
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
import net.minecraft.util.EnumHand
|
import net.minecraft.util.text.ITextComponent
|
||||||
import net.minecraftforge.fml.client.config.GuiButtonExt
|
import net.minecraftforge.fml.client.config.GuiButtonExt
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class GuiAmuletOfRecovery(player: EntityPlayer, itemHeldIn: EnumHand) : GuiBaseChestContainer(ContainerAmuletOfRecovery(player, itemHeldIn)){
|
class GuiAmuletOfRecovery(container: ContainerAmuletOfRecovery, inventory: PlayerInventory, title: ITextComponent) : GuiBaseChestContainer<ContainerAmuletOfRecovery>(container, inventory, title){
|
||||||
override fun initGui(){
|
override fun init(){
|
||||||
super.initGui()
|
super.init()
|
||||||
|
|
||||||
val moveAllTitle = I18n.format("gui.hee.amulet_of_recovery.move_all")
|
val moveAllTitle = I18n.format("gui.hee.amulet_of_recovery.move_all")
|
||||||
val moveAllWidth = (fontRenderer.getStringWidth(moveAllTitle) + 14).coerceAtMost(xSize / 2)
|
val moveAllWidth = (font.getStringWidth(moveAllTitle) + 14).coerceAtMost(xSize / 2)
|
||||||
|
|
||||||
buttonList.add(GuiButtonExt(1000, guiLeft + xSize - moveAllWidth - 7, (height / 2) + 6, moveAllWidth, 11, moveAllTitle))
|
addButton(GuiButtonExt(guiLeft + xSize - moveAllWidth - 7, (height / 2) + 6, moveAllWidth, 11, moveAllTitle){
|
||||||
}
|
PacketServerContainerEvent(0).sendToServer()
|
||||||
|
})
|
||||||
override fun actionPerformed(button: GuiButton){
|
|
||||||
when(button.id){
|
|
||||||
1000 -> PacketServerContainerEvent(0).sendToServer()
|
|
||||||
else -> super.actionPerformed(button)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,28 +2,23 @@ package chylex.hee.client.gui
|
|||||||
import chylex.hee.client.render.util.GL
|
import chylex.hee.client.render.util.GL
|
||||||
import chylex.hee.client.util.MC
|
import chylex.hee.client.util.MC
|
||||||
import chylex.hee.game.block.entity.TileEntityBrewingStandCustom
|
import chylex.hee.game.block.entity.TileEntityBrewingStandCustom
|
||||||
import chylex.hee.game.container.ContainerBrewingStandCustom
|
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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.facades.Resource
|
||||||
import chylex.hee.system.util.getStack
|
|
||||||
import chylex.hee.system.util.isNotEmpty
|
|
||||||
import chylex.hee.system.util.totalTime
|
import chylex.hee.system.util.totalTime
|
||||||
import net.minecraft.client.gui.inventory.GuiBrewingStand
|
import net.minecraft.client.gui.screen.inventory.BrewingStandScreen
|
||||||
import net.minecraft.entity.player.InventoryPlayer
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
|
import net.minecraft.util.text.ITextComponent
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class GuiBrewingStandCustom(inventory: InventoryPlayer, private val brewingStand: TileEntityBrewingStandCustom) : GuiBrewingStand(inventory, brewingStand){
|
class GuiBrewingStandCustom(container: ContainerBrewingStand, inventory: PlayerInventory, title: ITextComponent) : BrewingStandScreen(container, inventory, title){
|
||||||
private companion object{
|
private companion object{
|
||||||
private val TEX_BACKGROUND = Resource.Custom("textures/gui/brewing_stand.png")
|
private val TEX_BACKGROUND = Resource.Custom("textures/gui/brewing_stand.png")
|
||||||
private val BUBBLE_LENGTHS = intArrayOf(0, 6, 11, 16, 20, 24, 29)
|
private val BUBBLE_LENGTHS = intArrayOf(0, 6, 11, 16, 20, 24, 29)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var brewStartTime = brewingStand.world.totalTime
|
private var brewStartTime = MC.world!!.totalTime
|
||||||
|
|
||||||
init{
|
|
||||||
inventorySlots = ContainerBrewingStandCustom(inventory, brewingStand)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
|
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
|
||||||
val x = (width - xSize) / 2
|
val x = (width - xSize) / 2
|
||||||
@@ -31,37 +26,37 @@ class GuiBrewingStandCustom(inventory: InventoryPlayer, private val brewingStand
|
|||||||
|
|
||||||
GL.color(1F, 1F, 1F, 1F)
|
GL.color(1F, 1F, 1F, 1F)
|
||||||
MC.textureManager.bindTexture(TEX_BACKGROUND)
|
MC.textureManager.bindTexture(TEX_BACKGROUND)
|
||||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize)
|
blit(x, y, 0, 0, xSize, ySize)
|
||||||
|
|
||||||
val worldTime = brewingStand.world.totalTime
|
val worldTime = MC.world!!.totalTime
|
||||||
val brewTime = brewingStand.brewTime
|
val brewTime = container.func_216981_f() // RENAME getBrewTime
|
||||||
|
|
||||||
if (brewTime > 0){
|
if (brewTime > 0){
|
||||||
val brewProgress = (28F * (1F - (brewTime / 400F))).toInt()
|
val brewProgress = (28F * (1F - (brewTime / 400F))).toInt()
|
||||||
|
|
||||||
if (brewProgress > 0){
|
if (brewProgress > 0){
|
||||||
drawTexturedModalRect(x + 97, y + 16, 176, 0, 9, brewProgress)
|
blit(x + 97, y + 16, 176, 0, 9, brewProgress)
|
||||||
}
|
}
|
||||||
|
|
||||||
val bubbleLength = BUBBLE_LENGTHS[((worldTime - brewStartTime).toInt() / 2) % 7]
|
val bubbleLength = BUBBLE_LENGTHS[((worldTime - brewStartTime).toInt() / 2) % 7]
|
||||||
|
|
||||||
if (bubbleLength > 0){
|
if (bubbleLength > 0){
|
||||||
drawTexturedModalRect(x + 63, y + 43 - bubbleLength, 185, 29 - bubbleLength, 12, bubbleLength)
|
blit(x + 63, y + 43 - bubbleLength, 185, 29 - bubbleLength, 12, bubbleLength)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
brewStartTime = worldTime
|
brewStartTime = worldTime
|
||||||
}
|
}
|
||||||
|
|
||||||
if (brewingStand.getStack(TileEntityBrewingStandCustom.SLOT_MODIFIER).isNotEmpty){
|
if (container.getSlot(TileEntityBrewingStandCustom.SLOT_MODIFIER).hasStack){
|
||||||
drawTexturedModalRect(x + 62, y + 45, 197, 0, 14, 2)
|
blit(x + 62, y + 45, 197, 0, 14, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
for(slotIndex in TileEntityBrewingStandCustom.SLOTS_POTIONS){
|
for(slotIndex in TileEntityBrewingStandCustom.SLOTS_POTIONS){
|
||||||
val slot = inventorySlots.getSlot(slotIndex)
|
val slot = container.getSlot(slotIndex)
|
||||||
|
|
||||||
if (!slot.hasStack){
|
if (!slot.hasStack){
|
||||||
drawTexturedModalRect(x + slot.xPos, y + slot.yPos, 211, 0, 16, 16)
|
blit(x + slot.xPos, y + slot.yPos, 211, 0, 16, 16)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,8 @@ import chylex.hee.game.block.entity.TileEntityLootChest
|
|||||||
import chylex.hee.game.container.ContainerLootChest
|
import chylex.hee.game.container.ContainerLootChest
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
|
import net.minecraft.util.text.ITextComponent
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class GuiLootChest(player: EntityPlayer, tile: TileEntityLootChest) : GuiBaseChestContainer(ContainerLootChest(player, tile))
|
class GuiLootChest(container: ContainerLootChest, inventory: PlayerInventory, title: ITextComponent) : GuiBaseChestContainer<ContainerLootChest>(container, inventory, TileEntityLootChest.getClientTitle(inventory.player, title))
|
||||||
|
@@ -1,17 +1,15 @@
|
|||||||
package chylex.hee.client.gui
|
package chylex.hee.client.gui
|
||||||
import chylex.hee.client.gui.base.GuiBaseChestContainer
|
import chylex.hee.client.gui.base.GuiBaseChestContainer
|
||||||
import chylex.hee.game.block.entity.TileEntityVoidPortalStorage
|
|
||||||
import chylex.hee.game.container.ContainerPortalTokenStorage
|
import chylex.hee.game.container.ContainerPortalTokenStorage
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.util.any
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
import chylex.hee.system.util.nonEmptySlots
|
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.util.text.ITextComponent
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class GuiPortalTokenStorage(player: EntityPlayer, tile: TileEntityVoidPortalStorage) : GuiBaseChestContainer(ContainerPortalTokenStorage(player, tile)){
|
class GuiPortalTokenStorage(container: ContainerPortalTokenStorage, inventory: PlayerInventory, title: ITextComponent) : GuiBaseChestContainer<ContainerPortalTokenStorage>(container, inventory, title){
|
||||||
fun canActivateToken(stack: ItemStack): Boolean{
|
fun canActivateToken(stack: ItemStack): Boolean{
|
||||||
return (inventorySlots as ContainerPortalTokenStorage).lowerChestInventory.nonEmptySlots.any { it.stack === stack }
|
return container.canActivateToken(stack)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,17 +2,16 @@ package chylex.hee.client.gui
|
|||||||
import chylex.hee.client.gui.base.GuiBaseCustomInventory
|
import chylex.hee.client.gui.base.GuiBaseCustomInventory
|
||||||
import chylex.hee.game.container.ContainerTrinketPouch
|
import chylex.hee.game.container.ContainerTrinketPouch
|
||||||
import chylex.hee.game.container.base.ContainerBaseCustomInventory
|
import chylex.hee.game.container.base.ContainerBaseCustomInventory
|
||||||
import chylex.hee.game.item.ItemTrinketPouch.Inventory
|
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.util.color.IntColor.Companion.RGBA
|
import chylex.hee.system.util.color.IntColor.Companion.RGBA
|
||||||
import chylex.hee.system.util.facades.Resource
|
import chylex.hee.system.util.facades.Resource
|
||||||
import chylex.hee.system.util.size
|
import chylex.hee.system.util.size
|
||||||
import net.minecraft.client.gui.Gui
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.util.text.ITextComponent
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class GuiTrinketPouch(player: EntityPlayer, inventorySlot: Int) : GuiBaseCustomInventory<Inventory>(ContainerTrinketPouch(player, inventorySlot)){
|
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 texBackground = Resource.Custom("textures/gui/trinket_pouch.png")
|
||||||
override val titleContainer = "gui.hee.trinket_pouch.title"
|
override val titleContainer = "gui.hee.trinket_pouch.title"
|
||||||
|
|
||||||
@@ -21,7 +20,7 @@ class GuiTrinketPouch(player: EntityPlayer, inventorySlot: Int) : GuiBaseCustomI
|
|||||||
|
|
||||||
init{
|
init{
|
||||||
ySize = ContainerTrinketPouch.HEIGHT
|
ySize = ContainerTrinketPouch.HEIGHT
|
||||||
hiddenSlots = ContainerTrinketPouch.MAX_SLOTS - (inventorySlots as ContainerBaseCustomInventory<*>).containerInventory.size
|
hiddenSlots = ContainerTrinketPouch.MAX_SLOTS - (container as ContainerBaseCustomInventory<*>).containerInventory.size
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
|
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
|
||||||
@@ -37,6 +36,6 @@ class GuiTrinketPouch(player: EntityPlayer, inventorySlot: Int) : GuiBaseCustomI
|
|||||||
private fun renderSlotCover(index: Int){
|
private fun renderSlotCover(index: Int){
|
||||||
val x = guiLeft + 44 + (index * 18)
|
val x = guiLeft + 44 + (index * 18)
|
||||||
val y = guiTop + 18
|
val y = guiTop + 18
|
||||||
Gui.drawRect(x, y, x + 16, y + 16, hiddenSlotColor)
|
fill(x, y, x + 16, y + 16, hiddenSlotColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,14 +3,16 @@ import chylex.hee.client.render.util.GL
|
|||||||
import chylex.hee.client.util.MC
|
import chylex.hee.client.util.MC
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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.color.IntColor.Companion.RGB
|
||||||
import chylex.hee.system.util.facades.Resource
|
import chylex.hee.system.util.facades.Resource
|
||||||
import chylex.hee.system.util.size
|
import chylex.hee.system.util.size
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer
|
import net.minecraft.client.gui.screen.inventory.ContainerScreen
|
||||||
import net.minecraft.inventory.ContainerChest
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
|
import net.minecraft.util.text.ITextComponent
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
abstract class GuiBaseChestContainer(container: ContainerChest) : GuiContainer(container){
|
abstract class GuiBaseChestContainer<T : ContainerChest>(container: T, inventory: PlayerInventory, title: ITextComponent) : ContainerScreen<T>(container, inventory, title){
|
||||||
private companion object{
|
private companion object{
|
||||||
private val TEX_BACKGROUND = Resource.Vanilla("textures/gui/container/generic_54.png")
|
private val TEX_BACKGROUND = Resource.Vanilla("textures/gui/container/generic_54.png")
|
||||||
private val COLOR_TEXT = RGB(64u).i
|
private val COLOR_TEXT = RGB(64u).i
|
||||||
@@ -18,16 +20,13 @@ abstract class GuiBaseChestContainer(container: ContainerChest) : GuiContainer(c
|
|||||||
|
|
||||||
private val containerRows = container.lowerChestInventory.size / 9
|
private val containerRows = container.lowerChestInventory.size / 9
|
||||||
|
|
||||||
private val titleContainer = container.lowerChestInventory.displayName.unformattedText
|
|
||||||
private val titleInventory = MC.player?.inventory?.displayName?.unformattedText ?: "" // 'mc' not initialized yet
|
|
||||||
|
|
||||||
init{
|
init{
|
||||||
ySize = 114 + (containerRows * 18)
|
ySize = 114 + (containerRows * 18)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float){
|
override fun render(mouseX: Int, mouseY: Int, partialTicks: Float){
|
||||||
drawDefaultBackground()
|
renderBackground()
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks)
|
super.render(mouseX, mouseY, partialTicks)
|
||||||
renderHoveredToolTip(mouseX, mouseY)
|
renderHoveredToolTip(mouseX, mouseY)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,13 +36,13 @@ abstract class GuiBaseChestContainer(container: ContainerChest) : GuiContainer(c
|
|||||||
val heightContainer = 17 + (containerRows * 18)
|
val heightContainer = 17 + (containerRows * 18)
|
||||||
|
|
||||||
GL.color(1F, 1F, 1F, 1F)
|
GL.color(1F, 1F, 1F, 1F)
|
||||||
mc.textureManager.bindTexture(TEX_BACKGROUND)
|
MC.textureManager.bindTexture(TEX_BACKGROUND)
|
||||||
drawTexturedModalRect(x, y, 0, 0, xSize, heightContainer)
|
blit(x, y, 0, 0, xSize, heightContainer)
|
||||||
drawTexturedModalRect(x, y + heightContainer, 0, 126, xSize, 96)
|
blit(x, y + heightContainer, 0, 126, xSize, 96)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int){
|
override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int){
|
||||||
fontRenderer.drawString(titleContainer, 8, 6, COLOR_TEXT)
|
font.drawString(title.formattedText, 8F, 6F, COLOR_TEXT)
|
||||||
fontRenderer.drawString(titleInventory, 8, ySize - 94, COLOR_TEXT)
|
font.drawString(playerInventory.displayName.formattedText, 8F, ySize - 94F, COLOR_TEXT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,13 +5,13 @@ import chylex.hee.game.container.base.ContainerBaseCustomInventory
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.util.color.IntColor.Companion.RGB
|
import chylex.hee.system.util.color.IntColor.Companion.RGB
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer
|
import net.minecraft.client.gui.screen.inventory.ContainerScreen
|
||||||
import net.minecraft.client.resources.I18n
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
import net.minecraft.inventory.IInventory
|
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
|
import net.minecraft.util.text.ITextComponent
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
abstract class GuiBaseCustomInventory<T : IInventory>(container: ContainerBaseCustomInventory<T>) : GuiContainer(container){
|
abstract class GuiBaseCustomInventory<T : ContainerBaseCustomInventory<*>>(container: T, inventory: PlayerInventory, title: ITextComponent) : ContainerScreen<T>(container, inventory, title){
|
||||||
private companion object{
|
private companion object{
|
||||||
private val COLOR_TEXT = RGB(64u).i
|
private val COLOR_TEXT = RGB(64u).i
|
||||||
}
|
}
|
||||||
@@ -19,11 +19,9 @@ abstract class GuiBaseCustomInventory<T : IInventory>(container: ContainerBaseCu
|
|||||||
protected abstract val texBackground: ResourceLocation
|
protected abstract val texBackground: ResourceLocation
|
||||||
protected abstract val titleContainer: String
|
protected abstract val titleContainer: String
|
||||||
|
|
||||||
private val titleInventory = MC.player?.inventory?.displayName?.unformattedText ?: "" // 'mc' not initialized yet
|
override fun render(mouseX: Int, mouseY: Int, partialTicks: Float){
|
||||||
|
renderBackground()
|
||||||
override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float){
|
super.render(mouseX, mouseY, partialTicks)
|
||||||
drawDefaultBackground()
|
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks)
|
|
||||||
renderHoveredToolTip(mouseX, mouseY)
|
renderHoveredToolTip(mouseX, mouseY)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,12 +30,12 @@ abstract class GuiBaseCustomInventory<T : IInventory>(container: ContainerBaseCu
|
|||||||
val y = (height - ySize) / 2
|
val y = (height - ySize) / 2
|
||||||
|
|
||||||
GL.color(1F, 1F, 1F, 1F)
|
GL.color(1F, 1F, 1F, 1F)
|
||||||
mc.textureManager.bindTexture(texBackground)
|
MC.textureManager.bindTexture(texBackground)
|
||||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize)
|
blit(x, y, 0, 0, xSize, ySize)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int){
|
override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int){
|
||||||
fontRenderer.drawString(I18n.format(titleContainer), 8, 6, COLOR_TEXT)
|
font.drawString(title.formattedText, 8F, 6F, COLOR_TEXT)
|
||||||
fontRenderer.drawString(titleInventory, 8, ySize - 94, COLOR_TEXT)
|
font.drawString(playerInventory.displayName.formattedText, 8F, ySize - 94F, COLOR_TEXT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,12 +3,12 @@ import chylex.hee.client.util.MC
|
|||||||
import chylex.hee.system.migration.Hand.MAIN_HAND
|
import chylex.hee.system.migration.Hand.MAIN_HAND
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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.Vec3
|
||||||
import chylex.hee.system.util.lookPosVec
|
import chylex.hee.system.util.lookPosVec
|
||||||
import chylex.hee.system.util.subtractY
|
import chylex.hee.system.util.subtractY
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.util.Hand
|
||||||
import net.minecraft.util.EnumHand
|
import net.minecraft.util.HandSide.RIGHT
|
||||||
import net.minecraft.util.EnumHandSide.RIGHT
|
|
||||||
import net.minecraft.util.math.MathHelper
|
import net.minecraft.util.math.MathHelper
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.Vec3d
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
@@ -16,13 +16,13 @@ import kotlin.math.pow
|
|||||||
|
|
||||||
object ModelHelper{
|
object ModelHelper{
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
fun getHandPosition(player: EntityPlayer, hand: EnumHand): Vec3d{
|
fun getHandPosition(player: EntityPlayer, hand: Hand): Vec3d{
|
||||||
val yawOffsetMp = (if (player.primaryHand == RIGHT) 1 else -1) * (if (hand == MAIN_HAND) 1 else -1)
|
val yawOffsetMp = (if (player.primaryHand == RIGHT) 1 else -1) * (if (hand == MAIN_HAND) 1 else -1)
|
||||||
|
|
||||||
if (player === MC.player && MC.settings.thirdPersonView == 0){
|
if (player === MC.player && MC.settings.thirdPersonView == 0){
|
||||||
val pitch = MathHelper.wrapDegrees(player.rotationPitch)
|
val pitch = MathHelper.wrapDegrees(player.rotationPitch)
|
||||||
val yaw = MathHelper.wrapDegrees(player.rotationYaw)
|
val yaw = MathHelper.wrapDegrees(player.rotationYaw)
|
||||||
val fov = MC.settings.fovSetting
|
val fov = MC.settings.fov.toFloat()
|
||||||
|
|
||||||
return player
|
return player
|
||||||
.lookPosVec
|
.lookPosVec
|
||||||
|
@@ -3,31 +3,31 @@ import chylex.hee.client.render.util.beginBox
|
|||||||
import chylex.hee.client.render.util.render
|
import chylex.hee.client.render.util.render
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.model.ModelBase
|
import net.minecraft.client.renderer.entity.model.RendererModel
|
||||||
import net.minecraft.client.model.ModelRenderer
|
import net.minecraft.client.renderer.model.Model
|
||||||
import kotlin.math.PI
|
import kotlin.math.PI
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlin.math.sin
|
import kotlin.math.sin
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object ModelBlockIgneousPlate : ModelBase(){
|
object ModelBlockIgneousPlate : Model(){
|
||||||
const val ANIMATION_PERIOD = PI
|
const val ANIMATION_PERIOD = PI
|
||||||
|
|
||||||
private val outerBox: ModelRenderer
|
private val outerBox: RendererModel
|
||||||
private val innerBox: ModelRenderer
|
private val innerBox: RendererModel
|
||||||
|
|
||||||
init{
|
init{
|
||||||
textureWidth = 32
|
textureWidth = 32
|
||||||
textureHeight = 16
|
textureHeight = 16
|
||||||
|
|
||||||
outerBox = ModelRenderer(this).apply {
|
outerBox = RendererModel(this).apply {
|
||||||
beginBox.offset(12F, 4F, 0F).size( 2, 8, 2).tex(0, 6).add()
|
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, 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, 2F, 0F).size(12, 2, 2).tex(0, 0).add()
|
||||||
beginBox.offset( 2F, 12F, 0F).size(12, 2, 2).tex(0, 4).add()
|
beginBox.offset( 2F, 12F, 0F).size(12, 2, 2).tex(0, 4).add()
|
||||||
}
|
}
|
||||||
|
|
||||||
innerBox = ModelRenderer(this).apply {
|
innerBox = RendererModel(this).apply {
|
||||||
beginBox.offset(4F, 4F, 0.5F).size(8, 8, 1).tex(14, 7).add()
|
beginBox.offset(4F, 4F, 0.5F).size(8, 8, 1).tex(14, 7).add()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,54 +4,52 @@ import chylex.hee.game.entity.living.EntityBossEnderEye
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.util.toRadians
|
import chylex.hee.system.util.toRadians
|
||||||
import net.minecraft.client.model.ModelBase
|
import net.minecraft.client.renderer.entity.model.EntityModel
|
||||||
import net.minecraft.client.model.ModelRenderer
|
import net.minecraft.client.renderer.entity.model.RendererModel
|
||||||
import net.minecraft.entity.Entity
|
|
||||||
import net.minecraft.entity.EntityLivingBase
|
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object ModelEntityBossEnderEye : ModelBase(){
|
object ModelEntityBossEnderEye : EntityModel<EntityBossEnderEye>(){
|
||||||
const val SCALE = 16F / 18F
|
const val SCALE = 16F / 18F
|
||||||
|
|
||||||
private val head: ModelRenderer
|
private val head: RendererModel
|
||||||
private val eyes: Array<ModelRenderer>
|
private val eyes: Array<RendererModel>
|
||||||
private val arms: ModelRenderer
|
private val arms: RendererModel
|
||||||
|
|
||||||
init{
|
init{
|
||||||
textureWidth = 128
|
textureWidth = 128
|
||||||
textureHeight = 64
|
textureHeight = 64
|
||||||
|
|
||||||
head = ModelRenderer(this).apply {
|
head = RendererModel(this).apply {
|
||||||
setRotationPoint(0F, 15F, 0F)
|
setRotationPoint(0F, 15F, 0F)
|
||||||
beginBox.offset(-9F, -9F, -9F).size(18, 18, 18).tex(0, 0).add()
|
beginBox.offset(-9F, -9F, -9F).size(18, 18, 18).tex(0, 0).add()
|
||||||
}
|
}
|
||||||
|
|
||||||
eyes = Array(8){
|
eyes = Array(8){
|
||||||
ModelRenderer(this).apply {
|
RendererModel(this).apply {
|
||||||
setRotationPoint(0F, 15F, 0F)
|
setRotationPoint(0F, 15F, 0F)
|
||||||
beginBox.offset(-8F, -8F, -9F).size(16, 16, 1).tex(-1 + (16 * it), 47).add()
|
beginBox.offset(-8F, -8F, -9F).size(16, 16, 1).tex(-1 + (16 * it), 47).add()
|
||||||
cubeList[0].let { it.quadList = arrayOf(it.quadList[4]) } // front face only
|
cubeList[0].let { it.quads = arrayOf(it.quads[4]) } // front face only
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arms = ModelRenderer(this).apply {
|
arms = RendererModel(this).apply {
|
||||||
setRotationPoint(0F, 15.5F, -0.5F)
|
setRotationPoint(0F, 15.5F, -0.5F)
|
||||||
beginBox.offset(-12F, -1.5F, -1.5F).size(3, 27, 3).tex(73, 0).add()
|
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()
|
beginBox.offset( 9F, -1.5F, -1.5F).size(3, 27, 3).tex(73, 0).mirror().add()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setLivingAnimations(entity: EntityLivingBase, limbSwing: Float, limbSwingAmount: Float, partialTicks: Float){
|
override fun setLivingAnimations(entity: EntityBossEnderEye, limbSwing: Float, limbSwingAmount: Float, partialTicks: Float){
|
||||||
super.setLivingAnimations(entity, limbSwing, limbSwingAmount, partialTicks)
|
super.setLivingAnimations(entity, limbSwing, limbSwingAmount, partialTicks)
|
||||||
arms.rotateAngleX = (entity as? EntityBossEnderEye)?.clientArmAngle?.get(partialTicks)?.toRadians() ?: 0F
|
arms.rotateAngleX = (entity as? EntityBossEnderEye)?.clientArmAngle?.get(partialTicks)?.toRadians() ?: 0F
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setRotationAngles(limbSwing: Float, limbSwingAmount: Float, ageInTicks: Float, netHeadYaw: Float, headPitch: Float, scale: Float, entity: Entity){
|
override fun setRotationAngles(entity: EntityBossEnderEye, limbSwing: Float, limbSwingAmount: Float, ageInTicks: Float, netHeadYaw: Float, headPitch: Float, scale: Float){
|
||||||
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entity)
|
super.setRotationAngles(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale)
|
||||||
head.rotateAngleX = headPitch.toRadians()
|
head.rotateAngleX = headPitch.toRadians()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(entity: Entity, limbSwing: Float, limbSwingAmount: Float, ageInTicks: Float, netHeadYaw: Float, headPitch: Float, scale: Float){
|
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)
|
super.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale)
|
||||||
|
|
||||||
val boss = entity as? EntityBossEnderEye
|
val boss = entity as? EntityBossEnderEye
|
||||||
|
@@ -1,20 +1,21 @@
|
|||||||
package chylex.hee.client.model.entity
|
package chylex.hee.client.model.entity
|
||||||
import chylex.hee.client.render.util.beginBox
|
import chylex.hee.client.render.util.beginBox
|
||||||
import chylex.hee.client.render.util.render
|
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.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.model.ModelBase
|
import net.minecraft.client.renderer.entity.model.EntityModel
|
||||||
import net.minecraft.client.model.ModelRenderer
|
import net.minecraft.client.renderer.entity.model.RendererModel
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object ModelEntityTokenHolder : ModelBase(){
|
object ModelEntityTokenHolder : EntityModel<EntityTokenHolder>(){
|
||||||
private val box: ModelRenderer
|
private val box: RendererModel
|
||||||
|
|
||||||
init{
|
init{
|
||||||
textureWidth = 64
|
textureWidth = 64
|
||||||
textureHeight = 32
|
textureHeight = 32
|
||||||
|
|
||||||
box = ModelRenderer(this).apply {
|
box = RendererModel(this).apply {
|
||||||
beginBox.offset(-8F, -8F, -8F).size(16, 16, 16).add()
|
beginBox.offset(-8F, -8F, -8F).size(16, 16, 16).add()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,15 @@
|
|||||||
|
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,40 +1,45 @@
|
|||||||
package chylex.hee.client.model.item
|
package chylex.hee.client.model.item
|
||||||
|
import chylex.hee.HEE
|
||||||
import chylex.hee.client.util.MC
|
import chylex.hee.client.util.MC
|
||||||
import chylex.hee.init.ModItems
|
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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.migration.forge.SubscribeEvent
|
||||||
import chylex.hee.system.util.facades.Resource
|
import chylex.hee.system.util.facades.Resource
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel
|
import net.minecraft.client.renderer.model.IBakedModel
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND
|
||||||
import net.minecraft.client.renderer.block.model.ModelBakery
|
import net.minecraft.client.renderer.model.ModelResourceLocation
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraftforge.client.event.ModelBakeEvent
|
import net.minecraftforge.client.event.ModelBakeEvent
|
||||||
|
import net.minecraftforge.client.event.ModelRegistryEvent
|
||||||
import net.minecraftforge.client.model.BakedModelWrapper
|
import net.minecraftforge.client.model.BakedModelWrapper
|
||||||
import net.minecraftforge.common.MinecraftForge
|
import net.minecraftforge.client.model.ModelLoader
|
||||||
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
|
||||||
import org.apache.commons.lang3.tuple.Pair
|
import org.apache.commons.lang3.tuple.Pair
|
||||||
import javax.vecmath.Matrix4f
|
import javax.vecmath.Matrix4f
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class ModelItemAmuletOfRecovery private constructor(sourceModel: IBakedModel) : BakedModelWrapper<IBakedModel>(sourceModel){
|
class ModelItemAmuletOfRecovery private constructor(sourceModel: IBakedModel) : BakedModelWrapper<IBakedModel>(sourceModel){
|
||||||
|
@SubscribeAllEvents(modid = HEE.ID, bus = MOD)
|
||||||
companion object{
|
companion object{
|
||||||
private val RESOURCE_NORMAL = ModelResourceLocation(Resource.Custom("amulet_of_recovery"), "inventory")
|
private val RESOURCE_NORMAL = ModelResourceLocation(Resource.Custom("amulet_of_recovery"), "inventory")
|
||||||
private val RESOURCE_HELD = ModelResourceLocation(Resource.Custom("amulet_of_recovery_held"), "held")
|
private val RESOURCE_HELD = Resource.Custom("item/amulet_of_recovery_held")
|
||||||
|
|
||||||
fun register(){
|
private lateinit var modelRegistry: MutableMap<ResourceLocation, IBakedModel>
|
||||||
ModelBakery.registerItemVariants(ModItems.AMULET_OF_RECOVERY, RESOURCE_NORMAL, RESOURCE_HELD)
|
|
||||||
MinecraftForge.EVENT_BUS.register(this)
|
@SubscribeEvent
|
||||||
|
fun onRegisterModels(@Suppress("UNUSED_PARAMETER") e: ModelRegistryEvent){
|
||||||
|
ModelLoader.addSpecialModel(RESOURCE_HELD)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onModelBake(e: ModelBakeEvent){
|
fun onModelBake(e: ModelBakeEvent){
|
||||||
with(e.modelRegistry){
|
modelRegistry = e.modelRegistry
|
||||||
putObject(RESOURCE_NORMAL, ModelItemAmuletOfRecovery(getObject(RESOURCE_NORMAL)!!))
|
modelRegistry[RESOURCE_NORMAL] = ModelItemAmuletOfRecovery(modelRegistry.getValue(RESOURCE_NORMAL))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +48,7 @@ class ModelItemAmuletOfRecovery private constructor(sourceModel: IBakedModel) :
|
|||||||
FIRST_PERSON_RIGHT_HAND,
|
FIRST_PERSON_RIGHT_HAND,
|
||||||
THIRD_PERSON_LEFT_HAND,
|
THIRD_PERSON_LEFT_HAND,
|
||||||
THIRD_PERSON_RIGHT_HAND ->
|
THIRD_PERSON_RIGHT_HAND ->
|
||||||
MC.itemRenderer.itemModelMesher.modelManager.getModel(RESOURCE_HELD).handlePerspective(transformType)
|
modelRegistry.getOrElse(RESOURCE_HELD){ MC.instance.modelManager.missingModel }.handlePerspective(transformType)
|
||||||
|
|
||||||
else ->
|
else ->
|
||||||
super.handlePerspective(transformType)
|
super.handlePerspective(transformType)
|
||||||
|
@@ -24,10 +24,8 @@ import chylex.hee.system.util.color.IntColor.Companion.RGBA
|
|||||||
import chylex.hee.system.util.facades.Resource
|
import chylex.hee.system.util.facades.Resource
|
||||||
import chylex.hee.system.util.getBlock
|
import chylex.hee.system.util.getBlock
|
||||||
import chylex.hee.system.util.getTile
|
import chylex.hee.system.util.getTile
|
||||||
import net.minecraft.client.gui.Gui
|
import net.minecraft.client.gui.AbstractGui
|
||||||
import net.minecraft.client.renderer.ActiveRenderInfo
|
|
||||||
import net.minecraft.client.resources.I18n
|
import net.minecraft.client.resources.I18n
|
||||||
import net.minecraft.util.math.RayTraceResult.Type.BLOCK
|
|
||||||
import net.minecraft.util.text.TextFormatting
|
import net.minecraft.util.text.TextFormatting
|
||||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent
|
import net.minecraftforge.client.event.DrawBlockHighlightEvent
|
||||||
import net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity
|
import net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity
|
||||||
@@ -46,11 +44,9 @@ object OverlayRenderer{
|
|||||||
|
|
||||||
// Ender Goo
|
// Ender Goo
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onFogDensity(e: FogDensity){
|
fun onFogDensity(e: FogDensity){
|
||||||
val entity = e.entity
|
val inside = e.info.blockAtCamera.material
|
||||||
val inside = ActiveRenderInfo.getBlockStateAtEntityViewpoint(entity.world, entity, e.renderPartialTicks.toFloat()).material
|
|
||||||
|
|
||||||
if (inside === Materials.ENDER_GOO || inside === Materials.PURIFIED_ENDER_GOO){
|
if (inside === Materials.ENDER_GOO || inside === Materials.PURIFIED_ENDER_GOO){
|
||||||
GL.setFogMode(FOG_EXP)
|
GL.setFogMode(FOG_EXP)
|
||||||
@@ -59,7 +55,6 @@ object OverlayRenderer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onRenderHelmetOverlayPre(e: RenderGameOverlayEvent.Pre){
|
fun onRenderHelmetOverlayPre(e: RenderGameOverlayEvent.Pre){
|
||||||
if (e.type != HELMET){
|
if (e.type != HELMET){
|
||||||
@@ -67,10 +62,10 @@ object OverlayRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
val player = MC.player ?: return
|
val player = MC.player ?: return
|
||||||
val inside = ActiveRenderInfo.getBlockStateAtEntityViewpoint(player.world, player, e.partialTicks).material
|
val inside = MC.gameRenderer.activeRenderInfo.blockAtCamera.material
|
||||||
|
|
||||||
if ((inside === Materials.ENDER_GOO || inside === Materials.PURIFIED_ENDER_GOO) && MC.settings.thirdPersonView == 0 && !player.isSpectator){
|
if ((inside === Materials.ENDER_GOO || inside === Materials.PURIFIED_ENDER_GOO) && MC.settings.thirdPersonView == 0 && !player.isSpectator){
|
||||||
val scaledResolution = MC.resolution
|
val window = MC.window
|
||||||
val brightness = player.brightness
|
val brightness = player.brightness
|
||||||
|
|
||||||
GL.color(brightness, brightness, brightness, 1F)
|
GL.color(brightness, brightness, brightness, 1F)
|
||||||
@@ -83,7 +78,7 @@ object OverlayRenderer{
|
|||||||
MC.textureManager.bindTexture(TEX_PURIFIED_ENDER_GOO_OVERLAY)
|
MC.textureManager.bindTexture(TEX_PURIFIED_ENDER_GOO_OVERLAY)
|
||||||
}
|
}
|
||||||
|
|
||||||
MC.instance.ingameGUI.drawTexturedModalRect(0, 0, 0, 0, scaledResolution.scaledWidth, scaledResolution.scaledHeight)
|
MC.instance.ingameGUI.blit(0, 0, 0, 0, window.scaledWidth, window.scaledHeight)
|
||||||
|
|
||||||
GL.color(1F, 1F, 1F, 1F)
|
GL.color(1F, 1F, 1F, 1F)
|
||||||
}
|
}
|
||||||
@@ -91,15 +86,14 @@ object OverlayRenderer{
|
|||||||
|
|
||||||
// Energy Cluster
|
// Energy Cluster
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onRenderText(@Suppress("UNUSED_PARAMETER") e: RenderGameOverlayEvent.Text){
|
fun onRenderText(@Suppress("UNUSED_PARAMETER") e: RenderGameOverlayEvent.Text){
|
||||||
fun drawTextOffScreenCenter(x: Int, y: Int, line: Int, text: String, color: IntColor){
|
fun drawTextOffScreenCenter(x: Int, y: Int, line: Int, text: String, color: IntColor){
|
||||||
val scaledResolution = MC.resolution
|
val window = MC.window
|
||||||
|
|
||||||
with(MC.fontRenderer){
|
with(MC.fontRenderer){
|
||||||
val centerX = x + (scaledResolution.scaledWidth / 2)
|
val centerX = x + (window.scaledWidth / 2)
|
||||||
val centerY = y + (scaledResolution.scaledHeight / 2) + (line * (LINE_SPACING + FONT_HEIGHT))
|
val centerY = y + (window.scaledHeight / 2) + (line * (LINE_SPACING + FONT_HEIGHT))
|
||||||
|
|
||||||
val textWidth = getStringWidth(text)
|
val textWidth = getStringWidth(text)
|
||||||
val textHeight = FONT_HEIGHT
|
val textHeight = FONT_HEIGHT
|
||||||
@@ -107,7 +101,7 @@ object OverlayRenderer{
|
|||||||
val offsetX = -(textWidth / 2)
|
val offsetX = -(textWidth / 2)
|
||||||
val offsetY = -(textHeight / 2)
|
val offsetY = -(textHeight / 2)
|
||||||
|
|
||||||
Gui.drawRect(centerX + offsetX - BORDER_SIZE, centerY + offsetY - BORDER_SIZE, centerX - offsetX + BORDER_SIZE - 1, centerY - offsetY + BORDER_SIZE - 1, RGBA(0u, 0.6F).i)
|
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)
|
drawStringWithShadow(text, (centerX + offsetX).toFloat(), (centerY + offsetY).toFloat(), color.i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,12 +134,11 @@ object OverlayRenderer{
|
|||||||
|
|
||||||
// Block outlines
|
// Block outlines
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onRenderBlockOutline(e: DrawBlockHighlightEvent){
|
fun onRenderBlockOutline(e: DrawBlockHighlightEvent.HighlightBlock){
|
||||||
if (e.target.typeOfHit == BLOCK){ // why the fuck is this still called for air and entities
|
val world = MC.world ?: return
|
||||||
val world = e.player.world
|
|
||||||
val pos = e.target.blockPos
|
val pos = e.target.pos
|
||||||
val block = pos.getBlock(world)
|
val block = pos.getBlock(world)
|
||||||
|
|
||||||
if (block === ModBlocks.ENERGY_CLUSTER){
|
if (block === ModBlocks.ENERGY_CLUSTER){
|
||||||
@@ -156,5 +149,4 @@ object OverlayRenderer{
|
|||||||
e.isCanceled = true
|
e.isCanceled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@ import chylex.hee.system.migration.forge.EventPriority
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.SubscribeAllEvents
|
import chylex.hee.system.migration.forge.SubscribeAllEvents
|
||||||
import chylex.hee.system.migration.forge.SubscribeEvent
|
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
|
||||||
import chylex.hee.system.util.color.IntColor.Companion.RGB
|
import chylex.hee.system.util.color.IntColor.Companion.RGB
|
||||||
import chylex.hee.system.util.floorToInt
|
import chylex.hee.system.util.floorToInt
|
||||||
@@ -26,11 +27,10 @@ import chylex.hee.system.util.math.LerpedFloat
|
|||||||
import chylex.hee.system.util.posVec
|
import chylex.hee.system.util.posVec
|
||||||
import chylex.hee.system.util.scale
|
import chylex.hee.system.util.scale
|
||||||
import net.minecraft.client.resources.I18n
|
import net.minecraft.client.resources.I18n
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent
|
import net.minecraftforge.client.event.RenderGameOverlayEvent
|
||||||
import net.minecraftforge.common.MinecraftForge
|
import net.minecraftforge.common.MinecraftForge
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
|
import net.minecraftforge.event.TickEvent.ClientTickEvent
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase
|
import net.minecraftforge.event.TickEvent.Phase
|
||||||
import org.lwjgl.opengl.GL11.GL_GREATER
|
import org.lwjgl.opengl.GL11.GL_GREATER
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
@@ -40,13 +40,12 @@ object TerritoryRenderer{
|
|||||||
private var prevChunkX = Int.MAX_VALUE
|
private var prevChunkX = Int.MAX_VALUE
|
||||||
private var prevTerritory: TerritoryType? = null
|
private var prevTerritory: TerritoryType? = null
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onClientTick(e: ClientTickEvent){
|
fun onClientTick(e: ClientTickEvent){
|
||||||
if (e.phase == Phase.START){
|
if (e.phase == Phase.START){
|
||||||
val player = MC.player
|
val player = MC.player
|
||||||
|
|
||||||
if (player != null && player.world.provider is WorldProviderEndCustom && player.ticksExisted > 0){
|
if (player != null && player.world.dimension is WorldProviderEndCustom && player.ticksExisted > 0){
|
||||||
Void.tick(player)
|
Void.tick(player)
|
||||||
Title.tick()
|
Title.tick()
|
||||||
|
|
||||||
@@ -123,7 +122,7 @@ object TerritoryRenderer{
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text){
|
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text){
|
||||||
if (MC.settings.showDebugInfo && MC.player?.dimension == HEE.DIM){
|
if (MC.settings.showDebugInfo && MC.player?.dimension === HEE.dim){
|
||||||
with(e.left){
|
with(e.left){
|
||||||
add("")
|
add("")
|
||||||
add("End Void Factor: ${"%.3f".format(voidFactor.currentValue)}")
|
add("End Void Factor: ${"%.3f".format(voidFactor.currentValue)}")
|
||||||
@@ -176,7 +175,6 @@ object TerritoryRenderer{
|
|||||||
textTime = 0
|
textTime = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@SubscribeEvent(EventPriority.HIGHEST)
|
@SubscribeEvent(EventPriority.HIGHEST)
|
||||||
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text){
|
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text){
|
||||||
if (textTime == 0){
|
if (textTime == 0){
|
||||||
@@ -184,7 +182,7 @@ object TerritoryRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
val fontRenderer = MC.fontRenderer
|
val fontRenderer = MC.fontRenderer
|
||||||
val resolution = e.resolution
|
val resolution = e.window
|
||||||
val width = resolution.scaledWidth
|
val width = resolution.scaledWidth
|
||||||
val height = resolution.scaledHeight
|
val height = resolution.scaledHeight
|
||||||
|
|
||||||
@@ -214,24 +212,10 @@ object TerritoryRenderer{
|
|||||||
GL.popMatrix()
|
GL.popMatrix()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun drawTitle(x: Float, y: Float, color: IntColor) = with(MC.fontRenderer){
|
private fun drawTitle(x: Float, y: Float, color: IntColor){
|
||||||
resetStyles()
|
if (color.alpha > 3){ // prevents flickering alpha
|
||||||
|
MC.fontRenderer.drawString(textTitle, x, y, color.i)
|
||||||
red = color.red / 255F
|
}
|
||||||
green = color.green / 255F
|
|
||||||
blue = color.blue / 255F
|
|
||||||
alpha = color.alpha / 255F
|
|
||||||
|
|
||||||
posX = x
|
|
||||||
posY = y
|
|
||||||
|
|
||||||
val text = if (bidiFlag)
|
|
||||||
bidiReorder(textTitle)
|
|
||||||
else
|
|
||||||
textTitle
|
|
||||||
|
|
||||||
GL.color(red, green, blue, alpha)
|
|
||||||
renderStringAtPos(text, false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,8 +6,8 @@ import chylex.hee.system.migration.Facing.NORTH
|
|||||||
import chylex.hee.system.migration.Facing.WEST
|
import chylex.hee.system.migration.Facing.WEST
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.model.ModelChest
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
import net.minecraft.client.renderer.tileentity.model.ChestModel
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import org.lwjgl.opengl.GL11.GL_MODELVIEW
|
import org.lwjgl.opengl.GL11.GL_MODELVIEW
|
||||||
import org.lwjgl.opengl.GL11.GL_TEXTURE
|
import org.lwjgl.opengl.GL11.GL_TEXTURE
|
||||||
@@ -15,12 +15,12 @@ import kotlin.math.PI
|
|||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
abstract class RenderTileAbstractChest<T : TileEntityBaseChest> : TileEntitySpecialRenderer<T>(){
|
abstract class RenderTileAbstractChest<T : TileEntityBaseChest> : TileEntityRenderer<T>(){
|
||||||
protected abstract val texture: ResourceLocation
|
protected abstract val texture: ResourceLocation
|
||||||
|
|
||||||
private val modelChest = ModelChest()
|
private val modelChest = ChestModel()
|
||||||
|
|
||||||
override fun render(tile: T, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, alpha: Float){
|
override fun render(tile: T, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
|
||||||
if (destroyStage >= 0){
|
if (destroyStage >= 0){
|
||||||
bindTexture(DESTROY_STAGES[destroyStage])
|
bindTexture(DESTROY_STAGES[destroyStage])
|
||||||
GL.matrixMode(GL_TEXTURE)
|
GL.matrixMode(GL_TEXTURE)
|
||||||
@@ -35,7 +35,7 @@ abstract class RenderTileAbstractChest<T : TileEntityBaseChest> : TileEntitySpec
|
|||||||
|
|
||||||
GL.pushMatrix()
|
GL.pushMatrix()
|
||||||
GL.enableRescaleNormal()
|
GL.enableRescaleNormal()
|
||||||
GL.color(1F, 1F, 1F, alpha)
|
GL.color(1F, 1F, 1F)
|
||||||
GL.translate(x, y + 1F, z + 1F)
|
GL.translate(x, y + 1F, z + 1F)
|
||||||
GL.scale(1F, -1F, -1F)
|
GL.scale(1F, -1F, -1F)
|
||||||
GL.translate(0.5F, 0.5F, 0.5F)
|
GL.translate(0.5F, 0.5F, 0.5F)
|
||||||
@@ -50,7 +50,7 @@ abstract class RenderTileAbstractChest<T : TileEntityBaseChest> : TileEntitySpec
|
|||||||
GL.rotate(rotation, 0F, 1F, 0F)
|
GL.rotate(rotation, 0F, 1F, 0F)
|
||||||
GL.translate(-0.5F, -0.5F, -0.5F)
|
GL.translate(-0.5F, -0.5F, -0.5F)
|
||||||
|
|
||||||
modelChest.chestLid.rotateAngleX = -(1F - (1F - tile.lidAngle.get(partialTicks)).pow(3)) * PI.toFloat() * 0.5F
|
modelChest.lid.rotateAngleX = -(1F - (1F - tile.lidAngle.get(partialTicks)).pow(3)) * PI.toFloat() * 0.5F
|
||||||
modelChest.renderAll()
|
modelChest.renderAll()
|
||||||
|
|
||||||
GL.disableRescaleNormal()
|
GL.disableRescaleNormal()
|
||||||
|
@@ -18,9 +18,9 @@ import chylex.hee.system.migration.forge.Side
|
|||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.util.facades.Resource
|
import chylex.hee.system.util.facades.Resource
|
||||||
import chylex.hee.system.util.square
|
import chylex.hee.system.util.square
|
||||||
import net.minecraft.client.renderer.ActiveRenderInfo
|
|
||||||
import net.minecraft.client.renderer.GLAllocation
|
import net.minecraft.client.renderer.GLAllocation
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
@@ -37,7 +37,7 @@ import java.util.Random
|
|||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalController> : TileEntitySpecialRenderer<T>(){
|
abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalController> : TileEntityRenderer<T>(){
|
||||||
private companion object{
|
private companion object{
|
||||||
private val TEX_BACKGROUND = Resource.Vanilla("textures/environment/end_sky.png")
|
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 TEX_PARTICLE_LAYER = Resource.Vanilla("textures/entity/end_portal.png")
|
||||||
@@ -89,15 +89,15 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
|||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
|
|
||||||
override fun render(tile: T, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, alpha: Float){
|
override fun render(tile: T, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
|
||||||
val controller = findController(tile.world, tile.pos)
|
val controller = findController(tile.world ?: return, tile.pos)
|
||||||
|
|
||||||
rand.setSeed(controller?.let { generateSeed(it) } ?: 0L)
|
rand.setSeed(controller?.let { generateSeed(it) } ?: 0L)
|
||||||
|
|
||||||
animationProgress = controller?.clientAnimationProgress?.get(partialTicks) ?: 0F
|
animationProgress = controller?.clientAnimationProgress?.get(partialTicks) ?: 0F
|
||||||
isAnimating = animationProgress > 0F && animationProgress < 1F
|
isAnimating = animationProgress > 0F && animationProgress < 1F
|
||||||
|
|
||||||
cameraTarget = ActiveRenderInfo.getCameraPosition()
|
cameraTarget = Vec3d.ZERO // UPDATE fix bobbing
|
||||||
globalTranslation = ((MC.systemTime % BlockAbstractPortal.TRANSLATION_SPEED_LONG) / BlockAbstractPortal.TRANSLATION_SPEED) - (controller?.clientPortalOffset?.get(partialTicks) ?: 0F)
|
globalTranslation = ((MC.systemTime % BlockAbstractPortal.TRANSLATION_SPEED_LONG) / BlockAbstractPortal.TRANSLATION_SPEED) - (controller?.clientPortalOffset?.get(partialTicks) ?: 0F)
|
||||||
|
|
||||||
val offsetY = -y - 0.75
|
val offsetY = -y - 0.75
|
||||||
@@ -113,7 +113,7 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
|||||||
GL.enableTexGenCoord(TEX_R)
|
GL.enableTexGenCoord(TEX_R)
|
||||||
GL.enableTexGenCoord(TEX_Q)
|
GL.enableTexGenCoord(TEX_Q)
|
||||||
|
|
||||||
MC.entityRenderer.setupFogColor(true)
|
MC.gameRenderer.setupFogColor(true)
|
||||||
|
|
||||||
// background
|
// background
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
|||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
|
|
||||||
MC.entityRenderer.setupFogColor(false)
|
MC.gameRenderer.setupFogColor(false)
|
||||||
|
|
||||||
GL.disableTexGenCoord(TEX_S)
|
GL.disableTexGenCoord(TEX_S)
|
||||||
GL.disableTexGenCoord(TEX_T)
|
GL.disableTexGenCoord(TEX_T)
|
||||||
@@ -178,9 +178,9 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun renderLayer(renderX: Double, renderY: Double, renderZ: Double, texture: ResourceLocation, layerPosition: Double, layerRotation: Float, layerScale: Float, cameraOffsetMp: Double){
|
private fun renderLayer(renderX: Double, renderY: Double, renderZ: Double, texture: ResourceLocation, layerPosition: Double, layerRotation: Float, layerScale: Float, cameraOffsetMp: Double){
|
||||||
val globalX = rendererDispatcher.entityX
|
val globalX = TileEntityRendererDispatcher.staticPlayerX
|
||||||
val globalY = rendererDispatcher.entityY
|
val globalY = TileEntityRendererDispatcher.staticPlayerY
|
||||||
val globalZ = rendererDispatcher.entityZ
|
val globalZ = TileEntityRendererDispatcher.staticPlayerZ
|
||||||
|
|
||||||
// texture
|
// texture
|
||||||
|
|
||||||
|
@@ -3,14 +3,13 @@ import chylex.hee.game.block.entity.TileEntityDarkChest
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.util.facades.Resource
|
import chylex.hee.system.util.facades.Resource
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityChestRenderer
|
import net.minecraft.client.renderer.tileentity.ChestTileEntityRenderer
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer
|
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.tileentity.TileEntityChest
|
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object RenderTileDarkChest : TileEntityChestRenderer(){
|
object RenderTileDarkChest : ChestTileEntityRenderer<TileEntityDarkChest>(){
|
||||||
private val TEX_SINGLE = Resource.Custom("textures/entity/dark_chest_single.png")
|
private val TEX_SINGLE = Resource.Custom("textures/entity/dark_chest_single.png")
|
||||||
private val TEX_DOUBLE = Resource.Custom("textures/entity/dark_chest_double.png")
|
private val TEX_DOUBLE = Resource.Custom("textures/entity/dark_chest_double.png")
|
||||||
|
|
||||||
@@ -18,24 +17,24 @@ object RenderTileDarkChest : TileEntityChestRenderer(){
|
|||||||
isChristmas = false
|
isChristmas = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(tile: TileEntityChest, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, alpha: Float){
|
override fun render(tile: TileEntityDarkChest, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
|
||||||
val prevTexSingle = TEXTURE_NORMAL
|
val prevTexSingle = TEXTURE_NORMAL
|
||||||
val prevTexDouble = TEXTURE_NORMAL_DOUBLE
|
val prevTexDouble = TEXTURE_NORMAL_DOUBLE
|
||||||
|
|
||||||
TEXTURE_NORMAL = TEX_SINGLE
|
TEXTURE_NORMAL = TEX_SINGLE
|
||||||
TEXTURE_NORMAL_DOUBLE = TEX_DOUBLE
|
TEXTURE_NORMAL_DOUBLE = TEX_DOUBLE
|
||||||
|
|
||||||
super.render(tile, x, y, z, partialTicks, destroyStage, alpha)
|
super.render(tile, x, y, z, partialTicks, destroyStage)
|
||||||
|
|
||||||
TEXTURE_NORMAL = prevTexSingle
|
TEXTURE_NORMAL = prevTexSingle
|
||||||
TEXTURE_NORMAL_DOUBLE = prevTexDouble
|
TEXTURE_NORMAL_DOUBLE = prevTexDouble
|
||||||
}
|
}
|
||||||
|
|
||||||
object AsItem : TileEntityItemStackRenderer(){
|
object AsItem : ItemStackTileEntityRenderer(){
|
||||||
private val tile = TileEntityDarkChest()
|
private val tile = TileEntityDarkChest()
|
||||||
|
|
||||||
override fun renderByItem(stack: ItemStack, partialTicks: Float){
|
override fun renderByItem(stack: ItemStack){
|
||||||
TileEntityRendererDispatcher.instance.render(tile, 0.0, 0.0, 0.0, partialTicks)
|
TileEntityRendererDispatcher.instance.renderAsItem(tile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ object RenderTileEndPortal : RenderTileAbstractPortal<TileEntityPortalInner.End,
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun findController(world: World, pos: BlockPos): IPortalController?{
|
override fun findController(world: World, pos: BlockPos): IPortalController?{
|
||||||
if (world.provider.dimension == HEE.DIM){
|
if (world.dimension.type === HEE.dim){
|
||||||
return AlwaysOnController
|
return AlwaysOnController
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,60 +0,0 @@
|
|||||||
package chylex.hee.client.render.block
|
|
||||||
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.util.facades.Resource
|
|
||||||
import net.minecraft.client.model.ModelRenderer
|
|
||||||
import net.minecraft.client.model.ModelSkeletonHead
|
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer
|
|
||||||
import net.minecraft.entity.Entity
|
|
||||||
import net.minecraft.item.ItemStack
|
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
|
||||||
object RenderTileEndermanHead{
|
|
||||||
private val TEX_ENDERMAN = Resource.Custom("textures/entity/enderman_head.png")
|
|
||||||
private val MODEL_HEAD = ModelSkeletonHead(0, 0, 64, 32)
|
|
||||||
|
|
||||||
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
|
||||||
private fun renderHead(){
|
|
||||||
MC.textureManager.bindTexture(TEX_ENDERMAN)
|
|
||||||
MODEL_HEAD.render(null, 0F, 0F, 0F, 180F, 0F, 0.0625F)
|
|
||||||
}
|
|
||||||
|
|
||||||
object AsItem : TileEntityItemStackRenderer(){
|
|
||||||
override fun renderByItem(stack: ItemStack, partialTicks: Float){
|
|
||||||
GL.pushMatrix()
|
|
||||||
GL.disableCull()
|
|
||||||
|
|
||||||
GL.translate(0.5F, 0F, 0.5F)
|
|
||||||
GL.enableRescaleNormal()
|
|
||||||
GL.scale(-1F, -1F, 1F)
|
|
||||||
GL.enableAlpha()
|
|
||||||
|
|
||||||
renderHead()
|
|
||||||
|
|
||||||
GL.enableCull()
|
|
||||||
GL.popMatrix()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
object AsHeadLayer{
|
|
||||||
operator fun invoke(entity: Entity, headModel: ModelRenderer){
|
|
||||||
GL.pushMatrix()
|
|
||||||
GL.disableCull()
|
|
||||||
|
|
||||||
if (entity.isSneaking){
|
|
||||||
GL.translate(0F, 0.2F, 0F)
|
|
||||||
}
|
|
||||||
|
|
||||||
headModel.postRender(0.0625F)
|
|
||||||
GL.color(1F, 1F, 1F, 1F)
|
|
||||||
GL.scale(1.1875F, 1.1875F, -1.1875F)
|
|
||||||
|
|
||||||
renderHead()
|
|
||||||
|
|
||||||
GL.enableCull()
|
|
||||||
GL.popMatrix()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -12,11 +12,12 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
|||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent
|
import net.minecraftforge.client.event.TextureStitchEvent
|
||||||
import net.minecraftforge.client.model.animation.FastTESR
|
import net.minecraftforge.client.model.animation.TileEntityRendererFast
|
||||||
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID)
|
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID, bus = MOD)
|
||||||
object RenderTileExperienceGate : FastTESR<TileEntityExperienceGate>(){
|
object RenderTileExperienceGate : TileEntityRendererFast<TileEntityExperienceGate>(){
|
||||||
private const val SPRITE_COUNT = 40
|
private const val SPRITE_COUNT = 40
|
||||||
|
|
||||||
private val TEX = Array(SPRITE_COUNT){ Resource.Custom("block/experience_gate_top_bar_$it") }
|
private val TEX = Array(SPRITE_COUNT){ Resource.Custom("block/experience_gate_top_bar_$it") }
|
||||||
@@ -40,17 +41,23 @@ object RenderTileExperienceGate : FastTESR<TileEntityExperienceGate>(){
|
|||||||
private val FRAME_COUNT = 1 + FRAMES.sumBy { it.size }
|
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()
|
private val FRAME_OFFSETS = FRAMES.indices.map { index -> 1 + FRAMES.take(index).sumBy { it.size } }.toIntArray()
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onTextureStitchPre(e: TextureStitchEvent.Pre){
|
fun onTextureStitchPre(e: TextureStitchEvent.Pre){
|
||||||
with(e.map){
|
if (e.map.basePath != "textures"){
|
||||||
TEX.forEach { registerSprite(it) }
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
with(e){
|
||||||
|
TEX.forEach { addSprite(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onTextureStitchPost(e: TextureStitchEvent.Post){
|
fun onTextureStitchPost(e: TextureStitchEvent.Post){
|
||||||
|
if (e.map.basePath != "textures"){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
SPRITES.clear()
|
SPRITES.clear()
|
||||||
|
|
||||||
with(e.map){
|
with(e.map){
|
||||||
@@ -62,8 +69,8 @@ object RenderTileExperienceGate : FastTESR<TileEntityExperienceGate>(){
|
|||||||
return FRAMES[index].getOrNull((frame - FRAME_OFFSETS[index]).coerceAtMost(FRAMES[index].lastIndex))?.let(SPRITES::getOrNull)
|
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, partial: Float, buffer: BufferBuilder){
|
override fun renderTileEntityFast(tile: TileEntityExperienceGate, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, buffer: BufferBuilder){
|
||||||
val world = tile.world
|
val world = tile.world ?: return
|
||||||
val pos = tile.pos
|
val pos = tile.pos
|
||||||
|
|
||||||
val progress = tile.chargeProgress
|
val progress = tile.chargeProgress
|
||||||
|
@@ -16,16 +16,15 @@ import chylex.hee.system.util.component2
|
|||||||
import chylex.hee.system.util.component3
|
import chylex.hee.system.util.component3
|
||||||
import chylex.hee.system.util.facades.Resource
|
import chylex.hee.system.util.facades.Resource
|
||||||
import chylex.hee.system.util.floorToInt
|
import chylex.hee.system.util.floorToInt
|
||||||
import chylex.hee.system.util.get
|
|
||||||
import chylex.hee.system.util.getState
|
import chylex.hee.system.util.getState
|
||||||
import chylex.hee.system.util.offsetTowards
|
import chylex.hee.system.util.offsetTowards
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.Vec3d
|
||||||
import org.lwjgl.opengl.GL11.GL_MODELVIEW
|
import org.lwjgl.opengl.GL11.GL_MODELVIEW
|
||||||
import org.lwjgl.opengl.GL11.GL_TEXTURE
|
import org.lwjgl.opengl.GL11.GL_TEXTURE
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object RenderTileIgneousPlate : TileEntitySpecialRenderer<TileEntityIgneousPlate>(){
|
object RenderTileIgneousPlate : TileEntityRenderer<TileEntityIgneousPlate>(){
|
||||||
private val TEX_PLATE = Resource.Custom("textures/entity/igneous_plate.png")
|
private val TEX_PLATE = Resource.Custom("textures/entity/igneous_plate.png")
|
||||||
|
|
||||||
private val COLOR_TRANSITIONS = arrayOf(
|
private val COLOR_TRANSITIONS = arrayOf(
|
||||||
@@ -41,7 +40,7 @@ object RenderTileIgneousPlate : TileEntitySpecialRenderer<TileEntityIgneousPlate
|
|||||||
return COLOR_TRANSITIONS[index].offsetTowards(COLOR_TRANSITIONS[index + 1], progress)
|
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, alpha: Float){
|
override fun render(tile: TileEntityIgneousPlate, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
|
||||||
if (destroyStage >= 0){
|
if (destroyStage >= 0){
|
||||||
bindTexture(DESTROY_STAGES[destroyStage])
|
bindTexture(DESTROY_STAGES[destroyStage])
|
||||||
GL.matrixMode(GL_TEXTURE)
|
GL.matrixMode(GL_TEXTURE)
|
||||||
@@ -53,9 +52,9 @@ object RenderTileIgneousPlate : TileEntitySpecialRenderer<TileEntityIgneousPlate
|
|||||||
bindTexture(TEX_PLATE)
|
bindTexture(TEX_PLATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
val state = tile.pos.getState(tile.world)
|
val state = tile.world?.let { tile.pos.getState(it) }
|
||||||
|
|
||||||
if (state.block !== ModBlocks.IGNEOUS_PLATE){
|
if (state?.block !== ModBlocks.IGNEOUS_PLATE){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,13 +86,13 @@ object RenderTileIgneousPlate : TileEntitySpecialRenderer<TileEntityIgneousPlate
|
|||||||
}
|
}
|
||||||
|
|
||||||
GL.enableRescaleNormal()
|
GL.enableRescaleNormal()
|
||||||
GL.color(1F, 1F, 1F, alpha)
|
GL.color(1F, 1F, 1F)
|
||||||
|
|
||||||
if (destroyStage < 0){
|
if (destroyStage < 0){
|
||||||
ModelBlockIgneousPlate.renderOuterBox()
|
ModelBlockIgneousPlate.renderOuterBox()
|
||||||
|
|
||||||
val (r, g, b) = getInnerBoxColor(tile.clientCombinedHeat)
|
val (r, g, b) = getInnerBoxColor(tile.clientCombinedHeat)
|
||||||
GL.color(r.toFloat(), g.toFloat(), b.toFloat(), alpha)
|
GL.color(r.toFloat(), g.toFloat(), b.toFloat())
|
||||||
}
|
}
|
||||||
|
|
||||||
GL.disableLighting()
|
GL.disableLighting()
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
package chylex.hee.client.render.block
|
package chylex.hee.client.render.block
|
||||||
|
import chylex.hee.HEE
|
||||||
import chylex.hee.client.render.util.GL
|
import chylex.hee.client.render.util.GL
|
||||||
import chylex.hee.client.render.util.TESSELLATOR
|
import chylex.hee.client.render.util.TESSELLATOR
|
||||||
import chylex.hee.client.render.util.draw
|
import chylex.hee.client.render.util.draw
|
||||||
@@ -8,50 +9,82 @@ import chylex.hee.game.block.entity.TileEntityJarODust
|
|||||||
import chylex.hee.game.mechanics.dust.DustLayers
|
import chylex.hee.game.mechanics.dust.DustLayers
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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.facades.Resource
|
||||||
import chylex.hee.system.util.floorToInt
|
import chylex.hee.system.util.floorToInt
|
||||||
import chylex.hee.system.util.getListOfCompounds
|
import chylex.hee.system.util.getListOfCompounds
|
||||||
import chylex.hee.system.util.heeTagOrNull
|
import chylex.hee.system.util.heeTagOrNull
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.client.renderer.BufferBuilder
|
||||||
import net.minecraft.client.renderer.RenderHelper
|
import net.minecraft.client.renderer.RenderHelper
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer
|
import net.minecraft.client.renderer.model.IBakedModel
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||||
|
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
import net.minecraft.item.ItemStack
|
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
|
import org.lwjgl.opengl.GL11.GL_QUADS
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object RenderTileJarODust : TileEntitySpecialRenderer<TileEntityJarODust>(){
|
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID, bus = MOD)
|
||||||
private val TEX_LAYER = Resource.Custom("textures/entity/dust_layer.png")
|
object RenderTileJarODust : TileEntityRendererFast<TileEntityJarODust>(){
|
||||||
|
private val TEX_LAYER = Resource.Custom("block/dust_layer")
|
||||||
private const val TEX_MP = 1.6
|
private const val TEX_MP = 1.6
|
||||||
|
|
||||||
|
private lateinit var SPRITE_LAYER: TextureAtlasSprite
|
||||||
|
|
||||||
private val AABB = BlockJarODust.AABB
|
private val AABB = BlockJarODust.AABB
|
||||||
|
|
||||||
private const val EPSILON_Y = 0.025
|
private const val EPSILON_Y = 0.025
|
||||||
private const val EPSILON_XZ = 0.005
|
private const val EPSILON_XZ = 0.005
|
||||||
|
|
||||||
override fun render(tile: TileEntityJarODust, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, alpha: Float){
|
@SubscribeEvent
|
||||||
GL.color(1F, 1F, 1F, alpha)
|
fun onTextureStitchPre(e: TextureStitchEvent.Pre){
|
||||||
RenderHelper.disableStandardItemLighting()
|
if (e.map.basePath == "textures"){
|
||||||
renderLayers(tile.layers, x, y, z)
|
e.addSprite(TEX_LAYER)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderLayers(layers: DustLayers, x: Double, y: Double, z: Double){ // TODO could work as FastTESR
|
@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 contents = layers.contents.takeUnless { it.isEmpty() } ?: return
|
||||||
val unit = AABB.let { it.maxY - it.minY - (EPSILON_Y * 2) } / layers.totalCapacity
|
val unit = AABB.let { it.maxY - it.minY - (EPSILON_Y * 2) } / layers.totalCapacity
|
||||||
|
|
||||||
MC.textureManager.bindTexture(TEX_LAYER)
|
val sky = (combinedLight shr 16) and 65535
|
||||||
|
val block = combinedLight and 65535
|
||||||
|
|
||||||
GL.pushMatrix()
|
val minX = x + AABB.minX + EPSILON_XZ
|
||||||
GL.translate(x, y + AABB.minY + EPSILON_Y, z)
|
val maxX = x + AABB.maxX - EPSILON_XZ
|
||||||
|
|
||||||
val minX = AABB.minX + EPSILON_XZ
|
val minZ = z + AABB.minZ + EPSILON_XZ
|
||||||
val maxX = AABB.maxX - EPSILON_XZ
|
val maxZ = z + AABB.maxZ - EPSILON_XZ
|
||||||
|
|
||||||
val minZ = AABB.minZ + EPSILON_XZ
|
val minU = SPRITE_LAYER.minU.toDouble()
|
||||||
val maxZ = AABB.maxZ - EPSILON_XZ
|
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 minY = 0.0
|
var relY = 0.0
|
||||||
|
|
||||||
for((index, info) in contents.withIndex()){
|
for((index, info) in contents.withIndex()){
|
||||||
val (dustType, dustAmount) = info
|
val (dustType, dustAmount) = info
|
||||||
@@ -59,34 +92,49 @@ object RenderTileJarODust : TileEntitySpecialRenderer<TileEntityJarODust>(){
|
|||||||
val color = dustType.color
|
val color = dustType.color
|
||||||
val height = dustAmount * unit
|
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 maxY = minY + height
|
||||||
val texMin = 0.01 + (minY * TEX_MP)
|
|
||||||
val texMax = 0.01 + (maxY * TEX_MP)
|
|
||||||
|
|
||||||
val sideR = (color[0] / 1.125F).floorToInt().coerceAtLeast(0)
|
val sideR = (color[0] / 1.125F).floorToInt().coerceAtLeast(0)
|
||||||
val sideG = (color[1] / 1.125F).floorToInt().coerceAtLeast(0)
|
val sideG = (color[1] / 1.125F).floorToInt().coerceAtLeast(0)
|
||||||
val sideB = (color[2] / 1.125F).floorToInt().coerceAtLeast(0)
|
val sideB = (color[2] / 1.125F).floorToInt().coerceAtLeast(0)
|
||||||
|
|
||||||
TESSELLATOR.draw(GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR){
|
with(buffer){
|
||||||
pos(minX, minY, minZ).tex(texMin, 0.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(minX, minY, minZ).color(sideR, sideG, sideB, 255).tex(texMin, minV).lightmap(sky, block).endVertex()
|
||||||
pos(minX, minY, maxZ).tex(texMin, 1.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(minX, minY, maxZ).color(sideR, sideG, sideB, 255).tex(texMin, maxV).lightmap(sky, block).endVertex()
|
||||||
pos(minX, maxY, maxZ).tex(texMax, 1.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(minX, maxY, maxZ).color(sideR, sideG, sideB, 255).tex(texMax, maxV).lightmap(sky, block).endVertex()
|
||||||
pos(minX, maxY, minZ).tex(texMax, 0.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(minX, maxY, minZ).color(sideR, sideG, sideB, 255).tex(texMax, minV).lightmap(sky, block).endVertex()
|
||||||
|
|
||||||
pos(maxX, minY, maxZ).tex(texMin, 0.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(maxX, minY, maxZ).color(sideR, sideG, sideB, 255).tex(texMin, minV).lightmap(sky, block).endVertex()
|
||||||
pos(maxX, minY, minZ).tex(texMin, 1.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(maxX, minY, minZ).color(sideR, sideG, sideB, 255).tex(texMin, maxV).lightmap(sky, block).endVertex()
|
||||||
pos(maxX, maxY, minZ).tex(texMax, 1.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(maxX, maxY, minZ).color(sideR, sideG, sideB, 255).tex(texMax, maxV).lightmap(sky, block).endVertex()
|
||||||
pos(maxX, maxY, maxZ).tex(texMax, 0.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(maxX, maxY, maxZ).color(sideR, sideG, sideB, 255).tex(texMax, minV).lightmap(sky, block).endVertex()
|
||||||
|
|
||||||
pos(maxX, minY, minZ).tex(texMin, 0.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(maxX, minY, minZ).color(sideR, sideG, sideB, 255).tex(texMin, minV).lightmap(sky, block).endVertex()
|
||||||
pos(minX, minY, minZ).tex(texMin, 1.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(minX, minY, minZ).color(sideR, sideG, sideB, 255).tex(texMin, maxV).lightmap(sky, block).endVertex()
|
||||||
pos(minX, maxY, minZ).tex(texMax, 1.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(minX, maxY, minZ).color(sideR, sideG, sideB, 255).tex(texMax, maxV).lightmap(sky, block).endVertex()
|
||||||
pos(maxX, maxY, minZ).tex(texMax, 0.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(maxX, maxY, minZ).color(sideR, sideG, sideB, 255).tex(texMax, minV).lightmap(sky, block).endVertex()
|
||||||
|
|
||||||
pos(minX, minY, maxZ).tex(texMin, 0.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(minX, minY, maxZ).color(sideR, sideG, sideB, 255).tex(texMin, minV).lightmap(sky, block).endVertex()
|
||||||
pos(maxX, minY, maxZ).tex(texMin, 1.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(maxX, minY, maxZ).color(sideR, sideG, sideB, 255).tex(texMin, maxV).lightmap(sky, block).endVertex()
|
||||||
pos(maxX, maxY, maxZ).tex(texMax, 1.0).color(sideR, sideG, sideB, 255).endVertex()
|
pos(maxX, maxY, maxZ).color(sideR, sideG, sideB, 255).tex(texMax, maxV).lightmap(sky, block).endVertex()
|
||||||
pos(minX, maxY, maxZ).tex(texMax, 0.0).color(sideR, sideG, sideB, 255).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){
|
if (index == contents.lastIndex){
|
||||||
@@ -94,35 +142,51 @@ object RenderTileJarODust : TileEntitySpecialRenderer<TileEntityJarODust>(){
|
|||||||
val topG = (color[1] * 1.125F).floorToInt().coerceAtMost(255)
|
val topG = (color[1] * 1.125F).floorToInt().coerceAtMost(255)
|
||||||
val topB = (color[2] * 1.125F).floorToInt().coerceAtMost(255)
|
val topB = (color[2] * 1.125F).floorToInt().coerceAtMost(255)
|
||||||
|
|
||||||
TESSELLATOR.draw(GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR){
|
with(buffer){
|
||||||
pos(minX, maxY, minZ).tex(0.0, 0.0).color(topR, topG, topB, 255).endVertex()
|
pos(minX, maxY, minZ).color(topR, topG, topB, 255).tex(minU, minV).lightmap(sky, block).endVertex()
|
||||||
pos(minX, maxY, maxZ).tex(0.0, 1.0).color(topR, topG, topB, 255).endVertex()
|
pos(minX, maxY, maxZ).color(topR, topG, topB, 255).tex(minU, maxV).lightmap(sky, block).endVertex()
|
||||||
pos(maxX, maxY, maxZ).tex(1.0, 1.0).color(topR, topG, topB, 255).endVertex()
|
pos(maxX, maxY, maxZ).color(topR, topG, topB, 255).tex(maxU, maxV).lightmap(sky, block).endVertex()
|
||||||
pos(maxX, maxY, minZ).tex(1.0, 0.0).color(topR, topG, topB, 255).endVertex()
|
pos(maxX, maxY, minZ).color(topR, topG, topB, 255).tex(maxU, minV).lightmap(sky, block).endVertex()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
minY = maxY
|
relY += height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL.popMatrix()
|
@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)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO not implemented at the moment
|
|
||||||
object AsItem : TileEntityItemStackRenderer(){
|
|
||||||
private val layers = DustLayers(TileEntityJarODust.DUST_CAPACITY)
|
private val layers = DustLayers(TileEntityJarODust.DUST_CAPACITY)
|
||||||
|
|
||||||
override fun renderByItem(stack: ItemStack, partialTicks: Float){
|
override fun renderByItem(stack: ItemStack){
|
||||||
val dispatcher = MC.instance.blockRendererDispatcher
|
val nbt = stack.heeTagOrNull?.getListOfCompounds(BlockJarODust.LAYERS_TAG) ?: return
|
||||||
val state = Block.getBlockFromItem(stack.item).defaultState
|
val player = MC.player ?: return
|
||||||
val model = dispatcher.blockModelShapes.getModelForState(state)
|
|
||||||
|
|
||||||
dispatcher.blockModelRenderer.renderModelBrightness(model, state, 1F, true)
|
layers.deserializeNBT(nbt)
|
||||||
|
|
||||||
stack.heeTagOrNull?.getListOfCompounds(BlockJarODust.LAYERS_TAG)?.let {
|
GL.enableCull()
|
||||||
layers.deserializeNBT(it)
|
RenderHelper.disableStandardItemLighting()
|
||||||
renderLayers(layers, 0.0, 0.0, 0.0)
|
|
||||||
|
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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,7 @@ import chylex.hee.game.block.entity.TileEntityLootChest
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.util.facades.Resource
|
import chylex.hee.system.util.facades.Resource
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer
|
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
|
||||||
@@ -11,11 +11,11 @@ import net.minecraft.item.ItemStack
|
|||||||
object RenderTileLootChest : RenderTileAbstractChest<TileEntityLootChest>(){
|
object RenderTileLootChest : RenderTileAbstractChest<TileEntityLootChest>(){
|
||||||
override val texture = Resource.Custom("textures/entity/loot_chest.png")
|
override val texture = Resource.Custom("textures/entity/loot_chest.png")
|
||||||
|
|
||||||
object AsItem : TileEntityItemStackRenderer(){
|
object AsItem : ItemStackTileEntityRenderer(){
|
||||||
private val tile = TileEntityLootChest()
|
private val tile = TileEntityLootChest()
|
||||||
|
|
||||||
override fun renderByItem(stack: ItemStack, partialTicks: Float){
|
override fun renderByItem(stack: ItemStack){
|
||||||
TileEntityRendererDispatcher.instance.render(tile, 0.0, 0.0, 0.0, partialTicks)
|
TileEntityRendererDispatcher.instance.renderAsItem(tile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,17 +6,17 @@ import chylex.hee.game.block.entity.TileEntityMinersBurialAltar
|
|||||||
import chylex.hee.init.ModItems
|
import chylex.hee.init.ModItems
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType.GROUND
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraftforge.client.ForgeHooksClient
|
import net.minecraftforge.client.ForgeHooksClient
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object RenderTileMinersBurialAltar : TileEntitySpecialRenderer<TileEntityMinersBurialAltar>(){
|
object RenderTileMinersBurialAltar : TileEntityRenderer<TileEntityMinersBurialAltar>(){
|
||||||
private val PUZZLE_MEDALLION = ItemStack(ModItems.PUZZLE_MEDALLION)
|
private val PUZZLE_MEDALLION = ItemStack(ModItems.PUZZLE_MEDALLION)
|
||||||
private const val SCALE_XZ = 1.85F
|
private const val SCALE_XZ = 1.85F
|
||||||
|
|
||||||
override fun render(tile: TileEntityMinersBurialAltar, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, alpha: Float){
|
override fun render(tile: TileEntityMinersBurialAltar, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
|
||||||
if (!tile.hasMedallion){
|
if (!tile.hasMedallion){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@@ -4,12 +4,12 @@ import chylex.hee.client.util.MC
|
|||||||
import chylex.hee.game.block.entity.base.TileEntityBaseSpawner
|
import chylex.hee.game.block.entity.base.TileEntityBaseSpawner
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object RenderTileSpawner : TileEntitySpecialRenderer<TileEntityBaseSpawner>(){
|
object RenderTileSpawner : TileEntityRenderer<TileEntityBaseSpawner>(){
|
||||||
override fun render(tile: TileEntityBaseSpawner, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, alpha: Float){
|
override fun render(tile: TileEntityBaseSpawner, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
|
||||||
val entity = tile.clientEntity
|
val entity = tile.clientEntity
|
||||||
val scale = 0.53125F / max(entity.width, entity.height).coerceAtLeast(1F)
|
val scale = 0.53125F / max(entity.width, entity.height).coerceAtLeast(1F)
|
||||||
|
|
||||||
|
@@ -15,9 +15,8 @@ import chylex.hee.system.util.center
|
|||||||
import chylex.hee.system.util.color.IntColor.Companion.RGBA
|
import chylex.hee.system.util.color.IntColor.Companion.RGBA
|
||||||
import chylex.hee.system.util.getTile
|
import chylex.hee.system.util.getTile
|
||||||
import chylex.hee.system.util.lookPosVec
|
import chylex.hee.system.util.lookPosVec
|
||||||
import net.minecraft.client.renderer.OpenGlHelper
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GUI
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType.GUI
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraftforge.client.ForgeHooksClient
|
import net.minecraftforge.client.ForgeHooksClient
|
||||||
@@ -25,11 +24,11 @@ import net.minecraftforge.client.model.pipeline.LightUtil
|
|||||||
import org.lwjgl.opengl.GL11.GL_QUADS
|
import org.lwjgl.opengl.GL11.GL_QUADS
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object RenderTileTable : TileEntitySpecialRenderer<TileEntityBaseTable>(){
|
object RenderTileTable : TileEntityRenderer<TileEntityBaseTable>(){
|
||||||
private val COLOR = RGBA(180, 180, 180, 120).i
|
private val COLOR = RGBA(180, 180, 180, 120).i
|
||||||
private const val Y_OFFSET = 0.8F
|
private const val Y_OFFSET = 0.8F
|
||||||
|
|
||||||
override fun render(tile: TileEntityBaseTable, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, alpha: Float){
|
override fun render(tile: TileEntityBaseTable, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
|
||||||
val dustType = tile.tableDustType ?: return
|
val dustType = tile.tableDustType ?: return
|
||||||
|
|
||||||
if (tile.pos.up().getTile<TileEntityJarODust>(world)?.layers?.getDustType(DustLayers.Side.BOTTOM) == dustType){
|
if (tile.pos.up().getTile<TileEntityJarODust>(world)?.layers?.getDustType(DustLayers.Side.BOTTOM) == dustType){
|
||||||
@@ -52,11 +51,11 @@ object RenderTileTable : TileEntitySpecialRenderer<TileEntityBaseTable>(){
|
|||||||
val itemStack = ItemStack(dustType.item)
|
val itemStack = ItemStack(dustType.item)
|
||||||
val itemModel = ForgeHooksClient.handleCameraTransforms(ItemRenderHelper.getItemModel(itemStack), GUI, false)
|
val itemModel = ForgeHooksClient.handleCameraTransforms(ItemRenderHelper.getItemModel(itemStack), GUI, false)
|
||||||
|
|
||||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680F, 0F)
|
GL.setLightmapCoords(61680F, 0F)
|
||||||
GL.translate(-0.5F, -0.5F, -0.5F)
|
GL.translate(-0.5F, -0.5F, -0.5F)
|
||||||
|
|
||||||
TESSELLATOR.draw(GL_QUADS, DefaultVertexFormats.ITEM){
|
TESSELLATOR.draw(GL_QUADS, DefaultVertexFormats.ITEM){
|
||||||
val quads = itemModel.getQuads(null, null, 0L)
|
val quads = itemModel.getQuads(null, null, tile.wrld.rand)
|
||||||
|
|
||||||
for(quad in quads){
|
for(quad in quads){
|
||||||
LightUtil.renderQuadColor(this, quad, COLOR)
|
LightUtil.renderQuadColor(this, quad, COLOR)
|
||||||
|
@@ -11,13 +11,12 @@ import chylex.hee.system.migration.forge.Sided
|
|||||||
import chylex.hee.system.util.facades.Resource
|
import chylex.hee.system.util.facades.Resource
|
||||||
import chylex.hee.system.util.nextFloat
|
import chylex.hee.system.util.nextFloat
|
||||||
import chylex.hee.system.util.size
|
import chylex.hee.system.util.size
|
||||||
import chylex.hee.system.util.square
|
|
||||||
import chylex.hee.system.util.toRadians
|
import chylex.hee.system.util.toRadians
|
||||||
import net.minecraft.client.renderer.RenderItem
|
import net.minecraft.client.renderer.ItemRenderer
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel
|
import net.minecraft.client.renderer.model.IBakedModel
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType.GROUND
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
|
||||||
import net.minecraft.client.renderer.texture.TextureManager
|
import net.minecraft.client.renderer.texture.TextureManager
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
import net.minecraft.item.Item
|
import net.minecraft.item.Item
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
@@ -31,7 +30,7 @@ import kotlin.math.cos
|
|||||||
import kotlin.math.sin
|
import kotlin.math.sin
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object RenderTileTablePedestal : TileEntitySpecialRenderer<TileEntityTablePedestal>(){
|
object RenderTileTablePedestal : TileEntityRenderer<TileEntityTablePedestal>(){
|
||||||
private val TEX_SHADOW = Resource.Vanilla("textures/misc/shadow.png")
|
private val TEX_SHADOW = Resource.Vanilla("textures/misc/shadow.png")
|
||||||
private val RAND = Random()
|
private val RAND = Random()
|
||||||
|
|
||||||
@@ -57,7 +56,7 @@ object RenderTileTablePedestal : TileEntitySpecialRenderer<TileEntityTablePedest
|
|||||||
else -> 1
|
else -> 1
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(tile: TileEntityTablePedestal, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, alpha: Float){
|
override fun render(tile: TileEntityTablePedestal, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int){
|
||||||
val textureManager = MC.textureManager
|
val textureManager = MC.textureManager
|
||||||
val itemRenderer = MC.itemRenderer
|
val itemRenderer = MC.itemRenderer
|
||||||
|
|
||||||
@@ -77,7 +76,7 @@ object RenderTileTablePedestal : TileEntitySpecialRenderer<TileEntityTablePedest
|
|||||||
ITEM_ANGLES.toMutableList()
|
ITEM_ANGLES.toMutableList()
|
||||||
|
|
||||||
val shadowAlpha = if (MC.settings.entityShadows)
|
val shadowAlpha = if (MC.settings.entityShadows)
|
||||||
(0.25 * world.getLightBrightness(pos) * (1.0 - (square(x) + square(y) + square(z)) / 256.0)).toFloat().coerceAtMost(1F)
|
(0.75 * (1.0 - (MC.renderManager.getDistanceToCamera(x, y, z) / 256.0))).toFloat().coerceAtMost(1F)
|
||||||
else
|
else
|
||||||
0F
|
0F
|
||||||
|
|
||||||
@@ -89,14 +88,14 @@ object RenderTileTablePedestal : TileEntitySpecialRenderer<TileEntityTablePedest
|
|||||||
ItemRenderHelper.endItemModel()
|
ItemRenderHelper.endItemModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderItemStack(textureManager: TextureManager, renderer: RenderItem, stack: ItemStack, index: Int, baseRotation: Float, baseSeed: Long, offsetAngleIndices: MutableList<Float>, shadowAlpha: Float){
|
private fun renderItemStack(textureManager: TextureManager, renderer: ItemRenderer, stack: ItemStack, index: Int, baseRotation: Float, baseSeed: Long, offsetAngleIndices: MutableList<Float>, shadowAlpha: Float){
|
||||||
GL.pushMatrix()
|
GL.pushMatrix()
|
||||||
|
|
||||||
var offsetY = 0F
|
var offsetY = 0F
|
||||||
var rotationMp = 1F
|
var rotationMp = 1F
|
||||||
|
|
||||||
if (index > 0 && offsetAngleIndices.isNotEmpty()){
|
if (index > 0 && offsetAngleIndices.isNotEmpty()){
|
||||||
val seed = baseSeed + ((Item.getIdFromItem(stack.item) + stack.metadata) xor (33867 shl index))
|
val seed = baseSeed + (Item.getIdFromItem(stack.item) xor (33867 shl index))
|
||||||
RAND.setSeed(seed)
|
RAND.setSeed(seed)
|
||||||
|
|
||||||
val locDistance = RAND.nextFloat(0.26F, 0.29F)
|
val locDistance = RAND.nextFloat(0.26F, 0.29F)
|
||||||
@@ -133,11 +132,11 @@ object RenderTileTablePedestal : TileEntitySpecialRenderer<TileEntityTablePedest
|
|||||||
GL.popMatrix()
|
GL.popMatrix()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderItemWithSpread(renderer: RenderItem, stack: ItemStack, model: IBakedModel, isModel3D: Boolean){
|
private fun renderItemWithSpread(renderer: ItemRenderer, stack: ItemStack, model: IBakedModel, isModel3D: Boolean){
|
||||||
val extraModels = getItemModelCount(stack.size) - 1
|
val extraModels = getItemModelCount(stack.size) - 1
|
||||||
|
|
||||||
if (extraModels > 0){
|
if (extraModels > 0){
|
||||||
RAND.setSeed((Item.getIdFromItem(stack.item) + stack.metadata).toLong())
|
RAND.setSeed(Item.getIdFromItem(stack.item).toLong())
|
||||||
|
|
||||||
if (!isModel3D){
|
if (!isModel3D){
|
||||||
GL.translate(0F, 0F, -SPREAD_DEPTH_PER_2D_MODEL * (extraModels / 2F))
|
GL.translate(0F, 0F, -SPREAD_DEPTH_PER_2D_MODEL * (extraModels / 2F))
|
||||||
|
@@ -11,7 +11,6 @@ import chylex.hee.init.ModBlocks
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.util.closestTickingTile
|
import chylex.hee.system.util.closestTickingTile
|
||||||
import chylex.hee.system.util.get
|
|
||||||
import chylex.hee.system.util.getState
|
import chylex.hee.system.util.getState
|
||||||
import chylex.hee.system.util.math.LerpedFloat
|
import chylex.hee.system.util.math.LerpedFloat
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
|
@@ -5,13 +5,13 @@ import chylex.hee.client.render.util.GL
|
|||||||
import chylex.hee.game.entity.living.EntityBossEnderEye
|
import chylex.hee.game.entity.living.EntityBossEnderEye
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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.facades.Resource
|
||||||
import net.minecraft.client.renderer.entity.RenderLiving
|
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class RenderEntityBossEnderEye(manager: RenderManager) : RenderLiving<EntityBossEnderEye>(manager, ModelEntityBossEnderEye, SCALE){
|
class RenderEntityBossEnderEye(manager: RenderManager) : RenderLiving<EntityBossEnderEye, ModelEntityBossEnderEye>(manager, ModelEntityBossEnderEye, SCALE){
|
||||||
private val texture = Resource.Custom("textures/entity/ender_eye.png")
|
private val texture = Resource.Custom("textures/entity/ender_eye.png")
|
||||||
|
|
||||||
override fun preRenderCallback(entity: EntityBossEnderEye, partialTicks: Float){
|
override fun preRenderCallback(entity: EntityBossEnderEye, partialTicks: Float){
|
||||||
|
@@ -2,8 +2,8 @@ package chylex.hee.client.render.entity
|
|||||||
import chylex.hee.client.util.MC
|
import chylex.hee.client.util.MC
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.renderer.entity.RenderEntityItem
|
import chylex.hee.system.migration.vanilla.RenderEntityItem
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
import chylex.hee.system.migration.vanilla.RenderManager
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class RenderEntityItemNoBob(manager: RenderManager) : RenderEntityItem(manager, MC.itemRenderer){
|
class RenderEntityItemNoBob(manager: RenderManager) : RenderEntityItem(manager, MC.itemRenderer){
|
||||||
|
@@ -5,11 +5,11 @@ import chylex.hee.client.render.util.GL.SF_SRC_ALPHA
|
|||||||
import chylex.hee.game.entity.living.EntityMobAbstractEnderman
|
import chylex.hee.game.entity.living.EntityMobAbstractEnderman
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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.nextFloat
|
||||||
import chylex.hee.system.util.totalTime
|
import chylex.hee.system.util.totalTime
|
||||||
import net.minecraft.client.renderer.entity.RenderEnderman
|
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
|
||||||
import net.minecraft.entity.monster.EntityEnderman
|
|
||||||
import org.lwjgl.opengl.GL11.GL_GREATER
|
import org.lwjgl.opengl.GL11.GL_GREATER
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
|
|
||||||
@@ -72,6 +72,6 @@ open class RenderEntityMobAbstractEnderman(manager: RenderManager) : RenderEnder
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected open fun getCloneCount(entity: EntityMobAbstractEnderman): Int{
|
protected open fun getCloneCount(entity: EntityMobAbstractEnderman): Int{
|
||||||
return if (entity.hurtTime == 0 && entity.isAggressive) 2 else 0
|
return if (entity.hurtTime == 0 && entity.isAggro) 2 else 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,13 +2,13 @@ package chylex.hee.client.render.entity
|
|||||||
import chylex.hee.game.entity.living.EntityMobAbstractEnderman
|
import chylex.hee.game.entity.living.EntityMobAbstractEnderman
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
import chylex.hee.system.migration.vanilla.RenderManager
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class RenderEntityMobAngryEnderman(manager: RenderManager) : RenderEntityMobAbstractEnderman(manager){
|
class RenderEntityMobAngryEnderman(manager: RenderManager) : RenderEntityMobAbstractEnderman(manager){
|
||||||
override fun getCloneCount(entity: EntityMobAbstractEnderman) = when{
|
override fun getCloneCount(entity: EntityMobAbstractEnderman) = when{
|
||||||
entity.hurtTime != 0 -> 0
|
entity.hurtTime != 0 -> 0
|
||||||
entity.isAggressive -> 2
|
entity.isAggro -> 2
|
||||||
else -> 1
|
else -> 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,18 +4,18 @@ import chylex.hee.client.render.util.GL
|
|||||||
import chylex.hee.game.entity.living.EntityMobSpiderling
|
import chylex.hee.game.entity.living.EntityMobSpiderling
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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.facades.Resource
|
||||||
import net.minecraft.client.model.ModelSpider
|
import net.minecraft.client.renderer.entity.model.SpiderModel
|
||||||
import net.minecraft.client.renderer.entity.RenderLiving
|
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class RenderEntityMobSpiderling(manager: RenderManager) : RenderLiving<EntityMobSpiderling>(manager, ModelSpider(), 0.5F){
|
class RenderEntityMobSpiderling(manager: RenderManager) : RenderLiving<EntityMobSpiderling, SpiderModel<EntityMobSpiderling>>(manager, SpiderModel(), 0.5F){
|
||||||
private val texture = Resource.Custom("textures/entity/spiderling.png")
|
private val texture = Resource.Custom("textures/entity/spiderling.png")
|
||||||
|
|
||||||
init{
|
init{
|
||||||
addLayer(LayerSpiderlingEyes(this, (mainModel as ModelSpider).spiderHead))
|
addLayer(LayerSpiderlingEyes(this, (entityModel as SpiderModel).field_78209_a)) // RENAME spiderHead
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun preRenderCallback(entity: EntityMobSpiderling, partialTicks: Float){
|
override fun preRenderCallback(entity: EntityMobSpiderling, partialTicks: Float){
|
||||||
|
@@ -1,26 +1,22 @@
|
|||||||
package chylex.hee.client.render.entity
|
package chylex.hee.client.render.entity
|
||||||
|
import chylex.hee.client.model.entity.ModelEntityUndread
|
||||||
import chylex.hee.client.render.util.GL
|
import chylex.hee.client.render.util.GL
|
||||||
import chylex.hee.game.entity.living.EntityMobUndread
|
import chylex.hee.game.entity.living.EntityMobUndread
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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 chylex.hee.system.util.facades.Resource
|
||||||
import net.minecraft.client.model.ModelZombie
|
import net.minecraft.client.renderer.entity.layers.BipedArmorLayer
|
||||||
import net.minecraft.client.renderer.entity.RenderBiped
|
import net.minecraft.client.renderer.entity.model.AbstractZombieModel
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor
|
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class RenderEntityMobUndread(manager: RenderManager) : RenderBiped<EntityMobUndread>(manager, ModelZombie(), 0.5F){
|
class RenderEntityMobUndread(manager: RenderManager) : RenderBiped<EntityMobUndread, AbstractZombieModel<EntityMobUndread>>(manager, ModelEntityUndread(), 0.5F){
|
||||||
private val texture = Resource.Custom("textures/entity/undread.png")
|
private val texture = Resource.Custom("textures/entity/undread.png")
|
||||||
|
|
||||||
init{
|
init{
|
||||||
addLayer(object : LayerBipedArmor(this){
|
addLayer(BipedArmorLayer(this, ModelEntityUndread(0.5125F, true), ModelEntityUndread(1F, true)))
|
||||||
override fun initArmor(){
|
|
||||||
modelLeggings = ModelZombie(0.5125F, true)
|
|
||||||
modelArmor = ModelZombie(1F, true)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun preRenderCallback(entity: EntityMobUndread, partialTicks: Float){
|
override fun preRenderCallback(entity: EntityMobUndread, partialTicks: Float){
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
package chylex.hee.client.render.entity
|
package chylex.hee.client.render.entity
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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 chylex.hee.system.util.facades.Resource
|
||||||
import net.minecraft.client.renderer.entity.RenderBat
|
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
|
||||||
import net.minecraft.entity.passive.EntityBat
|
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
|
@@ -1,19 +1,32 @@
|
|||||||
package chylex.hee.client.render.entity
|
package chylex.hee.client.render.entity
|
||||||
import chylex.hee.client.render.util.GL
|
import chylex.hee.client.render.util.GL
|
||||||
|
import chylex.hee.client.util.MC
|
||||||
import chylex.hee.game.entity.living.EntityMobVillagerDying
|
import chylex.hee.game.entity.living.EntityMobVillagerDying
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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 chylex.hee.system.util.totalTime
|
||||||
import net.minecraft.client.model.ModelVillager
|
import net.minecraft.client.renderer.entity.layers.HeadLayer
|
||||||
import net.minecraft.client.renderer.entity.RenderLiving
|
import net.minecraft.client.renderer.entity.layers.VillagerHeldItemLayer
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
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 net.minecraft.util.ResourceLocation
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class RenderEntityMobVillagerDying(manager: RenderManager) : RenderLiving<EntityMobVillagerDying>(manager, ModelVillager(0F), 0.5F){
|
class RenderEntityMobVillagerDying(manager: RenderManager) : RenderLiving<EntityMobVillagerDying, VillagerModel<EntityMobVillagerDying>>(manager, VillagerModel(0F), 0.5F){
|
||||||
private val rand = Random()
|
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){
|
override fun doRender(entity: EntityMobVillagerDying, x: Double, y: Double, z: Double, rotationYaw: Float, partialTicks: Float){
|
||||||
rand.setSeed(entity.world.totalTime)
|
rand.setSeed(entity.world.totalTime)
|
||||||
@@ -22,8 +35,8 @@ class RenderEntityMobVillagerDying(manager: RenderManager) : RenderLiving<Entity
|
|||||||
super.doRender(entity, x + (rand.nextGaussian() * mp), y + (rand.nextGaussian() * mp), z + (rand.nextGaussian() * mp), rotationYaw, partialTicks)
|
super.doRender(entity, x + (rand.nextGaussian() * mp), y + (rand.nextGaussian() * mp), z + (rand.nextGaussian() * mp), rotationYaw, partialTicks)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getEntityTexture(entity: EntityMobVillagerDying): ResourceLocation?{
|
override fun getEntityTexture(entity: EntityMobVillagerDying): ResourceLocation{
|
||||||
return entity.profession?.skin
|
return texture
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun preRenderCallback(entity: EntityMobVillagerDying, partialTicks: Float){
|
override fun preRenderCallback(entity: EntityMobVillagerDying, partialTicks: Float){
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
package chylex.hee.client.render.entity
|
package chylex.hee.client.render.entity
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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.client.renderer.culling.ICamera
|
||||||
import net.minecraft.client.renderer.entity.Render
|
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
|
|
||||||
|
@@ -6,9 +6,9 @@ import chylex.hee.game.entity.projectile.EntityProjectileEyeOfEnder
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.migration.vanilla.Items
|
import chylex.hee.system.migration.vanilla.Items
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType.GROUND
|
import chylex.hee.system.migration.vanilla.Render
|
||||||
import net.minecraft.client.renderer.entity.Render
|
import chylex.hee.system.migration.vanilla.RenderManager
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraftforge.client.ForgeHooksClient
|
import net.minecraftforge.client.ForgeHooksClient
|
||||||
|
@@ -9,9 +9,9 @@ import chylex.hee.game.item.ItemPortalToken.TokenType.RARE
|
|||||||
import chylex.hee.game.item.ItemPortalToken.TokenType.SOLITARY
|
import chylex.hee.game.item.ItemPortalToken.TokenType.SOLITARY
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
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 chylex.hee.system.util.facades.Resource
|
||||||
import net.minecraft.client.renderer.entity.Render
|
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
|
|
||||||
|
@@ -1,20 +0,0 @@
|
|||||||
package chylex.hee.client.render.entity.layer
|
|
||||||
import chylex.hee.client.render.block.RenderTileEndermanHead
|
|
||||||
import chylex.hee.init.ModItems
|
|
||||||
import chylex.hee.system.migration.forge.Side
|
|
||||||
import chylex.hee.system.migration.forge.Sided
|
|
||||||
import net.minecraft.client.model.ModelRenderer
|
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer
|
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot.HEAD
|
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
|
||||||
class LayerEndermanHead(private val headModel: ModelRenderer) : LayerRenderer<EntityPlayer>{
|
|
||||||
override fun doRenderLayer(entity: EntityPlayer, limbSwing: Float, limbSwingAmount: Float, partialTicks: Float, entityTickTime: Float, rotationYaw: Float, rotationPitch: Float, scale: Float){
|
|
||||||
if (entity.getItemStackFromSlot(HEAD).item === ModItems.ENDERMAN_HEAD){
|
|
||||||
RenderTileEndermanHead.AsHeadLayer(entity, headModel)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun shouldCombineTextures() = false
|
|
||||||
}
|
|
@@ -8,29 +8,29 @@ import chylex.hee.game.entity.living.EntityMobSpiderling
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.util.facades.Resource
|
import chylex.hee.system.util.facades.Resource
|
||||||
import net.minecraft.client.model.ModelRenderer
|
|
||||||
import net.minecraft.client.renderer.OpenGlHelper
|
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer
|
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)
|
@Sided(Side.CLIENT)
|
||||||
class LayerSpiderlingEyes(private val spiderlingRenderer: RenderEntityMobSpiderling, private val headRenderer: ModelRenderer) : LayerRenderer<EntityMobSpiderling>{
|
class LayerSpiderlingEyes(spiderlingRenderer: RenderEntityMobSpiderling, private val headRenderer: RendererModel) : LayerRenderer<EntityMobSpiderling, SpiderModel<EntityMobSpiderling>>(spiderlingRenderer){
|
||||||
private val texture = Resource.Custom("textures/entity/spiderling_eyes.png")
|
private val texture = Resource.Custom("textures/entity/spiderling_eyes.png")
|
||||||
|
|
||||||
override fun doRenderLayer(entity: EntityMobSpiderling, limbSwing: Float, limbSwingAmount: Float, partialTicks: Float, ageInTicks: Float, netHeadYaw: Float, headPitch: Float, scale: Float){
|
override fun render(entity: EntityMobSpiderling, limbSwing: Float, limbSwingAmount: Float, partialTicks: Float, ageInTicks: Float, netHeadYaw: Float, headPitch: Float, scale: Float){
|
||||||
if (entity.isSleeping){
|
if (entity.isSleeping){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
spiderlingRenderer.bindTexture(texture)
|
bindTexture(texture)
|
||||||
|
|
||||||
GL.color(1F, 1F, 1F, 1F)
|
|
||||||
GL.disableAlpha()
|
GL.disableAlpha()
|
||||||
GL.enableBlend()
|
GL.enableBlend()
|
||||||
GL.blendFunc(SF_ONE, DF_ONE)
|
GL.blendFunc(SF_ONE, DF_ONE)
|
||||||
GL.depthMask(!entity.isInvisible)
|
GL.depthMask(!entity.isInvisible)
|
||||||
|
|
||||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680F, 0F)
|
GL.color(1F, 1F, 1F, 1F)
|
||||||
MC.entityRenderer.setupFogColor(true)
|
GL.setLightmapCoords(61680F, 0F)
|
||||||
|
MC.gameRenderer.setupFogColor(true)
|
||||||
|
|
||||||
if (headPitch == 0F){
|
if (headPitch == 0F){
|
||||||
GL.pushMatrix()
|
GL.pushMatrix()
|
||||||
@@ -42,9 +42,10 @@ class LayerSpiderlingEyes(private val spiderlingRenderer: RenderEntityMobSpiderl
|
|||||||
headRenderer.render(scale)
|
headRenderer.render(scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
spiderlingRenderer.setLightmap(entity)
|
MC.gameRenderer.setupFogColor(false)
|
||||||
MC.entityRenderer.setupFogColor(false)
|
func_215334_a(entity) // RENAME resets lightmap
|
||||||
|
|
||||||
|
GL.depthMask(true)
|
||||||
GL.disableBlend()
|
GL.disableBlend()
|
||||||
GL.enableAlpha()
|
GL.enableAlpha()
|
||||||
}
|
}
|
||||||
|
@@ -2,10 +2,10 @@ package chylex.hee.client.render.territory
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.multiplayer.WorldClient
|
import net.minecraft.client.world.ClientWorld
|
||||||
import net.minecraftforge.client.IRenderHandler
|
import net.minecraftforge.client.IRenderHandler
|
||||||
|
|
||||||
object EmptyRenderer : IRenderHandler(){
|
object EmptyRenderer : IRenderHandler{
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
override fun render(partialTicks: Float, world: WorldClient, mc: Minecraft){}
|
override fun render(ticks: Int, partialTicks: Float, world: ClientWorld, mc: Minecraft){}
|
||||||
}
|
}
|
||||||
|
@@ -7,13 +7,12 @@ import chylex.hee.system.migration.forge.Sided
|
|||||||
import chylex.hee.system.util.facades.Resource
|
import chylex.hee.system.util.facades.Resource
|
||||||
import chylex.hee.system.util.remapRange
|
import chylex.hee.system.util.remapRange
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.multiplayer.WorldClient
|
import net.minecraft.client.world.ClientWorld
|
||||||
import net.minecraft.client.renderer.EntityRenderer
|
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.Vec3d
|
||||||
import net.minecraftforge.client.IRenderHandler
|
import net.minecraftforge.client.IRenderHandler
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
|
|
||||||
class EnvironmentRenderer(private vararg val renderers: IRenderHandler) : IRenderHandler(){
|
class EnvironmentRenderer(private vararg val renderers: IRenderHandler) : IRenderHandler{
|
||||||
companion object{
|
companion object{
|
||||||
val currentSkyAlpha
|
val currentSkyAlpha
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
@@ -33,15 +32,11 @@ class EnvironmentRenderer(private vararg val renderers: IRenderHandler) : IRende
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
override fun render(partialTicks: Float, world: WorldClient, mc: Minecraft){
|
override fun render(ticks: Int, partialTicks: Float, world: ClientWorld, mc: Minecraft){
|
||||||
if (mc.gameSettings.anaglyph && EntityRenderer.anaglyphField != 0){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
GL.depthMask(false)
|
GL.depthMask(false)
|
||||||
|
|
||||||
for(renderer in renderers){
|
for(renderer in renderers){
|
||||||
renderer.render(partialTicks, world, mc)
|
renderer.render(ticks, partialTicks, world, mc)
|
||||||
}
|
}
|
||||||
|
|
||||||
GL.depthMask(true)
|
GL.depthMask(true)
|
||||||
|
@@ -11,16 +11,16 @@ import chylex.hee.client.util.MC
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.multiplayer.WorldClient
|
|
||||||
import net.minecraft.client.renderer.RenderHelper
|
import net.minecraft.client.renderer.RenderHelper
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
|
import net.minecraft.client.world.ClientWorld
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.Vec3d
|
||||||
import net.minecraftforge.client.IRenderHandler
|
import net.minecraftforge.client.IRenderHandler
|
||||||
import org.lwjgl.opengl.GL11.GL_GREATER
|
import org.lwjgl.opengl.GL11.GL_GREATER
|
||||||
import org.lwjgl.opengl.GL11.GL_QUADS
|
import org.lwjgl.opengl.GL11.GL_QUADS
|
||||||
|
|
||||||
abstract class SkyCubeBase : IRenderHandler(){
|
abstract class SkyCubeBase : IRenderHandler{
|
||||||
protected companion object{
|
protected companion object{
|
||||||
const val DEFAULT_ALPHA = 1F
|
const val DEFAULT_ALPHA = 1F
|
||||||
const val DEFAULT_DISTANCE = 125.0
|
const val DEFAULT_DISTANCE = 125.0
|
||||||
@@ -32,7 +32,7 @@ abstract class SkyCubeBase : IRenderHandler(){
|
|||||||
protected open val distance = DEFAULT_DISTANCE
|
protected open val distance = DEFAULT_DISTANCE
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
override fun render(partialTicks: Float, world: WorldClient, mc: Minecraft){
|
override fun render(ticks: Int, partialTicks: Float, world: ClientWorld, mc: Minecraft){
|
||||||
val dist = distance
|
val dist = distance
|
||||||
val col = color
|
val col = color
|
||||||
|
|
||||||
|
@@ -10,8 +10,8 @@ import chylex.hee.system.migration.forge.Side
|
|||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.util.square
|
import chylex.hee.system.util.square
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.multiplayer.WorldClient
|
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
|
import net.minecraft.client.world.ClientWorld
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.Vec3d
|
||||||
import net.minecraftforge.client.IRenderHandler
|
import net.minecraftforge.client.IRenderHandler
|
||||||
@@ -22,7 +22,7 @@ import org.lwjgl.opengl.GL11.GL_SMOOTH
|
|||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
import kotlin.math.sqrt
|
import kotlin.math.sqrt
|
||||||
|
|
||||||
abstract class SkyDomeBase : IRenderHandler(){
|
abstract class SkyDomeBase : IRenderHandler{
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
private object Skybox{
|
private object Skybox{
|
||||||
data class Vertex(val x: Float, val y: Float, val z: Float, val u: Float, val v: Float, val c: Float)
|
data class Vertex(val x: Float, val y: Float, val z: Float, val u: Float, val v: Float, val c: Float)
|
||||||
@@ -84,7 +84,7 @@ abstract class SkyDomeBase : IRenderHandler(){
|
|||||||
protected open val alpha = DEFAULT_ALPHA
|
protected open val alpha = DEFAULT_ALPHA
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
override fun render(partialTicks: Float, world: WorldClient, mc: Minecraft){
|
override fun render(ticks: Int, partialTicks: Float, world: ClientWorld, mc: Minecraft){
|
||||||
val col = color
|
val col = color
|
||||||
val alp = alpha * EnvironmentRenderer.currentSkyAlpha
|
val alp = alpha * EnvironmentRenderer.currentSkyAlpha
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ abstract class SkyDomeBase : IRenderHandler(){
|
|||||||
GL.enableFog()
|
GL.enableFog()
|
||||||
GL.shadeModel(GL_SMOOTH)
|
GL.shadeModel(GL_SMOOTH)
|
||||||
|
|
||||||
GL.enableTexture2D()
|
GL.enableTexture()
|
||||||
MC.textureManager.bindTexture(texture)
|
MC.textureManager.bindTexture(texture)
|
||||||
|
|
||||||
TESSELLATOR.draw(GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR){
|
TESSELLATOR.draw(GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR){
|
||||||
|
@@ -10,15 +10,15 @@ import chylex.hee.client.util.MC
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.multiplayer.WorldClient
|
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
|
import net.minecraft.client.world.ClientWorld
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.Vec3d
|
||||||
import net.minecraftforge.client.IRenderHandler
|
import net.minecraftforge.client.IRenderHandler
|
||||||
import org.lwjgl.opengl.GL11.GL_GREATER
|
import org.lwjgl.opengl.GL11.GL_GREATER
|
||||||
import org.lwjgl.opengl.GL11.GL_QUADS
|
import org.lwjgl.opengl.GL11.GL_QUADS
|
||||||
|
|
||||||
abstract class SunBase : IRenderHandler(){
|
abstract class SunBase : IRenderHandler{
|
||||||
protected companion object{
|
protected companion object{
|
||||||
val DEFAULT_COLOR = Vec3d(1.0, 1.0, 1.0)
|
val DEFAULT_COLOR = Vec3d(1.0, 1.0, 1.0)
|
||||||
const val DEFAULT_ALPHA = 1F
|
const val DEFAULT_ALPHA = 1F
|
||||||
@@ -31,13 +31,13 @@ abstract class SunBase : IRenderHandler(){
|
|||||||
protected abstract val size: Double
|
protected abstract val size: Double
|
||||||
protected open val distance = DEFAULT_DISTANCE
|
protected open val distance = DEFAULT_DISTANCE
|
||||||
|
|
||||||
protected open fun setRotation(world: WorldClient, partialTicks: Float){
|
protected open fun setRotation(world: ClientWorld, partialTicks: Float){
|
||||||
GL.rotate(-90F, 0F, 1F, 0F)
|
GL.rotate(-90F, 0F, 1F, 0F)
|
||||||
GL.rotate(world.getCelestialAngle(partialTicks) * 360F, 1F, 0F, 0F)
|
GL.rotate(world.getCelestialAngle(partialTicks) * 360F, 1F, 0F, 0F)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
override fun render(partialTicks: Float, world: WorldClient, mc: Minecraft){
|
override fun render(ticks: Int, partialTicks: Float, world: ClientWorld, mc: Minecraft){
|
||||||
val width = size
|
val width = size
|
||||||
val dist = distance
|
val dist = distance
|
||||||
val col = color
|
val col = color
|
||||||
|
@@ -5,4 +5,4 @@ import net.minecraft.client.renderer.color.IItemColor
|
|||||||
|
|
||||||
const val NO_TINT = -1
|
const val NO_TINT = -1
|
||||||
|
|
||||||
fun IBlockColor.asItem(block: Block) = IItemColor { _, tintIndex -> colorMultiplier(block.defaultState, null, null, tintIndex) }
|
fun IBlockColor.asItem(block: Block) = IItemColor { _, tintIndex -> this.getColor(block.defaultState, null, null, tintIndex) }
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
package chylex.hee.client.render.util
|
package chylex.hee.client.render.util
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.renderer.GlStateManager
|
import com.mojang.blaze3d.platform.GLX
|
||||||
import net.minecraft.client.renderer.GlStateManager.DestFactor
|
import com.mojang.blaze3d.platform.GlStateManager
|
||||||
import net.minecraft.client.renderer.GlStateManager.FogMode
|
import com.mojang.blaze3d.platform.GlStateManager.DestFactor
|
||||||
import net.minecraft.client.renderer.GlStateManager.SourceFactor
|
import com.mojang.blaze3d.platform.GlStateManager.FogMode
|
||||||
import net.minecraft.client.renderer.GlStateManager.TexGen
|
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager.TexGen
|
||||||
import java.nio.FloatBuffer
|
import java.nio.FloatBuffer
|
||||||
|
|
||||||
typealias GLSM = GlStateManager
|
typealias GLSM = GlStateManager
|
||||||
@@ -29,12 +30,12 @@ object GL{
|
|||||||
fun disableBlend() = GLSM.disableBlend()
|
fun disableBlend() = GLSM.disableBlend()
|
||||||
|
|
||||||
fun blendFunc(s: SourceFactor, d: DestFactor) = GLSM.blendFunc(s, d)
|
fun blendFunc(s: SourceFactor, d: DestFactor) = GLSM.blendFunc(s, d)
|
||||||
fun blendFunc(srgb: SourceFactor, drgb: DestFactor, sa: SourceFactor, da: DestFactor) = GLSM.tryBlendFuncSeparate(srgb, drgb, sa, da)
|
fun blendFunc(srgb: SourceFactor, drgb: DestFactor, sa: SourceFactor, da: DestFactor) = GLSM.blendFuncSeparate(srgb, drgb, sa, da)
|
||||||
|
|
||||||
// Alpha
|
// Alpha
|
||||||
|
|
||||||
fun enableAlpha() = GLSM.enableAlpha()
|
fun enableAlpha() = GLSM.enableAlphaTest()
|
||||||
fun disableAlpha() = GLSM.disableAlpha()
|
fun disableAlpha() = GLSM.disableAlphaTest()
|
||||||
|
|
||||||
fun alphaFunc(func: Int, ref: Float) = GLSM.alphaFunc(func, ref)
|
fun alphaFunc(func: Int, ref: Float) = GLSM.alphaFunc(func, ref)
|
||||||
|
|
||||||
@@ -43,8 +44,8 @@ object GL{
|
|||||||
fun enableFog() = GLSM.enableFog()
|
fun enableFog() = GLSM.enableFog()
|
||||||
fun disableFog() = GLSM.disableFog()
|
fun disableFog() = GLSM.disableFog()
|
||||||
|
|
||||||
fun setFogMode(mode: FogMode) = GLSM.setFog(mode)
|
fun setFogMode(mode: FogMode) = GLSM.fogMode(mode)
|
||||||
fun setFogDensity(density: Float) = GLSM.setFogDensity(density)
|
fun setFogDensity(density: Float) = GLSM.fogDensity(density)
|
||||||
|
|
||||||
// Lighting
|
// Lighting
|
||||||
|
|
||||||
@@ -53,27 +54,41 @@ object GL{
|
|||||||
|
|
||||||
fun shadeModel(model: Int) = GLSM.shadeModel(model)
|
fun shadeModel(model: Int) = GLSM.shadeModel(model)
|
||||||
|
|
||||||
|
// Lightmap
|
||||||
|
|
||||||
|
fun setLightmapCoords(x: Float, y: Float){
|
||||||
|
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, x, y)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setLightmapCoords(x: Int, y: Int){
|
||||||
|
setLightmapCoords(x.toFloat(), y.toFloat())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setLightmapCoords(brightness: Int){
|
||||||
|
setLightmapCoords(brightness % 65536, brightness / 65536)
|
||||||
|
}
|
||||||
|
|
||||||
// Color
|
// Color
|
||||||
|
|
||||||
fun enableColorMaterial() = GLSM.enableColorMaterial()
|
fun enableColorMaterial() = GLSM.enableColorMaterial()
|
||||||
fun disableColorMaterial() = GLSM.disableColorMaterial()
|
fun disableColorMaterial() = GLSM.disableColorMaterial()
|
||||||
|
|
||||||
fun color(red: Float, green: Float, blue: Float) = GLSM.color(red, green, blue)
|
fun color(red: Float, green: Float, blue: Float) = GLSM.color3f(red, green, blue)
|
||||||
fun color(red: Float, green: Float, blue: Float, alpha: Float) = GLSM.color(red, green, blue, alpha)
|
fun color(red: Float, green: Float, blue: Float, alpha: Float) = GLSM.color4f(red, green, blue, alpha)
|
||||||
|
|
||||||
// Texture
|
// Texture
|
||||||
|
|
||||||
fun enableTexture2D() = GLSM.enableTexture2D()
|
fun enableTexture() = GLSM.enableTexture()
|
||||||
fun disableTexture2D() = GLSM.disableTexture2D()
|
fun disableTexture() = GLSM.disableTexture()
|
||||||
|
|
||||||
fun enableOutlineMode(color: Int) = GLSM.enableOutlineMode(color)
|
fun enableOutlineMode(color: Int) = GLSM.setupSolidRenderingTextureCombine(color)
|
||||||
fun disableOutlineMode() = GLSM.disableOutlineMode()
|
fun disableOutlineMode() = GLSM.tearDownSolidRenderingTextureCombine()
|
||||||
|
|
||||||
fun enableTexGenCoord(tex: TexGen) = GLSM.enableTexGenCoord(tex)
|
fun enableTexGenCoord(tex: TexGen) = GLSM.enableTexGen(tex)
|
||||||
fun disableTexGenCoord(tex: TexGen) = GLSM.disableTexGenCoord(tex)
|
fun disableTexGenCoord(tex: TexGen) = GLSM.disableTexGen(tex)
|
||||||
|
|
||||||
fun texGenMode(tex: TexGen, mode: Int) = GLSM.texGen(tex, mode)
|
fun texGenMode(tex: TexGen, mode: Int) = GLSM.texGenMode(tex, mode)
|
||||||
fun texGenParam(tex: TexGen, param: Int, buffer: FloatBuffer) = GLSM.texGen(tex, param, buffer)
|
fun texGenParam(tex: TexGen, param: Int, buffer: FloatBuffer) = GLSM.texGenParam(tex, param, buffer)
|
||||||
|
|
||||||
// Matrix
|
// Matrix
|
||||||
|
|
||||||
@@ -83,14 +98,14 @@ object GL{
|
|||||||
|
|
||||||
fun matrixMode(mode: Int) = GLSM.matrixMode(mode)
|
fun matrixMode(mode: Int) = GLSM.matrixMode(mode)
|
||||||
|
|
||||||
fun translate(x: Float, y: Float, z: Float) = GLSM.translate(x, y, z)
|
fun translate(x: Float, y: Float, z: Float) = GLSM.translatef(x, y, z)
|
||||||
fun translate(x: Double, y: Double, z: Double) = GLSM.translate(x, y, z)
|
fun translate(x: Double, y: Double, z: Double) = GLSM.translated(x, y, z)
|
||||||
|
|
||||||
fun scale(x: Float, y: Float, z: Float) = GLSM.scale(x, y, z)
|
fun scale(x: Float, y: Float, z: Float) = GLSM.scalef(x, y, z)
|
||||||
fun scale(x: Double, y: Double, z: Double) = GLSM.scale(x, y, z)
|
fun scale(x: Double, y: Double, z: Double) = GLSM.scaled(x, y, z)
|
||||||
|
|
||||||
fun rotate(angle: Float, x: Float, y: Float, z: Float) = GLSM.rotate(angle, x, y, z)
|
fun rotate(angle: Float, x: Float, y: Float, z: Float) = GLSM.rotatef(angle, x, y, z)
|
||||||
// fun rotate(angle: Double, x: Double, y: Double, z: Double) = GLSM.rotate(angle, x, y, z)
|
fun rotate(angle: Double, x: Double, y: Double, z: Double) = GLSM.rotated(angle, x, y, z)
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
|
|
||||||
|
@@ -7,16 +7,16 @@ import chylex.hee.client.util.MC
|
|||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import net.minecraft.client.renderer.RenderHelper
|
import net.minecraft.client.renderer.RenderHelper
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel
|
import net.minecraft.client.renderer.model.IBakedModel
|
||||||
|
import net.minecraft.client.renderer.texture.AtlasTexture
|
||||||
import net.minecraft.client.renderer.texture.ITextureObject
|
import net.minecraft.client.renderer.texture.ITextureObject
|
||||||
import net.minecraft.client.renderer.texture.TextureMap
|
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import org.lwjgl.opengl.GL11.GL_GREATER
|
import org.lwjgl.opengl.GL11.GL_GREATER
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object ItemRenderHelper{
|
object ItemRenderHelper{
|
||||||
val TEX_BLOCKS_ITEMS: ResourceLocation = TextureMap.LOCATION_BLOCKS_TEXTURE
|
val TEX_BLOCKS_ITEMS: ResourceLocation = AtlasTexture.LOCATION_BLOCKS_TEXTURE
|
||||||
private lateinit var texBlocksItemsObj: ITextureObject
|
private lateinit var texBlocksItemsObj: ITextureObject
|
||||||
|
|
||||||
fun beginItemModel(){
|
fun beginItemModel(){
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
package chylex.hee.client.render.util
|
package chylex.hee.client.render.util
|
||||||
import net.minecraft.client.model.ModelBox
|
import net.minecraft.client.renderer.entity.model.RendererModel
|
||||||
import net.minecraft.client.model.ModelRenderer
|
import net.minecraft.client.renderer.model.ModelBox
|
||||||
|
|
||||||
class ModelBoxBuilder(private val model: ModelRenderer){
|
class ModelBoxBuilder(private val model: RendererModel){
|
||||||
private var x = 0F
|
private var x = 0F
|
||||||
private var y = 0F
|
private var y = 0F
|
||||||
private var z = 0F
|
private var z = 0F
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
package chylex.hee.client.render.util
|
package chylex.hee.client.render.util
|
||||||
import net.minecraft.client.model.ModelRenderer
|
import net.minecraft.client.renderer.entity.model.RendererModel
|
||||||
|
|
||||||
val ModelRenderer.beginBox
|
val RendererModel.beginBox
|
||||||
get() = ModelBoxBuilder(this)
|
get() = ModelBoxBuilder(this)
|
||||||
|
|
||||||
fun ModelRenderer.render(){
|
fun RendererModel.render(){
|
||||||
this.render(1F / 16F)
|
this.render(1F / 16F)
|
||||||
}
|
}
|
||||||
|
@@ -2,10 +2,10 @@ package chylex.hee.client.sound
|
|||||||
import chylex.hee.game.entity.projectile.EntityProjectileSpatialDash
|
import chylex.hee.game.entity.projectile.EntityProjectileSpatialDash
|
||||||
import chylex.hee.system.migration.vanilla.Sounds
|
import chylex.hee.system.migration.vanilla.Sounds
|
||||||
import chylex.hee.system.util.nextFloat
|
import chylex.hee.system.util.nextFloat
|
||||||
import net.minecraft.client.audio.MovingSound
|
import net.minecraft.client.audio.TickableSound
|
||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
|
|
||||||
class MovingSoundSpatialDash(private val entity: EntityProjectileSpatialDash) : MovingSound(Sounds.ITEM_ELYTRA_FLYING, SoundCategory.PLAYERS){
|
class MovingSoundSpatialDash(private val entity: EntityProjectileSpatialDash) : TickableSound(Sounds.ITEM_ELYTRA_FLYING, SoundCategory.PLAYERS){
|
||||||
init{
|
init{
|
||||||
volume = 0.9F
|
volume = 0.9F
|
||||||
pitch = entity.world.rand.nextFloat(1.1F, 1.4F)
|
pitch = entity.world.rand.nextFloat(1.1F, 1.4F)
|
||||||
@@ -13,14 +13,14 @@ class MovingSoundSpatialDash(private val entity: EntityProjectileSpatialDash) :
|
|||||||
repeatDelay = 0
|
repeatDelay = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun update(){
|
override fun tick(){
|
||||||
if (entity.isDead){
|
if (!entity.isAlive){
|
||||||
donePlaying = true
|
donePlaying = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
xPosF = entity.posX.toFloat()
|
x = entity.posX.toFloat()
|
||||||
yPosF = entity.posY.toFloat()
|
y = entity.posY.toFloat()
|
||||||
zPosF = entity.posZ.toFloat()
|
z = entity.posZ.toFloat()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,44 +1,45 @@
|
|||||||
package chylex.hee.client.util
|
package chylex.hee.client.util
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
|
import chylex.hee.system.migration.vanilla.EntityPlayerSP
|
||||||
|
import chylex.hee.system.migration.vanilla.RenderManager
|
||||||
|
import net.minecraft.client.GameSettings
|
||||||
|
import net.minecraft.client.MainWindow
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.entity.EntityPlayerSP
|
|
||||||
import net.minecraft.client.gui.FontRenderer
|
import net.minecraft.client.gui.FontRenderer
|
||||||
import net.minecraft.client.gui.GuiScreen
|
import net.minecraft.client.gui.screen.Screen
|
||||||
import net.minecraft.client.gui.ScaledResolution
|
|
||||||
import net.minecraft.client.multiplayer.WorldClient
|
|
||||||
import net.minecraft.client.particle.ParticleManager
|
import net.minecraft.client.particle.ParticleManager
|
||||||
import net.minecraft.client.renderer.EntityRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.client.renderer.RenderItem
|
import net.minecraft.client.renderer.ItemRenderer
|
||||||
import net.minecraft.client.renderer.entity.RenderManager
|
|
||||||
import net.minecraft.client.renderer.texture.TextureManager
|
import net.minecraft.client.renderer.texture.TextureManager
|
||||||
import net.minecraft.client.settings.GameSettings
|
import net.minecraft.client.world.ClientWorld
|
||||||
|
import net.minecraft.util.Util
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object MC{
|
object MC{
|
||||||
@JvmField
|
@JvmField
|
||||||
val instance: Minecraft = Minecraft.getMinecraft()
|
val instance: Minecraft = Minecraft.getInstance()
|
||||||
|
|
||||||
// General
|
// General
|
||||||
|
|
||||||
val settings: GameSettings
|
val settings: GameSettings
|
||||||
get() = instance.gameSettings
|
get() = instance.gameSettings
|
||||||
|
|
||||||
val resolution
|
val window: MainWindow
|
||||||
get() = ScaledResolution(instance)
|
get() = instance.mainWindow
|
||||||
|
|
||||||
val systemTime
|
val systemTime
|
||||||
get() = Minecraft.getSystemTime()
|
get() = Util.milliTime()
|
||||||
|
|
||||||
// Game state
|
// Game state
|
||||||
|
|
||||||
val player: EntityPlayerSP?
|
val player: EntityPlayerSP?
|
||||||
get() = instance.player
|
get() = instance.player
|
||||||
|
|
||||||
val world: WorldClient?
|
val world: ClientWorld?
|
||||||
get() = instance.world
|
get() = instance.world
|
||||||
|
|
||||||
val currentScreen: GuiScreen?
|
val currentScreen: Screen?
|
||||||
get() = instance.currentScreen
|
get() = instance.currentScreen
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
@@ -53,13 +54,13 @@ object MC{
|
|||||||
get() = instance.renderManager
|
get() = instance.renderManager
|
||||||
|
|
||||||
val particleManager: ParticleManager
|
val particleManager: ParticleManager
|
||||||
get() = instance.effectRenderer
|
get() = instance.particles
|
||||||
|
|
||||||
val entityRenderer: EntityRenderer
|
val gameRenderer: GameRenderer
|
||||||
get() = instance.entityRenderer
|
get() = instance.gameRenderer
|
||||||
|
|
||||||
val itemRenderer: RenderItem
|
val itemRenderer: ItemRenderer
|
||||||
get() = instance.renderItem
|
get() = instance.itemRenderer
|
||||||
|
|
||||||
val fontRenderer: FontRenderer
|
val fontRenderer: FontRenderer
|
||||||
get() = instance.fontRenderer
|
get() = instance.fontRenderer
|
||||||
|
@@ -1,58 +1,52 @@
|
|||||||
package chylex.hee.game.block
|
package chylex.hee.game.block
|
||||||
import chylex.hee.HEE
|
import chylex.hee.HEE
|
||||||
|
import chylex.hee.game.block.info.BlockBuilder
|
||||||
import chylex.hee.system.migration.forge.SubscribeAllEvents
|
import chylex.hee.system.migration.forge.SubscribeAllEvents
|
||||||
import chylex.hee.system.migration.forge.SubscribeEvent
|
import chylex.hee.system.migration.forge.SubscribeEvent
|
||||||
|
import chylex.hee.system.migration.vanilla.BlockCauldron
|
||||||
import chylex.hee.system.migration.vanilla.Blocks
|
import chylex.hee.system.migration.vanilla.Blocks
|
||||||
|
import chylex.hee.system.migration.vanilla.EntityPlayer
|
||||||
import chylex.hee.system.migration.vanilla.Items
|
import chylex.hee.system.migration.vanilla.Items
|
||||||
import chylex.hee.system.migration.vanilla.Sounds
|
import chylex.hee.system.migration.vanilla.Sounds
|
||||||
import chylex.hee.system.util.Pos
|
import chylex.hee.system.util.Pos
|
||||||
import chylex.hee.system.util.facades.Stats
|
import chylex.hee.system.util.facades.Stats
|
||||||
import chylex.hee.system.util.get
|
|
||||||
import chylex.hee.system.util.getBlock
|
import chylex.hee.system.util.getBlock
|
||||||
import chylex.hee.system.util.isNotEmpty
|
import chylex.hee.system.util.isNotEmpty
|
||||||
import chylex.hee.system.util.playUniversal
|
import chylex.hee.system.util.playUniversal
|
||||||
import net.minecraft.block.BlockCauldron
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.state.IBlockState
|
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.Hand
|
||||||
import net.minecraft.util.EnumHand
|
|
||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent
|
import net.minecraftforge.event.entity.player.EntityItemPickupEvent
|
||||||
|
|
||||||
@SubscribeAllEvents(modid = HEE.ID)
|
abstract class BlockAbstractCauldron(builder: BlockBuilder) : BlockCauldron(builder.p){
|
||||||
abstract class BlockAbstractCauldron : BlockCauldron(){
|
@SubscribeAllEvents(modid = HEE.ID)
|
||||||
companion object{
|
companion object{
|
||||||
const val MAX_LEVEL = 3
|
const val MAX_LEVEL = 3
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onEntityItemPickup(e: EntityItemPickupEvent){
|
fun onEntityItemPickup(e: EntityItemPickupEvent){
|
||||||
val item = e.item
|
val item = e.item
|
||||||
val pos = Pos(item)
|
val pos = Pos(item)
|
||||||
|
|
||||||
if (pos.getBlock(item.world) is BlockCauldron && Pos(e.entityPlayer) != pos){
|
if (pos.getBlock(item.world) is BlockCauldron && Pos(e.player) != pos){
|
||||||
e.isCanceled = true
|
e.isCanceled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init{
|
|
||||||
@Suppress("LeakingThis")
|
|
||||||
setHardness(2F)
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract fun createFilledBucket(): ItemStack?
|
protected abstract fun createFilledBucket(): ItemStack?
|
||||||
protected abstract fun createFilledBottle(): ItemStack?
|
protected abstract fun createFilledBottle(): ItemStack?
|
||||||
|
|
||||||
override fun setWaterLevel(world: World, pos: BlockPos, state: IBlockState, level: Int){
|
override fun setWaterLevel(world: World, pos: BlockPos, state: BlockState, level: Int){
|
||||||
super.setWaterLevel(world, pos, if (level == 0) Blocks.CAULDRON.defaultState else state, level)
|
super.setWaterLevel(world, pos, if (level == 0) Blocks.CAULDRON.defaultState else state, level)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun useAndUpdateHeldItem(player: EntityPlayer, hand: EnumHand, newHeldItem: ItemStack){
|
private fun useAndUpdateHeldItem(player: EntityPlayer, hand: Hand, newHeldItem: ItemStack){
|
||||||
val oldHeldItem = player.getHeldItem(hand)
|
val oldHeldItem = player.getHeldItem(hand)
|
||||||
|
|
||||||
oldHeldItem.shrink(1)
|
oldHeldItem.shrink(1)
|
||||||
@@ -65,7 +59,7 @@ abstract class BlockAbstractCauldron : BlockCauldron(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun onBlockActivated(world: World, pos: BlockPos, state: IBlockState, player: EntityPlayer, hand: EnumHand, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float): Boolean{
|
final override fun onBlockActivated(state: BlockState, world: World, pos: BlockPos, player: EntityPlayer, hand: Hand, hit: BlockRayTraceResult): Boolean{
|
||||||
val item = player.getHeldItem(hand).takeIf { it.isNotEmpty }?.item
|
val item = player.getHeldItem(hand).takeIf { it.isNotEmpty }?.item
|
||||||
|
|
||||||
if (item == null){
|
if (item == null){
|
||||||
@@ -106,6 +100,6 @@ abstract class BlockAbstractCauldron : BlockCauldron(){
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEntityCollision(world: World, pos: BlockPos, state: IBlockState, entity: Entity){}
|
override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity){}
|
||||||
override fun fillWithRain(world: World, pos: BlockPos){}
|
override fun fillWithRain(world: World, pos: BlockPos){}
|
||||||
}
|
}
|
||||||
|
@@ -2,112 +2,107 @@ package chylex.hee.game.block
|
|||||||
import chylex.hee.game.block.entity.base.TileEntityBaseChest
|
import chylex.hee.game.block.entity.base.TileEntityBaseChest
|
||||||
import chylex.hee.game.block.info.BlockBuilder
|
import chylex.hee.game.block.info.BlockBuilder
|
||||||
import chylex.hee.game.entity.living.ai.AIOcelotSitOverride.IOcelotCanSitOn
|
import chylex.hee.game.entity.living.ai.AIOcelotSitOverride.IOcelotCanSitOn
|
||||||
import chylex.hee.init.ModGuiHandler.GuiType
|
import chylex.hee.init.ModContainers
|
||||||
import chylex.hee.system.migration.Facing.DOWN
|
|
||||||
import chylex.hee.system.migration.Facing.NORTH
|
import chylex.hee.system.migration.Facing.NORTH
|
||||||
import chylex.hee.system.util.get
|
import chylex.hee.system.migration.vanilla.EntityCat
|
||||||
|
import chylex.hee.system.migration.vanilla.EntityLivingBase
|
||||||
|
import chylex.hee.system.migration.vanilla.EntityPlayer
|
||||||
import chylex.hee.system.util.getState
|
import chylex.hee.system.util.getState
|
||||||
import chylex.hee.system.util.getTile
|
import chylex.hee.system.util.getTile
|
||||||
import chylex.hee.system.util.selectExistingEntities
|
import chylex.hee.system.util.selectExistingEntities
|
||||||
import chylex.hee.system.util.withFacing
|
import chylex.hee.system.util.withFacing
|
||||||
import net.minecraft.block.BlockDirectional.FACING
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.block.ITileEntityProvider
|
import net.minecraft.block.BlockRenderType.ENTITYBLOCK_ANIMATED
|
||||||
import net.minecraft.block.state.BlockFaceShape.UNDEFINED
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.state.BlockStateContainer
|
import net.minecraft.block.ChestBlock.FACING
|
||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.item.BlockItemUseContext
|
||||||
import net.minecraft.entity.EntityLivingBase
|
|
||||||
import net.minecraft.entity.passive.EntityOcelot
|
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.state.StateContainer.Builder
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.util.EnumBlockRenderType.ENTITYBLOCK_ANIMATED
|
import net.minecraft.util.Hand
|
||||||
import net.minecraft.util.EnumFacing
|
|
||||||
import net.minecraft.util.EnumHand
|
|
||||||
import net.minecraft.util.Mirror
|
import net.minecraft.util.Mirror
|
||||||
import net.minecraft.util.Rotation
|
import net.minecraft.util.Rotation
|
||||||
import net.minecraft.util.math.AxisAlignedBB
|
import net.minecraft.util.math.AxisAlignedBB
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.IBlockAccess
|
import net.minecraft.util.math.BlockRayTraceResult
|
||||||
|
import net.minecraft.world.IBlockReader
|
||||||
|
import net.minecraft.world.IWorldReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
|
||||||
abstract class BlockAbstractChest<T : TileEntityBaseChest>(builder: BlockBuilder) : BlockSimple(builder), ITileEntityProvider, IOcelotCanSitOn{
|
abstract class BlockAbstractChest<T : TileEntityBaseChest>(builder: BlockBuilder) : BlockSimpleShaped(builder, AxisAlignedBB(0.0625, 0.0, 0.0625, 0.9375, 0.875, 0.9375)), IOcelotCanSitOn{
|
||||||
private companion object{
|
|
||||||
private val AABB = AxisAlignedBB(0.0625, 0.0, 0.0625, 0.9375, 0.875, 0.9375)
|
|
||||||
}
|
|
||||||
|
|
||||||
init{
|
init{
|
||||||
defaultState = blockState.baseState.withFacing(NORTH)
|
defaultState = stateContainer.baseState.withFacing(NORTH)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createBlockState() = BlockStateContainer(this, FACING)
|
override fun fillStateContainer(container: Builder<Block, BlockState>){
|
||||||
|
container.add(FACING)
|
||||||
|
}
|
||||||
|
|
||||||
// Placement and interaction
|
// Placement and interaction
|
||||||
|
|
||||||
abstract fun createNewTileEntity(): T
|
abstract fun createTileEntity(): T
|
||||||
abstract val guiType: GuiType
|
|
||||||
|
|
||||||
final override fun createNewTileEntity(world: World, meta: Int): TileEntity{
|
override fun hasTileEntity(state: BlockState): Boolean{
|
||||||
return createNewTileEntity()
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getStateForPlacement(world: World, pos: BlockPos, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float, meta: Int, placer: EntityLivingBase, hand: EnumHand): IBlockState{
|
final override fun createTileEntity(state: BlockState, world: IBlockReader): TileEntity{
|
||||||
return this.withFacing(placer.horizontalFacing.opposite)
|
return createTileEntity()
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun onBlockPlacedBy(world: World, pos: BlockPos, state: IBlockState, placer: EntityLivingBase, stack: ItemStack){
|
override fun getStateForPlacement(context: BlockItemUseContext): BlockState{
|
||||||
|
return this.withFacing(context.placementHorizontalFacing.opposite)
|
||||||
|
}
|
||||||
|
|
||||||
|
final override fun onBlockPlacedBy(world: World, pos: BlockPos, state: BlockState, placer: EntityLivingBase?, stack: ItemStack){
|
||||||
if (stack.hasDisplayName()){
|
if (stack.hasDisplayName()){
|
||||||
pos.getTile<TileEntityBaseChest>(world)?.setCustomName(stack.displayName)
|
pos.getTile<TileEntityBaseChest>(world)?.setCustomName(stack.displayName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun onBlockActivated(world: World, pos: BlockPos, state: IBlockState, player: EntityPlayer, hand: EnumHand, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float): Boolean{
|
final override fun onBlockActivated(state: BlockState, world: World, pos: BlockPos, player: EntityPlayer, hand: Hand, hit: BlockRayTraceResult): Boolean{
|
||||||
if (world.isRemote){
|
if (world.isRemote){
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
val posAbove = pos.up()
|
val posAbove = pos.up()
|
||||||
|
|
||||||
if (posAbove.getState(world).doesSideBlockChestOpening(world, posAbove, DOWN)){
|
if (posAbove.getState(world).isNormalCube(world, posAbove)){
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.selectExistingEntities.inBox<EntityOcelot>(AxisAlignedBB(posAbove)).any { it.isSitting }){
|
if (world.selectExistingEntities.inBox<EntityCat>(AxisAlignedBB(posAbove)).any { it.isSitting }){
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openChest(world, pos, player)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
protected open fun openChest(world: World, pos: BlockPos, player: EntityPlayer){
|
||||||
pos.getTile<TileEntityBaseChest>(world)?.let {
|
pos.getTile<TileEntityBaseChest>(world)?.let {
|
||||||
guiType.open(player, pos.x, pos.y, pos.z)
|
ModContainers.open(player, it, pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ocelot behavior
|
// Ocelot behavior
|
||||||
|
|
||||||
override fun canOcelotSitOn(world: World, pos: BlockPos): Boolean{
|
override fun canOcelotSitOn(world: IWorldReader, pos: BlockPos): Boolean{
|
||||||
return pos.getTile<TileEntityBaseChest>(world)?.isLidClosed == true
|
return pos.getTile<TileEntityBaseChest>(world)?.isLidClosed == true
|
||||||
}
|
}
|
||||||
|
|
||||||
// State handling
|
// State handling
|
||||||
|
|
||||||
override fun withRotation(state: IBlockState, rot: Rotation): IBlockState{
|
override fun rotate(state: BlockState, rot: Rotation): BlockState{
|
||||||
return state.withFacing(rot.rotate(state[FACING]))
|
return state.withFacing(rot.rotate(state[FACING]))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun withMirror(state: IBlockState, mirror: Mirror): IBlockState{
|
override fun mirror(state: BlockState, mirror: Mirror): BlockState{
|
||||||
return state.withFacing(mirror.mirror(state[FACING]))
|
return state.withFacing(mirror.mirror(state[FACING]))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getMetaFromState(state: IBlockState) = state[FACING].index
|
// Rendering
|
||||||
override fun getStateFromMeta(meta: Int) = this.withFacing(EnumFacing.byIndex(meta))
|
|
||||||
|
|
||||||
// Shape and rendering
|
final override fun getRenderType(state: BlockState) = ENTITYBLOCK_ANIMATED
|
||||||
|
final override fun hasCustomBreakingProgress(state: BlockState) = true
|
||||||
final override fun getBoundingBox(state: IBlockState, source: IBlockAccess, pos: BlockPos) = AABB
|
|
||||||
final override fun getBlockFaceShape(world: IBlockAccess, state: IBlockState, pos: BlockPos, face: EnumFacing) = UNDEFINED
|
|
||||||
|
|
||||||
final override fun isFullCube(state: IBlockState) = false
|
|
||||||
final override fun isOpaqueCube(state: IBlockState) = false
|
|
||||||
final override fun getRenderType(state: IBlockState) = ENTITYBLOCK_ANIMATED
|
|
||||||
final override fun hasCustomBreakingProgress(state: IBlockState) = true
|
|
||||||
}
|
}
|
||||||
|
@@ -1,43 +1,34 @@
|
|||||||
package chylex.hee.game.block
|
package chylex.hee.game.block
|
||||||
import chylex.hee.game.block.fluid.FluidBase
|
import chylex.hee.game.block.fluid.FluidBase
|
||||||
import chylex.hee.game.world.util.BlockEditor
|
import chylex.hee.game.block.fluid.distances.FlowingFluid5
|
||||||
import chylex.hee.system.migration.forge.EventResult
|
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.migration.forge.SubscribeEvent
|
import chylex.hee.system.migration.vanilla.BlockFlowingFluid
|
||||||
import chylex.hee.system.migration.vanilla.Blocks
|
import chylex.hee.system.migration.vanilla.EntityPlayer
|
||||||
import chylex.hee.system.util.FLAG_NOTIFY_NEIGHBORS
|
|
||||||
import chylex.hee.system.util.FLAG_RENDER_IMMEDIATE
|
|
||||||
import chylex.hee.system.util.FLAG_SYNC_CLIENT
|
|
||||||
import chylex.hee.system.util.Pos
|
import chylex.hee.system.util.Pos
|
||||||
import chylex.hee.system.util.allInBoxMutable
|
import chylex.hee.system.util.allInBoxMutable
|
||||||
import chylex.hee.system.util.facades.Stats
|
|
||||||
import chylex.hee.system.util.get
|
|
||||||
import chylex.hee.system.util.getLongOrNull
|
import chylex.hee.system.util.getLongOrNull
|
||||||
import chylex.hee.system.util.getOrCreateCompound
|
import chylex.hee.system.util.getOrCreateCompound
|
||||||
import chylex.hee.system.util.getState
|
import chylex.hee.system.util.getState
|
||||||
import chylex.hee.system.util.heeTag
|
import chylex.hee.system.util.heeTag
|
||||||
import chylex.hee.system.util.setBlock
|
|
||||||
import chylex.hee.system.util.totalTime
|
import chylex.hee.system.util.totalTime
|
||||||
import net.minecraft.block.material.MapColor
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.material.Material
|
import net.minecraft.block.material.Material
|
||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.block.material.MaterialColor
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
|
||||||
import net.minecraft.item.Item
|
|
||||||
import net.minecraft.item.ItemStack
|
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.RayTraceResult.Type.BLOCK
|
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.Vec3d
|
||||||
import net.minecraft.world.IBlockAccess
|
import net.minecraft.world.IBlockReader
|
||||||
|
import net.minecraft.world.IWorldReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.common.MinecraftForge
|
|
||||||
import net.minecraftforge.event.entity.player.FillBucketEvent
|
|
||||||
import net.minecraftforge.fluids.BlockFluidClassic
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
import java.util.function.Supplier
|
||||||
|
|
||||||
abstract class BlockAbstractGoo(private val fluid: FluidBase, material: Material) : BlockFluidClassic(fluid, material){
|
abstract class BlockAbstractGoo(
|
||||||
private companion object{
|
private val fluid: FluidBase,
|
||||||
|
material: Material
|
||||||
|
) : BlockFlowingFluid(Supplier { fluid.still }, Properties.create(material, fluid.mapColor).hardnessAndResistance(fluid.resistance).doesNotBlockMovement().noDrops()){
|
||||||
|
protected companion object{
|
||||||
private const val LAST_TIME_TAG = "Time"
|
private const val LAST_TIME_TAG = "Time"
|
||||||
private const val TOTAL_TICKS_TAG = "Ticks"
|
private const val TOTAL_TICKS_TAG = "Ticks"
|
||||||
}
|
}
|
||||||
@@ -46,52 +37,11 @@ abstract class BlockAbstractGoo(private val fluid: FluidBase, material: Material
|
|||||||
|
|
||||||
private var lastCollidingEntity = ThreadLocal<Pair<Long, UUID>?>()
|
private var lastCollidingEntity = ThreadLocal<Pair<Long, UUID>?>()
|
||||||
|
|
||||||
abstract val filledBucket: Item
|
|
||||||
protected abstract val tickTrackingKey: String
|
protected abstract val tickTrackingKey: String
|
||||||
|
|
||||||
init{
|
|
||||||
enableStats = false
|
|
||||||
|
|
||||||
@Suppress("LeakingThis")
|
|
||||||
setQuantaPerBlock(5)
|
|
||||||
|
|
||||||
@Suppress("LeakingThis")
|
|
||||||
MinecraftForge.EVENT_BUS.register(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Behavior
|
// Behavior
|
||||||
|
|
||||||
@SubscribeEvent
|
final override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity){
|
||||||
fun onFillBucket(e: FillBucketEvent){
|
|
||||||
val target = e.target
|
|
||||||
|
|
||||||
if (target == null || target.typeOfHit != BLOCK){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val world = e.world
|
|
||||||
val player = e.entityPlayer
|
|
||||||
val pos = target.blockPos
|
|
||||||
|
|
||||||
if (!BlockEditor.canEdit(pos, e.entityPlayer, e.emptyBucket) || !world.isBlockModifiable(player, pos)){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val state = pos.getState(world)
|
|
||||||
|
|
||||||
if (state.block !== this || state[LEVEL] != 0){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
player.addStat(Stats.useItem(e.emptyBucket.item))
|
|
||||||
// TODO sound effect?
|
|
||||||
|
|
||||||
pos.setBlock(world, Blocks.AIR, FLAG_NOTIFY_NEIGHBORS or FLAG_SYNC_CLIENT or FLAG_RENDER_IMMEDIATE)
|
|
||||||
e.filledBucket = ItemStack(filledBucket)
|
|
||||||
e.result = EventResult.ALLOW
|
|
||||||
}
|
|
||||||
|
|
||||||
final override fun onEntityCollision(world: World, pos: BlockPos, state: IBlockState, entity: Entity){
|
|
||||||
/*
|
/*
|
||||||
* this prevents calling onInsideGoo/modifyMotion multiple times if the entity is touching 2 or more goo blocks
|
* this prevents calling onInsideGoo/modifyMotion multiple times if the entity is touching 2 or more goo blocks
|
||||||
*
|
*
|
||||||
@@ -105,14 +55,14 @@ abstract class BlockAbstractGoo(private val fluid: FluidBase, material: Material
|
|||||||
lastCollidingEntity.set(Pair(currentWorldTime, entity.uniqueID))
|
lastCollidingEntity.set(Pair(currentWorldTime, entity.uniqueID))
|
||||||
|
|
||||||
// handling from Entity.doBlockCollisions
|
// handling from Entity.doBlockCollisions
|
||||||
val bb = entity.entityBoundingBox
|
val bb = entity.boundingBox
|
||||||
val posMin = Pos(bb.minX - 0.001, bb.minY - 0.001, bb.minZ - 0.001)
|
val posMin = Pos(bb.minX - 0.001, bb.minY - 0.001, bb.minZ - 0.001)
|
||||||
val posMax = Pos(bb.maxX + 0.001, bb.maxY + 0.001, bb.maxZ + 0.001)
|
val posMax = Pos(bb.maxX + 0.001, bb.maxY + 0.001, bb.maxZ + 0.001)
|
||||||
|
|
||||||
var lowestLevel = Int.MAX_VALUE
|
var lowestLevel = Int.MAX_VALUE
|
||||||
|
|
||||||
for(testPos in posMin.allInBoxMutable(posMax)){
|
for(testPos in posMin.allInBoxMutable(posMax)){
|
||||||
val level = testPos.getState(world).takeIf { it.block === this }?.get(LEVEL) ?: continue
|
val level = testPos.getState(world).takeIf { it.block === this }?.let { FlowingFluid5.stateToLevel(it) } ?: continue
|
||||||
|
|
||||||
if (level < lowestLevel){
|
if (level < lowestLevel){
|
||||||
lowestLevel = level
|
lowestLevel = level
|
||||||
@@ -124,7 +74,7 @@ abstract class BlockAbstractGoo(private val fluid: FluidBase, material: Material
|
|||||||
onInsideGoo(entity)
|
onInsideGoo(entity)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(entity is EntityPlayer && entity.capabilities.isFlying)){
|
if (!(entity is EntityPlayer && entity.abilities.isFlying)){
|
||||||
modifyMotion(entity, lowestLevel)
|
modifyMotion(entity, lowestLevel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,7 +87,7 @@ abstract class BlockAbstractGoo(private val fluid: FluidBase, material: Material
|
|||||||
|
|
||||||
with(entity.heeTag.getOrCreateCompound(tickTrackingKey)){
|
with(entity.heeTag.getOrCreateCompound(tickTrackingKey)){
|
||||||
val lastWorldTime = getLongOrNull(LAST_TIME_TAG) ?: (currentWorldTime - 1)
|
val lastWorldTime = getLongOrNull(LAST_TIME_TAG) ?: (currentWorldTime - 1)
|
||||||
var totalTicks = getInteger(TOTAL_TICKS_TAG)
|
var totalTicks = getInt(TOTAL_TICKS_TAG)
|
||||||
|
|
||||||
val ticksSinceLastUpdate = currentWorldTime - lastWorldTime
|
val ticksSinceLastUpdate = currentWorldTime - lastWorldTime
|
||||||
|
|
||||||
@@ -149,8 +99,8 @@ abstract class BlockAbstractGoo(private val fluid: FluidBase, material: Material
|
|||||||
++totalTicks
|
++totalTicks
|
||||||
}
|
}
|
||||||
|
|
||||||
setLong(LAST_TIME_TAG, currentWorldTime)
|
putLong(LAST_TIME_TAG, currentWorldTime)
|
||||||
setInteger(TOTAL_TICKS_TAG, totalTicks)
|
putInt(TOTAL_TICKS_TAG, totalTicks)
|
||||||
|
|
||||||
return totalTicks
|
return totalTicks
|
||||||
}
|
}
|
||||||
@@ -159,14 +109,12 @@ abstract class BlockAbstractGoo(private val fluid: FluidBase, material: Material
|
|||||||
abstract fun onInsideGoo(entity: Entity)
|
abstract fun onInsideGoo(entity: Entity)
|
||||||
abstract fun modifyMotion(entity: Entity, level: Int)
|
abstract fun modifyMotion(entity: Entity, level: Int)
|
||||||
|
|
||||||
// Colors
|
override fun getMaterialColor(state: BlockState, world: IBlockReader, pos: BlockPos): MaterialColor{
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
|
||||||
override fun getFogColor(world: World, pos: BlockPos, state: IBlockState, entity: Entity, originalColor: Vec3d, partialTicks: Float): Vec3d{
|
|
||||||
return fluid.fogColor
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getMapColor(state: IBlockState, world: IBlockAccess, pos: BlockPos): MapColor{
|
|
||||||
return fluid.mapColor
|
return fluid.mapColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Sided(Side.CLIENT)
|
||||||
|
override fun getFogColor(state: BlockState, world: IWorldReader, pos: BlockPos, entity: Entity, originalColor: Vec3d, partialTicks: Float): Vec3d{
|
||||||
|
return fluid.fogColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@ package chylex.hee.game.block
|
|||||||
import chylex.hee.game.block.info.BlockBuilder
|
import chylex.hee.game.block.info.BlockBuilder
|
||||||
import chylex.hee.system.util.allInBox
|
import chylex.hee.system.util.allInBox
|
||||||
import chylex.hee.system.util.allInBoxMutable
|
import chylex.hee.system.util.allInBoxMutable
|
||||||
|
import chylex.hee.system.util.asVoxelShape
|
||||||
import chylex.hee.system.util.distanceTo
|
import chylex.hee.system.util.distanceTo
|
||||||
import chylex.hee.system.util.facades.Facing4
|
import chylex.hee.system.util.facades.Facing4
|
||||||
import chylex.hee.system.util.floorToInt
|
import chylex.hee.system.util.floorToInt
|
||||||
@@ -15,18 +16,18 @@ import chylex.hee.system.util.offsetUntil
|
|||||||
import chylex.hee.system.util.setAir
|
import chylex.hee.system.util.setAir
|
||||||
import chylex.hee.system.util.setBlock
|
import chylex.hee.system.util.setBlock
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.block.ITileEntityProvider
|
import net.minecraft.block.BlockRenderType.INVISIBLE
|
||||||
import net.minecraft.block.state.BlockFaceShape.UNDEFINED
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.state.IBlockState
|
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.util.EnumBlockRenderType.INVISIBLE
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.util.EnumFacing
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB
|
import net.minecraft.util.math.AxisAlignedBB
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.IBlockAccess
|
import net.minecraft.util.math.shapes.ISelectionContext
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShape
|
||||||
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
|
||||||
abstract class BlockAbstractPortal(builder: BlockBuilder) : BlockSimple(builder), ITileEntityProvider{
|
abstract class BlockAbstractPortal(builder: BlockBuilder) : BlockSimpleShaped(builder, AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 0.75, 1.0)){
|
||||||
companion object{
|
companion object{
|
||||||
const val MAX_DISTANCE_FROM_FRAME = 6.0
|
const val MAX_DISTANCE_FROM_FRAME = 6.0
|
||||||
const val MAX_SIZE = 5
|
const val MAX_SIZE = 5
|
||||||
@@ -34,8 +35,7 @@ abstract class BlockAbstractPortal(builder: BlockBuilder) : BlockSimple(builder)
|
|||||||
const val TRANSLATION_SPEED_LONG = 600000L
|
const val TRANSLATION_SPEED_LONG = 600000L
|
||||||
const val TRANSLATION_SPEED = TRANSLATION_SPEED_LONG.toFloat()
|
const val TRANSLATION_SPEED = TRANSLATION_SPEED_LONG.toFloat()
|
||||||
|
|
||||||
private val SELECTION_AABB = AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 0.75, 1.0)
|
private val COLLISION_AABB = AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 0.025, 1.0).asVoxelShape
|
||||||
private val COLLISION_AABB = AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 0.025, 1.0)
|
|
||||||
|
|
||||||
fun findInnerArea(world: World, controllerPos: BlockPos, frameBlock: Block): Pair<BlockPos, BlockPos>?{
|
fun findInnerArea(world: World, controllerPos: BlockPos, frameBlock: Block): Pair<BlockPos, BlockPos>?{
|
||||||
val mirrorRange = 1..(MAX_SIZE + 1)
|
val mirrorRange = 1..(MAX_SIZE + 1)
|
||||||
@@ -88,19 +88,22 @@ abstract class BlockAbstractPortal(builder: BlockBuilder) : BlockSimple(builder)
|
|||||||
val clientPortalOffset: LerpedFloat
|
val clientPortalOffset: LerpedFloat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun hasTileEntity(state: BlockState): Boolean{
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract override fun createTileEntity(state: BlockState, world: IBlockReader): TileEntity
|
||||||
protected abstract fun onEntityInside(world: World, pos: BlockPos, entity: Entity)
|
protected abstract fun onEntityInside(world: World, pos: BlockPos, entity: Entity)
|
||||||
|
|
||||||
final override fun onEntityCollision(world: World, pos: BlockPos, state: IBlockState, entity: Entity){
|
final override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity){
|
||||||
if (!world.isRemote && !entity.isRiding && !entity.isBeingRidden && entity.isNonBoss && entity.posY <= pos.y + 0.05){
|
if (!world.isRemote && !entity.isPassenger && !entity.isBeingRidden && entity.isNonBoss && entity.posY <= pos.y + 0.05){
|
||||||
onEntityInside(world, pos, entity)
|
onEntityInside(world, pos, entity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun getCollisionBoundingBox(state: IBlockState, world: IBlockAccess, pos: BlockPos) = COLLISION_AABB
|
override fun getCollisionShape(state: BlockState, world: IBlockReader, pos: BlockPos, context: ISelectionContext): VoxelShape{
|
||||||
final override fun getSelectedBoundingBox(state: IBlockState, world: World, pos: BlockPos): AxisAlignedBB = SELECTION_AABB.offset(pos)
|
return COLLISION_AABB
|
||||||
final override fun getBlockFaceShape(world: IBlockAccess, state: IBlockState, pos: BlockPos, face: EnumFacing) = UNDEFINED
|
}
|
||||||
|
|
||||||
final override fun isFullCube(state: IBlockState) = false
|
final override fun getRenderType(state: BlockState) = INVISIBLE
|
||||||
final override fun isOpaqueCube(state: IBlockState) = false
|
|
||||||
final override fun getRenderType(state: IBlockState) = INVISIBLE
|
|
||||||
}
|
}
|
||||||
|
@@ -1,50 +1,28 @@
|
|||||||
package chylex.hee.game.block
|
package chylex.hee.game.block
|
||||||
import chylex.hee.game.block.info.BlockBuilder
|
import chylex.hee.game.block.info.BlockBuilder
|
||||||
import chylex.hee.game.block.util.Property
|
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
import chylex.hee.system.util.get
|
import chylex.hee.system.migration.vanilla.TextComponentTranslation
|
||||||
import chylex.hee.system.util.with
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.state.BlockStateContainer
|
|
||||||
import net.minecraft.block.state.IBlockState
|
|
||||||
import net.minecraft.client.resources.I18n
|
|
||||||
import net.minecraft.client.util.ITooltipFlag
|
import net.minecraft.client.util.ITooltipFlag
|
||||||
import net.minecraft.creativetab.CreativeTabs
|
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.util.BlockRenderLayer.CUTOUT
|
import net.minecraft.util.BlockRenderLayer.CUTOUT
|
||||||
import net.minecraft.util.NonNullList
|
import net.minecraft.util.text.ITextComponent
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.IBlockReader
|
||||||
|
|
||||||
abstract class BlockAbstractTable(builder: BlockBuilder) : BlockSimple(builder){
|
|
||||||
companion object{
|
|
||||||
const val MIN_TIER = 1
|
|
||||||
const val MAX_TIER = 3
|
|
||||||
|
|
||||||
val TIER = Property.int("tier", MIN_TIER..MAX_TIER)
|
|
||||||
}
|
|
||||||
|
|
||||||
open val minAllowedTier = MIN_TIER
|
|
||||||
|
|
||||||
|
abstract class BlockAbstractTable(builder: BlockBuilder, val tier: Int, val firstTier: Int) : BlockSimple(builder){
|
||||||
init{
|
init{
|
||||||
defaultState = blockState.baseState.with(TIER, MIN_TIER)
|
require(tier in 1..3){ "[BlockAbstractTable] tier must be in the range 1..3" }
|
||||||
|
require(firstTier <= tier){ "[BlockAbstractTable] firstTier cannot be larger than current tier" }
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun createBlockState() = BlockStateContainer(this, TIER)
|
override fun isSolid(state: BlockState): Boolean{
|
||||||
|
return true
|
||||||
final override fun getMetaFromState(state: IBlockState) = state[TIER]
|
|
||||||
final override fun getStateFromMeta(meta: Int) = this.with(TIER, meta.coerceIn(MIN_TIER, MAX_TIER))
|
|
||||||
|
|
||||||
override fun damageDropped(state: IBlockState) = state[TIER]
|
|
||||||
|
|
||||||
override fun getSubBlocks(tab: CreativeTabs, items: NonNullList<ItemStack>){
|
|
||||||
for(tier in minAllowedTier..MAX_TIER){
|
|
||||||
items.add(ItemStack(this, 1, tier))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
override fun addInformation(stack: ItemStack, world: World?, lines: MutableList<String>, flags: ITooltipFlag){
|
override fun addInformation(stack: ItemStack, world: IBlockReader?, lines: MutableList<ITextComponent>, flags: ITooltipFlag){
|
||||||
lines.add(I18n.format("tile.tooltip.hee.table_base.tier", stack.metadata))
|
lines.add(TextComponentTranslation("block.tooltip.hee.table.tier", tier))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getRenderLayer() = CUTOUT
|
override fun getRenderLayer() = CUTOUT
|
||||||
|
@@ -1,32 +1,42 @@
|
|||||||
package chylex.hee.game.block
|
package chylex.hee.game.block
|
||||||
import chylex.hee.game.block.entity.base.TileEntityBaseTable
|
import chylex.hee.game.block.entity.base.TileEntityBaseTable
|
||||||
import chylex.hee.game.block.info.BlockBuilder
|
import chylex.hee.game.block.info.BlockBuilder
|
||||||
|
import chylex.hee.system.migration.vanilla.EntityPlayer
|
||||||
import chylex.hee.system.util.getTile
|
import chylex.hee.system.util.getTile
|
||||||
import net.minecraft.block.ITileEntityProvider
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.state.IBlockState
|
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
|
||||||
abstract class BlockAbstractTableTile<T : TileEntityBaseTable>(builder: BlockBuilder) : BlockAbstractTable(builder), ITileEntityProvider{
|
abstract class BlockAbstractTableTile<T : TileEntityBaseTable>(builder: BlockBuilder, name: String, tier: Int, firstTier: Int) : BlockAbstractTable(builder, tier, firstTier){
|
||||||
abstract fun createNewTileEntity(): T
|
private val translationKey = "block.hee.$name"
|
||||||
|
|
||||||
final override fun createNewTileEntity(world: World, meta: Int): TileEntity{
|
override fun getTranslationKey(): String{
|
||||||
return createNewTileEntity()
|
return translationKey
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBlockHarvested(world: World, pos: BlockPos, state: IBlockState, player: EntityPlayer){
|
abstract fun createTileEntity(): T
|
||||||
|
|
||||||
|
override fun hasTileEntity(state: BlockState): Boolean{
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
final override fun createTileEntity(state: BlockState, world: IBlockReader): TileEntity{
|
||||||
|
return createTileEntity()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBlockHarvested(world: World, pos: BlockPos, state: BlockState, player: EntityPlayer){
|
||||||
if (!world.isRemote && player.isCreative){
|
if (!world.isRemote && player.isCreative){
|
||||||
pos.getTile<TileEntityBaseTable>(world)?.onTableDestroyed(dropTableLink = false)
|
pos.getTile<TileEntityBaseTable>(world)?.onTableDestroyed(dropTableLink = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun breakBlock(world: World, pos: BlockPos, state: IBlockState){
|
override fun onReplaced(state: BlockState, world: World, pos: BlockPos, newState: BlockState, isMoving: Boolean){
|
||||||
if (!world.isRemote){
|
if (newState.block !== this){
|
||||||
pos.getTile<TileEntityBaseTable>(world)?.onTableDestroyed(dropTableLink = true)
|
pos.getTile<TileEntityBaseTable>(world)?.onTableDestroyed(dropTableLink = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
super.breakBlock(world, pos, state)
|
super.onReplaced(state, world, pos, newState, isMoving)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,36 +1,30 @@
|
|||||||
package chylex.hee.game.block
|
package chylex.hee.game.block
|
||||||
import chylex.hee.game.block.info.Materials
|
import chylex.hee.game.block.info.BlockBuilder
|
||||||
import chylex.hee.init.ModLoot
|
|
||||||
import chylex.hee.system.migration.Hand.MAIN_HAND
|
import chylex.hee.system.migration.Hand.MAIN_HAND
|
||||||
import chylex.hee.system.migration.forge.SubscribeEvent
|
import chylex.hee.system.migration.forge.SubscribeEvent
|
||||||
|
import chylex.hee.system.migration.vanilla.BlockWeb
|
||||||
|
import chylex.hee.system.migration.vanilla.EntityItem
|
||||||
|
import chylex.hee.system.migration.vanilla.EntityLivingBase
|
||||||
|
import chylex.hee.system.migration.vanilla.EntityMob
|
||||||
|
import chylex.hee.system.migration.vanilla.EntityPlayer
|
||||||
|
import chylex.hee.system.migration.vanilla.ItemShears
|
||||||
|
import chylex.hee.system.migration.vanilla.ItemSword
|
||||||
import chylex.hee.system.util.breakBlock
|
import chylex.hee.system.util.breakBlock
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.material.MapColor
|
|
||||||
import net.minecraft.block.state.BlockFaceShape.UNDEFINED
|
|
||||||
import net.minecraft.block.state.IBlockState
|
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.EntityLivingBase
|
|
||||||
import net.minecraft.entity.item.EntityItem
|
|
||||||
import net.minecraft.entity.monster.EntityMob
|
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
|
||||||
import net.minecraft.item.ItemShears
|
|
||||||
import net.minecraft.item.ItemStack
|
|
||||||
import net.minecraft.item.ItemSword
|
|
||||||
import net.minecraft.util.BlockRenderLayer.CUTOUT
|
|
||||||
import net.minecraft.util.EnumFacing
|
|
||||||
import net.minecraft.util.NonNullList
|
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.IBlockAccess
|
import net.minecraft.util.math.Vec3d
|
||||||
|
import net.minecraft.util.math.shapes.ISelectionContext
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShape
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShapes
|
||||||
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.common.MinecraftForge
|
import net.minecraftforge.common.MinecraftForge
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed
|
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
|
|
||||||
class BlockAncientCobweb : Block(Materials.ANCIENT_COBWEB, MapColor.CLOTH){
|
class BlockAncientCobweb(builder: BlockBuilder) : BlockWeb(builder.p){
|
||||||
init{
|
init{
|
||||||
setHardness(0.2F)
|
|
||||||
setLightOpacity(1)
|
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(this)
|
MinecraftForge.EVENT_BUS.register(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +34,7 @@ class BlockAncientCobweb : Block(Materials.ANCIENT_COBWEB, MapColor.CLOTH){
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val item = e.entityPlayer.getHeldItem(MAIN_HAND).item
|
val item = e.player.getHeldItem(MAIN_HAND).item
|
||||||
|
|
||||||
if (item is ItemSword){
|
if (item is ItemSword){
|
||||||
e.newSpeed = e.originalSpeed * 15.8F
|
e.newSpeed = e.originalSpeed * 15.8F
|
||||||
@@ -50,39 +44,29 @@ class BlockAncientCobweb : Block(Materials.ANCIENT_COBWEB, MapColor.CLOTH){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateTick(world: World, pos: BlockPos, state: IBlockState, rand: Random){
|
override fun tick(state: BlockState, world: World, pos: BlockPos, rand: Random){
|
||||||
pos.breakBlock(world, true)
|
pos.breakBlock(world, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getDrops(drops: NonNullList<ItemStack>, world: IBlockAccess, pos: BlockPos, state: IBlockState, fortune: Int){
|
override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity){
|
||||||
ModLoot.ANCIENT_COBWEB.generateDrops(drops, world, fortune)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun canSilkHarvest() = true
|
|
||||||
|
|
||||||
override fun onEntityCollision(world: World, pos: BlockPos, state: IBlockState, entity: Entity){
|
|
||||||
if (entity is EntityItem){
|
if (entity is EntityItem){
|
||||||
entity.setInWeb()
|
entity.setMotionMultiplier(state, Vec3d(0.6, 0.6, 0.6))
|
||||||
entity.motionY = -0.25
|
|
||||||
}
|
}
|
||||||
else if (!world.isRemote){
|
else if (!world.isRemote){
|
||||||
val canBreak = when(entity){
|
val canBreak = when(entity){
|
||||||
is EntityPlayer -> !entity.capabilities.isFlying
|
is EntityPlayer -> !entity.abilities.isFlying
|
||||||
is EntityMob -> entity.attackTarget != null && (entity.width * entity.height) > 0.5F
|
is EntityMob -> entity.attackTarget != null && (entity.width * entity.height) > 0.5F
|
||||||
is EntityLivingBase -> false
|
is EntityLivingBase -> false
|
||||||
else -> true
|
else -> true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canBreak){
|
if (canBreak){
|
||||||
world.scheduleUpdate(pos, this, 1) // delay required to avoid client-side particle crash
|
world.pendingBlockTicks.scheduleTick(pos, this, 1) // delay required to avoid client-side particle crash
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getCollisionBoundingBox(state: IBlockState, world: IBlockAccess, pos: BlockPos) = NULL_AABB
|
override fun getCollisionShape(state: BlockState, world: IBlockReader, pos: BlockPos, context: ISelectionContext): VoxelShape {
|
||||||
override fun getBlockFaceShape(world: IBlockAccess, state: IBlockState, pos: BlockPos, face: EnumFacing) = UNDEFINED
|
return VoxelShapes.empty()
|
||||||
|
}
|
||||||
override fun isFullCube(state: IBlockState) = false
|
|
||||||
override fun isOpaqueCube(state: IBlockState) = false
|
|
||||||
override fun getRenderLayer() = CUTOUT
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,32 @@
|
|||||||
|
package chylex.hee.game.block
|
||||||
|
import chylex.hee.game.block.entity.TileEntityBrewingStandCustom
|
||||||
|
import chylex.hee.game.block.info.BlockBuilder
|
||||||
|
import chylex.hee.init.ModContainers
|
||||||
|
import chylex.hee.system.migration.vanilla.BlockBrewingStand
|
||||||
|
import chylex.hee.system.migration.vanilla.EntityPlayer
|
||||||
|
import chylex.hee.system.util.getTile
|
||||||
|
import net.minecraft.block.BlockState
|
||||||
|
import net.minecraft.tileentity.TileEntity
|
||||||
|
import net.minecraft.util.Hand
|
||||||
|
import net.minecraft.util.math.BlockPos
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult
|
||||||
|
import net.minecraft.world.IBlockReader
|
||||||
|
import net.minecraft.world.World
|
||||||
|
|
||||||
|
open class BlockBrewingStandCustom(builder: BlockBuilder) : BlockBrewingStand(builder.p){
|
||||||
|
override fun createTileEntity(state: BlockState, world: IBlockReader): TileEntity{
|
||||||
|
return TileEntityBrewingStandCustom()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBlockActivated(state: BlockState, world: World, pos: BlockPos, player: EntityPlayer, hand: Hand, hit: BlockRayTraceResult): Boolean{
|
||||||
|
if (world.isRemote){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
pos.getTile<TileEntityBrewingStandCustom>(world)?.let {
|
||||||
|
ModContainers.open(player, it, pos)
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@@ -1,39 +0,0 @@
|
|||||||
package chylex.hee.game.block
|
|
||||||
import chylex.hee.game.block.entity.TileEntityBrewingStandCustom
|
|
||||||
import chylex.hee.game.block.info.BlockBuilder
|
|
||||||
import chylex.hee.game.block.info.BlockBuilder.Companion.setupBlockProperties
|
|
||||||
import chylex.hee.init.ModGuiHandler.GuiType
|
|
||||||
import chylex.hee.system.migration.vanilla.Blocks
|
|
||||||
import chylex.hee.system.util.getTile
|
|
||||||
import chylex.hee.system.util.translationKeyOriginal
|
|
||||||
import net.minecraft.block.BlockBrewingStand
|
|
||||||
import net.minecraft.block.state.IBlockState
|
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
|
||||||
import net.minecraft.tileentity.TileEntity
|
|
||||||
import net.minecraft.util.EnumFacing
|
|
||||||
import net.minecraft.util.EnumHand
|
|
||||||
import net.minecraft.util.math.BlockPos
|
|
||||||
import net.minecraft.world.World
|
|
||||||
|
|
||||||
open class BlockBrewingStandOverride(builder: BlockBuilder) : BlockBrewingStand(){
|
|
||||||
init{
|
|
||||||
setupBlockProperties(builder)
|
|
||||||
translationKey = Blocks.BREWING_STAND.translationKeyOriginal
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createNewTileEntity(world: World, meta: Int): TileEntity{
|
|
||||||
return TileEntityBrewingStandCustom()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBlockActivated(world: World, pos: BlockPos, state: IBlockState, player: EntityPlayer, hand: EnumHand, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float): Boolean{
|
|
||||||
if (world.isRemote){
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
pos.getTile<TileEntityBrewingStandCustom>(world)?.let {
|
|
||||||
GuiType.BREWING_STAND.open(player, pos.x, pos.y, pos.z)
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,8 +1,9 @@
|
|||||||
package chylex.hee.game.block
|
package chylex.hee.game.block
|
||||||
|
import chylex.hee.game.block.info.BlockBuilder
|
||||||
import chylex.hee.system.migration.vanilla.Items
|
import chylex.hee.system.migration.vanilla.Items
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
|
||||||
class BlockCauldronWithDragonsBreath : BlockAbstractCauldron(){
|
class BlockCauldronWithDragonsBreath(builder: BlockBuilder) : BlockAbstractCauldron(builder){
|
||||||
override fun createFilledBucket(): ItemStack?{
|
override fun createFilledBucket(): ItemStack?{
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
@@ -1,27 +1,24 @@
|
|||||||
package chylex.hee.game.block
|
package chylex.hee.game.block
|
||||||
|
import chylex.hee.game.block.info.BlockBuilder
|
||||||
import chylex.hee.game.mechanics.potion.brewing.PotionItems
|
import chylex.hee.game.mechanics.potion.brewing.PotionItems
|
||||||
import chylex.hee.system.migration.vanilla.Items
|
import chylex.hee.system.migration.vanilla.Items
|
||||||
import chylex.hee.system.migration.vanilla.PotionTypes
|
import chylex.hee.system.migration.vanilla.PotionTypes
|
||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
|
||||||
class BlockCauldronWithGoo(private val goo: BlockAbstractGoo) : BlockAbstractCauldron(){
|
class BlockCauldronWithGoo(builder: BlockBuilder, private val goo: BlockAbstractGoo) : BlockAbstractCauldron(builder){
|
||||||
init{
|
|
||||||
setHardness(2F)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createFilledBucket(): ItemStack?{
|
override fun createFilledBucket(): ItemStack?{
|
||||||
return ItemStack(goo.filledBucket)
|
return ItemStack(goo.fluid.filledBucket)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createFilledBottle(): ItemStack?{
|
override fun createFilledBottle(): ItemStack?{
|
||||||
return PotionItems.getBottle(Items.POTIONITEM, PotionTypes.THICK)
|
return PotionItems.getBottle(Items.POTION, PotionTypes.THICK)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEntityCollision(world: World, pos: BlockPos, state: IBlockState, entity: Entity){
|
override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity){
|
||||||
goo.onInsideGoo(entity)
|
goo.onInsideGoo(entity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,59 +0,0 @@
|
|||||||
package chylex.hee.game.block
|
|
||||||
import chylex.hee.init.ModBlocks
|
|
||||||
import chylex.hee.init.ModLoot
|
|
||||||
import chylex.hee.system.migration.vanilla.Blocks
|
|
||||||
import chylex.hee.system.util.facades.Facing4
|
|
||||||
import chylex.hee.system.util.get
|
|
||||||
import chylex.hee.system.util.getBlock
|
|
||||||
import chylex.hee.system.util.isAir
|
|
||||||
import chylex.hee.system.util.translationKeyOriginal
|
|
||||||
import chylex.hee.system.util.with
|
|
||||||
import net.minecraft.block.BlockChorusPlant
|
|
||||||
import net.minecraft.block.state.IBlockState
|
|
||||||
import net.minecraft.item.ItemStack
|
|
||||||
import net.minecraft.util.NonNullList
|
|
||||||
import net.minecraft.util.math.BlockPos
|
|
||||||
import net.minecraft.world.IBlockAccess
|
|
||||||
import net.minecraft.world.World
|
|
||||||
|
|
||||||
class BlockChorusPlantOverride : BlockChorusPlant(){
|
|
||||||
init{
|
|
||||||
val source = Blocks.CHORUS_PLANT
|
|
||||||
|
|
||||||
setHardness(source.blockHardness)
|
|
||||||
soundType = source.blockSoundType
|
|
||||||
translationKey = source.translationKeyOriginal
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getDrops(drops: NonNullList<ItemStack>, world: IBlockAccess, pos: BlockPos, state: IBlockState, fortune: Int){
|
|
||||||
ModLoot.CHORUS_PLANT.generateDrops(drops, world, fortune)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun canSurviveAt(world: World, pos: BlockPos): Boolean{
|
|
||||||
val supportPos = pos.down()
|
|
||||||
val isAirAboveAndBelow = pos.up().isAir(world) && supportPos.isAir(world)
|
|
||||||
|
|
||||||
for(adjacentPlantPos in Facing4.map(pos::offset)){
|
|
||||||
if (adjacentPlantPos.getBlock(world) === this){
|
|
||||||
if (!isAirAboveAndBelow){
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
val blockBelowAdjacent = adjacentPlantPos.down().getBlock(world)
|
|
||||||
|
|
||||||
if (blockBelowAdjacent === this || blockBelowAdjacent === ModBlocks.HUMUS){
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val supportBlock = supportPos.getBlock(world)
|
|
||||||
return supportBlock === this || supportBlock === ModBlocks.HUMUS
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getActualState(state: IBlockState, world: IBlockAccess, pos: BlockPos): IBlockState{
|
|
||||||
return super.getActualState(state, world, pos).let {
|
|
||||||
if (it[DOWN]) it else it.with(DOWN, pos.down().getBlock(world) === ModBlocks.HUMUS)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -17,40 +17,38 @@ import chylex.hee.game.mechanics.damage.IDamageProcessor.Companion.MAGIC_TYPE
|
|||||||
import chylex.hee.game.mechanics.damage.IDamageProcessor.Companion.NUDITY_DANGER
|
import chylex.hee.game.mechanics.damage.IDamageProcessor.Companion.NUDITY_DANGER
|
||||||
import chylex.hee.game.mechanics.damage.IDamageProcessor.Companion.RAPID_DAMAGE
|
import chylex.hee.game.mechanics.damage.IDamageProcessor.Companion.RAPID_DAMAGE
|
||||||
import chylex.hee.game.particle.ParticleCorruptedEnergy
|
import chylex.hee.game.particle.ParticleCorruptedEnergy
|
||||||
import chylex.hee.game.particle.ParticleTeleport.Data
|
|
||||||
import chylex.hee.game.particle.spawner.ParticleSpawnerCustom
|
import chylex.hee.game.particle.spawner.ParticleSpawnerCustom
|
||||||
import chylex.hee.game.particle.util.IOffset.InBox
|
import chylex.hee.game.particle.util.IOffset.InBox
|
||||||
import chylex.hee.game.particle.util.IShape.Point
|
import chylex.hee.game.particle.util.IShape.Point
|
||||||
import chylex.hee.init.ModBlocks
|
import chylex.hee.init.ModBlocks
|
||||||
import chylex.hee.system.migration.forge.Side
|
import chylex.hee.system.migration.forge.Side
|
||||||
import chylex.hee.system.migration.forge.Sided
|
import chylex.hee.system.migration.forge.Sided
|
||||||
|
import chylex.hee.system.migration.vanilla.EntityLivingBase
|
||||||
import chylex.hee.system.util.FLAG_NONE
|
import chylex.hee.system.util.FLAG_NONE
|
||||||
import chylex.hee.system.util.FLAG_SYNC_CLIENT
|
import chylex.hee.system.util.FLAG_SYNC_CLIENT
|
||||||
import chylex.hee.system.util.facades.Facing6
|
import chylex.hee.system.util.facades.Facing6
|
||||||
import chylex.hee.system.util.get
|
|
||||||
import chylex.hee.system.util.getState
|
import chylex.hee.system.util.getState
|
||||||
import chylex.hee.system.util.getTile
|
import chylex.hee.system.util.getTile
|
||||||
import chylex.hee.system.util.nextInt
|
import chylex.hee.system.util.nextInt
|
||||||
|
import chylex.hee.system.util.removeBlock
|
||||||
import chylex.hee.system.util.removeItem
|
import chylex.hee.system.util.removeItem
|
||||||
import chylex.hee.system.util.setAir
|
|
||||||
import chylex.hee.system.util.setState
|
import chylex.hee.system.util.setState
|
||||||
import chylex.hee.system.util.with
|
import chylex.hee.system.util.with
|
||||||
import net.minecraft.block.state.BlockFaceShape.UNDEFINED
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.block.state.BlockStateContainer
|
import net.minecraft.block.BlockRenderType.INVISIBLE
|
||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.EntityLivingBase
|
import net.minecraft.state.StateContainer.Builder
|
||||||
import net.minecraft.util.EnumBlockRenderType.INVISIBLE
|
|
||||||
import net.minecraft.util.EnumFacing
|
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.IBlockAccess
|
import net.minecraft.world.IBlockReader
|
||||||
|
import net.minecraft.world.IWorldReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
|
|
||||||
class BlockCorruptedEnergy(builder: BlockBuilder) : BlockSimple(builder){
|
class BlockCorruptedEnergy(builder: BlockBuilder) : BlockSimple(builder){
|
||||||
companion object{
|
companion object{
|
||||||
private const val MIN_LEVEL = 0
|
private const val MIN_LEVEL = 0
|
||||||
private const val MAX_LEVEL = 15 // UPDATE: extend to 20
|
private const val MAX_LEVEL = 20
|
||||||
|
|
||||||
private const val MAX_TICK_RATE = 5
|
private const val MAX_TICK_RATE = 5
|
||||||
private const val MIN_TICK_RATE = 1
|
private const val MIN_TICK_RATE = 1
|
||||||
@@ -62,7 +60,6 @@ class BlockCorruptedEnergy(builder: BlockBuilder) : BlockSimple(builder){
|
|||||||
|
|
||||||
private val PARTICLE_CORRUPTION = ParticleSpawnerCustom(
|
private val PARTICLE_CORRUPTION = ParticleSpawnerCustom(
|
||||||
type = ParticleCorruptedEnergy,
|
type = ParticleCorruptedEnergy,
|
||||||
data = Data(lifespan = 8..12, scale = (2.5F)..(5.0F)),
|
|
||||||
pos = InBox(0.75F),
|
pos = InBox(0.75F),
|
||||||
mot = InBox(0.05F),
|
mot = InBox(0.05F),
|
||||||
hideOnMinimalSetting = false
|
hideOnMinimalSetting = false
|
||||||
@@ -77,12 +74,10 @@ class BlockCorruptedEnergy(builder: BlockBuilder) : BlockSimple(builder){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init{
|
override fun fillStateContainer(container: Builder<Block, BlockState>){
|
||||||
needsRandomTick = true // just to be safe
|
container.add(LEVEL)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createBlockState() = BlockStateContainer(this, LEVEL)
|
|
||||||
|
|
||||||
// Utility methods
|
// Utility methods
|
||||||
|
|
||||||
enum class SpawnResult{
|
enum class SpawnResult{
|
||||||
@@ -116,7 +111,7 @@ class BlockCorruptedEnergy(builder: BlockBuilder) : BlockSimple(builder){
|
|||||||
return PASSTHROUGH
|
return PASSTHROUGH
|
||||||
}
|
}
|
||||||
else if (!currentBlock.isAir(currentState, world, pos)){
|
else if (!currentBlock.isAir(currentState, world, pos)){
|
||||||
return if (currentState.isNormalCube)
|
return if (currentState.isNormalCube(world, pos))
|
||||||
FAIL
|
FAIL
|
||||||
else
|
else
|
||||||
PASSTHROUGH
|
PASSTHROUGH
|
||||||
@@ -128,21 +123,21 @@ class BlockCorruptedEnergy(builder: BlockBuilder) : BlockSimple(builder){
|
|||||||
|
|
||||||
// Tick handling
|
// Tick handling
|
||||||
|
|
||||||
override fun tickRate(world: World): Int{
|
override fun tickRate(world: IWorldReader): Int{
|
||||||
return MAX_TICK_RATE
|
return MAX_TICK_RATE
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBlockAdded(world: World, pos: BlockPos, state: IBlockState){
|
override fun onBlockAdded(state: BlockState, world: World, pos: BlockPos, oldState: BlockState, isMoving: Boolean){
|
||||||
world.scheduleUpdate(pos, this, tickRateForLevel(state[LEVEL]))
|
world.pendingBlockTicks.scheduleTick(pos, this, tickRateForLevel(state[LEVEL]))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun randomTick(world: World, pos: BlockPos, state: IBlockState, rand: Random){
|
override fun randomTick(state: BlockState, world: World, pos: BlockPos, rand: Random){
|
||||||
if (!world.isUpdateScheduled(pos, this)){
|
if (!world.pendingBlockTicks.isTickScheduled(pos, this)){
|
||||||
pos.setAir(world)
|
pos.removeBlock(world)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateTick(world: World, pos: BlockPos, state: IBlockState, rand: Random){
|
override fun tick(state: BlockState, world: World, pos: BlockPos, rand: Random){
|
||||||
val level = state[LEVEL]
|
val level = state[LEVEL]
|
||||||
val remainingFacings = Facing6.toMutableList()
|
val remainingFacings = Facing6.toMutableList()
|
||||||
|
|
||||||
@@ -161,27 +156,27 @@ class BlockCorruptedEnergy(builder: BlockBuilder) : BlockSimple(builder){
|
|||||||
val decreaseToLevel = level - rand.nextInt(1, 2)
|
val decreaseToLevel = level - rand.nextInt(1, 2)
|
||||||
|
|
||||||
if (decreaseToLevel < MIN_LEVEL){
|
if (decreaseToLevel < MIN_LEVEL){
|
||||||
pos.setAir(world)
|
pos.removeBlock(world)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
pos.setState(world, state.with(LEVEL, decreaseToLevel), FLAG_NONE) // does not call onBlockAdded for the same Block instance
|
pos.setState(world, state.with(LEVEL, decreaseToLevel), FLAG_NONE) // does not call onBlockAdded for the same Block instance
|
||||||
}
|
}
|
||||||
|
|
||||||
world.scheduleUpdate(pos, this, tickRateForLevel(level))
|
world.pendingBlockTicks.scheduleTick(pos, this, tickRateForLevel(level))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interactions
|
// Interactions
|
||||||
|
|
||||||
override fun isAir(state: IBlockState, world: IBlockAccess, pos: BlockPos): Boolean{
|
override fun isAir(state: BlockState, world: IBlockReader, pos: BlockPos): Boolean{
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun canCollideCheck(state: IBlockState, hitIfLiquid: Boolean): Boolean{ // actually used for raytracing, not entity collisions
|
override fun propagatesSkylightDown(state: BlockState, world: IBlockReader, pos: BlockPos): Boolean{
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEntityCollision(world: World, pos: BlockPos, state: IBlockState, entity: Entity){
|
override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity){
|
||||||
if (!world.isRemote && entity is EntityLivingBase && !isEntityTolerant(entity)){
|
if (!world.isRemote && entity is EntityLivingBase && !isEntityTolerant(entity)){
|
||||||
CombinedDamage(
|
CombinedDamage(
|
||||||
DAMAGE_PART_NORMAL to 0.75F,
|
DAMAGE_PART_NORMAL to 0.75F,
|
||||||
@@ -193,25 +188,20 @@ class BlockCorruptedEnergy(builder: BlockBuilder) : BlockSimple(builder){
|
|||||||
// Client side
|
// Client side
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
override fun randomDisplayTick(state: IBlockState, world: World, pos: BlockPos, rand: Random){
|
override fun animateTick(state: BlockState, world: World, pos: BlockPos, rand: Random){
|
||||||
val amount = rand.nextInt(0, 2)
|
val amount = rand.nextInt(0, 2)
|
||||||
|
|
||||||
if (amount > 0){
|
if (amount > 0){
|
||||||
PARTICLE_CORRUPTION.spawn(Point(pos, amount), rand) // TODO figure out how to show particles outside randomDisplayTick range
|
PARTICLE_CORRUPTION.spawn(Point(pos, amount), rand) // TODO figure out how to show particles outside animateTick range
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// General
|
@Sided(Side.CLIENT)
|
||||||
|
override fun getAmbientOcclusionLightValue(state: BlockState, world: IBlockReader, pos: BlockPos): Float{
|
||||||
|
return 1F
|
||||||
|
}
|
||||||
|
|
||||||
override fun getMetaFromState(state: IBlockState) = state[LEVEL]
|
override fun getRenderType(state: BlockState) = INVISIBLE
|
||||||
override fun getStateFromMeta(meta: Int) = this.with(LEVEL, meta)
|
|
||||||
|
|
||||||
override fun getCollisionBoundingBox(state: IBlockState, world: IBlockAccess, pos: BlockPos) = NULL_AABB
|
|
||||||
override fun getBlockFaceShape(world: IBlockAccess, state: IBlockState, pos: BlockPos, face: EnumFacing) = UNDEFINED
|
|
||||||
|
|
||||||
override fun isFullCube(state: IBlockState) = false
|
|
||||||
override fun isOpaqueCube(state: IBlockState) = false
|
|
||||||
override fun getRenderType(state: IBlockState) = INVISIBLE
|
|
||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
// override fun getRenderLayer() = CUTOUT
|
// override fun getRenderLayer() = CUTOUT
|
||||||
|
@@ -1,29 +1,21 @@
|
|||||||
package chylex.hee.game.block
|
package chylex.hee.game.block
|
||||||
import chylex.hee.game.block.entity.TileEntityDarkChest
|
import chylex.hee.game.block.entity.TileEntityDarkChest
|
||||||
import chylex.hee.game.block.info.BlockBuilder
|
import chylex.hee.game.block.info.BlockBuilder
|
||||||
import chylex.hee.game.block.info.BlockBuilder.Companion.setupBlockProperties
|
|
||||||
import chylex.hee.game.entity.living.ai.AIOcelotSitOverride.IOcelotCanSitOn
|
import chylex.hee.game.entity.living.ai.AIOcelotSitOverride.IOcelotCanSitOn
|
||||||
import chylex.hee.system.util.getTile
|
import chylex.hee.system.migration.vanilla.BlockChest
|
||||||
import net.minecraft.block.BlockChest
|
import chylex.hee.system.migration.vanilla.TileEntityChest
|
||||||
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraftforge.common.util.EnumHelper
|
import net.minecraft.world.IWorldReader
|
||||||
|
|
||||||
class BlockDarkChest(builder: BlockBuilder) : BlockChest(TYPE), IOcelotCanSitOn{
|
class BlockDarkChest(builder: BlockBuilder) : BlockChest(builder.p), IOcelotCanSitOn{
|
||||||
companion object{
|
override fun createTileEntity(state: BlockState, world: IBlockReader): TileEntity{
|
||||||
val TYPE = EnumHelper.addEnum(Type::class.java, "HEE_DARK", emptyArray())!!
|
|
||||||
}
|
|
||||||
|
|
||||||
init{
|
|
||||||
setupBlockProperties(builder)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createNewTileEntity(world: World, meta: Int): TileEntity{
|
|
||||||
return TileEntityDarkChest()
|
return TileEntityDarkChest()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun canOcelotSitOn(world: World, pos: BlockPos): Boolean{
|
override fun canOcelotSitOn(world: IWorldReader, pos: BlockPos): Boolean{
|
||||||
return pos.getTile<TileEntityDarkChest>(world)?.let { it.numPlayersUsing < 1 } == true
|
return TileEntityChest.getPlayersUsing(world, pos) < 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user