mirror of
https://github.com/chylex/Hardcore-Ender-Expansion-2.git
synced 2025-09-15 23:32:08 +02:00
Compare commits
1 Commits
5564fc4a24
...
1.16
Author | SHA1 | Date | |
---|---|---|---|
f091eb20b2 |
@@ -1,8 +1,8 @@
|
|||||||
ext {
|
ext {
|
||||||
mc_version = "1.15.2"
|
mc_version = "1.16.4"
|
||||||
forge_version = "31.2.45"
|
forge_version = "35.1.2"
|
||||||
mapping_version = "20200626-1.15.1"
|
mapping_version = "20201028-1.16.3"
|
||||||
kotlin_mod_version = "1.6.1"
|
kotlin_mod_version = "1.6.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
|
@@ -5,13 +5,13 @@ import net.minecraft.block.Block
|
|||||||
import net.minecraft.data.DataGenerator
|
import net.minecraft.data.DataGenerator
|
||||||
import net.minecraft.data.LootTableProvider
|
import net.minecraft.data.LootTableProvider
|
||||||
import net.minecraft.data.loot.BlockLootTables
|
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.IItemProvider
|
||||||
import net.minecraft.util.ResourceLocation
|
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.BiConsumer
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
import java.util.function.Supplier
|
import java.util.function.Supplier
|
||||||
|
@@ -25,7 +25,6 @@ import chylex.hee.system.Debug
|
|||||||
import chylex.hee.system.forge.SubscribeAllEvents
|
import chylex.hee.system.forge.SubscribeAllEvents
|
||||||
import chylex.hee.system.forge.SubscribeEvent
|
import chylex.hee.system.forge.SubscribeEvent
|
||||||
import net.minecraft.block.Blocks
|
import net.minecraft.block.Blocks
|
||||||
import net.minecraft.world.dimension.DimensionType
|
|
||||||
import net.minecraftforge.fml.DistExecutor
|
import net.minecraftforge.fml.DistExecutor
|
||||||
import net.minecraftforge.fml.DistExecutor.SafeSupplier
|
import net.minecraftforge.fml.DistExecutor.SafeSupplier
|
||||||
import net.minecraftforge.fml.ModLoadingContext
|
import net.minecraftforge.fml.ModLoadingContext
|
||||||
|
@@ -4,12 +4,14 @@ import chylex.hee.system.facades.Resource
|
|||||||
import chylex.hee.system.migration.supply
|
import chylex.hee.system.migration.supply
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.resources.IPackFinder
|
import net.minecraft.resources.IPackFinder
|
||||||
|
import net.minecraft.resources.IPackNameDecorator
|
||||||
import net.minecraft.resources.IResourcePack
|
import net.minecraft.resources.IResourcePack
|
||||||
import net.minecraft.resources.ResourcePackInfo
|
import net.minecraft.resources.ResourcePackInfo
|
||||||
import net.minecraft.resources.ResourcePackInfo.IFactory
|
import net.minecraft.resources.ResourcePackInfo.IFactory
|
||||||
import net.minecraft.resources.ResourcePackInfo.Priority
|
import net.minecraft.resources.ResourcePackInfo.Priority
|
||||||
import net.minecraft.resources.ResourcePackType
|
import net.minecraft.resources.ResourcePackType
|
||||||
import net.minecraftforge.fml.packs.ResourcePackLoader
|
import net.minecraftforge.fml.packs.ResourcePackLoader
|
||||||
|
import java.util.function.Consumer
|
||||||
|
|
||||||
object VanillaResourceOverrides : IPackFinder{
|
object VanillaResourceOverrides : IPackFinder{
|
||||||
fun register(){
|
fun register(){
|
||||||
@@ -19,11 +21,11 @@ object VanillaResourceOverrides : IPackFinder{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 delegate = ResourcePackLoader.getResourcePackFor(HEE.ID).get()
|
||||||
val supplier = supply<IResourcePack>(Pack(delegate))
|
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 {
|
private class Pack(delegate: IResourcePack) : IResourcePack by delegate {
|
||||||
|
@@ -4,9 +4,9 @@ import chylex.hee.game.container.ContainerAmuletOfRecovery
|
|||||||
import chylex.hee.network.server.PacketServerContainerEvent
|
import chylex.hee.network.server.PacketServerContainerEvent
|
||||||
import chylex.hee.system.forge.Side
|
import chylex.hee.system.forge.Side
|
||||||
import chylex.hee.system.forge.Sided
|
import chylex.hee.system.forge.Sided
|
||||||
import net.minecraft.client.resources.I18n
|
|
||||||
import net.minecraft.entity.player.PlayerInventory
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
import net.minecraft.util.text.ITextComponent
|
import net.minecraft.util.text.ITextComponent
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent
|
||||||
import net.minecraftforge.fml.client.gui.widget.ExtendedButton
|
import net.minecraftforge.fml.client.gui.widget.ExtendedButton
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
@@ -14,8 +14,8 @@ class GuiAmuletOfRecovery(container: ContainerAmuletOfRecovery, inventory: Playe
|
|||||||
override fun init(){
|
override fun init(){
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
val moveAllTitle = I18n.format("gui.hee.amulet_of_recovery.move_all")
|
val moveAllTitle = TranslationTextComponent("gui.hee.amulet_of_recovery.move_all")
|
||||||
val moveAllWidth = (font.getStringWidth(moveAllTitle) + 14).coerceAtMost(xSize / 2)
|
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()
|
PacketServerContainerEvent(0).sendToServer()
|
||||||
|
@@ -6,6 +6,7 @@ import chylex.hee.game.world.totalTime
|
|||||||
import chylex.hee.system.facades.Resource
|
import chylex.hee.system.facades.Resource
|
||||||
import chylex.hee.system.forge.Side
|
import chylex.hee.system.forge.Side
|
||||||
import chylex.hee.system.forge.Sided
|
import chylex.hee.system.forge.Sided
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack
|
||||||
import net.minecraft.client.gui.screen.inventory.BrewingStandScreen
|
import net.minecraft.client.gui.screen.inventory.BrewingStandScreen
|
||||||
import net.minecraft.entity.player.PlayerInventory
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
import net.minecraft.inventory.container.BrewingStandContainer
|
import net.minecraft.inventory.container.BrewingStandContainer
|
||||||
@@ -20,13 +21,13 @@ class GuiBrewingStandCustom(container: BrewingStandContainer, inventory: PlayerI
|
|||||||
|
|
||||||
private var brewStartTime = MC.world!!.totalTime
|
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 x = (width - xSize) / 2
|
||||||
val y = (height - ySize) / 2
|
val y = (height - ySize) / 2
|
||||||
|
|
||||||
GL.color(1F, 1F, 1F, 1F)
|
GL.color(1F, 1F, 1F, 1F)
|
||||||
GL.bindTexture(TEX_BACKGROUND)
|
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 worldTime = MC.world!!.totalTime
|
||||||
val brewTime = container.func_216981_f() // RENAME getBrewTime
|
val brewTime = container.func_216981_f() // RENAME getBrewTime
|
||||||
@@ -35,13 +36,13 @@ class GuiBrewingStandCustom(container: BrewingStandContainer, inventory: PlayerI
|
|||||||
val brewProgress = (28F * (1F - (brewTime / 400F))).toInt()
|
val brewProgress = (28F * (1F - (brewTime / 400F))).toInt()
|
||||||
|
|
||||||
if (brewProgress > 0){
|
if (brewProgress > 0){
|
||||||
blit(x + 97, y + 16, 176, 0, 9, brewProgress)
|
blit(matrix, x + 97, y + 16, 176, 0, 9, brewProgress)
|
||||||
}
|
}
|
||||||
|
|
||||||
val bubbleLength = BUBBLE_LENGTHS[((worldTime - brewStartTime).toInt() / 2) % 7]
|
val bubbleLength = BUBBLE_LENGTHS[((worldTime - brewStartTime).toInt() / 2) % 7]
|
||||||
|
|
||||||
if (bubbleLength > 0){
|
if (bubbleLength > 0){
|
||||||
blit(x + 63, y + 43 - bubbleLength, 185, 29 - bubbleLength, 12, bubbleLength)
|
blit(matrix, x + 63, y + 43 - bubbleLength, 185, 29 - bubbleLength, 12, bubbleLength)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -49,14 +50,14 @@ class GuiBrewingStandCustom(container: BrewingStandContainer, inventory: PlayerI
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (container.getSlot(TileEntityBrewingStandCustom.SLOT_MODIFIER).hasStack){
|
if (container.getSlot(TileEntityBrewingStandCustom.SLOT_MODIFIER).hasStack){
|
||||||
blit(x + 62, y + 45, 197, 0, 14, 2)
|
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)
|
val slot = container.getSlot(slotIndex)
|
||||||
|
|
||||||
if (!slot.hasStack){
|
if (!slot.hasStack){
|
||||||
blit(x + slot.xPos, y + slot.yPos, 211, 0, 16, 16)
|
blit(matrix, x + slot.xPos, y + slot.yPos, 211, 0, 16, 16)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@ import chylex.hee.system.color.IntColor.Companion.RGBA
|
|||||||
import chylex.hee.system.facades.Resource
|
import chylex.hee.system.facades.Resource
|
||||||
import chylex.hee.system.forge.Side
|
import chylex.hee.system.forge.Side
|
||||||
import chylex.hee.system.forge.Sided
|
import chylex.hee.system.forge.Sided
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack
|
||||||
import net.minecraft.entity.player.PlayerInventory
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
import net.minecraft.util.text.ITextComponent
|
import net.minecraft.util.text.ITextComponent
|
||||||
|
|
||||||
@@ -23,19 +24,19 @@ class GuiTrinketPouch(container: ContainerTrinketPouch, inventory: PlayerInvento
|
|||||||
hiddenSlots = ContainerTrinketPouch.MAX_SLOTS - (container as ContainerBaseCustomInventory<*>).containerInventory.size
|
hiddenSlots = ContainerTrinketPouch.MAX_SLOTS - (container as ContainerBaseCustomInventory<*>).containerInventory.size
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
|
override fun drawGuiContainerBackgroundLayer(matrix: MatrixStack, partialTicks: Float, mouseX: Int, mouseY: Int){
|
||||||
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY)
|
super.drawGuiContainerBackgroundLayer(matrix, partialTicks, mouseX, mouseY)
|
||||||
|
|
||||||
val middleSlot = ContainerTrinketPouch.MAX_SLOTS / 2
|
val middleSlot = ContainerTrinketPouch.MAX_SLOTS / 2
|
||||||
|
|
||||||
repeat(hiddenSlots){
|
repeat(hiddenSlots){
|
||||||
renderSlotCover(middleSlot + ((ContainerTrinketPouch.MAX_SLOTS - it) / 2) * (if (it % 2 == 0) -1 else 1))
|
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 x = guiLeft + 44 + (index * 18)
|
||||||
val y = guiTop + 18
|
val y = guiTop + 18
|
||||||
fill(x, y, x + 16, y + 16, hiddenSlotColor)
|
fill(matrix, x, y, x + 16, y + 16, hiddenSlotColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ import chylex.hee.system.color.IntColor.Companion.RGB
|
|||||||
import chylex.hee.system.facades.Resource
|
import chylex.hee.system.facades.Resource
|
||||||
import chylex.hee.system.forge.Side
|
import chylex.hee.system.forge.Side
|
||||||
import chylex.hee.system.forge.Sided
|
import chylex.hee.system.forge.Sided
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack
|
||||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen
|
import net.minecraft.client.gui.screen.inventory.ContainerScreen
|
||||||
import net.minecraft.entity.player.PlayerInventory
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
import net.minecraft.inventory.container.ChestContainer
|
import net.minecraft.inventory.container.ChestContainer
|
||||||
@@ -23,25 +24,25 @@ abstract class GuiBaseChestContainer<T : ChestContainer>(container: T, inventory
|
|||||||
ySize = 114 + (containerRows * 18)
|
ySize = 114 + (containerRows * 18)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(mouseX: Int, mouseY: Int, partialTicks: Float){
|
override fun render(matrix: MatrixStack, mouseX: Int, mouseY: Int, partialTicks: Float){
|
||||||
renderBackground()
|
renderBackground(matrix)
|
||||||
super.render(mouseX, mouseY, partialTicks)
|
super.render(matrix, mouseX, mouseY, partialTicks)
|
||||||
renderHoveredToolTip(mouseX, mouseY)
|
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 x = (width - xSize) / 2
|
||||||
val y = (height - ySize) / 2
|
val y = (height - ySize) / 2
|
||||||
val heightContainer = 17 + (containerRows * 18)
|
val heightContainer = 17 + (containerRows * 18)
|
||||||
|
|
||||||
GL.color(1F, 1F, 1F, 1F)
|
GL.color(1F, 1F, 1F, 1F)
|
||||||
GL.bindTexture(TEX_BACKGROUND)
|
GL.bindTexture(TEX_BACKGROUND)
|
||||||
blit(x, y, 0, 0, xSize, heightContainer)
|
blit(matrix, x, y, 0, 0, xSize, heightContainer)
|
||||||
blit(x, y + heightContainer, 0, 126, xSize, 96)
|
blit(matrix, x, y + heightContainer, 0, 126, xSize, 96)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int){
|
override fun drawGuiContainerForegroundLayer(matrix: MatrixStack, mouseX: Int, mouseY: Int){
|
||||||
font.drawString(title.formattedText, 8F, 6F, COLOR_TEXT)
|
font.drawString(matrix, title.string, 8F, 6F, COLOR_TEXT)
|
||||||
font.drawString(playerInventory.displayName.formattedText, 8F, ySize - 94F, COLOR_TEXT)
|
font.drawString(matrix, playerInventory.displayName.string, 8F, ySize - 94F, COLOR_TEXT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ import chylex.hee.game.container.base.ContainerBaseCustomInventory
|
|||||||
import chylex.hee.system.color.IntColor.Companion.RGB
|
import chylex.hee.system.color.IntColor.Companion.RGB
|
||||||
import chylex.hee.system.forge.Side
|
import chylex.hee.system.forge.Side
|
||||||
import chylex.hee.system.forge.Sided
|
import chylex.hee.system.forge.Sided
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack
|
||||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen
|
import net.minecraft.client.gui.screen.inventory.ContainerScreen
|
||||||
import net.minecraft.entity.player.PlayerInventory
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
@@ -18,23 +19,23 @@ abstract class GuiBaseCustomInventory<T : ContainerBaseCustomInventory<*>>(conta
|
|||||||
protected abstract val texBackground: ResourceLocation
|
protected abstract val texBackground: ResourceLocation
|
||||||
protected abstract val titleContainer: String
|
protected abstract val titleContainer: String
|
||||||
|
|
||||||
override fun render(mouseX: Int, mouseY: Int, partialTicks: Float){
|
override fun render(matrix: MatrixStack, mouseX: Int, mouseY: Int, partialTicks: Float){
|
||||||
renderBackground()
|
renderBackground(matrix)
|
||||||
super.render(mouseX, mouseY, partialTicks)
|
super.render(matrix, mouseX, mouseY, partialTicks)
|
||||||
renderHoveredToolTip(mouseX, mouseY)
|
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 x = (width - xSize) / 2
|
||||||
val y = (height - ySize) / 2
|
val y = (height - ySize) / 2
|
||||||
|
|
||||||
GL.color(1F, 1F, 1F, 1F)
|
GL.color(1F, 1F, 1F, 1F)
|
||||||
GL.bindTexture(texBackground)
|
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){
|
override fun drawGuiContainerForegroundLayer(matrix: MatrixStack, mouseX: Int, mouseY: Int){
|
||||||
font.drawString(title.formattedText, 8F, 6F, COLOR_TEXT)
|
font.drawString(matrix, title.string, 8F, 6F, COLOR_TEXT)
|
||||||
font.drawString(playerInventory.displayName.formattedText, 8F, ySize - 94F, COLOR_TEXT)
|
font.drawString(matrix, playerInventory.displayName.string, 8F, ySize - 94F, COLOR_TEXT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@ import com.mojang.blaze3d.vertex.IVertexBuilder
|
|||||||
import net.minecraft.client.renderer.RenderType
|
import net.minecraft.client.renderer.RenderType
|
||||||
import net.minecraft.client.renderer.model.Model
|
import net.minecraft.client.renderer.model.Model
|
||||||
import net.minecraft.client.renderer.model.ModelRenderer
|
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.PI
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlin.math.sin
|
import kotlin.math.sin
|
||||||
@@ -40,7 +40,7 @@ object ModelBlockIgneousPlate : Model(RenderType::getEntityCutout){
|
|||||||
outerBox.render(matrix, builder, combinedLight, combinedOverlay, red, green, blue, alpha)
|
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.push()
|
||||||
matrix.translateZ(-abs(sin(-animation)).toFloat() * 0.0925)
|
matrix.translateZ(-abs(sin(-animation)).toFloat() * 0.0925)
|
||||||
innerBox.render(matrix, builder, combinedLight, combinedOverlay, color.x.toFloat(), color.y.toFloat(), color.z.toFloat(), 1F)
|
innerBox.render(matrix, builder, combinedLight, combinedOverlay, color.x.toFloat(), color.y.toFloat(), color.z.toFloat(), 1F)
|
||||||
|
@@ -78,7 +78,7 @@ object OverlayRenderer{
|
|||||||
GL.bindTexture(TEX_PURIFIED_ENDER_GOO_OVERLAY)
|
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)
|
GL.color(1F, 1F, 1F, 1F)
|
||||||
}
|
}
|
||||||
@@ -90,6 +90,7 @@ object OverlayRenderer{
|
|||||||
fun onRenderText(@Suppress("UNUSED_PARAMETER") e: RenderGameOverlayEvent.Text){
|
fun onRenderText(@Suppress("UNUSED_PARAMETER") e: RenderGameOverlayEvent.Text){
|
||||||
fun drawTextOffScreenCenter(x: Int, y: Int, line: Int, text: String, color: IntColor){
|
fun drawTextOffScreenCenter(x: Int, y: Int, line: Int, text: String, color: IntColor){
|
||||||
val window = MC.window
|
val window = MC.window
|
||||||
|
val matrix = e.matrixStack
|
||||||
|
|
||||||
with(MC.fontRenderer){
|
with(MC.fontRenderer){
|
||||||
val centerX = x + (window.scaledWidth / 2)
|
val centerX = x + (window.scaledWidth / 2)
|
||||||
@@ -101,8 +102,8 @@ object OverlayRenderer{
|
|||||||
val offsetX = -(textWidth / 2)
|
val offsetX = -(textWidth / 2)
|
||||||
val offsetY = -(textHeight / 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)
|
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(text, (centerX + offsetX).toFloat(), (centerY + offsetY).toFloat(), color.i)
|
drawStringWithShadow(matrix, text, (centerX + offsetX).toFloat(), (centerY + offsetY).toFloat(), color.i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,13 +6,13 @@ import chylex.hee.client.render.gl.DF_ZERO
|
|||||||
import chylex.hee.client.render.gl.GL
|
import chylex.hee.client.render.gl.GL
|
||||||
import chylex.hee.client.render.gl.SF_ONE
|
import chylex.hee.client.render.gl.SF_ONE
|
||||||
import chylex.hee.client.render.gl.SF_SRC_ALPHA
|
import chylex.hee.client.render.gl.SF_SRC_ALPHA
|
||||||
|
import chylex.hee.game.entity.dimensionKey
|
||||||
import chylex.hee.game.entity.lookDirVec
|
import chylex.hee.game.entity.lookDirVec
|
||||||
import chylex.hee.game.entity.posVec
|
import chylex.hee.game.entity.posVec
|
||||||
import chylex.hee.game.particle.ParticleVoid
|
import chylex.hee.game.particle.ParticleVoid
|
||||||
import chylex.hee.game.particle.spawner.ParticleSpawnerCustom
|
import chylex.hee.game.particle.spawner.ParticleSpawnerCustom
|
||||||
import chylex.hee.game.particle.spawner.properties.IOffset.InBox
|
import chylex.hee.game.particle.spawner.properties.IOffset.InBox
|
||||||
import chylex.hee.game.particle.spawner.properties.IShape.Point
|
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.TerritoryType
|
||||||
import chylex.hee.game.world.territory.TerritoryVoid
|
import chylex.hee.game.world.territory.TerritoryVoid
|
||||||
import chylex.hee.system.Debug
|
import chylex.hee.system.Debug
|
||||||
@@ -26,6 +26,7 @@ import chylex.hee.system.math.LerpedFloat
|
|||||||
import chylex.hee.system.math.floorToInt
|
import chylex.hee.system.math.floorToInt
|
||||||
import chylex.hee.system.math.scale
|
import chylex.hee.system.math.scale
|
||||||
import chylex.hee.system.migration.EntityPlayer
|
import chylex.hee.system.migration.EntityPlayer
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack
|
||||||
import net.minecraft.client.resources.I18n
|
import net.minecraft.client.resources.I18n
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent
|
import net.minecraftforge.client.event.RenderGameOverlayEvent
|
||||||
import net.minecraftforge.common.MinecraftForge
|
import net.minecraftforge.common.MinecraftForge
|
||||||
@@ -45,7 +46,7 @@ object TerritoryRenderer{
|
|||||||
if (e.phase == Phase.START){
|
if (e.phase == Phase.START){
|
||||||
val player = MC.player
|
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)
|
Void.tick(player)
|
||||||
Title.tick()
|
Title.tick()
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ object TerritoryRenderer{
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text){
|
fun onRenderGameOverlayText(e: RenderGameOverlayEvent.Text){
|
||||||
if (MC.settings.showDebugInfo && MC.player?.dimension === HEE.dim){
|
if (MC.settings.showDebugInfo && MC.player?.dimensionKey === HEE.dim){
|
||||||
with(e.left){
|
with(e.left){
|
||||||
add("")
|
add("")
|
||||||
add("End Void Factor: ${"%.3f".format(voidFactor.currentValue)}")
|
add("End Void Factor: ${"%.3f".format(voidFactor.currentValue)}")
|
||||||
@@ -203,8 +204,8 @@ object TerritoryRenderer{
|
|||||||
val x = -fontRenderer.getStringWidth(textTitle) * 0.5F
|
val x = -fontRenderer.getStringWidth(textTitle) * 0.5F
|
||||||
val y = -fontRenderer.FONT_HEIGHT - 2F
|
val y = -fontRenderer.FONT_HEIGHT - 2F
|
||||||
|
|
||||||
drawTitle(x + 0.5F, y + 0.5F, textShadowColor.withAlpha(opacity.pow(1.25F)))
|
drawTitle(e.matrixStack, x + 0.5F, y + 0.5F, textShadowColor.withAlpha(opacity.pow(1.25F)))
|
||||||
drawTitle(x, y, textMainColor.withAlpha(opacity))
|
drawTitle(e.matrixStack, x, y, textMainColor.withAlpha(opacity))
|
||||||
|
|
||||||
GL.popMatrix()
|
GL.popMatrix()
|
||||||
GL.alphaFunc(GL_GREATER, 0.1F)
|
GL.alphaFunc(GL_GREATER, 0.1F)
|
||||||
@@ -212,9 +213,9 @@ object TerritoryRenderer{
|
|||||||
GL.popMatrix()
|
GL.popMatrix()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun drawTitle(x: Float, y: Float, color: IntColor){
|
private fun drawTitle(matrix: MatrixStack, x: Float, y: Float, color: IntColor){
|
||||||
if (color.alpha > 3){ // prevents flickering alpha
|
if (color.alpha > 3){ // prevents flickering alpha
|
||||||
MC.fontRenderer.drawString(textTitle, x, y, color.i)
|
MC.fontRenderer.drawString(matrix, textTitle, x, y, color.i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,12 +23,12 @@ import chylex.hee.system.math.toRadians
|
|||||||
import com.mojang.blaze3d.matrix.MatrixStack
|
import com.mojang.blaze3d.matrix.MatrixStack
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder
|
import com.mojang.blaze3d.vertex.IVertexBuilder
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer
|
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.TileEntityRenderer
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
import net.minecraft.util.math.BlockPos
|
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 net.minecraft.world.World
|
||||||
import org.lwjgl.opengl.GL11
|
import org.lwjgl.opengl.GL11
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
@@ -209,7 +209,7 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
|
|||||||
builder.pos(mat, sizeNB, yB, sizeNB).color().tex(texW, 0F).endVertex()
|
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 layerIndexRev = 16 - layer
|
||||||
val parallaxMp = (1F + abs(diff.y.toFloat() / 32F)).pow(0.12F)
|
val parallaxMp = (1F + abs(diff.y.toFloat() / 32F)).pow(0.12F)
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@ import chylex.hee.init.ModAtlases
|
|||||||
import chylex.hee.system.facades.Resource
|
import chylex.hee.system.facades.Resource
|
||||||
import chylex.hee.system.forge.Side
|
import chylex.hee.system.forge.Side
|
||||||
import chylex.hee.system.forge.Sided
|
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.ChestTileEntityRenderer
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||||
import net.minecraft.state.properties.ChestType
|
import net.minecraft.state.properties.ChestType
|
||||||
@@ -18,9 +18,9 @@ class RenderTileDarkChest(dispatcher: TileEntityRendererDispatcher) : ChestTileE
|
|||||||
val TEX_DOUBLE_LEFT = Resource.Custom("entity/dark_chest_left")
|
val TEX_DOUBLE_LEFT = Resource.Custom("entity/dark_chest_left")
|
||||||
val TEX_DOUBLE_RIGHT = Resource.Custom("entity/dark_chest_right")
|
val TEX_DOUBLE_RIGHT = Resource.Custom("entity/dark_chest_right")
|
||||||
|
|
||||||
private val MAT_SINGLE = Material(ModAtlases.ATLAS_TILES, TEX_SINGLE)
|
private val MAT_SINGLE = RenderMaterial(ModAtlases.ATLAS_TILES, TEX_SINGLE)
|
||||||
private val MAT_DOUBLE_LEFT = Material(ModAtlases.ATLAS_TILES, TEX_DOUBLE_LEFT)
|
private val MAT_DOUBLE_LEFT = RenderMaterial(ModAtlases.ATLAS_TILES, TEX_DOUBLE_LEFT)
|
||||||
private val MAT_DOUBLE_RIGHT = Material(ModAtlases.ATLAS_TILES, TEX_DOUBLE_RIGHT)
|
private val MAT_DOUBLE_RIGHT = RenderMaterial(ModAtlases.ATLAS_TILES, TEX_DOUBLE_RIGHT)
|
||||||
}
|
}
|
||||||
|
|
||||||
init{
|
init{
|
||||||
|
@@ -20,7 +20,7 @@ class RenderTileEndPortal(dispatcher: TileEntityRendererDispatcher) : RenderTile
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun findController(world: World, pos: BlockPos): IPortalController?{
|
override fun findController(world: World, pos: BlockPos): IPortalController?{
|
||||||
if (world.dimension.type === HEE.dim){
|
if (world.dimensionKey === HEE.dim){
|
||||||
return AlwaysOnController
|
return AlwaysOnController
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,7 +14,6 @@ import chylex.hee.system.math.floorToInt
|
|||||||
import com.mojang.blaze3d.matrix.MatrixStack
|
import com.mojang.blaze3d.matrix.MatrixStack
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder
|
import com.mojang.blaze3d.vertex.IVertexBuilder
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer
|
import net.minecraft.client.renderer.IRenderTypeBuffer
|
||||||
import net.minecraft.client.renderer.Matrix4f
|
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.WorldRenderer
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||||
@@ -22,6 +21,7 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
|||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
import net.minecraft.inventory.container.PlayerContainer
|
import net.minecraft.inventory.container.PlayerContainer
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
|
import net.minecraft.util.math.vector.Matrix4f
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent
|
import net.minecraftforge.client.event.TextureStitchEvent
|
||||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
|
||||||
|
@@ -29,7 +29,7 @@ import net.minecraft.client.renderer.RenderType
|
|||||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import org.lwjgl.opengl.GL11
|
import org.lwjgl.opengl.GL11
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
@@ -53,7 +53,7 @@ class RenderTileIgneousPlate(dispatcher: TileEntityRendererDispatcher) : TileEnt
|
|||||||
RGB(235, 23, 23).asVec
|
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 index = combinedHeat.floorToInt().coerceIn(0, COLOR_TRANSITIONS.lastIndex - 1)
|
||||||
val progress = combinedHeat.toDouble() - index
|
val progress = combinedHeat.toDouble() - index
|
||||||
|
|
||||||
|
@@ -20,6 +20,7 @@ import com.mojang.blaze3d.matrix.MatrixStack
|
|||||||
import net.minecraft.client.renderer.Atlases
|
import net.minecraft.client.renderer.Atlases
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer
|
import net.minecraft.client.renderer.IRenderTypeBuffer
|
||||||
import net.minecraft.client.renderer.model.IBakedModel
|
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.texture.TextureAtlasSprite
|
||||||
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
|
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
|
||||||
@@ -181,7 +182,7 @@ class RenderTileJarODust(dispatcher: TileEntityRendererDispatcher) : TileEntityR
|
|||||||
|
|
||||||
private val layers = DustLayers(TileEntityJarODust.DUST_CAPACITY)
|
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)
|
val nbt = stack.heeTagOrNull?.getListOfCompounds(TileEntityJarODust.LAYERS_TAG)
|
||||||
|
|
||||||
if (nbt != null){
|
if (nbt != null){
|
||||||
|
@@ -4,7 +4,7 @@ import chylex.hee.init.ModAtlases
|
|||||||
import chylex.hee.system.facades.Resource
|
import chylex.hee.system.facades.Resource
|
||||||
import chylex.hee.system.forge.Side
|
import chylex.hee.system.forge.Side
|
||||||
import chylex.hee.system.forge.Sided
|
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.ChestTileEntityRenderer
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||||
import net.minecraft.state.properties.ChestType
|
import net.minecraft.state.properties.ChestType
|
||||||
@@ -13,14 +13,14 @@ import net.minecraft.state.properties.ChestType
|
|||||||
class RenderTileLootChest(dispatcher: TileEntityRendererDispatcher) : ChestTileEntityRenderer<TileEntityLootChest>(dispatcher){
|
class RenderTileLootChest(dispatcher: TileEntityRendererDispatcher) : ChestTileEntityRenderer<TileEntityLootChest>(dispatcher){
|
||||||
companion object{
|
companion object{
|
||||||
val TEX = Resource.Custom("entity/loot_chest")
|
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
|
isChristmas = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getMaterial(tile: TileEntityLootChest, type: ChestType): Material{
|
override fun getMaterial(tile: TileEntityLootChest, type: ChestType): RenderMaterial{
|
||||||
return MAT
|
return MAT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ class RenderTileTable(dispatcher: TileEntityRendererDispatcher) : TileEntityRend
|
|||||||
val itemModel = ForgeHooksClient.handleCameraTransforms(matrix, ModelHelper.getItemModel(itemStack), GUI, false)
|
val itemModel = ForgeHooksClient.handleCameraTransforms(matrix, ModelHelper.getItemModel(itemStack), GUI, false)
|
||||||
|
|
||||||
val mat = matrix.last
|
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)
|
builder.addVertexData(mat, quad, COLOR_SHADE, COLOR_SHADE, COLOR_SHADE, COLOR_ALPHA, LIGHT, OverlayTexture.NO_OVERLAY)
|
||||||
|
@@ -23,7 +23,6 @@ import chylex.hee.system.random.nextFloat
|
|||||||
import com.mojang.blaze3d.matrix.MatrixStack
|
import com.mojang.blaze3d.matrix.MatrixStack
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer
|
import net.minecraft.client.renderer.IRenderTypeBuffer
|
||||||
import net.minecraft.client.renderer.ItemRenderer
|
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.IBakedModel
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||||
@@ -32,6 +31,7 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
|||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
import net.minecraft.item.Item
|
import net.minecraft.item.Item
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.util.math.vector.Matrix4f
|
||||||
import org.lwjgl.opengl.GL11
|
import org.lwjgl.opengl.GL11
|
||||||
import java.util.Collections
|
import java.util.Collections
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
|
@@ -115,10 +115,10 @@ open class RenderEntityMobAbstractEnderman(manager: EntityRendererManager) : End
|
|||||||
return if (entity.hurtTime == 0 && entity.isAggro) 2 else 0
|
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)
|
return if (isRenderingClone)
|
||||||
RENDER_TYPE_CLONE(getEntityTexture(entity))
|
RENDER_TYPE_CLONE(getEntityTexture(entity))
|
||||||
else
|
else
|
||||||
super.func_230042_a_(entity, isVisible, isTranslucent)
|
super.func_230496_a_(entity, isVisible, isTranslucent, isGlowing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@ import net.minecraft.client.renderer.RenderType
|
|||||||
import net.minecraft.client.renderer.entity.EntityRendererManager
|
import net.minecraft.client.renderer.entity.EntityRendererManager
|
||||||
import net.minecraft.client.renderer.entity.MobRenderer
|
import net.minecraft.client.renderer.entity.MobRenderer
|
||||||
import net.minecraft.client.renderer.model.IBakedModel
|
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.model.ItemCameraTransforms.TransformType.GROUND
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
@@ -66,7 +67,7 @@ class RenderEntityMobBlobby(manager: EntityRendererManager) : MobRenderer<Entity
|
|||||||
super.render(entity, yaw, partialTicks, matrix, buffer, combinedLight)
|
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
|
return renderType
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,8 +112,8 @@ class RenderEntityMobBlobby(manager: EntityRendererManager) : MobRenderer<Entity
|
|||||||
else -> null // POLISH implement more special cases
|
else -> null // POLISH implement more special cases
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overrideType != null){
|
if (overrideType != null){ // UPDATE test transform
|
||||||
stack.item.itemStackTileEntityRenderer.render(stack, matrix, { buffer.getBuffer(overrideType) }, combinedLight, OverlayTexture.NO_OVERLAY)
|
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()
|
matrix.pop()
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package chylex.hee.client.render.entity
|
package chylex.hee.client.render.entity
|
||||||
import chylex.hee.system.forge.Side
|
import chylex.hee.system.forge.Side
|
||||||
import chylex.hee.system.forge.Sided
|
import chylex.hee.system.forge.Sided
|
||||||
import net.minecraft.client.renderer.culling.ClippingHelperImpl
|
import net.minecraft.client.renderer.culling.ClippingHelper
|
||||||
import net.minecraft.client.renderer.entity.EntityRenderer
|
import net.minecraft.client.renderer.entity.EntityRenderer
|
||||||
import net.minecraft.client.renderer.entity.EntityRendererManager
|
import net.minecraft.client.renderer.entity.EntityRendererManager
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
@@ -9,6 +9,6 @@ import net.minecraft.util.ResourceLocation
|
|||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class RenderEntityNothing(manager: EntityRendererManager) : EntityRenderer<Entity>(manager){
|
class RenderEntityNothing(manager: EntityRendererManager) : EntityRenderer<Entity>(manager){
|
||||||
override fun shouldRender(entity: Entity, camera: ClippingHelperImpl, camX: Double, camY: Double, camZ: Double) = false
|
override fun shouldRender(entity: Entity, camera: ClippingHelper, camX: Double, camY: Double, camZ: Double) = false
|
||||||
override fun getEntityTexture(entity: Entity): ResourceLocation? = null
|
override fun getEntityTexture(entity: Entity): ResourceLocation? = null
|
||||||
}
|
}
|
||||||
|
@@ -5,12 +5,12 @@ import chylex.hee.system.forge.Sided
|
|||||||
import com.mojang.blaze3d.matrix.MatrixStack
|
import com.mojang.blaze3d.matrix.MatrixStack
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder
|
import com.mojang.blaze3d.vertex.IVertexBuilder
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer
|
import net.minecraft.client.renderer.IRenderTypeBuffer
|
||||||
import net.minecraft.client.renderer.Matrix4f
|
|
||||||
import net.minecraft.client.renderer.RenderType
|
import net.minecraft.client.renderer.RenderType
|
||||||
import net.minecraft.client.renderer.entity.EntityRenderer
|
import net.minecraft.client.renderer.entity.EntityRenderer
|
||||||
import net.minecraft.client.renderer.entity.EntityRendererManager
|
import net.minecraft.client.renderer.entity.EntityRendererManager
|
||||||
import net.minecraft.inventory.container.PlayerContainer
|
import net.minecraft.inventory.container.PlayerContainer
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
|
import net.minecraft.util.math.vector.Matrix4f
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
|
@@ -3,6 +3,7 @@ import chylex.hee.system.forge.Side
|
|||||||
import chylex.hee.system.forge.Sided
|
import chylex.hee.system.forge.Sided
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack
|
import com.mojang.blaze3d.matrix.MatrixStack
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer
|
import net.minecraft.client.renderer.IRenderTypeBuffer
|
||||||
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType
|
||||||
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
|
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
@@ -10,7 +11,7 @@ import net.minecraft.tileentity.TileEntity
|
|||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
class RenderItemTileEntitySimple<T : TileEntity>(val tile: T) : ItemStackTileEntityRenderer(){
|
class RenderItemTileEntitySimple<T : TileEntity>(val tile: T) : ItemStackTileEntityRenderer(){
|
||||||
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){
|
||||||
TileEntityRendererDispatcher.instance.renderItem(tile, matrix, buffer, combinedLight, combinedOverlay)
|
TileEntityRendererDispatcher.instance.renderItem(tile, matrix, buffer, combinedLight, combinedOverlay)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@ import net.minecraft.client.renderer.RenderHelper
|
|||||||
import net.minecraft.client.renderer.Tessellator
|
import net.minecraft.client.renderer.Tessellator
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||||
import net.minecraft.client.world.ClientWorld
|
import net.minecraft.client.world.ClientWorld
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraftforge.client.SkyRenderHandler
|
import net.minecraftforge.client.SkyRenderHandler
|
||||||
import org.lwjgl.opengl.GL11.GL_QUADS
|
import org.lwjgl.opengl.GL11.GL_QUADS
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
@@ -32,7 +32,7 @@ abstract class AbstractEnvironmentRenderer : SkyRenderHandler{
|
|||||||
get() = MC.settings.renderDistanceChunks.let { if (it > 12) 0F else (1F - (it / 16.5F)).pow((it - 1) * 0.25F) }
|
get() = MC.settings.renderDistanceChunks.let { if (it > 12) 0F else (1F - (it / 16.5F)).pow((it - 1) * 0.25F) }
|
||||||
|
|
||||||
val DEFAULT_TEXTURE = Resource.Custom("textures/environment/white.png")
|
val DEFAULT_TEXTURE = Resource.Custom("textures/environment/white.png")
|
||||||
val DEFAULT_COLOR = Vec3d(1.0, 1.0, 1.0)
|
val DEFAULT_COLOR = Vector3d(1.0, 1.0, 1.0)
|
||||||
const val DEFAULT_ALPHA = 1F
|
const val DEFAULT_ALPHA = 1F
|
||||||
|
|
||||||
fun renderPlane(matrix: MatrixStack, y: Float, size: Float, rescale: Float){
|
fun renderPlane(matrix: MatrixStack, y: Float, size: Float, rescale: Float){
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
package chylex.hee.client.render.territory.components
|
package chylex.hee.client.render.territory.components
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
|
|
||||||
class SkyCubeStatic(
|
class SkyCubeStatic(
|
||||||
override val texture: ResourceLocation = DEFAULT_TEXTURE,
|
override val texture: ResourceLocation = DEFAULT_TEXTURE,
|
||||||
override val color: Vec3d = DEFAULT_COLOR,
|
override val color: Vector3d = DEFAULT_COLOR,
|
||||||
override val alpha: Float = DEFAULT_ALPHA,
|
override val alpha: Float = DEFAULT_ALPHA,
|
||||||
override val rescale: Float = DEFAULT_RESCALE,
|
override val rescale: Float = DEFAULT_RESCALE,
|
||||||
override val distance: Float = DEFAULT_DISTANCE
|
override val distance: Float = DEFAULT_DISTANCE
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
package chylex.hee.client.render.territory.components
|
package chylex.hee.client.render.territory.components
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
|
|
||||||
class SkyDomeStatic(
|
class SkyDomeStatic(
|
||||||
override val texture: ResourceLocation = DEFAULT_TEXTURE,
|
override val texture: ResourceLocation = DEFAULT_TEXTURE,
|
||||||
override val color1: Vec3d = DEFAULT_COLOR,
|
override val color1: Vector3d = DEFAULT_COLOR,
|
||||||
override val color2: Vec3d = DEFAULT_COLOR,
|
override val color2: Vector3d = DEFAULT_COLOR,
|
||||||
override val alpha1: Float = DEFAULT_ALPHA,
|
override val alpha1: Float = DEFAULT_ALPHA,
|
||||||
override val alpha2: Float = DEFAULT_ALPHA
|
override val alpha2: Float = DEFAULT_ALPHA
|
||||||
) : SkyDomeBase(){
|
) : SkyDomeBase(){
|
||||||
constructor(texture: ResourceLocation = DEFAULT_TEXTURE, color: Vec3d = DEFAULT_COLOR, alpha: Float = DEFAULT_ALPHA) : this(texture, color, color, alpha, alpha)
|
constructor(texture: ResourceLocation = DEFAULT_TEXTURE, color: Vector3d = DEFAULT_COLOR, alpha: Float = DEFAULT_ALPHA) : this(texture, color, color, alpha, alpha)
|
||||||
constructor(texture: ResourceLocation = DEFAULT_TEXTURE, color1: Vec3d, color2: Vec3d, alpha: Float = DEFAULT_ALPHA) : this(texture, color1, color2, alpha, alpha)
|
constructor(texture: ResourceLocation = DEFAULT_TEXTURE, color1: Vector3d, color2: Vector3d, alpha: Float = DEFAULT_ALPHA) : this(texture, color1, color2, alpha, alpha)
|
||||||
constructor(texture: ResourceLocation = DEFAULT_TEXTURE, color: Vec3d = DEFAULT_COLOR, alpha1: Float, alpha2: Float) : this(texture, color, color, alpha1, alpha2)
|
constructor(texture: ResourceLocation = DEFAULT_TEXTURE, color: Vector3d = DEFAULT_COLOR, alpha1: Float, alpha2: Float) : this(texture, color, color, alpha1, alpha2)
|
||||||
}
|
}
|
||||||
|
@@ -11,12 +11,12 @@ import chylex.hee.system.forge.Sided
|
|||||||
import com.mojang.blaze3d.matrix.MatrixStack
|
import com.mojang.blaze3d.matrix.MatrixStack
|
||||||
import net.minecraft.client.world.ClientWorld
|
import net.minecraft.client.world.ClientWorld
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import org.lwjgl.opengl.GL11.GL_GREATER
|
import org.lwjgl.opengl.GL11.GL_GREATER
|
||||||
|
|
||||||
class SkyPlaneTopFoggy(
|
class SkyPlaneTopFoggy(
|
||||||
override val texture: ResourceLocation = DEFAULT_TEXTURE,
|
override val texture: ResourceLocation = DEFAULT_TEXTURE,
|
||||||
override val color: Vec3d = DEFAULT_COLOR,
|
override val color: Vector3d = DEFAULT_COLOR,
|
||||||
override val alpha: Float = DEFAULT_ALPHA,
|
override val alpha: Float = DEFAULT_ALPHA,
|
||||||
override val rescale: Float = DEFAULT_RESCALE,
|
override val rescale: Float = DEFAULT_RESCALE,
|
||||||
override val distance: Float = DEFAULT_DISTANCE,
|
override val distance: Float = DEFAULT_DISTANCE,
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
package chylex.hee.client.render.territory.components
|
package chylex.hee.client.render.territory.components
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
|
|
||||||
class SunStatic(
|
class SunStatic(
|
||||||
override val texture: ResourceLocation,
|
override val texture: ResourceLocation,
|
||||||
override val color: Vec3d = DEFAULT_COLOR,
|
override val color: Vector3d = DEFAULT_COLOR,
|
||||||
override val alpha: Float = DEFAULT_ALPHA,
|
override val alpha: Float = DEFAULT_ALPHA,
|
||||||
override val size: Float,
|
override val size: Float,
|
||||||
override val distance: Float = DEFAULT_DISTANCE
|
override val distance: Float = DEFAULT_DISTANCE
|
||||||
|
@@ -15,12 +15,12 @@ class MovingSoundSpatialDash(private val entity: EntityProjectileSpatialDash) :
|
|||||||
|
|
||||||
override fun tick(){
|
override fun tick(){
|
||||||
if (!entity.isAlive){
|
if (!entity.isAlive){
|
||||||
donePlaying = true
|
finishPlaying()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
x = entity.posX.toFloat()
|
x = entity.posX
|
||||||
y = entity.posY.toFloat()
|
y = entity.posY
|
||||||
z = entity.posZ.toFloat()
|
z = entity.posZ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ object CommandDebugTerritory : ICommand{
|
|||||||
val instance = TerritoryInstance.fromPos(pos)
|
val instance = TerritoryInstance.fromPos(pos)
|
||||||
val seed = if (hasSeedArg) ctx.getLong("seed") else null
|
val seed = if (hasSeedArg) ctx.getLong("seed") else null
|
||||||
|
|
||||||
if (world.dimension.type !== HEE.dim){
|
if (world.dimensionKey !== HEE.dim){
|
||||||
sendFeedback(StringTextComponent("Invalid dimension."), false)
|
sendFeedback(StringTextComponent("Invalid dimension."), false)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,7 @@ import com.mojang.brigadier.context.CommandContext
|
|||||||
import net.minecraft.command.CommandException
|
import net.minecraft.command.CommandException
|
||||||
import net.minecraft.command.CommandSource
|
import net.minecraft.command.CommandSource
|
||||||
import net.minecraft.command.Commands.argument
|
import net.minecraft.command.Commands.argument
|
||||||
|
import net.minecraft.util.text.IFormattableTextComponent
|
||||||
import net.minecraft.util.text.ITextComponent
|
import net.minecraft.util.text.ITextComponent
|
||||||
import net.minecraft.util.text.StringTextComponent
|
import net.minecraft.util.text.StringTextComponent
|
||||||
import net.minecraft.util.text.TextFormatting.DARK_GREEN
|
import net.minecraft.util.text.TextFormatting.DARK_GREEN
|
||||||
@@ -85,7 +86,7 @@ object CommandServerHelp : ICommand, CommandExecutionFunctionCtx<Boolean>{
|
|||||||
|
|
||||||
send(source, emptyLine)
|
send(source, emptyLine)
|
||||||
send(source, TranslationTextComponent(headerKey, currentPage, totalPages).also {
|
send(source, TranslationTextComponent(headerKey, currentPage, totalPages).also {
|
||||||
it.style.color = GREEN // required to set a custom color on tokens
|
it.style.setFormatting(GREEN) // required to set a custom color on tokens
|
||||||
})
|
})
|
||||||
send(source, emptyLine)
|
send(source, emptyLine)
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ object CommandServerHelp : ICommand, CommandExecutionFunctionCtx<Boolean>{
|
|||||||
send(source, chainTextComponents(
|
send(source, chainTextComponents(
|
||||||
StringTextComponent(" "),
|
StringTextComponent(" "),
|
||||||
TranslationTextComponent("commands.hee.${name}.info").also {
|
TranslationTextComponent("commands.hee.${name}.info").also {
|
||||||
it.style.color = GRAY
|
it.style.setFormatting(GRAY)
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -113,7 +114,7 @@ object CommandServerHelp : ICommand, CommandExecutionFunctionCtx<Boolean>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun sendInteractiveNavigation(source: CommandSource, currentPage: Int, totalPages: Int?){
|
private fun sendInteractiveNavigation(source: CommandSource, currentPage: Int, totalPages: Int?){
|
||||||
val components = mutableListOf<ITextComponent>()
|
val components = mutableListOf<IFormattableTextComponent>()
|
||||||
|
|
||||||
if (totalPages == null){
|
if (totalPages == null){
|
||||||
components.add(TranslationTextComponent("commands.hee.help.footer.admin").also {
|
components.add(TranslationTextComponent("commands.hee.help.footer.admin").also {
|
||||||
@@ -151,15 +152,15 @@ object CommandServerHelp : ICommand, CommandExecutionFunctionCtx<Boolean>{
|
|||||||
|
|
||||||
if (page != null){
|
if (page != null){
|
||||||
style.clickEvent = ClickEvent(RUN_COMMAND, "/${ModCommands.ROOT} help $page")
|
style.clickEvent = ClickEvent(RUN_COMMAND, "/${ModCommands.ROOT} help $page")
|
||||||
style.color = GREEN
|
style.setFormatting(GREEN)
|
||||||
style.underlined = true
|
style.setUnderlined(true)
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
style.color = DARK_GREEN
|
style.setFormatting(DARK_GREEN)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun chainTextComponents(vararg components: ITextComponent): ITextComponent{
|
private fun chainTextComponents(vararg components: IFormattableTextComponent): ITextComponent{
|
||||||
return components.reduce(ITextComponent::appendSibling)
|
return components.reduce(IFormattableTextComponent::append)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@ import net.minecraft.command.Commands.literal
|
|||||||
import net.minecraft.command.arguments.BlockPosArgument.blockPos
|
import net.minecraft.command.arguments.BlockPosArgument.blockPos
|
||||||
import net.minecraft.command.arguments.ResourceLocationArgument.getResourceLocation
|
import net.minecraft.command.arguments.ResourceLocationArgument.getResourceLocation
|
||||||
import net.minecraft.command.arguments.ResourceLocationArgument.resourceLocation
|
import net.minecraft.command.arguments.ResourceLocationArgument.resourceLocation
|
||||||
import net.minecraft.world.storage.loot.LootTable
|
import net.minecraft.loot.LootTable
|
||||||
|
|
||||||
object CommandServerLootChest : ICommand{
|
object CommandServerLootChest : ICommand{
|
||||||
override val name = "lootchest"
|
override val name = "lootchest"
|
||||||
|
@@ -16,11 +16,9 @@ import chylex.hee.system.serialization.getLongOrNull
|
|||||||
import chylex.hee.system.serialization.getOrCreateCompound
|
import chylex.hee.system.serialization.getOrCreateCompound
|
||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.material.Material
|
import net.minecraft.block.material.Material
|
||||||
import net.minecraft.block.material.MaterialColor
|
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.IBlockReader
|
|
||||||
import net.minecraft.world.IWorldReader
|
import net.minecraft.world.IWorldReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
|
||||||
@@ -98,12 +96,8 @@ abstract class BlockAbstractGoo(
|
|||||||
abstract fun onInsideGoo(entity: Entity)
|
abstract fun onInsideGoo(entity: Entity)
|
||||||
abstract fun modifyMotion(entity: Entity, level: Int)
|
abstract fun modifyMotion(entity: Entity, level: Int)
|
||||||
|
|
||||||
override fun getMaterialColor(state: BlockState, world: IBlockReader, pos: BlockPos): MaterialColor{
|
|
||||||
return fluid.mapColor
|
|
||||||
}
|
|
||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
override fun getFogColor(state: BlockState, world: IWorldReader, pos: BlockPos, entity: Entity, originalColor: Vec3d, partialTicks: Float): Vec3d{
|
override fun getFogColor(state: BlockState, world: IWorldReader, pos: BlockPos, entity: Entity, originalColor: Vector3d, partialTicks: Float): Vector3d{
|
||||||
return fluid.fogColor
|
return fluid.fogColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ import chylex.hee.system.migration.ItemSword
|
|||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.util.math.shapes.ISelectionContext
|
import net.minecraft.util.math.shapes.ISelectionContext
|
||||||
import net.minecraft.util.math.shapes.VoxelShape
|
import net.minecraft.util.math.shapes.VoxelShape
|
||||||
import net.minecraft.util.math.shapes.VoxelShapes
|
import net.minecraft.util.math.shapes.VoxelShapes
|
||||||
@@ -52,7 +52,7 @@ class BlockAncientCobweb(builder: BlockBuilder) : BlockWeb(builder.p), IBlockLay
|
|||||||
|
|
||||||
override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity){
|
override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity){
|
||||||
if (entity is EntityItem){
|
if (entity is EntityItem){
|
||||||
entity.setMotionMultiplier(state, Vec3d(0.6, 0.6, 0.6))
|
entity.setMotionMultiplier(state, Vector3d(0.6, 0.6, 0.6))
|
||||||
}
|
}
|
||||||
else if (!world.isRemote){
|
else if (!world.isRemote){
|
||||||
val canBreak = when(entity){
|
val canBreak = when(entity){
|
||||||
|
@@ -40,7 +40,6 @@ import net.minecraft.entity.Entity
|
|||||||
import net.minecraft.state.StateContainer.Builder
|
import net.minecraft.state.StateContainer.Builder
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.IBlockReader
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.IWorldReader
|
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.server.ServerWorld
|
import net.minecraft.world.server.ServerWorld
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
@@ -123,10 +122,6 @@ class BlockCorruptedEnergy(builder: BlockBuilder) : BlockSimple(builder){
|
|||||||
|
|
||||||
// Tick handling
|
// Tick handling
|
||||||
|
|
||||||
override fun tickRate(world: IWorldReader): Int{
|
|
||||||
return MAX_TICK_RATE
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBlockAdded(state: BlockState, world: World, pos: BlockPos, oldState: BlockState, isMoving: Boolean){
|
override fun onBlockAdded(state: BlockState, world: World, pos: BlockPos, oldState: BlockState, isMoving: Boolean){
|
||||||
world.pendingBlockTicks.scheduleTick(pos, this, tickRateForLevel(state[LEVEL]))
|
world.pendingBlockTicks.scheduleTick(pos, this, tickRateForLevel(state[LEVEL]))
|
||||||
}
|
}
|
||||||
|
@@ -9,14 +9,13 @@ import net.minecraft.block.Block
|
|||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.item.BlockItemUseContext
|
import net.minecraft.item.BlockItemUseContext
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.loot.LootContext
|
||||||
import net.minecraft.state.StateContainer.Builder
|
import net.minecraft.state.StateContainer.Builder
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.RayTraceResult
|
import net.minecraft.util.math.RayTraceResult
|
||||||
import net.minecraft.world.IBlockReader
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.IWorldReader
|
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.server.ServerWorld
|
import net.minecraft.world.server.ServerWorld
|
||||||
import net.minecraft.world.storage.loot.LootContext
|
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
|
|
||||||
class BlockDeathFlowerDecaying(builder: BlockBuilder) : BlockEndPlant(builder), IBlockDeathFlowerDecaying, IBlockLayerCutout{
|
class BlockDeathFlowerDecaying(builder: BlockBuilder) : BlockEndPlant(builder), IBlockDeathFlowerDecaying, IBlockLayerCutout{
|
||||||
@@ -33,10 +32,6 @@ class BlockDeathFlowerDecaying(builder: BlockBuilder) : BlockEndPlant(builder),
|
|||||||
override val witheredFlowerBlock
|
override val witheredFlowerBlock
|
||||||
get() = ModBlocks.DEATH_FLOWER_WITHERED
|
get() = ModBlocks.DEATH_FLOWER_WITHERED
|
||||||
|
|
||||||
override fun tickRate(world: IWorldReader): Int{
|
|
||||||
return implTickRate()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getStateForPlacement(context: BlockItemUseContext): BlockState{
|
override fun getStateForPlacement(context: BlockItemUseContext): BlockState{
|
||||||
return defaultState.with(LEVEL, ItemDeathFlower.getDeathLevel(context.item))
|
return defaultState.with(LEVEL, ItemDeathFlower.getDeathLevel(context.item))
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,7 @@ import net.minecraft.util.Hand
|
|||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.BlockRayTraceResult
|
import net.minecraft.util.math.BlockRayTraceResult
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.GameRules.DO_TILE_DROPS
|
import net.minecraft.world.GameRules.DO_TILE_DROPS
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.gen.Heightmap.Type.OCEAN_FLOOR
|
import net.minecraft.world.gen.Heightmap.Type.OCEAN_FLOOR
|
||||||
@@ -122,7 +122,7 @@ class BlockDragonEggOverride(builder: BlockBuilder) : BlockDragonEgg(builder.p){
|
|||||||
|
|
||||||
if (world.gameRules.getBoolean(DO_TILE_DROPS) && !world.restoringBlockSnapshots){
|
if (world.gameRules.getBoolean(DO_TILE_DROPS) && !world.restoringBlockSnapshots){
|
||||||
EntityItem(world, pos.x + 0.5, pos.y.toDouble(), pos.z + 0.5, ItemStack(this)).apply {
|
EntityItem(world, pos.x + 0.5, pos.y.toDouble(), pos.z + 0.5, ItemStack(this)).apply {
|
||||||
motion = Vec3d.ZERO
|
motion = Vector3d.ZERO
|
||||||
setDefaultPickupDelay()
|
setDefaultPickupDelay()
|
||||||
world.addEntity(this)
|
world.addEntity(this)
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@ import net.minecraft.block.BlockState
|
|||||||
import net.minecraft.client.renderer.color.IBlockColor
|
import net.minecraft.client.renderer.color.IBlockColor
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.FoliageColors
|
import net.minecraft.world.FoliageColors
|
||||||
import net.minecraft.world.ILightReader
|
import net.minecraft.world.IBlockDisplayReader
|
||||||
import net.minecraft.world.IWorldReader
|
import net.minecraft.world.IWorldReader
|
||||||
import net.minecraft.world.biome.BiomeColors
|
import net.minecraft.world.biome.BiomeColors
|
||||||
import net.minecraft.world.biome.Biomes
|
import net.minecraft.world.biome.Biomes
|
||||||
@@ -26,7 +26,7 @@ class BlockDryVines(builder: BlockBuilder) : BlockVine(builder.p), IBlockLayerCu
|
|||||||
override fun tick(state: BlockState, world: ServerWorld, pos: BlockPos, rand: Random){}
|
override fun tick(state: BlockState, world: ServerWorld, pos: BlockPos, rand: Random){}
|
||||||
|
|
||||||
override fun isLadder(state: BlockState, world: IWorldReader, pos: BlockPos, entity: EntityLivingBase): Boolean{
|
override fun isLadder(state: BlockState, world: IWorldReader, pos: BlockPos, entity: EntityLivingBase): Boolean{
|
||||||
return !entity.onGround
|
return !entity.isOnGround
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client side
|
// Client side
|
||||||
@@ -44,7 +44,7 @@ class BlockDryVines(builder: BlockBuilder) : BlockVine(builder.p), IBlockLayerCu
|
|||||||
).i
|
).i
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getColor(state: BlockState, uselessWorld: ILightReader?, pos: BlockPos?, tintIndex: Int): Int{
|
override fun getColor(state: BlockState, uselessWorld: IBlockDisplayReader?, pos: BlockPos?, tintIndex: Int): Int{
|
||||||
val world = MC.world
|
val world = MC.world
|
||||||
|
|
||||||
if (world == null || pos == null){
|
if (world == null || pos == null){
|
||||||
|
@@ -17,7 +17,6 @@ import net.minecraft.tileentity.TileEntity
|
|||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.IBlockReader
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.dimension.DimensionType
|
|
||||||
|
|
||||||
class BlockEndPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder){
|
class BlockEndPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder){
|
||||||
override fun createTileEntity(state: BlockState, world: IBlockReader): TileEntity{
|
override fun createTileEntity(state: BlockState, world: IBlockReader): TileEntity{
|
||||||
@@ -29,8 +28,8 @@ class BlockEndPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder){
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.dimension.type === HEE.dim){
|
if (world.dimensionKey === HEE.dim){
|
||||||
DimensionTeleporter.changeDimension(entity, DimensionType.OVERWORLD, DimensionTeleporter.LastEndPortal)
|
DimensionTeleporter.changeDimension(entity, World.OVERWORLD, DimensionTeleporter.LastEndPortal)
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
val acceptor = pos.closestTickingTile<TileEntityEndPortalAcceptor>(world, MAX_DISTANCE_FROM_FRAME)
|
val acceptor = pos.closestTickingTile<TileEntityEndPortalAcceptor>(world, MAX_DISTANCE_FROM_FRAME)
|
||||||
@@ -44,7 +43,7 @@ class BlockEndPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder){
|
|||||||
EnderCausatum.triggerStage(entity, CausatumStage.S2_ENTERED_END)
|
EnderCausatum.triggerStage(entity, CausatumStage.S2_ENTERED_END)
|
||||||
}
|
}
|
||||||
|
|
||||||
DimensionTeleporter.changeDimension(entity, DimensionType.THE_END, DimensionTeleporter.EndSpawnPortal)
|
DimensionTeleporter.changeDimension(entity, World.THE_END, DimensionTeleporter.EndSpawnPortal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,6 @@ import chylex.hee.system.migration.Potions
|
|||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.IWorldReader
|
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
@@ -110,10 +109,6 @@ open class BlockEnderGoo : BlockAbstractGoo(FluidEnderGoo, Materials.ENDER_GOO){
|
|||||||
|
|
||||||
// Behavior
|
// Behavior
|
||||||
|
|
||||||
override fun tickRate(world: IWorldReader): Int{
|
|
||||||
return 18
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onInsideGoo(entity: Entity){
|
override fun onInsideGoo(entity: Entity){
|
||||||
if (entity is EntityLivingBase && !CustomCreatureType.isEnder(entity)){
|
if (entity is EntityLivingBase && !CustomCreatureType.isEnder(entity)){
|
||||||
updateGooEffects(entity, trackTick(entity, MAX_COLLISION_TICK_COUNTER))
|
updateGooEffects(entity, trackTick(entity, MAX_COLLISION_TICK_COUNTER))
|
||||||
|
@@ -29,7 +29,6 @@ import net.minecraft.block.BlockState
|
|||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.potion.EffectType.HARMFUL
|
import net.minecraft.potion.EffectType.HARMFUL
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.IWorldReader
|
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
@@ -121,10 +120,6 @@ open class BlockEnderGooPurified : BlockAbstractGoo(FluidEnderGooPurified, Mater
|
|||||||
|
|
||||||
// Behavior
|
// Behavior
|
||||||
|
|
||||||
override fun tickRate(world: IWorldReader): Int{
|
|
||||||
return 16
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onInsideGoo(entity: Entity){
|
override fun onInsideGoo(entity: Entity){
|
||||||
if (entity is EntityLivingBase){
|
if (entity is EntityLivingBase){
|
||||||
updateGooEffects(entity, trackTick(entity, MAX_COLLISION_TICK_COUNTER))
|
updateGooEffects(entity, trackTick(entity, MAX_COLLISION_TICK_COUNTER))
|
||||||
|
@@ -19,7 +19,7 @@ import net.minecraft.block.BlockRenderType.INVISIBLE
|
|||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.client.particle.ParticleManager
|
import net.minecraft.client.particle.ParticleManager
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.IProjectile
|
import net.minecraft.entity.projectile.ProjectileEntity
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.util.math.AxisAlignedBB
|
import net.minecraft.util.math.AxisAlignedBB
|
||||||
@@ -99,7 +99,7 @@ class BlockEnergyCluster(builder: BlockBuilder) : BlockSimpleShaped(builder, Axi
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity){
|
override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity){
|
||||||
if (entity is IProjectile){
|
if (entity is ProjectileEntity){
|
||||||
pos.removeBlock(world)
|
pos.removeBlock(world)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,9 +33,8 @@ import net.minecraft.particles.ParticleTypes.LARGE_SMOKE
|
|||||||
import net.minecraft.util.Direction
|
import net.minecraft.util.Direction
|
||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.GameRules.DO_FIRE_TICK
|
import net.minecraft.world.GameRules.DO_FIRE_TICK
|
||||||
import net.minecraft.world.IWorldReader
|
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.server.ServerWorld
|
import net.minecraft.world.server.ServerWorld
|
||||||
import net.minecraftforge.common.MinecraftForge
|
import net.minecraftforge.common.MinecraftForge
|
||||||
@@ -53,7 +52,6 @@ class BlockEternalFire(builder: BlockBuilder) : BlockFire(builder.p), IBlockLaye
|
|||||||
MinecraftForge.EVENT_BUS.register(this)
|
MinecraftForge.EVENT_BUS.register(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun tickRate(world: IWorldReader) = super.tickRate(world) * 2
|
|
||||||
override fun canDie(world: World, pos: BlockPos) = false
|
override fun canDie(world: World, pos: BlockPos) = false
|
||||||
|
|
||||||
override fun tick(state: BlockState, world: ServerWorld, pos: BlockPos, rand: Random){
|
override fun tick(state: BlockState, world: ServerWorld, pos: BlockPos, rand: Random){
|
||||||
@@ -65,7 +63,7 @@ class BlockEternalFire(builder: BlockBuilder) : BlockFire(builder.p), IBlockLaye
|
|||||||
pos.removeBlock(world)
|
pos.removeBlock(world)
|
||||||
}
|
}
|
||||||
|
|
||||||
world.pendingBlockTicks.scheduleTick(pos, this, tickRate(world) + rand.nextInt(10))
|
world.pendingBlockTicks.scheduleTick(pos, this, (2 * (30 + rand.nextInt(10))) + rand.nextInt(10))
|
||||||
|
|
||||||
val baseChance = if (world.isBlockinHighHumidity(pos))
|
val baseChance = if (world.isBlockinHighHumidity(pos))
|
||||||
250
|
250
|
||||||
@@ -143,7 +141,7 @@ class BlockEternalFire(builder: BlockBuilder) : BlockFire(builder.p), IBlockLaye
|
|||||||
|
|
||||||
if (rand.nextInt(3) != 0){
|
if (rand.nextInt(3) != 0){
|
||||||
if (pos.down().isTopSolid(world)){
|
if (pos.down().isTopSolid(world)){
|
||||||
PARTICLE_SMOKE.spawn(Point(Vec3d(
|
PARTICLE_SMOKE.spawn(Point(Vector3d(
|
||||||
pos.x + rand.nextFloat(0.0, 1.0),
|
pos.x + rand.nextFloat(0.0, 1.0),
|
||||||
pos.y + rand.nextFloat(0.5, 1.0),
|
pos.y + rand.nextFloat(0.5, 1.0),
|
||||||
pos.z + rand.nextFloat(0.0, 1.0)
|
pos.z + rand.nextFloat(0.0, 1.0)
|
||||||
@@ -159,7 +157,7 @@ class BlockEternalFire(builder: BlockBuilder) : BlockFire(builder.p), IBlockLaye
|
|||||||
val offsetFacing = rand.nextFloat(0.4, 0.5)
|
val offsetFacing = rand.nextFloat(0.4, 0.5)
|
||||||
val offsetSide = rand.nextFloat(-0.5, 0.5)
|
val offsetSide = rand.nextFloat(-0.5, 0.5)
|
||||||
|
|
||||||
PARTICLE_SMOKE.spawn(Point(Vec3d(
|
PARTICLE_SMOKE.spawn(Point(Vector3d(
|
||||||
pos.x + 0.5 + (facing.xOffset * offsetFacing) + (perpendicular.xOffset * offsetSide),
|
pos.x + 0.5 + (facing.xOffset * offsetFacing) + (perpendicular.xOffset * offsetSide),
|
||||||
pos.y + rand.nextFloat(0.0, 1.0),
|
pos.y + rand.nextFloat(0.0, 1.0),
|
||||||
pos.z + 0.5 + (facing.zOffset * offsetFacing) + (perpendicular.zOffset * offsetSide)
|
pos.z + 0.5 + (facing.zOffset * offsetFacing) + (perpendicular.zOffset * offsetSide)
|
||||||
|
@@ -13,6 +13,7 @@ import net.minecraft.block.Block
|
|||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.Blocks
|
import net.minecraft.block.Blocks
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.loot.LootContext
|
||||||
import net.minecraft.state.StateContainer.Builder
|
import net.minecraft.state.StateContainer.Builder
|
||||||
import net.minecraft.util.ActionResultType
|
import net.minecraft.util.ActionResultType
|
||||||
import net.minecraft.util.ActionResultType.PASS
|
import net.minecraft.util.ActionResultType.PASS
|
||||||
@@ -22,10 +23,8 @@ import net.minecraft.util.math.BlockPos
|
|||||||
import net.minecraft.util.math.BlockRayTraceResult
|
import net.minecraft.util.math.BlockRayTraceResult
|
||||||
import net.minecraft.util.math.RayTraceResult
|
import net.minecraft.util.math.RayTraceResult
|
||||||
import net.minecraft.world.IBlockReader
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.IWorldReader
|
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.server.ServerWorld
|
import net.minecraft.world.server.ServerWorld
|
||||||
import net.minecraft.world.storage.loot.LootContext
|
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
|
|
||||||
class BlockFlowerPotDeathFlowerDecaying(
|
class BlockFlowerPotDeathFlowerDecaying(
|
||||||
@@ -45,12 +44,8 @@ class BlockFlowerPotDeathFlowerDecaying(
|
|||||||
override val witheredFlowerBlock
|
override val witheredFlowerBlock
|
||||||
get() = ModBlocks.POTTED_DEATH_FLOWER_WITHERED
|
get() = ModBlocks.POTTED_DEATH_FLOWER_WITHERED
|
||||||
|
|
||||||
override fun tickRate(world: IWorldReader): Int{
|
|
||||||
return implTickRate()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getDrop(state: BlockState): ItemStack{
|
private fun getDrop(state: BlockState): ItemStack{
|
||||||
return ItemStack(func_220276_d() /* RENAME getFlower */).also { ItemDeathFlower.setDeathLevel(it, state[LEVEL]) }
|
return ItemStack(flower).also { ItemDeathFlower.setDeathLevel(it, state[LEVEL]) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getDrops(state: BlockState, context: LootContext.Builder): MutableList<ItemStack>{
|
override fun getDrops(state: BlockState, context: LootContext.Builder): MutableList<ItemStack>{
|
||||||
|
@@ -25,6 +25,9 @@ import net.minecraft.block.Block
|
|||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.item.BlockItemUseContext
|
import net.minecraft.item.BlockItemUseContext
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.loot.LootContext
|
||||||
|
import net.minecraft.loot.LootParameterSets
|
||||||
|
import net.minecraft.loot.LootParameters
|
||||||
import net.minecraft.state.StateContainer.Builder
|
import net.minecraft.state.StateContainer.Builder
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.util.DamageSource
|
import net.minecraft.util.DamageSource
|
||||||
@@ -40,9 +43,6 @@ import net.minecraft.world.IBlockReader
|
|||||||
import net.minecraft.world.IWorld
|
import net.minecraft.world.IWorld
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.server.ServerWorld
|
import net.minecraft.world.server.ServerWorld
|
||||||
import net.minecraft.world.storage.loot.LootContext
|
|
||||||
import net.minecraft.world.storage.loot.LootParameterSets
|
|
||||||
import net.minecraft.world.storage.loot.LootParameters
|
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
|
|
||||||
open class BlockGraveDirt(builder: BlockBuilder) : BlockSimpleShaped(builder, AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 0.9375, 1.0)){
|
open class BlockGraveDirt(builder: BlockBuilder) : BlockSimpleShaped(builder, AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 0.9375, 1.0)){
|
||||||
@@ -98,7 +98,7 @@ open class BlockGraveDirt(builder: BlockBuilder) : BlockSimpleShaped(builder, Ax
|
|||||||
if (world is ServerWorld){
|
if (world is ServerWorld){
|
||||||
LootContext.Builder(world)
|
LootContext.Builder(world)
|
||||||
.withRandom(world.rand)
|
.withRandom(world.rand)
|
||||||
.withParameter(LootParameters.POSITION, pos)
|
.withParameter(LootParameters.field_237457_g_, pos)
|
||||||
.withParameter(LootParameters.EXPLOSION_RADIUS, explosion.size)
|
.withParameter(LootParameters.EXPLOSION_RADIUS, explosion.size)
|
||||||
.withParameter(LootParameters.TOOL, ItemStack.EMPTY)
|
.withParameter(LootParameters.TOOL, ItemStack.EMPTY)
|
||||||
.withNullableParameter(LootParameters.BLOCK_ENTITY, null)
|
.withNullableParameter(LootParameters.BLOCK_ENTITY, null)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package chylex.hee.game.block
|
package chylex.hee.game.block
|
||||||
import chylex.hee.game.block.properties.BlockBuilder
|
import chylex.hee.game.block.properties.BlockBuilder
|
||||||
import chylex.hee.game.inventory.size
|
|
||||||
import chylex.hee.game.world.breakBlock
|
import chylex.hee.game.world.breakBlock
|
||||||
|
import chylex.hee.game.world.center
|
||||||
import chylex.hee.game.world.getBlock
|
import chylex.hee.game.world.getBlock
|
||||||
import chylex.hee.game.world.getState
|
import chylex.hee.game.world.getState
|
||||||
import chylex.hee.system.forge.SubscribeEvent
|
import chylex.hee.system.forge.SubscribeEvent
|
||||||
@@ -15,14 +15,14 @@ import net.minecraft.block.Blocks
|
|||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
|
import net.minecraft.loot.LootContext
|
||||||
|
import net.minecraft.loot.LootParameters
|
||||||
import net.minecraft.util.Direction
|
import net.minecraft.util.Direction
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.Explosion
|
import net.minecraft.world.Explosion
|
||||||
import net.minecraft.world.IBlockReader
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.server.ServerWorld
|
import net.minecraft.world.server.ServerWorld
|
||||||
import net.minecraft.world.storage.loot.LootContext
|
|
||||||
import net.minecraft.world.storage.loot.LootParameters
|
|
||||||
import net.minecraftforge.common.ForgeHooks
|
import net.minecraftforge.common.ForgeHooks
|
||||||
import net.minecraftforge.common.IPlantable
|
import net.minecraftforge.common.IPlantable
|
||||||
import net.minecraftforge.common.MinecraftForge
|
import net.minecraftforge.common.MinecraftForge
|
||||||
@@ -101,7 +101,7 @@ class BlockHumus(builder: BlockBuilder, mergeBottom: Block) : BlockSimpleMerging
|
|||||||
if (world is ServerWorld){
|
if (world is ServerWorld){
|
||||||
LootContext.Builder(world)
|
LootContext.Builder(world)
|
||||||
.withRandom(world.rand)
|
.withRandom(world.rand)
|
||||||
.withParameter(LootParameters.POSITION, pos)
|
.withParameter(LootParameters.field_237457_g_, pos.center)
|
||||||
.withParameter(LootParameters.EXPLOSION_RADIUS, explosion.size)
|
.withParameter(LootParameters.EXPLOSION_RADIUS, explosion.size)
|
||||||
.withParameter(LootParameters.TOOL, ItemStack.EMPTY)
|
.withParameter(LootParameters.TOOL, ItemStack.EMPTY)
|
||||||
.withNullableParameter(LootParameters.BLOCK_ENTITY, null)
|
.withNullableParameter(LootParameters.BLOCK_ENTITY, null)
|
||||||
|
@@ -17,7 +17,7 @@ import chylex.hee.system.migration.ItemTool
|
|||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.enchantment.EnchantmentHelper
|
import net.minecraft.enchantment.EnchantmentHelper
|
||||||
import net.minecraft.enchantment.Enchantments
|
import net.minecraft.enchantment.Enchantments
|
||||||
import net.minecraft.fluid.IFluidState
|
import net.minecraft.fluid.FluidState
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.particles.ParticleTypes.LAVA
|
import net.minecraft.particles.ParticleTypes.LAVA
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
@@ -65,7 +65,7 @@ class BlockIgneousRockOre(builder: BlockBuilder) : BlockSimple(builder){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun removedByPlayer(state: BlockState, world: World, pos: BlockPos, player: EntityPlayer, willHarvest: Boolean, fluid: IFluidState): Boolean{
|
override fun removedByPlayer(state: BlockState, world: World, pos: BlockPos, player: EntityPlayer, willHarvest: Boolean, fluid: FluidState): Boolean{
|
||||||
val heldItem = player.getHeldItem(MAIN_HAND)
|
val heldItem = player.getHeldItem(MAIN_HAND)
|
||||||
|
|
||||||
if ((getToolHarvestLevel(heldItem) ?: 0) < super.getHarvestLevel(state) || EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, player.getHeldItem(MAIN_HAND)) == 0){
|
if ((getToolHarvestLevel(heldItem) ?: 0) < super.getHarvestLevel(state) || EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, player.getHeldItem(MAIN_HAND)) == 0){
|
||||||
|
@@ -18,8 +18,10 @@ import chylex.hee.system.migration.Sounds
|
|||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.Blocks
|
import net.minecraft.block.Blocks
|
||||||
import net.minecraft.fluid.IFluidState
|
import net.minecraft.fluid.FluidState
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.loot.LootContext
|
||||||
|
import net.minecraft.loot.LootParameters
|
||||||
import net.minecraft.state.StateContainer.Builder
|
import net.minecraft.state.StateContainer.Builder
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.util.Direction
|
import net.minecraft.util.Direction
|
||||||
@@ -31,8 +33,6 @@ import net.minecraft.world.Explosion
|
|||||||
import net.minecraft.world.IBlockReader
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.server.ServerWorld
|
import net.minecraft.world.server.ServerWorld
|
||||||
import net.minecraft.world.storage.loot.LootContext
|
|
||||||
import net.minecraft.world.storage.loot.LootParameters
|
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
|
|
||||||
class BlockInfusedTNT : BlockTNT(Properties.from(Blocks.TNT)), IBlockFireCatchOverride{
|
class BlockInfusedTNT : BlockTNT(Properties.from(Blocks.TNT)), IBlockFireCatchOverride{
|
||||||
@@ -94,7 +94,7 @@ class BlockInfusedTNT : BlockTNT(Properties.from(Blocks.TNT)), IBlockFireCatchOv
|
|||||||
super.onBlockAdded(state, world, pos, Blocks.AIR.defaultState, false)
|
super.onBlockAdded(state, world, pos, Blocks.AIR.defaultState, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun removedByPlayer(state: BlockState, world: World, pos: BlockPos, player: EntityPlayer, willHarvest: Boolean, fluid: IFluidState): Boolean{
|
override fun removedByPlayer(state: BlockState, world: World, pos: BlockPos, player: EntityPlayer, willHarvest: Boolean, fluid: FluidState): Boolean{
|
||||||
if (pos.getTile<TileEntityInfusedTNT>(world)?.infusions?.has(TRAP) == true && !player.isCreative){
|
if (pos.getTile<TileEntityInfusedTNT>(world)?.infusions?.has(TRAP) == true && !player.isCreative){
|
||||||
catchFire(state, world, pos, null, player)
|
catchFire(state, world, pos, null, player)
|
||||||
pos.removeBlock(world)
|
pos.removeBlock(world)
|
||||||
|
@@ -25,6 +25,8 @@ import net.minecraft.block.BlockState
|
|||||||
import net.minecraft.block.Blocks
|
import net.minecraft.block.Blocks
|
||||||
import net.minecraft.client.util.ITooltipFlag
|
import net.minecraft.client.util.ITooltipFlag
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.loot.LootContext
|
||||||
|
import net.minecraft.loot.LootParameters
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.util.ActionResultType
|
import net.minecraft.util.ActionResultType
|
||||||
import net.minecraft.util.ActionResultType.PASS
|
import net.minecraft.util.ActionResultType.PASS
|
||||||
@@ -43,8 +45,6 @@ import net.minecraft.world.IBlockReader
|
|||||||
import net.minecraft.world.IWorld
|
import net.minecraft.world.IWorld
|
||||||
import net.minecraft.world.IWorldReader
|
import net.minecraft.world.IWorldReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.storage.loot.LootContext
|
|
||||||
import net.minecraft.world.storage.loot.LootParameters
|
|
||||||
|
|
||||||
class BlockJarODust(builder: BlockBuilder) : BlockSimpleShaped(builder, AABB), IBlockLayerTranslucent{
|
class BlockJarODust(builder: BlockBuilder) : BlockSimpleShaped(builder, AABB), IBlockLayerTranslucent{
|
||||||
companion object{
|
companion object{
|
||||||
|
@@ -48,7 +48,7 @@ import net.minecraft.util.Direction
|
|||||||
import net.minecraft.util.IStringSerializable
|
import net.minecraft.util.IStringSerializable
|
||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.ILightReader
|
import net.minecraft.world.IBlockDisplayReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ sealed class BlockPuzzleLogic(builder: BlockBuilder) : BlockSimple(builder), IBl
|
|||||||
DISABLED -> DISABLED
|
DISABLED -> DISABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getName(): String{
|
override fun getString(): String{
|
||||||
return serializableName
|
return serializableName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,7 @@ sealed class BlockPuzzleLogic(builder: BlockBuilder) : BlockSimple(builder), IBl
|
|||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object Color : IBlockColor{
|
object Color : IBlockColor{
|
||||||
override fun getColor(state: BlockState, world: ILightReader?, pos: BlockPos?, tintIndex: Int): Int{
|
override fun getColor(state: BlockState, world: IBlockDisplayReader?, pos: BlockPos?, tintIndex: Int): Int{
|
||||||
if (tintIndex != 1){
|
if (tintIndex != 1){
|
||||||
return NO_TINT
|
return NO_TINT
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,8 @@ import net.minecraft.block.BlockState
|
|||||||
import net.minecraft.inventory.container.INamedContainerProvider
|
import net.minecraft.inventory.container.INamedContainerProvider
|
||||||
import net.minecraft.item.DyeColor
|
import net.minecraft.item.DyeColor
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.loot.LootContext.Builder
|
||||||
|
import net.minecraft.loot.LootParameters
|
||||||
import net.minecraft.tileentity.ShulkerBoxTileEntity.AnimationStatus.CLOSED
|
import net.minecraft.tileentity.ShulkerBoxTileEntity.AnimationStatus.CLOSED
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.util.ActionResultType
|
import net.minecraft.util.ActionResultType
|
||||||
@@ -25,8 +27,6 @@ import net.minecraft.util.math.shapes.VoxelShapes
|
|||||||
import net.minecraft.util.text.TranslationTextComponent
|
import net.minecraft.util.text.TranslationTextComponent
|
||||||
import net.minecraft.world.IBlockReader
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.storage.loot.LootContext.Builder
|
|
||||||
import net.minecraft.world.storage.loot.LootParameters
|
|
||||||
import java.util.stream.IntStream
|
import java.util.stream.IntStream
|
||||||
|
|
||||||
class BlockShulkerBoxOverride(properties: Properties, color: DyeColor?) : BlockShulkerBox(color, properties){
|
class BlockShulkerBoxOverride(properties: Properties, color: DyeColor?) : BlockShulkerBox(color, properties){
|
||||||
|
@@ -29,8 +29,8 @@ import net.minecraft.util.math.BlockRayTraceResult
|
|||||||
import net.minecraft.util.math.shapes.ISelectionContext
|
import net.minecraft.util.math.shapes.ISelectionContext
|
||||||
import net.minecraft.util.math.shapes.VoxelShape
|
import net.minecraft.util.math.shapes.VoxelShape
|
||||||
import net.minecraft.util.math.shapes.VoxelShapes
|
import net.minecraft.util.math.shapes.VoxelShapes
|
||||||
|
import net.minecraft.world.IBlockDisplayReader
|
||||||
import net.minecraft.world.IBlockReader
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.ILightReader
|
|
||||||
import net.minecraft.world.IWorld
|
import net.minecraft.world.IWorld
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
@@ -210,7 +210,7 @@ class BlockTablePedestal(builder: BlockBuilder) : BlockSimpleShaped(builder, COM
|
|||||||
|
|
||||||
@Sided(Side.CLIENT)
|
@Sided(Side.CLIENT)
|
||||||
object Color : IBlockColor{
|
object Color : IBlockColor{
|
||||||
override fun getColor(state: BlockState, world: ILightReader?, pos: BlockPos?, tintIndex: Int): Int{
|
override fun getColor(state: BlockState, world: IBlockDisplayReader?, pos: BlockPos?, tintIndex: Int): Int{
|
||||||
if (world == null || pos == null){
|
if (world == null || pos == null){
|
||||||
return NO_TINT
|
return NO_TINT
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ import chylex.hee.game.block.properties.BlockBuilder
|
|||||||
import chylex.hee.game.block.properties.Property
|
import chylex.hee.game.block.properties.Property
|
||||||
import chylex.hee.game.entity.Teleporter
|
import chylex.hee.game.entity.Teleporter
|
||||||
import chylex.hee.game.entity.Teleporter.FxRange.Silent
|
import chylex.hee.game.entity.Teleporter.FxRange.Silent
|
||||||
|
import chylex.hee.game.entity.dimensionKey
|
||||||
import chylex.hee.game.mechanics.causatum.EnderCausatum
|
import chylex.hee.game.mechanics.causatum.EnderCausatum
|
||||||
import chylex.hee.game.mechanics.portal.DimensionTeleporter
|
import chylex.hee.game.mechanics.portal.DimensionTeleporter
|
||||||
import chylex.hee.game.mechanics.portal.EntityPortalContact
|
import chylex.hee.game.mechanics.portal.EntityPortalContact
|
||||||
@@ -35,10 +36,9 @@ import net.minecraft.state.StateContainer.Builder
|
|||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.util.IStringSerializable
|
import net.minecraft.util.IStringSerializable
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.IBlockReader
|
import net.minecraft.world.IBlockReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.dimension.DimensionType
|
|
||||||
|
|
||||||
class BlockVoidPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder){
|
class BlockVoidPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder){
|
||||||
companion object{
|
companion object{
|
||||||
@@ -61,7 +61,7 @@ class BlockVoidPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder)
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
entity.setPositionAndUpdate(targetVec.x, targetVec.y, targetVec.z)
|
entity.setPositionAndUpdate(targetVec.x, targetVec.y, targetVec.z)
|
||||||
entity.motion = Vec3d.ZERO
|
entity.motion = Vector3d.ZERO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ class BlockVoidPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder)
|
|||||||
RETURN_ACTIVE("return_active"),
|
RETURN_ACTIVE("return_active"),
|
||||||
RETURN_INACTIVE("return_inactive");
|
RETURN_INACTIVE("return_inactive");
|
||||||
|
|
||||||
override fun getName(): String{
|
override fun getString(): String{
|
||||||
return serializableName
|
return serializableName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,14 +145,14 @@ class BlockVoidPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder)
|
|||||||
val info = pos.closestTickingTile<TileEntityVoidPortalStorage>(world, MAX_DISTANCE_FROM_FRAME)?.prepareSpawnPoint(entity)
|
val info = pos.closestTickingTile<TileEntityVoidPortalStorage>(world, MAX_DISTANCE_FROM_FRAME)?.prepareSpawnPoint(entity)
|
||||||
|
|
||||||
if (info != null){
|
if (info != null){
|
||||||
if (entity.dimension === HEE.dim){
|
if (entity.dimensionKey === HEE.dim){
|
||||||
DimensionTeleporter.LastHubPortal.updateForEntity(entity, null)
|
DimensionTeleporter.LastHubPortal.updateForEntity(entity, null)
|
||||||
updateSpawnPortal(entity, pos)
|
updateSpawnPortal(entity, pos)
|
||||||
teleportEntity(entity, info)
|
teleportEntity(entity, info)
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
DimensionTeleporter.LastHubPortal.updateForEntity(entity, pos)
|
DimensionTeleporter.LastHubPortal.updateForEntity(entity, pos)
|
||||||
DimensionTeleporter.changeDimension(entity, DimensionType.THE_END, DimensionTeleporter.EndTerritoryPortal(info))
|
DimensionTeleporter.changeDimension(entity, World.THE_END, DimensionTeleporter.EndTerritoryPortal(info))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
package chylex.hee.game.block
|
package chylex.hee.game.block
|
||||||
import chylex.hee.game.block.properties.BlockBuilder
|
import chylex.hee.game.block.properties.BlockBuilder
|
||||||
import chylex.hee.system.migration.BlockLog
|
import chylex.hee.system.migration.BlockRotatedPillar
|
||||||
|
|
||||||
class BlockWhitebarkLog(builder: BlockBuilder) : BlockLog(builder.color, builder.p)
|
class BlockWhitebarkLog(builder: BlockBuilder) : BlockRotatedPillar(builder.p)
|
||||||
|
@@ -75,15 +75,9 @@ interface IBlockDeathFlowerDecaying{
|
|||||||
PacketClientFX(FX_HEAL, FxHealData(pos, newDecayLevel)).sendToAllAround(world, pos, 64.0)
|
PacketClientFX(FX_HEAL, FxHealData(pos, newDecayLevel)).sendToAllAround(world, pos, 64.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmDefault
|
|
||||||
fun implTickRate(): Int{
|
|
||||||
return 1600
|
|
||||||
}
|
|
||||||
|
|
||||||
@JvmDefault
|
@JvmDefault
|
||||||
fun implOnBlockAdded(world: World, pos: BlockPos){
|
fun implOnBlockAdded(world: World, pos: BlockPos){
|
||||||
val tickRate = implTickRate()
|
world.pendingBlockTicks.scheduleTick(pos, thisAsBlock, world.rand.nextInt(TICK_RATE / 4, TICK_RATE))
|
||||||
world.pendingBlockTicks.scheduleTick(pos, thisAsBlock, world.rand.nextInt(tickRate / 4, tickRate))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmDefault
|
@JvmDefault
|
||||||
@@ -92,7 +86,7 @@ interface IBlockDeathFlowerDecaying{
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
world.pendingBlockTicks.scheduleTick(pos, thisAsBlock, implTickRate())
|
world.pendingBlockTicks.scheduleTick(pos, thisAsBlock, TICK_RATE)
|
||||||
|
|
||||||
if (world.isPeaceful){
|
if (world.isPeaceful){
|
||||||
return
|
return
|
||||||
@@ -170,6 +164,7 @@ interface IBlockDeathFlowerDecaying{
|
|||||||
|
|
||||||
val LEVEL = Property.int("level", MIN_LEVEL..MAX_LEVEL)
|
val LEVEL = Property.int("level", MIN_LEVEL..MAX_LEVEL)
|
||||||
|
|
||||||
|
private const val TICK_RATE = 1600
|
||||||
private const val WITHER_FLOWER_RADIUS = 4
|
private const val WITHER_FLOWER_RADIUS = 4
|
||||||
private const val WITHER_PLAYER_RADIUS = 1024.0
|
private const val WITHER_PLAYER_RADIUS = 1024.0
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ import net.minecraft.item.ItemStack
|
|||||||
|
|
||||||
object DispenseEndermanHead : OptionalDispenseBehavior(){
|
object DispenseEndermanHead : OptionalDispenseBehavior(){
|
||||||
override fun dispenseStack(source: IBlockSource, stack: ItemStack): ItemStack{
|
override fun dispenseStack(source: IBlockSource, stack: ItemStack): ItemStack{
|
||||||
successful = ItemArmor.func_226626_a_(source, stack) // RENAME dispenseArmor
|
isSuccessful = ItemArmor.func_226626_a_(source, stack) // RENAME dispenseArmor
|
||||||
return stack
|
return stack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,12 +2,12 @@ package chylex.hee.game.block.dispenser
|
|||||||
import chylex.hee.game.entity.projectile.EntityProjectileExperienceBottle
|
import chylex.hee.game.entity.projectile.EntityProjectileExperienceBottle
|
||||||
import net.minecraft.dispenser.IPosition
|
import net.minecraft.dispenser.IPosition
|
||||||
import net.minecraft.dispenser.ProjectileDispenseBehavior
|
import net.minecraft.dispenser.ProjectileDispenseBehavior
|
||||||
import net.minecraft.entity.IProjectile
|
import net.minecraft.entity.projectile.ProjectileEntity
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
|
||||||
object DispenseExperienceBottle : ProjectileDispenseBehavior(){
|
object DispenseExperienceBottle : ProjectileDispenseBehavior(){
|
||||||
override fun getProjectileEntity(world: World, position: IPosition, stack: ItemStack): IProjectile{
|
override fun getProjectileEntity(world: World, position: IPosition, stack: ItemStack): ProjectileEntity{
|
||||||
return EntityProjectileExperienceBottle(world, position.x, position.y, position.z, stack)
|
return EntityProjectileExperienceBottle(world, position.x, position.y, position.z, stack)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ import net.minecraft.tileentity.ITickableTileEntity
|
|||||||
import net.minecraft.tileentity.TileEntityType
|
import net.minecraft.tileentity.TileEntityType
|
||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.math.AxisAlignedBB
|
import net.minecraft.util.math.AxisAlignedBB
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import java.util.WeakHashMap
|
import java.util.WeakHashMap
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
@@ -189,7 +189,7 @@ class TileEntityExperienceGate(type: TileEntityType<TileEntityExperienceGate>) :
|
|||||||
val newCharge = tokenHolder.currentCharge + (1F / 175F)
|
val newCharge = tokenHolder.currentCharge + (1F / 175F)
|
||||||
|
|
||||||
if (newCharge >= 1F){
|
if (newCharge >= 1F){
|
||||||
tokenHolder.forceDropToken(Vec3d.ZERO)
|
tokenHolder.forceDropToken(Vector3d.ZERO)
|
||||||
tokenHolder.currentCharge = 0F
|
tokenHolder.currentCharge = 0F
|
||||||
experience = 0F
|
experience = 0F
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,7 @@ import chylex.hee.system.serialization.use
|
|||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.tileentity.TileEntityType
|
import net.minecraft.tileentity.TileEntityType
|
||||||
import net.minecraft.util.Direction
|
import net.minecraft.util.Direction
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
@@ -105,7 +105,7 @@ class TileEntityIgneousPlate(type: TileEntityType<TileEntityIgneousPlate>) : Til
|
|||||||
val rand = wrld.rand
|
val rand = wrld.rand
|
||||||
|
|
||||||
EntityItemFreshlyCooked(wrld, pos.center, ItemStack(ModBlocks.IGNEOUS_PLATE)).apply {
|
EntityItemFreshlyCooked(wrld, pos.center, ItemStack(ModBlocks.IGNEOUS_PLATE)).apply {
|
||||||
motion = Vec3d(facing.directionVec).scale(rand.nextFloat(2.5, 3.0)).add(rand.nextFloat(-0.2, 0.2), rand.nextFloat(0.1, 0.2), rand.nextFloat(-0.2, 0.2))
|
motion = Vector3d(facing.directionVec).scale(rand.nextFloat(2.5, 3.0)).add(rand.nextFloat(-0.2, 0.2), rand.nextFloat(0.1, 0.2), rand.nextFloat(-0.2, 0.2))
|
||||||
wrld.addEntity(this)
|
wrld.addEntity(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@ import chylex.hee.game.block.entity.base.TileEntityBaseChest
|
|||||||
import chylex.hee.game.container.ContainerLootChest
|
import chylex.hee.game.container.ContainerLootChest
|
||||||
import chylex.hee.game.inventory.nonEmptySlots
|
import chylex.hee.game.inventory.nonEmptySlots
|
||||||
import chylex.hee.game.inventory.setStack
|
import chylex.hee.game.inventory.setStack
|
||||||
|
import chylex.hee.game.world.center
|
||||||
import chylex.hee.game.world.playServer
|
import chylex.hee.game.world.playServer
|
||||||
import chylex.hee.init.ModSounds
|
import chylex.hee.init.ModSounds
|
||||||
import chylex.hee.init.ModTileEntities
|
import chylex.hee.init.ModTileEntities
|
||||||
@@ -20,6 +21,9 @@ import net.minecraft.entity.player.PlayerInventory
|
|||||||
import net.minecraft.inventory.IInventory
|
import net.minecraft.inventory.IInventory
|
||||||
import net.minecraft.inventory.Inventory
|
import net.minecraft.inventory.Inventory
|
||||||
import net.minecraft.inventory.container.Container
|
import net.minecraft.inventory.container.Container
|
||||||
|
import net.minecraft.loot.LootContext
|
||||||
|
import net.minecraft.loot.LootParameterSets
|
||||||
|
import net.minecraft.loot.LootParameters
|
||||||
import net.minecraft.tileentity.TileEntityType
|
import net.minecraft.tileentity.TileEntityType
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
@@ -27,9 +31,6 @@ import net.minecraft.util.SoundEvent
|
|||||||
import net.minecraft.util.text.ITextComponent
|
import net.minecraft.util.text.ITextComponent
|
||||||
import net.minecraft.util.text.TranslationTextComponent
|
import net.minecraft.util.text.TranslationTextComponent
|
||||||
import net.minecraft.world.server.ServerWorld
|
import net.minecraft.world.server.ServerWorld
|
||||||
import net.minecraft.world.storage.loot.LootContext
|
|
||||||
import net.minecraft.world.storage.loot.LootParameterSets
|
|
||||||
import net.minecraft.world.storage.loot.LootParameters
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
class TileEntityLootChest(type: TileEntityType<TileEntityLootChest>) : TileEntityBaseChest(type){
|
class TileEntityLootChest(type: TileEntityType<TileEntityLootChest>) : TileEntityBaseChest(type){
|
||||||
@@ -109,7 +110,7 @@ class TileEntityLootChest(type: TileEntityType<TileEntityLootChest>) : TileEntit
|
|||||||
val world = wrld as ServerWorld
|
val world = wrld as ServerWorld
|
||||||
val lootContext = LootContext.Builder(world)
|
val lootContext = LootContext.Builder(world)
|
||||||
.withRandom(world.rand)
|
.withRandom(world.rand)
|
||||||
.withParameter(LootParameters.POSITION, pos)
|
.withParameter(LootParameters.field_237457_g_, pos.center)
|
||||||
.withParameter(LootParameters.THIS_ENTITY, player)
|
.withParameter(LootParameters.THIS_ENTITY, player)
|
||||||
.withLuck(player.luck)
|
.withLuck(player.luck)
|
||||||
.build(LootParameterSets.CHEST)
|
.build(LootParameterSets.CHEST)
|
||||||
|
@@ -53,7 +53,7 @@ import net.minecraft.tileentity.ITickableTileEntity
|
|||||||
import net.minecraft.tileentity.TileEntityType
|
import net.minecraft.tileentity.TileEntityType
|
||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.math.AxisAlignedBB
|
import net.minecraft.util.math.AxisAlignedBB
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
@@ -110,7 +110,7 @@ class TileEntityMinersBurialAltar(type: TileEntityType<TileEntityMinersBurialAlt
|
|||||||
pos = InBox(0.175F)
|
pos = InBox(0.175F)
|
||||||
)
|
)
|
||||||
|
|
||||||
class FxSpawnData(private val pos: Vec3d, private val type: Byte) : IFxData{
|
class FxSpawnData(private val pos: Vector3d, private val type: Byte) : IFxData{
|
||||||
override fun write(buffer: PacketBuffer) = buffer.use {
|
override fun write(buffer: PacketBuffer) = buffer.use {
|
||||||
writeCompactVec(pos)
|
writeCompactVec(pos)
|
||||||
writeByte(type.toInt())
|
writeByte(type.toInt())
|
||||||
@@ -231,7 +231,7 @@ class TileEntityMinersBurialAltar(type: TileEntityType<TileEntityMinersBurialAlt
|
|||||||
|
|
||||||
if (tick == 0){
|
if (tick == 0){
|
||||||
if (tokenHolder == null){
|
if (tokenHolder == null){
|
||||||
val fxPos = Vec3d(tokenHolderPos.x + 0.5, tokenHolderPos.y + 0.95, tokenHolderPos.z + 0.5)
|
val fxPos = Vector3d(tokenHolderPos.x + 0.5, tokenHolderPos.y + 0.95, tokenHolderPos.z + 0.5)
|
||||||
PacketClientFX(FX_SPAWN, FxSpawnData(fxPos, redeemType)).sendToAllAround(wrld, fxPos, 16.0)
|
PacketClientFX(FX_SPAWN, FxSpawnData(fxPos, redeemType)).sendToAllAround(wrld, fxPos, 16.0)
|
||||||
|
|
||||||
EntityTokenHolder(wrld, tokenHolderPos, TokenType.NORMAL, TerritoryType.CURSED_LIBRARY).apply {
|
EntityTokenHolder(wrld, tokenHolderPos, TokenType.NORMAL, TerritoryType.CURSED_LIBRARY).apply {
|
||||||
|
@@ -145,7 +145,7 @@ abstract class TileEntityBaseChest(type: TileEntityType<out TileEntityBaseChest>
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun readNBT(nbt: TagCompound, context: Context) = nbt.use {
|
override fun readNBT(nbt: TagCompound, context: Context) = nbt.use {
|
||||||
customName = getStringOrNull(CUSTOM_NAME_TAG)?.let(ITextComponent.Serializer::fromJson)
|
customName = getStringOrNull(CUSTOM_NAME_TAG)?.let(ITextComponent.Serializer::getComponentFromJson)
|
||||||
|
|
||||||
if (context == NETWORK){
|
if (context == NETWORK){
|
||||||
viewerCount = getShort(VIEWER_COUNT_TAG).toInt()
|
viewerCount = getShort(VIEWER_COUNT_TAG).toInt()
|
||||||
|
@@ -28,10 +28,10 @@ import chylex.hee.system.serialization.getPosOrNull
|
|||||||
import chylex.hee.system.serialization.putPos
|
import chylex.hee.system.serialization.putPos
|
||||||
import chylex.hee.system.serialization.use
|
import chylex.hee.system.serialization.use
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.FLYING_SPEED
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MOVEMENT_SPEED
|
|
||||||
import net.minecraft.entity.ai.attributes.AttributeModifier
|
import net.minecraft.entity.ai.attributes.AttributeModifier
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.FLYING_SPEED
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.MOVEMENT_SPEED
|
||||||
import net.minecraft.tileentity.TileEntityType
|
import net.minecraft.tileentity.TileEntityType
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraftforge.event.entity.living.LivingDropsEvent
|
import net.minecraftforge.event.entity.living.LivingDropsEvent
|
||||||
@@ -48,8 +48,8 @@ abstract class TileEntityBaseSpawner(type: TileEntityType<out TileEntityBaseSpaw
|
|||||||
private const val NEXT_SPAWN_COOLDOWN_TAG = "NextSpawnCooldown"
|
private const val NEXT_SPAWN_COOLDOWN_TAG = "NextSpawnCooldown"
|
||||||
|
|
||||||
private const val ENTITY_TAINTED_TAG = "Tainted"
|
private const val ENTITY_TAINTED_TAG = "Tainted"
|
||||||
private val BUFF_HEALTH = AttributeModifier(UUID.fromString("2A023243-1D08-4955-8056-C35959129CDF"), "Tainted health buff", 1.0, OPERATION_MUL_INCR_INDIVIDUAL).setSaved(true)
|
private val BUFF_HEALTH = AttributeModifier(UUID.fromString("2A023243-1D08-4955-8056-C35959129CDF"), "Tainted health buff", 1.0, OPERATION_MUL_INCR_INDIVIDUAL)
|
||||||
private val DEBUFF_SPEED = AttributeModifier(UUID.fromString("9BEF400C-05DD-49A7-91E1-036EF7B73766"), "Tainted speed debuff", -0.33, OPERATION_MUL_INCR_INDIVIDUAL).setSaved(true)
|
private val DEBUFF_SPEED = AttributeModifier(UUID.fromString("9BEF400C-05DD-49A7-91E1-036EF7B73766"), "Tainted speed debuff", -0.33, OPERATION_MUL_INCR_INDIVIDUAL)
|
||||||
|
|
||||||
private val PARTICLE_TAINT_COLOR = IRandomColor { RGB(nextInt(4, 40).toUByte()) }
|
private val PARTICLE_TAINT_COLOR = IRandomColor { RGB(nextInt(4, 40).toUByte()) }
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ abstract class TileEntityBaseSpawner(type: TileEntityType<out TileEntityBaseSpaw
|
|||||||
private var lastPos: BlockPos? = null
|
private var lastPos: BlockPos? = null
|
||||||
private var nextSpawnCooldown = 0
|
private var nextSpawnCooldown = 0
|
||||||
|
|
||||||
val clientEntity by lazy { createClientEntity() }
|
val clientEntity by lazy(::createClientEntity)
|
||||||
val clientRotation = LerpedFloat(0F)
|
val clientRotation = LerpedFloat(0F)
|
||||||
|
|
||||||
protected abstract val clientRotationSpeed: Float
|
protected abstract val clientRotationSpeed: Float
|
||||||
@@ -180,9 +180,9 @@ abstract class TileEntityBaseSpawner(type: TileEntityType<out TileEntityBaseSpaw
|
|||||||
protected fun spawnMob(entity: EntityLiving){
|
protected fun spawnMob(entity: EntityLiving){
|
||||||
if (isTainted){
|
if (isTainted){
|
||||||
entity.heeTag.putBoolean(ENTITY_TAINTED_TAG, true)
|
entity.heeTag.putBoolean(ENTITY_TAINTED_TAG, true)
|
||||||
entity.getAttribute(MAX_HEALTH)?.applyModifier(BUFF_HEALTH)
|
entity.getAttribute(MAX_HEALTH)?.applyPersistentModifier(BUFF_HEALTH)
|
||||||
entity.getAttribute(MOVEMENT_SPEED)?.applyModifier(DEBUFF_SPEED)
|
entity.getAttribute(MOVEMENT_SPEED)?.applyPersistentModifier(DEBUFF_SPEED)
|
||||||
entity.getAttribute(FLYING_SPEED)?.applyModifier(DEBUFF_SPEED)
|
entity.getAttribute(FLYING_SPEED)?.applyPersistentModifier(DEBUFF_SPEED)
|
||||||
entity.health = entity.maxHealth
|
entity.health = entity.maxHealth
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ object FluidEnderGoo : FluidBase(
|
|||||||
override fun props(properties: Properties): Properties = with(properties){
|
override fun props(properties: Properties): Properties = with(properties){
|
||||||
block { ModBlocks.ENDER_GOO }
|
block { ModBlocks.ENDER_GOO }
|
||||||
bucket { ModItems.ENDER_GOO_BUCKET }
|
bucket { ModItems.ENDER_GOO_BUCKET }
|
||||||
|
tickRate(18)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun constructFlowingFluid(properties: Properties) = FlowingFluid5(properties)
|
override fun constructFlowingFluid(properties: Properties) = FlowingFluid5(properties)
|
||||||
|
@@ -24,6 +24,7 @@ object FluidEnderGooPurified : FluidBase(
|
|||||||
override fun props(properties: Properties): Properties = with(properties){
|
override fun props(properties: Properties): Properties = with(properties){
|
||||||
block { ModBlocks.PURIFIED_ENDER_GOO }
|
block { ModBlocks.PURIFIED_ENDER_GOO }
|
||||||
bucket { ModItems.PURIFIED_ENDER_GOO_BUCKET }
|
bucket { ModItems.PURIFIED_ENDER_GOO_BUCKET }
|
||||||
|
tickRate(16)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun constructFlowingFluid(properties: Properties) = FlowingFluid5(properties)
|
override fun constructFlowingFluid(properties: Properties) = FlowingFluid5(properties)
|
||||||
|
@@ -2,5 +2,5 @@ package chylex.hee.game.block.properties
|
|||||||
import net.minecraftforge.common.PlantType
|
import net.minecraftforge.common.PlantType
|
||||||
|
|
||||||
object CustomPlantType{
|
object CustomPlantType{
|
||||||
val END: PlantType = PlantType.create("HEE_END")
|
val END: PlantType = PlantType.get("HEE_END")
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ import net.minecraft.network.PacketBuffer
|
|||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.SoundEvent
|
import net.minecraft.util.SoundEvent
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.common.MinecraftForge
|
import net.minecraftforge.common.MinecraftForge
|
||||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent
|
import net.minecraftforge.event.entity.living.EnderTeleportEvent
|
||||||
@@ -66,8 +66,8 @@ class Teleporter(
|
|||||||
private val PARTICLE_MOT = InBox(0.035F)
|
private val PARTICLE_MOT = InBox(0.035F)
|
||||||
|
|
||||||
class FxTeleportData(
|
class FxTeleportData(
|
||||||
private val startPoint: Vec3d,
|
private val startPoint: Vector3d,
|
||||||
private val endPoint: Vec3d,
|
private val endPoint: Vector3d,
|
||||||
private val width: Float,
|
private val width: Float,
|
||||||
private val height: Float,
|
private val height: Float,
|
||||||
private val soundEvent: SoundEvent,
|
private val soundEvent: SoundEvent,
|
||||||
@@ -145,7 +145,7 @@ class Teleporter(
|
|||||||
|
|
||||||
// Target
|
// Target
|
||||||
|
|
||||||
fun toLocation(entity: EntityLivingBase, position: Vec3d, soundCategory: SoundCategory = entity.soundCategory): Boolean{
|
fun toLocation(entity: EntityLivingBase, position: Vector3d, soundCategory: SoundCategory = entity.soundCategory): Boolean{
|
||||||
val event = EnderTeleportEvent(entity, position.x, position.y, position.z, damageDealt)
|
val event = EnderTeleportEvent(entity, position.x, position.y, position.z, damageDealt)
|
||||||
|
|
||||||
if (postEvent && MinecraftForge.EVENT_BUS.post(event)){
|
if (postEvent && MinecraftForge.EVENT_BUS.post(event)){
|
||||||
@@ -166,7 +166,7 @@ class Teleporter(
|
|||||||
|
|
||||||
val world = entity.world
|
val world = entity.world
|
||||||
val prevPos = entity.posVec
|
val prevPos = entity.posVec
|
||||||
val newPos = Vec3d(event.targetX, event.targetY, event.targetZ)
|
val newPos = Vector3d(event.targetX, event.targetY, event.targetZ)
|
||||||
|
|
||||||
PacketClientTeleportInstantly(entity, newPos).sendToTracking(entity)
|
PacketClientTeleportInstantly(entity, newPos).sendToTracking(entity)
|
||||||
entity.setPositionAndUpdate(newPos.x, newPos.y, newPos.z)
|
entity.setPositionAndUpdate(newPos.x, newPos.y, newPos.z)
|
||||||
@@ -222,14 +222,14 @@ class Teleporter(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun nearLocation(entity: EntityLivingBase, rand: Random, position: Vec3d, distance: ClosedFloatingPointRange<Double>, attempts: Int, soundCategory: SoundCategory = entity.soundCategory): Boolean{
|
fun nearLocation(entity: EntityLivingBase, rand: Random, position: Vector3d, distance: ClosedFloatingPointRange<Double>, attempts: Int, soundCategory: SoundCategory = entity.soundCategory): Boolean{
|
||||||
val world = entity.world
|
val world = entity.world
|
||||||
val originalPos = entity.posVec
|
val originalPos = entity.posVec
|
||||||
val originalBox = entity.boundingBox
|
val originalBox = entity.boundingBox
|
||||||
|
|
||||||
repeat(attempts){
|
repeat(attempts){
|
||||||
val randomPos = position.add(rand.nextVector(rand.nextFloat(distance)))
|
val randomPos = position.add(rand.nextVector(rand.nextFloat(distance)))
|
||||||
val newPos = Vec3d(randomPos.x, randomPos.y.floorToInt() + 0.01, randomPos.z)
|
val newPos = Vector3d(randomPos.x, randomPos.y.floorToInt() + 0.01, randomPos.z)
|
||||||
|
|
||||||
if (Pos(newPos).down().blocksMovement(world) && world.hasNoCollisions(entity, originalBox.offset(newPos.subtract(originalPos)))){
|
if (Pos(newPos).down().blocksMovement(world) && world.hasNoCollisions(entity, originalBox.offset(newPos.subtract(originalPos)))){
|
||||||
return toLocation(entity, newPos, soundCategory)
|
return toLocation(entity, newPos, soundCategory)
|
||||||
@@ -239,7 +239,7 @@ class Teleporter(
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun nearLocation(entity: EntityLivingBase, position: Vec3d, distance: ClosedFloatingPointRange<Double>, attempts: Int, soundCategory: SoundCategory = entity.soundCategory): Boolean{
|
fun nearLocation(entity: EntityLivingBase, position: Vector3d, distance: ClosedFloatingPointRange<Double>, attempts: Int, soundCategory: SoundCategory = entity.soundCategory): Boolean{
|
||||||
return nearLocation(entity, entity.rng, position, distance, attempts, soundCategory)
|
return nearLocation(entity, entity.rng, position, distance, attempts, soundCategory)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ import net.minecraft.network.IPacket
|
|||||||
import net.minecraft.network.PacketBuffer
|
import net.minecraft.network.PacketBuffer
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.GameRules.DO_ENTITY_DROPS
|
import net.minecraft.world.GameRules.DO_ENTITY_DROPS
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData
|
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData
|
||||||
@@ -52,7 +52,7 @@ open class EntityFallingBlockHeavy(type: EntityType<out EntityFallingBlockHeavy>
|
|||||||
prevPosX = x
|
prevPosX = x
|
||||||
prevPosY = y
|
prevPosY = y
|
||||||
prevPosZ = z
|
prevPosZ = z
|
||||||
motion = Vec3d.ZERO
|
motion = Vector3d.ZERO
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object{
|
companion object{
|
||||||
|
@@ -2,6 +2,7 @@ package chylex.hee.game.entity.item
|
|||||||
import chylex.hee.game.block.asVoxelShape
|
import chylex.hee.game.block.asVoxelShape
|
||||||
import chylex.hee.game.block.properties.BlockBuilder.Companion.INDESTRUCTIBLE_HARDNESS
|
import chylex.hee.game.block.properties.BlockBuilder.Companion.INDESTRUCTIBLE_HARDNESS
|
||||||
import chylex.hee.game.entity.motionY
|
import chylex.hee.game.entity.motionY
|
||||||
|
import chylex.hee.game.entity.posVec
|
||||||
import chylex.hee.game.item.ItemFlintAndInfernium
|
import chylex.hee.game.item.ItemFlintAndInfernium
|
||||||
import chylex.hee.game.item.infusion.Infusion.FIRE
|
import chylex.hee.game.item.infusion.Infusion.FIRE
|
||||||
import chylex.hee.game.item.infusion.Infusion.HARMLESS
|
import chylex.hee.game.item.infusion.Infusion.HARMLESS
|
||||||
@@ -40,24 +41,24 @@ import net.minecraft.inventory.Inventory
|
|||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
import net.minecraft.item.crafting.IRecipeType.SMELTING
|
import net.minecraft.item.crafting.IRecipeType.SMELTING
|
||||||
|
import net.minecraft.loot.LootContext
|
||||||
|
import net.minecraft.loot.LootParameterSets
|
||||||
|
import net.minecraft.loot.LootParameters
|
||||||
|
import net.minecraft.loot.LootTables
|
||||||
import net.minecraft.network.IPacket
|
import net.minecraft.network.IPacket
|
||||||
import net.minecraft.particles.ParticleTypes.SMOKE
|
import net.minecraft.particles.ParticleTypes.SMOKE
|
||||||
import net.minecraft.util.ReuseableStream
|
import net.minecraft.util.ReuseableStream
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
|
||||||
import net.minecraft.util.math.shapes.IBooleanFunction
|
import net.minecraft.util.math.shapes.IBooleanFunction
|
||||||
import net.minecraft.util.math.shapes.ISelectionContext
|
import net.minecraft.util.math.shapes.ISelectionContext
|
||||||
import net.minecraft.util.math.shapes.VoxelShapes
|
import net.minecraft.util.math.shapes.VoxelShapes
|
||||||
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.Explosion
|
import net.minecraft.world.Explosion
|
||||||
import net.minecraft.world.IWorldReader
|
import net.minecraft.world.IWorldReader
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.chunk.ChunkStatus
|
import net.minecraft.world.chunk.ChunkStatus
|
||||||
import net.minecraft.world.chunk.IChunk
|
import net.minecraft.world.chunk.IChunk
|
||||||
import net.minecraft.world.server.ServerWorld
|
import net.minecraft.world.server.ServerWorld
|
||||||
import net.minecraft.world.storage.loot.LootContext
|
|
||||||
import net.minecraft.world.storage.loot.LootParameterSets
|
|
||||||
import net.minecraft.world.storage.loot.LootParameters
|
|
||||||
import net.minecraft.world.storage.loot.LootTables
|
|
||||||
import net.minecraftforge.fml.network.NetworkHooks
|
import net.minecraftforge.fml.network.NetworkHooks
|
||||||
import java.util.stream.Stream
|
import java.util.stream.Stream
|
||||||
import kotlin.math.PI
|
import kotlin.math.PI
|
||||||
@@ -76,11 +77,11 @@ class EntityInfusedTNT : EntityTNTPrimed{
|
|||||||
|
|
||||||
// EntityItem construction
|
// EntityItem construction
|
||||||
|
|
||||||
private val constructRawItem: (World, Vec3d, ItemStack) -> EntityItem = { world, pos, stack ->
|
private val constructRawItem: (World, Vector3d, ItemStack) -> EntityItem = { world, pos, stack ->
|
||||||
EntityItem(world, pos.x, pos.y, pos.z, stack)
|
EntityItem(world, pos.x, pos.y, pos.z, stack)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val constructCookedItem: (World, Vec3d, ItemStack) -> EntityItem = { world, pos, stack ->
|
private val constructCookedItem: (World, Vector3d, ItemStack) -> EntityItem = { world, pos, stack ->
|
||||||
world.recipeManager.getRecipe(SMELTING, Inventory(stack), world).orElse(null).let {
|
world.recipeManager.getRecipe(SMELTING, Inventory(stack), world).orElse(null).let {
|
||||||
if (it == null)
|
if (it == null)
|
||||||
constructRawItem(world, pos, stack)
|
constructRawItem(world, pos, stack)
|
||||||
@@ -159,7 +160,7 @@ class EntityInfusedTNT : EntityTNTPrimed{
|
|||||||
|
|
||||||
// Phasing
|
// Phasing
|
||||||
|
|
||||||
override fun move(type: MoverType, by: Vec3d){
|
override fun move(type: MoverType, by: Vector3d){
|
||||||
val wasNoclip = noClip
|
val wasNoclip = noClip
|
||||||
|
|
||||||
noClip = false
|
noClip = false
|
||||||
@@ -176,7 +177,7 @@ class EntityInfusedTNT : EntityTNTPrimed{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAllowedMovement(motion: Vec3d): Vec3d{
|
override fun getAllowedMovement(motion: Vector3d): Vector3d{
|
||||||
if (infusions.has(PHASING)){
|
if (infusions.has(PHASING)){
|
||||||
if (motion.lengthSquared() == 0.0){
|
if (motion.lengthSquared() == 0.0){
|
||||||
return motion
|
return motion
|
||||||
@@ -295,7 +296,7 @@ class EntityInfusedTNT : EntityTNTPrimed{
|
|||||||
val lootTable = Environment.getLootTable(LootTables.GAMEPLAY_FISHING)
|
val lootTable = Environment.getLootTable(LootTables.GAMEPLAY_FISHING)
|
||||||
val lootContext = LootContext.Builder(world as ServerWorld)
|
val lootContext = LootContext.Builder(world as ServerWorld)
|
||||||
.withRandom(rand)
|
.withRandom(rand)
|
||||||
.withParameter(LootParameters.POSITION, position)
|
.withParameter(LootParameters.field_237457_g_, posVec)
|
||||||
.withParameter(LootParameters.TOOL, ItemStack(Items.FISHING_ROD))
|
.withParameter(LootParameters.TOOL, ItemStack(Items.FISHING_ROD))
|
||||||
.build(LootParameterSets.FISHING)
|
.build(LootParameterSets.FISHING)
|
||||||
|
|
||||||
@@ -310,7 +311,7 @@ class EntityInfusedTNT : EntityTNTPrimed{
|
|||||||
)
|
)
|
||||||
|
|
||||||
constructItemEntity(world, dropPos, droppedItem).apply {
|
constructItemEntity(world, dropPos, droppedItem).apply {
|
||||||
motion = Vec3d(
|
motion = Vector3d(
|
||||||
rand.nextFloat(-0.25, 0.25),
|
rand.nextFloat(-0.25, 0.25),
|
||||||
rand.nextFloat(1.0, 1.2),
|
rand.nextFloat(1.0, 1.2),
|
||||||
rand.nextFloat(-0.25, 0.25)
|
rand.nextFloat(-0.25, 0.25)
|
||||||
|
@@ -6,7 +6,7 @@ import net.minecraft.entity.Entity
|
|||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.network.IPacket
|
import net.minecraft.network.IPacket
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.fml.network.NetworkHooks
|
import net.minecraftforge.fml.network.NetworkHooks
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ abstract class EntityItemBase(type: EntityType<out EntityItemBase>, world: World
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("LeakingThis")
|
@Suppress("LeakingThis")
|
||||||
constructor(type: EntityType<out EntityItemBase>, world: World, pos: Vec3d, stack: ItemStack) : this(type, world){
|
constructor(type: EntityType<out EntityItemBase>, world: World, pos: Vector3d, stack: ItemStack) : this(type, world){
|
||||||
item = stack
|
item = stack
|
||||||
rotationYaw = rand.nextFloat(0F, 360F)
|
rotationYaw = rand.nextFloat(0F, 360F)
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ import net.minecraft.item.ItemStack
|
|||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.math.AxisAlignedBB
|
import net.minecraft.util.math.AxisAlignedBB
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
@@ -87,7 +87,7 @@ class EntityItemCauldronTrigger : EntityItemBase{
|
|||||||
pos.setBlock(world, Blocks.CAULDRON)
|
pos.setBlock(world, Blocks.CAULDRON)
|
||||||
|
|
||||||
EntityItem(world, pos.x + 0.5, pos.y + 0.4, pos.z + 0.5, ItemStack(ModItems.PURITY_EXTRACT)).apply {
|
EntityItem(world, pos.x + 0.5, pos.y + 0.4, pos.z + 0.5, ItemStack(ModItems.PURITY_EXTRACT)).apply {
|
||||||
motion = Vec3d.ZERO
|
motion = Vector3d.ZERO
|
||||||
setDefaultPickupDelay()
|
setDefaultPickupDelay()
|
||||||
world.addEntity(this)
|
world.addEntity(this)
|
||||||
}
|
}
|
||||||
|
@@ -11,14 +11,14 @@ import net.minecraft.entity.EntityType
|
|||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.network.PacketBuffer
|
import net.minecraft.network.PacketBuffer
|
||||||
import net.minecraft.particles.ParticleTypes.SMOKE
|
import net.minecraft.particles.ParticleTypes.SMOKE
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData
|
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData
|
||||||
|
|
||||||
class EntityItemFreshlyCooked : EntityItemBase, IEntityAdditionalSpawnData{
|
class EntityItemFreshlyCooked : EntityItemBase, IEntityAdditionalSpawnData{
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
constructor(type: EntityType<EntityItemFreshlyCooked>, world: World) : super(type, world)
|
constructor(type: EntityType<EntityItemFreshlyCooked>, world: World) : super(type, world)
|
||||||
constructor(world: World, pos: Vec3d, stack: ItemStack) : super(ModEntities.ITEM_FRESHLY_COOKED, world, pos, stack)
|
constructor(world: World, pos: Vector3d, stack: ItemStack) : super(ModEntities.ITEM_FRESHLY_COOKED, world, pos, stack)
|
||||||
|
|
||||||
private companion object{
|
private companion object{
|
||||||
private const val STOP_SMOKING_AFTER_TICKS = 20 * 90
|
private const val STOP_SMOKING_AFTER_TICKS = 20 * 90
|
||||||
|
@@ -83,7 +83,7 @@ import net.minecraft.util.Direction
|
|||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.SoundEvent
|
import net.minecraft.util.SoundEvent
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.server.ServerWorld
|
import net.minecraft.world.server.ServerWorld
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
@@ -146,7 +146,7 @@ class EntityItemIgneousRock : EntityItemNoBob{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var throwFacing = DOWN
|
private var throwFacing = DOWN
|
||||||
private var prevMotion = Vec3d.ZERO
|
private var prevMotion = Vector3d.ZERO
|
||||||
|
|
||||||
private val smeltingInventory = Inventory(1)
|
private val smeltingInventory = Inventory(1)
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ class EntityItemIgneousRock : EntityItemNoBob{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun move(type: MoverType, by: Vec3d){
|
override fun move(type: MoverType, by: Vector3d){
|
||||||
if (isInLava){
|
if (isInLava){
|
||||||
super.move(type, by.mul(0.2, 0.01, 0.2))
|
super.move(type, by.mul(0.2, 0.01, 0.2))
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,7 @@ import net.minecraft.network.datasync.DataSerializers
|
|||||||
import net.minecraft.util.DamageSource
|
import net.minecraft.util.DamageSource
|
||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData
|
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData
|
||||||
import net.minecraftforge.fml.network.NetworkHooks
|
import net.minecraftforge.fml.network.NetworkHooks
|
||||||
@@ -133,7 +133,7 @@ class EntityTokenHolder(type: EntityType<EntityTokenHolder>, world: World) : Ent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun forceDropToken(motion: Vec3d){
|
fun forceDropToken(motion: Vector3d){
|
||||||
val droppedToken = territoryType?.let { entityDropItem(ModItems.PORTAL_TOKEN.forTerritory(tokenType, it), (height * 0.5F) - 0.25F) }
|
val droppedToken = territoryType?.let { entityDropItem(ModItems.PORTAL_TOKEN.forTerritory(tokenType, it), (height * 0.5F) - 0.25F) }
|
||||||
|
|
||||||
if (droppedToken != null){
|
if (droppedToken != null){
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
package chylex.hee.game.entity.living
|
package chylex.hee.game.entity.living
|
||||||
import chylex.hee.game.entity.CustomCreatureType
|
import chylex.hee.game.entity.CustomCreatureType
|
||||||
import chylex.hee.game.entity.EntityData
|
import chylex.hee.game.entity.EntityData
|
||||||
|
import chylex.hee.game.entity.add
|
||||||
|
import chylex.hee.game.entity.extend
|
||||||
import chylex.hee.game.entity.living.behavior.EnderEyeAttack.KnockbackDash
|
import chylex.hee.game.entity.living.behavior.EnderEyeAttack.KnockbackDash
|
||||||
import chylex.hee.game.entity.living.behavior.EnderEyeAttack.Melee
|
import chylex.hee.game.entity.living.behavior.EnderEyeAttack.Melee
|
||||||
import chylex.hee.game.entity.living.behavior.EnderEyePhase
|
import chylex.hee.game.entity.living.behavior.EnderEyePhase
|
||||||
@@ -67,12 +69,14 @@ import net.minecraft.entity.Entity
|
|||||||
import net.minecraft.entity.EntitySize
|
import net.minecraft.entity.EntitySize
|
||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.ILivingEntityData
|
import net.minecraft.entity.ILivingEntityData
|
||||||
|
import net.minecraft.entity.MobEntity
|
||||||
import net.minecraft.entity.Pose
|
import net.minecraft.entity.Pose
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.ATTACK_DAMAGE
|
import net.minecraft.entity.ai.attributes.Attributes.ATTACK_DAMAGE
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.FLYING_SPEED
|
import net.minecraft.entity.ai.attributes.Attributes.FLYING_SPEED
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.FOLLOW_RANGE
|
import net.minecraft.entity.ai.attributes.Attributes.FOLLOW_RANGE
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
|
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
|
||||||
import net.minecraft.entity.SpawnReason
|
import net.minecraft.entity.SpawnReason
|
||||||
|
import net.minecraft.entity.ai.attributes.AttributeModifierMap.MutableAttribute
|
||||||
import net.minecraft.entity.ai.controller.BodyController
|
import net.minecraft.entity.ai.controller.BodyController
|
||||||
import net.minecraft.entity.monster.IMob
|
import net.minecraft.entity.monster.IMob
|
||||||
import net.minecraft.nbt.CompoundNBT
|
import net.minecraft.nbt.CompoundNBT
|
||||||
@@ -83,10 +87,11 @@ import net.minecraft.util.DamageSource
|
|||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.math.AxisAlignedBB
|
import net.minecraft.util.math.AxisAlignedBB
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.util.text.ITextComponent
|
import net.minecraft.util.text.ITextComponent
|
||||||
import net.minecraft.world.BossInfo
|
import net.minecraft.world.BossInfo
|
||||||
import net.minecraft.world.DifficultyInstance
|
import net.minecraft.world.DifficultyInstance
|
||||||
|
import net.minecraft.world.IServerWorld
|
||||||
import net.minecraft.world.IWorld
|
import net.minecraft.world.IWorld
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.server.ServerBossInfo
|
import net.minecraft.world.server.ServerBossInfo
|
||||||
@@ -145,6 +150,13 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
const val ARMS_ATTACK: Byte = 2
|
const val ARMS_ATTACK: Byte = 2
|
||||||
|
|
||||||
const val LASER_DISTANCE = 32.0
|
const val LASER_DISTANCE = 32.0
|
||||||
|
|
||||||
|
fun createAttributes() = MobEntity.func_233666_p_().extend {
|
||||||
|
add(MAX_HEALTH, 300.0)
|
||||||
|
add(ATTACK_DAMAGE, 4.0)
|
||||||
|
add(FLYING_SPEED, 0.093)
|
||||||
|
add(FOLLOW_RANGE, 16.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instance
|
// Instance
|
||||||
@@ -196,6 +208,8 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
|
|
||||||
health = maxHealth * 0.5F
|
health = maxHealth * 0.5F
|
||||||
bossInfo.percent = 0.5F
|
bossInfo.percent = 0.5F
|
||||||
|
|
||||||
|
experienceValue = 50
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun registerData(){
|
override fun registerData(){
|
||||||
@@ -208,22 +222,8 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
dataManager.register(DATA_ROTATE_TARGET_SPEED, DEFAULT_SLERP_ADJUSTMENT_SPEED)
|
dataManager.register(DATA_ROTATE_TARGET_SPEED, DEFAULT_SLERP_ADJUSTMENT_SPEED)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun registerAttributes(){
|
|
||||||
super.registerAttributes()
|
|
||||||
|
|
||||||
attributes.registerAttribute(ATTACK_DAMAGE)
|
|
||||||
attributes.registerAttribute(FLYING_SPEED)
|
|
||||||
|
|
||||||
getAttribute(MAX_HEALTH).baseValue = 300.0
|
|
||||||
getAttribute(ATTACK_DAMAGE).baseValue = 4.0
|
|
||||||
getAttribute(FLYING_SPEED).baseValue = 0.093
|
|
||||||
getAttribute(FOLLOW_RANGE).baseValue = 16.0
|
|
||||||
|
|
||||||
experienceValue = 50
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateDemonLevelAttributes(){
|
private fun updateDemonLevelAttributes(){
|
||||||
getAttribute(ATTACK_DAMAGE).baseValue = 4.0 * damageMultiplier
|
getAttribute(ATTACK_DAMAGE)!!.baseValue = 4.0 * damageMultiplier
|
||||||
experienceValue = (50 * experienceMultiplier).floorToInt()
|
experienceValue = (50 * experienceMultiplier).floorToInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,8 +281,8 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
else{
|
else{
|
||||||
val distanceFromTargetSq = getDistanceSq(currentTarget)
|
val distanceFromTargetSq = getDistanceSq(currentTarget)
|
||||||
|
|
||||||
if (distanceFromTargetSq > square(getAttribute(FOLLOW_RANGE).value * 0.75)){
|
if (distanceFromTargetSq > square(getAttributeValue(FOLLOW_RANGE) * 0.75)){
|
||||||
val closerRange = getAttribute(FOLLOW_RANGE).value * 0.375
|
val closerRange = getAttributeValue(FOLLOW_RANGE) * 0.375
|
||||||
val closerCandidate = rand.nextItemOrNull(world.selectVulnerableEntities.inRange<EntityPlayer>(posVec, closerRange).filter(::canEntityBeSeen))
|
val closerCandidate = rand.nextItemOrNull(world.selectVulnerableEntities.inRange<EntityPlayer>(posVec, closerRange).filter(::canEntityBeSeen))
|
||||||
|
|
||||||
if (closerCandidate != null){
|
if (closerCandidate != null){
|
||||||
@@ -318,7 +318,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
rotationYawHead = rotationYaw
|
rotationYawHead = rotationYaw
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onInitialSpawn(world: IWorld, difficulty: DifficultyInstance, reason: SpawnReason, data: ILivingEntityData?, nbt: CompoundNBT?): ILivingEntityData?{
|
override fun onInitialSpawn(world: IServerWorld, difficulty: DifficultyInstance, reason: SpawnReason, data: ILivingEntityData?, nbt: CompoundNBT?): ILivingEntityData?{
|
||||||
val yaw = ((rotationYaw + 45F).toInt() / 90) * 90F
|
val yaw = ((rotationYaw + 45F).toInt() / 90) * 90F
|
||||||
setPositionAndRotation(posX, posY, posZ, yaw, 0F)
|
setPositionAndRotation(posX, posY, posZ, yaw, 0F)
|
||||||
|
|
||||||
@@ -365,7 +365,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
|
|
||||||
setLocationAndAngles(pos.x + 0.5, pos.y.toDouble() + 2.5, pos.z + 0.5, yaw, 0F)
|
setLocationAndAngles(pos.x + 0.5, pos.y.toDouble() + 2.5, pos.z + 0.5, yaw, 0F)
|
||||||
rotationYawHead = yaw
|
rotationYawHead = yaw
|
||||||
motion = Vec3d.ZERO
|
motion = Vector3d.ZERO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +387,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
return attacker
|
return attacker
|
||||||
}
|
}
|
||||||
|
|
||||||
val range = getAttribute(FOLLOW_RANGE).value
|
val range = getAttributeValue(FOLLOW_RANGE)
|
||||||
val targets = world.selectVulnerableEntities.inRange<EntityPlayer>(posVec, range).filter(::canEntityBeSeen)
|
val targets = world.selectVulnerableEntities.inRange<EntityPlayer>(posVec, range).filter(::canEntityBeSeen)
|
||||||
|
|
||||||
return rng.nextItemOrNull(targets).also { attackTarget = it }
|
return rng.nextItemOrNull(targets).also { attackTarget = it }
|
||||||
@@ -411,7 +411,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
|
|
||||||
lastHitKnockbackMultiplier = attack.dealtKnockbackMultiplier
|
lastHitKnockbackMultiplier = attack.dealtKnockbackMultiplier
|
||||||
val type = attack.dealtDamageType
|
val type = attack.dealtDamageType
|
||||||
val amount = getAttribute(ATTACK_DAMAGE).value.toFloat() * attack.dealtDamageMultiplier
|
val amount = getAttributeValue(ATTACK_DAMAGE).toFloat() * attack.dealtDamageMultiplier
|
||||||
|
|
||||||
return type.dealToFrom(amount, entity, this)
|
return type.dealToFrom(amount, entity, this)
|
||||||
}
|
}
|
||||||
@@ -451,7 +451,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
val ratio = Vec3.fromXZ(target.posX, target.posZ).directionTowards(Vec3.fromXZ(posX, posZ)).scale(strength)
|
val ratio = Vec3.fromXZ(target.posX, target.posZ).directionTowards(Vec3.fromXZ(posX, posZ)).scale(strength)
|
||||||
|
|
||||||
if (target is EntityLivingBase){
|
if (target is EntityLivingBase){
|
||||||
target.knockBack(this, strength, ratio.x, ratio.z)
|
target.applyKnockback(strength, ratio.x, ratio.z)
|
||||||
|
|
||||||
if (target is EntityPlayer){
|
if (target is EntityPlayer){
|
||||||
PacketClientLaunchInstantly(target, target.motion).sendToPlayer(target)
|
PacketClientLaunchInstantly(target, target.motion).sendToPlayer(target)
|
||||||
@@ -462,7 +462,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLaserHit(partialTicks: Float): Vec3d{
|
fun getLaserHit(partialTicks: Float): Vector3d{
|
||||||
return entity.pick(LASER_DISTANCE, partialTicks, false).hitVec
|
return entity.pick(LASER_DISTANCE, partialTicks, false).hitVec
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,7 +496,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
return EntityBodyHeadOnly(this)
|
return EntityBodyHeadOnly(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun moveRelative(friction: Float, dir: Vec3d){
|
override fun moveRelative(friction: Float, dir: Vector3d){
|
||||||
super.moveRelative(EntityMoveFlyingForward.AIR_FRICTION, dir)
|
super.moveRelative(EntityMoveFlyingForward.AIR_FRICTION, dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,7 +519,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
super.addVelocity(x * KNOCKBACK_MP, y * KNOCKBACK_MP, z * KNOCKBACK_MP)
|
super.addVelocity(x * KNOCKBACK_MP, y * KNOCKBACK_MP, z * KNOCKBACK_MP)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun knockBack(entity: Entity, strength: Float, xRatio: Double, zRatio: Double){
|
override fun applyKnockback(strength: Float, ratioX: Double, ratioZ: Double){
|
||||||
val bossPhase = bossPhase
|
val bossPhase = bossPhase
|
||||||
|
|
||||||
if (isSleeping || bossPhase !is Attacking || !bossPhase.currentAttack.canTakeKnockback){
|
if (isSleeping || bossPhase !is Attacking || !bossPhase.currentAttack.canTakeKnockback){
|
||||||
@@ -527,13 +527,13 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bossPhase.currentAttack is Melee && rand.nextInt(knockbackDashChance) == 0 && lastKnockbackDashTime != world.totalTime){
|
if (bossPhase.currentAttack is Melee && rand.nextInt(knockbackDashChance) == 0 && lastKnockbackDashTime != world.totalTime){
|
||||||
super.knockBack(entity, strength * 1.4F, xRatio, zRatio)
|
super.applyKnockback(strength * 1.4F, ratioX, ratioZ)
|
||||||
bossPhase.currentAttack = KnockbackDash()
|
bossPhase.currentAttack = KnockbackDash()
|
||||||
knockbackDashChance = 7
|
knockbackDashChance = 7
|
||||||
lastKnockbackDashTime = world.totalTime
|
lastKnockbackDashTime = world.totalTime
|
||||||
}
|
}
|
||||||
else if (!ForgeHooks.onLivingKnockBack(this, entity, strength, xRatio, zRatio).isCanceled){
|
else if (!ForgeHooks.onLivingKnockBack(this, strength, ratioX, ratioZ).isCanceled){
|
||||||
motion = motion.add(Vec3.fromXZ(-xRatio, -zRatio).normalize().scale(KNOCKBACK_MP).withY(0.005))
|
motion = motion.add(Vec3.fromXZ(-ratioX, -ratioZ).normalize().scale(KNOCKBACK_MP).withY(0.005))
|
||||||
|
|
||||||
if (motionY > 0.05){
|
if (motionY > 0.05){
|
||||||
motionY = 0.05
|
motionY = 0.05
|
||||||
|
@@ -15,7 +15,7 @@ import net.minecraft.entity.Entity
|
|||||||
import net.minecraft.entity.EntitySize
|
import net.minecraft.entity.EntitySize
|
||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.Pose
|
import net.minecraft.entity.Pose
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MOVEMENT_SPEED
|
import net.minecraft.entity.ai.attributes.Attributes.MOVEMENT_SPEED
|
||||||
import net.minecraft.network.IPacket
|
import net.minecraft.network.IPacket
|
||||||
import net.minecraft.network.datasync.DataSerializers
|
import net.minecraft.network.datasync.DataSerializers
|
||||||
import net.minecraft.util.DamageSource
|
import net.minecraft.util.DamageSource
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
package chylex.hee.game.entity.living
|
package chylex.hee.game.entity.living
|
||||||
|
import chylex.hee.game.entity.add
|
||||||
|
import chylex.hee.game.entity.extend
|
||||||
import chylex.hee.game.entity.living.ai.AttackMelee
|
import chylex.hee.game.entity.living.ai.AttackMelee
|
||||||
import chylex.hee.game.entity.living.ai.Swim
|
import chylex.hee.game.entity.living.ai.Swim
|
||||||
import chylex.hee.game.entity.living.ai.TargetAttacker
|
import chylex.hee.game.entity.living.ai.TargetAttacker
|
||||||
@@ -13,36 +15,44 @@ import chylex.hee.init.ModEntities
|
|||||||
import chylex.hee.system.facades.Resource
|
import chylex.hee.system.facades.Resource
|
||||||
import chylex.hee.system.math.offsetTowards
|
import chylex.hee.system.math.offsetTowards
|
||||||
import chylex.hee.system.math.square
|
import chylex.hee.system.math.square
|
||||||
|
import chylex.hee.system.migration.EntityEnderman
|
||||||
import chylex.hee.system.migration.EntityPlayer
|
import chylex.hee.system.migration.EntityPlayer
|
||||||
import chylex.hee.system.serialization.TagCompound
|
import chylex.hee.system.serialization.TagCompound
|
||||||
import chylex.hee.system.serialization.heeTag
|
import chylex.hee.system.serialization.heeTag
|
||||||
import chylex.hee.system.serialization.use
|
import chylex.hee.system.serialization.use
|
||||||
import net.minecraft.entity.EntityPredicate
|
import net.minecraft.entity.EntityPredicate
|
||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.ATTACK_DAMAGE
|
import net.minecraft.entity.ai.attributes.Attributes.ATTACK_DAMAGE
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.FOLLOW_RANGE
|
import net.minecraft.entity.ai.attributes.Attributes.FOLLOW_RANGE
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
|
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MOVEMENT_SPEED
|
import net.minecraft.entity.ai.attributes.Attributes.MOVEMENT_SPEED
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.math.AxisAlignedBB
|
import net.minecraft.util.math.AxisAlignedBB
|
||||||
import net.minecraft.util.math.RayTraceContext
|
import net.minecraft.util.math.RayTraceContext
|
||||||
import net.minecraft.util.math.RayTraceContext.BlockMode
|
import net.minecraft.util.math.RayTraceContext.BlockMode
|
||||||
import net.minecraft.util.math.RayTraceContext.FluidMode
|
import net.minecraft.util.math.RayTraceContext.FluidMode
|
||||||
import net.minecraft.util.math.RayTraceResult.Type
|
import net.minecraft.util.math.RayTraceResult.Type
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.Difficulty.PEACEFUL
|
import net.minecraft.world.Difficulty.PEACEFUL
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
|
||||||
class EntityMobAngryEnderman(type: EntityType<EntityMobAngryEnderman>, world: World) : EntityMobAbstractEnderman(type, world){
|
class EntityMobAngryEnderman(type: EntityType<EntityMobAngryEnderman>, world: World) : EntityMobAbstractEnderman(type, world){
|
||||||
constructor(world: World) : this(ModEntities.ANGRY_ENDERMAN, world)
|
constructor(world: World) : this(ModEntities.ANGRY_ENDERMAN, world)
|
||||||
|
|
||||||
private companion object{
|
companion object{
|
||||||
private const val TELEPORT_HANDLER_TAG = "Teleport"
|
private const val TELEPORT_HANDLER_TAG = "Teleport"
|
||||||
private const val WATER_HANDLER_TAG = "Water"
|
private const val WATER_HANDLER_TAG = "Water"
|
||||||
private const val DESPAWN_COOLDOWN_TAG = "DespawnCooldown"
|
private const val DESPAWN_COOLDOWN_TAG = "DespawnCooldown"
|
||||||
|
|
||||||
private const val AGGRO_DISTANCE = 12
|
private const val AGGRO_DISTANCE = 12
|
||||||
private const val AGGRO_DISTANCE_SQ = AGGRO_DISTANCE * AGGRO_DISTANCE
|
private const val AGGRO_DISTANCE_SQ = AGGRO_DISTANCE * AGGRO_DISTANCE
|
||||||
|
|
||||||
|
fun createAttributes() = EntityEnderman.func_233666_p_().extend {
|
||||||
|
add(MAX_HEALTH, 40.0)
|
||||||
|
add(ATTACK_DAMAGE, 7.0)
|
||||||
|
add(MOVEMENT_SPEED, 0.315)
|
||||||
|
add(FOLLOW_RANGE, 32.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var teleportHandler: EndermanTeleportHandler
|
private lateinit var teleportHandler: EndermanTeleportHandler
|
||||||
@@ -51,14 +61,7 @@ class EntityMobAngryEnderman(type: EntityType<EntityMobAngryEnderman>, world: Wo
|
|||||||
override val teleportCooldown = 35
|
override val teleportCooldown = 35
|
||||||
private var despawnCooldown = 300
|
private var despawnCooldown = 300
|
||||||
|
|
||||||
override fun registerAttributes(){
|
init{
|
||||||
super.registerAttributes()
|
|
||||||
|
|
||||||
getAttribute(MAX_HEALTH).baseValue = 40.0
|
|
||||||
getAttribute(ATTACK_DAMAGE).baseValue = 7.0
|
|
||||||
getAttribute(MOVEMENT_SPEED).baseValue = 0.315
|
|
||||||
getAttribute(FOLLOW_RANGE).baseValue = 32.0
|
|
||||||
|
|
||||||
experienceValue = 7
|
experienceValue = 7
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +86,7 @@ class EntityMobAngryEnderman(type: EntityType<EntityMobAngryEnderman>, world: Wo
|
|||||||
if (currentTarget != null){
|
if (currentTarget != null){
|
||||||
val distanceSq = getDistanceSq(currentTarget)
|
val distanceSq = getDistanceSq(currentTarget)
|
||||||
|
|
||||||
if (distanceSq > square(getAttribute(FOLLOW_RANGE).value * 0.75) && !entitySenses.canSee(currentTarget)){
|
if (distanceSq > square(getAttributeValue(FOLLOW_RANGE) * 0.75) && !entitySenses.canSee(currentTarget)){
|
||||||
attackTarget = null
|
attackTarget = null
|
||||||
}
|
}
|
||||||
else if (distanceSq > AGGRO_DISTANCE_SQ){
|
else if (distanceSq > AGGRO_DISTANCE_SQ){
|
||||||
@@ -111,7 +114,7 @@ class EntityMobAngryEnderman(type: EntityType<EntityMobAngryEnderman>, world: Wo
|
|||||||
}
|
}
|
||||||
|
|
||||||
val currentTarget = attackTarget ?: return false
|
val currentTarget = attackTarget ?: return false
|
||||||
val teleportPos = Vec3d(offsetTowards(aabb.minX, aabb.maxX, 0.5), aabb.minY + eyeHeight.toDouble(), offsetTowards(aabb.minZ, aabb.maxZ, 0.5))
|
val teleportPos = Vector3d(offsetTowards(aabb.minX, aabb.maxX, 0.5), aabb.minY + eyeHeight.toDouble(), offsetTowards(aabb.minZ, aabb.maxZ, 0.5))
|
||||||
|
|
||||||
return world.rayTraceBlocks(RayTraceContext(teleportPos, currentTarget.lookPosVec, BlockMode.COLLIDER, FluidMode.NONE, this)).type == Type.MISS
|
return world.rayTraceBlocks(RayTraceContext(teleportPos, currentTarget.lookPosVec, BlockMode.COLLIDER, FluidMode.NONE, this)).type == Type.MISS
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package chylex.hee.game.entity.living
|
package chylex.hee.game.entity.living
|
||||||
import chylex.hee.game.entity.EntityData
|
import chylex.hee.game.entity.EntityData
|
||||||
|
import chylex.hee.game.entity.add
|
||||||
|
import chylex.hee.game.entity.extend
|
||||||
import chylex.hee.game.entity.living.ai.AIToggle
|
import chylex.hee.game.entity.living.ai.AIToggle
|
||||||
import chylex.hee.game.entity.living.ai.AIToggle.Companion.addGoal
|
import chylex.hee.game.entity.living.ai.AIToggle.Companion.addGoal
|
||||||
import chylex.hee.game.entity.living.ai.AIWatchDyingLeader
|
import chylex.hee.game.entity.living.ai.AIWatchDyingLeader
|
||||||
@@ -55,11 +57,11 @@ import net.minecraft.entity.EntitySize
|
|||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.ILivingEntityData
|
import net.minecraft.entity.ILivingEntityData
|
||||||
import net.minecraft.entity.Pose
|
import net.minecraft.entity.Pose
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.FOLLOW_RANGE
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MOVEMENT_SPEED
|
|
||||||
import net.minecraft.entity.SpawnReason
|
import net.minecraft.entity.SpawnReason
|
||||||
import net.minecraft.entity.SpawnReason.SPAWN_EGG
|
import net.minecraft.entity.SpawnReason.SPAWN_EGG
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.FOLLOW_RANGE
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.MOVEMENT_SPEED
|
||||||
import net.minecraft.entity.ai.controller.BodyController
|
import net.minecraft.entity.ai.controller.BodyController
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.item.UseAction.SPEAR
|
import net.minecraft.item.UseAction.SPEAR
|
||||||
@@ -75,8 +77,9 @@ import net.minecraft.util.Hand.OFF_HAND
|
|||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.util.SoundEvent
|
import net.minecraft.util.SoundEvent
|
||||||
import net.minecraft.world.DifficultyInstance
|
import net.minecraft.world.DifficultyInstance
|
||||||
import net.minecraft.world.IWorld
|
import net.minecraft.world.IServerWorld
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
import net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY
|
||||||
import net.minecraftforge.fml.network.NetworkHooks
|
import net.minecraftforge.fml.network.NetworkHooks
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
@@ -161,6 +164,13 @@ class EntityMobBlobby(type: EntityType<out EntityCreature>, world: World) : Enti
|
|||||||
it.jumpHeightMp = jumpHeightMp * rand.nextFloat(0.97F, 1.03F)
|
it.jumpHeightMp = jumpHeightMp * rand.nextFloat(0.97F, 1.03F)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun createAttributes() = EntityCreature.func_233666_p_().extend {
|
||||||
|
add(MAX_HEALTH, 8.0)
|
||||||
|
add(MOVEMENT_SPEED, 0.19)
|
||||||
|
add(FOLLOW_RANGE, 44.0)
|
||||||
|
add(ENTITY_GRAVITY.get(), ENTITY_GRAVITY.get().defaultValue * 0.725)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instance
|
// Instance
|
||||||
@@ -191,7 +201,7 @@ class EntityMobBlobby(type: EntityType<out EntityCreature>, world: World) : Enti
|
|||||||
private lateinit var aiLeaderDisabledToggle: AIToggle
|
private lateinit var aiLeaderDisabledToggle: AIToggle
|
||||||
|
|
||||||
private val isFollowRangeAreaLoaded
|
private val isFollowRangeAreaLoaded
|
||||||
get() = world.isAreaLoaded(Pos(this), getAttribute(FOLLOW_RANGE).value.ceilToInt())
|
get() = world.isAreaLoaded(Pos(this), getAttributeValue(FOLLOW_RANGE).ceilToInt())
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
|
|
||||||
@@ -199,6 +209,8 @@ class EntityMobBlobby(type: EntityType<out EntityCreature>, world: World) : Enti
|
|||||||
moveController = EntityMoveJumping(this, ::getJumpDelay, degreeDiffBeforeMovement = 22.5)
|
moveController = EntityMoveJumping(this, ::getJumpDelay, degreeDiffBeforeMovement = 22.5)
|
||||||
lookController = EntityLookWhileJumping(this)
|
lookController = EntityLookWhileJumping(this)
|
||||||
|
|
||||||
|
experienceValue = 1
|
||||||
|
|
||||||
setPathPriority(PathNodeType.WATER, 2F)
|
setPathPriority(PathNodeType.WATER, 2F)
|
||||||
setPathPriority(PathNodeType.WATER_BORDER, 4F)
|
setPathPriority(PathNodeType.WATER_BORDER, 4F)
|
||||||
}
|
}
|
||||||
@@ -210,19 +222,8 @@ class EntityMobBlobby(type: EntityType<out EntityCreature>, world: World) : Enti
|
|||||||
dataManager.register(DATA_HELD_ITEM, ItemStack.EMPTY)
|
dataManager.register(DATA_HELD_ITEM, ItemStack.EMPTY)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun registerAttributes(){
|
|
||||||
super.registerAttributes()
|
|
||||||
|
|
||||||
getAttribute(MAX_HEALTH).baseValue = 8.0
|
|
||||||
getAttribute(MOVEMENT_SPEED).baseValue = 0.19
|
|
||||||
getAttribute(FOLLOW_RANGE).baseValue = 44.0
|
|
||||||
getAttribute(ENTITY_GRAVITY).baseValue *= 0.725
|
|
||||||
|
|
||||||
experienceValue = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setMaxHealth(maxHealth: Float, resetCurrentHealth: Boolean){
|
fun setMaxHealth(maxHealth: Float, resetCurrentHealth: Boolean){
|
||||||
getAttribute(MAX_HEALTH).baseValue = maxHealth.toDouble()
|
getAttribute(MAX_HEALTH)!!.baseValue = maxHealth.toDouble()
|
||||||
|
|
||||||
health = if (resetCurrentHealth)
|
health = if (resetCurrentHealth)
|
||||||
maxHealth
|
maxHealth
|
||||||
@@ -262,7 +263,7 @@ class EntityMobBlobby(type: EntityType<out EntityCreature>, world: World) : Enti
|
|||||||
private fun recreateGroup(){
|
private fun recreateGroup(){
|
||||||
val originalGroup = world
|
val originalGroup = world
|
||||||
.selectExistingEntities
|
.selectExistingEntities
|
||||||
.inRange<EntityMobBlobby>(posVec, getAttribute(FOLLOW_RANGE).value)
|
.inRange<EntityMobBlobby>(posVec, getAttributeValue(FOLLOW_RANGE))
|
||||||
.filter { it.groupId == groupId }
|
.filter { it.groupId == groupId }
|
||||||
.ifEmpty { listOf(this) }
|
.ifEmpty { listOf(this) }
|
||||||
|
|
||||||
@@ -289,7 +290,7 @@ class EntityMobBlobby(type: EntityType<out EntityCreature>, world: World) : Enti
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun findLeader(): EntityMobBlobby?{
|
fun findLeader(): EntityMobBlobby?{
|
||||||
val maxDist = getAttribute(FOLLOW_RANGE).value
|
val maxDist = getAttributeValue(FOLLOW_RANGE)
|
||||||
val checkArea = boundingBox.grow(maxDist, maxDist * 0.5, maxDist)
|
val checkArea = boundingBox.grow(maxDist, maxDist * 0.5, maxDist)
|
||||||
|
|
||||||
return world.selectEntities.inBox<EntityMobBlobby>(checkArea).firstOrNull { it.groupId == groupId && it.isGroupLeader && it !== this }
|
return world.selectEntities.inBox<EntityMobBlobby>(checkArea).firstOrNull { it.groupId == groupId && it.isGroupLeader && it !== this }
|
||||||
@@ -427,7 +428,7 @@ class EntityMobBlobby(type: EntityType<out EntityCreature>, world: World) : Enti
|
|||||||
|
|
||||||
// Spawning
|
// Spawning
|
||||||
|
|
||||||
override fun onInitialSpawn(world: IWorld, difficulty: DifficultyInstance, reason: SpawnReason, data: ILivingEntityData?, nbt: CompoundNBT?): ILivingEntityData?{
|
override fun onInitialSpawn(world: IServerWorld, difficulty: DifficultyInstance, reason: SpawnReason, data: ILivingEntityData?, nbt: CompoundNBT?): ILivingEntityData?{
|
||||||
val rand = world.random
|
val rand = world.random
|
||||||
val wrld = world.world
|
val wrld = world.world
|
||||||
val group = (data as? SpawnGroupData) ?: SpawnGroupData(rand)
|
val group = (data as? SpawnGroupData) ?: SpawnGroupData(rand)
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package chylex.hee.game.entity.living
|
package chylex.hee.game.entity.living
|
||||||
import chylex.hee.HEE
|
import chylex.hee.HEE
|
||||||
|
import chylex.hee.game.entity.add
|
||||||
|
import chylex.hee.game.entity.extend
|
||||||
import chylex.hee.game.entity.living.ai.AITargetEyeContact
|
import chylex.hee.game.entity.living.ai.AITargetEyeContact
|
||||||
import chylex.hee.game.entity.living.ai.AIToggle
|
import chylex.hee.game.entity.living.ai.AIToggle
|
||||||
import chylex.hee.game.entity.living.ai.AIToggle.Companion.addGoal
|
import chylex.hee.game.entity.living.ai.AIToggle.Companion.addGoal
|
||||||
@@ -29,6 +31,7 @@ import chylex.hee.system.forge.SubscribeAllEvents
|
|||||||
import chylex.hee.system.forge.SubscribeEvent
|
import chylex.hee.system.forge.SubscribeEvent
|
||||||
import chylex.hee.system.math.square
|
import chylex.hee.system.math.square
|
||||||
import chylex.hee.system.migration.EntityArrow
|
import chylex.hee.system.migration.EntityArrow
|
||||||
|
import chylex.hee.system.migration.EntityEnderman
|
||||||
import chylex.hee.system.migration.EntityLiving
|
import chylex.hee.system.migration.EntityLiving
|
||||||
import chylex.hee.system.migration.EntityLivingBase
|
import chylex.hee.system.migration.EntityLivingBase
|
||||||
import chylex.hee.system.migration.EntityLlamaSpit
|
import chylex.hee.system.migration.EntityLlamaSpit
|
||||||
@@ -43,10 +46,10 @@ import chylex.hee.system.serialization.use
|
|||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.entity.EntityClassification.MONSTER
|
import net.minecraft.entity.EntityClassification.MONSTER
|
||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.ATTACK_DAMAGE
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.FOLLOW_RANGE
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
|
|
||||||
import net.minecraft.entity.SpawnReason
|
import net.minecraft.entity.SpawnReason
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.ATTACK_DAMAGE
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.FOLLOW_RANGE
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
|
||||||
import net.minecraft.network.datasync.DataParameter
|
import net.minecraft.network.datasync.DataParameter
|
||||||
import net.minecraft.util.DamageSource
|
import net.minecraft.util.DamageSource
|
||||||
import net.minecraft.util.IndirectEntityDamageSource
|
import net.minecraft.util.IndirectEntityDamageSource
|
||||||
@@ -184,7 +187,7 @@ class EntityMobEnderman(type: EntityType<EntityMobEnderman>, world: World) : Ent
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return !world.dimension.isSurfaceWorld || checkSkylightLevel(world, rand)
|
return !world.dimensionType.isSurfaceWorld || checkSkylightLevel(world, rand)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkSkylightLevel(world: IWorld, rand: Random): Boolean{
|
private fun checkSkylightLevel(world: IWorld, rand: Random): Boolean{
|
||||||
@@ -195,6 +198,14 @@ class EntityMobEnderman(type: EntityType<EntityMobEnderman>, world: World) : Ent
|
|||||||
|
|
||||||
return (skylight >= 11 && endermen <= 40 + (extra * 5)) || (skylight >= rand.nextInt(3, 9) && endermen < (skylight * 2) + (extra * 2))
|
return (skylight >= 11 && endermen <= 40 + (extra * 5)) || (skylight >= rand.nextInt(3, 9) && endermen < (skylight * 2) + (extra * 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
|
||||||
|
fun createAttributes() = EntityEnderman.func_233666_p_().extend {
|
||||||
|
add(MAX_HEALTH, 40.0)
|
||||||
|
add(ATTACK_DAMAGE, 5.0)
|
||||||
|
add(FOLLOW_RANGE, 64.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instance
|
// Instance
|
||||||
@@ -224,13 +235,7 @@ class EntityMobEnderman(type: EntityType<EntityMobEnderman>, world: World) : Ent
|
|||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
|
|
||||||
override fun registerAttributes(){
|
init{
|
||||||
super.registerAttributes()
|
|
||||||
|
|
||||||
getAttribute(MAX_HEALTH).baseValue = 40.0
|
|
||||||
getAttribute(ATTACK_DAMAGE).baseValue = 5.0
|
|
||||||
getAttribute(FOLLOW_RANGE).baseValue = 64.0
|
|
||||||
|
|
||||||
experienceValue = 10
|
experienceValue = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
package chylex.hee.game.entity.living
|
package chylex.hee.game.entity.living
|
||||||
|
import chylex.hee.game.entity.add
|
||||||
|
import chylex.hee.game.entity.extend
|
||||||
import chylex.hee.game.entity.living.EntityMobEndermanMuppet.Type.FIRST_KILL
|
import chylex.hee.game.entity.living.EntityMobEndermanMuppet.Type.FIRST_KILL
|
||||||
import chylex.hee.game.entity.living.EntityMobEndermanMuppet.Type.INVALID
|
import chylex.hee.game.entity.living.EntityMobEndermanMuppet.Type.INVALID
|
||||||
import chylex.hee.game.entity.living.behavior.EndermanTeleportHandler
|
import chylex.hee.game.entity.living.behavior.EndermanTeleportHandler
|
||||||
@@ -8,14 +10,15 @@ import chylex.hee.game.entity.technical.EntityTechnicalCausatumEvent
|
|||||||
import chylex.hee.game.mechanics.causatum.events.CausatumEventEndermanKill
|
import chylex.hee.game.mechanics.causatum.events.CausatumEventEndermanKill
|
||||||
import chylex.hee.game.world.Pos
|
import chylex.hee.game.world.Pos
|
||||||
import chylex.hee.init.ModEntities
|
import chylex.hee.init.ModEntities
|
||||||
|
import chylex.hee.system.migration.EntityEnderman
|
||||||
import chylex.hee.system.serialization.TagCompound
|
import chylex.hee.system.serialization.TagCompound
|
||||||
import chylex.hee.system.serialization.getEnum
|
import chylex.hee.system.serialization.getEnum
|
||||||
import chylex.hee.system.serialization.heeTag
|
import chylex.hee.system.serialization.heeTag
|
||||||
import chylex.hee.system.serialization.putEnum
|
import chylex.hee.system.serialization.putEnum
|
||||||
import chylex.hee.system.serialization.use
|
import chylex.hee.system.serialization.use
|
||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
|
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MOVEMENT_SPEED
|
import net.minecraft.entity.ai.attributes.Attributes.MOVEMENT_SPEED
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
|
||||||
class EntityMobEndermanMuppet(type: EntityType<EntityMobEndermanMuppet>, world: World) : EntityMobAbstractEnderman(type, world){
|
class EntityMobEndermanMuppet(type: EntityType<EntityMobEndermanMuppet>, world: World) : EntityMobAbstractEnderman(type, world){
|
||||||
@@ -23,8 +26,13 @@ class EntityMobEndermanMuppet(type: EntityType<EntityMobEndermanMuppet>, world:
|
|||||||
this.type = type
|
this.type = type
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object{
|
companion object{
|
||||||
private const val TYPE_TAG = "Type"
|
private const val TYPE_TAG = "Type"
|
||||||
|
|
||||||
|
fun createAttributes() = EntityEnderman.func_233666_p_().extend {
|
||||||
|
add(MAX_HEALTH, 40.0)
|
||||||
|
add(MOVEMENT_SPEED, 0.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class Type{
|
enum class Type{
|
||||||
@@ -37,12 +45,7 @@ class EntityMobEndermanMuppet(type: EntityType<EntityMobEndermanMuppet>, world:
|
|||||||
override val teleportCooldown = Int.MAX_VALUE
|
override val teleportCooldown = Int.MAX_VALUE
|
||||||
private var type = INVALID
|
private var type = INVALID
|
||||||
|
|
||||||
override fun registerAttributes(){
|
init{
|
||||||
super.registerAttributes()
|
|
||||||
|
|
||||||
getAttribute(MAX_HEALTH).baseValue = 40.0
|
|
||||||
getAttribute(MOVEMENT_SPEED).baseValue = 0.0
|
|
||||||
|
|
||||||
experienceValue = 0
|
experienceValue = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package chylex.hee.game.entity.living
|
package chylex.hee.game.entity.living
|
||||||
import chylex.hee.game.entity.CustomCreatureType
|
import chylex.hee.game.entity.CustomCreatureType
|
||||||
|
import chylex.hee.game.entity.add
|
||||||
|
import chylex.hee.game.entity.extend
|
||||||
import chylex.hee.game.entity.living.ai.AttackMelee
|
import chylex.hee.game.entity.living.ai.AttackMelee
|
||||||
import chylex.hee.game.entity.living.ai.ForceWanderTiming
|
import chylex.hee.game.entity.living.ai.ForceWanderTiming
|
||||||
import chylex.hee.game.entity.living.ai.Swim
|
import chylex.hee.game.entity.living.ai.Swim
|
||||||
@@ -21,8 +23,8 @@ import chylex.hee.system.serialization.use
|
|||||||
import net.minecraft.entity.CreatureAttribute
|
import net.minecraft.entity.CreatureAttribute
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.ATTACK_DAMAGE
|
import net.minecraft.entity.ai.attributes.Attributes.ATTACK_DAMAGE
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
|
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
|
||||||
import net.minecraft.network.IPacket
|
import net.minecraft.network.IPacket
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraft.world.Difficulty.PEACEFUL
|
import net.minecraft.world.Difficulty.PEACEFUL
|
||||||
@@ -33,22 +35,22 @@ open class EntityMobEndermite(type: EntityType<out EntityMobEndermite>, world: W
|
|||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
constructor(world: World) : this(ModEntities.ENDERMITE, world)
|
constructor(world: World) : this(ModEntities.ENDERMITE, world)
|
||||||
|
|
||||||
private companion object{
|
companion object{
|
||||||
private val DAMAGE_GENERAL = Damage(DIFFICULTY_SCALING, PEACEFUL_EXCLUSION, *ALL_PROTECTIONS)
|
private val DAMAGE_GENERAL = Damage(DIFFICULTY_SCALING, PEACEFUL_EXCLUSION, *ALL_PROTECTIONS)
|
||||||
|
|
||||||
private const val AGE_TAG = "Age"
|
private const val AGE_TAG = "Age"
|
||||||
private const val IDLE_TAG = "Idle"
|
private const val IDLE_TAG = "Idle"
|
||||||
|
|
||||||
|
fun createAttributes() = EntityEndermite.func_233666_p_().extend {
|
||||||
|
add(MAX_HEALTH, 8.0)
|
||||||
|
add(ATTACK_DAMAGE, 2.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var realLifetime = 0
|
private var realLifetime = 0
|
||||||
private var idleDespawnTimer: Short = 0
|
private var idleDespawnTimer: Short = 0
|
||||||
|
|
||||||
override fun registerAttributes(){
|
init{
|
||||||
super.registerAttributes()
|
|
||||||
|
|
||||||
getAttribute(MAX_HEALTH).baseValue = 8.0
|
|
||||||
getAttribute(ATTACK_DAMAGE).baseValue = 2.0
|
|
||||||
|
|
||||||
experienceValue = 3
|
experienceValue = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package chylex.hee.game.entity.living
|
package chylex.hee.game.entity.living
|
||||||
import chylex.hee.HEE
|
import chylex.hee.HEE
|
||||||
|
import chylex.hee.game.entity.add
|
||||||
|
import chylex.hee.game.entity.extend
|
||||||
import chylex.hee.game.entity.living.ai.AISummonFromBlock
|
import chylex.hee.game.entity.living.ai.AISummonFromBlock
|
||||||
import chylex.hee.game.entity.living.ai.AITargetSwarmSwitch
|
import chylex.hee.game.entity.living.ai.AITargetSwarmSwitch
|
||||||
import chylex.hee.game.entity.living.ai.AttackMelee
|
import chylex.hee.game.entity.living.ai.AttackMelee
|
||||||
@@ -31,9 +33,9 @@ import net.minecraft.block.Block
|
|||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.ATTACK_DAMAGE
|
import net.minecraft.entity.ai.attributes.Attributes.ATTACK_DAMAGE
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.FOLLOW_RANGE
|
import net.minecraft.entity.ai.attributes.Attributes.FOLLOW_RANGE
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
|
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
|
||||||
import net.minecraft.network.IPacket
|
import net.minecraft.network.IPacket
|
||||||
import net.minecraft.util.DamageSource
|
import net.minecraft.util.DamageSource
|
||||||
import net.minecraft.util.EntityDamageSource
|
import net.minecraft.util.EntityDamageSource
|
||||||
@@ -73,6 +75,12 @@ class EntityMobSilverfish(type: EntityType<EntityMobSilverfish>, world: World) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun createAttributes() = EntitySilverfish.func_233666_p_().extend {
|
||||||
|
add(MAX_HEALTH, 8.0)
|
||||||
|
add(ATTACK_DAMAGE, 2.0)
|
||||||
|
add(FOLLOW_RANGE, 12.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var aiSummonFromBlock: AISummonFromBlock
|
private lateinit var aiSummonFromBlock: AISummonFromBlock
|
||||||
@@ -82,13 +90,7 @@ class EntityMobSilverfish(type: EntityType<EntityMobSilverfish>, world: World) :
|
|||||||
|
|
||||||
override var wasLastHitCritical = false
|
override var wasLastHitCritical = false
|
||||||
|
|
||||||
override fun registerAttributes(){
|
init{
|
||||||
super.registerAttributes()
|
|
||||||
|
|
||||||
getAttribute(MAX_HEALTH).baseValue = 8.0
|
|
||||||
getAttribute(ATTACK_DAMAGE).baseValue = 2.0
|
|
||||||
getAttribute(FOLLOW_RANGE).baseValue = 12.0
|
|
||||||
|
|
||||||
experienceValue = 3
|
experienceValue = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
package chylex.hee.game.entity.living
|
package chylex.hee.game.entity.living
|
||||||
import chylex.hee.game.entity.EntityData
|
import chylex.hee.game.entity.EntityData
|
||||||
import chylex.hee.game.entity.OPERATION_MUL_INCR_INDIVIDUAL
|
import chylex.hee.game.entity.OPERATION_MUL_INCR_INDIVIDUAL
|
||||||
|
import chylex.hee.game.entity.add
|
||||||
|
import chylex.hee.game.entity.extend
|
||||||
import chylex.hee.game.entity.living.ai.AIAttackLeap
|
import chylex.hee.game.entity.living.ai.AIAttackLeap
|
||||||
import chylex.hee.game.entity.living.ai.AIToggle
|
import chylex.hee.game.entity.living.ai.AIToggle
|
||||||
import chylex.hee.game.entity.living.ai.AIToggle.Companion.addGoal
|
import chylex.hee.game.entity.living.ai.AIToggle.Companion.addGoal
|
||||||
@@ -22,6 +24,7 @@ import chylex.hee.game.entity.selectEntities
|
|||||||
import chylex.hee.game.entity.selectExistingEntities
|
import chylex.hee.game.entity.selectExistingEntities
|
||||||
import chylex.hee.game.entity.selectVulnerableEntities
|
import chylex.hee.game.entity.selectVulnerableEntities
|
||||||
import chylex.hee.game.entity.tryApplyModifier
|
import chylex.hee.game.entity.tryApplyModifier
|
||||||
|
import chylex.hee.game.entity.tryApplyNonPersistentModifier
|
||||||
import chylex.hee.game.entity.tryRemoveModifier
|
import chylex.hee.game.entity.tryRemoveModifier
|
||||||
import chylex.hee.game.mechanics.damage.Damage
|
import chylex.hee.game.mechanics.damage.Damage
|
||||||
import chylex.hee.game.mechanics.damage.IDamageProcessor.Companion.ALL_PROTECTIONS
|
import chylex.hee.game.mechanics.damage.IDamageProcessor.Companion.ALL_PROTECTIONS
|
||||||
@@ -54,11 +57,11 @@ import net.minecraft.block.BlockState
|
|||||||
import net.minecraft.entity.CreatureAttribute
|
import net.minecraft.entity.CreatureAttribute
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.ATTACK_DAMAGE
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.FOLLOW_RANGE
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MOVEMENT_SPEED
|
|
||||||
import net.minecraft.entity.ai.attributes.AttributeModifier
|
import net.minecraft.entity.ai.attributes.AttributeModifier
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.ATTACK_DAMAGE
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.FOLLOW_RANGE
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.MOVEMENT_SPEED
|
||||||
import net.minecraft.network.IPacket
|
import net.minecraft.network.IPacket
|
||||||
import net.minecraft.network.datasync.DataSerializers
|
import net.minecraft.network.datasync.DataSerializers
|
||||||
import net.minecraft.pathfinding.PathNavigator
|
import net.minecraft.pathfinding.PathNavigator
|
||||||
@@ -71,7 +74,7 @@ import net.minecraft.util.math.RayTraceContext
|
|||||||
import net.minecraft.util.math.RayTraceContext.BlockMode
|
import net.minecraft.util.math.RayTraceContext.BlockMode
|
||||||
import net.minecraft.util.math.RayTraceContext.FluidMode
|
import net.minecraft.util.math.RayTraceContext.FluidMode
|
||||||
import net.minecraft.util.math.RayTraceResult.Type
|
import net.minecraft.util.math.RayTraceResult.Type
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.Difficulty.HARD
|
import net.minecraft.world.Difficulty.HARD
|
||||||
import net.minecraft.world.Difficulty.NORMAL
|
import net.minecraft.world.Difficulty.NORMAL
|
||||||
import net.minecraft.world.LightType.BLOCK
|
import net.minecraft.world.LightType.BLOCK
|
||||||
@@ -118,6 +121,13 @@ class EntityMobSpiderling(type: EntityType<EntityMobSpiderling>, world: World) :
|
|||||||
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun createAttributes() = EntityMob.func_233666_p_().extend {
|
||||||
|
add(MAX_HEALTH, 11.0)
|
||||||
|
add(ATTACK_DAMAGE, 1.5)
|
||||||
|
add(MOVEMENT_SPEED, 0.32)
|
||||||
|
add(FOLLOW_RANGE, 20.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instance
|
// Instance
|
||||||
@@ -144,7 +154,11 @@ class EntityMobSpiderling(type: EntityType<EntityMobSpiderling>, world: World) :
|
|||||||
// Initialization
|
// Initialization
|
||||||
|
|
||||||
init{
|
init{
|
||||||
|
experienceValue = 2
|
||||||
stepHeight = 0F
|
stepHeight = 0F
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
getAttribute(MAX_HEALTH)!!.baseValue = rand.nextInt(11, 13).toDouble()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun registerData(){
|
override fun registerData(){
|
||||||
@@ -152,17 +166,6 @@ class EntityMobSpiderling(type: EntityType<EntityMobSpiderling>, world: World) :
|
|||||||
dataManager.register(DATA_SLEEPING, true)
|
dataManager.register(DATA_SLEEPING, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun registerAttributes(){
|
|
||||||
super.registerAttributes()
|
|
||||||
|
|
||||||
getAttribute(MAX_HEALTH).baseValue = rand.nextInt(11, 13).toDouble()
|
|
||||||
getAttribute(ATTACK_DAMAGE).baseValue = 1.5
|
|
||||||
getAttribute(MOVEMENT_SPEED).baseValue = 0.32
|
|
||||||
getAttribute(FOLLOW_RANGE).baseValue = 20.0
|
|
||||||
|
|
||||||
experienceValue = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun registerGoals(){
|
override fun registerGoals(){
|
||||||
aiMovement = AIToggle()
|
aiMovement = AIToggle()
|
||||||
aiMovement.enabled = false
|
aiMovement.enabled = false
|
||||||
@@ -245,7 +248,7 @@ class EntityMobSpiderling(type: EntityType<EntityMobSpiderling>, world: World) :
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
val start = posVec.addY(0.5)
|
val start = posVec.addY(0.5)
|
||||||
val target = Vec3d(moveHelper.x, start.y, moveHelper.z)
|
val target = Vector3d(moveHelper.x, start.y, moveHelper.z)
|
||||||
|
|
||||||
val direction = start.directionTowards(target)
|
val direction = start.directionTowards(target)
|
||||||
val obstacle = world.rayTraceBlocks(RayTraceContext(start, start.add(direction.scale(3.0)), BlockMode.COLLIDER, FluidMode.NONE, this))
|
val obstacle = world.rayTraceBlocks(RayTraceContext(start, start.add(direction.scale(3.0)), BlockMode.COLLIDER, FluidMode.NONE, this))
|
||||||
@@ -267,7 +270,7 @@ class EntityMobSpiderling(type: EntityType<EntityMobSpiderling>, world: World) :
|
|||||||
ForgeHooks.onLivingJump(this)
|
ForgeHooks.onLivingJump(this)
|
||||||
|
|
||||||
jumpCooldown = rand.nextInt(18, 22)
|
jumpCooldown = rand.nextInt(18, 22)
|
||||||
getAttribute(ATTACK_DAMAGE).tryApplyModifier(FALL_CRIT_DAMAGE)
|
getAttribute(ATTACK_DAMAGE).tryApplyNonPersistentModifier(FALL_CRIT_DAMAGE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -385,7 +388,7 @@ class EntityMobSpiderling(type: EntityType<EntityMobSpiderling>, world: World) :
|
|||||||
return 256
|
return 256
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setMotionMultiplier(state: BlockState, mp: Vec3d){
|
override fun setMotionMultiplier(state: BlockState, mp: Vector3d){
|
||||||
if (state.block !is BlockWeb){
|
if (state.block !is BlockWeb){
|
||||||
super.setMotionMultiplier(state, mp)
|
super.setMotionMultiplier(state, mp)
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
package chylex.hee.game.entity.living
|
package chylex.hee.game.entity.living
|
||||||
|
import chylex.hee.game.entity.add
|
||||||
|
import chylex.hee.game.entity.extend
|
||||||
import chylex.hee.game.entity.living.ai.AttackMelee
|
import chylex.hee.game.entity.living.ai.AttackMelee
|
||||||
import chylex.hee.game.entity.living.ai.Swim
|
import chylex.hee.game.entity.living.ai.Swim
|
||||||
import chylex.hee.game.entity.living.ai.TargetAttacker
|
import chylex.hee.game.entity.living.ai.TargetAttacker
|
||||||
@@ -25,10 +27,10 @@ import net.minecraft.entity.Entity
|
|||||||
import net.minecraft.entity.EntitySize
|
import net.minecraft.entity.EntitySize
|
||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.Pose
|
import net.minecraft.entity.Pose
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.ATTACK_DAMAGE
|
import net.minecraft.entity.ai.attributes.Attributes.ATTACK_DAMAGE
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.FOLLOW_RANGE
|
import net.minecraft.entity.ai.attributes.Attributes.FOLLOW_RANGE
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
|
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MOVEMENT_SPEED
|
import net.minecraft.entity.ai.attributes.Attributes.MOVEMENT_SPEED
|
||||||
import net.minecraft.network.IPacket
|
import net.minecraft.network.IPacket
|
||||||
import net.minecraft.util.DamageSource
|
import net.minecraft.util.DamageSource
|
||||||
import net.minecraft.util.Hand
|
import net.minecraft.util.Hand
|
||||||
@@ -44,18 +46,18 @@ class EntityMobUndread(type: EntityType<EntityMobUndread>, world: World) : Entit
|
|||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
constructor(world: World) : this(ModEntities.UNDREAD, world)
|
constructor(world: World) : this(ModEntities.UNDREAD, world)
|
||||||
|
|
||||||
private companion object{
|
companion object{
|
||||||
private val DAMAGE_GENERAL = Damage(DIFFICULTY_SCALING, PEACEFUL_EXCLUSION, *ALL_PROTECTIONS_WITH_SHIELD)
|
private val DAMAGE_GENERAL = Damage(DIFFICULTY_SCALING, PEACEFUL_EXCLUSION, *ALL_PROTECTIONS_WITH_SHIELD)
|
||||||
|
|
||||||
|
fun createAttributes() = EntityMob.func_233666_p_().extend {
|
||||||
|
add(MAX_HEALTH, 12.0)
|
||||||
|
add(ATTACK_DAMAGE, 4.0)
|
||||||
|
add(MOVEMENT_SPEED, 0.18)
|
||||||
|
add(FOLLOW_RANGE, 24.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun registerAttributes(){
|
init{
|
||||||
super.registerAttributes()
|
|
||||||
|
|
||||||
getAttribute(MAX_HEALTH).baseValue = 12.0
|
|
||||||
getAttribute(ATTACK_DAMAGE).baseValue = 4.0
|
|
||||||
getAttribute(MOVEMENT_SPEED).baseValue = 0.18
|
|
||||||
getAttribute(FOLLOW_RANGE).baseValue = 24.0
|
|
||||||
|
|
||||||
experienceValue = 5
|
experienceValue = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package chylex.hee.game.entity.living
|
package chylex.hee.game.entity.living
|
||||||
import chylex.hee.HEE
|
import chylex.hee.HEE
|
||||||
|
import chylex.hee.game.entity.add
|
||||||
|
import chylex.hee.game.entity.extend
|
||||||
import chylex.hee.game.entity.isAnyVulnerablePlayerWithinRange
|
import chylex.hee.game.entity.isAnyVulnerablePlayerWithinRange
|
||||||
import chylex.hee.game.entity.living.EntityMobVampireBat.BehaviorType.HOSTILE
|
import chylex.hee.game.entity.living.EntityMobVampireBat.BehaviorType.HOSTILE
|
||||||
import chylex.hee.game.entity.living.EntityMobVampireBat.BehaviorType.NEUTRAL
|
import chylex.hee.game.entity.living.EntityMobVampireBat.BehaviorType.NEUTRAL
|
||||||
@@ -53,22 +55,22 @@ import chylex.hee.system.serialization.use
|
|||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.ILivingEntityData
|
import net.minecraft.entity.ILivingEntityData
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.ATTACK_DAMAGE
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.FLYING_SPEED
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.FOLLOW_RANGE
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
|
|
||||||
import net.minecraft.entity.SpawnReason
|
import net.minecraft.entity.SpawnReason
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.ATTACK_DAMAGE
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.FLYING_SPEED
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.FOLLOW_RANGE
|
||||||
|
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
|
||||||
import net.minecraft.entity.monster.IMob
|
import net.minecraft.entity.monster.IMob
|
||||||
import net.minecraft.nbt.CompoundNBT
|
import net.minecraft.nbt.CompoundNBT
|
||||||
import net.minecraft.network.IPacket
|
import net.minecraft.network.IPacket
|
||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.math.AxisAlignedBB
|
import net.minecraft.util.math.AxisAlignedBB
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.Difficulty.HARD
|
import net.minecraft.world.Difficulty.HARD
|
||||||
import net.minecraft.world.Difficulty.NORMAL
|
import net.minecraft.world.Difficulty.NORMAL
|
||||||
import net.minecraft.world.DifficultyInstance
|
import net.minecraft.world.DifficultyInstance
|
||||||
import net.minecraft.world.IWorld
|
import net.minecraft.world.IServerWorld
|
||||||
import net.minecraft.world.LightType.BLOCK
|
import net.minecraft.world.LightType.BLOCK
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.fml.network.NetworkHooks
|
import net.minecraftforge.fml.network.NetworkHooks
|
||||||
@@ -78,7 +80,7 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
|
|||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
constructor(world: World) : this(ModEntities.VAMPIRE_BAT, world)
|
constructor(world: World) : this(ModEntities.VAMPIRE_BAT, world)
|
||||||
|
|
||||||
private companion object{
|
companion object{
|
||||||
private const val MIN_ATTACK_COOLDOWN = 30
|
private const val MIN_ATTACK_COOLDOWN = 30
|
||||||
|
|
||||||
private val DAMAGE_GENERAL = Damage(PEACEFUL_EXCLUSION, *ALL_PROTECTIONS_WITH_SHIELD, STATUS {
|
private val DAMAGE_GENERAL = Damage(PEACEFUL_EXCLUSION, *ALL_PROTECTIONS_WITH_SHIELD, STATUS {
|
||||||
@@ -97,6 +99,13 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
|
|||||||
data = ParticleSmokeCustom.Data(color = IRandomColor { RGB(nextInt(60, 162), nextInt(7, 71), nextInt(1, 19)) }, scale = 0.475F),
|
data = ParticleSmokeCustom.Data(color = IRandomColor { RGB(nextInt(60, 162), nextInt(7, 71), nextInt(1, 19)) }, scale = 0.475F),
|
||||||
pos = InBox(0.175F)
|
pos = InBox(0.175F)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun createAttributes() = EntityBat.func_233666_p_().extend {
|
||||||
|
add(MAX_HEALTH, 4.0)
|
||||||
|
add(ATTACK_DAMAGE, 3.0)
|
||||||
|
add(FOLLOW_RANGE, 14.5)
|
||||||
|
add(FLYING_SPEED, 0.1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class BehaviorType{
|
enum class BehaviorType{
|
||||||
@@ -106,9 +115,9 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
|
|||||||
// Instance
|
// Instance
|
||||||
|
|
||||||
private var behaviorType = NEUTRAL
|
private var behaviorType = NEUTRAL
|
||||||
private var prevTargetPos: Vec3d? = null
|
private var prevTargetPos: Vector3d? = null
|
||||||
|
|
||||||
private val nextTargetPos: Vec3d
|
private val nextTargetPos: Vector3d
|
||||||
get(){
|
get(){
|
||||||
val currentTarget = attackTarget
|
val currentTarget = attackTarget
|
||||||
|
|
||||||
@@ -119,7 +128,7 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
|
|||||||
val currentSleep = nextSleepPos
|
val currentSleep = nextSleepPos
|
||||||
|
|
||||||
if (currentSleep != null){
|
if (currentSleep != null){
|
||||||
return Vec3d(currentSleep.x + 0.5, currentSleep.y + 0.1, currentSleep.z + 0.5).also { prevTargetPos = null }
|
return Vector3d(currentSleep.x + 0.5, currentSleep.y + 0.1, currentSleep.z + 0.5).also { prevTargetPos = null }
|
||||||
}
|
}
|
||||||
|
|
||||||
val pos = prevTargetPos?.takeIf { Pos(it).isAir(world) && it.y >= 1 }
|
val pos = prevTargetPos?.takeIf { Pos(it).isAir(world) && it.y >= 1 }
|
||||||
@@ -130,7 +139,7 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
|
|||||||
rand.nextInt(-2, 4),
|
rand.nextInt(-2, 4),
|
||||||
rand.nextInt(-7, 7)
|
rand.nextInt(-7, 7)
|
||||||
).let {
|
).let {
|
||||||
Vec3d(it.x + 0.5, it.y + 0.1, it.z + 0.5)
|
Vector3d(it.x + 0.5, it.y + 0.1, it.z + 0.5)
|
||||||
}.also {
|
}.also {
|
||||||
prevTargetPos = it
|
prevTargetPos = it
|
||||||
}
|
}
|
||||||
@@ -151,28 +160,18 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
|
|||||||
|
|
||||||
init{
|
init{
|
||||||
moveController = EntityMoveFlyingBat(this)
|
moveController = EntityMoveFlyingBat(this)
|
||||||
}
|
|
||||||
|
|
||||||
override fun registerAttributes(){
|
|
||||||
super.registerAttributes()
|
|
||||||
|
|
||||||
attributes.registerAttribute(ATTACK_DAMAGE)
|
|
||||||
attributes.registerAttribute(FLYING_SPEED)
|
|
||||||
|
|
||||||
getAttribute(FOLLOW_RANGE).baseValue = 14.5
|
|
||||||
getAttribute(FLYING_SPEED).baseValue = 0.1
|
|
||||||
updateHostilityAttributes()
|
updateHostilityAttributes()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateHostilityAttributes(){
|
private fun updateHostilityAttributes(){
|
||||||
if (behaviorType == PASSIVE){
|
if (behaviorType == PASSIVE){
|
||||||
getAttribute(MAX_HEALTH).baseValue = 6.0
|
getAttribute(MAX_HEALTH)!!.baseValue = 6.0
|
||||||
getAttribute(ATTACK_DAMAGE).baseValue = 0.0
|
getAttribute(ATTACK_DAMAGE)!!.baseValue = 0.0
|
||||||
experienceValue = 0
|
experienceValue = 0
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
getAttribute(MAX_HEALTH).baseValue = 4.0
|
getAttribute(MAX_HEALTH)!!.baseValue = 4.0
|
||||||
getAttribute(ATTACK_DAMAGE).baseValue = 3.0
|
getAttribute(ATTACK_DAMAGE)!!.baseValue = 3.0
|
||||||
experienceValue = 1
|
experienceValue = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +213,7 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
|
|||||||
tryPickNextTarget()
|
tryPickNextTarget()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (getDistanceSq(currentTarget) > square(getAttribute(FOLLOW_RANGE).value) || (attackTimer > 0 && --attackTimer == 0)){
|
else if (getDistanceSq(currentTarget) > square(getAttributeValue(FOLLOW_RANGE)) || (attackTimer > 0 && --attackTimer == 0)){
|
||||||
attackTarget = null
|
attackTarget = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,7 +254,7 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
|
|||||||
else if (lookPosVec.squareDistanceTo(sleepPos.center) < square(0.2) && canHangUnderCurrentBlock()){
|
else if (lookPosVec.squareDistanceTo(sleepPos.center) < square(0.2) && canHangUnderCurrentBlock()){
|
||||||
isBatHanging = true
|
isBatHanging = true
|
||||||
nextSleepPos = null
|
nextSleepPos = null
|
||||||
motion = Vec3d.ZERO
|
motion = Vector3d.ZERO
|
||||||
|
|
||||||
moveHelper.tick()
|
moveHelper.tick()
|
||||||
moveForward = 0F
|
moveForward = 0F
|
||||||
@@ -370,10 +369,10 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
|
|||||||
|
|
||||||
// Spawning
|
// Spawning
|
||||||
|
|
||||||
override fun onInitialSpawn(world: IWorld, difficulty: DifficultyInstance, reason: SpawnReason, data: ILivingEntityData?, nbt: CompoundNBT?): ILivingEntityData?{
|
override fun onInitialSpawn(world: IServerWorld, difficulty: DifficultyInstance, reason: SpawnReason, data: ILivingEntityData?, nbt: CompoundNBT?): ILivingEntityData?{
|
||||||
// TODO use onInitialSpawn for territory generation, call enablePersistence to stop despawning
|
// TODO use onInitialSpawn for territory generation, call enablePersistence to stop despawning
|
||||||
|
|
||||||
if (world.dimension.type === HEE.dim){
|
if (world.world.dimensionKey === HEE.dim){
|
||||||
when(TerritoryType.fromX(posX.floorToInt())){
|
when(TerritoryType.fromX(posX.floorToInt())){
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import chylex.hee.system.serialization.heeTag
|
|||||||
import chylex.hee.system.serialization.readTag
|
import chylex.hee.system.serialization.readTag
|
||||||
import chylex.hee.system.serialization.use
|
import chylex.hee.system.serialization.use
|
||||||
import chylex.hee.system.serialization.writeTag
|
import chylex.hee.system.serialization.writeTag
|
||||||
import com.mojang.datafixers.Dynamic
|
import com.mojang.serialization.Dynamic
|
||||||
import net.minecraft.entity.EntityType
|
import net.minecraft.entity.EntityType
|
||||||
import net.minecraft.entity.merchant.villager.VillagerData
|
import net.minecraft.entity.merchant.villager.VillagerData
|
||||||
import net.minecraft.entity.villager.IVillagerDataHolder
|
import net.minecraft.entity.villager.IVillagerDataHolder
|
||||||
@@ -69,16 +69,11 @@ class EntityMobVillagerDying(type: EntityType<EntityMobVillagerDying>, world: Wo
|
|||||||
private var villager: VillagerData? = null
|
private var villager: VillagerData? = null
|
||||||
|
|
||||||
init{
|
init{
|
||||||
|
experienceValue = 0
|
||||||
isInvulnerable = true
|
isInvulnerable = true
|
||||||
setNoGravity(true)
|
setNoGravity(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun registerAttributes(){
|
|
||||||
super.registerAttributes()
|
|
||||||
|
|
||||||
experienceValue = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
fun copyVillagerDataFrom(villager: EntityVillager){
|
fun copyVillagerDataFrom(villager: EntityVillager){
|
||||||
setGrowingAge(villager.growingAge)
|
setGrowingAge(villager.growingAge)
|
||||||
this.villager = villager.villagerData
|
this.villager = villager.villagerData
|
||||||
@@ -97,7 +92,7 @@ class EntityMobVillagerDying(type: EntityType<EntityMobVillagerDying>, world: Wo
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun writeSpawnData(buffer: PacketBuffer) = buffer.use {
|
override fun writeSpawnData(buffer: PacketBuffer) = buffer.use {
|
||||||
writeTag(villagerData.serialize(NBTDynamicOps.INSTANCE) as TagCompound)
|
writeTag(VillagerData.CODEC.encodeStart(NBTDynamicOps.INSTANCE, villagerData).result().get() as TagCompound)
|
||||||
writeVarInt(deathTime)
|
writeVarInt(deathTime)
|
||||||
|
|
||||||
writeFloat(renderYawOffset)
|
writeFloat(renderYawOffset)
|
||||||
@@ -106,7 +101,7 @@ class EntityMobVillagerDying(type: EntityType<EntityMobVillagerDying>, world: Wo
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun readSpawnData(buffer: PacketBuffer) = buffer.use {
|
override fun readSpawnData(buffer: PacketBuffer) = buffer.use {
|
||||||
villager = VillagerData(Dynamic(NBTDynamicOps.INSTANCE, buffer.readTag()))
|
villager = VillagerData.CODEC.parse(Dynamic(NBTDynamicOps.INSTANCE, readTag())).result().get()
|
||||||
deathTime = readVarInt()
|
deathTime = readVarInt()
|
||||||
|
|
||||||
renderYawOffset = readFloat()
|
renderYawOffset = readFloat()
|
||||||
@@ -159,13 +154,13 @@ class EntityMobVillagerDying(type: EntityType<EntityMobVillagerDying>, world: Wo
|
|||||||
override fun writeAdditional(nbt: TagCompound) = nbt.heeTag.use {
|
override fun writeAdditional(nbt: TagCompound) = nbt.heeTag.use {
|
||||||
super.writeAdditional(nbt)
|
super.writeAdditional(nbt)
|
||||||
|
|
||||||
put(VILLAGER_TAG, villagerData.serialize(NBTDynamicOps.INSTANCE))
|
put(VILLAGER_TAG, VillagerData.CODEC.encodeStart(NBTDynamicOps.INSTANCE, villagerData).result().get())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun readAdditional(nbt: TagCompound) = nbt.heeTag.use {
|
override fun readAdditional(nbt: TagCompound) = nbt.heeTag.use {
|
||||||
super.readAdditional(nbt)
|
super.readAdditional(nbt)
|
||||||
|
|
||||||
villager = VillagerData(Dynamic(NBTDynamicOps.INSTANCE, getCompound(VILLAGER_TAG)))
|
villager = VillagerData.CODEC.parse(Dynamic(NBTDynamicOps.INSTANCE, getCompound(VILLAGER_TAG))).result().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun processInteract(player: EntityPlayer, hand: Hand) = true
|
override fun processInteract(player: EntityPlayer, hand: Hand) = true
|
||||||
|
@@ -35,7 +35,7 @@ class AIAttackLeap(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun shouldExecute(): Boolean{
|
override fun shouldExecute(): Boolean{
|
||||||
if (!entity.onGround){ // also prevents instant jump after taking damage
|
if (!entity.isOnGround){ // also prevents instant jump after taking damage
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class AIAttackLeap(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun shouldContinueExecuting(): Boolean{
|
override fun shouldContinueExecuting(): Boolean{
|
||||||
return !entity.onGround
|
return !entity.isOnGround
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun startExecuting(){
|
override fun startExecuting(){
|
||||||
|
@@ -12,15 +12,15 @@ import chylex.hee.system.random.nextVector2
|
|||||||
import net.minecraft.entity.ai.goal.Goal
|
import net.minecraft.entity.ai.goal.Goal
|
||||||
import net.minecraft.entity.ai.goal.Goal.Flag.JUMP
|
import net.minecraft.entity.ai.goal.Goal.Flag.JUMP
|
||||||
import net.minecraft.entity.ai.goal.Goal.Flag.MOVE
|
import net.minecraft.entity.ai.goal.Goal.Flag.MOVE
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import java.util.EnumSet
|
import java.util.EnumSet
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
class AIFollowLeaderJumping(private val entity: EntityMobBlobby) : Goal(){
|
class AIFollowLeaderJumping(private val entity: EntityMobBlobby) : Goal(){
|
||||||
private var leader: EntityMobBlobby? = null
|
private var leader: EntityMobBlobby? = null
|
||||||
|
|
||||||
private var offset = Vec3d.ZERO
|
private var offset = Vector3d.ZERO
|
||||||
private var targetOffset = Vec3d.ZERO
|
private var targetOffset = Vector3d.ZERO
|
||||||
private var offsetChangeTicks = 0
|
private var offsetChangeTicks = 0
|
||||||
private var stoppedTicks = 0
|
private var stoppedTicks = 0
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ import chylex.hee.system.random.nextInt
|
|||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.entity.ai.goal.Goal
|
import net.minecraft.entity.ai.goal.Goal
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
|
|
||||||
class AIPickUpBlock(
|
class AIPickUpBlock(
|
||||||
private val entity: EntityCreature,
|
private val entity: EntityCreature,
|
||||||
@@ -27,7 +27,7 @@ class AIPickUpBlock(
|
|||||||
|
|
||||||
private var timeOfNextAttempt = entity.world.totalTime + entity.rng.nextInt(ticksPerAttempt / 2, ticksPerAttempt)
|
private var timeOfNextAttempt = entity.world.totalTime + entity.rng.nextInt(ticksPerAttempt / 2, ticksPerAttempt)
|
||||||
|
|
||||||
private var targetNavPos: Vec3d? = null
|
private var targetNavPos: Vector3d? = null
|
||||||
private var targetBlockPos: BlockPos? = null
|
private var targetBlockPos: BlockPos? = null
|
||||||
private var targetBlockState: BlockState? = null
|
private var targetBlockState: BlockState? = null
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class AIPickUpBlock(
|
|||||||
|
|
||||||
targetBlockPos = pos
|
targetBlockPos = pos
|
||||||
targetBlockState = state
|
targetBlockState = state
|
||||||
targetNavPos = Vec3d(nav.x + 0.5, nav.y.toDouble(), nav.z + 0.5)
|
targetNavPos = Vector3d(nav.x + 0.5, nav.y.toDouble(), nav.z + 0.5)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@ package chylex.hee.game.entity.living.ai
|
|||||||
import chylex.hee.system.migration.EntityCreature
|
import chylex.hee.system.migration.EntityCreature
|
||||||
import net.minecraft.entity.ai.RandomPositionGenerator
|
import net.minecraft.entity.ai.RandomPositionGenerator
|
||||||
import net.minecraft.entity.ai.goal.RandomWalkingGoal
|
import net.minecraft.entity.ai.goal.RandomWalkingGoal
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
|
|
||||||
class AIWander(
|
class AIWander(
|
||||||
entity: EntityCreature,
|
entity: EntityCreature,
|
||||||
@@ -11,7 +11,7 @@ class AIWander(
|
|||||||
private val maxDistanceXZ: Int = 10,
|
private val maxDistanceXZ: Int = 10,
|
||||||
private val maxDistanceY: Int = 7
|
private val maxDistanceY: Int = 7
|
||||||
) : RandomWalkingGoal(entity, movementSpeed, chancePerTick){
|
) : RandomWalkingGoal(entity, movementSpeed, chancePerTick){
|
||||||
override fun getPosition(): Vec3d?{
|
override fun getPosition(): Vector3d?{
|
||||||
return RandomPositionGenerator.findRandomTarget(creature, maxDistanceXZ, maxDistanceY)
|
return RandomPositionGenerator.findRandomTarget(creature, maxDistanceXZ, maxDistanceY)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@ package chylex.hee.game.entity.living.ai
|
|||||||
import chylex.hee.system.migration.EntityCreature
|
import chylex.hee.system.migration.EntityCreature
|
||||||
import net.minecraft.entity.ai.RandomPositionGenerator
|
import net.minecraft.entity.ai.RandomPositionGenerator
|
||||||
import net.minecraft.entity.ai.goal.RandomWalkingGoal
|
import net.minecraft.entity.ai.goal.RandomWalkingGoal
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
|
|
||||||
open class AIWanderLand(
|
open class AIWanderLand(
|
||||||
entity: EntityCreature,
|
entity: EntityCreature,
|
||||||
@@ -14,7 +14,7 @@ open class AIWanderLand(
|
|||||||
protected inline val entity: EntityCreature
|
protected inline val entity: EntityCreature
|
||||||
get() = creature
|
get() = creature
|
||||||
|
|
||||||
override fun getPosition(): Vec3d?{
|
override fun getPosition(): Vector3d?{
|
||||||
return RandomPositionGenerator.getLandPos(entity, maxDistanceXZ, maxDistanceY) ?: RandomPositionGenerator.findRandomTarget(entity, maxDistanceXZ, maxDistanceY)
|
return RandomPositionGenerator.getLandPos(entity, maxDistanceXZ, maxDistanceY) ?: RandomPositionGenerator.findRandomTarget(entity, maxDistanceXZ, maxDistanceY)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@ import chylex.hee.system.migration.EntityCreature
|
|||||||
import chylex.hee.system.random.nextInt
|
import chylex.hee.system.random.nextInt
|
||||||
import net.minecraft.pathfinding.Path
|
import net.minecraft.pathfinding.Path
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.LightType.BLOCK
|
import net.minecraft.world.LightType.BLOCK
|
||||||
import net.minecraft.world.LightType.SKY
|
import net.minecraft.world.LightType.SKY
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ class AIWanderLightStartle(
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getPosition(): Vec3d?{
|
override fun getPosition(): Vector3d?{
|
||||||
val world = entity.world
|
val world = entity.world
|
||||||
val rand = entity.rng
|
val rand = entity.rng
|
||||||
val nav = entity.navigator
|
val nav = entity.navigator
|
||||||
@@ -88,7 +88,7 @@ class AIWanderLightStartle(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return foundTarget?.let { Vec3d(it.x + 0.5, it.y.toDouble(), it.z + 0.5) }
|
return foundTarget?.let { Vector3d(it.x + 0.5, it.y.toDouble(), it.z + 0.5) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCombinedLight(pos: BlockPos): Int{
|
private fun getCombinedLight(pos: BlockPos): Int{
|
||||||
|
@@ -8,7 +8,7 @@ import chylex.hee.system.migration.Facing.UP
|
|||||||
import chylex.hee.system.random.nextInt
|
import chylex.hee.system.random.nextInt
|
||||||
import net.minecraft.block.material.Material
|
import net.minecraft.block.material.Material
|
||||||
import net.minecraft.entity.ai.RandomPositionGenerator
|
import net.minecraft.entity.ai.RandomPositionGenerator
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
|
|
||||||
class AIWanderOnFirePanic(
|
class AIWanderOnFirePanic(
|
||||||
entity: EntityCreature,
|
entity: EntityCreature,
|
||||||
@@ -35,7 +35,7 @@ class AIWanderOnFirePanic(
|
|||||||
return entity.isBurning && !entity.navigator.noPath()
|
return entity.isBurning && !entity.navigator.noPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getPosition(): Vec3d?{
|
override fun getPosition(): Vector3d?{
|
||||||
val world = entity.world
|
val world = entity.world
|
||||||
val rand = entity.rng
|
val rand = entity.rng
|
||||||
|
|
||||||
|
@@ -4,14 +4,14 @@ import chylex.hee.game.entity.lookPosVec
|
|||||||
import net.minecraft.entity.ai.goal.Goal
|
import net.minecraft.entity.ai.goal.Goal
|
||||||
import net.minecraft.entity.ai.goal.Goal.Flag.LOOK
|
import net.minecraft.entity.ai.goal.Goal.Flag.LOOK
|
||||||
import net.minecraft.entity.ai.goal.Goal.Flag.MOVE
|
import net.minecraft.entity.ai.goal.Goal.Flag.MOVE
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import java.util.EnumSet
|
import java.util.EnumSet
|
||||||
|
|
||||||
class AIWatchDyingLeader(
|
class AIWatchDyingLeader(
|
||||||
private val entity: EntityMobBlobby,
|
private val entity: EntityMobBlobby,
|
||||||
private val ticksBeforeResuming: Int
|
private val ticksBeforeResuming: Int
|
||||||
) : Goal(){
|
) : Goal(){
|
||||||
private var watchTarget = Vec3d.ZERO
|
private var watchTarget = Vector3d.ZERO
|
||||||
private var remainingTicks = 0
|
private var remainingTicks = 0
|
||||||
|
|
||||||
init{
|
init{
|
||||||
@@ -37,7 +37,7 @@ class AIWatchDyingLeader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun resetTask(){
|
override fun resetTask(){
|
||||||
watchTarget = Vec3d.ZERO
|
watchTarget = Vector3d.ZERO
|
||||||
remainingTicks = 0
|
remainingTicks = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ class AIWatchIdleJumping(private val entity: EntityLiving, private val chancePer
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun shouldExecute(): Boolean{
|
override fun shouldExecute(): Boolean{
|
||||||
return entity.onGround && entity.rng.nextFloat() < chancePerTick
|
return entity.isOnGround && entity.rng.nextFloat() < chancePerTick
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun shouldContinueExecuting(): Boolean{
|
override fun shouldContinueExecuting(): Boolean{
|
||||||
@@ -28,7 +28,7 @@ class AIWatchIdleJumping(private val entity: EntityLiving, private val chancePer
|
|||||||
|
|
||||||
override fun tick(){
|
override fun tick(){
|
||||||
if (delayTicksRemaining > 0){
|
if (delayTicksRemaining > 0){
|
||||||
if (!entity.onGround){
|
if (!entity.isOnGround){
|
||||||
delayTicksRemaining = 0
|
delayTicksRemaining = 0
|
||||||
}
|
}
|
||||||
else if (--delayTicksRemaining == 0){
|
else if (--delayTicksRemaining == 0){
|
||||||
@@ -39,7 +39,7 @@ class AIWatchIdleJumping(private val entity: EntityLiving, private val chancePer
|
|||||||
else{
|
else{
|
||||||
super.tick()
|
super.tick()
|
||||||
|
|
||||||
if (entity.onGround){
|
if (entity.isOnGround){
|
||||||
delayTicksRemaining = 0
|
delayTicksRemaining = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
package chylex.hee.game.entity.living.behavior
|
package chylex.hee.game.entity.living.behavior
|
||||||
|
import chylex.hee.HEE
|
||||||
import chylex.hee.client.MC
|
import chylex.hee.client.MC
|
||||||
import chylex.hee.game.block.entity.TileEntitySpawnerObsidianTower
|
import chylex.hee.game.block.entity.TileEntitySpawnerObsidianTower
|
||||||
|
import chylex.hee.game.entity.dimensionKey
|
||||||
import chylex.hee.game.entity.effect.EntityTerritoryLightningBolt
|
import chylex.hee.game.entity.effect.EntityTerritoryLightningBolt
|
||||||
import chylex.hee.game.entity.living.EntityBossEnderEye
|
import chylex.hee.game.entity.living.EntityBossEnderEye
|
||||||
import chylex.hee.game.entity.living.behavior.EnderEyeAttack.LaserEye
|
import chylex.hee.game.entity.living.behavior.EnderEyeAttack.LaserEye
|
||||||
@@ -52,7 +54,6 @@ import net.minecraft.client.particle.DiggingParticle
|
|||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.util.SoundCategory
|
import net.minecraft.util.SoundCategory
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.dimension.DimensionType
|
|
||||||
import net.minecraftforge.common.util.INBTSerializable
|
import net.minecraftforge.common.util.INBTSerializable
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
@@ -97,7 +98,7 @@ sealed class EnderEyePhase : INBTSerializable<TagCompound>{
|
|||||||
else if (timer < 0){
|
else if (timer < 0){
|
||||||
val totalSpawners = entity.totalSpawners.toInt()
|
val totalSpawners = entity.totalSpawners.toInt()
|
||||||
|
|
||||||
if (totalSpawners == 0 || entity.dimension != DimensionType.THE_END){
|
if (totalSpawners == 0 || entity.dimensionKey !== HEE.dim){
|
||||||
return Floating.withScreech(entity, 0)
|
return Floating.withScreech(entity, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ import chylex.hee.system.serialization.use
|
|||||||
import chylex.hee.system.serialization.writeVec
|
import chylex.hee.system.serialization.writeVec
|
||||||
import net.minecraft.network.PacketBuffer
|
import net.minecraft.network.PacketBuffer
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.math.Vec3d
|
import net.minecraft.util.math.vector.Vector3d
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.common.util.INBTSerializable
|
import net.minecraftforge.common.util.INBTSerializable
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
@@ -46,7 +46,7 @@ class EnderEyeSpawnerParticles(private val entity: EntityBossEnderEye) : INBTSer
|
|||||||
hideOnMinimalSetting = false
|
hideOnMinimalSetting = false
|
||||||
)
|
)
|
||||||
|
|
||||||
class ParticleData(private val point: Vec3d) : IFxData{
|
class ParticleData(private val point: Vector3d) : IFxData{
|
||||||
override fun write(buffer: PacketBuffer) = buffer.use {
|
override fun write(buffer: PacketBuffer) = buffer.use {
|
||||||
writeVec(point)
|
writeVec(point)
|
||||||
}
|
}
|
||||||
@@ -59,8 +59,8 @@ class EnderEyeSpawnerParticles(private val entity: EntityBossEnderEye) : INBTSer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ParticleInstance(pos: Vec3d, delay: Int, private var originalDistanceXZ: Float) : INBTSerializable<TagCompound>{
|
private class ParticleInstance(pos: Vector3d, delay: Int, private var originalDistanceXZ: Float) : INBTSerializable<TagCompound>{
|
||||||
constructor() : this(Vec3d.ZERO, 0, 0F)
|
constructor() : this(Vector3d.ZERO, 0, 0F)
|
||||||
|
|
||||||
var pos = pos
|
var pos = pos
|
||||||
private set
|
private set
|
||||||
@@ -112,7 +112,7 @@ class EnderEyeSpawnerParticles(private val entity: EntityBossEnderEye) : INBTSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun deserializeNBT(nbt: TagCompound) = nbt.use {
|
override fun deserializeNBT(nbt: TagCompound) = nbt.use {
|
||||||
pos = Vec3d(
|
pos = Vector3d(
|
||||||
getDouble(X_TAG),
|
getDouble(X_TAG),
|
||||||
getDouble(Y_TAG),
|
getDouble(Y_TAG),
|
||||||
getDouble(Z_TAG)
|
getDouble(Z_TAG)
|
||||||
@@ -129,7 +129,7 @@ class EnderEyeSpawnerParticles(private val entity: EntityBossEnderEye) : INBTSer
|
|||||||
private val particles = mutableListOf<ParticleInstance>()
|
private val particles = mutableListOf<ParticleInstance>()
|
||||||
|
|
||||||
fun add(start: BlockPos){
|
fun add(start: BlockPos){
|
||||||
val center = Vec3d(start.x + 0.5, start.y.toDouble(), start.z + 0.5)
|
val center = Vector3d(start.x + 0.5, start.y.toDouble(), start.z + 0.5)
|
||||||
var delay = 0
|
var delay = 0
|
||||||
|
|
||||||
for(particle in particles){
|
for(particle in particles){
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user