mirror of
https://github.com/chylex/Hardcore-Ender-Expansion-2.git
synced 2025-09-15 05:32:10 +02:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
f091eb20b2 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -14,7 +14,6 @@ out
|
||||
!.idea/kotlinc.xml
|
||||
!.idea/statistic.xml
|
||||
!.idea/vcs.xml
|
||||
!.idea/shelf
|
||||
|
||||
# eclipse
|
||||
bin
|
||||
|
2
.idea/gradle.xml
generated
2
.idea/gradle.xml
generated
@@ -4,8 +4,6 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="delegatedBuild" value="true" />
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
|
3
.idea/misc.xml
generated
3
.idea/misc.xml
generated
@@ -14,6 +14,7 @@
|
||||
<item index="9" class="java.lang.String" itemvalue="net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.Name" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
@@ -66,4 +67,4 @@
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 DCEVM" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/bin" />
|
||||
</component>
|
||||
</project>
|
||||
</project>
|
||||
|
4
.idea/shelf/Datagen_Recipes.xml
generated
4
.idea/shelf/Datagen_Recipes.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Datagen_Recipes" date="1601734824200" recycled="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Datagen_Recipes/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Datagen Recipes" />
|
||||
</changelist>
|
79
.idea/shelf/Datagen_Recipes/shelved.patch
generated
79
.idea/shelf/Datagen_Recipes/shelved.patch
generated
@@ -1,79 +0,0 @@
|
||||
Index: data/src/main/java/chylex/hee/datagen/DataGen.kt
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
||||
<+>package chylex.hee.datagen\nimport chylex.hee.HEE\nimport chylex.hee.datagen.client.BlockItemModels\nimport chylex.hee.datagen.client.BlockModels\nimport chylex.hee.datagen.client.BlockStates\nimport chylex.hee.datagen.client.ItemModels\nimport chylex.hee.system.forge.SubscribeAllEvents\nimport chylex.hee.system.forge.SubscribeEvent\nimport net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD\nimport net.minecraftforge.fml.event.lifecycle.GatherDataEvent\n\n@SubscribeAllEvents(modid = HEE.ID, bus = MOD)\nobject DataGen{\n\t@SubscribeEvent\n\tfun register(e: GatherDataEvent){\n\t\tval modid = HEE.ID\n\t\tval helper = e.existingFileHelper\n\t\t\n\t\twith(e.generator){\n\t\t\tif (e.includeClient()){\n\t\t\t\taddProvider(BlockStates(this, modid, helper))\n\t\t\t\taddProvider(BlockModels(this, modid, helper))\n\t\t\t\taddProvider(BlockItemModels(this, modid, helper))\n\t\t\t\taddProvider(ItemModels(this, modid, helper))\n\t\t\t}\n\t\t}\n\t}\n}\n
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- a/data/src/main/java/chylex/hee/datagen/DataGen.kt (revision f8888e0a3b33898551301124a0879cea12fc1f06)
|
||||
+++ b/data/src/main/java/chylex/hee/datagen/DataGen.kt (date 1601732788951)
|
||||
@@ -4,6 +4,7 @@
|
||||
import chylex.hee.datagen.client.BlockModels
|
||||
import chylex.hee.datagen.client.BlockStates
|
||||
import chylex.hee.datagen.client.ItemModels
|
||||
+import chylex.hee.datagen.server.Recipes
|
||||
import chylex.hee.system.forge.SubscribeAllEvents
|
||||
import chylex.hee.system.forge.SubscribeEvent
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
|
||||
@@ -23,6 +24,10 @@
|
||||
addProvider(BlockItemModels(this, modid, helper))
|
||||
addProvider(ItemModels(this, modid, helper))
|
||||
}
|
||||
+
|
||||
+ if (e.includeServer()){
|
||||
+ addProvider(Recipes(this))
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
Index: data/src/main/java/chylex/hee/datagen/server/Recipes.kt
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- /dev/null (date 1601733265753)
|
||||
+++ b/data/src/main/java/chylex/hee/datagen/server/Recipes.kt (date 1601733265753)
|
||||
@@ -0,0 +1,15 @@
|
||||
+package chylex.hee.datagen.server
|
||||
+import chylex.hee.datagen.server.util.ingredients
|
||||
+import chylex.hee.datagen.server.util.shapeless
|
||||
+import chylex.hee.init.ModItems
|
||||
+import net.minecraft.data.DataGenerator
|
||||
+import net.minecraft.data.IFinishedRecipe
|
||||
+import net.minecraft.data.RecipeProvider
|
||||
+import net.minecraft.item.Items
|
||||
+import java.util.function.Consumer
|
||||
+
|
||||
+class Recipes(generator: DataGenerator) : RecipeProvider(generator){
|
||||
+ override fun registerRecipes(consumer: Consumer<IFinishedRecipe>) = with(consumer){
|
||||
+ shapeless(ModItems.ALTERATION_NEXUS, 1){ ingredients(Items.DIAMOND, Items.ENDER_EYE, ModItems.ANCIENT_DUST, ModItems.ETHEREUM) }
|
||||
+ }
|
||||
+}
|
||||
Index: data/src/main/java/chylex/hee/datagen/server/util/RecipeProviderExt.kt
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- /dev/null (date 1601733249382)
|
||||
+++ b/data/src/main/java/chylex/hee/datagen/server/util/RecipeProviderExt.kt (date 1601733249382)
|
||||
@@ -0,0 +1,20 @@
|
||||
+package chylex.hee.datagen.server.util
|
||||
+import net.minecraft.data.IFinishedRecipe
|
||||
+import net.minecraft.data.ShapedRecipeBuilder
|
||||
+import net.minecraft.data.ShapelessRecipeBuilder
|
||||
+import net.minecraft.util.IItemProvider
|
||||
+import java.util.function.Consumer
|
||||
+
|
||||
+fun Consumer<IFinishedRecipe>.shaped(result: IItemProvider, amount: Int, callback: ShapedRecipeBuilder.() -> Unit){
|
||||
+ ShapedRecipeBuilder(result, amount).apply(callback).build(this)
|
||||
+}
|
||||
+
|
||||
+fun Consumer<IFinishedRecipe>.shapeless(result: IItemProvider, amount: Int, callback: ShapelessRecipeBuilder.() -> Unit){
|
||||
+ ShapelessRecipeBuilder(result, amount).apply(callback).build(this)
|
||||
+}
|
||||
+
|
||||
+fun ShapelessRecipeBuilder.ingredients(vararg ingredients: IItemProvider){
|
||||
+ for(ingredient in ingredients){
|
||||
+ this.addIngredient(ingredient)
|
||||
+ }
|
||||
+}
|
4
.idea/shelf/Development3.xml
generated
4
.idea/shelf/Development3.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Development3" date="1601983889370" recycled="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Development3/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Development" />
|
||||
</changelist>
|
18
.idea/shelf/Development3/shelved.patch
generated
18
.idea/shelf/Development3/shelved.patch
generated
File diff suppressed because one or more lines are too long
4
.idea/shelf/Dust.xml
generated
4
.idea/shelf/Dust.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Dust" date="1590783410567" recycled="false">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Dust/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Dust" />
|
||||
</changelist>
|
210
.idea/shelf/Dust/shelved.patch
generated
210
.idea/shelf/Dust/shelved.patch
generated
File diff suppressed because one or more lines are too long
4
.idea/shelf/EnderEyeAttack_kt.xml
generated
4
.idea/shelf/EnderEyeAttack_kt.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="EnderEyeAttack_kt" date="1601761992769" recycled="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/EnderEyeAttack_kt/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="EnderEyeAttack.kt" />
|
||||
</changelist>
|
32
.idea/shelf/EnderEyeAttack_kt/shelved.patch
generated
32
.idea/shelf/EnderEyeAttack_kt/shelved.patch
generated
File diff suppressed because one or more lines are too long
4
.idea/shelf/Ender_Eye.xml
generated
4
.idea/shelf/Ender_Eye.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Ender_Eye" date="1595119986895" recycled="true">
|
||||
<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
69
.idea/shelf/Ender_Eye/shelved.patch
generated
File diff suppressed because one or more lines are too long
4
.idea/shelf/Ender_Eye_Stuff.xml
generated
4
.idea/shelf/Ender_Eye_Stuff.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Ender_Eye_Stuff" date="1601351827334" recycled="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Ender_Eye_Stuff/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Ender Eye Stuff" />
|
||||
</changelist>
|
172
.idea/shelf/Ender_Eye_Stuff/shelved.patch
generated
172
.idea/shelf/Ender_Eye_Stuff/shelved.patch
generated
File diff suppressed because one or more lines are too long
4
.idea/shelf/Eye.xml
generated
4
.idea/shelf/Eye.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Eye" date="1605472809585" recycled="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Eye/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Eye" />
|
||||
</changelist>
|
723
.idea/shelf/Eye/shelved.patch
generated
723
.idea/shelf/Eye/shelved.patch
generated
File diff suppressed because one or more lines are too long
4
.idea/shelf/Ideas.xml
generated
4
.idea/shelf/Ideas.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Ideas" date="1595089578362" recycled="false">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Ideas/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Ideas" />
|
||||
</changelist>
|
54
.idea/shelf/Ideas/shelved.patch
generated
54
.idea/shelf/Ideas/shelved.patch
generated
File diff suppressed because one or more lines are too long
4
.idea/shelf/Later.xml
generated
4
.idea/shelf/Later.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Later" date="1579750352473" recycled="false">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Later/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Later" />
|
||||
</changelist>
|
36
.idea/shelf/Later/shelved.patch
generated
36
.idea/shelf/Later/shelved.patch
generated
File diff suppressed because one or more lines are too long
4
.idea/shelf/Later1.xml
generated
4
.idea/shelf/Later1.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Later1" date="1607753523089" recycled="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Later1/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Later" />
|
||||
</changelist>
|
81
.idea/shelf/Later1/shelved.patch
generated
81
.idea/shelf/Later1/shelved.patch
generated
File diff suppressed because one or more lines are too long
4
.idea/shelf/Later2.xml
generated
4
.idea/shelf/Later2.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Later2" date="1610732422264" recycled="false">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Later2/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Later" />
|
||||
</changelist>
|
19
.idea/shelf/Later2/shelved.patch
generated
19
.idea/shelf/Later2/shelved.patch
generated
@@ -1,19 +0,0 @@
|
||||
Index: src/system/src/main/java/chylex/hee/game/entity/EntitySelector.kt
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
||||
<+>package chylex.hee.game.entity\n\nimport chylex.hee.system.math.square\nimport net.minecraft.entity.Entity\nimport net.minecraft.util.math.AxisAlignedBB\nimport net.minecraft.util.math.Vec3d\nimport net.minecraft.world.IEntityReader\nimport java.util.function.Predicate\n\n@Suppress(\"NOTHING_TO_INLINE\")\nclass EntitySelector(private val world: IEntityReader, private val predicate: Predicate<in Entity>) {\n\tfun <T : Entity> inBox(cls: Class<T>, aabb: AxisAlignedBB): List<T> {\n\t\treturn world.getEntitiesWithinAABB(cls, aabb, predicate)\n\t}\n\t\n\tfun <T : Entity> inRange(cls: Class<T>, point: Vec3d, range: Double): List<T> {\n\t\tval aabb = AxisAlignedBB(point.x - range, point.y - range, point.z - range, point.x + range, point.y + range, point.z + range)\n\t\tval rangeSq = square(range)\n\t\t\n\t\treturn world.getEntitiesWithinAABB(cls, aabb) { predicate.test(it) && it!!.posVec.squareDistanceTo(point) <= rangeSq }\n\t}\n\t\n\t// Reified\n\t\n\tinline fun <reified T : Entity> inBox(aabb: AxisAlignedBB) = inBox(T::class.java, aabb)\n\tinline fun <reified T : Entity> inRange(point: Vec3d, range: Double) = inRange(T::class.java, point, range)\n\t\n\t// General\n\t\n\tinline fun allInBox(aabb: AxisAlignedBB) = inBox(Entity::class.java, aabb)\n\tinline fun allInRange(point: Vec3d, range: Double) = inRange(Entity::class.java, point, range)\n}\n
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/src/system/src/main/java/chylex/hee/game/entity/EntitySelector.kt b/src/system/src/main/java/chylex/hee/game/entity/EntitySelector.kt
|
||||
--- a/src/system/src/main/java/chylex/hee/game/entity/EntitySelector.kt (revision 276df769798cbd4fd8154c5ebca0001dd8639545)
|
||||
+++ b/src/system/src/main/java/chylex/hee/game/entity/EntitySelector.kt (date 1609259090000)
|
||||
@@ -20,6 +20,8 @@
|
||||
return world.getEntitiesWithinAABB(cls, aabb) { predicate.test(it) && it!!.posVec.squareDistanceTo(point) <= rangeSq }
|
||||
}
|
||||
|
||||
+ // TODO only loaded? fuck
|
||||
+
|
||||
// Reified
|
||||
|
||||
inline fun <reified T : Entity> inBox(aabb: AxisAlignedBB) = inBox(T::class.java, aabb)
|
4
.idea/shelf/Recipe_Datagen.xml
generated
4
.idea/shelf/Recipe_Datagen.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Recipe_Datagen" date="1601740449134" recycled="false">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Recipe_Datagen/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Recipe Datagen" />
|
||||
</changelist>
|
47
.idea/shelf/Recipe_Datagen/shelved.patch
generated
47
.idea/shelf/Recipe_Datagen/shelved.patch
generated
@@ -1,47 +0,0 @@
|
||||
Index: data/src/main/java/chylex/hee/datagen/server/Recipes.kt
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- /dev/null (date 1601740133630)
|
||||
+++ b/data/src/main/java/chylex/hee/datagen/server/Recipes.kt (date 1601740133630)
|
||||
@@ -0,0 +1,11 @@
|
||||
+package chylex.hee.datagen.server
|
||||
+import net.minecraft.data.DataGenerator
|
||||
+import net.minecraft.data.IFinishedRecipe
|
||||
+import net.minecraft.data.RecipeProvider
|
||||
+import java.util.function.Consumer
|
||||
+
|
||||
+class Recipes(generator: DataGenerator) : RecipeProvider(generator){
|
||||
+ override fun registerRecipes(consumer: Consumer<IFinishedRecipe>) = with(consumer){
|
||||
+ // shapeless(ModItems.ALTERATION_NEXUS, 1){ ingredients(Items.DIAMOND, Items.ENDER_EYE, ModItems.ANCIENT_DUST, ModItems.ETHEREUM) }
|
||||
+ }
|
||||
+}
|
||||
Index: data/src/main/java/chylex/hee/datagen/server/util/RecipeProviderExt.kt
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- /dev/null (date 1601734823610)
|
||||
+++ b/data/src/main/java/chylex/hee/datagen/server/util/RecipeProviderExt.kt (date 1601734823610)
|
||||
@@ -0,0 +1,20 @@
|
||||
+package chylex.hee.datagen.server.util
|
||||
+import net.minecraft.data.IFinishedRecipe
|
||||
+import net.minecraft.data.ShapedRecipeBuilder
|
||||
+import net.minecraft.data.ShapelessRecipeBuilder
|
||||
+import net.minecraft.util.IItemProvider
|
||||
+import java.util.function.Consumer
|
||||
+
|
||||
+fun Consumer<IFinishedRecipe>.shaped(result: IItemProvider, amount: Int, callback: ShapedRecipeBuilder.() -> Unit){
|
||||
+ ShapedRecipeBuilder(result, amount).apply(callback).build(this)
|
||||
+}
|
||||
+
|
||||
+fun Consumer<IFinishedRecipe>.shapeless(result: IItemProvider, amount: Int, callback: ShapelessRecipeBuilder.() -> Unit){
|
||||
+ ShapelessRecipeBuilder(result, amount).apply(callback).build(this)
|
||||
+}
|
||||
+
|
||||
+fun ShapelessRecipeBuilder.ingredients(vararg ingredients: IItemProvider){
|
||||
+ for(ingredient in ingredients){
|
||||
+ this.addIngredient(ingredient)
|
||||
+ }
|
||||
+}
|
4
.idea/shelf/Shulker_Box_Animation.xml
generated
4
.idea/shelf/Shulker_Box_Animation.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="Shulker_Box_Animation" date="1590248312609" recycled="false">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Shulker_Box_Animation/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Shulker Box Animation" />
|
||||
</changelist>
|
228
.idea/shelf/Shulker_Box_Animation/shelved.patch
generated
228
.idea/shelf/Shulker_Box_Animation/shelved.patch
generated
File diff suppressed because one or more lines are too long
4
.idea/shelf/StructureFile.xml
generated
4
.idea/shelf/StructureFile.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="StructureFile" date="1601888541958" recycled="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/StructureFile/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="StructureFile" />
|
||||
</changelist>
|
19
.idea/shelf/StructureFile/shelved.patch
generated
19
.idea/shelf/StructureFile/shelved.patch
generated
File diff suppressed because one or more lines are too long
4
.idea/shelf/TODO.xml
generated
4
.idea/shelf/TODO.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="TODO" date="1601072216412" recycled="false">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/TODO/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="TODO" />
|
||||
</changelist>
|
124
.idea/shelf/TODO/shelved.patch
generated
124
.idea/shelf/TODO/shelved.patch
generated
File diff suppressed because one or more lines are too long
14
.idea/shelf/Territories.xml
generated
14
.idea/shelf/Territories.xml
generated
@@ -1,14 +0,0 @@
|
||||
<changelist name="Territories" date="1593174807954" recycled="false">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Territories/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Territories" />
|
||||
<binary>
|
||||
<option name="BEFORE_PATH" />
|
||||
<option name="AFTER_PATH" value="src/main/resources/assets/hee/textures/environment/end_sky_blurry.png" />
|
||||
<option name="SHELVED_PATH" value="$PROJECT_DIR$/.idea/shelf/Territories/end_sky_blurry.png" />
|
||||
</binary>
|
||||
<binary>
|
||||
<option name="BEFORE_PATH" />
|
||||
<option name="AFTER_PATH" value="src/main/resources/assets/hee/textures/environment/end_sky_smooth.png" />
|
||||
<option name="SHELVED_PATH" value="$PROJECT_DIR$/.idea/shelf/Territories/end_sky_smooth.png" />
|
||||
</binary>
|
||||
</changelist>
|
BIN
.idea/shelf/Territories/end_sky_blurry.png
generated
BIN
.idea/shelf/Territories/end_sky_blurry.png
generated
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB |
BIN
.idea/shelf/Territories/end_sky_smooth.png
generated
BIN
.idea/shelf/Territories/end_sky_smooth.png
generated
Binary file not shown.
Before Width: | Height: | Size: 9.9 KiB |
24
.idea/shelf/Territories/shelved.patch
generated
24
.idea/shelf/Territories/shelved.patch
generated
@@ -1,24 +0,0 @@
|
||||
Index: src/main/java/chylex/hee/game/block/BlockDustyStoneUnstable.kt
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- a/src/main/java/chylex/hee/game/block/BlockDustyStoneUnstable.kt (revision f6f631f6f3dc9b347b19db913cf2be4535813fc7)
|
||||
+++ b/src/main/java/chylex/hee/game/block/BlockDustyStoneUnstable.kt (date 1590584304217)
|
||||
@@ -26,7 +26,6 @@
|
||||
import net.minecraft.util.math.shapes.EntitySelectionContext
|
||||
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 java.util.Random
|
||||
@@ -68,7 +67,7 @@
|
||||
return if (context is EntitySelectionContext && context.entity is EntityLivingBase)
|
||||
MagicValues.BLOCK_COLLISION_SHRINK_SHAPE
|
||||
else
|
||||
- VoxelShapes.fullCube()
|
||||
+ MagicValues.BLOCK_COLLISION_SHRINK_SHAPE //VoxelShapes.fullCube()
|
||||
}
|
||||
|
||||
override fun causesSuffocation(state: BlockState, world: IBlockReader, pos: BlockPos): Boolean{
|
BIN
.idea/shelf/Territories1/end_sky_blurry.png
generated
BIN
.idea/shelf/Territories1/end_sky_blurry.png
generated
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB |
BIN
.idea/shelf/Territories1/end_sky_smooth.png
generated
BIN
.idea/shelf/Territories1/end_sky_smooth.png
generated
Binary file not shown.
Before Width: | Height: | Size: 9.9 KiB |
119
.idea/shelf/Territories1/shelved.patch
generated
119
.idea/shelf/Territories1/shelved.patch
generated
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +0,0 @@
|
||||
<changelist name="Work_on_Ender_Eye_spawn_animation,_movement,_and_attack_logic" date="1601092950910" recycled="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Work_on_Ender_Eye_spawn_animation,_movement,_and_attack_logic/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Work on Ender Eye spawn animation, movement, and attack logic" />
|
||||
</changelist>
|
4
.idea/shelf/thing.xml
generated
4
.idea/shelf/thing.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="thing" date="1608060366436" recycled="false">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/thing/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="thing" />
|
||||
</changelist>
|
74
.idea/shelf/thing/shelved.patch
generated
74
.idea/shelf/thing/shelved.patch
generated
@@ -1,74 +0,0 @@
|
||||
Index: src/main/resources/hee.mixins.json
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
||||
<+>{\n \"required\": true,\n \"minVersion\": \"0.8\",\n \"package\": \"chylex.hee.mixin\",\n \"compatibilityLevel\": \"JAVA_8\",\n \"mixins\": [\n \"HookAnvilRepair\",\n \"HookBlockDrops\",\n \"HookChorusFlowerSoil\",\n \"HookChorusPlantSoil\",\n \"HookEffectCorruption\",\n \"HookEffectInstanceCorruption\",\n \"HookEndBiome\",\n \"HookEndermanParticles\",\n \"HookEndermiteParticles\",\n \"HookEntityHelmetBreaking\",\n \"HookEntityPotionCorruption\",\n \"HookFireSpread\",\n \"HookItemEntityLavaCheck\",\n \"HookLightMapColors\",\n \"HookPlayerInventoryArmorBreaking\",\n \"HookPotionCreativeMenu\",\n \"HookThornsArmorBreaking\"\n ],\n \"injectors\": {\n \"defaultRequire\": 1\n }\n}\n
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/src/main/resources/hee.mixins.json b/src/main/resources/hee.mixins.json
|
||||
--- a/src/main/resources/hee.mixins.json (revision 7f9202bceb9aa7b8fac24437a2190a87857573a7)
|
||||
+++ b/src/main/resources/hee.mixins.json (date 1608060366293)
|
||||
@@ -3,25 +3,7 @@
|
||||
"minVersion": "0.8",
|
||||
"package": "chylex.hee.mixin",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
- "mixins": [
|
||||
- "HookAnvilRepair",
|
||||
- "HookBlockDrops",
|
||||
- "HookChorusFlowerSoil",
|
||||
- "HookChorusPlantSoil",
|
||||
- "HookEffectCorruption",
|
||||
- "HookEffectInstanceCorruption",
|
||||
- "HookEndBiome",
|
||||
- "HookEndermanParticles",
|
||||
- "HookEndermiteParticles",
|
||||
- "HookEntityHelmetBreaking",
|
||||
- "HookEntityPotionCorruption",
|
||||
- "HookFireSpread",
|
||||
- "HookItemEntityLavaCheck",
|
||||
- "HookLightMapColors",
|
||||
- "HookPlayerInventoryArmorBreaking",
|
||||
- "HookPotionCreativeMenu",
|
||||
- "HookThornsArmorBreaking"
|
||||
- ],
|
||||
+ "mixins": [ "HookAnvilRepair", "HookBlockDrops", "HookChorusFlowerSoil", "HookChorusPlantSoil", "HookEffectCorruption", "HookEffectInstanceCorruption", "HookElytraBreaking", "HookEndBiome", "HookEndermanParticles", "HookEndermiteParticles", "HookEntityHelmetBreaking", "HookEntityPotionCorruption", "HookFireSpread", "HookItemEntityLavaCheck", "HookLightMapColors", "HookPlayerInventoryArmorBreaking", "HookPotionCreativeMenu", "HookThornsArmorBreaking" ],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
Index: src/main/java/chylex/hee/mixin/HookElytraBreaking.java
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/src/main/java/chylex/hee/mixin/HookElytraBreaking.java b/src/main/java/chylex/hee/mixin/HookElytraBreaking.java
|
||||
new file mode 100644
|
||||
--- /dev/null (date 1608060322378)
|
||||
+++ b/src/main/java/chylex/hee/mixin/HookElytraBreaking.java (date 1608060322378)
|
||||
@@ -0,0 +1,27 @@
|
||||
+package chylex.hee.mixin;
|
||||
+
|
||||
+import chylex.hee.init.ModItems;
|
||||
+import net.minecraft.entity.LivingEntity;
|
||||
+import net.minecraft.entity.player.PlayerEntity;
|
||||
+import net.minecraft.item.ElytraItem;
|
||||
+import net.minecraft.item.ItemStack;
|
||||
+import org.spongepowered.asm.mixin.Mixin;
|
||||
+import org.spongepowered.asm.mixin.injection.At;
|
||||
+import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
+import java.util.function.Consumer;
|
||||
+
|
||||
+@Mixin(ElytraItem.class)
|
||||
+public abstract class HookElytraBreaking{
|
||||
+ @Redirect(
|
||||
+ method = "elytraFlightTick",
|
||||
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;damageItem(ILnet/minecraft/entity/LivingEntity;Ljava/util/function/Consumer;)V")
|
||||
+ )
|
||||
+ public void damageItem(final ItemStack stack, final int amount, final LivingEntity entity, final Consumer<LivingEntity> onBroken){
|
||||
+ final ItemStack originalStack = stack.copy();
|
||||
+ stack.damageItem(amount, entity, onBroken);
|
||||
+
|
||||
+ if (ElytraItem.isUsable(originalStack) && !ElytraItem.isUsable(stack) && entity instanceof PlayerEntity){
|
||||
+ ModItems.RING_OF_PRESERVATION.onArmorDestroyed((PlayerEntity)entity, originalStack, stack);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
4
.idea/shelf/todo1.xml
generated
4
.idea/shelf/todo1.xml
generated
@@ -1,4 +0,0 @@
|
||||
<changelist name="todo1" date="1601711471885" recycled="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/todo1/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="todo" />
|
||||
</changelist>
|
182
.idea/shelf/todo1/shelved.patch
generated
182
.idea/shelf/todo1/shelved.patch
generated
File diff suppressed because one or more lines are too long
@@ -1,3 +1,2 @@
|
||||
# Hardcore Ender Expansion 2
|
||||
|
||||
Work in progress. PRs will not be accepted before release.
|
||||
|
20
build.gradle
20
build.gradle
@@ -1,8 +1,8 @@
|
||||
ext {
|
||||
mc_version = "1.15.2"
|
||||
forge_version = "31.2.45"
|
||||
mapping_version = "20200626-1.15.1"
|
||||
kotlin_mod_version = "1.6.1"
|
||||
mc_version = "1.16.4"
|
||||
forge_version = "35.1.2"
|
||||
mapping_version = "20201028-1.16.3"
|
||||
kotlin_mod_version = "1.6.2"
|
||||
}
|
||||
|
||||
buildscript {
|
||||
@@ -49,16 +49,8 @@ archivesBaseName = metaName.replaceAll("\\s", "")
|
||||
|
||||
idea {
|
||||
module {
|
||||
[".idea", ".settings", ".gradle", "build", "gradle", "out", "run", "src/main/kotlin", "src/test/kotlin"].each {
|
||||
excludeDirs += file(it)
|
||||
}
|
||||
|
||||
["out", "src/main/kotlin", "src/test/kotlin"].each {
|
||||
excludeDirs += file("src/system/" + it)
|
||||
}
|
||||
|
||||
["src/main/kotlin", "src/test/kotlin"].each {
|
||||
excludeDirs += file("data/" + it)
|
||||
[".idea", ".settings", ".classpath", ".project", "gradle", "out", "run"].each {
|
||||
excludeDirs << file(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.datagen
|
||||
|
||||
import chylex.hee.HEE
|
||||
import chylex.hee.datagen.client.BlockItemModels
|
||||
import chylex.hee.datagen.client.BlockModels
|
||||
@@ -14,21 +13,21 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
|
||||
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent
|
||||
|
||||
@SubscribeAllEvents(modid = HEE.ID, bus = MOD)
|
||||
object DataGen {
|
||||
object DataGen{
|
||||
@SubscribeEvent
|
||||
fun register(e: GatherDataEvent) {
|
||||
fun register(e: GatherDataEvent){
|
||||
val modid = HEE.ID
|
||||
val helper = e.existingFileHelper
|
||||
|
||||
with(e.generator) {
|
||||
if (e.includeClient()) {
|
||||
with(e.generator){
|
||||
if (e.includeClient()){
|
||||
addProvider(BlockStates(this, modid, helper))
|
||||
addProvider(BlockModels(this, modid, helper))
|
||||
addProvider(BlockItemModels(this, modid, helper))
|
||||
addProvider(ItemModels(this, modid, helper))
|
||||
}
|
||||
|
||||
if (e.includeServer()) {
|
||||
if (e.includeServer()){
|
||||
addProvider(BlockLootTables(this))
|
||||
addProvider(BlockTags(this))
|
||||
addProvider(ItemTags(this))
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.datagen
|
||||
|
||||
import chylex.hee.HEE
|
||||
import chylex.hee.system.facades.Resource
|
||||
import net.minecraft.block.Block
|
||||
@@ -18,58 +17,58 @@ val IForgeRegistryEntry<*>.isVanilla
|
||||
get() = Resource.isVanilla(registryName!!)
|
||||
|
||||
val IItemProvider.r
|
||||
get() = when(this) {
|
||||
get() = when(this){
|
||||
is Block -> resource("block/" + this.path, this.isVanilla)
|
||||
is Item -> resource("item/" + this.path, this.isVanilla)
|
||||
else -> throw IllegalArgumentException()
|
||||
}
|
||||
|
||||
fun IItemProvider.r(suffix: String): ResourceLocation {
|
||||
return when(this) {
|
||||
fun IItemProvider.r(suffix: String): ResourceLocation{
|
||||
return when(this){
|
||||
is Block -> resource("block/" + this.path + suffix, this.isVanilla)
|
||||
is Item -> resource("item/" + this.path + suffix, this.isVanilla)
|
||||
else -> throw IllegalArgumentException()
|
||||
}
|
||||
}
|
||||
|
||||
fun resource(path: String, vanilla: Boolean): ResourceLocation {
|
||||
fun resource(path: String, vanilla: Boolean): ResourceLocation{
|
||||
return if (vanilla) Resource.Vanilla(path) else Resource.Custom(path)
|
||||
}
|
||||
|
||||
inline fun <T : IDataProvider> T?.safeUnit(callback: T.() -> Unit) {
|
||||
try {
|
||||
inline fun <T : IDataProvider> T?.safeUnit(callback: T.() -> Unit){
|
||||
try{
|
||||
this?.callback()
|
||||
} catch(e: Exception) {
|
||||
}catch(e: Exception){
|
||||
HEE.log.error("[DataGen] " + e.message)
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T : ModelBuilder<T>, U : ModelProvider<T>> U?.safeUnit(callback: U.() -> Unit) {
|
||||
try {
|
||||
inline fun <T : ModelBuilder<T>, U : ModelProvider<T>> U?.safeUnit(callback: U.() -> Unit){
|
||||
try{
|
||||
this?.callback()
|
||||
} catch(e: Exception) {
|
||||
}catch(e: Exception){
|
||||
HEE.log.error("[DataGen] " + e.message)
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T : ModelBuilder<T>, U : ModelProvider<T>> U?.safe(callback: U.() -> T): T? {
|
||||
return try {
|
||||
inline fun <T : ModelBuilder<T>, U : ModelProvider<T>> U?.safe(callback: U.() -> T): T?{
|
||||
return try{
|
||||
this?.callback()
|
||||
} catch(e: Exception) {
|
||||
}catch(e: Exception){
|
||||
HEE.log.error("[DataGen] " + e.message)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T : ModelBuilder<T>> T?.then(callback: T.() -> T): T? {
|
||||
return try {
|
||||
inline fun <T : ModelBuilder<T>> T?.then(callback: T.() -> T): T?{
|
||||
return try{
|
||||
this?.callback()
|
||||
} catch(e: Exception) {
|
||||
}catch(e: Exception){
|
||||
HEE.log.error("[DataGen] " + e.message)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
class Callback<T>(val item: T, val suffix: String, val path: String) {
|
||||
class Callback<T>(val item: T, val suffix: String, val path: String){
|
||||
override fun toString() = path
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.datagen.client
|
||||
|
||||
import chylex.hee.datagen.client.util.block
|
||||
import chylex.hee.datagen.client.util.multi
|
||||
import chylex.hee.datagen.client.util.override
|
||||
@@ -14,8 +13,8 @@ import net.minecraft.data.DataGenerator
|
||||
import net.minecraftforge.client.model.generators.ExistingFileHelper
|
||||
import net.minecraftforge.client.model.generators.ItemModelProvider
|
||||
|
||||
class BlockItemModels(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : ItemModelProvider(generator, modid, existingFileHelper) {
|
||||
override fun registerModels() {
|
||||
class BlockItemModels(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : ItemModelProvider(generator, modid, existingFileHelper){
|
||||
override fun registerModels(){
|
||||
|
||||
// Blocks: Building (Uncategorized)
|
||||
|
||||
@@ -86,12 +85,12 @@ class BlockItemModels(generator: DataGenerator, modid: String, existingFileHelpe
|
||||
// Blocks: Decorative (Plants)
|
||||
|
||||
simple(ModBlocks.DEATH_FLOWER_DECAYING, ModBlocks.DEATH_FLOWER_DECAYING.r("_1")).then {
|
||||
override(ModBlocks.DEATH_FLOWER_DECAYING.asItem().r("_2")) { predicate(Resource.Custom("death_level"), 4F) }
|
||||
override(ModBlocks.DEATH_FLOWER_DECAYING.asItem().r("_3")) { predicate(Resource.Custom("death_level"), 8F) }
|
||||
override(ModBlocks.DEATH_FLOWER_DECAYING.asItem().r("_4")) { predicate(Resource.Custom("death_level"), 12F) }
|
||||
override(ModBlocks.DEATH_FLOWER_DECAYING.asItem().r("_2")){ predicate(Resource.Custom("death_level"), 4F) }
|
||||
override(ModBlocks.DEATH_FLOWER_DECAYING.asItem().r("_3")){ predicate(Resource.Custom("death_level"), 8F) }
|
||||
override(ModBlocks.DEATH_FLOWER_DECAYING.asItem().r("_4")){ predicate(Resource.Custom("death_level"), 12F) }
|
||||
}
|
||||
|
||||
multi(ModBlocks.DEATH_FLOWER_DECAYING, Resource.Vanilla("item/generated"), 1..4) {
|
||||
multi(ModBlocks.DEATH_FLOWER_DECAYING, Resource.Vanilla("item/generated"), 1..4){
|
||||
texture("layer0", Resource.Custom("block/" + it.path))
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.datagen.client
|
||||
|
||||
import chylex.hee.datagen.client.util.cauldron
|
||||
import chylex.hee.datagen.client.util.cross
|
||||
import chylex.hee.datagen.client.util.cube
|
||||
@@ -24,8 +23,8 @@ import net.minecraft.data.DataGenerator
|
||||
import net.minecraftforge.client.model.generators.BlockModelProvider
|
||||
import net.minecraftforge.client.model.generators.ExistingFileHelper
|
||||
|
||||
class BlockModels(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : BlockModelProvider(generator, modid, existingFileHelper) {
|
||||
override fun registerModels() {
|
||||
class BlockModels(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : BlockModelProvider(generator, modid, existingFileHelper){
|
||||
override fun registerModels(){
|
||||
|
||||
// Blocks: Building (Uncategorized)
|
||||
|
||||
@@ -61,7 +60,7 @@ class BlockModels(generator: DataGenerator, modid: String, existingFileHelper: E
|
||||
texture("particle", ModBlocks.GRAVE_DIRT_PLAIN.r)
|
||||
}
|
||||
|
||||
multi(ModBlocks.GRAVE_DIRT_LOOT, Resource.Custom("block/grave_dirt_low"), 1..6) {
|
||||
multi(ModBlocks.GRAVE_DIRT_LOOT, Resource.Custom("block/grave_dirt_low"), 1..6){
|
||||
texture("top", Resource.Custom("block/$it"))
|
||||
}
|
||||
|
||||
@@ -103,7 +102,7 @@ class BlockModels(generator: DataGenerator, modid: String, existingFileHelper: E
|
||||
|
||||
cubeBottomTop(ModBlocks.EXPERIENCE_GATE, top = ModBlocks.EXPERIENCE_GATE.r("_bottom"))
|
||||
|
||||
multi(ModBlocks.EXPERIENCE_GATE, ModBlocks.EXPERIENCE_GATE.r, arrayOf("_rd1", "_rd2", "_ud")) {
|
||||
multi(ModBlocks.EXPERIENCE_GATE, ModBlocks.EXPERIENCE_GATE.r, arrayOf("_rd1", "_rd2", "_ud")){
|
||||
texture("top", Resource.Custom("block/experience_gate_top" + it.suffix))
|
||||
}
|
||||
|
||||
@@ -144,14 +143,14 @@ class BlockModels(generator: DataGenerator, modid: String, existingFileHelper: E
|
||||
|
||||
// Blocks: Decorative (Plants)
|
||||
|
||||
multi(ModBlocks.DEATH_FLOWER_DECAYING, Resource.Vanilla("block/cross"), 1..4) {
|
||||
multi(ModBlocks.DEATH_FLOWER_DECAYING, Resource.Vanilla("block/cross"), 1..4){
|
||||
texture("cross", Resource.Custom("block/$it"))
|
||||
}
|
||||
|
||||
cross(ModBlocks.DEATH_FLOWER_HEALED)
|
||||
cross(ModBlocks.DEATH_FLOWER_WITHERED)
|
||||
|
||||
multi(ModBlocks.POTTED_DEATH_FLOWER_DECAYING, Resource.Vanilla("block/flower_pot_cross"), 1..4) {
|
||||
multi(ModBlocks.POTTED_DEATH_FLOWER_DECAYING, Resource.Vanilla("block/flower_pot_cross"), 1..4){
|
||||
texture("plant", Resource.Custom("block/death_flower" + it.suffix))
|
||||
}
|
||||
|
||||
@@ -177,7 +176,7 @@ class BlockModels(generator: DataGenerator, modid: String, existingFileHelper: E
|
||||
|
||||
// Blocks: Tables
|
||||
|
||||
for(tier in 1..3) {
|
||||
for(tier in 1..3){
|
||||
parent("table_tier_$tier", Resource.Custom("block/table")).then {
|
||||
texture("particle", "hee:block/table_base")
|
||||
texture("bottom", "hee:block/table_base")
|
||||
@@ -186,26 +185,20 @@ class BlockModels(generator: DataGenerator, modid: String, existingFileHelper: E
|
||||
}
|
||||
}
|
||||
|
||||
parent(ModBlocks.TABLE_BASE_TIER_1, Resource.Custom("block/table_tier_1")).then {
|
||||
Resource.Custom("block/transparent").let {
|
||||
texture("overlay_top", it)
|
||||
texture("overlay_side", it)
|
||||
}
|
||||
}
|
||||
parent(ModBlocks.TABLE_BASE_TIER_1, Resource.Custom("block/table_tier_1")).then { Resource.Custom("block/transparent").let {
|
||||
texture("overlay_top", it)
|
||||
texture("overlay_side", it)
|
||||
}}
|
||||
|
||||
parent(ModBlocks.TABLE_BASE_TIER_2, Resource.Custom("block/table_tier_2")).then {
|
||||
Resource.Custom("block/transparent").let {
|
||||
texture("overlay_top", it)
|
||||
texture("overlay_side", it)
|
||||
}
|
||||
}
|
||||
parent(ModBlocks.TABLE_BASE_TIER_2, Resource.Custom("block/table_tier_2")).then { Resource.Custom("block/transparent").let {
|
||||
texture("overlay_top", it)
|
||||
texture("overlay_side", it)
|
||||
}}
|
||||
|
||||
parent(ModBlocks.TABLE_BASE_TIER_3, Resource.Custom("block/table_tier_3")).then {
|
||||
Resource.Custom("block/transparent").let {
|
||||
texture("overlay_top", it)
|
||||
texture("overlay_side", it)
|
||||
}
|
||||
}
|
||||
parent(ModBlocks.TABLE_BASE_TIER_3, Resource.Custom("block/table_tier_3")).then { Resource.Custom("block/transparent").let {
|
||||
texture("overlay_top", it)
|
||||
texture("overlay_side", it)
|
||||
}}
|
||||
|
||||
table(ModBlocks.ACCUMULATION_TABLE_TIER_1)
|
||||
table(ModBlocks.ACCUMULATION_TABLE_TIER_2)
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.datagen.client
|
||||
|
||||
import chylex.hee.datagen.client.util.cube
|
||||
import chylex.hee.datagen.client.util.log
|
||||
import chylex.hee.datagen.client.util.pillar
|
||||
@@ -14,8 +13,8 @@ import net.minecraft.data.DataGenerator
|
||||
import net.minecraftforge.client.model.generators.BlockStateProvider
|
||||
import net.minecraftforge.client.model.generators.ExistingFileHelper
|
||||
|
||||
class BlockStates(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : BlockStateProvider(generator, modid, existingFileHelper) {
|
||||
override fun registerStatesAndModels() {
|
||||
class BlockStates(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : BlockStateProvider(generator, modid, existingFileHelper){
|
||||
override fun registerStatesAndModels(){
|
||||
|
||||
// Blocks: Building (Uncategorized)
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.datagen.client
|
||||
|
||||
import chylex.hee.datagen.client.util.layers
|
||||
import chylex.hee.datagen.client.util.multi
|
||||
import chylex.hee.datagen.client.util.override
|
||||
@@ -15,8 +14,8 @@ import net.minecraft.item.Items
|
||||
import net.minecraftforge.client.model.generators.ExistingFileHelper
|
||||
import net.minecraftforge.client.model.generators.ItemModelProvider
|
||||
|
||||
class ItemModels(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : ItemModelProvider(generator, modid, existingFileHelper) {
|
||||
override fun registerModels() {
|
||||
class ItemModels(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : ItemModelProvider(generator, modid, existingFileHelper){
|
||||
override fun registerModels(){
|
||||
|
||||
// Items: Raw Resources
|
||||
|
||||
@@ -55,8 +54,8 @@ class ItemModels(generator: DataGenerator, modid: String, existingFileHelper: Ex
|
||||
simple(ModItems.COMPOST)
|
||||
|
||||
simple(ModItems.VOID_SALAD).then {
|
||||
override(Resource.Custom("item/void_void_salad")) { predicate(Resource.Custom("void_salad_type"), 1F) }
|
||||
override(Resource.Custom("item/mega_void_salad")) { predicate(Resource.Custom("void_salad_type"), 2F) }
|
||||
override(Resource.Custom("item/void_void_salad")){ predicate(Resource.Custom("void_salad_type"), 1F) }
|
||||
override(Resource.Custom("item/mega_void_salad")){ predicate(Resource.Custom("void_salad_type"), 2F) }
|
||||
}
|
||||
|
||||
simple("void_void_salad")
|
||||
@@ -80,13 +79,13 @@ class ItemModels(generator: DataGenerator, modid: String, existingFileHelper: Ex
|
||||
simple(ModItems.VOID_MINER)
|
||||
|
||||
simple(ModItems.VOID_BUCKET).then {
|
||||
override(ModItems.VOID_BUCKET.r("_fluid_level_1")) { predicate(Resource.Custom("void_bucket_cooldown"), 0.01F) }
|
||||
override(ModItems.VOID_BUCKET.r("_fluid_level_2")) { predicate(Resource.Custom("void_bucket_cooldown"), 0.3F) }
|
||||
override(ModItems.VOID_BUCKET.r("_fluid_level_3")) { predicate(Resource.Custom("void_bucket_cooldown"), 0.5F) }
|
||||
override(ModItems.VOID_BUCKET.r("_fluid_level_4")) { predicate(Resource.Custom("void_bucket_cooldown"), 0.7F) }
|
||||
override(ModItems.VOID_BUCKET.r("_fluid_level_1")){ predicate(Resource.Custom("void_bucket_cooldown"), 0.01F) }
|
||||
override(ModItems.VOID_BUCKET.r("_fluid_level_2")){ predicate(Resource.Custom("void_bucket_cooldown"), 0.3F) }
|
||||
override(ModItems.VOID_BUCKET.r("_fluid_level_3")){ predicate(Resource.Custom("void_bucket_cooldown"), 0.5F) }
|
||||
override(ModItems.VOID_BUCKET.r("_fluid_level_4")){ predicate(Resource.Custom("void_bucket_cooldown"), 0.7F) }
|
||||
}
|
||||
|
||||
multi(ModItems.VOID_BUCKET, Resource.Vanilla("item/generated"), Array(4) { "_fluid_level_${it + 1}" }) {
|
||||
multi(ModItems.VOID_BUCKET, Resource.Vanilla("item/generated"), Array(4){ "_fluid_level_${it + 1}" }){
|
||||
texture("layer0", Resource.Custom("item/void_bucket"))
|
||||
texture("layer1", Resource.Custom("item/$it"))
|
||||
}
|
||||
@@ -105,17 +104,17 @@ class ItemModels(generator: DataGenerator, modid: String, existingFileHelper: Ex
|
||||
// Items: Energy
|
||||
|
||||
layers(ModItems.ENERGY_ORACLE, arrayOf("energy_oracle", "energy_oracle_indicator_inactive")).then {
|
||||
override(ModItems.ENERGY_ORACLE.r("_active_mild")) { predicate(Resource.Custom("activity_intensity"), 0.5F) }
|
||||
override(ModItems.ENERGY_ORACLE.r("_active_full")) { predicate(Resource.Custom("activity_intensity"), 1F) }
|
||||
override(ModItems.ENERGY_ORACLE.r("_active_mild")){ predicate(Resource.Custom("activity_intensity"), 0.5F) }
|
||||
override(ModItems.ENERGY_ORACLE.r("_active_full")){ predicate(Resource.Custom("activity_intensity"), 1F) }
|
||||
}
|
||||
|
||||
multi(ModItems.ENERGY_ORACLE, Resource.Vanilla("item/generated"), arrayOf("_active_mild", "_active_full")) {
|
||||
multi(ModItems.ENERGY_ORACLE, Resource.Vanilla("item/generated"), arrayOf("_active_mild", "_active_full")){
|
||||
texture("layer0", Resource.Custom("item/energy_oracle"))
|
||||
texture("layer1", Resource.Custom("item/energy_oracle_indicator" + it.suffix))
|
||||
}
|
||||
|
||||
simple(ModItems.ENERGY_RECEPTACLE).then {
|
||||
override(ModItems.ENERGY_RECEPTACLE.r("_with_cluster")) { predicate(Resource.Custom("has_cluster"), 1F) }
|
||||
override(ModItems.ENERGY_RECEPTACLE.r("_with_cluster")){ predicate(Resource.Custom("has_cluster"), 1F) }
|
||||
}
|
||||
|
||||
layers(ModItems.ENERGY_RECEPTACLE.suffixed("_with_cluster"), arrayOf("energy_receptacle", "energy_receptacle_cluster"))
|
||||
@@ -127,9 +126,9 @@ class ItemModels(generator: DataGenerator, modid: String, existingFileHelper: Ex
|
||||
simple(ModItems.LINKING_GEM)
|
||||
|
||||
layers(ModItems.PORTAL_TOKEN, arrayOf("portal_token_outline", "portal_token_color_top", "portal_token_color_bottom")).then {
|
||||
override(ModItems.PORTAL_TOKEN.r("_rare")) { predicate(Resource.Custom("token_type"), 1F) }
|
||||
override(ModItems.PORTAL_TOKEN.r("_rare_corrupted")) { predicate(Resource.Custom("token_type"), 1.5F) }
|
||||
override(ModItems.PORTAL_TOKEN.r("_solitary")) { predicate(Resource.Custom("token_type"), 2F) }
|
||||
override(ModItems.PORTAL_TOKEN.r("_rare")){ predicate(Resource.Custom("token_type"), 1F) }
|
||||
override(ModItems.PORTAL_TOKEN.r("_rare_corrupted")){ predicate(Resource.Custom("token_type"), 1.5F) }
|
||||
override(ModItems.PORTAL_TOKEN.r("_solitary")){ predicate(Resource.Custom("token_type"), 2F) }
|
||||
}
|
||||
|
||||
layers(ModItems.PORTAL_TOKEN.suffixed("_rare"), arrayOf("portal_token_outline", "portal_token_color_top", "portal_token_color_bottom", "portal_token_border_rare"))
|
||||
@@ -142,7 +141,7 @@ class ItemModels(generator: DataGenerator, modid: String, existingFileHelper: Ex
|
||||
simple(ModItems.TRINKET_POUCH)
|
||||
|
||||
simple(ModItems.TOTEM_OF_UNDYING).then {
|
||||
override(ModItems.TOTEM_OF_UNDYING.r("_shaking")) { predicate(Resource.Custom("is_shaking"), 1F) }
|
||||
override(ModItems.TOTEM_OF_UNDYING.r("_shaking")){ predicate(Resource.Custom("is_shaking"), 1F) }
|
||||
}
|
||||
|
||||
simple(ModItems.TOTEM_OF_UNDYING.suffixed("_shaking"))
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.datagen.client.util
|
||||
|
||||
import chylex.hee.datagen.Callback
|
||||
import chylex.hee.datagen.path
|
||||
import chylex.hee.datagen.r
|
||||
@@ -16,7 +15,7 @@ import net.minecraft.util.ResourceLocation
|
||||
import net.minecraftforge.client.model.generators.BlockModelBuilder
|
||||
import net.minecraftforge.client.model.generators.BlockModelProvider
|
||||
|
||||
fun Block.suffixed(suffix: String): Block {
|
||||
fun Block.suffixed(suffix: String): Block{
|
||||
return Block(Block.Properties.from(Blocks.AIR)) named this.path + suffix
|
||||
}
|
||||
|
||||
@@ -28,15 +27,15 @@ fun BlockModelProvider.parent(block: Block, parent: ResourceLocation) = safe {
|
||||
this.getBuilder(block.path).parent(getExistingFile(parent))
|
||||
}
|
||||
|
||||
fun BlockModelProvider.simple(block: Block, parent: ResourceLocation, textureName: String, textureLocation: ResourceLocation = block.r): BlockModelBuilder? {
|
||||
fun BlockModelProvider.simple(block: Block, parent: ResourceLocation, textureName: String, textureLocation: ResourceLocation = block.r): BlockModelBuilder?{
|
||||
return this.parent(block, parent).then { texture(textureName, textureLocation) }
|
||||
}
|
||||
|
||||
fun BlockModelProvider.cube(block: Block, texture: ResourceLocation = block.r): BlockModelBuilder? {
|
||||
fun BlockModelProvider.cube(block: Block, texture: ResourceLocation = block.r): BlockModelBuilder?{
|
||||
return this.simple(block, Resource.Vanilla("block/cube_all"), "all", texture)
|
||||
}
|
||||
|
||||
fun BlockModelProvider.cross(block: Block, texture: ResourceLocation = block.r): BlockModelBuilder? {
|
||||
fun BlockModelProvider.cross(block: Block, texture: ResourceLocation = block.r): BlockModelBuilder?{
|
||||
return this.simple(block, Resource.Vanilla("block/cross"), "cross", texture)
|
||||
}
|
||||
|
||||
@@ -48,7 +47,7 @@ fun BlockModelProvider.cubeBottomTop(block: Block, side: ResourceLocation = bloc
|
||||
return this.cubeBottomTop(block.path, side, bottom, top)
|
||||
}
|
||||
|
||||
fun BlockModelProvider.leaves(block: Block): BlockModelBuilder? {
|
||||
fun BlockModelProvider.leaves(block: Block): BlockModelBuilder?{
|
||||
return this.simple(block, Resource.Vanilla("block/leaves"), "all")
|
||||
}
|
||||
|
||||
@@ -56,8 +55,8 @@ fun BlockModelProvider.particle(block: Block, particle: ResourceLocation) = safe
|
||||
this.getBuilder(block.path).texture("particle", particle)
|
||||
}
|
||||
|
||||
fun BlockModelProvider.multi(block: Block, parent: ResourceLocation, suffixes: Array<String>, callback: BlockModelBuilder.(Callback<Block>) -> Unit) {
|
||||
for(suffix in suffixes) {
|
||||
fun BlockModelProvider.multi(block: Block, parent: ResourceLocation, suffixes: Array<String>, callback: BlockModelBuilder.(Callback<Block>) -> Unit){
|
||||
for(suffix in suffixes){
|
||||
val path = block.path + suffix
|
||||
|
||||
this.safeUnit {
|
||||
@@ -66,8 +65,8 @@ fun BlockModelProvider.multi(block: Block, parent: ResourceLocation, suffixes: A
|
||||
}
|
||||
}
|
||||
|
||||
fun BlockModelProvider.multi(block: Block, parent: ResourceLocation, suffixes: IntRange, callback: BlockModelBuilder.(Callback<Block>) -> Unit) {
|
||||
multi(block, parent, Array(1 + suffixes.last - suffixes.first) { "_${suffixes.first + it}" }, callback)
|
||||
fun BlockModelProvider.multi(block: Block, parent: ResourceLocation, suffixes: IntRange, callback: BlockModelBuilder.(Callback<Block>) -> Unit){
|
||||
multi(block, parent, Array(1 + suffixes.last - suffixes.first){ "_${suffixes.first + it}" }, callback)
|
||||
}
|
||||
|
||||
fun BlockModelProvider.wall(block: BlockWall, texture: ResourceLocation) = safeUnit {
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.datagen.client.util
|
||||
|
||||
import chylex.hee.datagen.r
|
||||
import chylex.hee.datagen.safeUnit
|
||||
import chylex.hee.system.migration.BlockLog
|
||||
@@ -11,7 +10,7 @@ import net.minecraft.util.ResourceLocation
|
||||
import net.minecraftforge.client.model.generators.BlockStateProvider
|
||||
import net.minecraftforge.client.model.generators.ModelFile.UncheckedModelFile
|
||||
|
||||
private fun BlockStateProvider.simpleBlockItem(block: Block) {
|
||||
private fun BlockStateProvider.simpleBlockItem(block: Block){
|
||||
this.simpleBlockItem(block, UncheckedModelFile(block.r))
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.datagen.client.util
|
||||
|
||||
import chylex.hee.datagen.Callback
|
||||
import chylex.hee.datagen.path
|
||||
import chylex.hee.datagen.r
|
||||
@@ -16,20 +15,20 @@ import net.minecraftforge.client.model.generators.ItemModelBuilder.OverrideBuild
|
||||
import net.minecraftforge.client.model.generators.ItemModelProvider
|
||||
import net.minecraftforge.client.model.generators.ModelFile.UncheckedModelFile
|
||||
|
||||
fun Item.suffixed(suffix: String): Item {
|
||||
fun Item.suffixed(suffix: String): Item{
|
||||
return Item(Item.Properties()) named this.path + suffix
|
||||
}
|
||||
|
||||
private val ItemModelProvider.generated
|
||||
get() = getExistingFile(Resource.Vanilla("item/generated"))
|
||||
|
||||
private fun IItemProvider.path() = when(this) {
|
||||
private fun IItemProvider.path() = when(this){
|
||||
is Block -> this.path
|
||||
is Item -> this.path
|
||||
else -> throw IllegalArgumentException()
|
||||
}
|
||||
|
||||
private fun ItemModelProvider.build(item: IItemProvider): ItemModelBuilder {
|
||||
private fun ItemModelProvider.build(item: IItemProvider): ItemModelBuilder{
|
||||
return this.getBuilder(item.path())
|
||||
}
|
||||
|
||||
@@ -48,15 +47,15 @@ fun ItemModelProvider.simple(item: IItemProvider, texture: ResourceLocation = it
|
||||
fun ItemModelProvider.layers(item: Item, layers: Array<String>) = safe {
|
||||
var builder = this.getBuilder(item.path).parent(generated)
|
||||
|
||||
for((index, layer) in layers.withIndex()) {
|
||||
for((index, layer) in layers.withIndex()){
|
||||
builder = builder.texture("layer$index", Resource.Custom("item/$layer"))
|
||||
}
|
||||
|
||||
builder
|
||||
}
|
||||
|
||||
fun ItemModelProvider.multi(item: IItemProvider, parent: ResourceLocation, suffixes: Array<String>, callback: ItemModelBuilder.(Callback<IItemProvider>) -> Unit) {
|
||||
for(suffix in suffixes) {
|
||||
fun ItemModelProvider.multi(item: IItemProvider, parent: ResourceLocation, suffixes: Array<String>, callback: ItemModelBuilder.(Callback<IItemProvider>) -> Unit){
|
||||
for(suffix in suffixes){
|
||||
val path = item.path() + suffix
|
||||
|
||||
this.safeUnit {
|
||||
@@ -65,14 +64,14 @@ fun ItemModelProvider.multi(item: IItemProvider, parent: ResourceLocation, suffi
|
||||
}
|
||||
}
|
||||
|
||||
fun ItemModelProvider.multi(item: IItemProvider, parent: ResourceLocation, suffixes: IntRange, callback: ItemModelBuilder.(Callback<IItemProvider>) -> Unit) {
|
||||
multi(item, parent, Array(1 + suffixes.last - suffixes.first) { "_${suffixes.first + it}" }, callback)
|
||||
fun ItemModelProvider.multi(item: IItemProvider, parent: ResourceLocation, suffixes: IntRange, callback: ItemModelBuilder.(Callback<IItemProvider>) -> Unit){
|
||||
multi(item, parent, Array(1 + suffixes.last - suffixes.first){ "_${suffixes.first + it}" }, callback)
|
||||
}
|
||||
|
||||
fun ItemModelProvider.block(block: Block, parent: Block = block) = safe {
|
||||
this.getBuilder(block.path).parent(UncheckedModelFile(parent.r))
|
||||
}
|
||||
|
||||
fun ItemModelBuilder.override(model: ResourceLocation, callback: OverrideBuilder.() -> OverrideBuilder): ItemModelBuilder? {
|
||||
fun ItemModelBuilder.override(model: ResourceLocation, callback: OverrideBuilder.() -> OverrideBuilder): ItemModelBuilder?{
|
||||
return this.override().model(UncheckedModelFile(model)).let(callback).end()
|
||||
}
|
||||
|
@@ -1,14 +1,13 @@
|
||||
package chylex.hee.datagen.server
|
||||
|
||||
import chylex.hee.datagen.server.util.BlockLootTableProvider
|
||||
import chylex.hee.init.ModBlocks
|
||||
import chylex.hee.init.ModItems
|
||||
import net.minecraft.block.Blocks
|
||||
import net.minecraft.data.DataGenerator
|
||||
|
||||
class BlockLootTables(generator: DataGenerator) : BlockLootTableProvider(generator) {
|
||||
override val consumer = object : RegistrationConsumer() {
|
||||
override fun addTables() {
|
||||
class BlockLootTables(generator: DataGenerator) : BlockLootTableProvider(generator){
|
||||
override val consumer = object : RegistrationConsumer(){
|
||||
override fun addTables(){
|
||||
dropSelf(ModBlocks.ACCUMULATION_TABLE_TIER_1)
|
||||
dropSelf(ModBlocks.ACCUMULATION_TABLE_TIER_2)
|
||||
dropSelf(ModBlocks.ACCUMULATION_TABLE_TIER_3)
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.datagen.server
|
||||
|
||||
import chylex.hee.datagen.server.util.add
|
||||
import chylex.hee.game.block.BlockWhitebarkSapling
|
||||
import chylex.hee.init.ModBlocks
|
||||
@@ -15,10 +14,10 @@ import net.minecraft.data.DataGenerator
|
||||
import net.minecraft.tags.BlockTags
|
||||
import net.minecraftforge.common.Tags
|
||||
|
||||
class BlockTags(generator: DataGenerator) : BlockTagsProvider(generator) {
|
||||
class BlockTags(generator: DataGenerator) : BlockTagsProvider(generator){
|
||||
private val blocks = getRegistryEntries<Block>(ModBlocks)
|
||||
|
||||
override fun registerTags() {
|
||||
override fun registerTags(){
|
||||
getBuilder(BlockTags.BAMBOO_PLANTABLE_ON).add(ModBlocks.HUMUS)
|
||||
getBuilder(BlockTags.FLOWER_POTS).add(blocks.filterIsInstance<BlockFlowerPot>())
|
||||
getBuilder(BlockTags.IMPERMEABLE).add(ModBlocks.INFUSED_GLASS)
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.datagen.server
|
||||
|
||||
import chylex.hee.init.ModItems
|
||||
import net.minecraft.data.DataGenerator
|
||||
import net.minecraft.data.ItemTagsProvider
|
||||
@@ -7,8 +6,8 @@ import net.minecraft.tags.BlockTags
|
||||
import net.minecraft.tags.ItemTags
|
||||
import net.minecraftforge.common.Tags
|
||||
|
||||
class ItemTags(generator: DataGenerator) : ItemTagsProvider(generator) {
|
||||
override fun registerTags() {
|
||||
class ItemTags(generator: DataGenerator) : ItemTagsProvider(generator){
|
||||
override fun registerTags(){
|
||||
copy(BlockTags.LEAVES, ItemTags.LEAVES)
|
||||
copy(BlockTags.LOGS, ItemTags.LOGS)
|
||||
copy(BlockTags.PLANKS, ItemTags.PLANKS)
|
||||
|
@@ -1,71 +1,70 @@
|
||||
package chylex.hee.datagen.server.util
|
||||
|
||||
import chylex.hee.system.migration.BlockFlowerPot
|
||||
import com.mojang.datafixers.util.Pair
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.data.DataGenerator
|
||||
import net.minecraft.data.LootTableProvider
|
||||
import net.minecraft.data.loot.BlockLootTables
|
||||
import net.minecraft.loot.LootParameterSet
|
||||
import net.minecraft.loot.LootParameterSets
|
||||
import net.minecraft.loot.LootTable
|
||||
import net.minecraft.loot.LootTable.Builder
|
||||
import net.minecraft.loot.ValidationTracker
|
||||
import net.minecraft.util.IItemProvider
|
||||
import net.minecraft.util.ResourceLocation
|
||||
import net.minecraft.world.storage.loot.LootParameterSet
|
||||
import net.minecraft.world.storage.loot.LootParameterSets
|
||||
import net.minecraft.world.storage.loot.LootTable
|
||||
import net.minecraft.world.storage.loot.LootTable.Builder
|
||||
import net.minecraft.world.storage.loot.ValidationTracker
|
||||
import java.util.function.BiConsumer
|
||||
import java.util.function.Consumer
|
||||
import java.util.function.Supplier
|
||||
|
||||
abstract class BlockLootTableProvider(generator: DataGenerator) : LootTableProvider(generator) {
|
||||
abstract class BlockLootTableProvider(generator: DataGenerator) : LootTableProvider(generator){
|
||||
protected abstract val consumer: RegistrationConsumer
|
||||
|
||||
final override fun getName(): String {
|
||||
final override fun getName(): String{
|
||||
return "Block Loot Tables"
|
||||
}
|
||||
|
||||
final override fun getTables(): MutableList<Pair<Supplier<Consumer<BiConsumer<ResourceLocation, Builder>>>, LootParameterSet>> {
|
||||
final override fun getTables(): MutableList<Pair<Supplier<Consumer<BiConsumer<ResourceLocation, Builder>>>, LootParameterSet>>{
|
||||
return mutableListOf(Pair.of(Supplier(::consumer), LootParameterSets.BLOCK))
|
||||
}
|
||||
|
||||
final override fun validate(map: MutableMap<ResourceLocation, LootTable>, tracker: ValidationTracker) {}
|
||||
final override fun validate(map: MutableMap<ResourceLocation, LootTable>, tracker: ValidationTracker){}
|
||||
|
||||
protected abstract class RegistrationConsumer : BlockLootTables() {
|
||||
protected abstract class RegistrationConsumer : BlockLootTables(){
|
||||
private val lootTables = mutableMapOf<ResourceLocation, Builder>()
|
||||
|
||||
override fun addTables() {}
|
||||
override fun addTables(){}
|
||||
|
||||
final override fun accept(consumer: BiConsumer<ResourceLocation?, Builder?>) {
|
||||
final override fun accept(consumer: BiConsumer<ResourceLocation?, Builder?>){
|
||||
addTables()
|
||||
|
||||
for((location, table) in lootTables) {
|
||||
for((location, table) in lootTables){
|
||||
consumer.accept(location, table)
|
||||
}
|
||||
|
||||
lootTables.clear()
|
||||
}
|
||||
|
||||
final override fun registerLootTable(block: Block, table: Builder) {
|
||||
final override fun registerLootTable(block: Block, table: Builder){
|
||||
check(lootTables.put(block.lootTable, table) == null)
|
||||
}
|
||||
|
||||
protected fun dropSelf(block: Block) {
|
||||
protected fun dropSelf(block: Block){
|
||||
registerDropSelfLootTable(block)
|
||||
}
|
||||
|
||||
protected fun dropOther(block: Block, drop: IItemProvider) {
|
||||
protected fun dropOther(block: Block, drop: IItemProvider){
|
||||
registerDropping(block, drop)
|
||||
}
|
||||
|
||||
protected fun dropFunc(block: Block, func: (Block) -> Builder) {
|
||||
protected fun dropFunc(block: Block, func: (Block) -> Builder){
|
||||
registerLootTable(block, func)
|
||||
}
|
||||
|
||||
protected fun dropFlowerPot(block: BlockFlowerPot) {
|
||||
protected fun dropFlowerPot(block: BlockFlowerPot){
|
||||
registerFlowerPot(block)
|
||||
}
|
||||
|
||||
protected companion object {
|
||||
protected companion object{
|
||||
val withName = BlockLootTables::droppingWithName
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package chylex.hee.datagen.server.util
|
||||
|
||||
import net.minecraft.tags.Tag
|
||||
|
||||
fun <T> Tag.Builder<T>.add(items: List<T>) {
|
||||
fun <T> Tag.Builder<T>.add(items: List<T>){
|
||||
items.forEach(this::add)
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee
|
||||
|
||||
import chylex.hee.game.block.BlockBrewingStandCustom
|
||||
import chylex.hee.game.block.BlockEndPortalOverride
|
||||
import chylex.hee.game.block.BlockShulkerBoxOverride
|
||||
@@ -26,7 +25,6 @@ import chylex.hee.system.Debug
|
||||
import chylex.hee.system.forge.SubscribeAllEvents
|
||||
import chylex.hee.system.forge.SubscribeEvent
|
||||
import net.minecraft.block.Blocks
|
||||
import net.minecraft.world.dimension.DimensionType
|
||||
import net.minecraftforge.fml.DistExecutor
|
||||
import net.minecraftforge.fml.DistExecutor.SafeSupplier
|
||||
import net.minecraftforge.fml.ModLoadingContext
|
||||
@@ -38,16 +36,16 @@ import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent
|
||||
|
||||
@Mod(HEE.ID)
|
||||
@SubscribeAllEvents(modid = HEE.ID, bus = MOD)
|
||||
object Mod {
|
||||
init {
|
||||
with(ModLoadingContext.get()) {
|
||||
object Mod{
|
||||
init{
|
||||
with(ModLoadingContext.get()){
|
||||
HEE.version = activeContainer.modInfo.version.toString()
|
||||
}
|
||||
|
||||
@Suppress("ConvertLambdaToReference")
|
||||
HEE.proxy = DistExecutor.safeRunForDist(
|
||||
{ SafeSupplier { ModClientProxy() } },
|
||||
{ SafeSupplier { ModCommonProxy() } }
|
||||
{ SafeSupplier { ModClientProxy() }},
|
||||
{ SafeSupplier { ModCommonProxy() }}
|
||||
)
|
||||
|
||||
CustomRarity
|
||||
@@ -58,12 +56,12 @@ object Mod {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
fun onClientSetup(@Suppress("UNUSED_PARAMETER") e: FMLClientSetupEvent) {
|
||||
fun onClientSetup(@Suppress("UNUSED_PARAMETER") e: FMLClientSetupEvent){
|
||||
Debug.initializeClient()
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
fun onCommonSetup(@Suppress("UNUSED_PARAMETER") e: FMLCommonSetupEvent) {
|
||||
fun onCommonSetup(@Suppress("UNUSED_PARAMETER") e: FMLCommonSetupEvent){
|
||||
NetworkManager.initialize(ModPackets.ALL)
|
||||
ModLoot.initialize()
|
||||
|
||||
@@ -74,7 +72,7 @@ object Mod {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
fun onLoadComplete(@Suppress("UNUSED_PARAMETER") e: FMLLoadCompleteEvent) {
|
||||
fun onLoadComplete(@Suppress("UNUSED_PARAMETER") e: FMLLoadCompleteEvent){
|
||||
EntityMobEnderman.setupBiomeSpawns()
|
||||
EndermanBlockHandler.setupCarriableBlocks()
|
||||
ModPotions.setupVanillaOverrides()
|
||||
@@ -83,12 +81,12 @@ object Mod {
|
||||
IntegrityCheck.verify()
|
||||
}
|
||||
|
||||
private object IntegrityCheck {
|
||||
fun verify() {
|
||||
private object IntegrityCheck{
|
||||
fun verify(){
|
||||
crashIfFalse(Blocks.END_PORTAL::class.java === BlockEndPortalOverride::class.java, "invalid End Portal block: ${Blocks.END_PORTAL::class.java}")
|
||||
crashIfFalse(Blocks.BREWING_STAND::class.java === BlockBrewingStandCustom::class.java, "invalid Brewing Stand block: ${Blocks.BREWING_STAND::class.java}")
|
||||
|
||||
for(block in BlockShulkerBoxOverride.ALL_BLOCKS) {
|
||||
for(block in BlockShulkerBoxOverride.ALL_BLOCKS){
|
||||
crashIfFalse(block.javaClass === BlockShulkerBoxOverride::class.java, "invalid Shulker Box block: ${block.javaClass}")
|
||||
crashIfFalse(block.asItem().javaClass === ItemShulkerBoxOverride::class.java, "invalid Shulker Box item: ${block.asItem().javaClass}")
|
||||
}
|
||||
@@ -100,15 +98,15 @@ object Mod {
|
||||
|
||||
// Utilities
|
||||
|
||||
private fun crashIfFalse(value: Boolean, message: String) {
|
||||
if (!value) {
|
||||
private fun crashIfFalse(value: Boolean, message: String){
|
||||
if (!value){
|
||||
failIntegrityCheck(message, true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun failIntegrityCheck(message: String, crash: Boolean) {
|
||||
private fun failIntegrityCheck(message: String, crash: Boolean){
|
||||
HEE.log.error("[IntegrityCheck] $message")
|
||||
check(!crash) { "Integrity check failed: $message" }
|
||||
check(!crash){ "Integrity check failed: $message" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,37 +1,38 @@
|
||||
package chylex.hee.client
|
||||
|
||||
import chylex.hee.HEE
|
||||
import chylex.hee.system.facades.Resource
|
||||
import chylex.hee.system.migration.supply
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.resources.IPackFinder
|
||||
import net.minecraft.resources.IPackNameDecorator
|
||||
import net.minecraft.resources.IResourcePack
|
||||
import net.minecraft.resources.ResourcePackInfo
|
||||
import net.minecraft.resources.ResourcePackInfo.IFactory
|
||||
import net.minecraft.resources.ResourcePackInfo.Priority
|
||||
import net.minecraft.resources.ResourcePackType
|
||||
import net.minecraftforge.fml.packs.ResourcePackLoader
|
||||
import java.util.function.Consumer
|
||||
|
||||
object VanillaResourceOverrides : IPackFinder {
|
||||
fun register() {
|
||||
object VanillaResourceOverrides : IPackFinder{
|
||||
fun register(){
|
||||
// Minecraft is null when running datagen, but I cannot move this to FMLClientSetupEvent because it only runs after all resource packs are initialized
|
||||
with(Minecraft.getInstance() ?: return) {
|
||||
with(Minecraft.getInstance() ?: return){
|
||||
resourcePackList.addPackFinder(this@VanillaResourceOverrides)
|
||||
}
|
||||
}
|
||||
|
||||
override fun <T : ResourcePackInfo> addPackInfosToMap(map: MutableMap<String, T>, factory: IFactory<T>) {
|
||||
override fun findPacks(consumer: Consumer<ResourcePackInfo>, factory: IFactory) {
|
||||
val delegate = ResourcePackLoader.getResourcePackFor(HEE.ID).get()
|
||||
val supplier = supply<IResourcePack>(Pack(delegate))
|
||||
|
||||
map[HEE.ID] = ResourcePackInfo.createResourcePack("HEE 2", true /* isAlwaysEnabled */, supplier, factory, Priority.TOP)!!
|
||||
consumer.accept(ResourcePackInfo.createResourcePack("HEE 2", true /* isAlwaysEnabled */, supplier, factory, Priority.TOP, IPackNameDecorator.BUILTIN)!!)
|
||||
}
|
||||
|
||||
private class Pack(delegate: IResourcePack) : IResourcePack by delegate {
|
||||
override fun getName() = "Hardcore Ender Expansion 2"
|
||||
override fun isHidden() = true // minecraft doesn't remember the order across restarts anyway
|
||||
|
||||
override fun getResourceNamespaces(type: ResourcePackType): MutableSet<String> {
|
||||
override fun getResourceNamespaces(type: ResourcePackType): MutableSet<String>{
|
||||
return mutableSetOf(Resource.NAMESPACE_VANILLA)
|
||||
}
|
||||
}
|
||||
|
@@ -1,24 +1,23 @@
|
||||
package chylex.hee.client.gui
|
||||
|
||||
import chylex.hee.client.gui.base.GuiBaseChestContainer
|
||||
import chylex.hee.game.container.ContainerAmuletOfRecovery
|
||||
import chylex.hee.network.server.PacketServerContainerEvent
|
||||
import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.Sided
|
||||
import net.minecraft.client.resources.I18n
|
||||
import net.minecraft.entity.player.PlayerInventory
|
||||
import net.minecraft.util.text.ITextComponent
|
||||
import net.minecraft.util.text.TranslationTextComponent
|
||||
import net.minecraftforge.fml.client.gui.widget.ExtendedButton
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class GuiAmuletOfRecovery(container: ContainerAmuletOfRecovery, inventory: PlayerInventory, title: ITextComponent) : GuiBaseChestContainer<ContainerAmuletOfRecovery>(container, inventory, title) {
|
||||
override fun init() {
|
||||
class GuiAmuletOfRecovery(container: ContainerAmuletOfRecovery, inventory: PlayerInventory, title: ITextComponent) : GuiBaseChestContainer<ContainerAmuletOfRecovery>(container, inventory, title){
|
||||
override fun init(){
|
||||
super.init()
|
||||
|
||||
val moveAllTitle = I18n.format("gui.hee.amulet_of_recovery.move_all")
|
||||
val moveAllWidth = (font.getStringWidth(moveAllTitle) + 14).coerceAtMost(xSize / 2)
|
||||
val moveAllTitle = TranslationTextComponent("gui.hee.amulet_of_recovery.move_all")
|
||||
val moveAllWidth = (font.getStringPropertyWidth(moveAllTitle) + 14).coerceAtMost(xSize / 2)
|
||||
|
||||
addButton(ExtendedButton(guiLeft + xSize - moveAllWidth - 7, (height / 2) + 6, moveAllWidth, 11, moveAllTitle) {
|
||||
addButton(ExtendedButton(guiLeft + xSize - moveAllWidth - 7, (height / 2) + 6, moveAllWidth, 11, moveAllTitle){
|
||||
PacketServerContainerEvent(0).sendToServer()
|
||||
})
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.gui
|
||||
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.client.render.gl.GL
|
||||
import chylex.hee.game.block.entity.TileEntityBrewingStandCustom
|
||||
@@ -7,57 +6,58 @@ import chylex.hee.game.world.totalTime
|
||||
import chylex.hee.system.facades.Resource
|
||||
import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.Sided
|
||||
import com.mojang.blaze3d.matrix.MatrixStack
|
||||
import net.minecraft.client.gui.screen.inventory.BrewingStandScreen
|
||||
import net.minecraft.entity.player.PlayerInventory
|
||||
import net.minecraft.inventory.container.BrewingStandContainer
|
||||
import net.minecraft.util.text.ITextComponent
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class GuiBrewingStandCustom(container: BrewingStandContainer, inventory: PlayerInventory, title: ITextComponent) : BrewingStandScreen(container, inventory, title) {
|
||||
private companion object {
|
||||
class GuiBrewingStandCustom(container: BrewingStandContainer, inventory: PlayerInventory, title: ITextComponent) : BrewingStandScreen(container, inventory, title){
|
||||
private companion object{
|
||||
private val TEX_BACKGROUND = Resource.Custom("textures/gui/brewing_stand.png")
|
||||
private val BUBBLE_LENGTHS = intArrayOf(0, 6, 11, 16, 20, 24, 29)
|
||||
}
|
||||
|
||||
private var brewStartTime = MC.world!!.totalTime
|
||||
|
||||
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int) {
|
||||
override fun drawGuiContainerBackgroundLayer(matrix: MatrixStack, partialTicks: Float, mouseX: Int, mouseY: Int){
|
||||
val x = (width - xSize) / 2
|
||||
val y = (height - ySize) / 2
|
||||
|
||||
GL.color(1F, 1F, 1F, 1F)
|
||||
GL.bindTexture(TEX_BACKGROUND)
|
||||
blit(x, y, 0, 0, xSize, ySize)
|
||||
blit(matrix, x, y, 0, 0, xSize, ySize)
|
||||
|
||||
val worldTime = MC.world!!.totalTime
|
||||
val brewTime = container.func_216981_f() // RENAME getBrewTime
|
||||
|
||||
if (brewTime > 0) {
|
||||
if (brewTime > 0){
|
||||
val brewProgress = (28F * (1F - (brewTime / 400F))).toInt()
|
||||
|
||||
if (brewProgress > 0) {
|
||||
blit(x + 97, y + 16, 176, 0, 9, brewProgress)
|
||||
if (brewProgress > 0){
|
||||
blit(matrix, x + 97, y + 16, 176, 0, 9, brewProgress)
|
||||
}
|
||||
|
||||
val bubbleLength = BUBBLE_LENGTHS[((worldTime - brewStartTime).toInt() / 2) % 7]
|
||||
|
||||
if (bubbleLength > 0) {
|
||||
blit(x + 63, y + 43 - bubbleLength, 185, 29 - bubbleLength, 12, bubbleLength)
|
||||
if (bubbleLength > 0){
|
||||
blit(matrix, x + 63, y + 43 - bubbleLength, 185, 29 - bubbleLength, 12, bubbleLength)
|
||||
}
|
||||
}
|
||||
else {
|
||||
else{
|
||||
brewStartTime = worldTime
|
||||
}
|
||||
|
||||
if (container.getSlot(TileEntityBrewingStandCustom.SLOT_MODIFIER).hasStack) {
|
||||
blit(x + 62, y + 45, 197, 0, 14, 2)
|
||||
if (container.getSlot(TileEntityBrewingStandCustom.SLOT_MODIFIER).hasStack){
|
||||
blit(matrix, x + 62, y + 45, 197, 0, 14, 2)
|
||||
}
|
||||
|
||||
for(slotIndex in TileEntityBrewingStandCustom.SLOTS_POTIONS) {
|
||||
for(slotIndex in TileEntityBrewingStandCustom.SLOTS_POTIONS){
|
||||
val slot = container.getSlot(slotIndex)
|
||||
|
||||
if (!slot.hasStack) {
|
||||
blit(x + slot.xPos, y + slot.yPos, 211, 0, 16, 16)
|
||||
if (!slot.hasStack){
|
||||
blit(matrix, x + slot.xPos, y + slot.yPos, 211, 0, 16, 16)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.gui
|
||||
|
||||
import chylex.hee.client.gui.base.GuiBaseChestContainer
|
||||
import chylex.hee.game.block.entity.TileEntityLootChest
|
||||
import chylex.hee.game.container.ContainerLootChest
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.gui
|
||||
|
||||
import chylex.hee.client.gui.base.GuiBaseChestContainer
|
||||
import chylex.hee.game.container.ContainerPortalTokenStorage
|
||||
import chylex.hee.system.forge.Side
|
||||
@@ -9,8 +8,8 @@ import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.text.ITextComponent
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class GuiPortalTokenStorage(container: ContainerPortalTokenStorage, inventory: PlayerInventory, title: ITextComponent) : GuiBaseChestContainer<ContainerPortalTokenStorage>(container, inventory, title) {
|
||||
fun canActivateToken(stack: ItemStack): Boolean {
|
||||
class GuiPortalTokenStorage(container: ContainerPortalTokenStorage, inventory: PlayerInventory, title: ITextComponent) : GuiBaseChestContainer<ContainerPortalTokenStorage>(container, inventory, title){
|
||||
fun canActivateToken(stack: ItemStack): Boolean{
|
||||
return container.canActivateToken(stack)
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.gui
|
||||
|
||||
import chylex.hee.client.gui.base.GuiBaseChestContainer
|
||||
import chylex.hee.game.container.ContainerShulkerBox
|
||||
import chylex.hee.system.forge.Side
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.gui
|
||||
|
||||
import chylex.hee.client.gui.base.GuiBaseCustomInventory
|
||||
import chylex.hee.game.container.ContainerTrinketPouch
|
||||
import chylex.hee.game.container.base.ContainerBaseCustomInventory
|
||||
@@ -8,35 +7,36 @@ import chylex.hee.system.color.IntColor.Companion.RGBA
|
||||
import chylex.hee.system.facades.Resource
|
||||
import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.Sided
|
||||
import com.mojang.blaze3d.matrix.MatrixStack
|
||||
import net.minecraft.entity.player.PlayerInventory
|
||||
import net.minecraft.util.text.ITextComponent
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class GuiTrinketPouch(container: ContainerTrinketPouch, inventory: PlayerInventory, title: ITextComponent) : GuiBaseCustomInventory<ContainerTrinketPouch>(container, inventory, title) {
|
||||
class GuiTrinketPouch(container: ContainerTrinketPouch, inventory: PlayerInventory, title: ITextComponent) : GuiBaseCustomInventory<ContainerTrinketPouch>(container, inventory, title){
|
||||
override val texBackground = Resource.Custom("textures/gui/trinket_pouch.png")
|
||||
override val titleContainer = "gui.hee.trinket_pouch.title"
|
||||
|
||||
private val hiddenSlots: Int
|
||||
private val hiddenSlotColor = RGBA(0u, 0.25F).i
|
||||
|
||||
init {
|
||||
init{
|
||||
ySize = ContainerTrinketPouch.HEIGHT
|
||||
hiddenSlots = ContainerTrinketPouch.MAX_SLOTS - (container as ContainerBaseCustomInventory<*>).containerInventory.size
|
||||
}
|
||||
|
||||
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int) {
|
||||
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY)
|
||||
override fun drawGuiContainerBackgroundLayer(matrix: MatrixStack, partialTicks: Float, mouseX: Int, mouseY: Int){
|
||||
super.drawGuiContainerBackgroundLayer(matrix, partialTicks, mouseX, mouseY)
|
||||
|
||||
val middleSlot = ContainerTrinketPouch.MAX_SLOTS / 2
|
||||
|
||||
repeat(hiddenSlots) {
|
||||
renderSlotCover(middleSlot + ((ContainerTrinketPouch.MAX_SLOTS - it) / 2) * (if (it % 2 == 0) -1 else 1))
|
||||
repeat(hiddenSlots){
|
||||
renderSlotCover(matrix, middleSlot + ((ContainerTrinketPouch.MAX_SLOTS - it) / 2) * (if (it % 2 == 0) -1 else 1))
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderSlotCover(index: Int) {
|
||||
private fun renderSlotCover(matrix: MatrixStack, index: Int){
|
||||
val x = guiLeft + 44 + (index * 18)
|
||||
val y = guiTop + 18
|
||||
fill(x, y, x + 16, y + 16, hiddenSlotColor)
|
||||
fill(matrix, x, y, x + 16, y + 16, hiddenSlotColor)
|
||||
}
|
||||
}
|
||||
|
@@ -1,48 +1,48 @@
|
||||
package chylex.hee.client.gui.base
|
||||
|
||||
import chylex.hee.client.render.gl.GL
|
||||
import chylex.hee.game.inventory.size
|
||||
import chylex.hee.system.color.IntColor.Companion.RGB
|
||||
import chylex.hee.system.facades.Resource
|
||||
import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.Sided
|
||||
import com.mojang.blaze3d.matrix.MatrixStack
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen
|
||||
import net.minecraft.entity.player.PlayerInventory
|
||||
import net.minecraft.inventory.container.ChestContainer
|
||||
import net.minecraft.util.text.ITextComponent
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
abstract class GuiBaseChestContainer<T : ChestContainer>(container: T, inventory: PlayerInventory, title: ITextComponent) : ContainerScreen<T>(container, inventory, title) {
|
||||
private companion object {
|
||||
abstract class GuiBaseChestContainer<T : ChestContainer>(container: T, inventory: PlayerInventory, title: ITextComponent) : ContainerScreen<T>(container, inventory, title){
|
||||
private companion object{
|
||||
private val TEX_BACKGROUND = Resource.Vanilla("textures/gui/container/generic_54.png")
|
||||
private val COLOR_TEXT = RGB(64u).i
|
||||
}
|
||||
|
||||
private val containerRows = container.lowerChestInventory.size / 9
|
||||
|
||||
init {
|
||||
init{
|
||||
ySize = 114 + (containerRows * 18)
|
||||
}
|
||||
|
||||
override fun render(mouseX: Int, mouseY: Int, partialTicks: Float) {
|
||||
renderBackground()
|
||||
super.render(mouseX, mouseY, partialTicks)
|
||||
renderHoveredToolTip(mouseX, mouseY)
|
||||
override fun render(matrix: MatrixStack, mouseX: Int, mouseY: Int, partialTicks: Float){
|
||||
renderBackground(matrix)
|
||||
super.render(matrix, mouseX, mouseY, partialTicks)
|
||||
renderHoveredTooltip(matrix, mouseX, mouseY)
|
||||
}
|
||||
|
||||
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int) {
|
||||
override fun drawGuiContainerBackgroundLayer(matrix: MatrixStack, partialTicks: Float, mouseX: Int, mouseY: Int){
|
||||
val x = (width - xSize) / 2
|
||||
val y = (height - ySize) / 2
|
||||
val heightContainer = 17 + (containerRows * 18)
|
||||
|
||||
GL.color(1F, 1F, 1F, 1F)
|
||||
GL.bindTexture(TEX_BACKGROUND)
|
||||
blit(x, y, 0, 0, xSize, heightContainer)
|
||||
blit(x, y + heightContainer, 0, 126, xSize, 96)
|
||||
blit(matrix, x, y, 0, 0, xSize, heightContainer)
|
||||
blit(matrix, x, y + heightContainer, 0, 126, xSize, 96)
|
||||
}
|
||||
|
||||
override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int) {
|
||||
font.drawString(title.formattedText, 8F, 6F, COLOR_TEXT)
|
||||
font.drawString(playerInventory.displayName.formattedText, 8F, ySize - 94F, COLOR_TEXT)
|
||||
override fun drawGuiContainerForegroundLayer(matrix: MatrixStack, mouseX: Int, mouseY: Int){
|
||||
font.drawString(matrix, title.string, 8F, 6F, COLOR_TEXT)
|
||||
font.drawString(matrix, playerInventory.displayName.string, 8F, ySize - 94F, COLOR_TEXT)
|
||||
}
|
||||
}
|
||||
|
@@ -1,41 +1,41 @@
|
||||
package chylex.hee.client.gui.base
|
||||
|
||||
import chylex.hee.client.render.gl.GL
|
||||
import chylex.hee.game.container.base.ContainerBaseCustomInventory
|
||||
import chylex.hee.system.color.IntColor.Companion.RGB
|
||||
import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.Sided
|
||||
import com.mojang.blaze3d.matrix.MatrixStack
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen
|
||||
import net.minecraft.entity.player.PlayerInventory
|
||||
import net.minecraft.util.ResourceLocation
|
||||
import net.minecraft.util.text.ITextComponent
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
abstract class GuiBaseCustomInventory<T : ContainerBaseCustomInventory<*>>(container: T, inventory: PlayerInventory, title: ITextComponent) : ContainerScreen<T>(container, inventory, title) {
|
||||
private companion object {
|
||||
abstract class GuiBaseCustomInventory<T : ContainerBaseCustomInventory<*>>(container: T, inventory: PlayerInventory, title: ITextComponent) : ContainerScreen<T>(container, inventory, title){
|
||||
private companion object{
|
||||
private val COLOR_TEXT = RGB(64u).i
|
||||
}
|
||||
|
||||
protected abstract val texBackground: ResourceLocation
|
||||
protected abstract val titleContainer: String
|
||||
|
||||
override fun render(mouseX: Int, mouseY: Int, partialTicks: Float) {
|
||||
renderBackground()
|
||||
super.render(mouseX, mouseY, partialTicks)
|
||||
renderHoveredToolTip(mouseX, mouseY)
|
||||
override fun render(matrix: MatrixStack, mouseX: Int, mouseY: Int, partialTicks: Float){
|
||||
renderBackground(matrix)
|
||||
super.render(matrix, mouseX, mouseY, partialTicks)
|
||||
renderHoveredTooltip(matrix, mouseX, mouseY)
|
||||
}
|
||||
|
||||
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int) {
|
||||
override fun drawGuiContainerBackgroundLayer(matrix: MatrixStack, partialTicks: Float, mouseX: Int, mouseY: Int){
|
||||
val x = (width - xSize) / 2
|
||||
val y = (height - ySize) / 2
|
||||
|
||||
GL.color(1F, 1F, 1F, 1F)
|
||||
GL.bindTexture(texBackground)
|
||||
blit(x, y, 0, 0, xSize, ySize)
|
||||
blit(matrix, x, y, 0, 0, xSize, ySize)
|
||||
}
|
||||
|
||||
override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int) {
|
||||
font.drawString(title.formattedText, 8F, 6F, COLOR_TEXT)
|
||||
font.drawString(playerInventory.displayName.formattedText, 8F, ySize - 94F, COLOR_TEXT)
|
||||
override fun drawGuiContainerForegroundLayer(matrix: MatrixStack, mouseX: Int, mouseY: Int){
|
||||
font.drawString(matrix, title.string, 8F, 6F, COLOR_TEXT)
|
||||
font.drawString(matrix, playerInventory.displayName.string, 8F, ySize - 94F, COLOR_TEXT)
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.model.block
|
||||
|
||||
import chylex.hee.client.model.beginBox
|
||||
import chylex.hee.client.render.gl.translateZ
|
||||
import chylex.hee.system.forge.Side
|
||||
@@ -9,19 +8,19 @@ import com.mojang.blaze3d.vertex.IVertexBuilder
|
||||
import net.minecraft.client.renderer.RenderType
|
||||
import net.minecraft.client.renderer.model.Model
|
||||
import net.minecraft.client.renderer.model.ModelRenderer
|
||||
import net.minecraft.util.math.Vec3d
|
||||
import net.minecraft.util.math.vector.Vector3d
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.sin
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
object ModelBlockIgneousPlate : Model(RenderType::getEntityCutout) {
|
||||
object ModelBlockIgneousPlate : Model(RenderType::getEntityCutout){
|
||||
const val ANIMATION_PERIOD = PI
|
||||
|
||||
private val outerBox: ModelRenderer
|
||||
private val innerBox: ModelRenderer
|
||||
|
||||
init {
|
||||
init{
|
||||
textureWidth = 32
|
||||
textureHeight = 16
|
||||
|
||||
@@ -37,11 +36,11 @@ object ModelBlockIgneousPlate : Model(RenderType::getEntityCutout) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun render(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float) {
|
||||
override fun render(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float){
|
||||
outerBox.render(matrix, builder, combinedLight, combinedOverlay, red, green, blue, alpha)
|
||||
}
|
||||
|
||||
fun renderInnerBox(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, color: Vec3d, animation: Double) {
|
||||
fun renderInnerBox(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, color: Vector3d, animation: Double){
|
||||
matrix.push()
|
||||
matrix.translateZ(-abs(sin(-animation)).toFloat() * 0.0925)
|
||||
innerBox.render(matrix, builder, combinedLight, combinedOverlay, color.x.toFloat(), color.y.toFloat(), color.z.toFloat(), 1F)
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.model.entity
|
||||
|
||||
import chylex.hee.client.model.FACE_FRONT
|
||||
import chylex.hee.client.model.beginBox
|
||||
import chylex.hee.client.model.retainFace
|
||||
@@ -13,7 +12,7 @@ import net.minecraft.client.renderer.entity.model.EntityModel
|
||||
import net.minecraft.client.renderer.model.ModelRenderer
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
object ModelEntityBossEnderEye : EntityModel<EntityBossEnderEye>() {
|
||||
object ModelEntityBossEnderEye : EntityModel<EntityBossEnderEye>(){
|
||||
const val SCALE = 16F / 18F
|
||||
|
||||
private val head: ModelRenderer
|
||||
@@ -22,7 +21,7 @@ object ModelEntityBossEnderEye : EntityModel<EntityBossEnderEye>() {
|
||||
|
||||
private var eyeState = 0
|
||||
|
||||
init {
|
||||
init{
|
||||
textureWidth = 128
|
||||
textureHeight = 64
|
||||
|
||||
@@ -31,7 +30,7 @@ object ModelEntityBossEnderEye : EntityModel<EntityBossEnderEye>() {
|
||||
beginBox.offset(-9F, -9F, -9F).size(18, 18, 18).tex(0, 0).add()
|
||||
}
|
||||
|
||||
eyes = Array(8) {
|
||||
eyes = Array(8){
|
||||
ModelRenderer(this).apply {
|
||||
setRotationPoint(0F, 15F, 0F)
|
||||
beginBox.offset(-8F, -8F, -9F).size(16, 16, 1).tex(-1 + (16 * it), 47).add()
|
||||
@@ -46,22 +45,22 @@ object ModelEntityBossEnderEye : EntityModel<EntityBossEnderEye>() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun setLivingAnimations(entity: EntityBossEnderEye, limbSwing: Float, limbSwingAmount: Float, partialTicks: Float) {
|
||||
override fun setLivingAnimations(entity: EntityBossEnderEye, limbSwing: Float, limbSwingAmount: Float, partialTicks: Float){
|
||||
arms.rotateAngleX = entity.clientArmAngle.get(partialTicks).toRadians()
|
||||
|
||||
eyeState = when {
|
||||
eyeState = when{
|
||||
entity.eyeState == EntityBossEnderEye.EYE_CLOSED -> 0
|
||||
entity.eyeState == EntityBossEnderEye.EYE_LASER -> 7
|
||||
entity.isDemonEye -> 7
|
||||
else -> entity.demonLevel + 1
|
||||
entity.eyeState == EntityBossEnderEye.EYE_LASER -> 7
|
||||
entity.isDemonEye -> 7
|
||||
else -> entity.demonLevel + 1
|
||||
}
|
||||
}
|
||||
|
||||
override fun setRotationAngles(entity: EntityBossEnderEye, limbSwing: Float, limbSwingAmount: Float, age: Float, headYaw: Float, headPitch: Float) {
|
||||
override fun setRotationAngles(entity: EntityBossEnderEye, limbSwing: Float, limbSwingAmount: Float, age: Float, headYaw: Float, headPitch: Float){
|
||||
head.rotateAngleX = headPitch.toRadians()
|
||||
}
|
||||
|
||||
override fun render(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float) {
|
||||
override fun render(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float){
|
||||
head.render(matrix, builder, combinedLight, combinedOverlay, red, green, blue, alpha)
|
||||
eyes[eyeState].also { it.rotateAngleX = head.rotateAngleX }.render(matrix, builder, combinedLight, combinedOverlay, red, green, blue, alpha)
|
||||
arms.render(matrix, builder, combinedLight, combinedOverlay, red, green, blue, alpha)
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.model.entity
|
||||
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.client.model.FACE_FRONT
|
||||
import chylex.hee.client.model.beginBox
|
||||
@@ -18,7 +17,7 @@ import net.minecraft.client.renderer.entity.model.EntityModel
|
||||
import net.minecraft.client.renderer.model.ModelRenderer
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
object ModelEntityMobBlobby : EntityModel<EntityMobBlobby>() {
|
||||
object ModelEntityMobBlobby : EntityModel<EntityMobBlobby>(){
|
||||
const val GLOBAL_SCALE = 8F / 9F
|
||||
|
||||
private const val SIZE_BODY = 9
|
||||
@@ -35,7 +34,7 @@ object ModelEntityMobBlobby : EntityModel<EntityMobBlobby>() {
|
||||
private var g = 255F
|
||||
private var b = 55F
|
||||
|
||||
init {
|
||||
init{
|
||||
textureWidth = 128
|
||||
textureHeight = 256
|
||||
|
||||
@@ -55,22 +54,22 @@ object ModelEntityMobBlobby : EntityModel<EntityMobBlobby>() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun setLivingAnimations(entity: EntityMobBlobby, limbSwing: Float, limbSwingAmount: Float, partialTicks: Float) {
|
||||
override fun setLivingAnimations(entity: EntityMobBlobby, limbSwing: Float, limbSwingAmount: Float, partialTicks: Float){
|
||||
entity.color.let {
|
||||
r = it.redF
|
||||
g = it.greenF
|
||||
b = it.blueF
|
||||
r = it.red / 255F
|
||||
g = it.green / 255F
|
||||
b = it.blue / 255F
|
||||
}
|
||||
}
|
||||
|
||||
override fun setRotationAngles(entity: EntityMobBlobby, limbSwing: Float, limbSwingAmount: Float, age: Float, headYaw: Float, headPitch: Float) {
|
||||
override fun setRotationAngles(entity: EntityMobBlobby, limbSwing: Float, limbSwingAmount: Float, age: Float, headYaw: Float, headPitch: Float){
|
||||
val vecBlobbyLook = Vec3.fromYaw(entity.rotationYawHead)
|
||||
val vecCameraDiff = MC.renderManager.info.projectedView.subtract(entity.posVec).normalize()
|
||||
|
||||
isPlayerInFront = vecBlobbyLook.dotProduct(vecCameraDiff) > 0.0
|
||||
}
|
||||
|
||||
override fun render(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float) {
|
||||
override fun render(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float){
|
||||
matrix.translateY(-0.001)
|
||||
|
||||
matrix.push()
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.model.entity
|
||||
|
||||
import chylex.hee.client.model.beginBox
|
||||
import chylex.hee.game.entity.item.EntityTokenHolder
|
||||
import chylex.hee.system.forge.Side
|
||||
@@ -10,10 +9,10 @@ import net.minecraft.client.renderer.entity.model.EntityModel
|
||||
import net.minecraft.client.renderer.model.ModelRenderer
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
object ModelEntityTokenHolder : EntityModel<EntityTokenHolder>() {
|
||||
object ModelEntityTokenHolder : EntityModel<EntityTokenHolder>(){
|
||||
private val box: ModelRenderer
|
||||
|
||||
init {
|
||||
init{
|
||||
textureWidth = 64
|
||||
textureHeight = 32
|
||||
|
||||
@@ -22,9 +21,9 @@ object ModelEntityTokenHolder : EntityModel<EntityTokenHolder>() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun setRotationAngles(entity: EntityTokenHolder, limbSwing: Float, limbSwingAmount: Float, age: Float, headYaw: Float, headPitch: Float) {}
|
||||
override fun setRotationAngles(entity: EntityTokenHolder, limbSwing: Float, limbSwingAmount: Float, age: Float, headYaw: Float, headPitch: Float){}
|
||||
|
||||
override fun render(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float) {
|
||||
override fun render(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float){
|
||||
box.render(matrix, builder, combinedLight, combinedOverlay, red, green, blue, alpha)
|
||||
}
|
||||
}
|
||||
|
@@ -1,16 +1,15 @@
|
||||
package chylex.hee.client.model.entity
|
||||
|
||||
import chylex.hee.game.entity.living.EntityMobUndread
|
||||
import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.Sided
|
||||
import net.minecraft.client.renderer.entity.model.AbstractZombieModel
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class ModelEntityMobUndread private constructor(modelSize: Float, textureWidth: Int, textureHeight: Int) : AbstractZombieModel<EntityMobUndread>(modelSize, 0F, textureWidth, textureHeight) {
|
||||
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 isAggressive(entity: EntityMobUndread): Boolean {
|
||||
override fun isAggressive(entity: EntityMobUndread): Boolean{
|
||||
return entity.isAggressive
|
||||
}
|
||||
}
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.model.item
|
||||
|
||||
import chylex.hee.HEE
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.system.facades.Resource
|
||||
@@ -24,32 +23,32 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
@Suppress("unused")
|
||||
class ModelItemAmuletOfRecovery private constructor(sourceModel: IBakedModel) : BakedModelWrapper<IBakedModel>(sourceModel) {
|
||||
class ModelItemAmuletOfRecovery private constructor(sourceModel: IBakedModel) : BakedModelWrapper<IBakedModel>(sourceModel){
|
||||
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID, bus = MOD)
|
||||
companion object {
|
||||
companion object{
|
||||
private val RESOURCE_NORMAL = ModelResourceLocation(Resource.Custom("amulet_of_recovery"), "inventory")
|
||||
private val RESOURCE_HELD = Resource.Custom("item/amulet_of_recovery_held")
|
||||
|
||||
private lateinit var modelRegistry: MutableMap<ResourceLocation, IBakedModel>
|
||||
|
||||
@SubscribeEvent
|
||||
fun onRegisterModels(@Suppress("UNUSED_PARAMETER") e: ModelRegistryEvent) {
|
||||
fun onRegisterModels(@Suppress("UNUSED_PARAMETER") e: ModelRegistryEvent){
|
||||
ModelLoader.addSpecialModel(RESOURCE_HELD)
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
fun onModelBake(e: ModelBakeEvent) {
|
||||
fun onModelBake(e: ModelBakeEvent){
|
||||
modelRegistry = e.modelRegistry
|
||||
modelRegistry[RESOURCE_NORMAL] = ModelItemAmuletOfRecovery(modelRegistry.getValue(RESOURCE_NORMAL))
|
||||
}
|
||||
}
|
||||
|
||||
override fun handlePerspective(transformType: TransformType, matrix: MatrixStack): IBakedModel = when(transformType) {
|
||||
override fun handlePerspective(transformType: TransformType, matrix: MatrixStack): IBakedModel = when(transformType){
|
||||
FIRST_PERSON_LEFT_HAND,
|
||||
FIRST_PERSON_RIGHT_HAND,
|
||||
THIRD_PERSON_LEFT_HAND,
|
||||
THIRD_PERSON_RIGHT_HAND ->
|
||||
modelRegistry.getOrElse(RESOURCE_HELD) { MC.instance.modelManager.missingModel }.handlePerspective(transformType, matrix)
|
||||
modelRegistry.getOrElse(RESOURCE_HELD){ MC.instance.modelManager.missingModel }.handlePerspective(transformType, matrix)
|
||||
|
||||
else ->
|
||||
super.handlePerspective(transformType, matrix)
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render
|
||||
|
||||
import chylex.hee.HEE
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.client.render.gl.DF_ONE_MINUS_SRC_ALPHA
|
||||
@@ -34,8 +33,8 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.HELMET
|
||||
|
||||
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID)
|
||||
object OverlayRenderer {
|
||||
private const val BORDER_SIZE = 4
|
||||
object OverlayRenderer{
|
||||
private const val BORDER_SIZE = 4
|
||||
private const val LINE_SPACING = 7
|
||||
|
||||
private val TEX_ENDER_GOO_OVERLAY = Resource.Custom("textures/overlay/ender_goo.png")
|
||||
@@ -46,10 +45,10 @@ object OverlayRenderer {
|
||||
// Ender Goo
|
||||
|
||||
@SubscribeEvent
|
||||
fun onFogDensity(e: FogDensity) {
|
||||
fun onFogDensity(e: FogDensity){
|
||||
val inside = e.info.blockAtCamera.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)
|
||||
e.density = if (inside === Materials.ENDER_GOO) 0.66F else 0.06F
|
||||
e.isCanceled = true // otherwise the event is ignored
|
||||
@@ -57,29 +56,29 @@ object OverlayRenderer {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
fun onRenderHelmetOverlayPre(e: RenderGameOverlayEvent.Pre) {
|
||||
if (e.type != HELMET) {
|
||||
fun onRenderHelmetOverlayPre(e: RenderGameOverlayEvent.Pre){
|
||||
if (e.type != HELMET){
|
||||
return
|
||||
}
|
||||
|
||||
val player = MC.player ?: return
|
||||
val inside = MC.gameRenderer.activeRenderInfo.blockAtCamera.material
|
||||
|
||||
if ((inside === Materials.ENDER_GOO || inside === Materials.PURIFIED_ENDER_GOO) && MC.settings.thirdPersonView == 0 && !player.isSpectator) {
|
||||
if ((inside === Materials.ENDER_GOO || inside === Materials.PURIFIED_ENDER_GOO) && MC.settings.thirdPersonView == 0 && !player.isSpectator){
|
||||
val window = MC.window
|
||||
val brightness = player.brightness
|
||||
|
||||
GL.color(brightness, brightness, brightness, 1F)
|
||||
GL.blendFunc(SF_SRC_ALPHA, DF_ONE_MINUS_SRC_ALPHA, SF_ONE, DF_ZERO)
|
||||
|
||||
if (inside === Materials.ENDER_GOO) {
|
||||
if (inside === Materials.ENDER_GOO){
|
||||
GL.bindTexture(TEX_ENDER_GOO_OVERLAY)
|
||||
}
|
||||
else {
|
||||
else{
|
||||
GL.bindTexture(TEX_PURIFIED_ENDER_GOO_OVERLAY)
|
||||
}
|
||||
|
||||
MC.instance.ingameGUI.blit(0, 0, 0, 0, window.scaledWidth, window.scaledHeight)
|
||||
MC.instance.ingameGUI.blit(e.matrixStack, 0, 0, 0, 0, window.scaledWidth, window.scaledHeight)
|
||||
|
||||
GL.color(1F, 1F, 1F, 1F)
|
||||
}
|
||||
@@ -88,11 +87,12 @@ object OverlayRenderer {
|
||||
// Energy Cluster
|
||||
|
||||
@SubscribeEvent
|
||||
fun onRenderText(@Suppress("UNUSED_PARAMETER") e: RenderGameOverlayEvent.Text) {
|
||||
fun drawTextOffScreenCenter(x: Int, y: Int, line: Int, text: String, color: IntColor) {
|
||||
fun onRenderText(@Suppress("UNUSED_PARAMETER") e: RenderGameOverlayEvent.Text){
|
||||
fun drawTextOffScreenCenter(x: Int, y: Int, line: Int, text: String, color: IntColor){
|
||||
val window = MC.window
|
||||
val matrix = e.matrixStack
|
||||
|
||||
with(MC.fontRenderer) {
|
||||
with(MC.fontRenderer){
|
||||
val centerX = x + (window.scaledWidth / 2)
|
||||
val centerY = y + (window.scaledHeight / 2) + (line * (LINE_SPACING + FONT_HEIGHT))
|
||||
|
||||
@@ -102,15 +102,15 @@ object OverlayRenderer {
|
||||
val offsetX = -(textWidth / 2)
|
||||
val offsetY = -(textHeight / 2)
|
||||
|
||||
AbstractGui.fill(centerX + offsetX - BORDER_SIZE, centerY + offsetY - BORDER_SIZE, centerX - offsetX + BORDER_SIZE - 1, centerY - offsetY + BORDER_SIZE - 1, RGBA(0u, 0.6F).i)
|
||||
drawStringWithShadow(text, (centerX + offsetX).toFloat(), (centerY + offsetY).toFloat(), color.i)
|
||||
AbstractGui.fill(matrix, centerX + offsetX - BORDER_SIZE, centerY + offsetY - BORDER_SIZE, centerX - offsetX + BORDER_SIZE - 1, centerY - offsetY + BORDER_SIZE - 1, RGBA(0u, 0.6F).i)
|
||||
drawStringWithShadow(matrix, text, (centerX + offsetX).toFloat(), (centerY + offsetY).toFloat(), color.i)
|
||||
}
|
||||
}
|
||||
|
||||
clusterLookedAt?.let {
|
||||
clusterLookedAt = null
|
||||
|
||||
fun getQuantityString(quantity: IEnergyQuantity): String {
|
||||
fun getQuantityString(quantity: IEnergyQuantity): String{
|
||||
return if (it.energyLevel == MAX_POSSIBLE_VALUE)
|
||||
"${TextFormatting.OBFUSCATED}##${TextFormatting.RESET}"
|
||||
else
|
||||
@@ -127,7 +127,7 @@ object OverlayRenderer {
|
||||
val capacity = getQuantityString(it.energyRegenCapacity)
|
||||
drawTextOffScreenCenter(0, -40, firstLine + 1, I18n.format("hee.energy.overlay.level", level, capacity), RGB(220u))
|
||||
|
||||
if (isIgnored) {
|
||||
if (isIgnored){
|
||||
drawTextOffScreenCenter(0, -40, firstLine + 2, I18n.format("hee.energy.overlay.ignored"), RGB(160u))
|
||||
}
|
||||
}
|
||||
@@ -136,17 +136,17 @@ object OverlayRenderer {
|
||||
// Block outlines
|
||||
|
||||
@SubscribeEvent
|
||||
fun onRenderBlockOutline(e: DrawHighlightEvent.HighlightBlock) {
|
||||
fun onRenderBlockOutline(e: DrawHighlightEvent.HighlightBlock){
|
||||
val world = MC.world ?: return
|
||||
|
||||
val pos = e.target.pos
|
||||
val block = pos.getBlock(world)
|
||||
|
||||
if (block === ModBlocks.ENERGY_CLUSTER) {
|
||||
if (block === ModBlocks.ENERGY_CLUSTER){
|
||||
clusterLookedAt = pos.getTile(world)
|
||||
e.isCanceled = true
|
||||
}
|
||||
else if (block is BlockAbstractPortal) {
|
||||
else if (block is BlockAbstractPortal){
|
||||
e.isCanceled = true
|
||||
}
|
||||
}
|
||||
|
@@ -1,24 +1,20 @@
|
||||
package chylex.hee.client.render
|
||||
|
||||
import chylex.hee.HEE
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.client.render.gl.DF_ONE_MINUS_SRC_ALPHA
|
||||
import chylex.hee.client.render.gl.DF_ZERO
|
||||
import chylex.hee.client.render.gl.FOG_EXP2
|
||||
import chylex.hee.client.render.gl.GL
|
||||
import chylex.hee.client.render.gl.SF_ONE
|
||||
import chylex.hee.client.render.gl.SF_SRC_ALPHA
|
||||
import chylex.hee.client.render.territory.AbstractEnvironmentRenderer
|
||||
import chylex.hee.game.entity.dimensionKey
|
||||
import chylex.hee.game.entity.lookDirVec
|
||||
import chylex.hee.game.entity.posVec
|
||||
import chylex.hee.game.particle.ParticleVoid
|
||||
import chylex.hee.game.particle.spawner.ParticleSpawnerCustom
|
||||
import chylex.hee.game.particle.spawner.properties.IOffset.InBox
|
||||
import chylex.hee.game.particle.spawner.properties.IShape.Point
|
||||
import chylex.hee.game.world.WorldProviderEndCustom
|
||||
import chylex.hee.game.world.territory.TerritoryType
|
||||
import chylex.hee.game.world.territory.TerritoryVoid
|
||||
import chylex.hee.game.world.territory.properties.TerritoryEnvironment
|
||||
import chylex.hee.system.Debug
|
||||
import chylex.hee.system.color.IntColor
|
||||
import chylex.hee.system.color.IntColor.Companion.RGB
|
||||
@@ -27,13 +23,11 @@ import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.SubscribeAllEvents
|
||||
import chylex.hee.system.forge.SubscribeEvent
|
||||
import chylex.hee.system.math.LerpedFloat
|
||||
import chylex.hee.system.math.Vec3
|
||||
import chylex.hee.system.math.floorToInt
|
||||
import chylex.hee.system.math.scale
|
||||
import chylex.hee.system.migration.EntityPlayer
|
||||
import com.mojang.blaze3d.matrix.MatrixStack
|
||||
import net.minecraft.client.resources.I18n
|
||||
import net.minecraft.world.dimension.DimensionType
|
||||
import net.minecraftforge.client.event.EntityViewRenderEvent.RenderFogEvent
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent
|
||||
import net.minecraftforge.common.MinecraftForge
|
||||
import net.minecraftforge.event.TickEvent.ClientTickEvent
|
||||
@@ -43,41 +37,30 @@ import kotlin.math.min
|
||||
import kotlin.math.pow
|
||||
|
||||
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID)
|
||||
object TerritoryRenderer {
|
||||
@JvmStatic
|
||||
val environment
|
||||
get() = MC.player?.let { TerritoryType.fromX(it.posX.floorToInt()) }?.desc?.environment
|
||||
|
||||
@JvmStatic
|
||||
val skyColor
|
||||
get() = (environment?.let(TerritoryEnvironment::fogColor) ?: Vec3.ZERO).let {
|
||||
// use fog color because vanilla blends fog into sky color based on chunk render distance
|
||||
RGB((it.x * 255).floorToInt(), (it.y * 255).floorToInt(), (it.z * 255).floorToInt()).i
|
||||
}
|
||||
|
||||
object TerritoryRenderer{
|
||||
private var prevChunkX = Int.MAX_VALUE
|
||||
private var prevTerritory: TerritoryType? = null
|
||||
|
||||
@SubscribeEvent
|
||||
fun onClientTick(e: ClientTickEvent) {
|
||||
if (e.phase == Phase.START) {
|
||||
fun onClientTick(e: ClientTickEvent){
|
||||
if (e.phase == Phase.START){
|
||||
val player = MC.player
|
||||
|
||||
if (player != null && player.world.dimension is WorldProviderEndCustom && player.ticksExisted > 0) {
|
||||
if (player != null && player.dimensionKey === HEE.dim && player.ticksExisted > 0){
|
||||
Void.tick(player)
|
||||
Title.tick()
|
||||
|
||||
val newChunkX = player.chunkCoordX
|
||||
|
||||
if (prevChunkX != newChunkX) {
|
||||
if (prevChunkX != newChunkX){
|
||||
prevChunkX = newChunkX
|
||||
|
||||
val newTerritory = TerritoryType.fromX(player.posX.floorToInt())
|
||||
|
||||
if (prevTerritory != newTerritory) {
|
||||
if (prevTerritory != newTerritory){
|
||||
prevTerritory = newTerritory
|
||||
|
||||
if (newTerritory != null) {
|
||||
if (newTerritory != null){
|
||||
Void.reset()
|
||||
Title.display(newTerritory)
|
||||
newTerritory.desc.environment.setupClient(player)
|
||||
@@ -87,7 +70,7 @@ object TerritoryRenderer {
|
||||
|
||||
prevTerritory?.desc?.environment?.tickClient(player)
|
||||
}
|
||||
else if (prevTerritory != null) {
|
||||
else if (prevTerritory != null){
|
||||
prevTerritory = null
|
||||
prevChunkX = Int.MAX_VALUE
|
||||
|
||||
@@ -97,31 +80,12 @@ object TerritoryRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
fun onFog(@Suppress("UNUSED_PARAMETER") e: RenderFogEvent) {
|
||||
val player = MC.player?.takeIf { it.world.dimension.type == DimensionType.THE_END } ?: return
|
||||
val territory = TerritoryType.fromPos(player)
|
||||
|
||||
if (territory == null || WorldProviderEndCustom.debugMode) {
|
||||
GL.setFogMode(FOG_EXP2)
|
||||
GL.setFogDensity(0F)
|
||||
}
|
||||
else {
|
||||
val env = territory.desc.environment
|
||||
val density = env.fogDensity * AbstractEnvironmentRenderer.currentFogDensityMp
|
||||
val modifier = env.fogRenderDistanceModifier * AbstractEnvironmentRenderer.currentRenderDistanceMp
|
||||
|
||||
GL.setFogMode(FOG_EXP2)
|
||||
GL.setFogDensity(density + modifier)
|
||||
}
|
||||
}
|
||||
|
||||
// Void handling
|
||||
|
||||
val VOID_FACTOR_VALUE
|
||||
get() = Void.voidFactor.get(MC.partialTicks)
|
||||
|
||||
private object Void {
|
||||
private object Void{
|
||||
private val VOID_PARTICLE = ParticleSpawnerCustom(
|
||||
type = ParticleVoid,
|
||||
pos = InBox(8F)
|
||||
@@ -129,20 +93,20 @@ object TerritoryRenderer {
|
||||
|
||||
val voidFactor = LerpedFloat(TerritoryVoid.OUTSIDE_VOID_FACTOR)
|
||||
|
||||
init {
|
||||
if (Debug.enabled) {
|
||||
init{
|
||||
if (Debug.enabled){
|
||||
MinecraftForge.EVENT_BUS.register(this)
|
||||
}
|
||||
}
|
||||
|
||||
fun tick(player: EntityPlayer) {
|
||||
fun tick(player: EntityPlayer){
|
||||
val factor = TerritoryVoid.getVoidFactor(player).also(voidFactor::update)
|
||||
|
||||
if (factor == TerritoryVoid.OUTSIDE_VOID_FACTOR || MC.instance.isGamePaused) {
|
||||
if (factor == TerritoryVoid.OUTSIDE_VOID_FACTOR || MC.instance.isGamePaused){
|
||||
return
|
||||
}
|
||||
|
||||
if (factor > TerritoryVoid.OUTSIDE_VOID_FACTOR) {
|
||||
if (factor > TerritoryVoid.OUTSIDE_VOID_FACTOR){
|
||||
val rand = player.rng
|
||||
|
||||
val mp = min(1F, (factor * 0.275F) + 0.275F)
|
||||
@@ -153,14 +117,14 @@ object TerritoryRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
fun reset(){
|
||||
voidFactor.updateImmediately(TerritoryVoid.OUTSIDE_VOID_FACTOR)
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text) {
|
||||
if (MC.settings.showDebugInfo && MC.player?.dimension === HEE.dim) {
|
||||
with(e.left) {
|
||||
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text){
|
||||
if (MC.settings.showDebugInfo && MC.player?.dimensionKey === HEE.dim){
|
||||
with(e.left){
|
||||
add("")
|
||||
add("End Void Factor: ${"%.3f".format(voidFactor.currentValue)}")
|
||||
}
|
||||
@@ -171,7 +135,7 @@ object TerritoryRenderer {
|
||||
// Text rendering
|
||||
|
||||
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID)
|
||||
private object Title {
|
||||
private object Title{
|
||||
private const val FADE_TICKS = 22
|
||||
|
||||
private var textTime = 0
|
||||
@@ -180,19 +144,19 @@ object TerritoryRenderer {
|
||||
private var textMainColor = RGB(0u)
|
||||
private var textShadowColor = RGB(0u)
|
||||
|
||||
fun display(newTerritory: TerritoryType) {
|
||||
fun display(newTerritory: TerritoryType){
|
||||
val title = I18n.format(newTerritory.translationKey)
|
||||
|
||||
textTime = 60 + (2 * title.length)
|
||||
textFade = FADE_TICKS
|
||||
textTitle = title
|
||||
|
||||
with(newTerritory.desc.colors) {
|
||||
if (tokenTop.asVec.lengthSquared() > tokenBottom.asVec.lengthSquared()) {
|
||||
with(newTerritory.desc.colors){
|
||||
if (tokenTop.asVec.lengthSquared() > tokenBottom.asVec.lengthSquared()){
|
||||
textMainColor = tokenTop
|
||||
textShadowColor = tokenBottom
|
||||
}
|
||||
else {
|
||||
else{
|
||||
textMainColor = tokenBottom
|
||||
textShadowColor = tokenTop
|
||||
}
|
||||
@@ -201,20 +165,20 @@ object TerritoryRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
fun tick() {
|
||||
if (textTime > 0) {
|
||||
fun tick(){
|
||||
if (textTime > 0){
|
||||
--textTime
|
||||
--textFade
|
||||
}
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
fun reset(){
|
||||
textTime = 0
|
||||
}
|
||||
|
||||
@SubscribeEvent(EventPriority.HIGHEST)
|
||||
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text) {
|
||||
if (textTime == 0) {
|
||||
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text){
|
||||
if (textTime == 0){
|
||||
return
|
||||
}
|
||||
|
||||
@@ -223,7 +187,7 @@ object TerritoryRenderer {
|
||||
val width = resolution.scaledWidth
|
||||
val height = resolution.scaledHeight
|
||||
|
||||
val opacity = when {
|
||||
val opacity = when{
|
||||
textFade > 0 -> ((FADE_TICKS - (textFade - e.partialTicks)) / FADE_TICKS.toFloat()).coerceIn(0F, 1F)
|
||||
textTime < FADE_TICKS -> ((textTime - e.partialTicks) / FADE_TICKS.toFloat()).coerceIn(0F, 1F)
|
||||
else -> 1F
|
||||
@@ -240,8 +204,8 @@ object TerritoryRenderer {
|
||||
val x = -fontRenderer.getStringWidth(textTitle) * 0.5F
|
||||
val y = -fontRenderer.FONT_HEIGHT - 2F
|
||||
|
||||
drawTitle(x + 0.5F, y + 0.5F, textShadowColor.withAlpha(opacity.pow(1.25F)))
|
||||
drawTitle(x, y, textMainColor.withAlpha(opacity))
|
||||
drawTitle(e.matrixStack, x + 0.5F, y + 0.5F, textShadowColor.withAlpha(opacity.pow(1.25F)))
|
||||
drawTitle(e.matrixStack, x, y, textMainColor.withAlpha(opacity))
|
||||
|
||||
GL.popMatrix()
|
||||
GL.alphaFunc(GL_GREATER, 0.1F)
|
||||
@@ -249,9 +213,9 @@ object TerritoryRenderer {
|
||||
GL.popMatrix()
|
||||
}
|
||||
|
||||
private fun drawTitle(x: Float, y: Float, color: IntColor) {
|
||||
if (color.alpha > 3) { // prevents flickering alpha
|
||||
MC.fontRenderer.drawString(textTitle, x, y, color.i)
|
||||
private fun drawTitle(matrix: MatrixStack, x: Float, y: Float, color: IntColor){
|
||||
if (color.alpha > 3){ // prevents flickering alpha
|
||||
MC.fontRenderer.drawString(matrix, textTitle, x, y, color.i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,8 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.client.render.gl.DF_ONE
|
||||
import chylex.hee.client.render.gl.DF_ONE_MINUS_SRC_ALPHA
|
||||
import chylex.hee.client.render.gl.RenderStateBuilder
|
||||
import chylex.hee.client.render.gl.RenderStateBuilder.Companion.FOG_BLACK
|
||||
import chylex.hee.client.render.gl.RenderStateBuilder.Companion.FOG_ENABLED
|
||||
import chylex.hee.client.render.gl.SF_SRC_ALPHA
|
||||
import chylex.hee.game.block.BlockAbstractPortal
|
||||
@@ -25,12 +23,12 @@ import chylex.hee.system.math.toRadians
|
||||
import com.mojang.blaze3d.matrix.MatrixStack
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer
|
||||
import net.minecraft.client.renderer.Matrix4f
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||
import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.util.math.Vec3d
|
||||
import net.minecraft.util.math.vector.Matrix4f
|
||||
import net.minecraft.util.math.vector.Vector3d
|
||||
import net.minecraft.world.World
|
||||
import org.lwjgl.opengl.GL11
|
||||
import java.util.Random
|
||||
@@ -41,28 +39,28 @@ import kotlin.math.sin
|
||||
import kotlin.math.sqrt
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalController>(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<T>(dispatcher) {
|
||||
private companion object {
|
||||
abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalController>(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<T>(dispatcher){
|
||||
private companion object{
|
||||
private val TEX_BACKGROUND = Resource.Vanilla("textures/environment/end_sky.png")
|
||||
private val TEX_PARTICLE_LAYER = Resource.Custom("textures/entity/portal.png")
|
||||
|
||||
private val RENDER_TYPE_BACKGROUND = with(RenderStateBuilder()) {
|
||||
private val RENDER_TYPE_BACKGROUND = with(RenderStateBuilder()){
|
||||
tex(TEX_BACKGROUND)
|
||||
fog(FOG_ENABLED)
|
||||
blend(SF_SRC_ALPHA, DF_ONE_MINUS_SRC_ALPHA)
|
||||
buildType("hee:portal_background_bottom", DefaultVertexFormats.POSITION_COLOR_TEX, GL11.GL_QUADS, bufferSize = 256)
|
||||
}
|
||||
|
||||
private val RENDER_TYPE_LAYER = Array(16) {
|
||||
with(RenderStateBuilder()) {
|
||||
private val RENDER_TYPE_LAYER = Array(16){
|
||||
with(RenderStateBuilder()){
|
||||
tex(TEX_PARTICLE_LAYER)
|
||||
fog(FOG_BLACK)
|
||||
fog(FOG_ENABLED)
|
||||
blend(SF_SRC_ALPHA, DF_ONE)
|
||||
buildType("hee:portal_layer_${it}", DefaultVertexFormats.POSITION_COLOR_TEX, GL11.GL_QUADS, bufferSize = 256)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLayerCount(distSq: Double) = when {
|
||||
private fun getLayerCount(distSq: Double) = when{
|
||||
distSq > square(60) -> 5
|
||||
distSq > square(48) -> 7
|
||||
distSq > square(38) -> 9
|
||||
@@ -78,7 +76,7 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
||||
private var isAnimating = false
|
||||
private var animationProgress = 0F
|
||||
|
||||
private fun calculateEasing(layer: Int): Float {
|
||||
private fun calculateEasing(layer: Int): Float{
|
||||
return if (isAnimating)
|
||||
(1.1F - square(animationProgress * 4.5F - 4.816F) + 22.1F * (1F - ((layer - 1F) / 14F).pow(1.2F))).coerceIn(0F, 1F).pow(1.5F)
|
||||
else
|
||||
@@ -97,21 +95,21 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
||||
|
||||
// Rendering
|
||||
|
||||
override fun render(tile: T, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int) {
|
||||
override fun render(tile: T, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int){
|
||||
val world = tile.world ?: return
|
||||
val pos = tile.pos
|
||||
val mat = matrix.last.matrix
|
||||
|
||||
var dist = -1
|
||||
|
||||
for(facing in Facing4) {
|
||||
val testPos = pos.offsetWhile(facing, 1 until BlockAbstractPortal.MAX_SIZE) { it.getTile<TileEntityPortalInner>(world) != null }
|
||||
for(facing in Facing4){
|
||||
val testPos = pos.offsetWhile(facing, 1 until BlockAbstractPortal.MAX_SIZE){ it.getTile<TileEntityPortalInner>(world) != null }
|
||||
val testDist = abs((testPos.x - pos.x) + (testPos.z - pos.z))
|
||||
|
||||
if (dist == -1) {
|
||||
if (dist == -1){
|
||||
dist = testDist
|
||||
}
|
||||
else if (dist != testDist) {
|
||||
else if (dist != testDist){
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -144,14 +142,14 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
||||
val (x, y, z) = diff
|
||||
val layerCount = getLayerCount((x * x) + (y * y) + (z * z))
|
||||
|
||||
for(layer in 1..15) {
|
||||
for(layer in 1..15){
|
||||
val layerIndexRev = 16 - layer
|
||||
val colorMultiplier = 1F / (layerIndexRev + 1F)
|
||||
|
||||
controller?.let { generateNextColor(it, layer) }
|
||||
transformColor { it * colorMultiplier * calculateEasing(layer) }
|
||||
|
||||
if (layerIndexRev <= layerCount) {
|
||||
if (layerIndexRev <= layerCount){
|
||||
renderLayer(mat, buffer.getBuffer(RENDER_TYPE_LAYER[layer - 1]), layer, dist, diff)
|
||||
}
|
||||
}
|
||||
@@ -161,13 +159,13 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
||||
|
||||
// Utilities
|
||||
|
||||
private inline fun transformColor(func: (Float) -> Float) {
|
||||
private inline fun transformColor(func: (Float) -> Float){
|
||||
color[0] = func(color[0])
|
||||
color[1] = func(color[1])
|
||||
color[2] = func(color[2])
|
||||
}
|
||||
|
||||
private fun renderBackgroundBottom(mat: Matrix4f, builder: IVertexBuilder, dist: Int) {
|
||||
private fun renderBackgroundBottom(mat: Matrix4f, builder: IVertexBuilder, dist: Int){
|
||||
val sizePT = 1F + dist
|
||||
val sizeNT = -sizePT + 1F
|
||||
val yB = 0.02F
|
||||
@@ -179,7 +177,7 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
||||
builder.pos(mat, sizePT, yB, sizeNT).color().tex(texW, 0F).endVertex()
|
||||
}
|
||||
|
||||
private fun renderBackgroundSides(mat: Matrix4f, builder: IVertexBuilder, dist: Int) {
|
||||
private fun renderBackgroundSides(mat: Matrix4f, builder: IVertexBuilder, dist: Int){
|
||||
val sizePT = 1F + dist
|
||||
val sizePB = sizePT - 0.01F
|
||||
val sizeNT = -sizePT + 1F
|
||||
@@ -211,7 +209,7 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
||||
builder.pos(mat, sizeNB, yB, sizeNB).color().tex(texW, 0F).endVertex()
|
||||
}
|
||||
|
||||
private fun renderLayer(mat: Matrix4f, builder: IVertexBuilder, layer: Int, dist: Int, diff: Vec3d) {
|
||||
private fun renderLayer(mat: Matrix4f, builder: IVertexBuilder, layer: Int, dist: Int, diff: Vector3d){
|
||||
val layerIndexRev = 16 - layer
|
||||
val parallaxMp = (1F + abs(diff.y.toFloat() / 32F)).pow(0.12F)
|
||||
|
||||
@@ -244,11 +242,11 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
||||
builder.pos(mat, sizeP, yT, sizeN).color().tex(x2, y1, cx, cy, parallaxX, parallaxZ, rotCos, rotSin).endVertex()
|
||||
}
|
||||
|
||||
private fun IVertexBuilder.color(): IVertexBuilder {
|
||||
private fun IVertexBuilder.color(): IVertexBuilder{
|
||||
return this.color(color[0], color[1], color[2], 1F)
|
||||
}
|
||||
|
||||
private fun IVertexBuilder.tex(x: Float, y: Float, cx: Float, cy: Float, ox: Float, oy: Float, rotCos: Float, rotSin: Float): IVertexBuilder {
|
||||
private fun IVertexBuilder.tex(x: Float, y: Float, cx: Float, cy: Float, ox: Float, oy: Float, rotCos: Float, rotSin: Float): IVertexBuilder{
|
||||
return this.tex(
|
||||
cx + (rotCos * (ox + x - cx)) - (rotSin * (oy + y - cy)),
|
||||
cy + (rotSin * (ox + x - cx)) + (rotCos * (oy + y - cy))
|
||||
|
@@ -1,11 +1,10 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.game.block.entity.TileEntityDarkChest
|
||||
import chylex.hee.init.ModAtlases
|
||||
import chylex.hee.system.facades.Resource
|
||||
import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.Sided
|
||||
import net.minecraft.client.renderer.model.Material
|
||||
import net.minecraft.client.renderer.model.RenderMaterial
|
||||
import net.minecraft.client.renderer.tileentity.ChestTileEntityRenderer
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||
import net.minecraft.state.properties.ChestType
|
||||
@@ -13,22 +12,22 @@ import net.minecraft.state.properties.ChestType.LEFT
|
||||
import net.minecraft.state.properties.ChestType.RIGHT
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderTileDarkChest(dispatcher: TileEntityRendererDispatcher) : ChestTileEntityRenderer<TileEntityDarkChest>(dispatcher) {
|
||||
companion object {
|
||||
class RenderTileDarkChest(dispatcher: TileEntityRendererDispatcher) : ChestTileEntityRenderer<TileEntityDarkChest>(dispatcher){
|
||||
companion object{
|
||||
val TEX_SINGLE = Resource.Custom("entity/dark_chest_single")
|
||||
val TEX_DOUBLE_LEFT = Resource.Custom("entity/dark_chest_left")
|
||||
val TEX_DOUBLE_RIGHT = Resource.Custom("entity/dark_chest_right")
|
||||
|
||||
private val MAT_SINGLE = Material(ModAtlases.ATLAS_TILES, TEX_SINGLE)
|
||||
private val MAT_DOUBLE_LEFT = Material(ModAtlases.ATLAS_TILES, TEX_DOUBLE_LEFT)
|
||||
private val MAT_DOUBLE_RIGHT = Material(ModAtlases.ATLAS_TILES, TEX_DOUBLE_RIGHT)
|
||||
private val MAT_SINGLE = RenderMaterial(ModAtlases.ATLAS_TILES, TEX_SINGLE)
|
||||
private val MAT_DOUBLE_LEFT = RenderMaterial(ModAtlases.ATLAS_TILES, TEX_DOUBLE_LEFT)
|
||||
private val MAT_DOUBLE_RIGHT = RenderMaterial(ModAtlases.ATLAS_TILES, TEX_DOUBLE_RIGHT)
|
||||
}
|
||||
|
||||
init {
|
||||
init{
|
||||
isChristmas = false
|
||||
}
|
||||
|
||||
override fun getMaterial(tile: TileEntityDarkChest, type: ChestType) = when(type) {
|
||||
override fun getMaterial(tile: TileEntityDarkChest, type: ChestType) = when(type){
|
||||
LEFT -> MAT_DOUBLE_LEFT
|
||||
RIGHT -> MAT_DOUBLE_RIGHT
|
||||
else -> MAT_SINGLE
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.HEE
|
||||
import chylex.hee.game.block.BlockAbstractPortal
|
||||
import chylex.hee.game.block.BlockAbstractPortal.IPortalController
|
||||
@@ -14,25 +13,25 @@ import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.world.World
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderTileEndPortal(dispatcher: TileEntityRendererDispatcher) : RenderTileAbstractPortal<TileEntityPortalInner.End, IPortalController>(dispatcher) {
|
||||
private object AlwaysOnController : IPortalController {
|
||||
class RenderTileEndPortal(dispatcher: TileEntityRendererDispatcher) : RenderTileAbstractPortal<TileEntityPortalInner.End, IPortalController>(dispatcher){
|
||||
private object AlwaysOnController : IPortalController{
|
||||
override val clientAnimationProgress = LerpedFloat(1F)
|
||||
override val clientPortalOffset = LerpedFloat(0F)
|
||||
}
|
||||
|
||||
override fun findController(world: World, pos: BlockPos): IPortalController? {
|
||||
if (world.dimension.type === HEE.dim) {
|
||||
override fun findController(world: World, pos: BlockPos): IPortalController?{
|
||||
if (world.dimensionKey === HEE.dim){
|
||||
return AlwaysOnController
|
||||
}
|
||||
|
||||
return pos.closestTickingTile<TileEntityEndPortalAcceptor>(world, BlockAbstractPortal.MAX_DISTANCE_FROM_FRAME)
|
||||
}
|
||||
|
||||
override fun generateSeed(controller: IPortalController): Long {
|
||||
override fun generateSeed(controller: IPortalController): Long{
|
||||
return 31100L
|
||||
}
|
||||
|
||||
override fun generateNextColor(controller: IPortalController, layer: Int) {
|
||||
override fun generateNextColor(controller: IPortalController, layer: Int){
|
||||
color[0] = (rand.nextFloat() * 0.5F) + 0.1F
|
||||
color[1] = (rand.nextFloat() * 0.5F) + 0.4F
|
||||
color[2] = (rand.nextFloat() * 0.5F) + 0.5F
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.HEE
|
||||
import chylex.hee.client.render.gl.RenderStateBuilder
|
||||
import chylex.hee.client.render.gl.RenderStateBuilder.Companion.ALPHA_CUTOUT
|
||||
@@ -15,7 +14,6 @@ import chylex.hee.system.math.floorToInt
|
||||
import com.mojang.blaze3d.matrix.MatrixStack
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer
|
||||
import net.minecraft.client.renderer.Matrix4f
|
||||
import net.minecraft.client.renderer.WorldRenderer
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||
@@ -23,21 +21,22 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||
import net.minecraft.inventory.container.PlayerContainer
|
||||
import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.util.math.vector.Matrix4f
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.client.event.TextureStitchEvent
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
|
||||
import org.lwjgl.opengl.GL11
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderTileExperienceGate(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityExperienceGate>(dispatcher) {
|
||||
class RenderTileExperienceGate(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityExperienceGate>(dispatcher){
|
||||
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID, bus = MOD)
|
||||
companion object {
|
||||
companion object{
|
||||
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") }
|
||||
private val SPRITES = mutableListOf<TextureAtlasSprite>()
|
||||
|
||||
private val RENDER_TYPE_BAR = with(RenderStateBuilder()) {
|
||||
private val RENDER_TYPE_BAR = with(RenderStateBuilder()){
|
||||
tex(PlayerContainer.LOCATION_BLOCKS_TEXTURE, mipmap = true)
|
||||
alpha(ALPHA_CUTOUT)
|
||||
shade(SHADE_ENABLED)
|
||||
@@ -64,31 +63,31 @@ class RenderTileExperienceGate(dispatcher: TileEntityRendererDispatcher) : TileE
|
||||
private val FRAME_OFFSETS = FRAMES.indices.map { index -> 1 + FRAMES.take(index).sumBy { it.size } }.toIntArray()
|
||||
|
||||
@SubscribeEvent
|
||||
fun onTextureStitchPre(e: TextureStitchEvent.Pre) {
|
||||
if (e.map.textureLocation == PlayerContainer.LOCATION_BLOCKS_TEXTURE) {
|
||||
with(e) {
|
||||
fun onTextureStitchPre(e: TextureStitchEvent.Pre){
|
||||
if (e.map.textureLocation == PlayerContainer.LOCATION_BLOCKS_TEXTURE){
|
||||
with(e){
|
||||
TEX.forEach { addSprite(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
fun onTextureStitchPost(e: TextureStitchEvent.Post) {
|
||||
if (e.map.textureLocation == PlayerContainer.LOCATION_BLOCKS_TEXTURE) {
|
||||
fun onTextureStitchPost(e: TextureStitchEvent.Post){
|
||||
if (e.map.textureLocation == PlayerContainer.LOCATION_BLOCKS_TEXTURE){
|
||||
SPRITES.clear()
|
||||
|
||||
with(e.map) {
|
||||
with(e.map){
|
||||
TEX.forEach { SPRITES.add(getSprite(it)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTexture(index: Int, frame: Int): TextureAtlasSprite? {
|
||||
private fun getTexture(index: Int, frame: Int): TextureAtlasSprite?{
|
||||
return FRAMES[index].getOrNull((frame - FRAME_OFFSETS[index]).coerceAtMost(FRAMES[index].lastIndex))?.let(SPRITES::getOrNull)
|
||||
}
|
||||
}
|
||||
|
||||
override fun render(tile: TileEntityExperienceGate, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int) {
|
||||
override fun render(tile: TileEntityExperienceGate, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int){
|
||||
val world = tile.world ?: return
|
||||
val pos = tile.pos
|
||||
|
||||
@@ -110,7 +109,7 @@ class RenderTileExperienceGate(dispatcher: TileEntityRendererDispatcher) : TileE
|
||||
getTexture(7, frame)?.let { builder.renderTextureAt(mat, -1F, 0F, world, pos.add(-1, 1, 0), it, 0b0000, combinedOverlay) }
|
||||
}
|
||||
|
||||
private fun IVertexBuilder.renderTextureAt(mat: Matrix4f, x: Float, z: Float, world: World, pos: BlockPos, tex: TextureAtlasSprite, rot: Int, overlay: Int) {
|
||||
private fun IVertexBuilder.renderTextureAt(mat: Matrix4f, x: Float, z: Float, world: World, pos: BlockPos, tex: TextureAtlasSprite, rot: Int, overlay: Int){
|
||||
val rotX = (((rot shr 1) and 1) - 0.5F) * 1.002F
|
||||
val rotZ = (((rot shr 2) and 1) - 0.5F) * 1.002F
|
||||
|
||||
@@ -119,13 +118,13 @@ class RenderTileExperienceGate(dispatcher: TileEntityRendererDispatcher) : TileE
|
||||
val v1 = tex.minV
|
||||
val v2 = tex.maxV
|
||||
|
||||
val c = if (rot and 0b1000 != 0) {
|
||||
val c = if (rot and 0b1000 != 0){
|
||||
floatArrayOf(u2, u1, u1, u2, v1, v1, v2, v2)
|
||||
}
|
||||
else if (rot and 0b0001 == 0) {
|
||||
else if (rot and 0b0001 == 0){
|
||||
floatArrayOf(u2, u2, u1, u1, v2, v1, v1, v2)
|
||||
}
|
||||
else {
|
||||
else{
|
||||
floatArrayOf(u2, u1, u1, u2, v2, v2, v1, v1)
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.client.model.block.ModelBlockIgneousPlate
|
||||
import chylex.hee.client.render.gl.RenderStateBuilder
|
||||
import chylex.hee.client.render.gl.RenderStateBuilder.Companion.BLEND_NONE
|
||||
@@ -30,16 +29,16 @@ import net.minecraft.client.renderer.RenderType
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||
import net.minecraft.util.math.Vec3d
|
||||
import net.minecraft.util.math.vector.Vector3d
|
||||
import org.lwjgl.opengl.GL11
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderTileIgneousPlate(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityIgneousPlate>(dispatcher) {
|
||||
private companion object {
|
||||
class RenderTileIgneousPlate(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityIgneousPlate>(dispatcher){
|
||||
private companion object{
|
||||
private val TEX_PLATE = Resource.Custom("textures/entity/igneous_plate.png")
|
||||
|
||||
private val RENDER_TYPE_OUTER = RenderType.getEntitySolid(TEX_PLATE)
|
||||
private val RENDER_TYPE_INNER = with(RenderStateBuilder()) {
|
||||
private val RENDER_TYPE_INNER = with(RenderStateBuilder()){
|
||||
tex(TEX_PLATE)
|
||||
blend(BLEND_NONE)
|
||||
lighting(LIGHTING_DISABLED)
|
||||
@@ -54,7 +53,7 @@ class RenderTileIgneousPlate(dispatcher: TileEntityRendererDispatcher) : TileEnt
|
||||
RGB(235, 23, 23).asVec
|
||||
)
|
||||
|
||||
private fun getInnerBoxColor(combinedHeat: Float): Vec3d {
|
||||
private fun getInnerBoxColor(combinedHeat: Float): Vector3d{
|
||||
val index = combinedHeat.floorToInt().coerceIn(0, COLOR_TRANSITIONS.lastIndex - 1)
|
||||
val progress = combinedHeat.toDouble() - index
|
||||
|
||||
@@ -62,16 +61,16 @@ class RenderTileIgneousPlate(dispatcher: TileEntityRendererDispatcher) : TileEnt
|
||||
}
|
||||
}
|
||||
|
||||
override fun render(tile: TileEntityIgneousPlate, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int) {
|
||||
override fun render(tile: TileEntityIgneousPlate, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int){
|
||||
val state = tile.world?.let(tile.pos::getState)
|
||||
|
||||
if (state?.block !== ModBlocks.IGNEOUS_PLATE) {
|
||||
if (state?.block !== ModBlocks.IGNEOUS_PLATE){
|
||||
return
|
||||
}
|
||||
|
||||
matrix.push()
|
||||
|
||||
when(state[BlockIgneousPlate.FACING_NOT_DOWN]) {
|
||||
when(state[BlockIgneousPlate.FACING_NOT_DOWN]){
|
||||
UP -> {
|
||||
matrix.translateZ(1.0)
|
||||
matrix.rotateX(-90F)
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.HEE
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.client.render.gl.RenderStateBuilder
|
||||
@@ -21,6 +20,7 @@ import com.mojang.blaze3d.matrix.MatrixStack
|
||||
import net.minecraft.client.renderer.Atlases
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer
|
||||
import net.minecraft.client.renderer.model.IBakedModel
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||
@@ -35,18 +35,17 @@ import net.minecraftforge.client.model.ModelLoader
|
||||
import net.minecraftforge.client.model.data.EmptyModelData
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
|
||||
import org.lwjgl.opengl.GL11
|
||||
import kotlin.math.sqrt
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderTileJarODust(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityJarODust>(dispatcher) {
|
||||
class RenderTileJarODust(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityJarODust>(dispatcher){
|
||||
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID, bus = MOD)
|
||||
companion object {
|
||||
companion object{
|
||||
private val TEX_LAYER = Resource.Custom("block/dust_layer")
|
||||
private const val TEX_MP = 1.6
|
||||
|
||||
private lateinit var SPRITE_LAYER: TextureAtlasSprite
|
||||
|
||||
private val RENDER_TYPE_LAYERS = with(RenderStateBuilder()) {
|
||||
private val RENDER_TYPE_LAYERS = with(RenderStateBuilder()){
|
||||
tex(PlayerContainer.LOCATION_BLOCKS_TEXTURE, mipmap = true)
|
||||
shade(SHADE_ENABLED)
|
||||
lightmap(LIGHTMAP_ENABLED)
|
||||
@@ -55,29 +54,26 @@ class RenderTileJarODust(dispatcher: TileEntityRendererDispatcher) : TileEntityR
|
||||
|
||||
private val AABB = BlockJarODust.AABB
|
||||
|
||||
private const val EPSILON_Y_BOTTOM = 0.02
|
||||
private const val EPSILON_Y_TOP = 0.04
|
||||
private const val EPSILON_Y = 0.025
|
||||
private const val EPSILON_XZ = 0.005
|
||||
private const val FIRST_LAYER_HEIGHT = 0.0325
|
||||
|
||||
@SubscribeEvent
|
||||
fun onTextureStitchPre(e: TextureStitchEvent.Pre) {
|
||||
if (e.map.textureLocation == PlayerContainer.LOCATION_BLOCKS_TEXTURE) {
|
||||
fun onTextureStitchPre(e: TextureStitchEvent.Pre){
|
||||
if (e.map.textureLocation == PlayerContainer.LOCATION_BLOCKS_TEXTURE){
|
||||
e.addSprite(TEX_LAYER)
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
fun onTextureStitchPost(e: TextureStitchEvent.Post) {
|
||||
if (e.map.textureLocation == PlayerContainer.LOCATION_BLOCKS_TEXTURE) {
|
||||
fun onTextureStitchPost(e: TextureStitchEvent.Post){
|
||||
if (e.map.textureLocation == PlayerContainer.LOCATION_BLOCKS_TEXTURE){
|
||||
SPRITE_LAYER = e.map.getSprite(TEX_LAYER)
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderLayers(layers: DustLayers, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int) {
|
||||
private fun renderLayers(layers: DustLayers, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int, renderBottom: Boolean){
|
||||
val contents = layers.contents.takeUnless { it.isEmpty() } ?: return
|
||||
val squish = 0.775F + (0.225F * sqrt(contents.sumBy { it.second.toInt() }.toDouble() / layers.totalCapacity))
|
||||
val unit = AABB.let { it.maxY - it.minY - EPSILON_Y_BOTTOM - EPSILON_Y_TOP - FIRST_LAYER_HEIGHT } / layers.totalCapacity / squish
|
||||
val unit = AABB.let { it.maxY - it.minY - (EPSILON_Y * 2) } / layers.totalCapacity
|
||||
|
||||
val builder = buffer.getBuffer(RENDER_TYPE_LAYERS)
|
||||
val mat = matrix.last.matrix
|
||||
@@ -96,23 +92,23 @@ class RenderTileJarODust(dispatcher: TileEntityRendererDispatcher) : TileEntityR
|
||||
|
||||
var relY = 0.0
|
||||
|
||||
for((index, info) in contents.withIndex()) {
|
||||
for((index, info) in contents.withIndex()){
|
||||
val (dustType, dustAmount) = info
|
||||
|
||||
val color = dustType.color
|
||||
val height = (if (index == 0) FIRST_LAYER_HEIGHT else 0.0) + (dustAmount * unit)
|
||||
val height = dustAmount * unit
|
||||
|
||||
val texMin = minU + ((0.01 + relY * TEX_MP) * texHalfSize).toFloat()
|
||||
val texMax = minU + ((0.01 + (relY + height) * TEX_MP) * texHalfSize).toFloat()
|
||||
|
||||
val minY = (relY + AABB.minY + EPSILON_Y_BOTTOM).toFloat()
|
||||
val minY = (relY + AABB.minY + EPSILON_Y).toFloat()
|
||||
val maxY = (minY + height).toFloat()
|
||||
|
||||
val sideR = (color[0] / 1.125F).floorToInt().coerceAtLeast(0)
|
||||
val sideG = (color[1] / 1.125F).floorToInt().coerceAtLeast(0)
|
||||
val sideB = (color[2] / 1.125F).floorToInt().coerceAtLeast(0)
|
||||
|
||||
with(builder) {
|
||||
with(builder){
|
||||
pos(mat, minX, minY, minZ).color(sideR, sideG, sideB, 255).tex(texMin, minV).lightmap(combinedLight).overlay(combinedOverlay).endVertex()
|
||||
pos(mat, minX, minY, maxZ).color(sideR, sideG, sideB, 255).tex(texMin, maxV).lightmap(combinedLight).overlay(combinedOverlay).endVertex()
|
||||
pos(mat, minX, maxY, maxZ).color(sideR, sideG, sideB, 255).tex(texMax, maxV).lightmap(combinedLight).overlay(combinedOverlay).endVertex()
|
||||
@@ -134,12 +130,12 @@ class RenderTileJarODust(dispatcher: TileEntityRendererDispatcher) : TileEntityR
|
||||
pos(mat, minX, maxY, maxZ).color(sideR, sideG, sideB, 255).tex(texMax, minV).lightmap(combinedLight).overlay(combinedOverlay).endVertex()
|
||||
}
|
||||
|
||||
if (index == 0) {
|
||||
if (index == 0 && renderBottom){
|
||||
val bottomR = color[0]
|
||||
val bottomG = color[1]
|
||||
val bottomB = color[2]
|
||||
|
||||
with(builder) {
|
||||
with(builder){
|
||||
pos(mat, maxX, minY, minZ).color(bottomR, bottomG, bottomB, 255).tex(maxU, minV).lightmap(combinedLight).overlay(combinedOverlay).endVertex()
|
||||
pos(mat, maxX, minY, maxZ).color(bottomR, bottomG, bottomB, 255).tex(maxU, maxV).lightmap(combinedLight).overlay(combinedOverlay).endVertex()
|
||||
pos(mat, minX, minY, maxZ).color(bottomR, bottomG, bottomB, 255).tex(minU, maxV).lightmap(combinedLight).overlay(combinedOverlay).endVertex()
|
||||
@@ -147,12 +143,12 @@ class RenderTileJarODust(dispatcher: TileEntityRendererDispatcher) : TileEntityR
|
||||
}
|
||||
}
|
||||
|
||||
if (index == contents.lastIndex) {
|
||||
if (index == contents.lastIndex){
|
||||
val topR = (color[0] * 1.125F).floorToInt().coerceAtMost(255)
|
||||
val topG = (color[1] * 1.125F).floorToInt().coerceAtMost(255)
|
||||
val topB = (color[2] * 1.125F).floorToInt().coerceAtMost(255)
|
||||
|
||||
with(builder) {
|
||||
with(builder){
|
||||
pos(mat, minX, maxY, minZ).color(topR, topG, topB, 255).tex(minU, minV).lightmap(combinedLight).overlay(combinedOverlay).endVertex()
|
||||
pos(mat, minX, maxY, maxZ).color(topR, topG, topB, 255).tex(minU, maxV).lightmap(combinedLight).overlay(combinedOverlay).endVertex()
|
||||
pos(mat, maxX, maxY, maxZ).color(topR, topG, topB, 255).tex(maxU, maxV).lightmap(combinedLight).overlay(combinedOverlay).endVertex()
|
||||
@@ -165,33 +161,33 @@ class RenderTileJarODust(dispatcher: TileEntityRendererDispatcher) : TileEntityR
|
||||
}
|
||||
}
|
||||
|
||||
override fun render(tile: TileEntityJarODust, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int) {
|
||||
renderLayers(tile.layers, matrix, buffer, combinedLight, combinedOverlay)
|
||||
override fun render(tile: TileEntityJarODust, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int){
|
||||
renderLayers(tile.layers, matrix, buffer, combinedLight, combinedOverlay, renderBottom = false)
|
||||
}
|
||||
|
||||
@SubscribeAllEvents(Side.CLIENT, modid = HEE.ID, bus = MOD)
|
||||
object AsItem : ItemStackTileEntityRenderer() {
|
||||
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) {
|
||||
fun onRegisterModels(@Suppress("UNUSED_PARAMETER") e: ModelRegistryEvent){
|
||||
ModelLoader.addSpecialModel(RESOURCE_MODEL)
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
fun onModelBake(e: ModelBakeEvent) {
|
||||
fun onModelBake(e: ModelBakeEvent){
|
||||
MODEL = e.modelRegistry.getValue(RESOURCE_MODEL)
|
||||
}
|
||||
|
||||
private val layers = DustLayers(TileEntityJarODust.DUST_CAPACITY)
|
||||
|
||||
override fun render(stack: ItemStack, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int) {
|
||||
override fun func_239207_a_(stack: ItemStack, transformType: TransformType, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int){
|
||||
val nbt = stack.heeTagOrNull?.getListOfCompounds(TileEntityJarODust.LAYERS_TAG)
|
||||
|
||||
if (nbt != null) {
|
||||
if (nbt != null){
|
||||
layers.deserializeNBT(nbt)
|
||||
renderLayers(layers, matrix, buffer, combinedLight, combinedOverlay)
|
||||
renderLayers(layers, matrix, buffer, combinedLight, combinedOverlay, renderBottom = true)
|
||||
}
|
||||
|
||||
MC.instance.blockRendererDispatcher.blockModelRenderer.renderModel(matrix.last, buffer.getBuffer(Atlases.getTranslucentCullBlockType()), null, MODEL, 1F, 1F, 1F, combinedLight, combinedOverlay, EmptyModelData.INSTANCE)
|
||||
|
@@ -1,27 +1,26 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.game.block.entity.TileEntityLootChest
|
||||
import chylex.hee.init.ModAtlases
|
||||
import chylex.hee.system.facades.Resource
|
||||
import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.Sided
|
||||
import net.minecraft.client.renderer.model.Material
|
||||
import net.minecraft.client.renderer.model.RenderMaterial
|
||||
import net.minecraft.client.renderer.tileentity.ChestTileEntityRenderer
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||
import net.minecraft.state.properties.ChestType
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderTileLootChest(dispatcher: TileEntityRendererDispatcher) : ChestTileEntityRenderer<TileEntityLootChest>(dispatcher) {
|
||||
companion object {
|
||||
class RenderTileLootChest(dispatcher: TileEntityRendererDispatcher) : ChestTileEntityRenderer<TileEntityLootChest>(dispatcher){
|
||||
companion object{
|
||||
val TEX = Resource.Custom("entity/loot_chest")
|
||||
private val MAT = Material(ModAtlases.ATLAS_TILES, TEX)
|
||||
private val MAT = RenderMaterial(ModAtlases.ATLAS_TILES, TEX)
|
||||
}
|
||||
|
||||
init {
|
||||
init{
|
||||
isChristmas = false
|
||||
}
|
||||
|
||||
override fun getMaterial(tile: TileEntityLootChest, type: ChestType): Material {
|
||||
override fun getMaterial(tile: TileEntityLootChest, type: ChestType): RenderMaterial{
|
||||
return MAT
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.client.model.ModelHelper
|
||||
import chylex.hee.client.render.gl.rotateX
|
||||
@@ -16,14 +15,14 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderTileMinersBurialAltar(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityMinersBurialAltar>(dispatcher) {
|
||||
private companion object {
|
||||
class RenderTileMinersBurialAltar(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityMinersBurialAltar>(dispatcher){
|
||||
private companion object{
|
||||
private val PUZZLE_MEDALLION = ItemStack(ModItems.PUZZLE_MEDALLION)
|
||||
private const val SCALE_XZ = 1.85F
|
||||
}
|
||||
|
||||
override fun render(tile: TileEntityMinersBurialAltar, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int) {
|
||||
if (!tile.hasMedallion) {
|
||||
override fun render(tile: TileEntityMinersBurialAltar, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int){
|
||||
if (!tile.hasMedallion){
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ShulkerModel
|
||||
import net.minecraft.client.renderer.tileentity.ShulkerBoxTileEntityRenderer
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.client.render.gl.rotateX
|
||||
import chylex.hee.client.render.gl.rotateY
|
||||
@@ -15,8 +14,8 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||
import kotlin.math.max
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderTileSpawner(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityBaseSpawner>(dispatcher) {
|
||||
override fun render(tile: TileEntityBaseSpawner, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int) {
|
||||
class RenderTileSpawner(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityBaseSpawner>(dispatcher){
|
||||
override fun render(tile: TileEntityBaseSpawner, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int){
|
||||
val entity = tile.clientEntity
|
||||
val scale = 0.53125F / max(entity.width, entity.height).coerceAtLeast(1F)
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.client.model.ModelHelper
|
||||
import chylex.hee.client.model.getQuads
|
||||
@@ -27,8 +26,8 @@ import net.minecraft.item.ItemStack
|
||||
import net.minecraftforge.client.ForgeHooksClient
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderTileTable(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityBaseTable>(dispatcher) {
|
||||
private companion object {
|
||||
class RenderTileTable(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityBaseTable>(dispatcher){
|
||||
private companion object{
|
||||
private const val COLOR_SHADE = 80F / 255F
|
||||
private const val COLOR_ALPHA = 30F / 255F
|
||||
private val LIGHT = LightTexture.packLight(15, 0)
|
||||
@@ -36,11 +35,11 @@ class RenderTileTable(dispatcher: TileEntityRendererDispatcher) : TileEntityRend
|
||||
private const val Y_OFFSET = 0.8
|
||||
}
|
||||
|
||||
override fun render(tile: TileEntityBaseTable, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int) {
|
||||
override fun render(tile: TileEntityBaseTable, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int){
|
||||
val world = tile.world ?: 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){
|
||||
return
|
||||
}
|
||||
|
||||
@@ -58,9 +57,9 @@ class RenderTileTable(dispatcher: TileEntityRendererDispatcher) : TileEntityRend
|
||||
val itemModel = ForgeHooksClient.handleCameraTransforms(matrix, ModelHelper.getItemModel(itemStack), GUI, false)
|
||||
|
||||
val mat = matrix.last
|
||||
val builder = ItemRenderer.getBuffer(buffer, RenderTypeLookup.getRenderType(itemStack), true /* isItem */, false /* hasGlint */)
|
||||
val builder = ItemRenderer.getBuffer(buffer, RenderTypeLookup.func_239219_a_(itemStack, true), true /* isItem */, false /* hasGlint */)
|
||||
|
||||
for(quad in itemModel.getQuads()) {
|
||||
for(quad in itemModel.getQuads()){
|
||||
builder.addVertexData(mat, quad, COLOR_SHADE, COLOR_SHADE, COLOR_SHADE, COLOR_ALPHA, LIGHT, OverlayTexture.NO_OVERLAY)
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.client.model.ModelHelper
|
||||
import chylex.hee.client.render.gl.DF_ONE_MINUS_SRC_ALPHA
|
||||
@@ -24,7 +23,6 @@ import chylex.hee.system.random.nextFloat
|
||||
import com.mojang.blaze3d.matrix.MatrixStack
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer
|
||||
import net.minecraft.client.renderer.ItemRenderer
|
||||
import net.minecraft.client.renderer.Matrix4f
|
||||
import net.minecraft.client.renderer.model.IBakedModel
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
@@ -33,6 +31,7 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.math.vector.Matrix4f
|
||||
import org.lwjgl.opengl.GL11
|
||||
import java.util.Collections
|
||||
import java.util.Random
|
||||
@@ -40,11 +39,11 @@ import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderTileTablePedestal(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityTablePedestal>(dispatcher) {
|
||||
private companion object {
|
||||
class RenderTileTablePedestal(dispatcher: TileEntityRendererDispatcher) : TileEntityRenderer<TileEntityTablePedestal>(dispatcher){
|
||||
private companion object{
|
||||
private val RAND = Random()
|
||||
|
||||
private val RENDER_TYPE_SHADOW = with(RenderStateBuilder()) {
|
||||
private val RENDER_TYPE_SHADOW = with(RenderStateBuilder()){
|
||||
tex(Resource.Vanilla("textures/misc/shadow.png"))
|
||||
blend(SF_SRC_ALPHA, DF_ONE_MINUS_SRC_ALPHA, SF_ONE, DF_ZERO)
|
||||
lighting(LIGHTING_ENABLED)
|
||||
@@ -68,7 +67,7 @@ class RenderTileTablePedestal(dispatcher: TileEntityRendererDispatcher) : TileEn
|
||||
map { (it - 0.5F) * section }
|
||||
}
|
||||
|
||||
private fun getItemModelCount(stackSize: Int) = when {
|
||||
private fun getItemModelCount(stackSize: Int) = when{
|
||||
stackSize > 48 -> 5
|
||||
stackSize > 32 -> 4
|
||||
stackSize > 16 -> 3
|
||||
@@ -77,7 +76,7 @@ class RenderTileTablePedestal(dispatcher: TileEntityRendererDispatcher) : TileEn
|
||||
}
|
||||
}
|
||||
|
||||
override fun render(tile: TileEntityTablePedestal, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int) {
|
||||
override fun render(tile: TileEntityTablePedestal, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int){
|
||||
val itemRenderer = MC.itemRenderer
|
||||
|
||||
val pos = tile.pos
|
||||
@@ -96,18 +95,18 @@ class RenderTileTablePedestal(dispatcher: TileEntityRendererDispatcher) : TileEn
|
||||
else
|
||||
0F
|
||||
|
||||
for((index, stack) in stacks.withIndex()) {
|
||||
for((index, stack) in stacks.withIndex()){
|
||||
renderItemStack(matrix, buffer, itemRenderer, stack, index, itemRotation, baseSeed, offsetAngleIndices, shadowAlpha, combinedLight)
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderItemStack(matrix: MatrixStack, buffer: IRenderTypeBuffer, renderer: ItemRenderer, stack: ItemStack, index: Int, baseRotation: Float, baseSeed: Long, offsetAngleIndices: MutableList<Float>, shadowAlpha: Float, combinedLight: Int) {
|
||||
private fun renderItemStack(matrix: MatrixStack, buffer: IRenderTypeBuffer, renderer: ItemRenderer, stack: ItemStack, index: Int, baseRotation: Float, baseSeed: Long, offsetAngleIndices: MutableList<Float>, shadowAlpha: Float, combinedLight: Int){
|
||||
matrix.push()
|
||||
|
||||
var offsetY = 0F
|
||||
var rotationMp = 1F
|
||||
|
||||
if (index > 0 && offsetAngleIndices.isNotEmpty()) {
|
||||
if (index > 0 && offsetAngleIndices.isNotEmpty()){
|
||||
val seed = baseSeed + (Item.getIdFromItem(stack.item) xor (33867 shl index))
|
||||
RAND.setSeed(seed)
|
||||
|
||||
@@ -121,7 +120,7 @@ class RenderTileTablePedestal(dispatcher: TileEntityRendererDispatcher) : TileEn
|
||||
rotationMp = RAND.nextFloat(0.4F, 1.2F)
|
||||
}
|
||||
|
||||
if (shadowAlpha > 0F) {
|
||||
if (shadowAlpha > 0F){
|
||||
renderShadow(buffer, matrix.last.matrix, shadowAlpha)
|
||||
}
|
||||
|
||||
@@ -137,30 +136,30 @@ class RenderTileTablePedestal(dispatcher: TileEntityRendererDispatcher) : TileEn
|
||||
matrix.pop()
|
||||
}
|
||||
|
||||
private fun renderItemWithSpread(matrix: MatrixStack, buffer: IRenderTypeBuffer, renderer: ItemRenderer, stack: ItemStack, model: IBakedModel, isModel3D: Boolean, combinedLight: Int) {
|
||||
private fun renderItemWithSpread(matrix: MatrixStack, buffer: IRenderTypeBuffer, renderer: ItemRenderer, stack: ItemStack, model: IBakedModel, isModel3D: Boolean, combinedLight: Int){
|
||||
val extraModels = getItemModelCount(stack.size) - 1
|
||||
|
||||
if (extraModels > 0) {
|
||||
if (extraModels > 0){
|
||||
RAND.setSeed(Item.getIdFromItem(stack.item).toLong())
|
||||
|
||||
if (!isModel3D) {
|
||||
if (!isModel3D){
|
||||
matrix.translateZ(-SPREAD_DEPTH_PER_2D_MODEL * (extraModels / 2.0))
|
||||
}
|
||||
}
|
||||
|
||||
renderer.renderItem(stack, GROUND, false, matrix, buffer, combinedLight, OverlayTexture.NO_OVERLAY, model)
|
||||
|
||||
repeat(extraModels) {
|
||||
repeat(extraModels){
|
||||
matrix.push()
|
||||
|
||||
if (isModel3D) {
|
||||
if (isModel3D){
|
||||
matrix.translate(
|
||||
RAND.nextFloat(-SPREAD_RAND_3D_XZ, SPREAD_RAND_3D_XZ),
|
||||
RAND.nextFloat(-SPREAD_RAND_3D_Y, SPREAD_RAND_3D_Y),
|
||||
RAND.nextFloat(-SPREAD_RAND_3D_XZ, SPREAD_RAND_3D_XZ)
|
||||
)
|
||||
}
|
||||
else {
|
||||
else{
|
||||
matrix.translate(
|
||||
RAND.nextFloat(-SPREAD_RAND_2D, SPREAD_RAND_2D),
|
||||
RAND.nextFloat(-SPREAD_RAND_2D, SPREAD_RAND_2D),
|
||||
@@ -173,8 +172,8 @@ class RenderTileTablePedestal(dispatcher: TileEntityRendererDispatcher) : TileEn
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderShadow(buffer: IRenderTypeBuffer, mat: Matrix4f, alpha: Float) {
|
||||
with(buffer.getBuffer(RENDER_TYPE_SHADOW)) {
|
||||
private fun renderShadow(buffer: IRenderTypeBuffer, mat: Matrix4f, alpha: Float){
|
||||
with(buffer.getBuffer(RENDER_TYPE_SHADOW)){
|
||||
pos(mat, SHADOW_XZ_MIN, SHADOW_Y, SHADOW_XZ_MIN).color(1F, 1F, 1F, alpha).tex(0F, 0F).endVertex()
|
||||
pos(mat, SHADOW_XZ_MIN, SHADOW_Y, SHADOW_XZ_MAX).color(1F, 1F, 1F, alpha).tex(0F, 1F).endVertex()
|
||||
pos(mat, SHADOW_XZ_MAX, SHADOW_Y, SHADOW_XZ_MAX).color(1F, 1F, 1F, alpha).tex(1F, 1F).endVertex()
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.block
|
||||
|
||||
import chylex.hee.game.block.BlockAbstractPortal
|
||||
import chylex.hee.game.block.BlockVoidPortalInner.Companion.TYPE
|
||||
import chylex.hee.game.block.BlockVoidPortalInner.ITerritoryInstanceFactory
|
||||
@@ -21,9 +20,9 @@ import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.world.World
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderTileVoidPortal(dispatcher: TileEntityRendererDispatcher) : RenderTileAbstractPortal<TileEntityPortalInner.Void, IVoidPortalController>(dispatcher) {
|
||||
private object ActiveReturnController : IVoidPortalController {
|
||||
override val currentInstanceFactory = object : ITerritoryInstanceFactory {
|
||||
class RenderTileVoidPortal(dispatcher: TileEntityRendererDispatcher) : RenderTileAbstractPortal<TileEntityPortalInner.Void, IVoidPortalController>(dispatcher){
|
||||
private object ActiveReturnController : IVoidPortalController{
|
||||
override val currentInstanceFactory = object : ITerritoryInstanceFactory{
|
||||
override val territory = THE_HUB_INSTANCE.territory
|
||||
override fun create(entity: Entity) = THE_HUB_INSTANCE
|
||||
}
|
||||
@@ -32,17 +31,17 @@ class RenderTileVoidPortal(dispatcher: TileEntityRendererDispatcher) : RenderTil
|
||||
override val clientPortalOffset = LerpedFloat(0F)
|
||||
}
|
||||
|
||||
override fun findController(world: World, pos: BlockPos) = when(pos.getState(world).takeIf { it.block === ModBlocks.VOID_PORTAL_INNER }?.get(TYPE)) {
|
||||
HUB -> pos.closestTickingTile<TileEntityVoidPortalStorage>(world, BlockAbstractPortal.MAX_DISTANCE_FROM_FRAME)
|
||||
override fun findController(world: World, pos: BlockPos) = when(pos.getState(world).takeIf { it.block === ModBlocks.VOID_PORTAL_INNER }?.get(TYPE)){
|
||||
HUB -> pos.closestTickingTile<TileEntityVoidPortalStorage>(world, BlockAbstractPortal.MAX_DISTANCE_FROM_FRAME)
|
||||
RETURN_ACTIVE -> ActiveReturnController
|
||||
else -> null
|
||||
else -> null
|
||||
}
|
||||
|
||||
override fun generateSeed(controller: IVoidPortalController): Long {
|
||||
override fun generateSeed(controller: IVoidPortalController): Long{
|
||||
return controller.currentInstanceFactory?.territory?.desc?.colors?.portalSeed ?: 0L
|
||||
}
|
||||
|
||||
override fun generateNextColor(controller: IVoidPortalController, layer: Int) {
|
||||
override fun generateNextColor(controller: IVoidPortalController, layer: Int){
|
||||
controller.currentInstanceFactory?.territory?.desc?.colors?.nextPortalColor(rand, color)
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.entity
|
||||
|
||||
import chylex.hee.client.model.entity.ModelEntityBossEnderEye
|
||||
import chylex.hee.client.model.entity.ModelEntityBossEnderEye.SCALE
|
||||
import chylex.hee.client.render.entity.layer.LayerEnderEyeLaser
|
||||
@@ -14,19 +13,19 @@ import net.minecraft.client.renderer.entity.MobRenderer
|
||||
import net.minecraft.util.ResourceLocation
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderEntityBossEnderEye(manager: EntityRendererManager) : MobRenderer<EntityBossEnderEye, ModelEntityBossEnderEye>(manager, ModelEntityBossEnderEye, SCALE) {
|
||||
class RenderEntityBossEnderEye(manager: EntityRendererManager) : MobRenderer<EntityBossEnderEye, ModelEntityBossEnderEye>(manager, ModelEntityBossEnderEye, SCALE){
|
||||
private val texture = Resource.Custom("textures/entity/ender_eye.png")
|
||||
|
||||
init {
|
||||
init{
|
||||
addLayer(LayerEnderEyeLaser(this))
|
||||
}
|
||||
|
||||
override fun preRenderCallback(entity: EntityBossEnderEye, matrix: MatrixStack, partialTicks: Float) {
|
||||
override fun preRenderCallback(entity: EntityBossEnderEye, matrix: MatrixStack, partialTicks: Float){
|
||||
matrix.scale(SCALE)
|
||||
super.preRenderCallback(entity, matrix, partialTicks)
|
||||
}
|
||||
|
||||
override fun getEntityTexture(entity: EntityBossEnderEye): ResourceLocation {
|
||||
override fun getEntityTexture(entity: EntityBossEnderEye): ResourceLocation{
|
||||
return texture
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.entity
|
||||
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.Sided
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.entity
|
||||
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.Sided
|
||||
@@ -7,6 +6,6 @@ import net.minecraft.client.renderer.entity.EntityRendererManager
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderEntityItemNoBob(manager: EntityRendererManager) : ItemRenderer(manager, MC.itemRenderer) {
|
||||
class RenderEntityItemNoBob(manager: EntityRendererManager) : ItemRenderer(manager, MC.itemRenderer){
|
||||
override fun shouldBob() = false
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.entity
|
||||
|
||||
import chylex.hee.client.render.gl.DF_ONE_MINUS_SRC_ALPHA
|
||||
import chylex.hee.client.render.gl.RenderStateBuilder
|
||||
import chylex.hee.client.render.gl.RenderStateBuilder.Companion.CULL_DISABLED
|
||||
@@ -28,8 +27,8 @@ import org.lwjgl.opengl.GL11
|
||||
import java.util.Random
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
open class RenderEntityMobAbstractEnderman(manager: EntityRendererManager) : EndermanRenderer(manager) {
|
||||
private fun RENDER_TYPE_CLONE(tex: ResourceLocation) = with(RenderStateBuilder()) {
|
||||
open class RenderEntityMobAbstractEnderman(manager: EntityRendererManager) : EndermanRenderer(manager){
|
||||
private fun RENDER_TYPE_CLONE(tex: ResourceLocation) = with(RenderStateBuilder()){
|
||||
tex(tex)
|
||||
blend(SF_SRC_ALPHA, DF_ONE_MINUS_SRC_ALPHA)
|
||||
lighting(LIGHTING_ENABLED)
|
||||
@@ -45,9 +44,9 @@ open class RenderEntityMobAbstractEnderman(manager: EntityRendererManager) : End
|
||||
private val originalLayerList: List<LayerRenderer<EntityEnderman, EndermanModel<EntityEnderman>>>
|
||||
private var isRenderingClone = false
|
||||
|
||||
init {
|
||||
entityModel = object : EndermanModel<EntityEnderman>(0F) {
|
||||
override fun render(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float) {
|
||||
init{
|
||||
entityModel = object : EndermanModel<EntityEnderman>(0F){
|
||||
override fun render(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float){
|
||||
super.render(matrix, builder, combinedLight, combinedOverlay, red, green, blue, if (isRenderingClone) rand.nextFloat(0.05F, 0.3F) else alpha)
|
||||
}
|
||||
}
|
||||
@@ -55,12 +54,12 @@ open class RenderEntityMobAbstractEnderman(manager: EntityRendererManager) : End
|
||||
originalLayerList = ArrayList(layerRenderers)
|
||||
}
|
||||
|
||||
override fun render(entity: EntityEnderman, yaw: Float, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int) {
|
||||
if (entity !is EntityMobAbstractEnderman) {
|
||||
override fun render(entity: EntityEnderman, yaw: Float, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int){
|
||||
if (entity !is EntityMobAbstractEnderman){
|
||||
return
|
||||
}
|
||||
|
||||
if (entity.isShaking) {
|
||||
if (entity.isShaking){
|
||||
rand.setSeed(entity.world.totalTime)
|
||||
|
||||
matrix.push()
|
||||
@@ -68,13 +67,13 @@ open class RenderEntityMobAbstractEnderman(manager: EntityRendererManager) : End
|
||||
super.render(entity, yaw, partialTicks, matrix, buffer, combinedLight)
|
||||
matrix.pop()
|
||||
}
|
||||
else {
|
||||
else{
|
||||
super.render(entity, yaw, partialTicks, matrix, buffer, combinedLight)
|
||||
}
|
||||
|
||||
val cloneCount = getCloneCount(entity)
|
||||
|
||||
if (cloneCount > 0) {
|
||||
if (cloneCount > 0){
|
||||
rand.setSeed(entity.world.totalTime * 2L / 3L)
|
||||
|
||||
val prevPrevYaw = entity.prevRotationYawHead
|
||||
@@ -86,8 +85,8 @@ open class RenderEntityMobAbstractEnderman(manager: EntityRendererManager) : End
|
||||
isRenderingClone = true
|
||||
layerRenderers.clear()
|
||||
|
||||
repeat(cloneCount) {
|
||||
if (rand.nextInt(3) == 0) {
|
||||
repeat(cloneCount){
|
||||
if (rand.nextInt(3) == 0){
|
||||
entity.rotationYawHead += rand.nextFloat(-45F, 45F)
|
||||
entity.prevRotationYawHead = entity.rotationYawHead
|
||||
|
||||
@@ -112,14 +111,14 @@ open class RenderEntityMobAbstractEnderman(manager: EntityRendererManager) : End
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun getCloneCount(entity: EntityMobAbstractEnderman): Int {
|
||||
protected open fun getCloneCount(entity: EntityMobAbstractEnderman): Int{
|
||||
return if (entity.hurtTime == 0 && entity.isAggro) 2 else 0
|
||||
}
|
||||
|
||||
override fun func_230042_a_(entity: EntityEnderman, isVisible: Boolean, isTranslucent: Boolean): RenderType? {
|
||||
override fun func_230496_a_(entity: EntityEnderman, isVisible: Boolean, isTranslucent: Boolean, isGlowing: Boolean): RenderType?{
|
||||
return if (isRenderingClone)
|
||||
RENDER_TYPE_CLONE(getEntityTexture(entity))
|
||||
else
|
||||
super.func_230042_a_(entity, isVisible, isTranslucent)
|
||||
super.func_230496_a_(entity, isVisible, isTranslucent, isGlowing)
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,12 @@
|
||||
package chylex.hee.client.render.entity
|
||||
|
||||
import chylex.hee.game.entity.living.EntityMobAbstractEnderman
|
||||
import chylex.hee.system.forge.Side
|
||||
import chylex.hee.system.forge.Sided
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderEntityMobAngryEnderman(manager: EntityRendererManager) : RenderEntityMobAbstractEnderman(manager) {
|
||||
override fun getCloneCount(entity: EntityMobAbstractEnderman) = when {
|
||||
class RenderEntityMobAngryEnderman(manager: EntityRendererManager) : RenderEntityMobAbstractEnderman(manager){
|
||||
override fun getCloneCount(entity: EntityMobAbstractEnderman) = when{
|
||||
entity.hurtTime != 0 -> 0
|
||||
entity.isAggro -> 2
|
||||
else -> 1
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.entity
|
||||
|
||||
import chylex.hee.client.MC
|
||||
import chylex.hee.client.model.ModelHelper
|
||||
import chylex.hee.client.model.entity.ModelEntityMobBlobby
|
||||
@@ -29,6 +28,7 @@ import net.minecraft.client.renderer.RenderType
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager
|
||||
import net.minecraft.client.renderer.entity.MobRenderer
|
||||
import net.minecraft.client.renderer.model.IBakedModel
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
import net.minecraft.item.ItemStack
|
||||
@@ -38,28 +38,28 @@ import net.minecraftforge.client.ForgeHooksClient
|
||||
import java.util.Random
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderEntityMobBlobby(manager: EntityRendererManager) : MobRenderer<EntityMobBlobby, ModelEntityMobBlobby>(manager, ModelEntityMobBlobby, 0.27F) {
|
||||
class RenderEntityMobBlobby(manager: EntityRendererManager) : MobRenderer<EntityMobBlobby, ModelEntityMobBlobby>(manager, ModelEntityMobBlobby, 0.27F){
|
||||
private val texture = Resource.Custom("textures/entity/blobby.png")
|
||||
private val renderType = RenderType.getEntityTranslucent(texture)
|
||||
private val fallbackStack = ItemStack(Blocks.BEDROCK)
|
||||
private val rand = Random()
|
||||
|
||||
init {
|
||||
init{
|
||||
shadowOpaque = 0.6F
|
||||
}
|
||||
|
||||
override fun preRenderCallback(entity: EntityMobBlobby, matrix: MatrixStack, partialTicks: Float) {
|
||||
override fun preRenderCallback(entity: EntityMobBlobby, matrix: MatrixStack, partialTicks: Float){
|
||||
matrix.scale(entity.scale * GLOBAL_SCALE)
|
||||
matrix.scaleY(1F + entity.renderSquishClient.get(partialTicks))
|
||||
|
||||
super.preRenderCallback(entity, matrix, partialTicks)
|
||||
}
|
||||
|
||||
override fun render(entity: EntityMobBlobby, yaw: Float, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int) {
|
||||
override fun render(entity: EntityMobBlobby, yaw: Float, partialTicks: Float, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int){
|
||||
val scale = entity.scale
|
||||
val stack = entity.heldItem
|
||||
|
||||
if (stack.isNotEmpty && entity.deathTime == 0) {
|
||||
if (stack.isNotEmpty && entity.deathTime == 0){
|
||||
renderItemInGel(stack, entity, matrix, buffer, combinedLight)
|
||||
}
|
||||
|
||||
@@ -67,15 +67,15 @@ class RenderEntityMobBlobby(manager: EntityRendererManager) : MobRenderer<Entity
|
||||
super.render(entity, yaw, partialTicks, matrix, buffer, combinedLight)
|
||||
}
|
||||
|
||||
override fun func_230042_a_(entity: EntityMobBlobby, isVisible: Boolean, isTranslucent: Boolean): RenderType {
|
||||
override fun func_230496_a_(entity: EntityMobBlobby, isVisible: Boolean, isTranslucent: Boolean, isGlowing: Boolean): RenderType{
|
||||
return renderType
|
||||
}
|
||||
|
||||
override fun getEntityTexture(entity: EntityMobBlobby): ResourceLocation {
|
||||
override fun getEntityTexture(entity: EntityMobBlobby): ResourceLocation{
|
||||
return texture
|
||||
}
|
||||
|
||||
private fun renderItemInGel(stack: ItemStack, entity: EntityMobBlobby, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int) {
|
||||
private fun renderItemInGel(stack: ItemStack, entity: EntityMobBlobby, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int){
|
||||
val scale = entity.scale
|
||||
|
||||
matrix.push()
|
||||
@@ -85,12 +85,12 @@ class RenderEntityMobBlobby(manager: EntityRendererManager) : MobRenderer<Entity
|
||||
val modelRotOff: Double
|
||||
val modelScale: Float
|
||||
|
||||
if (model.isGui3d) {
|
||||
if (model.isGui3d){
|
||||
modelYOff = 0.75
|
||||
modelRotOff = 0.0
|
||||
modelScale = 0.75F
|
||||
}
|
||||
else {
|
||||
else{
|
||||
modelYOff = 0.5
|
||||
modelRotOff = 0.1
|
||||
modelScale = 0.66F
|
||||
@@ -106,25 +106,25 @@ class RenderEntityMobBlobby(manager: EntityRendererManager) : MobRenderer<Entity
|
||||
matrix.scale(modelScale * scale)
|
||||
matrix.translate(-0.5, entity.height * scale * 0.5 - modelYOff, -0.5)
|
||||
|
||||
if (model.isBuiltInRenderer) {
|
||||
val overrideType = when((stack.item as? ItemBlock)?.block) {
|
||||
if (model.isBuiltInRenderer){
|
||||
val overrideType = when((stack.item as? ItemBlock)?.block){
|
||||
is AbstractChestBlock<*> -> RenderType.getEntityTranslucentCull(Atlases.CHEST_ATLAS)
|
||||
else -> null // POLISH implement more special cases
|
||||
else -> null // POLISH implement more special cases
|
||||
}
|
||||
|
||||
if (overrideType != null) {
|
||||
stack.item.itemStackTileEntityRenderer.render(stack, matrix, { buffer.getBuffer(overrideType) }, combinedLight, OverlayTexture.NO_OVERLAY)
|
||||
if (overrideType != null){ // UPDATE test transform
|
||||
stack.item.itemStackTileEntityRenderer.func_239207_a_(stack, TransformType.NONE, matrix, { buffer.getBuffer(overrideType) }, combinedLight, OverlayTexture.NO_OVERLAY)
|
||||
}
|
||||
else if (stack !== fallbackStack) {
|
||||
else if (stack !== fallbackStack){
|
||||
matrix.pop()
|
||||
renderItemInGel(fallbackStack, entity, matrix, buffer, combinedLight)
|
||||
return
|
||||
}
|
||||
}
|
||||
else {
|
||||
else{
|
||||
val builder = buffer.getBuffer(Atlases.getTranslucentCullBlockType())
|
||||
|
||||
for(facing in Facing6) {
|
||||
for(facing in Facing6){
|
||||
renderItemQuads(stack, model, facing, matrix, builder, combinedLight)
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ class RenderEntityMobBlobby(manager: EntityRendererManager) : MobRenderer<Entity
|
||||
matrix.pop()
|
||||
}
|
||||
|
||||
private fun renderItemQuads(stack: ItemStack, model: IBakedModel, facing: Direction?, matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int) {
|
||||
private fun renderItemQuads(stack: ItemStack, model: IBakedModel, facing: Direction?, matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int){
|
||||
MC.itemRenderer.renderQuads(matrix, builder, model.getQuads(facing), stack, combinedLight, OverlayTexture.NO_OVERLAY)
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
package chylex.hee.client.render.entity
|
||||
|
||||
import chylex.hee.client.render.entity.layer.LayerSpiderlingEyes
|
||||
import chylex.hee.client.render.gl.scale
|
||||
import chylex.hee.game.entity.living.EntityMobSpiderling
|
||||
@@ -19,27 +18,27 @@ import net.minecraft.world.LightType.BLOCK
|
||||
import net.minecraft.world.LightType.SKY
|
||||
|
||||
@Sided(Side.CLIENT)
|
||||
class RenderEntityMobSpiderling(manager: EntityRendererManager) : MobRenderer<EntityMobSpiderling, SpiderModel<EntityMobSpiderling>>(manager, SpiderModel(), 0.5F) {
|
||||
class RenderEntityMobSpiderling(manager: EntityRendererManager) : MobRenderer<EntityMobSpiderling, SpiderModel<EntityMobSpiderling>>(manager, SpiderModel(), 0.5F){
|
||||
private val texture = Resource.Custom("textures/entity/spiderling.png")
|
||||
|
||||
init {
|
||||
init{
|
||||
addLayer(LayerSpiderlingEyes(this, (entityModel as SpiderModel).spiderHead))
|
||||
}
|
||||
|
||||
override fun preRenderCallback(entity: EntityMobSpiderling, matrix: MatrixStack, partialTicks: Float) {
|
||||
override fun preRenderCallback(entity: EntityMobSpiderling, matrix: MatrixStack, partialTicks: Float){
|
||||
matrix.scale(0.5F)
|
||||
super.preRenderCallback(entity, matrix, partialTicks)
|
||||
}
|
||||
|
||||
override fun getEntityTexture(entity: EntityMobSpiderling): ResourceLocation {
|
||||
override fun getEntityTexture(entity: EntityMobSpiderling): ResourceLocation{
|
||||
return texture
|
||||
}
|
||||
|
||||
override fun getPackedLight(entity: EntityMobSpiderling, partialTicks: Float): Int {
|
||||
override fun getPackedLight(entity: EntityMobSpiderling, partialTicks: Float): Int{
|
||||
val world = entity.world
|
||||
val pos = Pos(entity)
|
||||
|
||||
if (!pos.isLoaded(world)) {
|
||||
if (!pos.isLoaded(world)){
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -49,7 +48,7 @@ class RenderEntityMobSpiderling(manager: EntityRendererManager) : MobRenderer<En
|
||||
return LightTexture.packLight(sky, block)
|
||||
}
|
||||
|
||||
override fun getDeathMaxRotation(entity: EntityMobSpiderling): Float {
|
||||
override fun getDeathMaxRotation(entity: EntityMobSpiderling): Float{
|
||||
return 180F
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user